www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/12/04:02:38

Date: Mon, 12 Mar 2001 10:33:15 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: James Allan Ventura <javentura AT digitelone DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Problem with __asm and far* keywords
In-Reply-To: <001301c0aac3$843cdde0$72272a42@james>
Message-ID: <Pine.SUN.3.91.1010312102803.24860M-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 11 Mar 2001, James Allan Ventura wrote:

> I have a source code written in Microsoft C.  I tried to compile it using the
> GCC compiler and I get an error in the __asm and far* keywords.  Is there a way
> to modify the code so I can compile it in GCC?

Sections 18.12 and 17.8 of the DJGPP FAQ list deal with these problems; 
please read them.

> 62. void clearscreen() {
> 63. __asm {
> 64. mov ax,0f00h
> 65. int 010h
> 66. mov ah,0
> 67. int 010h
> 68. }
> 69. }

It's much easier to use the library function clrscr().

> 128. word portaddr(int n) {                      // base address of port LPTn
> 129. return(*(word far*)(0x00000408+2*n-2));
> 130. }

You should throw away `far', but your real problem here is that this code 
accessed absolute addresses in the BIOS data area.  The equivalent DJGPP 
code should use the _farpeekw library function.  See its documentation in 
the library reference manual.

- Raw text -


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