From: notsaying@nospicedham.invalid.org   
      
   "wolfgang kern" wrote in news:ok89hd$pah$1   
   @gioia.aioe.org:   
      
   > 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,   
      
   only for the jz; it should be ; the last shift of cl=8 empties al pshurely?   
   but we still need to reset cl from 8 to 0 but not if 2,4 or 6   
      
      
      
   > push bp/pop cx are only 2 bytes for me.   
   But we only want to reset it (cl) when cl reaches 8   
   my 3 bytes are 1 for "push bp" in plain and 2 for 2:1 "pop cx"   
      
      
   >   
   >> cl=0 might even be free in SMC4:3   
   >   
   > yes, cx=0 after the move, but needs to be cleared again.   
   >   
   It's OK to start, the "and cx,6" then clears ah after the save, but I see   
   you don't like the 80:   
      
   let's try   
   >   
   >>>>> ;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   
    AA stosb   
    3C 00 cmp al,0   
    75 03 jnz notlast   
    4F dec di ; undo   
    55 push bp   
    59 pop cx ; 8->0   
   notlast:   
   gnc: AC lodsb   
   ...   
      
   > 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.   
      
   but 1 less fixup, if needed for somewhere else.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|