delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/09/13/12:12:49

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX18Fm3pjjusFM9fl9eyjOTNTUNo1OUCiCEp6EaN3eP
gheBCcvKyK1TRI
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
To: djgpp AT delorie DOT com
Subject: inline assemby question
Date: Thu, 13 Sep 2007 18:22:23 +0200
User-Agent: KMail/1.9.5
MIME-Version: 1.0
Message-Id: <200709131822.23799.juan.guerrero@gmx.de>
X-Y-GMX-Trusted: 0

I have tried to compile freebe12 using gcc 4.2.1 and binutils 2.17.
I have also applied the patch proposed by Robert Riebisch some time
ago.  The compilation of the cirrus54 driver fails with the following
error message:

make.exe[1]: Entering directory `d:/p/srcs/contrib/freebe/cirrus54'
gcc -O3 -m486 -fomit-frame-pointer -Wall -Werror -I.. -MMD -o driver.o -c driver.c
driver.c: In function 'SrcTransBltSys32MMIO':
driver.c:1309: error: can't find a register in class 'DREG' while reloading 'asm'
driver.c:1309: error: 'asm' operand has impossible constraints
make.exe[1]: *** [driver.o] Error 1
make.exe[1]: Leaving directory `d:/p/srcs/contrib/freebe/cirrus54'
make.exe: *** [cirrus54/vbeaf.drv] Error 2


The inline assembly code follows:

#define SrcTransBltSysMacro(mmio,bpp,pixmode)\
void SrcTransBltSys##bpp##mmio(AF_DRIVER *af, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent)\
{                                         \
  unsigned long pdst;                     \
  int bltmode,bltrop;                     \
					  \
  width*=(bpp/8);width--;height--;        \
  srcLeft*=(bpp/8);dstLeft*=(bpp/8);      \
  waitidle##mmio();                       \
  need_wait=1;                            \
  dstTop += af_active_page*af_height;     \
  pdst = dstTop * af_width + dstLeft;     \
  bltrop=af_mix_fore(op);                 \
  bltmode=CIR_BLT_MEM|CIR_BLT_TRANS|pixmode;\
  SET_ROP_MODE##mmio(bltrop,bltmode);     \
  SET_WIDTH_HEIGHT##mmio(width,height);   \
  SET_TRANS##mmio((int)transparent);      \
  SET_SRCADDR##mmio(0);                   \
  SET_DSTADDR##mmio(pdst);                \
  CIR_CMD(CIR_CMD_RUN);                   \
  width++;height++;                       \
  __asm__ __volatile__ ("                 \
      cld;                                \
  1:;                                     \
      pushl %%edi;                        \
      pushl %%ecx;                        \
      rep; movsl;                         \
      movsw;                              \
      movsw;                              \
      popl  %%ecx;                        \
      addl  %%ebx,%%esi;                  \
      popl  %%edi;                        \
      decl  %%edx;                        \
      jnz   1b;                           \
      "                                   \
      :                                   \
      :"S" (srcAddr+srcTop*srcPitch+srcLeft), "D" (af_linear?af->LinearMem:af->BankedMem),  "b" (srcPitch-((width-1)&0xfffffffc)-4), "c" ((width-1)>>2), "d" (height)\
      :"eax","ebx","ecx","edx","esi","edi","cc"\
      );                                  \
}

SrcTransBltSysMacro(,8,CIR_BLT_PIX8)
SrcTransBltSysMacro(,16,CIR_BLT_PIX16)
SrcTransBltSysMacro(,24,CIR_BLT_PIX24)
SrcTransBltSysMacro(,32,CIR_BLT_PIX32)

SrcTransBltSysMacro(MMIO,8,CIR_BLT_PIX8)
SrcTransBltSysMacro(MMIO,16,CIR_BLT_PIX16)
SrcTransBltSysMacro(MMIO,24,CIR_BLT_PIX24)
SrcTransBltSysMacro(MMIO,32,CIR_BLT_PIX32)  //  This is line 1309




My inline assembly and GAS skills are to limited to solve this issue.
May be some one else has a good suggestion how to fix this.

Only for the realy interested people I submit the actual patch.
This patch includes the modifications proposed by Robert.


Regards,
Juan M. Guerrero



2007-09-12  Juan Manuel Guerrero  <juan DOT guerrero AT gmx DOT de>

	* mach64/driver.c: Fix wrong use of ## in PutMonoImageMacro macro.


2007-09-10  Juan Manuel Guerrero  <juan DOT guerrero AT gmx DOT de>

	* cirrus54/driver.c: Fix wrong use of ## in PutMonoImageMacro macro.
	Fix wrong use of ## in SetupMacro macro.

	* mach64/driver.c (SetBank32): Quote every asm line with ".
	(SetBank): Quote every asm line with ".



2007-09-09  Juan Manuel Guerrero  <juan DOT guerrero AT gmx DOT de>

	Patch to compile freebs12 with gcc 4.2.1, binutils 2.17
	and djdev203 and djdev204.  The things that I have changed
	are documentated in this changelog.  The original patch is
	*not* from me, it has been taken from:
	<http://www.bttr-software.de/forum/forum_entry.php?id=358>
	The original patch is also stored in /djgpp as:
	http://www.bttr-software.de/misc/freebe12_gcc4_patch.zip

	* ati/driver.c: Include <string.h> for declaration of memcmp().
	(SetBank32): Quote every asm line with ".

	* avance/driver.c (GetVideoModeInfo): Fix difference in signedness of
	pointer targets.
	(SetBank32): Quote every asm line with ".

	* cirrus54/driver.c: Fix wrong use of ## in WaitMacro macro.
	Fix wrong use of ## in copymonomacro macro.
	Fix wrong use of ## in copycolormacro macro.
	Fix wrong use of ## in DrawScanMacro macro.
	Fix wrong use of ## in DrawPattScanMacro macro.
	Fix wrong use of ## in DrawPattRectMacro macro.
	Fix wrong use of ## in DrawColorPattScanMacro macro.
	Fix wrong use of ## in DrawRectMacro macro.
	Fix wrong use of ## in DrawColorPattRectMacro macro.
	Fix wrong use of ## in BitBltMacro macro.
	Fix wrong use of ## in SrcTransBltMacro macro.
	Fix wrong use of ## in BitBltSysMacro macro.
	Fix wrong use of ## in SrcTransBltSysMacro macro.
	(SetBank32): Quote every asm line with ".
	(SetBank): Quote every asm line with ".
	(SetCursorPos): Quote every asm line with ".
	(shiftleft): Quote every asm line with ".




diff -aprNU3 freebe.orig/ati/driver.c freebe/ati/driver.c
--- freebe.orig/ati/driver.c	1998-12-21 20:52:42 +0000
+++ freebe/ati/driver.c	2007-09-11 23:51:04 +0000
@@ -19,6 +19,7 @@
 
 
 #include <pc.h>
+#include <string.h>
 
 #include "vbeaf.h"
 
@@ -563,41 +564,41 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *  Relocatable bank switch function, called with a bank number in %edx.
  */
 
