X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16.c;h=798c9aee620d301092c95943d350f0570097abed;hb=17be56acf6a4d9c44762ea85bc6998955525e864;hp=1a111cf8235df6139f7c42498d1467a6ad658491;hpb=321aeec2b64da73bfc92378548e8d2fc9b274f7c;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 1a111cf8..798c9aee 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -125,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; @@ -392,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) { @@ -461,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; @@ -475,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 @@ -501,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 @@ -525,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, @@ -576,7 +616,7 @@ modexDrawSpriteRegion(page_t *page, int x, int y, MOV AX, height ; start the row counter MOV rowCounter, AX ; MOV DI, poffset ; go to the first pixel - MOV SI, bmpOffset ; go to the bmp pixel + MOV DI, bmpOffset ; go to the bmp pixel ROW_LOOP: MOV CX, width ; count the columns SCAN_LOOP: @@ -616,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.