From: sparky4 Date: Wed, 4 May 2016 19:15:40 +0000 (-0500) Subject: joncambell321 please help test.exe creates garbage if the 2nd rendering page is written X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=40391c09eb16ee6d6261bca1e37ba08a3de2af9c;p=16.git joncambell321 please help test.exe creates garbage if the 2nd rendering page is written --- diff --git a/makefile b/makefile index 9f9e4e43..9e002883 100755 --- a/makefile +++ b/makefile @@ -66,7 +66,7 @@ UPXQ=-qqq AFLAGS=-mh -0 -d1 16FLAGS=-fh=16.hed BAKAPIFLAGS=-fh=bakapi.hed -SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768#55808#60000 +SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768#54096#60000 DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS) ZFLAGS=-zk0 -zc -zp8 $(WCLQ) ## -zm CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo -i$(DOSLIB)##wwww @@ -117,11 +117,11 @@ tesuto.exe: tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) gfx.lib tesuto.$(OBJ): $(SRC)tesuto.c wcl $(FLAGS) $(WCLQ) -c $(SRC)tesuto.c -test.exe: test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) - wcl $(FLAGS) test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) -fm=test.mah +test.exe: test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) $(DOSLIBLIBS) + wcl $(FLAGS) test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) $(DOSLIBLIBS) -fm=test.mah -test2.exe: test2.$(OBJ) gfx.lib - wcl $(FLAGS) test2.$(OBJ) gfx.lib -fm=test2.mah +test2.exe: test2.$(OBJ) $(DOSLIBLIBS) gfx.lib + wcl $(FLAGS) test2.$(OBJ) $(DOSLIBLIBS) gfx.lib -fm=test2.mah fonttest.exe: fonttest.$(OBJ) $(16LIB) gfx.lib wcl $(FLAGS) fonttest.$(OBJ) $(16LIB) gfx.lib -fm=fonttest.mah diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 97870192..8776d0aa 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -155,6 +155,7 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) //TODO MAKE FLEXIBLE~ // gv->video.page[0].tilemidposscreenx = gv->video.page[0].tilesw; // gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1; + gv->video.num_of_pages=0; } void @@ -234,12 +235,12 @@ modexNextPageFlexibleSize(page_t *p, word x, word y) void modexCalcVmemRemain(video_t *video) { byte i; - printf("\n\n 1st vmem_remain=%ld\n", video->vmem_remain); + //printf("\n\n 1st vmem_remain=%ld\n", video->vmem_remain); for(i=0; i<=video->num_of_pages-1; i++) { video->vmem_remain-=video->page[i].pagesize; - printf(" [%u], video->page[i].pagesize=%ld\n", i, video->page[i].pagesize); - printf(" [%u], vmem_remain=%ld\n", i, video->vmem_remain); + //printf(" [%u], video->page[i].pagesize=%ld\n", i, video->page[i].pagesize); + //printf(" [%u], vmem_remain=%ld\n", i, video->vmem_remain); } } diff --git a/src/test.c b/src/test.c index b80291fc..397971ba 100755 --- a/src/test.c +++ b/src/test.c @@ -39,6 +39,28 @@ void main(int argc, char *argv[]) if(argv[1]) bakapee = atoi(argv[1]); else bakapee = 1; + + // DOSLIB: check our environment + probe_dos(); + + // DOSLIB: what CPU are we using? + // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. + // So this code by itself shouldn't care too much what CPU it's running on. Except that other + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for + // the CPU to carry out tasks. --J.C. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + /* load our palette */ modexLoadPalFile("data/default.pal", &pal2); @@ -48,25 +70,29 @@ void main(int argc, char *argv[]) modexFadeOff(1, pal); modexPalBlack(); - VGAmodeX(bakapee, 1, &gvar); - modexPalBlack(); - IN_Startup(); IN_Default(0,&player,ctrl_Joystick); + textInit(); + VGAmodeX(bakapee, 1, &gvar); + modexPalBlack(); + /* set up the page, but with 16 pixels on all borders in offscreen mem */ - gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); - gvar.video.page[1] = modexNextPage(&gvar.video.page[0]); - gvar.video.page[0].width += 32; - gvar.video.page[0].height += 32; + modexHiganbanaPageSetup(&gvar.video); +// gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); +// gvar.video.page[1] = modexNextPage(&gvar.video.page[0]); +// gvar.video.page[0].width += 32; +// gvar.video.page[0].height += 32; /* fill the page with one color, but with a black border */ modexShowPage(&gvar.video.page[1]); + //modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 0); modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128); modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42); modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128); modexShowPage(&gvar.video.page[0]); + modexCopyPageRegion(&gvar.video.page[1], &gvar.video.page[0], 0, 0, 0, 0, gvar.video.page[0].width, gvar.video.page[0].height); /* fade in */ modexFadeOn(1, pal2); @@ -113,9 +139,16 @@ void main(int argc, char *argv[]) modexFadeOff(1, pal2); modexPalBlack(); VGAmodeX(0, 1, &gvar); - IN_Shutdown(); printf("Project 16 test.exe. This is just a test file!\n"); printf("version %s\n", VERSION); + printf("video memory remaining: %ld\n", gvar.video.vmem_remain); + printf("page "); + for(i=0; i