X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16.c;h=247a24d34f1500392357014bd26fb34d4a9a25e5;hb=e9292f41f721bb096d78a2abe35020c045ebc749;hp=a2152825ee9638110111f011c051bdc1ff646a99;hpb=234ea19c3af4288b1705a459619a9ce0257252fb;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index a2152825..247a24d3 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -70,7 +70,7 @@ vgaSetMode(byte mode) // Use the bios to get the current video mode // -long/*FIXME: why long? "long" is 32-bit datatype, VGA modes are 8-bit numbers. */ +byte/*FIXME: why long? "long" is 32-bit datatype, VGA modes are 8-bit numbers. */ vgaGetMode() { return int10_getmode(); @@ -80,7 +80,7 @@ vgaGetMode() void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) { word i; - dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */ + dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA; /* used for faster screen clearing */ struct vga_mode_params cm; int CRTParmCount; @@ -115,6 +115,8 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) cm.clock_select = 0; /* misc register = 0xE3 25MHz */ cm.vsync_neg = 1; cm.hsync_neg = 1; + vga_state.vga_stride=0x58; + cm.offset=0x2c; break; case 2: // TODO: 160x120 according to ModeX_160x120regs return; @@ -545,7 +547,8 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset) static word a[PAL_SIZE]; //palette array of change values! word z=0, aq=0, aa=0, pp=0; - modexWaitBorder(); + //modexWaitBorder(); + vga_wait_for_vsync(); if((*i)==0) { memset(a, -1, sizeof(a)); @@ -595,7 +598,8 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset) //if(qp>0) printf("qp=%d\n", qp); //if(qp>0) printf(" (*i)=%d\n", (*i)/3); } - modexWaitBorder(); /* waits one retrace -- less flicker */ + //modexWaitBorder(); /* waits one retrace -- less flicker */ + vga_wait_for_vsync(); if((*i)>=PAL_SIZE/2 && w==0) { for(; (*i)=page[0].sw-1){ x=0; yy+=4; } - modexClearRegion(page, x+xl, y+yy, 4, 4, color); - } - //modexputPixel(page, x+xl, y, color); -} - -void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q) +void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, word addrq, boolean q) { word s, o, w; word addr = (word) romFontsData.l; @@ -917,7 +913,7 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons JNZ L1 } //TODO: OPTIMIZE THIS!!!! - modexDrawCharPBuf(page, x, y, t, col, bgcol, q); + modexDrawCharPBuf(page, x, y, t, col, bgcol, addrq, q); //if(!q) getch(); } @@ -999,7 +995,7 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c } /* palette dump on display! */ -void pdump(page_t *pee) +void modexpdump(page_t *pee) { int mult=(QUADWH); int palq=(mult)*TILEWH; @@ -1019,7 +1015,7 @@ void pdump(page_t *pee) // the Virtual screen. // // // ///////////////////////////////////////////////////////////////////////////// -void cls(page_t *page, byte color, byte *Where) +void modexcls(page_t *page, byte color, byte *Where) { //modexClearRegion(page, 0, 0, page->width, page->height, color); /* set map mask to all 4 planes */ @@ -1028,13 +1024,40 @@ void cls(page_t *page, byte color, byte *Where) _fmemset(Where, color, page->width*(page->height)/4); } -void +/*void modexWaitBorder() { while(inp(INPUT_STATUS_1) & 8) { - /* spin */ + // spin } while(!(inp(INPUT_STATUS_1) & 8)) { - /* spin */ + // spin } +}*/ + +void bios_cls() { + VGA_ALPHA_PTR ap; + VGA_RAM_PTR rp; + unsigned char m; + + m = int10_getmode(); + if ((rp=vga_state.vga_graphics_ram) != NULL && !(m <= 3 || m == 7)) { + unsigned int i,im; + + im = (FP_SEG(vga_state.vga_graphics_ram_fence) - FP_SEG(vga_state.vga_graphics_ram)); + if (im > 0xFFE) im = 0xFFE; + im <<= 4; + for (i=0;i < im;i++) vga_state.vga_graphics_ram[i] = 0; + } + else if ((ap=vga_state.vga_alpha_ram) != NULL) { + unsigned int i,im; + + im = (FP_SEG(vga_state.vga_alpha_ram_fence) - FP_SEG(vga_state.vga_alpha_ram)); + if (im > 0x7FE) im = 0x7FE; + im <<= 4 - 1; /* because ptr is type uint16_t */ + for (i=0;i < im;i++) vga_state.vga_alpha_ram[i] = 0x0720; + } + else { + printf("WARNING: bios cls no ptr\n"); + } }