Mail Archives: djgpp/1998/09/17/02:00:33
Thomas Luzat wrote:
> Hi there!
>
> I just wanted to start programming in C/C++ and downloaded DJGPP for
> this purpose. Everything is working fine, but I haven't figured out how
> to use inline assembler. That's what I wanted to convert from Turbo
> Pascal to DJGPP:
>
> asm
> mov ax,0003h;
> int 10h;
> end;
>
> I need just one sample to start. I can't figure out how to do it from
> the docs (maybe you can point me to the right one?)
>
> T.I.A.,
>
> Thomas Luzat
Easy. Assuming you are loading up some registers and calling a DOS
interrupt (looks like a video interrupt call to me :) ) heres how:
int FunctionThatSwitchesToTextModeHAHAHA(void)
{
__dpmi_regs r;
r.x.ax = 0x03;
__dpmi_int(0x10, &r);
// You can examine the __dpmi_regs structure after the call to see return
registers.
// Cheesy old BIOS int 10 interrupts never return failure though...
return 1; // Always succeeds
}
You should be able to adapt that to most DOS interrupt calls. Passing
pointers to blocks of memory is a different story...not what you asked for.
( I think that passing 0x13 in ax is a little more fun :)
- Raw text -