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 3,316 of 4,675   
   wolfgang kern to John   
   Re: Hex 2 Bin   
   23 Mar 18 09:36:42   
   
   From: nowhere@never.at   
      
   Kerr-Mudd,John wrote:   
   ..   
   > need to add cr lf space skipping   
      
   >>  and al,0x4f   
   >>  cmp al,0x40     ;any U/Lcase or Num   
   >>  jb +2           ;skip   
   >>  sub al,0x37     ;add 9 sub 0x40   
   >>                  ;al = 00..0F   
      
   > 10 bytes, with Jxx but no AAx   
   > ;; 1x becomes num           ; 0A 0D 20 30 41 61 66   
   >         or  al,0x20         ; 2A 2D 20 30 61 61 66   
   >         sub al,'a'-0x0A     ; D3 D6 C9 D9 0A 0A 0F  ; 0x57   
   >         jae havehex   
   >         add al,'a'-0x0A-'0' ;  -  -  -  0  x  x  x  ; 0x27   
   >         js  gnc             ; skip cr lf space   
   > havehex:   
      
   hard to make this any shorter and it may be faster than LUT   
   because it avoids memory access.   
   The skip check can't be implied into one branch without   
   SETcc or CMOVcc which may make the code faster but larger.   
   __   
   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