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,875 of 4,675   
   Terje Mathisen to James Harris   
   Re: Look back to "just for the H@ck"   
   20 Jul 17 12:57:15   
   
   From: terje.mathisen@nospicedham.tmsw.no   
      
   James Harris wrote:   
   > On 19/07/2017 21:25, Terje Mathisen wrote:   
   >> In my code I added one more (strong!) limitation: I wanted to write   
   >> a primary decoder that would work with as little self-modification   
   >> as possible, so when I figured out a way that only needed to fixup   
   >> the absolute minimum (a single short (two-byte)) backwards branch   
   >> instruction) I called it a day.   
   >   
   > So the only thing you "self-modify" is a branch offset? That's   
   > /definitely/ cool. I always hated self-modifying code. But branch   
   > offsets have to be legit as it's very similar to doing the work of a   
   > linker.   
      
   I actually SM the branch instruction as well, because my target is an   
   array of pseudo-NOP 'E's, in order to allow reflow/changing line   
   terminator lengths.   
      
   >   
   > Interesting you mention imposing an additional limitation on   
   > yourself. If I had a go at it I'd be itching to add some of my own.   
   > Things like   
   >   
   > * A subsequent run from the start must also work.   
      
   That already works since the payload is moved to the normal CS:100   
   offset before being executed.   
   >   
   > * Need to cope with CR and LF at any point (after the first N bytes,   
   > for some reasonable N).   
      
   Yes indeed: My original code can handle arbitrary white space   
   insertion/deletion at any point after the first two lines (each of 64   
   chars, and the boundary between those two lines can be any zero, one or   
   two-byte sequence.   
   >   
   > * Only 8086 instructions.   
      
   Doable, but not within Base64 character set.   
   >   
   > * Not rely on [SP] being zero - in case of non-compliant environment.   
   > (I haven't found the .COM spec but from what people have said I guess   
   > that that 16-bit word is supposed to be zero ... perhaps so that a   
   > near return gets to CS:0 which is termination code.)   
      
   Impossible! [SP] == 0 is an absolute requirement for all COM files,   
   otherwise the one-byte RET program wouldn't work.   
   >   
   > Maybe others have done some of that. In any case, I am not   
   > volunteering ... the challenge already looks more than hard enough.   
   > Now I know what it was about I wish I'd followed from the beginning.   
      
   It was even more fun back in 1995 when I didn't know if it was even   
   possible. :-)   
      
   Terje   
      
   --   
   -    
   "almost all programming can be viewed as an exercise in caching"   
      
   --- 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