From: sparky4 Date: Mon, 9 Jan 2017 18:12:47 +0000 (-0600) Subject: added stuff to help me study 0.exe it is a complex program wwww what is getting to... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=6cfcd9ddd5f8b515913ea6f0e0f84f8e4c0fb720;p=16.git added stuff to help me study 0.exe it is a complex program wwww what is getting to me is the preservation of the bg and how it is done and where is it wwww --- diff --git a/src/0.c b/src/0.c index 47a0e29a..635a4f3e 100755 --- a/src/0.c +++ b/src/0.c @@ -10,7 +10,7 @@ #define FILENAME_1 "data/spri/chikyuu.vrl" #define FILENAME_2 "data/spri/chikyuu.pal" -//#define PATTERN +#define PATTERN #define INITTNUM 1 static unsigned char palette[768]; @@ -180,6 +180,8 @@ int main(int argc,char **argv) player[0].q = 1; player[0].d = 2; x=y=0; xdir=ydir=1; + TESTBG; + DRAWCORNERBOXES; } //R FUNCTIONKEYFUNCTIONS0EXE; diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index 9369ce49..652ef89c 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -369,6 +369,37 @@ modexShowPage_(page_t *page) outp(AC_INDEX, (page->dx & 0x03) << 1); } +void +modexShowPageVsync(page_t *page) { + word high_address, low_address, offset; + byte crtcOffset; + + /* calculate offset */ + offset = (word) page->data; + offset += page->dy * (page->width >> 2 ); + offset += page->dx >> 2; + + /* calculate crtcOffset according to virtual width */ + crtcOffset = page->width >> 3; + + high_address = HIGH_ADDRESS | (offset & 0xff00); + low_address = LOW_ADDRESS | (offset << 8); + + /* wait for appropriate timing and then program CRTC */ + while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE)); + outpw(CRTC_INDEX, high_address); + outpw(CRTC_INDEX, low_address); + outp(CRTC_INDEX, 0x13); + outp(CRTC_DATA, crtcOffset); + + /* wait for one retrace */ + while (!(inp(INPUT_STATUS_1) & VRETRACE)); + + /* do PEL panning here */ + outp(AC_INDEX, 0x33); + outp(AC_INDEX, (page->dx & 0x03) << 1); +} + void modexPanPage(page_t *page, int dx, int dy) { page->dx = dx; diff --git a/src/lib/16_vl.h b/src/lib/16_vl.h index 2562f211..36f2069d 100755 --- a/src/lib/16_vl.h +++ b/src/lib/16_vl.h @@ -105,6 +105,7 @@ void modexCalcVmemRemain(video_t *video); void modexHiganbanaPageSetup(video_t *video); void modexShowPage(page_t *page); void modexShowPage_(page_t *page); +void modexShowPageVsync(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); diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index e1221f8d..c30c8ac5 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -214,7 +214,7 @@ void walk(map_view_t *pip, player_t *player, word pn) } //panning page -void panpagemanual(map_view_t *pip, player_t *player, word pn) +void panPageManual(map_view_t *pip, player_t *player, word pn) { switch(player[pn].d) { @@ -273,6 +273,66 @@ void panpagemanual(map_view_t *pip, player_t *player, word pn) //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q); } +//panning vmem +void panVmemManual(map_view_t *pip, player_t *player, word pn) +{ + switch(player[pn].d) + { + //right movement + case 3: + if(pip[pip[0].pan->pn].tx >= 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw < pip[pip[0].pan->pn].page->tilesw) + { + if(player[pn].q<=player[pn].spt) + { + pip[pip[0].pan->pn].page->dx+=4; + modexShowPageVsync(pip[pip[0].pan->pn].page); + player[pn].q++; + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } + } + break; + + //left movement + case 1: + if(pip[pip[0].pan->pn].tx > 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw <= pip[pip[0].pan->pn].page->tilesw) + { + if(player[pn].q<=player[pn].spt) + { + pip[pip[0].pan->pn].page->dx-=4; + modexShowPageVsync(pip[pip[0].pan->pn].page); + player[pn].q++; + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } + } + break; + + //down movement + case 4: + if(pip[pip[0].pan->pn].ty >= 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th < pip[pip[0].pan->pn].page->tilesh+pip[pip[1].pan->pn].page->tilesh+pip[pip[2].pan->pn].page->tilesh+pip[pip[3].pan->pn].page->tilesh) + { + if(player[pn].q<=player[pn].spt) + { + pip[pip[0].pan->pn].page->dy+=4; + modexShowPageVsync(pip[pip[0].pan->pn].page); + player[pn].q++; + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } + } + break; + + //up movement + case 0: + if(pip[pip[0].pan->pn].ty > 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th <= pip[pip[0].pan->pn].page->tilesh+pip[pip[1].pan->pn].page->tilesh+pip[pip[2].pan->pn].page->tilesh+pip[pip[3].pan->pn].page->tilesh) + { + if(player[pn].q<=player[pn].spt) + { + pip[pip[0].pan->pn].page->dy-=4; + modexShowPageVsync(pip[pip[0].pan->pn].page); + player[pn].q++; + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } + } + break; + } + //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q); +} + /*map_t allocMap(int w, int h) { map_t result; diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index 75117f5e..a29f1f50 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -126,7 +126,8 @@ extern char global_temp_status_text[512]; //map_t allocMap(int w, int h); //void initMap(map_t *map); void walk(map_view_t *pip, player_t *player, word pn); -void panpagemanual(map_view_t *pip, player_t *player, word pn); +void panPageManual(map_view_t *pip, player_t *player, word pn); +void panVmemManual(map_view_t *pip, player_t *player, word pn); void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid); void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid); void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid); diff --git a/src/scroll.c b/src/scroll.c index 18df0c76..855ffb09 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -188,7 +188,7 @@ void main(int argc, char *argv[]) if(!panswitch){ walk(mv, &player, 0); }else{ - panpagemanual(mv, &player, 0); + panPageManual(mv, &player, 0); //printf(" player[0].q: %d", player[0].q); printf(" player[0].d: %d\n", player[0].d); } diff --git a/src/tesuto.h b/src/tesuto.h index 6ada8a7b..09aca18b 100755 --- a/src/tesuto.h +++ b/src/tesuto.h @@ -10,8 +10,9 @@ #include #include +//panPageManual(mv, player, 0); #define PANKEY0EXE \ - panpagemanual(mv, player, 0); \ + panVmemManual(mv, player, 0); \ if(IN_KeyDown(1+1)){ pan.pn=0; modexShowPage(&(gvar.video.page[pan.pn])); } \ if(IN_KeyDown(2+1)){ pan.pn=1; modexShowPage(&(gvar.video.page[pan.pn])); } \ if(IN_KeyDown(3+1)){ pan.pn=2; modexShowPage(&(gvar.video.page[pan.pn])); } \