Mail Archives: djgpp/1998/08/06/02:01:41
On 5 Aug 98 at 12:53, Rylan wrote:
> In DJGPP's inline assembler format, how can I generate a BIOS int?
>
> If I cannot do it directly, how can I call __dpmi_int from an inline
> assembler function, i. e. how do I pass __dpmi_int the correct parameters
> while calling from inside an inline assembler statement?
>
> Please reply by email if at all possible.
__dpmi_int is just a function, so you pass parameters in the usual
way. For the parameters to __dpmi_int, which are nice parameters,
you just push them onto the stack, four bytes each, right-to-left,
and then do the (near) call:
movl _regs, %eax /* address of register block */
pushl %eax
movl $0x10, %eax /* interrupt number (example) */
pushl %eax
call ___dpmi_int /* (0x10, ®s) */
addl $8, %esp /* or popl twice */
/* now EAX is the return value */
Since you're calling GCC-compiled code (or rather, code written to
be called by GCC-compiled code) you must make sure the normal
assumptions hold, e.g. ES=DS=CS=SS. Also note that it can clobber
ECX, EDX, FS and GS without restoring them; if you care about their
values, save them (perhaps on the stack before pushing parameters).
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -