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,279 of 4,675    |
|    wolfgang kern to John    |
|    Re: Hex to bin    |
|    17 Feb 18 16:00:18    |
      From: nowhere@never.at              Kerr-Mudd,John wrote:              >>> For education and amusement I hereby present clax with a 5:4 (base85)       >>> decoder for DOS! Same caveat; the 1st 2 lines (well up to and       >>> including the eeeee string) must be "as is", reflowing (cr,lf spaces)       >>> should be OK afterwards.              > actually removing the crlf is OK, but not inserting newlines. I'd       > forgotten that whilst my ret slide of "dec bp" is usually OK it could be       > an issue here; but I reset bp to 0 in the secondary stage anyway.       > []       >> I'll check on it, but give me some more time ...              > Sure; it is a bit complicated (at least to me!). I use bp::dx as a qword       > accumulator for the 5:4 decoding.              I couldn't fully figure all details so far. What I got is your decoder at       03d..07e and it seem to work (I had to stop on the first INT21 call).       a few questions:              * DEC BP JNO you want a branch always?       OV is only set on transitions from 8000 to 7FFF (opposite for INC) but not       from 0 to FFFF and reverse, I dont think that my debugger is wrong.              * XOR BH,[si] JNZ 06A ;if this isn't a 'branch never' it may act endless.              * EXCH AL,AH ;Big Endian encoded ?              perhaps you can save on one branch in the prologue: JB 0171 JA 0171       with a single JNE 0171.              Your encoder must be tricky to avoid some characters so your 5:4 format       can use 0x21..0x7D except quote marks (90 characters ?)              the use of 0x66 overrides may make the whole story easier ie:       ...       XOR eax,eax ;or if bp=0 : push bp bp pop eax       LODSB ;check/skip/end       ...       IMUL ebx,eax,0x55       ADD [di],ebx       ... ;inner loop for powers 4,3,2,1       fifth:       ADD [di],eax       INC di dup 4       ... ;loop until end mark       __       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