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,680 of 4,675   
   Rod Pemberton to Kerr Mudd-John   
   Re: smallest B64 decoder in ASCII asm   
   13 Jun 17 09:31:52   
   
   From: NeedNotReplyHere@nospicedham.xrsevnneqk.cem   
      
   On Tue, 13 Jun 2017 11:19:31 +0100   
   "Kerr Mudd-John"  wrote:   
      
   > On Thu, 08 Jun 2017 11:46:45 +0100, Terje Mathisen   
   >  wrote:   
      
   > > Guys, I would love to see you come up with a better 2:1 encoding   
   > > algorithm instead of the current micro-tweaking of the one I came   
   > > up with!   
   > >   
   > > There has to be more than one way to achieve full byte coverage,   
   > > XOR-SUB-SUB was more or less the first thing I came up with. :-)   
   > >   
   >   
   > I think I might save 4 bytes with a (shl (A xor B),1) xor B decoder,   
   > but I'm uncertain (the jmpback address goes to an invalid 5F from 61   
   > and the other 2 are in the 2B buffer anyhow) and it seems a lot of   
   > effort to create a whole new encoding table just for that.   
   >   
   ...   
      
   > I'd need a reasonable range of opcodes; might as well go for a full   
   > coverage.   
   >   
   > 2:1 is quite wasteful (7+7=14 bits->8; wastes 6/16=0.375)  I've been   
   > toying with a 3:2 (7+7+7=21->16 wastes 7/24=0.29166.), but can't see   
   > a simple algorithm.   
      
   If you have 7 bytes (8-bit), can't you just store the MSB for the 7   
   bytes in one 7-bit character?  You'd have 7 characters with the lower   
   7-bits of an 8-bit byte, and one character with the upper bits. AFAICT,   
   that would require two SHL and an RCR to implement.  One SHL on the   
   packed upper bits value to move the bit into the CF, and a SHL and RCR   
   on the 7-bit value to fill the MSB with the CF.  Is an instruction   
   sequence like this too long?  The SHL and RCR could also probably be   
   replaced with branch JC and XOR 80h.   
      
   This is 32-bit code, correct?  Has anyone looked at using AAM 10h (16)   
   with XLAT?  AAM would allow you to break a 7-bit character into   
   upper 3-bits and lower 4-bits, etc.  You could then use XLAT to convert   
   one or both of them into another, larger value, up to 8-bits.  Then,   
   perhaps, XOR or SUB the values together would create a larger range?   
      
   Or, maybe, AAM could be used to reduce the wasted bits for 2:1 XOR SUB   
   SUB?  I.e., use smaller values?   
      
      
   Rod Pemberton   
   --   
   The Paris Agreement is irrelevant. A carbon tax is futile. The only   
   solution is technology. Please tell Elon Musk that he is not being a   
   technology visionary.   
      
   --- 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