X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fmodex16.c;h=ea059d82d2c58837413e8dba0e2adc643c697cdb;hb=ddf0f7c950011c570d0c0a35ad9b2dea8d5d1160;hp=ac31bb0ac000f74801d7df390f833ed20210cd9e;hpb=c5ae4553d9d0d94ac69f8e70d1f0727ed58d2dbb;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index ac31bb0a..ea059d82 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -97,8 +97,7 @@ modexEnter(sword vq, global_game_variables_t *gv) switch(vq) { - case 0: - //case 1://---- + case 1: CRTParmCount = sizeof(ModeX_320x240regs) / sizeof(ModeX_320x240regs[0]); /* width and height */ gv->video.page[0].sw=320; @@ -115,8 +114,7 @@ modexEnter(sword vq, global_game_variables_t *gv) ptr[i] = 0x0000; } break; - //++++ - case 1: + case 2: CRTParmCount = sizeof(ModeX_192x144regs) / sizeof(ModeX_192x144regs[0]); /* width and height */ gv->video.page[0].sw=192; @@ -127,6 +125,40 @@ modexEnter(sword vq, global_game_variables_t *gv) outpw(CRTC_INDEX, ModeX_192x144regs[i]); } + /* clear video memory */ + outpw(SC_INDEX, 0x0f02); + for(i=0; i<0x8000; i++) { + ptr[i] = 0x0000; + } + break; + case 3: + CRTParmCount = sizeof(ModeX_320x200regs) / sizeof(ModeX_320x200regs[0]); + /* width and height */ + gv->video.page[0].sw=320; + gv->video.page[0].sh=200; + + /* send the CRTParms */ + for(i=0; ivideo.page[0].sw=256; + gv->video.page[0].sh=192; + + /* send the CRTParms */ + for(i=0; itilesw; + page.tilesh=p->tilesh; //pageSize = p->sw*p->sh; page.id = 0; @@ -394,7 +428,6 @@ modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) { modexDrawBmpRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); } - void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp) { @@ -463,10 +496,27 @@ modexDrawBmpRegion(page_t *page, int x, int y, } void -modex_sparky4_DrawBmpRegion(page_t *page, int x, int y, - int rx, int ry, int rw, int rh, bitmap_t *bmp) { - word poffset = (word) page->data + y*(page->width/4) + x/4; - byte far *data = bmp->data;//+bmp->offset; +modexDrawPlanarBuf(page_t *page, int x, int y, planar_buf_t *bmp) { + /* TODO - adapt from test code */ + int plane; + for(plane=0; plane < 4; plane++) + { + //fack + } +} + + +void +modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp) { + /* draw the whole sprite */ + modexDrawSpriteRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + +/*void +modexDrawSpriteRegion(page_t *page, int x, int y, + int rx, int ry, int rw, int rh, bitmap_t *bmp) { + word poffset = (word)page->data + y*(page->width/4) + x/4; + byte *data = bmp->data;//+bmp->offset; word bmpOffset = (word) data + ry * bmp->width + rx; word width = rw; word height = rh; @@ -477,11 +527,6 @@ modex_sparky4_DrawBmpRegion(page_t *page, int x, int y, word rowCounter; byte planeCounter = 4; -/* printf("bmp->data=%Fp\n",bmp->data); - printf("*bmp->data=%Fp\n",*(bmp->data)); - printf("&bmp->data=%Fp\n",&(bmp->data));*/ - - //code is a bit slow here __asm { MOV AX, SCREEN_SEG ; go to the VGA memory MOV ES, AX @@ -503,7 +548,17 @@ modex_sparky4_DrawBmpRegion(page_t *page, int x, int y, ROW_LOOP: MOV CX, width ; count the columns SCAN_LOOP: + LODSB + DEC SI + CMP AL, 0 + JNE DRAW_PIXEL ; draw non-zero pixels + + INC DI ; skip the transparent pixel + ADD SI, 1 + JMP NEXT_PIXEL + DRAW_PIXEL: MOVSB ; copy the pixel + NEXT_PIXEL: SUB CX, 3 ; we skip the next 3 ADD SI, 3 ; skip the bmp pixels LOOP SCAN_LOOP ; finish the scan @@ -527,24 +582,7 @@ modex_sparky4_DrawBmpRegion(page_t *page, int x, int y, DEC planeCounter JNZ PLANE_LOOP ; do all 4 planes } -} - -void -modexDrawPlanarBuf(page_t *page, int x, int y, planar_buf_t *bmp) { - /* TODO - adapt from test code */ - int plane; - for(plane=0; plane < 4; plane++) - { - //fack - } -} - - -void -modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp) { - /* draw the whole sprite */ - modexDrawSpriteRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); -} +}//backup!*/ void modexDrawSpriteRegion(page_t *page, int x, int y, @@ -618,7 +656,6 @@ modexDrawSpriteRegion(page_t *page, int x, int y, } } - /* copy a region of video memory from one page to another. * It assumes that the left edge of the tile is the same on both * regions and the memory areas do not overlap.