www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/12/04:30:31

Message-ID: <35D15066.F081F88@geocities.com>
From: Merlin <merlin__ AT geocities DOT com>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem with inline asm in DJGPP
References: <01bdc475$efbcfdc0$6559f482 AT s-64584>
Lines: 52
Date: Wed, 12 Aug 1998 08:23:51 GMT
NNTP-Posting-Host: 196-cy-wpg.ilos.net
NNTP-Posting-Date: Wed, 12 Aug 1998 03:23:51 CDT
Organization: MBnet Networking Inc.
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

The syntax for djgpp's asm is at&t style... you'll have to learn to use
it...or use nasm.. although at&t's it's not much different from
intels...pretty much just flip the source and dest.
to use asm you'll need to use:

asm("code goes here with \n separating each
line":outputs:intputs:modified registers/flags);

thats about it....

Tarad wrote:

> Hya, just begun learining assembler and tried to do this:
> ---=== asm.c ===---
> #include <conio.h>
> #include <stdio.h>
>
> int main()
> {
>    int xpos, ypos;
>
>    do
>    {
>       clrscr();
>
>       asm
>       {
>          MOV    AX,0x3
>          INT    0x33
>          MOV    xpos,CX
>          MOV    ypos,DX
>        }
>
>        printf("X position: %d",xpos);
>        printf("\nY position: %d",ypos);
>
>    }
>    while(!kbhit());
>
>    return 0;
> }
>
> And of course I got errors (like with everything I do it seems).
> asm.c: In function `main':
> asm.c:13: parse error before `{'
> asm.c: warning: unused variable `xpos'
>
> What's up now? Can't I use inline assembler in DJGPP?
> Thanks. :-)



- Raw text -


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