2008-05-06  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* tgui/vga.h (ReadCRT): Make variable "register", fix syntax error and
	remove all registers that appear in the input list from the clobber
	list.
	(ReadGRA): Make variable "register", fix syntax error and remove all
	registers that appear in the input list from the clobber list.
	(ReadSEQ): Make variable "register", fix syntax error and remove all
	registers that appear in the input list from the clobber list.
	(WriteCRT): Remove all registers that appear in the input list
	from the clobber list.
	(WriteGRA): Remove all registers that appear in the input list
	from the clobber list.
	(WriteSEQ): Remove all registers that appear in the input list
	from the clobber list.
	(SetPalRange): Remove all registers that appear in the input list
	from the clobber list.

	* tgui/driver.c (BitBltSys): Remove all registers that appear in the
	input list from the clobber list.
	(SrcTransBltSys): Remove all registers that appear in the input list
	from the clobber list.
	(PutMonoImage): Remove all registers that appear in the input list
	from the clobber list.

	* install.c (read_driver_data): Fix PACKFILE.


2008-05-05  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* mach64/driver.c (SetBank): Remove empty clobber register list.

	* matrox/driver.c (SetBank32): Quote every asm line with ".
	(SetBank): Quote every asm line with ".
	(PutMonoImage): Remove all registers that appear in the input list
	from the clobber list.
	(BitBltSys): Remove all registers that appear in the input list
	from the clobber list.
	(SrcTransBltSys): Remove all registers that appear in the input list
	from the clobber list.

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

	* nvidia/riva_hw.c (CalcStateExt): Pacify compiler; set default for
	certain variables.

	* paradise/driver.c (CirrusSetBank32): Quote every asm line with ".
	(ParadiseSetBank32): Quote every asm line with ".

	* s3/driver.c (SetBank32): Quote every asm line with ".
	(ParadiseSetBank32): Quote every asm line with ".

	* tgui/vga.h (ReadCRT): Quote every asm line with ".
	(ReadGRA): Quote every asm line with ".
	(ReadSEQ): Quote every asm line with ".
	(WriteCRT): Quote every asm line with ".
	(WriteGRA): Quote every asm line with ".
	(WaitVRT): Quote every asm line with ".
	(RPF_SetPalRange): Quote every asm line with ".

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

	* trident/driver.c (DualSetBank32): Quote every asm line with ".
	(SingleSetBank32): Quote every asm line with ".

	* tseng/driver.c (ET3000SetBank32): Quote every asm line with ".
	(ET4000SetBank32): Quote every asm line with ".

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


2008-05-03  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	Patch to compile freebs12 with gcc 4.3.0, binutils 2.17
	and djdev203 and djdev204.

	* makefile: Use -mtune=generic instead of -m486.

	* vbeaf.h: Define NULL only if not already defined.


2007-09-13  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* cirrus54/driver.c (SrcTransBltSysMacro): Remove all registers
	that appear in the input list from the clobber list.
	(BitBltSysMacro): Remove all registers that appear in the input
	list from the clobber list.
	(PutMonoImageMacro): Remove all registers that appear in the input
	list from the clobber list.


2007-09-12  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

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


2007-09-10  Juan Manuel Guerrero  <juan.guerrero@gmx.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.guerrero@gmx.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	2008-05-06 10:40:56 +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	2008-05-06 10:40:56 +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	2008-05-06 10:40:56 +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       \n\t"
      ::"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\t"
+  "outw %%ax,%%dx      \n\t"
+  "movw %%bx,%%ax      \n\t"
+  "outw %%ax,%%dx      \n\t"
   :
   :"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__ ("\
@@ -1243,7 +1243,7 @@ void BitBltSys##bpp####mmio##(AF_DRIVER 
       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"\
+      :"eax","cc"\
       );\
 }
 
