www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/20/08:01:02

Message-ID: <3604F2ED.7C1BBA24@mailexcite.com>
Date: Sun, 20 Sep 1998 08:19:58 -0400
From: Doug Gale <dgale AT mailexcite DOT com>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: FW: Inline ASM
References: <01BDE216 DOT FEF3F280 AT mmolekwa DOT rrs DOT co DOT za>
NNTP-Posting-Host: oshawappp15.idirect.com
Organization: "Usenet User"
Lines: 50
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


Mthimkhulu Molekwa wrote:

> ----------
> From:   Endlisnis[SMTP:s257m AT unb DOT ca]
> Sent:   Wednesday, September 16, 1998 03:18
> To:     djgpp AT delorie DOT com
> Subject:        Re: Inline ASM
>
> 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?)
>
> >asm("movw 0x0003, %%ax;"
> >   "int $0x10;"
> >    : : "%eax");
> >
>
> Correct me if I'm wrong. Should the above code be:
>
> asm("movw $0x0003, %%ax\n\t"
>        "int $0x10\n\t"
>        : : "%eax");
>
> ===> replaced "0x0003" by "$0x0003" and ";" by "\n\t"
>

Yes, you have corrected the syntax. But look, the guy is obviously setting
the video mode to text mode. You have to use DPMI calls to do that in DJGPP!
You can't call a real mode interrupt in inline assembly!

And to do something invalid even better:
__asm__("int $0x10" : : "a" (3) : "%eax");

:)


- Raw text -


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