Mail Archives: djgpp/1996/03/08/10:07:24
"Rafael R. Sevilla" <rsevilla AT upd DOT edu DOT ph> writes:
>And also another question. When we write an assembler routine in djgpp
>that is called by a C function, do the usual BP addressing techniques used
>in real mode DOS still work the same way? Does it still follow the large-
>model convention of BP+6 pointing to the first parameter after having
>pushed the old value of BP? Or must I use EBP to do the same thing, and
>therefore EBP+10 (the pushed EBP being 32 bits and all, plus the 48-bits
>of CS:EIP...)? This was one crucial issue which was not addressed by the
>FAQ at all. I've been writing such low-level interfaces to assembler for
>years, and I'd like to know how it's done in this new system.
Your first parameter is at %ebp+8 . Since DJGPP uses a flat memory
model, all code references are 'near' and hence %cs is not pushed. You
thus have %eip then %ebp on the stack when the main bit of your routine
gets going.
In general, you should not have to use section registers at all in your
code except for a few specialised applications (generally those using DOS
memory), and hence any real mode code you're trying to port will
probably require fairly extensive changes. Also, remember that the
default data sizes are 8 or 32 bits in PM, so avoid using 16-bit
registers if possible.
--
Mark Mackey http://www.ch.cam.ac.uk/MMRG/mdm.html
A magical cave, the empire of the ghost of shadows. A young man plays
with all his heart and soul upon a bizarre sound machine... - Yello
- Raw text -