@@ -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__ ("                 \
@@ -1294,7 +1294,7 @@ void SrcTransBltSys##bpp####mmio##(AF_DR
       "                                   \
       :                                   \
       :"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"\
+      :"eax","cc"                         \
       );                                  \
 }
 
@@ -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                \n\t"
 	::"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;                                     \
@@ -1379,7 +1379,7 @@ void PutMonoImage##bpp####mmio##(AF_DRIV
       "                                        \
       :                                        \
       :"S" (lines), "D" (af_linear?af->LinearMem:af->BankedMem), "c" ((height*bytelen+3)/4), "d" (height)\
-      :"eax","ecx","edx","esi","edi","cc"      \
+      :"eax","cc"                              \
       );                                       \
 }
 
@@ -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	2008-05-06 10:40:56 +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/install.c freebe/install.c
--- freebe.orig/install.c	1999-04-08 19:12:54 +0000
+++ freebe/install.c	2008-05-06 10:42:24 +0000
@@ -709,12 +709,12 @@ int read_driver_data()
 	       f = pack_fopen_chunk(f, FALSE);
 
 	       if (strcmp(name, "VBEAF_DRV") == 0) {
-		  info->driver_size = f->todo;
+		  info->driver_size = f->normal.todo;
 		  info->driver = malloc(info->driver_size);
 		  pack_fread(info->driver, info->driver_size, f);
 	       }
 	       else if (strcmp(name, "NOTES_TXT") == 0) {
-		  info->notes_size = f->todo;
+		  info->notes_size = f->normal.todo;
 		  info->notes = malloc(info->notes_size);
 		  pack_fread(info->notes, info->notes_size, f);
 	       }
diff -aprNU3 freebe.orig/mach64/driver.c freebe/mach64/driver.c
--- freebe.orig/mach64/driver.c	1999-06-22 20:22:48 +0000
+++ freebe/mach64/driver.c	2008-05-06 10:40:56 +0000
@@ -1101,36 +1101,36 @@ 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:
-      pushal
-# [OK] mostly copied from Allegro's bank.s
-      movl %edx,%eax
-      # two 32K apertures, bank and bank+1
-      movb %al,%ah
-      incb %ah
-      shll $8,%eax
-      shrw $8,%ax
-
-# [OK] hey, I'm violating Shawn's rules for SetBank32...
-# [OK] oh well, I might make it 100% relocatable later
-# [OK] (how? I can think of at least 3 ways, so don't worry)
-# [OK] or just use LFB meanwhile (or preferably always)
-      movl _mach64_wpsel,%edx
-      outl %eax,%dx
-      movl _mach64_rpsel,%edx
-      outl %eax,%dx
+  "   .align 4                                                  \n\t"
+  "_SetBank32:                                                  \n\t"
+  "   pushal                                                    \n\t"
+"# [OK] mostly copied from Allegro's bank.s                     \n\t"
+  "   movl %edx,%eax                                            \n\t"
+  "   # two 32K apertures, bank and bank+1                      \n\t"
+  "   movb %al,%ah                                              \n\t"
+  "   incb %ah                                                  \n\t"
+  "   shll $8,%eax                                              \n\t"
+  "   shrw $8,%ax                                               \n\t"
+
+"# [OK] hey, I'm violating Shawn's rules for SetBank32...       \n\t"
+"# [OK] oh well, I might make it 100% relocatable later         \n\t"
+"# [OK] (how? I can think of at least 3 ways, so don't worry)   \n\t"
+"# [OK] or just use LFB meanwhile (or preferably always)        \n\t"
+  "   movl _mach64_wpsel,%edx                                   \n\t"
+  "   outl %eax,%dx                                             \n\t"
+  "   movl _mach64_rpsel,%edx                                   \n\t"
+  "   outl %eax,%dx                                             \n\t"
 
-      popal
-      ret
+  "   popal                                                     \n\t"
+  "   ret                                                       \n\t"
 
-   _SetBank32End:
+ " _SetBank32End:                                               \n\t"
 
-");
+);
 
 
 
diff -aprNU3 freebe.orig/makefile freebe/makefile
--- freebe.orig/makefile	1999-06-23 21:18:40 +0000
+++ freebe/makefile	2008-05-06 10:40:56 +0000
@@ -27,7 +27,7 @@ else
 ifdef PGCC
 CFLAGS = -O6 -mpentium -fomit-frame-pointer -Wall -Werror
 else
-CFLAGS = -O3 -m486 -fomit-frame-pointer -Wall -Werror
+CFLAGS = -O3 -mtune=generic -fomit-frame-pointer -Wall -Werror
 endif
 endif
 
diff -aprNU3 freebe.orig/matrox/driver.c freebe/matrox/driver.c
--- freebe.orig/matrox/driver.c	1999-06-25 19:04:44 +0000
+++ freebe/matrox/driver.c	2008-05-06 10:40:56 +0000
@@ -1150,25 +1150,25 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *  %edx.
  */
 
