// Use the bios to get the current video mode\r
//\r
\r
-long/*FIXME: why long? "long" is 32-bit datatype, VGA modes are 8-bit numbers. */\r
+byte/*FIXME: why long? "long" is 32-bit datatype, VGA modes are 8-bit numbers. */\r
vgaGetMode()\r
{\r
return int10_getmode();\r
void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)\r
{\r
word i;\r
- dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */\r
+ dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA; /* used for faster screen clearing */\r
struct vga_mode_params cm;\r
int CRTParmCount;\r
\r
cm.clock_select = 0; /* misc register = 0xE3 25MHz */\r
cm.vsync_neg = 1;\r
cm.hsync_neg = 1;\r
+ vga_state.vga_stride=0x58;\r
+ cm.offset=0x2c;\r
break;\r
case 2: // TODO: 160x120 according to ModeX_160x120regs\r
return;\r
static word a[PAL_SIZE]; //palette array of change values!\r
word z=0, aq=0, aa=0, pp=0;\r
\r
- modexWaitBorder();\r
+ //modexWaitBorder();\r
+ vga_wait_for_vsync();\r
if((*i)==0)\r
{\r
memset(a, -1, sizeof(a));\r
//if(qp>0) printf("qp=%d\n", qp);\r
//if(qp>0) printf(" (*i)=%d\n", (*i)/3);\r
}\r
- modexWaitBorder(); /* waits one retrace -- less flicker */\r
+ //modexWaitBorder(); /* waits one retrace -- less flicker */\r
+ vga_wait_for_vsync();\r
if((*i)>=PAL_SIZE/2 && w==0)\r
{\r
for(; (*i)<PAL_SIZE; (*i)++)\r
pp = q;\r
//printf("1(*i)=%02d\n", (*i)/3);\r
//printf("1z=%02d\n", z/3);\r
- chkcolor(bmp, &q, &a, &aa, &z, i);\r
+ modexchkcolor(bmp, &q, &a, &aa, &z, i);\r
//printf("2(*i)=%02d\n", (*i)/3);\r
//printf("2z=%02d\n", z/3);\r
aq=0;\r
modexPalUpdate1(byte *p)\r
{\r
int i;\r
- modexWaitBorder();\r
+ //modexWaitBorder();\r
+ vga_wait_for_vsync();\r
outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */\r
for(i=0; i<PAL_SIZE/2; i++)\r
{\r
outp(PAL_DATA_REG, p[i]);\r
}\r
- modexWaitBorder(); /* waits one retrace -- less flicker */\r
+ //modexWaitBorder(); /* waits one retrace -- less flicker */\r
+ vga_wait_for_vsync();\r
for(; i<PAL_SIZE; i++)\r
{\r
outp(PAL_DATA_REG, p[(i)]);\r
modexPalUpdate0(byte *p)\r
{\r
int i;\r
- modexWaitBorder();\r
+ //modexWaitBorder();\r
+ vga_wait_for_vsync();\r
outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */\r
for(i=0; i<PAL_SIZE/2; i++)\r
{\r
outp(PAL_DATA_REG, rand());\r
}\r
- modexWaitBorder(); /* waits one retrace -- less flicker */\r
+ //modexWaitBorder(); /* waits one retrace -- less flicker */\r
+ vga_wait_for_vsync();\r
for(; i<PAL_SIZE; i++)\r
{\r
outp(PAL_DATA_REG, rand());\r
void\r
modexPalOverscan(byte *p, word col)\r
{\r
- modexWaitBorder();\r
+ //modexWaitBorder();\r
+ vga_wait_for_vsync();\r
outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */\r
outp(PAL_DATA_REG, col);\r
}\r
\r
//color checker~\r
//i want to make another vesion that checks the palette when the palette is being appened~\r
-void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)\r
+void modexchkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)\r
{\r
byte *pal;\r
word zz=0;\r
\r
}\r
\r
-void modexhlin(page_t *page, word xl, word xh, word y, word color)\r
-{\r
- word x;\r
- word yy=0;\r
-\r
- for(x=0;x<xh*4;x+=4)\r
- {\r
- if(x+4>=page[0].sw-1){ x=0; yy+=4; }\r
- modexClearRegion(page, x+xl, y+yy, 4, 4, color);\r
- }\r
- //modexputPixel(page, x+xl, y, color);\r
-}\r
-\r
-void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q)\r
+void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
{\r
word s, o, w;\r
word addr = (word) romFontsData.l;\r
+ word addrq = (page->width/4) * y + (x / 4) + ((word)page->data);\r
byte c;\r
\r
s=romFonts[t].seg;\r
JNZ L1\r
}\r
//TODO: OPTIMIZE THIS!!!!\r
- modexDrawCharPBuf(page, x, y, t, col, bgcol, q);\r
+ modexDrawCharPBuf(page, x, y, t, col, bgcol, addrq);\r
\r
//if(!q) getch();\r
}\r
}\r
\r
/* palette dump on display! */\r
-void pdump(page_t *pee)\r
+void modexpdump(page_t *pee)\r
{\r
int mult=(QUADWH);\r
int palq=(mult)*TILEWH;\r
// the Virtual screen. //\r
// //\r
/////////////////////////////////////////////////////////////////////////////\r
-void cls(page_t *page, byte color, byte *Where)\r
+void modexcls(page_t *page, byte color, byte *Where)\r
{\r
//modexClearRegion(page, 0, 0, page->width, page->height, color);\r
/* set map mask to all 4 planes */\r
_fmemset(Where, color, page->width*(page->height)/4);\r
}\r
\r
-void\r
+/*void\r
modexWaitBorder() {\r
while(inp(INPUT_STATUS_1) & 8) {\r
- /* spin */\r
+ // spin\r
}\r
\r
while(!(inp(INPUT_STATUS_1) & 8)) {\r
- /* spin */\r
+ // spin\r
}\r
+}*/\r
+\r
+void bios_cls() {\r
+ VGA_ALPHA_PTR ap;\r
+ VGA_RAM_PTR rp;\r
+ unsigned char m;\r
+\r
+ m = int10_getmode();\r
+ if ((rp=vga_state.vga_graphics_ram) != NULL && !(m <= 3 || m == 7)) {\r
+ unsigned int i,im;\r
+\r
+ im = (FP_SEG(vga_state.vga_graphics_ram_fence) - FP_SEG(vga_state.vga_graphics_ram));\r
+ if (im > 0xFFE) im = 0xFFE;\r
+ im <<= 4;\r
+ for (i=0;i < im;i++) vga_state.vga_graphics_ram[i] = 0;\r
+ }\r
+ else if ((ap=vga_state.vga_alpha_ram) != NULL) {\r
+ unsigned int i,im;\r
+\r
+ im = (FP_SEG(vga_state.vga_alpha_ram_fence) - FP_SEG(vga_state.vga_alpha_ram));\r
+ if (im > 0x7FE) im = 0x7FE;\r
+ im <<= 4 - 1; /* because ptr is type uint16_t */\r
+ for (i=0;i < im;i++) vga_state.vga_alpha_ram[i] = 0x0720;\r
+ }\r
+ else {\r
+ printf("WARNING: bios cls no ptr\n");\r
+ }\r
}\r