delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/09/10:30:03

Date: Wed, 9 Jul 1997 07:29:10 -0700 (PDT)
Message-Id: <199707091429.HAA13600@adit.ap.net>
Mime-Version: 1.0
To: keijo DOT koivula AT pp DOT inet DOT fi
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Newbee question
Cc: djgpp AT delorie DOT com

>I'm kinda new with DJGPP and programming alike, and was just wondering
>how to link external (n)asm-modules with C/C++ code (I think it's done
>by just linking the external asm-modules with C/C++ -modules with GCC,
>but haven't had the courage to try it out 
Yep, that's how it works. Note that for C programs, your asm module will
have to use underlines in front of the C symbols it references (like `call
_printf'), and for C++ you'd better declare the asm symbols `extern "C"' in
your C++ source.
:P), learning AT&T syntax is
>frustrating and the TA2AS-syntax converter is somehow a bit weird... I
>can't even get it translate a simple display-type setting -piece of
>code (uh):
>
>mov ah, 0
>mov al,13h
>int 10h
>
>(what would that look like with AT&T syntax?)
Try this:
movb $0,%ah
movb $0x13,%ah
int $0x10

One problem with this (someone correct me if I'm wrong) is that the
interrupt will be generated in protected mode. If there is a protected-mode
handler for INT 10h (probably not too likely but possible), it will get
called instead of the usual INT 10h. To avoid this, you can use the
__dpmi_int function from C, which generates the interrupt in real mode.

HTH

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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