-asm ("
+asm (
 
-   .globl _SetBank32, _SetBank32End
+  ".globl _SetBank32, _SetBank32End\n\t"
 
-      .align 4
-   _SetBank32:
-      pushl %eax
-      pushl %edx
-      movb %dl, %ah
-      movb $4, %al
-      movw $0x03DE, %dx
-      outw %ax, %dx
-      popl %edx
-      popl %eax
-      ret
+  "   .align 4             \n\t"
+  "_SetBank32:             \n\t"
+  "   pushl %eax           \n\t"
+  "   pushl %edx           \n\t"
+  "   movb %dl, %ah        \n\t"
+  "   movb $4, %al         \n\t"
+  "   movw $0x03DE, %dx    \n\t"
+  "   outw %ax, %dx        \n\t"
+  "   popl %edx            \n\t"
+  "   popl %eax            \n\t"
+  "   ret\n\t"
 
-   _SetBank32End:
+  "_SetBank32End:          \n\t"
 
-");
+);
 
 
 
@@ -1944,8 +1944,6 @@ void PutMonoImage(AF_DRIVER *af, long fo
 	    : "c" (i),
 	      "S" (image),
 	      "D" (af->IOMemMaps[0])
-
-	    : "%ecx", "%esi", "%edi"
 	    );
 
 	 #else
@@ -1960,8 +1958,6 @@ void PutMonoImage(AF_DRIVER *af, long fo
 	      "S" (image),
 	      "D" (hwptr.IOMemMaps[0].offset),
 	      "a" (hwptr.IOMemMaps[0].sel)
-
-	    : "%ecx", "%edx", "%esi", "%edi"
 	    );
 
 	 #endif
@@ -2122,8 +2118,6 @@ void BitBltSys(AF_DRIVER *af, void *srcA
 	 : "c" (n),
 	   "S" (addr),
 	   "D" (af->IOMemMaps[0])
-
-	 : "%ecx", "%esi", "%edi"
 	 );
 
       #else
@@ -2139,7 +2133,7 @@ void BitBltSys(AF_DRIVER *af, void *srcA
 	   "D" (hwptr.IOMemMaps[0].offset),
 	   "a" (hwptr.IOMemMaps[0].sel)
 
-	 : "%ecx", "%edx", "%esi", "%edi"
+	 : "%edx"
 	 );
 
       #endif
@@ -2272,8 +2266,6 @@ void SrcTransBltSys(AF_DRIVER *af, void 
 	 : "c" (n),
 	   "S" (addr),
 	   "D" (af->IOMemMaps[0])
-
-	 : "%ecx", "%esi", "%edi"
 	 );
 
       #else
@@ -2289,7 +2281,7 @@ void SrcTransBltSys(AF_DRIVER *af, void 
 	   "D" (hwptr.IOMemMaps[0].offset),
 	   "a" (hwptr.IOMemMaps[0].sel)
 
-	 : "%ecx", "%edx", "%esi", "%edi"
+	 : "%edx"
 	 );
 
       #endif
diff -aprNU3 freebe.orig/nvidia/driver.c freebe/nvidia/driver.c
--- freebe.orig/nvidia/driver.c	1999-06-27 01:01:38 +0000
+++ freebe/nvidia/driver.c	2008-05-06 10:40:56 +0000
@@ -1146,45 +1146,45 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *  %edx.
  */
 
-asm ("
+asm (
 
-   .globl _SetBank32, _SetBank32End
+   ".globl _SetBank32, _SetBank32End\n\t"
 
-      .align 4
-   _SetBank32:
-      pushl %eax
-      pushl %ebx
-      pushl %edx
-
-      movl %edx, %ebx
-      shll $1, %ebx
-
-      movw $0x3D4, %dx
-      movw $0x571F, %ax
-      outw %ax, %dx
-      movb %bl, %ah
-      movb $0x1D, %al
-      outw %ax, %dx
-      movb $0x1E, %al
-      outw %ax, %dx
-
-      orb %bh, %bh
-      jz SkipHighBits
-
-      movb %bh, %ah
-      movb $0x29, %al
-      orb $3, %ah
-      outw %ax, %dx
-
-   SkipHighBits:
-      popl %edx
-      popl %ebx
-      popl %eax
-      ret
+   "  .align 4                      \n\t"
+   "_SetBank32:                     \n\t"
+   "  pushl %eax                    \n\t"
+   "  pushl %ebx                    \n\t"
+   "  pushl %edx                    \n\t"
+
+   "  movl %edx, %ebx               \n\t"
+   "  shll $1, %ebx                 \n\t"
+
+   "  movw $0x3D4, %dx              \n\t"
+   "  movw $0x571F, %ax             \n\t"
+   "  outw %ax, %dx                 \n\t"
+   "  movb %bl, %ah                 \n\t"
+   "  movb $0x1D, %al               \n\t"
+   "  outw %ax, %dx                 \n\t"
+   "  movb $0x1E, %al               \n\t"
+   "  outw %ax, %dx                 \n\t"
+
+   "  orb %bh, %bh                  \n\t"
+   "  jz SkipHighBits               \n\t"
+
+   "  movb %bh, %ah                 \n\t"
+   "  movb $0x29, %al               \n\t"
+   "  orb $3, %ah                   \n\t"
+   "  outw %ax, %dx                 \n\t"
+
+   "SkipHighBits:                   \n\t"
+   "  popl %edx                     \n\t"
+   "  popl %ebx                     \n\t"
+   "  popl %eax                     \n\t"
+   "  ret                           \n\t"
 
-   _SetBank32End:
+   "_SetBank32End:                  \n\t"
 
-");
+);
 
 
 
diff -aprNU3 freebe.orig/nvidia/riva_hw.c freebe/nvidia/riva_hw.c
--- freebe.orig/nvidia/riva_hw.c	1999-06-27 00:38:26 +0000
+++ freebe/nvidia/riva_hw.c	2008-05-06 10:40:56 +0000
@@ -858,7 +858,7 @@ static void CalcStateExt
     int            dotClock
 )
 {
-    int pixelDepth, VClk, m, n, p;
+    int pixelDepth, VClk = 0, m = 0, n = 0, p = 0;
     /*
      * Save mode parameters.
      */
diff -aprNU3 freebe.orig/paradise/driver.c freebe/paradise/driver.c
--- freebe.orig/paradise/driver.c	1998-12-21 20:52:24 +0000
+++ freebe/paradise/driver.c	2008-05-06 10:40:56 +0000
@@ -564,32 +564,32 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *  Relocatable bank switch function, called with a bank number in %edx.
  */
 
-asm ("
+asm (
 
-   .globl _CirrusSetBank32, _CirrusSetBank32End
+  ".globl _CirrusSetBank32, _CirrusSetBank32End            \n\t"
 
-      .align 4
-   _CirrusSetBank32:
-      pushl %edx
-      pushl %eax
-      pushl %edx
+  "   .align 4\n\t"
+  "_CirrusSetBank32:                                       \n\t"
+  "   pushl %edx                                           \n\t"
+  "   pushl %eax                                           \n\t"
+  "   pushl %edx                                           \n\t"
 
-      movl $0x3CE, %edx          /* 3CE index 0x9 */
-      movb $0x9, %al
-      outb %al, %dx
+  "   movl $0x3CE, %edx          /* 3CE index 0x9 */       \n\t"
+  "   movb $0x9, %al                                       \n\t"
+  "   outb %al, %dx                                        \n\t"
 
-      popl %eax                  /* write bank number */
-      shll $4, %eax
-      incl %edx
-      outb %al, %dx
+  "   popl %eax                  /* write bank number */   \n\t"
+  "   shll $4, %eax                                        \n\t"
+  "   incl %edx                                            \n\t"
+  "   outb %al, %dx                                        \n\t"
 
-      popl %eax
-      popl %edx
-      ret
+  "   popl %eax                                            \n\t"
+  "   popl %edx                                            \n\t"
+  "   ret                                                  \n\t"
 
-   _CirrusSetBank32End:
+  "_CirrusSetBank32End:                                    \n\t"
 
-");
+);
 
 
 
@@ -614,43 +614,43 @@ void CirrusSetBank(AF_DRIVER *af, long b
  *  Relocatable bank switch function, called with a bank number in %edx.
  */
 
-asm ("
+asm (
 
-   .globl _ParadiseSetBank32, _ParadiseSetBank32End
+  ".globl _ParadiseSetBank32, _ParadiseSetBank32End\n\t"
 
-      .align 4
-   _ParadiseSetBank32:
-      pushl %eax
-      pushl %ecx
-      pushl %edx
+  "   .align 4\n\t"
+  "_ParadiseSetBank32:\n\t"
+  "   pushl %eax\n\t"
+  "   pushl %ecx\n\t"
+  "   pushl %edx\n\t"
 
-      movl %edx, %ecx
-      shll $4, %ecx
+  "   movl %edx, %ecx\n\t"
+  "   shll $4, %ecx\n\t"
 
-      movl $0x3CE, %edx          /* 3CE index 0x9 */
-      movb $0x9, %al
-      outb %al, %dx
+  "   movl $0x3CE, %edx          /* 3CE index 0x9 */\n\t"
+  "   movb $0x9, %al\n\t"
+  "   outb %al, %dx\n\t"
 
-      movl %ecx, %eax            /* set read bank number */
-      incl %edx
-      outb %al, %dx
+  "   movl %ecx, %eax            /* set read bank number */\n\t"
+  "   incl %edx\n\t"
+  "   outb %al, %dx\n\t"
 
-      decl %edx                  /* 3CE index 0xA */
-      movb $0xA, %al
-      outb %al, %dx
+  "   decl %edx                  /* 3CE index 0xA */\n\t"
+  "   movb $0xA, %al\n\t"
+  "   outb %al, %dx\n\t"
 
-      movl %ecx, %eax            /* set write bank number */
-      incl %edx
-      outb %al, %dx
+  "   movl %ecx, %eax            /* set write bank number */\n\t"
+  "   incl %edx\n\t"
+  "   outb %al, %dx\n\t"
 
-      popl %edx
-      popl %ecx
-      popl %eax
-      ret
+  "   popl %edx\n\t"
+  "   popl %ecx\n\t"
+  "   popl %eax\n\t"
+  "   ret\n\t"
 
-   _ParadiseSetBank32End:
+  "_ParadiseSetBank32End:\n\t"
 
-");
+);
 
 
 
diff -aprNU3 freebe.orig/s3/driver.c freebe/s3/driver.c
--- freebe.orig/s3/driver.c	1999-03-27 16:50:24 +0000
+++ freebe/s3/driver.c	2008-05-06 10:40:56 +0000
@@ -628,89 +628,89 @@ 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 %ecx
-      pushl %edx
-      movl %edx, %ecx
-      movl $0x3D4, %edx
-
-      movb $0x38, %al            /* enable extensions */
-      outb %al, %dx
-      incl %edx
-      movb $0x48, %al
-      outb %al, %dx
-      decl %edx
-
-      movb $0x31, %al            /* read register 0x31 */
-      outb %al, %dx 
-      incl %edx
-      inb %dx, %al
-      decl %edx
-
-      movb %al, %ah              /* set bank write and vid mem > 256K flags */
-      movb $0x31, %al
-      outb %al, %dx
-      movb %ah, %al
-      orb $9, %al 
-      incl %edx
-      outb %al, %dx
-      decl %edx
-
-      movb $0x35, %al            /* read register 0x35 */
-      outb %al, %dx
-      incl %edx
-      inb %dx, %al
-      decl %edx
-
-      andb $0xF0, %al            /* mix bits 0-3 of bank number */
-      movb %cl, %ch
-      andb $0x0F, %ch
-      orb %al, %ch
-
-      movb $0x35, %al            /* write the bits 0-3 of bank number */
-      outb %al, %dx
-      incl %edx
-      movb %ch, %al
-      outb %al, %dx 
-      decl %edx
-
-      movb $0x51, %al            /* read register 0x51 */
-      outb %al, %dx
-      incl %edx
-      inb %dx, %al
-      decl %edx
-
-      andb $0xF3, %al            /* mix bits 4-5 of bank number */
-      shrb $2, %cl
-      andb $0x0C, %cl
-      orb %al, %cl
-
-      movb $0x51, %al            /* write the bits 4-5 of bank number */
-      outb %al, %dx
-      incl %edx
-      movb %cl, %al
-      outb %al, %dx
-      decl %edx
-
-      movb $0x38, %al            /* disable extensions */
-      outb %al, %dx
-      incl %edx
-      xorb %al, %al
-      outb %al, %dx
-      decl %edx
-
-      popl %edx
-      popl %ecx
-      ret
+  "   .align 4\n\t"
+  "_SetBank32:\n\t"
+  "   pushl %ecx\n\t"
+  "   pushl %edx\n\t"
+  "   movl %edx, %ecx\n\t"
+  "   movl $0x3D4, %edx\n\t"
+
+  "   movb $0x38, %al            /* enable extensions */\n\t"
+  "   outb %al, %dx\n\t"
+  "   incl %edx\n\t"
+  "   movb $0x48, %al\n\t"
+  "   outb %al, %dx\n\t"
+  "   decl %edx\n\t"
+
+  "   movb $0x31, %al            /* read register 0x31 */\n\t"
+  "   outb %al, %dx\n\t"
+  "   incl %edx\n\t"
+  "   inb %dx, %al\n\t"
+  "   decl %edx\n\t"
+
+  "   movb %al, %ah              /* set bank write and vid mem > 256K flags */\n\t"
+  "   movb $0x31, %al\n\t"
+  "   outb %al, %dx\n\t"
+  "   movb %ah, %al\n\t"
+  "   orb $9, %al\n\t"
+  "   incl %edx\n\t"
+  "   outb %al, %dx\n\t"
+  "   decl %edx\n\t"
+
+  "   movb $0x35, %al            /* read register 0x35 */\n\t"
+  "   outb %al, %dx\n\t"
+  "   incl %edx\n\t"
+  "   inb %dx, %al\n\t"
+  "   decl %edx\n\t"
+
+  "   andb $0xF0, %al            /* mix bits 0-3 of bank number */\n\t"
+  "   movb %cl, %ch\n\t"
+  "   andb $0x0F, %ch\n\t"
+  "   orb %al, %ch\n\t"
+
+  "   movb $0x35, %al            /* write the bits 0-3 of bank number */\n\t"
+  "   outb %al, %dx\n\t"
+  "   incl %edx\n\t"
+  "   movb %ch, %al\n\t"
+  "   outb %al, %dx\n\t"
+  "   decl %edx\n\t"
+
+  "   movb $0x51, %al            /* read register 0x51 */\n\t"
+  "   outb %al, %dx\n\t"
+  "   incl %edx\n\t"
+  "   inb %dx, %al\n\t"
+  "   decl %edx\n\t"
+
+  "   andb $0xF3, %al            /* mix bits 4-5 of bank number */\n\t"
+  "   shrb $2, %cl\n\t"
+  "   andb $0x0C, %cl\n\t"
+  "   orb %al, %cl\n\t"
+
+  "   movb $0x51, %al            /* write the bits 4-5 of bank number */\n\t"
+  "   outb %al, %dx\n\t"
+  "   incl %edx\n\t"
+  "   movb %cl, %al\n\t"
+  "   outb %al, %dx\n\t"
+  "   decl %edx\n\t"
+
+  "   movb $0x38, %al            /* disable extensions */\n\t"
+  "   outb %al, %dx\n\t"
+  "   incl %edx\n\t"
+  "   xorb %al, %al\n\t"
+  "   outb %al, %dx\n\t"
+  "   decl %edx\n\t"
+
+  "   popl %edx\n\t"
+  "   popl %ecx\n\t"
+  "   ret\n\t"
 
-   _SetBank32End:
+  "_SetBank32End:\n\t"
 
-");
+);
 
 /* SetBank:
  *  C-callable bank switch function. This version simply chains to the
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	2008-05-06 10:40:56 +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/tgui/driver.c freebe/tgui/driver.c
--- freebe.orig/tgui/driver.c	1998-12-11 23:03:48 +0000
+++ freebe/tgui/driver.c	2008-05-06 10:40:56 +0000
@@ -1179,8 +1179,7 @@ void BitBltSys(AF_DRIVER *af, void *srcA
        :
        : "c" (n),
 	 "S" (addr),
-	 "D" (BASE_PSEUDO_DMA)
-       : "%ecx", "%esi", "%edi");
+	 "D" (BASE_PSEUDO_DMA));
      addr+=srcPitch;
     }
 }
@@ -1240,8 +1239,7 @@ void SrcTransBltSys(AF_DRIVER *af, void 
        :
        : "c" (n),
 	 "S" (addr),
-	 "D" (BASE_PSEUDO_DMA)
-       : "%ecx", "%esi", "%edi");
+	 "D" (BASE_PSEUDO_DMA));
      addr+=srcPitch;
     }
 }
@@ -1301,8 +1299,7 @@ void PutMonoImage(AF_DRIVER *af, long fo
        :
        : "c" (n),
 	 "S" (image),
-	 "D" (BASE_PSEUDO_DMA)
-       : "%ecx", "%esi", "%edi");
+	 "D" (BASE_PSEUDO_DMA));
      image+=byteWidth;
     }
 }
@@ -1525,23 +1522,23 @@ void SetBank(AF_DRIVER *af, long bank)
  *  %edx.
  */
 
-asm ("
-.globl _SetBank32, _SetBank32End
+asm (
+".globl _SetBank32, _SetBank32End   \n\t"
 
-   .align 4
-_SetBank32:
-   pushl %eax
-   pushl %edx
-   movb %dl, %al
-   movb %dl, %ah
-   movw $0x03D8, %dx
-   outw %ax, %dx
-   popl %edx
-   popl %eax
-   ret
+"  .align 4                         \n\t"
+"_SetBank32:                        \n\t"
+"   pushl %eax                      \n\t"
+"   pushl %edx                      \n\t"
+"   movb %dl, %al                   \n\t"
+"   movb %dl, %ah                   \n\t"
+"   movw $0x03D8, %dx               \n\t"
+"   outw %ax, %dx                   \n\t"
+"   popl %edx                       \n\t"
+"   popl %eax                       \n\t"
+"   ret                             \n\t"
 
-_SetBank32End:
-");
+"_SetBank32End:                     \n\t"
+);
 
 
 /**[txh]********************************************************************
diff -aprNU3 freebe.orig/tgui/vga.h freebe/tgui/vga.h
--- freebe.orig/tgui/vga.h	1998-07-22 15:28:46 +0000
+++ freebe/tgui/vga.h	2008-05-06 10:40:56 +0000
@@ -97,13 +97,13 @@ void WaitVRT()
 extern inline
 uchar ReadCRT(uchar index)
 {
- uchar a asm("%eax");
+ register uchar a asm("%eax");
  a=index;
- asm volatile ("
-     outb %%al,%%dx
-     incl %%edx
-     inb  %%dx,%%al
-     " : "a=" (a) : "a" (a), "d" (CRTController) : "%edx");
+ __asm__ __volatile__ (
+    "outb %%al,%%dx  \n\t"
+    "incl %%edx      \n\t"
+    "inb  %%dx,%%al  \n\t"
+      : "=a" (a) : "a" (a), "d" (CRTController));
  return a;
 }
 
@@ -111,71 +111,71 @@ uchar ReadCRT(uchar index)
 extern inline
 uchar ReadGRA(uchar index)
 {
- uchar a asm("%eax");
+ register uchar a asm("%eax");
  a=index;
- asm volatile ("
-     outb %%al,%%dx
-     incl %%edx
-     inb  %%dx,%%al
-     " : "a=" (a) : "a" (a), "d" (GraphicsController) : "%edx");
+ __asm__ __volatile__ (
+    "outb %%al,%%dx  \n\t"
+    "incl %%edx      \n\t"
+    "inb  %%dx,%%al  \n\t"
+      : "=a" (a) : "a" (a), "d" (GraphicsController));
  return a;
 }
 
 extern inline
 uchar ReadSEQ(uchar index)
 {
- uchar a asm("%eax");
+ register uchar a asm("%eax");
  a=index;
- asm volatile ("
-     outb %%al,%%dx
-     incl %%edx
-     inb  %%dx,%%al
-     " : "a=" (a) : "a" (a), "d" (Sequencer) : "%edx");
+ __asm__ __volatile__ (
+    "outb %%al,%%dx  \n\t"
+    "incl %%edx      \n\t"
+    "inb  %%dx,%%al  \n\t"
+      : "=a" (a) : "a" (a), "d" (Sequencer));
  return a;
 }
 
 extern inline
 void WriteCRT(uchar index, uchar value)
 {
- asm volatile ("
-     movb %0,%%ah
-     outw %%ax,%%dx
-     " : : "qi" (value), "a" (index), "d" (CRTController) : "%eax");
+ __asm__ __volatile__ (
+    "movb %0,%%ah    \n\t"
+    "outw %%ax,%%dx  \n\t"
+      : : "qi" (value), "a" (index), "d" (CRTController));
 }
 
 extern inline
 void WriteGRA(uchar index, uchar value)
 {
- asm volatile ("
-     movb %0,%%ah
-     outw %%ax,%%dx
-     " : : "qi" (value), "a" (index), "d" (GraphicsController) : "%eax");
+ __asm__ __volatile__ (
+    "movb %0,%%ah    \n\t"
+    "outw %%ax,%%dx  \n\t"
+      : : "qi" (value), "a" (index), "d" (GraphicsController));
 }
 
 extern inline
 void WriteSEQ(uchar index, uchar value)
 {
- asm volatile ("
-     movb %0,%%ah
-     outw %%ax,%%dx
-     " : : "qi" (value), "a" (index), "d" (Sequencer) : "%eax");
+ __asm__ __volatile__ (
+    "movb %0,%%ah    \n\t"
+    "outw %%ax,%%dx  \n\t"
+      : : "qi" (value), "a" (index), "d" (Sequencer));
 }
 
 
 extern inline
 void WaitVRT()
 {
- asm("
- 1:
-     inb   %%dx,%%al
-     testb $8,%%al
-     jne 1b
-     .align 2,0x90
- 2:
-     inb %%dx,%%al
-     testb $8,%%al
-     je 2b
-     " : : "d" (InputStatusRegister1) : "%eax" );
+ asm(
+"1:                   \n\t"
+"    inb   %%dx,%%al  \n\t"
+"    testb $8,%%al    \n\t"
+"    jne 1b           \n\t"
+"    .align 2,0x90    \n\t"
+"2:                   \n\t"
+"    inb %%dx,%%al    \n\t"
+"    testb $8,%%al    \n\t"
+"    je 2b            \n\t"
+      : : "d" (InputStatusRegister1) : "%eax" );
 }
 
 #endif
@@ -235,14 +235,13 @@ void WriteEDAC(int index, int val)
 extern inline
 void RPF_SetPalRange(unsigned char *_pal_ptr, int color, int cant)
 {
-__asm__("
-     outb %%al,%%dx
-     incl %%edx
-     cli
-     rep
-     outsb
-     sti"
-: : "c" (cant*3), "S" (_pal_ptr), "a" (color), "d" (0x3C8)
-: "%eax", "%ecx", "%edx", "%esi");
+__asm__(
+    "outb %%al,%%dx  \n\t"
+    "incl %%edx      \n\t"
+    "cli             \n\t"
+    "rep             \n\t"
+    "outsb           \n\t"
+    "sti             \n\t"
+: : "c" (cant*3), "S" (_pal_ptr), "a" (color), "d" (0x3C8));
 }
 
diff -aprNU3 freebe.orig/trident/driver.c freebe/trident/driver.c
--- freebe.orig/trident/driver.c	1998-12-21 20:51:52 +0000
+++ freebe/trident/driver.c	2008-05-06 10:40:56 +0000
@@ -570,29 +570,29 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *  Relocatable bank switch function, called with a bank number in %edx.
  */
 
-asm ("
+asm (
 
-   .globl _DualSetBank32, _DualSetBank32End
+  ".globl _DualSetBank32, _DualSetBank32End    \n\t"
 
-      .align 4
-   _DualSetBank32:
-      pushl %edx
-      pushl %eax
-      movl %edx, %eax
+  "   .align 4                                 \n\t"
+  "_DualSetBank32:                             \n\t"
+  "   pushl %edx                               \n\t"
+  "   pushl %eax                               \n\t"
+  "   movl %edx, %eax                          \n\t"
 
-      movl $0x3D8, %edx
-      outb %al, %dx
+  "   movl $0x3D8, %edx                        \n\t"
+  "   outb %al, %dx                            \n\t"
 
-      incl %edx
-      outb %al, %dx
+  "   incl %edx                                \n\t"
+  "   outb %al, %dx                            \n\t"
 
-      popl %eax
-      popl %edx
-      ret
+  "   popl %eax                                \n\t"
+  "   popl %edx                                \n\t"
+  "   ret                                      \n\t"
 
-   _DualSetBank32End:
+  "_DualSetBank32End:                          \n\t"
 
-");
+);
 
 
 
@@ -617,40 +617,40 @@ void DualSetBank(AF_DRIVER *af, long ban
  *  Relocatable bank switch function, called with a bank number in %edx.
  */
 
-asm ("
+asm (
 
-   .globl _SingleSetBank32, _SingleSetBank32End
+  ".globl _SingleSetBank32, _SingleSetBank32End                         \n\t"
 
-      .align 4
-   _SingleSetBank32:
-      pushl %edx
-      pushl %eax
-      movb %dl, %ah              /* save bank into ah */
-
-      movl $0x3C4, %edx          /* read port 3C4 register 0xE */
-      movb $0xE, %al
-      outb %al, %dx 
-      incl %edx
-      inb %dx, %al
-      decl %edx
-
-      andb $0xF0, %al            /* mask low four bits */
-      xorb $2, %ah               /* xor bank number with 2 */
-      orb %al, %ah
-
-      movb $0xE, %al             /* write to port 3C4 register 0xE */
-      outb %al, %dx
-      incl %edx
-      movb %ah, %al
-      outb %al, %dx
-
-      popl %eax
-      popl %edx
-      ret
+  "   .align 4                                                          \n\t"
+  "_SingleSetBank32:                                                    \n\t"
+  "   pushl %edx                                                        \n\t"
+  "   pushl %eax                                                        \n\t"
+  "   movb %dl, %ah              /* save bank into ah */                \n\t"
+
+  "   movl $0x3C4, %edx          /* read port 3C4 register 0xE */       \n\t"
+  "   movb $0xE, %al                                                    \n\t"
+  "   outb %al, %dx                                                     \n\t"
+  "   incl %edx                                                         \n\t"
+  "   inb %dx, %al                                                      \n\t"
+  "   decl %edx                                                         \n\t"
+
+  "   andb $0xF0, %al            /* mask low four bits */               \n\t"
+  "   xorb $2, %ah               /* xor bank number with 2 */           \n\t"
+  "   orb %al, %ah                                                      \n\t"
+
+  "   movb $0xE, %al             /* write to port 3C4 register 0xE */   \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"
 
-   _SingleSetBank32End:
+  "_SingleSetBank32End:                                                 \n\t"
 
-");
+);
 
 
 
diff -aprNU3 freebe.orig/tseng/driver.c freebe/tseng/driver.c
--- freebe.orig/tseng/driver.c	1998-12-20 17:23:16 +0000
+++ freebe/tseng/driver.c	2008-05-06 10:40:56 +0000
@@ -601,30 +601,30 @@ void SetPaletteData(AF_DRIVER *af, AF_PA
  *  Relocatable bank switch function, called with a bank number in %edx.
  */
 
-asm ("
+asm (
 
-   .globl _ET3000SetBank32, _ET3000SetBank32End
+  ".globl _ET3000SetBank32, _ET3000SetBank32End                             \n\t"
 
-      .align 4
-   _ET3000SetBank32:
-      pushl %edx
-      pushl %eax
+  "   .align 4                                                              \n\t"
+  "_ET3000SetBank32:                                                        \n\t"
+  "   pushl %edx                                                            \n\t"
+  "   pushl %eax                                                            \n\t"
 
-      movb %dl, %al              /* mask read and write banks together */
-      shlb $3, %al
-      orb %dl, %al 
-      orb $0x40, %al             /* select 64k segments */
+  "   movb %dl, %al              /* mask read and write banks together */   \n\t"
+  "   shlb $3, %al                                                          \n\t"
+  "   orb %dl, %al                                                          \n\t"
+  "   orb $0x40, %al             /* select 64k segments */                  \n\t"
 
-      movl $0x3CD, %edx
-      outb %al, %dx              /* write to the card */
+  "   movl $0x3CD, %edx                                                     \n\t"
+  "   outb %al, %dx              /* write to the card */                    \n\t"
 
-      popl %eax
-      popl %edx
-      ret
+  "   popl %eax                                                             \n\t"
+  "   popl %edx                                                             \n\t"
+  "   ret                                                                   \n\t"
 
-   _ET3000SetBank32End:
+  "_ET3000SetBank32End:                                                     \n\t"
 
-");
+);
 
 
 
@@ -649,29 +649,29 @@ void ET3000SetBank(AF_DRIVER *af, long b
  *  Relocatable bank switch function, called with a bank number in %edx.
  */
 
-asm ("
+asm (
 
-   .globl _ET4000SetBank32, _ET4000SetBank32End
+  ".globl _ET4000SetBank32, _ET4000SetBank32End                             \n\t"
 
-      .align 4
-   _ET4000SetBank32:
-      pushl %edx
-      pushl %eax
+  "   .align 4                                                              \n\t"
+  "_ET4000SetBank32:                                                        \n\t"
+  "   pushl %edx                                                            \n\t"
+  "   pushl %eax                                                            \n\t"
 
-      movb %dl, %al              /* mask read and write banks together */
-      shlb $4, %al
-      orb %dl, %al 
+  "   movb %dl, %al              /* mask read and write banks together */   \n\t"
+  "   shlb $4, %al                                                          \n\t"
+  "   orb %dl, %al                                                          \n\t"
 
-      movl $0x3CD, %edx
-      outb %al, %dx              /* write to the card */
+  "   movl $0x3CD, %edx                                                     \n\t"
+  "   outb %al, %dx              /* write to the card */                    \n\t"
 
-      popl %eax
-      popl %edx
-      ret
+  "   popl %eax                                                             \n\t"
+  "   popl %edx                                                             \n\t"
+  "   ret                                                                   \n\t"
 
-   _ET4000SetBank32End:
+  "_ET4000SetBank32End:                                                     \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	2008-05-06 10:40:56 +0000
@@ -21,8 +21,9 @@
 
 #include <pc.h>
 
-
-#define NULL   0
+#ifndef NULL
+# define NULL  0
+#endif
 
 #define TRUE   1
 #define FALSE  0
@@ -146,7 +147,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 +178,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 +208,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 +222,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));
diff -aprNU3 freebe.orig/video7/driver.c freebe/video7/driver.c
--- freebe.orig/video7/driver.c	1998-12-21 20:51:12 +0000
+++ freebe/video7/driver.c	2008-05-06 10:40:56 +0000
@@ -527,28 +527,28 @@ 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
+  "   .align 4                                          \n\t"
+  "_SetBank32:                                          \n\t"
+  "   pushl %edx                                        \n\t"
+  "   pushl %eax                                        \n\t"
 
-      movb %dl, %ah
-      shlb $4, %ah               /* bank number */
-      movb $0xE8, %al
-      movl $0x3C4, %edx
-      outw %ax, %dx              /* 3C4 index 0xE8 */
+  "   movb %dl, %ah                                     \n\t"
+  "   shlb $4, %ah               /* bank number */      \n\t"
+  "   movb $0xE8, %al                                   \n\t"
+  "   movl $0x3C4, %edx                                 \n\t"
+  "   outw %ax, %dx              /* 3C4 index 0xE8 */   \n\t"
 
-      popl %eax 
-      popl %edx
-      ret
+  "   popl %eax                                         \n\t"
+  "   popl %edx                                         \n\t"
+  "   ret                                               \n\t"
 
-   _SetBank32End:
+  "_SetBank32End:                                       \n\t"
 
-");
+);
 
 
 
