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,325 of 4,675    |
|    wolfgang kern to John    |
|    Re: Hex 2 Bin (1/2)    |
|    04 Apr 18 11:15:43    |
      From: nowhere@never.at              Kerr-Mudd,John wrote:              >>>> Criticisms welcome:              >> seems you like to test my abilities at the end of holydays, let me       >> check how long it takes me to figure by only using my brain :)              > Sorry, I only post when I'm reasonably happy with what I've got so far,       > not to vex you!              :) I have much fun with hex-anal-ice.              > But I did throw in the exponentiation at the last minute as I       > had about 20 bytes leftover.       > The "test for operator" is "if x jmp code", as a table lookup worked out at       > a few bytes longer. Adding AND XOR OR NOT would make it worthwhile, but       > then I've blown my self-imposed 256 byte limit.              Yeah, a LUT would be overkill. A bit reordering and CMOVcc, SETcc could       save some jumps.       I know you are after shortest solution, so slow and ugly dont care :)              > try again:       >       > minicalc.com              > BE8000AC9891E88D00724A954EAC3C20E1FB744150E87E0092587239982C2574       > 393C0674123C0874133C0574143C0A74293CFE7411EB1E9501D0EB2B9529D0EB       > 2695F7E2EB2189E85189D149F7E57205E2FA59EB12BAD001EB375389D39995F7       > F35B454D750192BFF901B16880FB10740AB12B09C07904F7D8B12D31D2F7F392       > 3C0A1C692F88054F9209C075EE880D575AB409CD21C3AC3C20E1FB7430BB0A00       > 3C687503B310AC55523C2D9C74014E31EDAC3C30720E244FD4379895F7E3720D       > 01C5E2ED959D7502F7D85A5DC358EBFA55736167652069733A2063616C63206E       > 756D31205B2B2D2A2F25235D206E756D320D0A242D242424242424       > (that's 3 less!)              good that you got rid of the 5-byte Jcc.       have you ever used the four byte Jcc 0f8x..?              > ->u100 l100       > 161D:0100 BE 80 00 mov si,0080       > 161D:0103 AC lodsb       > 161D:0104 98 cbw       > 161D:0105 91 xchg ax,cx       > 161D:0106 E8 8F 00 call 0198 ; getnum       > 161D:0109 72 4C jb 0157       > 161D:010B 95 xchg ax,bp       > 161D:010C 4E dec si       > 161D:010D AC lodsb       > 161D:010E 3C 20 cmp al,20       > 161D:0110 E1 FB loopzw 010D       > 161D:0112 74 43 jz 0157       > 161D:0114 50 push ax ; save operator       > 161D:0115 E8 80 00 call 0198 ; getnum       > 161D:0118 92 xchg ax,dx       > 161D:0119 58 pop ax       > 161D:011A 72 3B jb 0157       > testop:       > 161D:011C 98 cbw       > 161D:011D 2C 25 sub al,25       > 161D:011F 74 3B jz 015C       > 161D:0121 3C 06 cmp al,06       > 161D:0123 74 12 jz 0137       > 161D:0125 3C 08 cmp al,08       > 161D:0127 74 13 jz 013C       > 161D:0129 3C 05 cmp al,05       > 161D:012B 74 14 jz 0141       > 161D:012D 3C 0A cmp al,0A       > 161D:012F 74 2B jz 015C       > 161D:0131 3C FE cmp al,FE       > 161D:0133 74 11 jz 0146       > 161D:0135 EB 20 jmp 0157       > addnums:       > 161D:0137 95 xchg ax,bp       > 161D:0138 01 D0 add ax,dx       > 161D:013A EB 2D jmp 0169       > subnums:       > 161D:013C 95 xchg ax,bp       > 161D:013D 29 D0 sub ax,dx       > 161D:013F EB 28 jmp 0169       > mulnums:       > 161D:0141 95 xchg ax,bp       > 161D:0142 F7 E2 mul dx       > 161D:0144 EB 23 jmp 0169       > expnums:       > 161D:0146 89 E8 mov ax,bp       > 161D:0148 51 push cx       > 161D:0149 89 D1 mov cx,dx       > 161D:014B 49 dec cx       > 161D:014C F7 E5 mul bp       > 161D:014E 09 D2 or dx,dx       > 161D:0150 75 05 jnz 0157       > 161D:0152 E2 F8 loopw 014C       > 161D:0154 59 pop cx       > 161D:0155 EB 12 jmp 0169       > prtusage:       > 161D:0157 BA D2 01 mov dx,01D2       > 161D:015A EB 37 jmp 0193       > divmodnums:       > 161D:015C 53 push bx       > 161D:015D 89 D3 mov bx,dx       > 161D:015F 99 cwd       > 161D:0160 95 xchg ax,bp       > 161D:0161 F7 F3 div bx       > 161D:0163 5B pop bx       > 161D:0164 45 inc bp       > 161D:0165 4D dec bp       > 161D:0166 75 01 jnz 0169 ; if mod prt dx       > 161D:0168 92 xchg ax,dx       >       > prtnum:       > 161D:0169 BF FB 01 mov di,01FB       > 161D:016C B1 68 mov cl,68       > 161D:016E 80 FB 10 cmp bl,10       > 161D:0171 74 0A jz 017D       > 161D:0173 B1 2B mov cl,2B       > 161D:0175 09 C0 or ax,ax       > 161D:0177 79 04 jns 017D       > 161D:0179 F7 D8 neg ax       > 161D:017B B1 2D mov cl,2D       > 161D:017D 31 D2 xor dx,dx       > 161D:017F F7 F3 div bx       > 161D:0181 92 xchg ax,dx       > 161D:0182 3C 0A cmp al,0A       > 161D:0184 1C 69 sbb al,69       > 161D:0186 2F das       > 161D:0187 88 05 mov [di],al       > 161D:0189 4F dec di       > 161D:018A 92 xchg ax,dx       > 161D:018B 09 C0 or ax,ax       > 161D:018D 75 EE jnz 017D       > 161D:018F 88 0D mov [di],cl       > 161D:0191 57 push di       > 161D:0192 5A pop dx       > 161D:0193 B4 09 mov ah,09       > 161D:0195 CD 21 int 21       > 161D:0197 C3 ret       > getnum:       > 161D:0198 AC lodsb       > 161D:0199 3C 20 cmp al,20       > 161D:019B E1 FB loopzw 0198       > 161D:019D 74 30 jz 01CF       > 161D:019F BB 0A 00 mov bx,000A ; assume decimal       > 161D:01A2 3C 68 cmp al,68 ; 'h'       > 161D:01A4 75 03 jnz 01A9       > 161D:01A6 B3 10 mov bl,10 ; is hex       > 161D:01A8 AC lodsb       > 161D:01A9 55 push bp       > 161D:01AA 52 push dx       > 161D:01AB 3C 2D cmp al,2D ; -ve?       > 161D:01AD 9C pushfw       > 161D:01AE 74 01 jz 01B1       > 161D:01B0 4E dec si ;not minus, go back a char       > 161D:01B1 31 ED xor bp,bp       > 161D:01B3 AC lodsb       > 161D:01B4 3C 30 cmp al,30       > 161D:01B6 72 0E jb 01C6 ; end on <0       > 161D:01B8 24 4F and al,4F ; hex2bin       > 161D:01BA D4 37 aam 37       > 161D:01BC 98 cbw       > 161D:01BD 95 xchg ax,bp       > 161D:01BE F7 E3 mul bx              [continued in next message]              --- 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