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,565 of 4,675   
   Alexei A. Frounze to R.Wieser   
   Re: EXE program stack setup questions   
   08 Oct 18 02:43:29   
   
   From: alexfrunews@nospicedham.gmail.com   
      
   On Monday, October 8, 2018 at 1:28:18 AM UTC-7, R.Wieser wrote:   
   > Alexei,   
   >   
   > > Here's mine:   
   > > 000: 4D 5A 40 00 02 00 00 00 ? 20 00 00 01 FF FF 00 00   
   > > 010: 40 10 00 00 00 00 00 00 ? 3E 00 00 00 01 00 FB 30   
   > > 020: 6A 72 00 00 00 00 00 00 ? 00 00 00 00 00 00 00 00   
   > >...   
   > > 200: 8C C8 8E D8 8E C0 50 53 ? E8 08 00 83 C4 04 B8 00   
   > > 210: 4C CD 21 55 8B EC 83 EC ? 10 53 56 57 8D 7E F0 B9   
   >   
   > And this is mine:   
   > 000 4D 5A EB 00 03 00 00 00 20 00 91 00 FF FF 2F 00   
   > 010 00 01 00 00 00 00 00 00 3E 00 00 00 01 00 FB 71   
   > 020 6A 72 00 00 00 00 00 00 00 00 00 00 00 00 00 00   
   > ....   
   > 200 2E 8C 0E D0 00 2E 8C 16 D2 00 2E 89 26 D4 00 2E   
   > 210 8C 1E D6 00 2E 89 36 D8 00 2E 8C 06 DA 00 2E 89   
   >   
   > (guess how I got my register values :-) )   
      
   I asked you specifically to use my code in the   
   experiment. If there's a significant or any difference   
   in tasm/tlink behavior, I'll see it. Please use mine.   
      
   Reposting it:   
   ----8<---   
    file: tiny0.asm   
    assemble & link:   
      tasm tiny0.asm   
      tlink tiny0.obj   
      
   myseg segment para stack 'stack' use16   
       assume cs:myseg, ds:myseg, es:myseg, ss:myseg   
   start:   
       mov     ax, cs   
       mov     ds, ax   
       mov     es, ax   
      
       push    ax   
       push    bx   
       call    SomeFunction   
       add     sp, 4   
      
       mov     ax, 4c00h   
       int     21h   
      
   SomeFunction proc C   
     arg @@wArg1:WORD,@@wArg2:WORD   
     uses bx,si,di   
     local @@bBuffer[16]:BYTE   
       lea     di, @@bBuffer   
       mov     cx, 16   
       xor     al, al   
       cld   
       rep     stosb   
       mov     ax, @@wArg1   
       add     ax, @@wArg2   
       ret   
   SomeFunction endp   
      
       align 16   
       db 4096 dup (?)   
   myseg ends   
      
   end start   
   ----8<---   
      
   > > This line   
   > >  myseg segment para stack 'stack' use16   
   > > tells tasm that myseg *is* *the* stack segment.   
   >   
   > Look at the above dumps, and compare the bytes at 0Eh...0Fh.   Your   
   > assembler / linker keeps the SS offset at Zero (and probably sets SP to the   
   > programs memory size), while mine changes it to match the defined stack   
   > segment (with SP the size of that segment).    Which I have been telling you   
   > from the start and have been repeating thruout our conversation.  Why did   
   > you refuse to accept it ?   
      
   Hold on. How many segments does your code define?   
   Mine defines one and only myseg, which serves as   
   code, data and stack simultaneously. In this case   
   however you slice it or dice it, it's unlikely to   
   get the SS value any different than 0 in the .EXE   
   header and the SP value any different than the   
   segment/program size (both being the same thing   
   since there's just one segment).   
      
   Alex   
      
   --- 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