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 2,811 of 4,675   
   wolfgang kern to Kerr Mudd-John   
   Re: BASE64 again   
   13 Jul 17 19:08:22   
   
   From: nowhere@never.at   
      
   Kerr Mudd-John wrote:   
   ...   
   >>>>    ;put3:                 ; need cl=*0* on 1st run   
   >>>> 41          inc cx   
   >>>> 41          inc cx        ; need cl=8 for last; 'and' later   
   >>>> 98          cbw           ; clr ah reqd   
   >>>> D3E0        shl ax,cl     ; 2,4,6,8   
   >>>> 0865FF      or [di-1],ah  ; 'or' on top bits to prev; OK as 1st is 0   
   >>>> 80E106      and cl,0x06   ; 8->0. 2,4,6 ok   
   >>   ; could cmp al,0 or cmp cl,8 here & put the "and" at top but this   
   >>   costs 4 in 2:1 v 3 to clear cx.   
      
   if it works: cmp al,00 instead of and cl,06 sound good to me,   
   push bp/pop cx are only 2 bytes for me.   
      
   > cl=0 might even be free in SMC4:3   
      
   yes, cx=0 after the move, but needs to be cleared again.   
      
   >>>> 7401        jz nosave     ; jz not jcxz; saves fixup   
   >>>> AA          stosb         ; store these bits   
   >>>> nosave:   
   >>>> (gnc)   
   >>>   
   >>> good, I see   
   >>>   
   >>> 0fb  AC      lodsb   
   >>> 0fc  3C 3D   cmp al,3D   
   >>> 0FE  75 D5   jnz  0d5   
   >>>   
   >>> you saved three (six 2:1) bytes in the decoder part.   
   >>>   
   >>> 9 instead of 11 modify needs: d3,98,08e0,80,ff,06e1,aa01,ac,d5   
   >>> this are only 16 total instead of the 18 previous, and it make me   
   >>> think of adopting your much shorter decoder and direct SMC it. :)   
      
   > You can reduce the fixup count further for 1 byte extra:   
      
   >>>>    ;put3:                 ; need cl=*0* on 1st run   
   >>>> 41          inc cx   
   >>>> 41          inc cx        ; need cl=8 for last; 'and' later   
   >    4F          dec di   
   >>>> 98          cbw           ; clr ah reqd   
   >>>> D3E0        shl ax,cl     ; 2,4,6,8   
   >    08 25       or  [di],ah   
   >    47          inc di   
   >>>> 80E106      and cl,0x06   ; 8->0. 2,4,6 ok   
      
   good hint, this makes it two bytes shorter!   
      
   and then we can try to get rid of the nasty 80 with cmp al,0 to   
   save another byte to be used for push pb pop cx.   
   So our 'todays gain' is -2 -1 +2 = 1 saved byte, just kidding :)   
      
   > and 6 * dec ax instead of sub al,6 (cost 6-2,& saves 3 for fixup)   
   this will be one more byte in total.   
   __   
   wolfgang   
      
   --- 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