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,437 of 4,675   
   Kerr-Mudd,John to All   
   Re: DOS debug to com   
   13 Jun 18 16:58:01   
   
   From: notsaying@nospicedham.invalid.org   
      
   On Sun, 10 Jun 2018 11:36:21 GMT, "wolfgang kern"    
   wrote:   
      
   >  Kerr-Mudd,John wrote:   
   >   
   >>>> Having belatedly discovered GNU's xxd with it's -r option,   
   >>>> I've done a version for DOS.   
   >   
   >>>> If you can get the body of the hex into a com file, you can run the   
   >>>> program so you never need to do it again, IYSWIM. Caters for both   
   >>>> MS debug and grdb.   
   >   
   >>>> Uses DOS redirection, so not much use to you, Wolfgang.   
   >>>> (might wrap, lines are 78 long)   
   >   
   >>> Yes even it doesn't make any sense for me, I couldn't resist to   
   >>> spend 1/4h to translate it just for fun... and I see many branches   
   >>> here :)   
   >   
   >> Well here's a version that allows for larger files.   
   >> (it checks for a full line to 0A before processing it; if a partial   
   >> line it copies the part line and reads another buffer amount; oflw of   
   >> the output buffer similarly triggers a write). I could save the   
   >> duplicate read at the expense of a check on each line)   
   >   
   > DOS.com files occupy full 64KB (code, PSP and stack are lost for   
   > data). A common trick to work with a total of 64KB Data is to move the   
   > stack down (towards your code) and adjust DS/ES to point right after   
   > SS-top.   
   >   
   > if your code + PSP + stack fit 0x400 bytes then I'd use   
   > (perhaps better after cmdline check and text display)   
   >   
   >   mov sp,0x400  ;assume SS=CS   
   >   mov ax,cs     ;0x168d   
   >   add ax,0x40   ;0x16cd == 168d:0400   
   >   mov ds,ax     ;full 64K free there (ie source)   
   >   add ax,0x1000 ;0x26cd   
   >   mov es,ax     ;and another free 64KB here (ie destin).   
   >   
   > not to mention that FS and GS are available too ...   
      
   Thanks for those pointers (SIC!).   
      
   A definite problem with the code I posted was that it would have   
   overwritten the stack.   
   A fix with SP at 0x100 (reusing the PSP), and reading to/from an ES based   
   segment costs a few more bytes, but still within my limit of 0x200 of   
   code/text (just).   
      
   Ah well.   
      
      
   --   
   Bah, and indeed, Humbug.   
      
   --- 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