X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16.c;h=de79999c52e337d474d681d93597b421b3a80e6f;hb=707c5310d94a386646727cafad91f93cc65052ad;hp=27ad067757bf51701e7c4775c43e015a2daf2cae;hpb=18e9a8fb1179c8843a3dc67cbb8f69250265858f;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 27ad0677..de79999c 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -151,7 +151,7 @@ page_t modexNextPage(page_t *p) { page_t result; - result.data = p->data + (p->width/4)*p->height; /* compute the offset */ + result.data = p->data + (p->width/4)*p->height; result.dx = 0; result.dy = 0; result.width = p->width; @@ -159,11 +159,12 @@ modexNextPage(page_t *p) { result.id = p->id+1; return result; +// return modexNextPageFlexibleSize(&p, p->width, p->height); } //next page with defined dimentions~ page_t -modexNextPage0(page_t *p, word x, word y) +modexNextPageFlexibleSize(page_t *p, word x, word y) { page_t result; @@ -284,24 +285,46 @@ modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) { void oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) { - byte plane; - word px, py; - word offset; - - /* TODO Make this fast. It's SLOOOOOOW */ - for(plane=0; plane < 4; plane++) { - modexSelectPlane(PLANE(plane+x)); - for(px = plane; px < bmp->width; px+=4) { - offset=px; - for(py=0; pyheight; py++) { - if(!sprite || bmp->data[offset]) - page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset]; - offset+=bmp->width; - } - } - } + byte plane; + word px, py; + word offset; + + /* TODO Make this fast. It's SLOOOOOOW */ + for(plane=0; plane < 4; plane++) { + modexSelectPlane(PLANE(plane+x)); + for(px = plane; px < bmp->width; px+=4) { + offset=px; + for(py=0; pyheight; py++) { + if(!sprite || bmp->data[offset]) + page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset]; + offset+=bmp->width; + } + } + } } +void +CDrawBmp(byte far* vgamem, page_t* page, int x, int y, bitmap_t *bmp, byte sprite) +{ + byte plane; + word px, py; + word offset=0; + + + /* TODO Make this fast. It's SLOOOOOOW */ + for(plane=0; plane < 4; plane++) { + modexSelectPlane(PLANE(plane+x)); + for(px = plane; px < bmp->width; px+=4) { + offset=px; + for(py=0; pyheight; py++) { + if(!sprite || bmp->data[offset]) + //modexputPixel(page, x+px, y+py, bmp->data[offset]); + vgamem[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset]; + offset+=bmp->width; + } + } + } +} void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) { @@ -314,7 +337,7 @@ void modexDrawBmpRegion(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; + byte far *data = bmp->data;//+bmp->offset; word bmpOffset = (word) data + ry * bmp->width + rx; word width = rw; word height = rh; @@ -325,9 +348,9 @@ modexDrawBmpRegion(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)); - printf("&bmp->data=%Fp\n",&(bmp->data)); + printf("&bmp->data=%Fp\n",&(bmp->data));*/ //code is a bit slow here __asm { @@ -1166,6 +1189,21 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c } } +///////////////////////////////////////////////////////////////////////////// +// // +// cls() - This clears the screen to the specified color, on the VGA or on // +// the Virtual screen. // +// // +///////////////////////////////////////////////////////////////////////////// +void cls(page_t *page, byte color, byte *Where) +{ + //modexClearRegion(page, 0, 0, page->width, page->height, color); + /* set map mask to all 4 planes */ + outpw(SC_INDEX, 0xff02); + //_fmemset(VGA, color, 16000); + _fmemset(Where, color, page->width*(page->height)); +} + void modexWaitBorder() { while(inp(INPUT_STATUS_1) & 8) {