From b8c9d5fcb2b66420bc673f54b14cc5d0ea5283ed Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 9 Nov 2017 12:46:58 -0600 Subject: [PATCH] i did a butt load of tweaking to the paltest code and i did verious fixes here and there. paltest needs serious work. I need to study the code i wrote and i also NEED to comment it wwww --- src/.xcroll.c.kate-swp | Bin 89 -> 0 bytes src/lib/16_vl.h | 2 +- src/lib/16_vlpal.c | 2 +- src/lib/16_vlpld.h | 15 ++++++- src/lib/doslib | 2 +- src/palllist.c | 19 ++++----- src/paltest.c | 91 ++++++++++++----------------------------- src/ps.c | 5 +++ src/vidtest.c | 28 ++++++------- src/xcroll.c | 12 +++--- 10 files changed, 76 insertions(+), 100 deletions(-) delete mode 100755 src/.xcroll.c.kate-swp diff --git a/src/.xcroll.c.kate-swp b/src/.xcroll.c.kate-swp deleted file mode 100755 index 9b3a8b2abe0fdd35577578318cf1188b594cc9ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 89 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?VnS#DymKDqbG9I?HOEITX?pWXRbdP1-# lP(}_U3&b+XB}F;$Uip>9C7H?DhWh$ozHfeMajL$)D*%bL8w~&e diff --git a/src/lib/16_vl.h b/src/lib/16_vl.h index 30231f47..6ac00f28 100755 --- a/src/lib/16_vl.h +++ b/src/lib/16_vl.h @@ -209,7 +209,7 @@ void modexLoadPalFile(char *filename, byte *palette); void VL_LoadPalFile(const char *filename, byte *palette, global_game_variables_t *gvar); void VL_LoadPalFileCore(byte *palette, global_game_variables_t *gvar); void VL_SetCorePal(global_game_variables_t *gvar); -//void VLL_LoadPalFilewithoffset(const char *filename, byte *palette, word o, global_game_variables_t *gvar); +void VLL_LoadPalFilewithoffset(const char *filename, byte *palette, word o, word palsize, global_game_variables_t *gvar); void VL_UpdatePaletteWrite(byte *palette, word o, word palsize, global_game_variables_t *gvar); void VL_PaletteSync(global_game_variables_t *gvar); void modexSavePalFile(char *filename, byte *palette); diff --git a/src/lib/16_vlpal.c b/src/lib/16_vlpal.c index 032f2b7a..57a97f0a 100755 --- a/src/lib/16_vlpal.c +++ b/src/lib/16_vlpal.c @@ -189,7 +189,7 @@ aqpee: while(aq<=aa) { #ifdef BEVERBOSEPALCHECK - printf("a[%02d]=(%d)\n", aq, a[aq]);// +// printf("a[%02d]=(%d)\n", aq, a[aq]);//0000 #endif if(a[aq]==-1) aq++; else { aqoffset++; break; } diff --git a/src/lib/16_vlpld.h b/src/lib/16_vlpld.h index 5ade2e90..db51f5e9 100755 --- a/src/lib/16_vlpld.h +++ b/src/lib/16_vlpld.h @@ -2,8 +2,10 @@ #define __16_VLPALD_H__ #define BEVERBOSEPALCHECK +//#define BEVERBOSECOLORCHECK +//#define DONOTPALCHECK -#ifdef BEVERBOSEPALCHECK +#ifdef BEVERBOSECOLORCHECK #define CHKCOLDBGOUT1 \ printf("q: %02d\n", (*q));\ printf("chkcolor start~\n");\ @@ -44,6 +46,17 @@ printf("2 (*i): %d\n", (*i)/3); \ printf("2 offset of color in palette (*q): %d\n", (*q)/3); \ printf("chkcolor end~\n"); +#else +#define CHKCOLDBGOUT1 +#define CHKCOLDBGOUT2 +#define CHKCOLDBGOUT3 +#define CHKCOLDBGOUT4 +#define CHKCOLDBGOUT5 +#define CHKCOLDBGOUT6 +#define CHKCOLDBGOUT7 +#define CHKCOLDBGOUT8 +#define CHKCOLDBGOUT9 +#define CHKCOLDBGOUT10 #endif //======// diff --git a/src/lib/doslib b/src/lib/doslib index 9f68b899..2b7b2ed6 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit 9f68b899de82e9ed49cf03bd617820f98db034c3 +Subproject commit 2b7b2ed6b38382723b80be134cb5d22284de2eb4 diff --git a/src/palllist.c b/src/palllist.c index 023593b0..77f0abdc 100755 --- a/src/palllist.c +++ b/src/palllist.c @@ -165,19 +165,18 @@ void main() Created linked list will be 11->11->11->13->13->20 */ pushll(&head, 20); pushll(&head, 13); - pushll(&head, 13); + pushll(&head, 13); + pushll(&head, 11); pushll(&head, 11); pushll(&head, 11); - pushll(&head, 11); - + printf("\n Linked list before duplicate removal "); - printList(head); - + printList(head); + /* Remove duplicates from linked list */ - removeDuplicates(head); - - printf("\n Linked list after duplicate removal "); - printList(head); - + removeDuplicates(head); + + printf("\n Linked list after duplicate removal "); + printList(head); } #endif diff --git a/src/paltest.c b/src/paltest.c index 21f6a811..b353468e 100755 --- a/src/paltest.c +++ b/src/paltest.c @@ -29,7 +29,7 @@ #define LGQ 32 #define HGQ 55 -static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ +static word far* clockw= (word far*) 0x046C; // 18.2hz clock // void drawboxesmodex(page_t *pg) { @@ -47,102 +47,63 @@ void copyboxesmodex(page_t *page, boolean pn) void main(int argc, char *argv[]) { static word paloffset=0; - global_game_variables_t gvar; - -// map_view_t mv[4]; - map_t map; + static global_game_variables_t gvar; int i, j; word startclk, endclk; word k; +#ifndef DONOTPALCHECK imgtestpal_t bmp1, bmp2; - - bmp1.width=bmp2.width= 40; bmp1.width=bmp2.height= 30; +#endif //====word colo=LGQ; - // 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; - } - - if (_DEBUG_INIT() == 0) { -#ifdef DEBUGSERIAL - printf("WARNING: Failed to initialize DEBUG output\n"); -#endif - } - _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log - _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);*/ Startup16(&gvar); - /* save the palette */ + // save the palette // //====modexPalSave(pal); //====modexFadeOff(1, pal); //====modexPalBlack(); - //IN_Startup(); IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar); EN_initPlayer(&gvar.player[0], &gvar.video); - VGAmodeX(1, 1, &gvar); - modexPalBlack(); + VL_Startup(&gvar);//VGAmodeX(1, 1, &gvar); + modexPalBlack(); VL_PaletteSync(&gvar); - /* load our palette */ + // load our palette // VL_LoadPalFile("data/16.pal", &gvar.video.palette, &gvar); +#ifndef DONOTPALCHECK bmp1.offset=(paloffset/3); - VL_palette(&bmp1, &gvar.video.palette, &paloffset, 0, 0, &gvar); +// VL_palette(&bmp1, &gvar.video.palette, &paloffset, 0, 0, &gvar); //VL_LoadPalFilewithoffset("data/default.pal", &palette, paloffset); modexLoadPalFile("data/16t.pal", &gvar.video.dpal); + //VLL_LoadPalFilewithoffset("data/16t.pal", &gvar.video.palette, paloffset, 8, &gvar); bmp2.offset=(paloffset/3); - VL_palette(&bmp2, &gvar.video.dpal, &paloffset, 0, 0, &gvar); +// VL_palette(&bmp2, &gvar.video.dpal, &paloffset, 0, 0, &gvar); //====modexLoadPalFile("data/default.pal", &pal2); +#endif + VL_PaletteSync(&gvar); - /* overscan show */ + // overscan show // //modexPalOverscan(44+1); - /* set up the page, but with 16 pixels on all borders in offscreen mem */ + // set up the page, but with 16 pixels on all borders in offscreen mem // modexHiganbanaPageSetup(&gvar); - ZC_MVSetup(&gvar.mv, &map, &gvar); - - /* fill the page with one color, but with a black border */ - /*modexClearRegion(&gvar.video.page[1], 0, 0, gvar.video.page[1].width, gvar.video.page[1].height, 15); - modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128); - modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42); - modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128); - modexShowPage(&gvar.video.page[1]); - modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15); - 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]);*/ + ZC_MVSetup(&gvar.mv, &gvar.map, &gvar); + // fill the page with one color, but with a black border // drawboxesmodex(&gvar.video.page[0]); copyboxesmodex(&gvar.video.page, 1); modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 4); modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 6); - /* fade in */ + // fade in // //====modexFadeOn(1, pal2); i=0,k=0,j=0; @@ -160,7 +121,8 @@ void main(int argc, char *argv[]) TAIL_PANKEYFUN; if(gvar.in.inst->Keyboard[12]) modexClearRegion(&gvar.video.page[0], (gvar.video.page[0].width/2)-4, (gvar.video.page[0].height/2)-16, 24, 32, 15); if(gvar.in.inst->Keyboard[13]) modexClearRegion(&gvar.video.page[1], (gvar.video.page[1].width/2)-4, (gvar.video.page[1].height/2)-16, 24, 32, 15); -/*==== if(gvar.in.inst->Keyboard[7)){ +#if 0 +//==== if(gvar.in.inst->Keyboard[7)){ for(i=0;i<3;i++) { pal2[i] = rand()%64; @@ -169,7 +131,8 @@ void main(int argc, char *argv[]) if(colo>HGQ) colo=LGQ; } // if(i>PAL_SIZE) i=0; - }//9*/ + }//9 +#endif if(gvar.in.inst->Keyboard[25]){ modexpdump(gvar.video.sp, &gvar); IN_UserInput(1, &gvar); }//p if(gvar.in.inst->Keyboard[sc_I]){ drawboxesmodex(&gvar.video.page[gvar.video.sp]); IN_UserInput(1, &gvar); }//i if(gvar.in.inst->Keyboard[sc_O]){ copyboxesmodex(&gvar.video.page, !gvar.video.sp); IN_UserInput(1, &gvar); }//o @@ -179,19 +142,17 @@ void main(int argc, char *argv[]) endclk = *clockw; - /* fade back to text mode */ + // fade back to text mode // //====modexFadeOff(1, pal2); //====modexPalBlack(); - VGAmodeX(0, 1, &gvar); - Shutdown16(&gvar); - printf("Project 16 vidtest.exe. This is just a test file!\n"); + Shutdown16(&gvar);//VGAmodeX(0, 1, &gvar); + printf("Project 16 paltest.exe. This is just a test file!\n"); printf("version %s\n", VERSION); VL_PrintmodexmemInfo(&gvar.video); printf("tx=%d ", gvar.mv[gvar.video.sp].tx); printf("ty=%d ", gvar.mv[gvar.video.sp].ty); printf("gvar.player.d=%d\n", gvar.player[0].enti.d); printf("\n====\n"); printf("0 paloffset= %d\n", paloffset/3); printf("====\n\n"); - //IN_Shutdown(); //====modexPalBlack(); //====modexFadeOn(1, pal); } diff --git a/src/ps.c b/src/ps.c index 645006fc..64da4428 100755 --- a/src/ps.c +++ b/src/ps.c @@ -15,6 +15,11 @@ void main() PRINT_OPAQUE_STRUCT(&gvar.mm); printf("mmi:\n"); PRINT_OPAQUE_STRUCT(&gvar.mmi); + printf("sizeof gvar.video=%d\n", sizeof(gvar.video)); + printf("sizeof gvar.ca=%d\n", sizeof(gvar.ca)); + printf("sizeof gvar.pm=%d\n", sizeof(gvar.pm)); + printf("sizeof gvar.mm=%d\n", sizeof(gvar.mm)); + printf("sizeof gvar.mmi=%d\n", sizeof(gvar.mmi)); printf("sizeof gvar=%d\n", sizeof(gvar)); // handle // kurokku diff --git a/src/vidtest.c b/src/vidtest.c index d6db28cc..9d1966fb 100755 --- a/src/vidtest.c +++ b/src/vidtest.c @@ -29,7 +29,7 @@ #define LGQ 32 #define HGQ 55 -static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ +static word far* clockw= (word far*) 0x046C; // 18.2hz clock // void drawboxesmodex(page_t *pg) { @@ -47,44 +47,44 @@ void copyboxesmodex(page_t *page, boolean pn) void main(int argc, char *argv[]) { static global_game_variables_t gvar; - map_t map; int i, j; word startclk, endclk; word k; + //====word colo=LGQ; + Startup16(&gvar); - /* save the palette */ + // save the palette // //====modexPalSave(pal); //====modexFadeOff(1, pal); //====modexPalBlack(); - //IN_Startup(); IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar); EN_initPlayer(&gvar.player[0], &gvar.video); - VGAmodeX(1, 1, &gvar); + VL_Startup(&gvar);//VGAmodeX(1, 1, &gvar); modexPalBlack(); - /* load our palette */ + // load our palette // VL_LoadPalFile("data/16.pal", &gvar.video.palette, &gvar); - /* overscan show */ + // overscan show // //modexPalOverscan(44+1); - /* set up the page, but with 16 pixels on all borders in offscreen mem */ + // set up the page, but with 16 pixels on all borders in offscreen mem // modexHiganbanaPageSetup(&gvar); - ZC_MVSetup(&gvar.mv, &map, &gvar); + ZC_MVSetup(&gvar.mv, &gvar.map, &gvar); - /* fill the page with one color, but with a black border */ + // fill the page with one color, but with a black border // drawboxesmodex(&gvar.video.page[0]); copyboxesmodex(&gvar.video.page, 1); modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 4); modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 6); - /* fade in */ + // fade in // //====modexFadeOn(1, pal2); i=0,k=0,j=0; @@ -112,16 +112,14 @@ void main(int argc, char *argv[]) endclk = *clockw; - /* fade back to text mode */ + // fade back to text mode // //====modexFadeOff(1, pal2); //====modexPalBlack(); - VGAmodeX(0, 1, &gvar); - Shutdown16(&gvar); + Shutdown16(&gvar);//VGAmodeX(0, 1, &gvar); printf("Project 16 vidtest.exe. This is just a test file!\n"); printf("version %s\n", VERSION); VL_PrintmodexmemInfo(&gvar.video); printf("tx=%d ", gvar.mv[gvar.video.sp].tx); printf("ty=%d ", gvar.mv[gvar.video.sp].ty); printf("gvar.player.d=%d\n", gvar.player[0].enti.d); - //IN_Shutdown(); //====modexPalBlack(); //====modexFadeOn(1, pal); } diff --git a/src/xcroll.c b/src/xcroll.c index a73430af..3126f7da 100755 --- a/src/xcroll.c +++ b/src/xcroll.c @@ -22,19 +22,15 @@ #include "src/lib/scroll16.h" #include "src/lib/16_timer.h" -//#include "src/lib/16_dbg.h" +#include "src/lib/16_dbg.h" //#define FADE //#define NOMAPLOAD //#define OLDPLAYERSPRITESTUFF -#define XC_CTRLTYPE ctrl_Keyboard -//Mouse +#define XC_CTRLTYPE ctrl_Joystick1//ctrl_Mouse//ctrl_Keyboard #ifdef __DEBUG__ #define SCROLLEXEDEBUG -boolean - dbg_nointest=0, - dbg_joymousedelta=0; #endif //static map_t map; @@ -83,6 +79,10 @@ void main(int argc, char *argv[]) char bakapee[64] = FILENAME_1; char bakapeep[64] = FILENAME_1P; // char bakapee3[64] = FILENAME_3; +#ifdef __DEBUG__ + dbg_nointest=0; + dbg_joymousedelta=0; +#endif Startup16(&gvar); -- 2.39.5