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,559 of 4,675    |
|    Rick C. Hodgin to R.Wieser    |
|    Re: EXE program stack setup questions    |
|    07 Oct 18 15:47:33    |
      From: rick.c.hodgin@gmail.com              On 10/07/2018 03:10 PM, R.Wieser wrote:       > Rick C. Hodgin wrote:       >> IIRC, in such a model, typically the stack is initialized to the top of       >> the indicated segment,       >       > I take it that you mean SS when you say "indicated segment".              I'm referring to the block of data that's in use. When the       segment registers are all the same, it's allocating into a       single 64 KB block beginning at the 20-bit address specified       by the real mode address generation algorithm.              > But if that       > is so than SS gets also initialized to that segment, which (thus) isn't the       > SS=CS situation. At least, that is what happens under Borlands Tasm and       > Tlink.              I don't understand. The TINY memory model is, by definition,       using everything in a single 64 KB block, which is one seg-       ment. CS should be the same as DS, ES, and SS.              > I described the problem(s) with that in situation #2.       >       >> It should be handled for you automatically by the program loader.       >       > It is. Just not in a way that is usable for me: either with SS != CS -or-       > with SP = zero.              I think that's an error in the loader, or there's some       startup code being injected by TASM to handle some kind       of "fixup" at startup.              > In fact, that is what my question is all about: Do you, or anyone else, know       > a way to set up the stack in such a way that SS will equal CS and SP will       > point at the top of the defined stack space / end of the programs       > uninitialized memory (either will work for me).              If I recall correctly, you can set it up that way manually       (from memory, untested):               sti        mov AX,CS        mov SS,AX        mov sp,0fffeh        cli              --       Rick C. Hodgin              --- 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