home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,556 of 4,675   
   Kerr-Mudd, John to Terje Mathisen   
   Re: Rot13 for DOS   
   25 Jan 23 17:02:43   
   
   XPost: comp.os.msdos.programmer, alt.lang.asm   
   From: admin@nospicedham.127.0.0.1   
      
   On Wed, 25 Jan 2023 15:03:26 +0100   
   Terje Mathisen  wrote:   
      
   > Kerr-Mudd, John wrote:   
   > > Finally, a rot13 program for DOS that's smaller than the standard version   
   > > with jumps:   
   > >   
   > >   
   > > ->u 100 l2E   
   > > 1637:0100 B6 02          mov          dh,02   
   dirty save of 1 byte by not fully specifying the IOAREA   
      
   > > 1637:0102 B4 3F          mov          ah,3F   
   > > 1637:0104 89 C1          mov          cx,ax   
   dirty save of 1 byte by not fully specifying the IOAREA_Lth   
      
   > > 1637:0106 CD 21          int          21   
   > > 1637:0108 89 D6          mov          si,dx   
   > > 1637:010A 91             xchg         ax,cx   
   > > 1637:010B E3 20          jcxzw        012D   
   > > 1637:010D 51             push         cx   
   >   
   > The loop starts here of course!   
   >   
   > > 1637:010E AC             lodsb   
   > > ; main rot13 rtn   
   > > 1637:010F 24 DF          and          al,DF   
   > Folding to lowercase ascii   
   > > 1637:0111 2C 41          sub          al,41   
   > > 1637:0113 3C 1A          cmp          al,1A   
   > Checking that it was in-range   
   > > 1637:0115 18 E4          sbb          ah,ah   
   > > 1637:0117 3C 0D          cmp          al,0D   
   >   
   > Very nice, handling plus/minus for upper and lower case!   
   >   
   > > 1637:0119 D6             salc   
   > > 1637:011A 25 1A F3       and          ax,F31A   
   > > 1637:011D 00 E0          add          al,ah   
   > > 1637:011F 00 44 FF       add          [si-01],al   
   > >   
   > > 1637:0122 E2 EA          loopw        010E   
   > > 1637:0124 59             pop          cx   
   > > 1637:0125 43             inc          bx   
   > > 1637:0126 B4 40          mov          ah,40   
   > > 1637:0128 CD 21          int          21   
   > > 1637:012A 4B             dec          bx   
   > > 1637:012B EB D5          jmp          0102   
      
   > > 1637:012D C3             ret   
   > > ->          d 100 l2E   
   > > 1637:0100 B6 02 B4 3F-89 C1 CD 21-89 D6 91 E3-20 51 AC 24  ...?...!.... Q.$   
   > > 1637:0110 DF 2C 41 3C-1A 18 E4 3C-0D D6 25 1A-F3 00 E0 00  .,A<...<..%.....   
   > > 1637:0120 44 FF-E2 EA 59 43-B4 40 CD 21-4B EB D5 C3        D...YC.@.!K...   
   > > ->          q   
   > >   
   >   
      
   TYVM, It's appreciated, especially from you.   
      
   simpler? version; hardcoded IOAREA, rotamt in dl   
   ->u 100 l2E   
   1637:0100 BA 0D 1A       mov          dx,1A0D   
   1637:0103 B4 3F          mov          ah,3F   
   1637:0105 89 C1          mov          cx,ax   
   1637:0107 CD 21          int          21   
   1637:0109 89 D6          mov          si,dx   
   1637:010B 91             xchg         ax,cx   
   1637:010C E3 1F          jcxzw        012D   
   1637:010E 51             push         cx   
   1637:010F AC             lodsb   
      
   1637:0110 24 DF          and          al,DF   
   1637:0112 2C 41          sub          al,41   
   1637:0114 38 D0          cmp          al,dl   
   1637:0116 18 E4          sbb          ah,ah   
   1637:0118 38 F0          cmp          al,dh   
   1637:011A D6             salc   
   1637:011B 21 D0          and          ax,dx   
   1637:011D 28 C4          sub          ah,al   
   1637:011F 00 64 FF       add          [si-01],ah   
      
   1637:0122 E2 EB          loopw        010F   
   1637:0124 59             pop          cx   
   1637:0125 43             inc          bx   
   1637:0126 B4 40          mov          ah,40   
   1637:0128 CD 21          int          21   
   1637:012A 4B             dec          bx   
   1637:012B EB D6          jmp          0103   
   1637:012D C3             ret   
   ->          d 100 l2E   
   1637:0100 BA 0D 1A B4-3F 89 C1 CD-21 89 D6 91-E3 1F 51 AC  ....?...!.....Q.   
   1637:0110 24 DF 2C 41-38 D0 18 E4-38 F0 D6 21-D0 28 C4 00  $.,A8...8..!.(..   
   1637:0120 64 FF E2 EB-59 43 B4 40-CD 21 4B EB-D6 C3        d...YC.@.!K...   
   ->          q   
      
      
      
   Sad there's no^w little interest in x86 asm these days, but I suppose such   
   things might have been "hot" 40 years ago.   
      
   (Modesty forbids me from adding "me too!")   
      
   --   
   Bah, and indeed Humbug.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca