From: sparky4 Date: Mon, 15 Jun 2015 17:10:56 +0000 (-0500) Subject: modex16.c lookings.... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=032eb85aa3374bfb48d545b5d093ac84aa68c561;p=16.git modex16.c lookings.... modified: Project 16.bfproject modified: maptest.exe modified: pcxtest.exe modified: scroll.exe modified: src/lib/modex16.c modified: src/lib/modex16.h modified: src/pcxtest.c modified: src/scroll.c modified: test.exe modified: test2.exe --- diff --git a/Project 16.bfproject b/Project 16.bfproject index 25e1576d..c5b969dd 100644 --- a/Project 16.bfproject +++ b/Project 16.bfproject @@ -2,8 +2,8 @@ c2e.convert_special: 0 e2c.convert_num: 0 openfiles: /dos/z/16/doc/project.txt:138:0:0: openfiles: /dos/z/16/src/palettec.c:179:0:0: -openfiles: /dos/z/16/src/pcxtest.c:1431:1432:0: -openfiles: /dos/z/16/src/scroll.c:20126:19524:1: +openfiles: /dos/z/16/src/pcxtest.c:141:0:0: +openfiles: /dos/z/16/src/scroll.c:20776:19775:0: openfiles: /dos/z/16/src/fmemtest.c:116:0:0: openfiles: /dos/z/16/src/emmtest.c:732:0:0: openfiles: /dos/z/16/src/emsdump.c:456:0:0: @@ -11,17 +11,17 @@ openfiles: /dos/z/16/src/maptest.c:463:0:0: openfiles: /dos/z/16/src/maptest0.c:366:0:0: openfiles: /dos/z/16/src/test.c:0:0:0: openfiles: /dos/z/16/src/test2.c:0:0:0: -openfiles: /dos/z/16/src/lib/planar.h:602:0:0: +openfiles: /dos/z/16/src/lib/modex16.c:2794:2497:1: +openfiles: /dos/z/16/src/lib/modex16.h:1062:586:0: +openfiles: /dos/z/16/src/lib/planar.h:131:0:0: openfiles: /dos/z/16/src/lib/PLANAR.C:0:0:0: openfiles: /dos/z/16/src/lib/bitmap.c:1152:604:0: openfiles: /dos/z/16/src/lib/bitmap.h:257:0:0: -openfiles: /dos/z/16/src/lib/modex16.c:24171:23610:0: -openfiles: /dos/z/16/src/lib/modex16.h:3028:2369:0: -openfiles: /dos/z/16/src/lib/dos_kb.c:3264:2598:0: +openfiles: /dos/z/16/src/lib/dos_kb.c:3264:2448:0: openfiles: /dos/z/16/src/lib/dos_kb.h:0:0:0: openfiles: /dos/z/16/src/lib/mapread.c:2265:1988:0: openfiles: /dos/z/16/src/lib/mapread.h:584:0:0: -openfiles: /dos/z/16/src/lib/fmapread.c:5968:5101:0: +openfiles: /dos/z/16/src/lib/fmapread.c:5968:4626:0: openfiles: /dos/z/16/src/lib/fmapread.h:436:0:0: openfiles: /dos/z/16/src/lib/exmm/memory.c:308:99:0: openfiles: /dos/z/16/src/lib/exmm/memory.h:0:0:0: @@ -47,7 +47,7 @@ c2e.convert_iso: 0 opendir: file:///dos/z/16/src/lib wrap_text_default: 0 bookmarks_filename_mode: 1 -ssearch_text: panswitch +ssearch_text: modexShowPage() snr_casesens: 0 view_blocks: 1 name: Project 16 @@ -77,39 +77,39 @@ recent_files: file:///dos/z/16/src/emstest.c recent_files: file:///dos/z/16/src/lib/exmm/x.bat recent_files: file:///dos/z/16/src/lib/jsmn/jsmn.c recent_files: file:///dos/z/16/src/lib/jsmn/jsmn.h -recent_files: file:///dos/z/16/src/lib/modex16.c +recent_files: file:///dos/z/16/src/scroll.c recent_files: file:///dos/z/16/doc/project.txt recent_files: file:///dos/z/16/src/palettec.c +recent_files: file:///dos/z/16/src/emmtest.c recent_files: file:///dos/z/16/src/pcxtest.c recent_files: file:///dos/z/16/src/fmemtest.c -recent_files: file:///dos/z/16/src/emmtest.c recent_files: file:///dos/z/16/src/emsdump.c recent_files: file:///dos/z/16/src/maptest.c -recent_files: file:///dos/z/16/src/scroll.c recent_files: file:///dos/z/16/src/maptest0.c recent_files: file:///dos/z/16/src/test.c recent_files: file:///dos/z/16/src/test2.c recent_files: file:///dos/z/16/src/lib/planar.h recent_files: file:///dos/z/16/src/lib/PLANAR.C -recent_files: file:///dos/z/16/src/lib/bitmap.c -recent_files: file:///dos/z/16/src/lib/bitmap.h -recent_files: file:///dos/z/16/src/lib/modex16.h recent_files: file:///dos/z/16/src/lib/dos_kb.c recent_files: file:///dos/z/16/src/lib/dos_kb.h -recent_files: file:///dos/z/16/src/lib/mapread.c recent_files: file:///dos/z/16/src/lib/mapread.h -recent_files: file:///dos/z/16/src/lib/fmapread.c recent_files: file:///dos/z/16/src/lib/fmapread.h -recent_files: file:///dos/z/16/src/lib/exmm/memory.h +recent_files: file:///dos/z/16/src/lib/fmapread.c +recent_files: file:///dos/z/16/src/lib/bitmap.c +recent_files: file:///dos/z/16/src/lib/bitmap.h +recent_files: file:///dos/z/16/src/lib/mapread.c recent_files: file:///dos/z/16/src/lib/exmm/emmsize.h recent_files: file:///dos/z/16/src/lib/exmm/emmret.h +recent_files: file:///dos/z/16/src/lib/exmm/memory.c recent_files: file:///dos/z/16/src/lib/jsmn/farjsmn.c +recent_files: file:///dos/z/16/src/lib/lib_head.h recent_files: file:///dos/z/16/src/lib/jsmn/farjsmn.h +recent_files: file:///dos/z/16/src/lib/exmm/memory.h +recent_files: file:///dos/z/16/makefile recent_files: file:///dos/z/16/src/lib/lib_head.c -recent_files: file:///dos/z/16/src/lib/lib_head.h -recent_files: file:///dos/z/16/src/lib/exmm/memory.c recent_files: file:///dos/z/16/src/lib/types.h -recent_files: file:///dos/z/16/makefile +recent_files: file:///dos/z/16/src/lib/modex16.c +recent_files: file:///dos/z/16/src/lib/modex16.h snr_replacetype: 0 savedir: file:///dos/z/16/src/lib spell_check_default: 1 @@ -121,21 +121,21 @@ snr_escape_chars: 0 htmlbar_view: 0 spell_lang: en ssearch_dotmatchall: 0 -searchlist: (*bmp)=bitmapLoadPcx("data/font.pcx");(*bmp)=bitmapLoadPcx("data/font.pcx"); -searchlist: modexDraws -searchlist: reg -searchlist: animate -searchlist: SelectPlane -searchlist: modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) { -searchlist: cla -searchlist: clear -searchlist: trigg -searchlist: memset -searchlist: font -searchlist: word text_mask[16] = {\n\t0x0002, 0x0102, 0x0202, 0x0302,\r\n\t0x0402, 0x0502, 0x0602, 0x0702,\r\n\t0x0802, 0x0902, 0x0A02, 0x0B02,\r\n\t0x0C02, 0x0D02, 0x0E02, 0x0F02\n}; searchlist: 0x3C4 searchlist: SC_INDEX searchlist: panswitch +searchlist: ++++ +searchlist: !! +searchlist: drawbmp +searchlist: move +searchlist: next +searchlist: bg +searchlist: newde +searchlist: default +searchlist: (1) +searchlist: map +searchlist: screen, +searchlist: modexShowPage() autocomplete: 1 outputb_show_all_output: 0 bookmarks_show_mode: 0 diff --git a/maptest.exe b/maptest.exe index 1c90823e..4bddfea8 100644 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index 56ec4451..da40e7ab 100644 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/scroll.exe b/scroll.exe index 4551490e..e446180d 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 876f37ca..ba09a834 100644 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -117,6 +117,21 @@ modexNextPage(page_t *p) { return result; } +//next page with defined dimentions~ +page_t +modexNextPage0(page_t *p, word x, word y) +{ + page_t result; + + result.data = p->data + (p->width/4)*p->height; /* compute the offset */ + result.dx = 0; + result.dy = 0; + result.width = x; + result.height = y; + + return result; +} + void modexShowPage(page_t *page) { @@ -221,6 +236,28 @@ 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; + } + } + } +} + + void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) { /* draw the region (the entire freakin bitmap) */ diff --git a/src/lib/modex16.h b/src/lib/modex16.h index 6a497ae5..bc23ee3e 100644 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -36,10 +36,12 @@ void modexEnter(); void modexLeave(); page_t modexDefaultPage(); page_t modexNextPage(page_t *p); +page_t modexNextPage0(page_t *p, word x, word y); void modexShowPage(page_t *page); void modexPanPage(page_t *page, int dx, int dy); void modexSelectPlane(byte plane); void 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); void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp); void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); void modexDrawPlanarBuf(page_t *page, int x, int y, planar_buf_t *bmp); diff --git a/src/pcxtest.c b/src/pcxtest.c index ea8bfdf0..7e10a958 100644 --- a/src/pcxtest.c +++ b/src/pcxtest.c @@ -7,26 +7,6 @@ word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ -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; - } - } - } -} - /* void DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) @@ -67,7 +47,7 @@ void main() { // bmp = bitmapLoadPcx("data/chikyuu.pcx"); bmp = bitmapLoadPcx("data/koishi^^.pcx"); // bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); -//0000 p = planar_buf_from_bitmap(&bmp); + p = planar_buf_from_bitmap(&bmp); modexEnter(); /* fix up the palette and everything */ @@ -77,7 +57,7 @@ void main() { modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1); /* non sprite comparison */ - /*0000start = *clockw; + start = *clockw; for(i=0; i<100 ;i++) { oldDrawBmp(VGA, 20, 20, &bmp, 0); } @@ -107,7 +87,7 @@ void main() { for(i=0; i<100 ;i++) { //0000 modexDrawSprite(&page, 20, 20, &bmp); modexDrawSprite(&page, 0, 0, &bmp); - }*/ + } //_fmemset(MK_FP(0xA000, 0), (int)p->plane, SCREEN_WIDTH*(SCREEN_HEIGHT*2)); modexDrawBmp(&page, 0, 0, &bmp); while(!kbhit()) @@ -119,12 +99,12 @@ void main() { printf("\n%d\n", sizeof(p->plane)); printf("%d\n", sizeof(bmp)); - /*for(i=0; i<(320*240); i++) + for(i=0; i<(320*240); i++) { fprintf(stdout, "%d", bmp.data[i]); if(i%320==0) fprintf(stdout, "\n"); - }*/ -//0000 printf("CPU to VGA: %f\n", t1); -//0000 printf("VGA to VGA: %f\n", t2); + } + printf("CPU to VGA: %f\n", t1); + printf("VGA to VGA: %f\n", t2); return; } diff --git a/src/scroll.c b/src/scroll.c index 8134a31c..6546d4de 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -191,8 +191,9 @@ void main() { screen.height += (TILEWH*2)+QUADWH; mv.page = &screen; screen2 = modexNextPage(mv.page); - mv2.page = &screen2; - screen3 = screen2; + mv2.page = &screen2; + screen3 = modexNextPage0(mv2.page, 352, 176); //(352*176)+1024 is the remaining amount of memory left wwww + //screen3 = modexNextPage0(mv2.page, 320, 192); //(352*176)+1024 is the remaining amount of memory left wwww mv3.page = &screen3; /* set up paging */ @@ -532,8 +533,10 @@ void main() { { bg->page->dx++; spri->page->dx++; + mask->page->dx++; modexShowPage(bg->page); modexShowPage(spri->page); + modexShowPage(mask->page); panq++; } else { panq = 1; pand = 0; } } @@ -545,8 +548,10 @@ void main() { { bg->page->dx--; spri->page->dx--; + mask->page->dx--; modexShowPage(bg->page); modexShowPage(spri->page); + modexShowPage(mask->page); panq++; } else { panq = 1; pand = 0; } } @@ -558,8 +563,10 @@ void main() { { bg->page->dy--; spri->page->dy--; + mask->page->dy--; modexShowPage(bg->page); modexShowPage(spri->page); + modexShowPage(mask->page); panq++; } else { panq = 1; pand = 0; } } @@ -571,12 +578,17 @@ void main() { { bg->page->dy++; spri->page->dy++; + mask->page->dy++; modexShowPage(bg->page); - modexShowPage(spri->page); + modexShowPage(spri->page); + modexShowPage(mask->page); panq++; } else { panq = 1; pand = 0; } } -} +} + + //the scripting stuf.... + //if(((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(0x1C))||(player.tx == 5 && player.ty == 5)) if(((bg->map->data[(player.triggerx-1)+(map.width*(player.triggery-1))] == 0) && keyp(0x1C))||(player.tx == 5 && player.ty == 5)) { @@ -587,10 +599,14 @@ void main() { } nosound(); } - if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; } + if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; } + //debugging binds! //if(keyp(0x0E)) while(1){ if(xmsmalloc(24)) break; } + if(keyp(2)) modexShowPage(bg->page); + if(keyp(3)) modexShowPage(spri->page); + if(keyp(4)) modexShowPage(mask->page); if(keyp(0x44)){ bputs(spri->page, player.x+(TILEWH*2), player.y+(TILEWH*2), "wwww"); } //f10 - if(keyp(25)){ pdump(bg); pdump(spri); } + if(keyp(25)){ pdump(bg); pdump(spri); } //p if(keyp(24)){ modexPalUpdate0(gpal); paloffset=0; pdump(bg); pdump(spri); } if(keyp(22)){ paloffset=0; modexPalBlack(); modexPalUpdate(&ptmp, &paloffset, 0, 0); @@ -599,9 +615,9 @@ void main() { printf("2paloffset = %d\n", paloffset/3); pdump(bg); pdump(spri); } //pan switch - if(keyp(88)){if(!panswitch) panswitch++; else panswitch--; } + if(keyp(88)){if(!panswitch) panswitch++; else panswitch--; } //f12 //TSR - if(keyp(87)) + if(keyp(87)) //f11 { modexLeave(); setkb(0); @@ -648,7 +664,7 @@ void main() { //xmsreport(); //emmclose(emmhandle); printf("%Fp\n", bios_8x8_font()); - printf("%c\n", *bios_8x8_font()); + //printf("%c\n", *bios_8x8_font()); switch(detectcpu()) { case 0: cpus = "8086/8088 or 186/88"; break; diff --git a/test.exe b/test.exe index 53112b7a..13eadb07 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 246a3d0a..bfc3938a 100644 Binary files a/test2.exe and b/test2.exe differ