www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/17/02:00:33

Message-ID: <3600A5F0.92FBA21B@mailexcite.com>
Date: Thu, 17 Sep 1998 02:02:25 -0400
From: Doug Gale <dgale AT mailexcite DOT com>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Inline ASM
References: <35FE8291 DOT 37810D2D AT gmx DOT net>
NNTP-Posting-Host: oshawappp23.idirect.com
Organization: "Usenet User"
Lines: 48
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019