Mail Archives: djgpp/1995/08/27/16:17:08
I'm still trying to get *any* program using the sys/farptr functions
working with optimizations switched in.
The following program gives -most times but not always- the following
error message when a -O? option is used:
c:/djgpp/include/sys/farptr.h: In function `main':
c:/djgpp/include/sys/farptr.h:159: `asm' operand constraint incompatible with operand size
Please can someone help me to preserve any sanity I might have left ?
:-))
The program:
/* Graphics test program */
#include <dos.h>
#include <go32.h>
#include <dpmi.h>
#include <stdio.h>
#include <sys/farptr.h>
int main( void )
{
short x, y;
_go32_dpmi_registers regs;
unsigned long address, offset;
/* Schakel naar VGA */
regs.x.ax = 0x0012;
regs.x.flags = regs.x.ss = regs.x.sp = 0;
_go32_dpmi_simulate_int( 0x10, ®s );
/* Draw differently colored vertical bands on the screen */
for (x = 0; x < 640; x++) {
/* Set color */
outportb( 0x03c4, 2);
outportb( 0x03c5, (x / 40) & 0x0F );
/* Set bitmask */
outportb( 0x03ce, 8 );
outportb( 0x03cf, 0x80 >> ( x & 7 ) );
/* Draw vertical line */
offset = 0xa0000 + (x >> 3);
_farsetsel( _go32_conventional_mem_selector() );
for (y = 0; y < 480; y++) {
address = offset + y * 80;
_farnspeekb( address );
_farnspokeb( address, 0xff );
}
}
/* Wait for <Enter> */
getchar();
/* Return to text mode */
regs.x.ax = 0x0003;
regs.x.flags = regs.x.ss = regs.x.sp = 0;
_go32_dpmi_simulate_int( 0x10, ®s );
/* Done */
return 0;
}
- Raw text -