Mail Archives: djgpp/2001/03/12/04:02:38
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 -