-asm ("
+asm (
 
-   .globl _SetBank32, _SetBank32End
+   ".globl _SetBank32, _SetBank32End\n\t"
 
-      .align 4
-   _SetBank32:
-      pushl %edx
-      pushl %eax
-      movl %edx, %eax
-      movb %al, %ah              /* save al into ah */
-
-      movl _ati_port, %edx       /* read port 1CE index 0xB2 */
-      movb $0xB2, %al
-      outb %al, %dx 
-      incl %edx
-      inb %dx, %al
-      decl %edx
-
-      andb $0xE1, %al            /* mask out bits 1-4 */
-      shlb $1, %ah               /* shift bank number */
-      orb %al, %ah 
-
-      movb $0xB2, %al            /* write to port 1CE index 0xB2 */
-      outb %al, %dx
-      incl %edx
-      movb %ah, %al
-      outb %al, %dx
-
-      popl %eax
-      popl %edx
-      ret
+     ".align 4\n\t"
+  "_SetBank32:\n\t"
+     "pushl %edx\n\t"
+     "pushl %eax\n\t"
+     "movl %edx, %eax\n\t"
+     "movb %al, %ah              /* save al into ah */\n\t"
+
+     "movl _ati_port, %edx       /* read port 1CE index 0xB2 */\n\t"
+     "movb $0xB2, %al\n\t"
+     "outb %al, %dx \n\t"
+     "incl %edx\n\t"
+     "inb %dx, %al\n\t"
+     "decl %edx\n\t"
+
+     "andb $0xE1, %al            /* mask out bits 1-4 */\n\t"
+     "shlb $1, %ah               /* shift bank number */\n\t"
+     "orb %al, %ah \n\t"
+
+     "movb $0xB2, %al            /* write to port 1CE index 0xB2 */\n\t"
+     "outb %al, %dx\n\t"
+     "incl %edx\n\t"
+     "movb %ah, %al\n\t"
+     "outb %al, %dx\n\t"
+
+     "popl %eax\n\t"
+     "popl %edx\n\t"
+     "ret\n\t"
 
-   _SetBank32End:
+  "_SetBank32End:\n\t"
 
-");
+);
 
 
 
diff -aprNU3 freebe.orig/avance/driver.c freebe/avance/driver.c
--- freebe.orig/avance/driver.c	1998-12-11 23:17:14 +0000
+++ freebe/avance/driver.c	2007-09-11 23:51:04 +0000
@@ -549,10 +549,10 @@ long GetVideoModeInfo(AF_DRIVER *af, sho
 
 	get_field_data (
 		info->bpp,
-		&modeInfo->RedMaskSize, &modeInfo->RedFieldPosition,
-		&modeInfo->GreenMaskSize, &modeInfo->GreenFieldPosition,
-		&modeInfo->BlueMaskSize, &modeInfo->BlueFieldPosition,
-		&modeInfo->RsvdMaskSize, &modeInfo->RsvdFieldPosition
+		(char *)(void *)&modeInfo->RedMaskSize,   (char *)(void *)&modeInfo->RedFieldPosition,
+		(char *)(void *)&modeInfo->GreenMaskSize, (char *)(void *)&modeInfo->GreenFieldPosition,
+		(char *)(void *)&modeInfo->BlueMaskSize,  (char *)(void *)&modeInfo->BlueFieldPosition,
+		(char *)(void *)&modeInfo->RsvdMaskSize,  (char *)(void *)&modeInfo->RsvdFieldPosition
 	);
 
 	/* for linear video modes, fill in these variables: */
@@ -859,30 +859,30 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *  function out, but you may have problems running other VBE/AF 
  *  applications if you don't provide it.
  */
-asm ("
+asm (
 	#
-	.globl _SetBank32, _SetBank32End
+	".globl _SetBank32, _SetBank32End\n\t"
 
-		.align 4
-	_SetBank32:
+		".align 4\n\t"
+	"_SetBank32:\n\t"
 
-		pushal
+		"pushal\n\t"
 
-		andl $0x1F, %edx                    # Bank numbers are 5-bit
-		movl %edx, %eax
+		"andl $0x1F, %edx                    # Bank numbers are 5-bit\n\t"
+		"movl %edx, %eax\n\t"
 
-		movl $0x3d6, %edx                   # 0x3d6 = read bank select port
-		outb %al, %dx
+		"movl $0x3d6, %edx                   # 0x3d6 = read bank select port\n\t"
+		"outb %al, %dx\n\t"
 
-		movl $0x3d7, %edx                   # 0x3d7 = r/w bank select port
-		outb %al, %dx
+		"movl $0x3d7, %edx                   # 0x3d7 = r/w bank select port\n\t"
+		"outb %al, %dx\n\t"
 
-		popal
-		ret
+		"popal\n\t"
+		"ret\n\t"
 
-	_SetBank32End:
+	"_SetBank32End:\n\t"
 	#
-");
+);
 
 
 /* SetBank:
diff -aprNU3 freebe.orig/cirrus54/driver.c freebe/cirrus54/driver.c
--- freebe.orig/cirrus54/driver.c	1999-06-04 21:51:40 +0000
+++ freebe/cirrus54/driver.c	2007-09-12 00:15:32 +0000
@@ -337,23 +337,23 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *  applications if you don't provide it.
  *
  */
-asm ("
+asm (
 
-   .globl _SetBank32, _SetBank32End
+  ".globl _SetBank32, _SetBank32End\n\t"
 
-      .align 4
-   _SetBank32:
-     pushl %edx          /* I have 16K bank gran, but driver probably */
-     movb %dl,%ah        /* don't know about that, so I must multiply by 4 */
-     shlb $2,%ah
-     movl $0x3CE, %edx
-     movb $9, %al
-     outw %ax, %dx
-     popl %edx
-     ret
-   _SetBank32End:
+     ".align 4\n\t"
+  "_SetBank32:\n\t"
+    "pushl %edx          /* I have 16K bank gran, but driver probably */\n\t"
+    "movb %dl,%ah        /* don't know about that, so I must multiply by 4 */\n\t"
+    "shlb $2,%ah\n\t"
+    "movl $0x3CE, %edx\n\t"
+    "movb $9, %al\n\t"
+    "outw %ax, %dx\n\t"
+    "popl %edx\n\t"
+    "ret\n\t"
+  "_SetBank32End:\n\t"
 
-");
+);
 
 /* SetBank:
  *  C-callable bank switch function. This version simply chains to the
@@ -364,12 +364,12 @@ asm ("
  */
 void SetBank(AF_DRIVER *af, long bank)
 {
-  asm("
-     movb %%al,%%ah
-     shlb $2,%%ah
-     movl $0x3CE, %%edx
-     movb $9, %%al
-     outw %%ax, %%dx"
+  asm(
+    "movb %%al,%%ah\n\t"
+    "shlb $2,%%ah\n\t"
+    "movl $0x3CE, %%edx\n\t"
+    "movb $9, %%al\n\t"
+    "outw %%ax, %%dx"
      ::"a" (bank):"%dx");
    af_bank = bank;
 }
@@ -559,15 +559,15 @@ inline void waitidleMMIO()
  *  Delay until the hardware controller has finished drawing.
  */
 
-#define WaitMacro(bpp) \
-void WaitTillIdle##bpp##(AF_DRIVER *af)           \
+#define WaitMacro(bpp)                            \
+void WaitTillIdle##bpp(AF_DRIVER *af)             \
 {                                                 \
   if (need_wait) {                                \
     outportb(GRX,0x31);                           \
     while (inportb(GRX+1)&1);                     \
     need_wait=0;                                  \
   }                                               \
-  SET_FG##bpp##(0);                               \
+  SET_FG##bpp(0);                                 \
 }
 
 WaitMacro(8)
@@ -575,7 +575,7 @@ WaitMacro(16)
 WaitMacro(24)
 WaitMacro(32)
 
-#define WaitMacroMMIO(bpp)           \
+#define WaitMacroMMIO(bpp)                        \
 void WaitTillIdle##bpp##MMIO(AF_DRIVER *af)       \
 {                                                 \
   if (need_wait) {                                \
@@ -655,13 +655,13 @@ int last_mono_x,last_mono_y;
 int last_color_x,last_color_y;
 
 
-#define copymonomacro(mmio,bpp)        \
-void copymonopattern##bpp####mmio##(AF_DRIVER *af,int x,int y)\
+#define copymonomacro(mmio,bpp)                                         \
+void copymonopattern##bpp##mmio(AF_DRIVER *af,int x,int y)              \
 {                                                                       \
    int i;                                                               \
    unsigned char *p;                                                    \
 									\
-   SET_FG##bpp####mmio##(0);                                            \
+   SET_FG##bpp##mmio(0);                                                \
    if ((last_mono_y!=(y&7))||(last_mono_x!=(x&7))) {                    \
      last_mono_y=y&7;                                                   \
      last_mono_x=x&7;                                                   \
@@ -689,12 +689,12 @@ copymonomacro(MMIO,16)
 copymonomacro(MMIO,24)
 copymonomacro(MMIO,32)
 
-#define copycolormacro(mmio,bpp)       \
-void copycolorpattern##bpp####mmio##(AF_DRIVER *af,int x,int y)        \
+#define copycolormacro(mmio,bpp)                                       \
+void copycolorpattern##bpp##mmio(AF_DRIVER *af,int x,int y)            \
 {                                                                      \
   int i,j;                                                             \
 								       \
-  SET_FG##bpp####mmio##(0);                                      \
+  SET_FG##bpp##mmio(0);                                                \
   if ((last_color_y!=(y&7))||(last_color_x!=(x&7))) {                  \
     last_color_y=y&7;                                                  \
     last_color_x=x&7;                                                  \
@@ -842,8 +842,8 @@ void Use8x8ColorPattern(AF_DRIVER *af, i
  *  not including the second x coordinate. If the second coord is less
  *  than the first, they are swapped. If they are equal, nothing is drawn.
  */
-#define DrawScanMacro(mmio,bpp)\
-void DrawScan##bpp####mmio##(AF_DRIVER *af, long color, long y, long x1, long x2)\
+#define DrawScanMacro(mmio,bpp)               \
+void DrawScan##bpp##mmio(AF_DRIVER *af, long color, long y, long x1, long x2)\
 {                                             \
    if (x2 < x1) {                             \
       int tmp = x1;                           \
@@ -852,13 +852,13 @@ void DrawScan##bpp####mmio##(AF_DRIVER *
    }                                          \
 					      \
    y += af_active_page*af_height;             \
-   waitidle##mmio##();                                \
+   waitidle##mmio();                          \
    need_wait=1;                               \
    SET_ROP_MODE(cir_bltrop,cir_bltmode);      \
-   SET_FG##bpp####mmio##(color);              \
-   SET_WIDTH_HEIGHT##mmio##((x2-x1)*(bpp/8)-1,0);\
-   SET_DSTADDR##mmio##(y*af_width+x1*(bpp/8));\
-   SET_SRCADDR##mmio##(cir_offscreen);        \
+   SET_FG##bpp##mmio(color);                  \
+   SET_WIDTH_HEIGHT##mmio((x2-x1)*(bpp/8)-1,0);\
+   SET_DSTADDR##mmio(y*af_width+x1*(bpp/8));  \
+   SET_SRCADDR##mmio(cir_offscreen);          \
    CIR_CMD(CIR_CMD_RUN);                      \
 }
 
@@ -877,8 +877,8 @@ DrawScanMacro(MMIO,32)
  *  drawn using the specified foreground color and the foreground mix
  *  mode, and clear bits use the background color and background mix mode.
  */
-#define DrawPattScanMacro(mmio,bpp)\
-void DrawPattScan##bpp####mmio##(AF_DRIVER *af, long foreColor, long backColor, long y, long x1, long x2)\
+#define DrawPattScanMacro(mmio,bpp)          \
+void DrawPattScan##bpp##mmio(AF_DRIVER *af, long foreColor, long backColor, long y, long x1, long x2)\
 {                                            \
    if (x2 < x1) {                            \
       int tmp = x1;                          \
@@ -887,15 +887,15 @@ void DrawPattScan##bpp####mmio##(AF_DRIV
    }                                         \
 					     \
    y += af_active_page*af_height;            \
-   waitidle##mmio##();                       \
-   copymonopattern##bpp####mmio##(af,x1,y);  \
+   waitidle##mmio();                         \
+   copymonopattern##bpp##mmio(af,x1,y);      \
    need_wait=1;                              \
    SET_ROP_MODE(cir_bltrop,cir_bltmode);     \
-   SET_FG##bpp####mmio##(foreColor);         \
-   SET_BG##bpp####mmio##(backColor);         \
-   SET_WIDTH_HEIGHT##mmio##((x2-x1)*(bpp/8)-1,0);\
-   SET_DSTADDR##mmio##(y*af_width+x1*(bpp/8));\
-   SET_SRCADDR##mmio##(cir_offmono);         \
+   SET_FG##bpp##mmio(foreColor);             \
+   SET_BG##bpp##mmio(backColor);             \
+   SET_WIDTH_HEIGHT##mmio((x2-x1)*(bpp/8)-1,0);\
+   SET_DSTADDR##mmio(y*af_width+x1*(bpp/8)); \
+   SET_SRCADDR##mmio(cir_offmono);           \
    CIR_CMD(CIR_CMD_RUN);                     \
 }
 
@@ -912,8 +912,8 @@ DrawPattScanMacro(MMIO,32)
 /* DrawColorPattScan:
  *  Fills a scanline using the current color pattern and mix mode.
  */
-#define DrawColorPattScanMacro(mmio,bpp)\
-void DrawColorPattScan##bpp####mmio##(AF_DRIVER *af, long y, long x1, long x2)\
+#define DrawColorPattScanMacro(mmio,bpp)     \
+void DrawColorPattScan##bpp##mmio(AF_DRIVER *af, long y, long x1, long x2)\
 {                                            \
    if (x2 < x1) {                            \
       int tmp = x1;                          \
@@ -922,13 +922,13 @@ void DrawColorPattScan##bpp####mmio##(AF
    }                                         \
 					     \
    y += af_active_page*af_height;            \
-   waitidle##mmio##();                               \
-   copycolorpattern##bpp####mmio##(af,x1,y); \
+   waitidle##mmio();                         \
+   copycolorpattern##bpp##mmio(af,x1,y);     \
    need_wait=1;                              \
-   SET_ROP_MODE##mmio##(cir_bltrop,cir_bltmode);\
-   SET_WIDTH_HEIGHT##mmio##((x2-x1)*(bpp/8)-1,0);\
-   SET_DSTADDR##mmio##(y*af_width+x1*(bpp/8));\
-   SET_SRCADDR##mmio##(cir_offcolor);        \
+   SET_ROP_MODE##mmio(cir_bltrop,cir_bltmode);\
+   SET_WIDTH_HEIGHT##mmio((x2-x1)*(bpp/8)-1,0);\
+   SET_DSTADDR##mmio(y*af_width+x1*(bpp/8)); \
+   SET_SRCADDR##mmio(cir_offcolor);          \
    CIR_CMD(CIR_CMD_RUN);                     \
 }
 
@@ -945,17 +945,17 @@ DrawColorPattScanMacro(MMIO,32)
 /* DrawRect:
  *  Fills a rectangle in the current foreground mix mode.
  */
-#define DrawRectMacro(mmio,bpp)\
-void DrawRect##bpp####mmio##(AF_DRIVER *af, unsigned long color, long left, long top, long width, long height)\
+#define DrawRectMacro(mmio,bpp)              \
+void DrawRect##bpp##mmio(AF_DRIVER *af, unsigned long color, long left, long top, long width, long height)\
 {                                            \
    top += af_active_page*af_height;          \
-   waitidle##mmio##();                               \
+   waitidle##mmio();                         \
    need_wait=1;                              \
-   SET_ROP_MODE##mmio##(cir_bltrop,cir_bltmode);\
-   SET_FG##bpp####mmio##((int)color);             \
-   SET_WIDTH_HEIGHT##mmio##(width*(bpp/8)-1,height-1);\
-   SET_DSTADDR##mmio##(top*af_width+left*(bpp/8));\
-   SET_SRCADDR##mmio##(cir_offscreen);       \
+   SET_ROP_MODE##mmio(cir_bltrop,cir_bltmode);\
+   SET_FG##bpp##mmio((int)color);            \
+   SET_WIDTH_HEIGHT##mmio(width*(bpp/8)-1,height-1);\
+   SET_DSTADDR##mmio(top*af_width+left*(bpp/8));\
+   SET_SRCADDR##mmio(cir_offscreen);         \
    CIR_CMD(CIR_CMD_RUN);                     \
 }
 
@@ -974,19 +974,19 @@ DrawRectMacro(MMIO,32)
  *  drawn using the specified foreground color and the foreground mix
  *  mode, and clear bits use the background color and background mix mode.
  */
-#define DrawPattRectMacro(mmio,bpp)\
-void DrawPattRect##bpp####mmio##(AF_DRIVER *af, unsigned long foreColor, unsigned long backColor, long left, long top, long width, long height)\
+#define DrawPattRectMacro(mmio,bpp)          \
+void DrawPattRect##bpp##mmio(AF_DRIVER *af, unsigned long foreColor, unsigned long backColor, long left, long top, long width, long height)\
 {                                            \
    top += af_active_page*af_height;          \
-   waitidle##mmio##();                               \
-   copymonopattern##bpp####mmio##(af,left,top);\
+   waitidle##mmio();                         \
+   copymonopattern##bpp##mmio(af,left,top);  \
    need_wait=1;                              \
-   SET_ROP_MODE##mmio##(cir_bltrop,cir_bltmode);\
-   SET_FG##bpp####mmio##((int)foreColor);     \
-   SET_BG##bpp####mmio##((int)backColor);     \
-   SET_WIDTH_HEIGHT##mmio##(width*(bpp/8)-1,height-1);\
-   SET_DSTADDR##mmio##(top*af_width+left*(bpp/8));\
-   SET_SRCADDR##mmio##(cir_offmono);         \
+   SET_ROP_MODE##mmio(cir_bltrop,cir_bltmode);\
+   SET_FG##bpp##mmio((int)foreColor);        \
+   SET_BG##bpp##mmio((int)backColor);        \
+   SET_WIDTH_HEIGHT##mmio(width*(bpp/8)-1,height-1);\
+   SET_DSTADDR##mmio(top*af_width+left*(bpp/8));\
+   SET_SRCADDR##mmio(cir_offmono);           \
    CIR_CMD(CIR_CMD_RUN);                     \
 }
 
@@ -1003,17 +1003,17 @@ DrawPattRectMacro(MMIO,32)
 /* DrawColorPattRect:
  *  Fills a rectangle using the current color pattern and mix mode.
  */
-#define DrawColorPattRectMacro(mmio,bpp)\
-void DrawColorPattRect##bpp####mmio##(AF_DRIVER *af, long left, long top, long width, long height)\
+#define DrawColorPattRectMacro(mmio,bpp)     \
+void DrawColorPattRect##bpp##mmio(AF_DRIVER *af, long left, long top, long width, long height)\
 {                                            \
    top += af_active_page*af_height;          \
-   waitidle##mmio##();                               \
-   copycolorpattern##bpp####mmio##(af,left,top);\
+   waitidle##mmio();                         \
+   copycolorpattern##bpp##mmio(af,left,top); \
    need_wait=1;                              \
-   SET_ROP_MODE##mmio##(cir_bltrop,cir_bltmode);\
-   SET_WIDTH_HEIGHT##mmio##(width*(bpp/8)-1,height-1);\
-   SET_DSTADDR##mmio##(top*af_width+left*(bpp/8));\
-   SET_SRCADDR##mmio##(cir_offcolor);        \
+   SET_ROP_MODE##mmio(cir_bltrop,cir_bltmode);\
+   SET_WIDTH_HEIGHT##mmio(width*(bpp/8)-1,height-1);\
+   SET_DSTADDR##mmio(top*af_width+left*(bpp/8));\
+   SET_SRCADDR##mmio(cir_offcolor);          \
    CIR_CMD(CIR_CMD_RUN);                     \
 }
 
@@ -1032,15 +1032,15 @@ DrawColorPattRectMacro(MMIO,32)
  *  mix operation. This must correctly handle the case where the two
  *  regions overlap.
  */
-#define BitBltMacro(mmio,bpp,pixmode)\
-void BitBlt##bpp####mmio##(AF_DRIVER *af, long left, long top, long width, long height, long dstLeft, long dstTop, long op)\
+#define BitBltMacro(mmio,bpp,pixmode)        \
+void BitBlt##bpp##mmio(AF_DRIVER *af, long left, long top, long width, long height, long dstLeft, long dstTop, long op)\
 {                                            \
   unsigned long pdst,psrc;                   \
   int bltmode=pixmode,bltrop;                \
 					     \
   top += af_active_page*af_height;           \
   dstTop += af_active_page*af_height;        \
-  waitidle##mmio##();                                \
+  waitidle##mmio();                          \
   width*=(bpp/8);width--;height--;           \
   left*=(bpp/8);dstLeft*=(bpp/8);            \
   need_wait=1;                               \
@@ -1052,11 +1052,11 @@ void BitBlt##bpp####mmio##(AF_DRIVER *af
     psrc = ((top * af_width) + left);        \
     pdst = ((dstTop * af_width) + dstLeft);  \
   }                                          \
-  SET_WIDTH_HEIGHT##mmio##(width,height);    \
-  SET_SRCADDR##mmio##(psrc);                 \
-  SET_DSTADDR##mmio##(pdst);                 \
+  SET_WIDTH_HEIGHT##mmio(width,height);      \
+  SET_SRCADDR##mmio(psrc);                   \
+  SET_DSTADDR##mmio(pdst);                   \
   bltrop=af_mix_fore(op);                    \
-  SET_ROP_MODE##mmio##(bltrop,bltmode);      \
+  SET_ROP_MODE##mmio(bltrop,bltmode);        \
   CIR_CMD(CIR_CMD_RUN);                      \
 }
 
@@ -1076,14 +1076,14 @@ BitBltMacro(MMIO,32,CIR_BLT_PIX32)
  *  transparent color. Results are undefined if the two regions overlap.
  */
 #define SrcTransBltMacro(mmio,bpp,pixmode)\
-void SrcTransBlt##bpp####mmio##(AF_DRIVER *af, long left, long top, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent)\
+void SrcTransBlt##bpp##mmio(AF_DRIVER *af, long left, long top, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent)\
 {                                            \
   unsigned long pdst,psrc;                   \
   int bltmode=pixmode|CIR_BLT_TRANS,bltrop;  \
 					     \
   top += af_active_page*af_height;           \
   dstTop += af_active_page*af_height;        \
-  waitidle##mmio##();                                \
+  waitidle##mmio();                                \
   width*=(bpp/8);width--;height--;           \
   left*=(bpp/8);dstLeft*=(bpp/8);            \
   need_wait=1;                               \
@@ -1095,12 +1095,12 @@ void SrcTransBlt##bpp####mmio##(AF_DRIVE
     psrc = ((top * af_width) + left);        \
     pdst = ((dstTop * af_width) + dstLeft);  \
   }                                          \
-  SET_TRANS##mmio##((int)transparent);                \
-  SET_WIDTH_HEIGHT##mmio##(width,height);    \
-  SET_SRCADDR##mmio##(psrc);                 \
-  SET_DSTADDR##mmio##(pdst);                 \
+  SET_TRANS##mmio((int)transparent);                \
+  SET_WIDTH_HEIGHT##mmio(width,height);    \
+  SET_SRCADDR##mmio(psrc);                 \
+  SET_DSTADDR##mmio(pdst);                 \
   bltrop=af_mix_fore(op);                    \
-  SET_ROP_MODE##mmio##(bltrop,bltmode);      \
+  SET_ROP_MODE##mmio(bltrop,bltmode);      \
   CIR_CMD(CIR_CMD_RUN);                      \
 }
 
@@ -1162,10 +1162,10 @@ void SetCursorPos(AF_DRIVER *af, long x,
   y-=hw_cur_y;
   if (y<0) y=0;
   __asm__ (
-  "movw $0x3c4,%%dx
-   outw %%ax,%%dx
-   movw %%bx,%%ax
-   outw %%ax,%%dx"
+  "movw $0x3c4,%%dx\n"
+  "outw %%ax,%%dx\n"
+  "movw %%bx,%%ax\n"
+  "outw %%ax,%%dx\n"
   :
   :"a" ((x<<5)+0x10),"b" ((y<<5)+0x11)
   :"%dx");
@@ -1208,24 +1208,24 @@ void ShowCursor(AF_DRIVER *af, long visi
   }
 }
 
-#define BitBltSysMacro(mmio,bpp,pixmode) \
-void BitBltSys##bpp####mmio##(AF_DRIVER *af, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op)\
+#define BitBltSysMacro(mmio,bpp,pixmode)                           \
+void BitBltSys##bpp##mmio(AF_DRIVER *af, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op)\
 {                                                                  \
   unsigned long pdst;                                              \
   int bltmode=pixmode,bltrop;                                      \
 								   \
   width*=(bpp/8);width--;height--;                                 \
   srcLeft*=(bpp/8);dstLeft*=(bpp/8);                               \
-  waitidle##mmio##();                                                      \
+  waitidle##mmio();                                                \
   need_wait=1;                                                     \
   dstTop += af_active_page*af_height;                              \
   pdst = dstTop * af_width + dstLeft;                              \
-  SET_WIDTH_HEIGHT##mmio##(width,height);                          \
-  SET_SRCADDR##mmio##(0);                                          \
-  SET_DSTADDR##mmio##(pdst);                                       \
+  SET_WIDTH_HEIGHT##mmio(width,height);                            \
+  SET_SRCADDR##mmio(0);                                            \
+  SET_DSTADDR##mmio(pdst);                                         \
   bltrop=af_mix_fore(op);                                          \
   bltmode|=CIR_BLT_MEM;                                            \
-  SET_ROP_MODE##mmio##(bltrop,bltmode);                            \
+  SET_ROP_MODE##mmio(bltrop,bltmode);                              \
   CIR_CMD(CIR_CMD_RUN);                                            \
   width++;height++;                                                \
   __asm__ __volatile__ ("\
@@ -1258,24 +1258,24 @@ BitBltSysMacro(MMIO,24,CIR_BLT_PIX24)
 BitBltSysMacro(MMIO,32,CIR_BLT_PIX32)
 
 #define SrcTransBltSysMacro(mmio,bpp,pixmode)\
-void SrcTransBltSys##bpp####mmio##(AF_DRIVER *af, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent)\
+void SrcTransBltSys##bpp##mmio(AF_DRIVER *af, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent)\
 {                                         \
   unsigned long pdst;                     \
   int bltmode,bltrop;                     \
 					  \
   width*=(bpp/8);width--;height--;        \
   srcLeft*=(bpp/8);dstLeft*=(bpp/8);      \
-  waitidle##mmio##();                             \
+  waitidle##mmio();                       \
   need_wait=1;                            \
   dstTop += af_active_page*af_height;     \
   pdst = dstTop * af_width + dstLeft;     \
   bltrop=af_mix_fore(op);                 \
   bltmode=CIR_BLT_MEM|CIR_BLT_TRANS|pixmode;\
-  SET_ROP_MODE##mmio##(bltrop,bltmode);   \
-  SET_WIDTH_HEIGHT##mmio##(width,height); \
-  SET_TRANS##mmio##((int)transparent);     \
-  SET_SRCADDR##mmio##(0);                 \
-  SET_DSTADDR##mmio##(pdst);              \
+  SET_ROP_MODE##mmio(bltrop,bltmode);     \
+  SET_WIDTH_HEIGHT##mmio(width,height);   \
+  SET_TRANS##mmio((int)transparent);      \
+  SET_SRCADDR##mmio(0);                   \
+  SET_DSTADDR##mmio(pdst);                \
   CIR_CMD(CIR_CMD_RUN);                   \
   width++;height++;                       \
   __asm__ __volatile__ ("                 \
@@ -1310,28 +1310,28 @@ SrcTransBltSysMacro(MMIO,32,CIR_BLT_PIX3
 
 inline void shiftleft(unsigned char *line,int bytes,unsigned char bits)
 {
-  asm("
-	movb  $8,%%ch
-	addb  %%cl,%%ch
-	movb  %%dl,%%al
-1:
-	movb  (%%esi),%%ah
-	andl  $0xffff,%%eax
-	shll  %%cl,%%eax
-	movb  %%ah,(%%esi)
-	xchgb %%ch,%%cl
-	shrl  %%cl,%%eax
-	decl  %%esi
-	xchgb %%ch,%%cl
-	decl  %%ebx
-	jnz 1b"
+  asm(
+	"movb  $8,%%ch\n\t"
+	"addb  %%cl,%%ch\n\t"
+	"movb  %%dl,%%al\n\t"
+"1:\n\t"
+	"movb  (%%esi),%%ah\n\t"
+	"andl  $0xffff,%%eax\n\t"
+	"shll  %%cl,%%eax\n\t"
+	"movb  %%ah,(%%esi)\n\t"
+	"xchgb %%ch,%%cl\n\t"
+	"shrl  %%cl,%%eax\n\t"
+	"decl  %%esi\n\t"
+	"xchgb %%ch,%%cl\n\t"
+	"decl  %%ebx\n\t"
+	"jnz 1b"
 	::"S" (line+bytes-1), "c" ((bits&31)|((32-(bits&31))<<8)), "d" (0), "b" (bytes));
 }
 
 unsigned char lines[1024];
 
-#define PutMonoImageMacro(mmio,bpp,pixmode)\
-void PutMonoImage##bpp####mmio##(AF_DRIVER *af, long foreColor, long backColor, long dstX, long dstY, long byteWidth, long srcX, long srcY, long width, long height, unsigned char *image)\
+#define PutMonoImageMacro(mmio,bpp,pixmode)    \
+void PutMonoImage##bpp##mmio(AF_DRIVER *af, long foreColor, long backColor, long dstX, long dstY, long byteWidth, long srcX, long srcY, long width, long height, unsigned char *image)\
 {                                              \
   unsigned long pdst;                          \
   int i,j,bytelen=(width+7)/8;                 \
@@ -1351,7 +1351,7 @@ void PutMonoImage##bpp####mmio##(AF_DRIV
 					       \
   width*=(bpp/8);width--;                      \
   dstX*=(bpp/8);                               \
-  waitidle##mmio##();                          \
+  waitidle##mmio();                            \
   need_wait=1;                                 \
   dstY += af_active_page*af_height;            \
   pdst = dstY * af_width + dstX;               \
@@ -1361,17 +1361,17 @@ void PutMonoImage##bpp####mmio##(AF_DRIV
     bltmode |= CIR_BLT_TRANS;                  \
     if ((bpp/8)==1) {                          \
       backColor|=backColor<<8;                 \
-      SET_TRANS##mmio##(backColor);            \
+      SET_TRANS##mmio(backColor);              \
       backColor&=0xff;                         \
     } else                                     \
       SET_TRANS(backColor);                    \
   }                                            \
-  SET_BG##bpp####mmio##(backColor);            \
-  SET_ROP_MODE##mmio##(cir_bltrop,bltmode);    \
-  SET_FG##bpp####mmio##(foreColor);            \
-  SET_WIDTH_HEIGHT##mmio##(width,height-1);    \
-  SET_SRCADDR##mmio##(0);                      \
-  SET_DSTADDR##mmio##(pdst);                   \
+  SET_BG##bpp##mmio(backColor);                \
+  SET_ROP_MODE##mmio(cir_bltrop,bltmode);      \
+  SET_FG##bpp##mmio(foreColor);                \
+  SET_WIDTH_HEIGHT##mmio(width,height-1);      \
+  SET_SRCADDR##mmio(0);                        \
+  SET_DSTADDR##mmio(pdst);                     \
   CIR_CMD(CIR_CMD_RUN);                        \
   __asm__ __volatile__ ("                      \
       cld;                                     \
@@ -1400,21 +1400,21 @@ PutMonoImageMacro(MMIO,32,CIR_BLT_PIX32)
  *  video memory, so we can't talk directly to the card.
  */
 
-#define SetupMacro(mmio,bpp)\
-void SetupFuncPtr##bpp####mmio##(AF_DRIVER *af)\
-{\
-   af->DrawScan = DrawScan##bpp####mmio##;\
-   af->DrawPattScan = DrawPattScan##bpp####mmio##;\
-   af->DrawColorPattScan = DrawColorPattScan##bpp####mmio##;\
-   af->DrawRect = DrawRect##bpp####mmio##;\
-   af->DrawPattRect = DrawPattRect##bpp####mmio##;\
-   af->DrawColorPattRect = DrawColorPattRect##bpp####mmio##;\
-   af->BitBlt = BitBlt##bpp####mmio##;\
-   af->BitBltSys = BitBltSys##bpp####mmio##;\
-   af->SrcTransBlt = SrcTransBlt##bpp####mmio##;\
-   af->SrcTransBltSys = SrcTransBltSys##bpp####mmio##;\
-   af->WaitTillIdle = WaitTillIdle##bpp####mmio##;\
-   af->PutMonoImage = PutMonoImage##bpp####mmio##;\
+#define SetupMacro(mmio,bpp)                            \
+void SetupFuncPtr##bpp##mmio(AF_DRIVER *af)             \
+{                                                       \
+   af->DrawScan = DrawScan##bpp##mmio;                  \
+   af->DrawPattScan = DrawPattScan##bpp##mmio;          \
+   af->DrawColorPattScan = DrawColorPattScan##bpp##mmio;\
+   af->DrawRect = DrawRect##bpp##mmio;                  \
+   af->DrawPattRect = DrawPattRect##bpp##mmio;          \
+   af->DrawColorPattRect = DrawColorPattRect##bpp##mmio;\
+   af->BitBlt = BitBlt##bpp##mmio;                      \
+   af->BitBltSys = BitBltSys##bpp##mmio;                \
+   af->SrcTransBlt = SrcTransBlt##bpp##mmio;            \
+   af->SrcTransBltSys = SrcTransBltSys##bpp##mmio;      \
+   af->WaitTillIdle = WaitTillIdle##bpp##mmio;          \
+   af->PutMonoImage = PutMonoImage##bpp##mmio;          \
 }
 
 
diff -aprNU3 freebe.orig/helper.c freebe/helper.c
--- freebe.orig/helper.c	1999-06-23 21:18:28 +0000
+++ freebe/helper.c	2007-09-11 23:51:04 +0000
@@ -30,7 +30,7 @@
  */
 void trace_putc(char c)
 {
-   asm (
+   __asm__ __volatile__ (
       " int $0x21 "
 
    : 
@@ -38,12 +38,6 @@ void trace_putc(char c)
    : "a" (0x200),
      "d" (c)
 
-   : "%eax", 
-     "%ebx", 
-     "%ecx", 
-     "%edx", 
-     "%esi", 
-     "%edi"
    );
 }
 
@@ -79,7 +73,7 @@ void trace_printf(char *msg, ...)
 	       break;
 
 	    case 'c':
-	       c = va_arg(ap, char);
+	       c = va_arg(ap, int);
 	       trace_putc(c);
 	       break;
 
@@ -142,7 +136,7 @@ void rm_int(int num, RM_REGS *regs)
    regs->x.sp = 0;
    regs->x.ss = 0;
 
-   asm (
+   __asm__ __volatile__ (
       " int $0x31 "
    :
 
@@ -151,12 +145,6 @@ void rm_int(int num, RM_REGS *regs)
      "c" (0),
      "D" (regs)
 
-   : "%eax", 
-     "%ebx", 
-     "%ecx", 
-     "%edx", 
-     "%esi", 
-     "%edi"
    );
 }
 
@@ -173,7 +161,7 @@ int allocate_dos_memory(int size, int *s
    int pm_sel;
    int ok;
 
-   asm (
+   __asm__ __volatile__ (
       "  int $0x31 ; "
       "  jc 0f ; "
       "  movl $1, %2 ; "
@@ -189,12 +177,6 @@ int allocate_dos_memory(int size, int *s
    : "a" (0x100),
      "b" ((size+15)/16)
 
-   : "%eax", 
-     "%ebx", 
-     "%ecx", 
-     "%edx", 
-     "%esi", 
-     "%edi"
    );
 
    if (!ok)
@@ -212,19 +194,13 @@ int allocate_dos_memory(int size, int *s
  */
 void free_dos_memory(int sel)
 {
-   asm (
+   __asm__ __volatile__ (
       " int $0x31 "
    :
 
    : "a" (0x101),
      "d" (sel)
 
-   : "%eax", 
-     "%ebx", 
-     "%ecx", 
-     "%edx", 
-     "%esi", 
-     "%edi"
    );
 }
 
@@ -239,7 +215,7 @@ int allocate_selector(int addr, int size
    int sel;
    int ok;
 
-   asm (
+   __asm__ __volatile__ (
       "  int $0x31 ; "
       "  jc 0f ; "
 
@@ -268,17 +244,11 @@ int allocate_selector(int addr, int size
 
    : "a" (0),
      "c" (1),
-     "m" (addr>>16),
-     "m" (addr&0xFFFF),
-     "m" ((size-1)>>16),
-     "m" ((size-1)&0xFFFF)
-
-   : "%eax", 
-     "%ebx", 
-     "%ecx", 
-     "%edx", 
-     "%esi", 
-     "%edi"
+     "g" (addr>>16),
+     "g" (addr&0xFFFF),
+     "g" ((size-1)>>16),
+     "g" ((size-1)&0xFFFF)
+
    );
 
    if (!ok)
@@ -295,19 +265,13 @@ int allocate_selector(int addr, int size
  */
 void free_selector(int sel) 
 {
-   asm (
+   __asm__ __volatile__ (
       " int $0x31 "
    :
 
    : "a" (1),
      "b" (sel)
 
-   : "%eax", 
-     "%ebx", 
-     "%ecx", 
-     "%edx", 
-     "%esi", 
-     "%edi"
    );
 }
 
@@ -326,18 +290,18 @@ void free_selector(int sel) 
 
 typedef struct VESA_INFO         /* VESA information block structure */
 { 
-   unsigned char  VESASignature[4]     __attribute__ ((packed));
+   unsigned char  VESASignature[4];
    unsigned short VESAVersion          __attribute__ ((packed));
    unsigned long  OEMStringPtr         __attribute__ ((packed));
-   unsigned char  Capabilities[4]      __attribute__ ((packed));
+   unsigned char  Capabilities[4];
    unsigned long  VideoModePtr         __attribute__ ((packed)); 
    unsigned short TotalMemory          __attribute__ ((packed)); 
    unsigned short OemSoftwareRev       __attribute__ ((packed)); 
    unsigned long  OemVendorNamePtr     __attribute__ ((packed)); 
    unsigned long  OemProductNamePtr    __attribute__ ((packed)); 
    unsigned long  OemProductRevPtr     __attribute__ ((packed)); 
-   unsigned char  Reserved[222]        __attribute__ ((packed)); 
-   unsigned char  OemData[256]         __attribute__ ((packed)); 
+   unsigned char  Reserved[222];
+   unsigned char  OemData[256];
 } VESA_INFO;
 
 
@@ -345,8 +309,8 @@ typedef struct VESA_INFO         /* VESA
 typedef struct VESA_MODE_INFO       /* VESA information for a specific mode */
 {
    unsigned short ModeAttributes       __attribute__ ((packed)); 
-   unsigned char  WinAAttributes       __attribute__ ((packed)); 
-   unsigned char  WinBAttributes       __attribute__ ((packed)); 
+   unsigned char  WinAAttributes;
+   unsigned char  WinBAttributes;
    unsigned short WinGranularity       __attribute__ ((packed)); 
    unsigned short WinSize              __attribute__ ((packed)); 
    unsigned short WinASegment          __attribute__ ((packed)); 
@@ -355,24 +319,24 @@ typedef struct VESA_MODE_INFO       /* V
    unsigned short BytesPerScanLine     __attribute__ ((packed)); 
    unsigned short XResolution          __attribute__ ((packed)); 
    unsigned short YResolution          __attribute__ ((packed)); 
-   unsigned char  XCharSize            __attribute__ ((packed)); 
-   unsigned char  YCharSize            __attribute__ ((packed)); 
-   unsigned char  NumberOfPlanes       __attribute__ ((packed)); 
-   unsigned char  BitsPerPixel         __attribute__ ((packed)); 
-   unsigned char  NumberOfBanks        __attribute__ ((packed)); 
-   unsigned char  MemoryModel          __attribute__ ((packed)); 
-   unsigned char  BankSize             __attribute__ ((packed)); 
-   unsigned char  NumberOfImagePages   __attribute__ ((packed));
-   unsigned char  Reserved_page        __attribute__ ((packed)); 
-   unsigned char  RedMaskSize          __attribute__ ((packed)); 
-   unsigned char  RedMaskPos           __attribute__ ((packed)); 
-   unsigned char  GreenMaskSize        __attribute__ ((packed)); 
-   unsigned char  GreenMaskPos         __attribute__ ((packed));
-   unsigned char  BlueMaskSize         __attribute__ ((packed)); 
-   unsigned char  BlueMaskPos          __attribute__ ((packed)); 
-   unsigned char  ReservedMaskSize     __attribute__ ((packed)); 
-   unsigned char  ReservedMaskPos      __attribute__ ((packed)); 
-   unsigned char  DirectColorModeInfo  __attribute__ ((packed));
+   unsigned char  XCharSize;
+   unsigned char  YCharSize;
+   unsigned char  NumberOfPlanes;
+   unsigned char  BitsPerPixel;
+   unsigned char  NumberOfBanks;
+   unsigned char  MemoryModel;
+   unsigned char  BankSize;
+   unsigned char  NumberOfImagePages;
+   unsigned char  Reserved_page;
+   unsigned char  RedMaskSize;
+   unsigned char  RedMaskPos;
+   unsigned char  GreenMaskSize;
+   unsigned char  GreenMaskPos;
+   unsigned char  BlueMaskSize;
+   unsigned char  BlueMaskPos;
+   unsigned char  ReservedMaskSize;
+   unsigned char  ReservedMaskPos;
+   unsigned char  DirectColorModeInfo;
 
    /* VBE 2.0 extensions */
    unsigned long  PhysBasePtr          __attribute__ ((packed)); 
@@ -381,19 +345,19 @@ typedef struct VESA_MODE_INFO       /* V
 
    /* VBE 3.0 extensions */
    unsigned short LinBytesPerScanLine  __attribute__ ((packed));
-   unsigned char  BnkNumberOfPages     __attribute__ ((packed));
-   unsigned char  LinNumberOfPages     __attribute__ ((packed));
-   unsigned char  LinRedMaskSize       __attribute__ ((packed));
-   unsigned char  LinRedFieldPos       __attribute__ ((packed));
-   unsigned char  LinGreenMaskSize     __attribute__ ((packed));
-   unsigned char  LinGreenFieldPos     __attribute__ ((packed));
-   unsigned char  LinBlueMaskSize      __attribute__ ((packed));
-   unsigned char  LinBlueFieldPos      __attribute__ ((packed));
-   unsigned char  LinRsvdMaskSize      __attribute__ ((packed));
-   unsigned char  LinRsvdFieldPos      __attribute__ ((packed));
+   unsigned char  BnkNumberOfPages;
+   unsigned char  LinNumberOfPages;
+   unsigned char  LinRedMaskSize;
+   unsigned char  LinRedFieldPos;
+   unsigned char  LinGreenMaskSize;
+   unsigned char  LinGreenFieldPos;
+   unsigned char  LinBlueMaskSize;
+   unsigned char  LinBlueFieldPos;
+   unsigned char  LinRsvdMaskSize;
+   unsigned char  LinRsvdFieldPos;
    unsigned long  MaxPixelClock        __attribute__ ((packed));
 
-   unsigned char  Reserved[190]        __attribute__ ((packed)); 
+   unsigned char  Reserved[190]; 
 } VESA_MODE_INFO;
 
 
diff -aprNU3 freebe.orig/stub/driver.c freebe/stub/driver.c
--- freebe.orig/stub/driver.c	1999-04-08 19:36:50 +0000
+++ freebe/stub/driver.c	2007-09-11 23:51:04 +0000
@@ -908,32 +908,32 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *    rm_int(0x10, &r);
  */
 
-asm ("
+asm (
 
-   .globl _SetBank32, _SetBank32End
+  ".globl _SetBank32, _SetBank32End\n\t"
 
-      .align 4
-   _SetBank32:
-      pushal
-      subl $56, %esp                   # RM_REGS structure on the stack
-      movw $0x4F05, 32(%esp)           # r.x.ax = 0x4F05
-      movw $0, 20(%esp)                # r.x.bx = 0
-      movw %dx, 24(%esp)               # r.x.dx = bank number
-      movw $0, 36(%esp)                # r.x.flags = 0
-      movw $0, 50(%esp)                # r.x.sp = 0
-      movw $0, 52(%esp)                # r.x.ss = 0
-      movl $0x300, %eax                # %eax = 0x300
-      movl $0x10, %ebx                 # %ebx = 0x10
-      movl $0, %ecx                    # %ecx = 0
-      leal 4(%esp), %edi               # %edi = RM_REGS structure
-      int $0x31                        # real mode VESA call
-      addl $56, %esp 
-      popal
-      ret
+   "  .align 4\n\t"
+   "_SetBank32:\n\t"
+   "  pushal\n\t"
+   "  subl $56, %esp                   # RM_REGS structure on the stack\n\t"
+   "  movw $0x4F05, 32(%esp)           # r.x.ax = 0x4F05\n\t"
+   "  movw $0, 20(%esp)                # r.x.bx = 0\n\t"
+   "  movw %dx, 24(%esp)               # r.x.dx = bank number\n\t"
+   "  movw $0, 36(%esp)                # r.x.flags = 0\n\t"
+   "  movw $0, 50(%esp)                # r.x.sp = 0\n\t"
+   "  movw $0, 52(%esp)                # r.x.ss = 0\n\t"
+   "  movl $0x300, %eax                # %eax = 0x300\n\t"
+   "  movl $0x10, %ebx                 # %ebx = 0x10\n\t"
+   "  movl $0, %ecx                    # %ecx = 0\n\t"
+   "  leal 4(%esp), %edi               # %edi = RM_REGS structure\n\t"
+   "  int $0x31                        # real mode VESA call\n\t"
+   "  addl $56, %esp\n\t"
+   "  popal\n\t"
+   "  ret\n\t"
 
-   _SetBank32End:
+  "_SetBank32End:\n\t"
 
-");
+);
 
 
 
diff -aprNU3 freebe.orig/vbeaf.h freebe/vbeaf.h
--- freebe.orig/vbeaf.h	1999-06-22 20:22:22 +0000
+++ freebe/vbeaf.h	2007-09-11 23:51:04 +0000
@@ -146,7 +146,7 @@ typedef struct AF_CRTCInfo
    unsigned short VerticalTotal        __attribute__ ((packed));  /* vertical total (lines) */
    unsigned short VerticalSyncStart    __attribute__ ((packed));  /* vertical sync start position */
    unsigned short VerticalSyncEnd      __attribute__ ((packed));  /* vertical sync end position */
-   unsigned char  Flags                __attribute__ ((packed));  /* initialisation flags for mode */
+   unsigned char  Flags;                                          /* initialisation flags for mode */
    unsigned int   PixelClock           __attribute__ ((packed));  /* pixel clock in units of Hz */
    unsigned short RefreshRate          __attribute__ ((packed));  /* expected refresh rate in .01Hz */
    unsigned short NumBuffers           __attribute__ ((packed));  /* number of display buffers */
@@ -177,29 +177,29 @@ typedef struct AF_MODE_INFO 
    unsigned short BytesPerScanLine        __attribute__ ((packed));
    unsigned short BitsPerPixel            __attribute__ ((packed));
    unsigned short MaxBuffers              __attribute__ ((packed));
-   unsigned char  RedMaskSize             __attribute__ ((packed));
-   unsigned char  RedFieldPosition        __attribute__ ((packed));
-   unsigned char  GreenMaskSize           __attribute__ ((packed));
-   unsigned char  GreenFieldPosition      __attribute__ ((packed));
-   unsigned char  BlueMaskSize            __attribute__ ((packed));
-   unsigned char  BlueFieldPosition       __attribute__ ((packed));
-   unsigned char  RsvdMaskSize            __attribute__ ((packed));
-   unsigned char  RsvdFieldPosition       __attribute__ ((packed));
+   unsigned char  RedMaskSize;
+   unsigned char  RedFieldPosition;
+   unsigned char  GreenMaskSize;
+   unsigned char  GreenFieldPosition;
+   unsigned char  BlueMaskSize;
+   unsigned char  BlueFieldPosition;
+   unsigned char  RsvdMaskSize;
+   unsigned char  RsvdFieldPosition;
    unsigned short MaxBytesPerScanLine     __attribute__ ((packed));
    unsigned short MaxScanLineWidth        __attribute__ ((packed));
 
    /* VBE/AF 2.0 extensions */
    unsigned short LinBytesPerScanLine     __attribute__ ((packed));
-   unsigned char  BnkMaxBuffers           __attribute__ ((packed));
-   unsigned char  LinMaxBuffers           __attribute__ ((packed));
-   unsigned char  LinRedMaskSize          __attribute__ ((packed));
-   unsigned char  LinRedFieldPosition     __attribute__ ((packed));
-   unsigned char  LinGreenMaskSize        __attribute__ ((packed));
-   unsigned char  LinGreenFieldPosition   __attribute__ ((packed));
-   unsigned char  LinBlueMaskSize         __attribute__ ((packed));
-   unsigned char  LinBlueFieldPosition    __attribute__ ((packed));
-   unsigned char  LinRsvdMaskSize         __attribute__ ((packed));
-   unsigned char  LinRsvdFieldPosition    __attribute__ ((packed));
+   unsigned char  BnkMaxBuffers;
+   unsigned char  LinMaxBuffers;
+   unsigned char  LinRedMaskSize;
+   unsigned char  LinRedFieldPosition;
+   unsigned char  LinGreenMaskSize;
+   unsigned char  LinGreenFieldPosition;
+   unsigned char  LinBlueMaskSize;
+   unsigned char  LinBlueFieldPosition;
+   unsigned char  LinRsvdMaskSize;
+   unsigned char  LinRsvdFieldPosition;
    unsigned long  MaxPixelClock           __attribute__ ((packed));
    unsigned long  VideoCapabilities       __attribute__ ((packed));
    unsigned short VideoMinXScale          __attribute__ ((packed));
@@ -207,7 +207,7 @@ typedef struct AF_MODE_INFO 
    unsigned short VideoMaxXScale          __attribute__ ((packed));
    unsigned short VideoMaxYScale          __attribute__ ((packed));
 
-   unsigned char  reserved[76]            __attribute__ ((packed));
+   unsigned char  reserved[76];
 
 } AF_MODE_INFO;
 
@@ -221,11 +221,11 @@ typedef struct AF_MODE_INFO 
 typedef struct AF_DRIVER 
 {
    /* header */
-   char           Signature[12]           __attribute__ ((packed));
+   char           Signature[12];
    unsigned long  Version                 __attribute__ ((packed));
    unsigned long  DriverRev               __attribute__ ((packed));
-   char           OemVendorName[80]       __attribute__ ((packed));
-   char           OemCopyright[80]        __attribute__ ((packed));
+   char           OemVendorName[80];
+   char           OemCopyright[80];
    short          *AvailableModes         __attribute__ ((packed));
    unsigned long  TotalMemory             __attribute__ ((packed));
    unsigned long  Attributes              __attribute__ ((packed));

- Raw text -


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