]> 4ch.mooo.com Git - 16.git/commitdiff
added stuff to help me study 0.exe it is a complex program wwww what is getting to...
authorsparky4 <sparky4@cock.li>
Mon, 9 Jan 2017 18:12:47 +0000 (12:12 -0600)
committersparky4 <sparky4@cock.li>
Mon, 9 Jan 2017 18:12:47 +0000 (12:12 -0600)
src/0.c
src/lib/16_vl.c
src/lib/16_vl.h
src/lib/scroll16.c
src/lib/scroll16.h
src/scroll.c
src/tesuto.h

diff --git a/src/0.c b/src/0.c
index 47a0e29ac66bbc8d195d96b5088cca2679bc2be7..635a4f3eb1a3c34bc01ecb452268055e21abc2f9 100755 (executable)
--- a/src/0.c
+++ b/src/0.c
@@ -10,7 +10,7 @@
 #define FILENAME_1 "data/spri/chikyuu.vrl"\r
 #define FILENAME_2 "data/spri/chikyuu.pal"\r
 \r
-//#define PATTERN\r
+#define PATTERN\r
 #define INITTNUM 1\r
 \r
 static unsigned char palette[768];\r
@@ -180,6 +180,8 @@ int main(int argc,char **argv)
                                player[0].q = 1; player[0].d = 2;\r
                                x=y=0;\r
                                xdir=ydir=1;\r
+                               TESTBG;\r
+                               DRAWCORNERBOXES;\r
                        } //R\r
                        FUNCTIONKEYFUNCTIONS0EXE;\r
 \r
index 9369ce49ab7b2c2e88c086962684dae117fd00c0..652ef89c2491b898bd25908b6d63c70f5bee7504 100755 (executable)
@@ -369,6 +369,37 @@ modexShowPage_(page_t *page)
        outp(AC_INDEX, (page->dx & 0x03) << 1);\r
 }\r
 \r
+void\r
+modexShowPageVsync(page_t *page) {\r
+       word high_address, low_address, offset;\r
+       byte crtcOffset;\r
+\r
+       /* calculate offset */\r
+       offset = (word) page->data;\r
+       offset += page->dy * (page->width >> 2 );\r
+       offset += page->dx >> 2;\r
+\r
+       /* calculate crtcOffset according to virtual width */\r
+       crtcOffset = page->width >> 3;\r
+\r
+       high_address = HIGH_ADDRESS | (offset & 0xff00);\r
+       low_address  = LOW_ADDRESS  | (offset << 8);\r
+\r
+       /* wait for appropriate timing and then program CRTC */\r
+       while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE));\r
+       outpw(CRTC_INDEX, high_address);\r
+       outpw(CRTC_INDEX, low_address);\r
+       outp(CRTC_INDEX, 0x13);\r
+       outp(CRTC_DATA, crtcOffset);\r
+\r
+       /* wait for one retrace */\r
+       while (!(inp(INPUT_STATUS_1) & VRETRACE));\r
+\r
+       /* do PEL panning here */\r
+       outp(AC_INDEX, 0x33);\r
+       outp(AC_INDEX, (page->dx & 0x03) << 1);\r
+}\r
+\r
 void\r
 modexPanPage(page_t *page, int dx, int dy) {\r
        page->dx = dx;\r
index 2562f2111facead5095ee377611a47a4fe80c30c..36f2069dee162480137202ea001a0f491885705f 100755 (executable)
@@ -105,6 +105,7 @@ void modexCalcVmemRemain(video_t *video);
 void modexHiganbanaPageSetup(video_t *video);\r
 void modexShowPage(page_t *page);\r
 void modexShowPage_(page_t *page);\r
+void modexShowPageVsync(page_t *page);\r
 void modexPanPage(page_t *page, int dx, int dy);\r
 void modexSelectPlane(byte plane);\r
 void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color);\r
index e1221f8d6f483b10d5e56371a9f76786178c71ec..c30c8ac5c077ad2831825890db52213bf21f9925 100755 (executable)
@@ -214,7 +214,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
 }\r
 \r
 //panning page\r
-void panpagemanual(map_view_t *pip, player_t *player, word pn)\r
+void panPageManual(map_view_t *pip, player_t *player, word pn)\r
 {\r
        switch(player[pn].d)\r
        {\r
@@ -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);\r
 }\r
 \r
+//panning vmem\r
+void panVmemManual(map_view_t *pip, player_t *player, word pn)\r
+{\r
+       switch(player[pn].d)\r
+       {\r
+               //right movement\r
+               case 3:\r
+                       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)\r
+                       {\r
+                               if(player[pn].q<=player[pn].spt)\r
+                               {\r
+                                       pip[pip[0].pan->pn].page->dx+=4;\r
+                                       modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+                                       player[pn].q++;\r
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; }\r
+                       }\r
+               break;\r
+\r
+               //left movement\r
+               case 1:\r
+                       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)\r
+                       {\r
+                               if(player[pn].q<=player[pn].spt)\r
+                               {\r
+                                       pip[pip[0].pan->pn].page->dx-=4;\r
+                                       modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+                                       player[pn].q++;\r
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; }\r
+                       }\r
+               break;\r
+\r
+               //down movement\r
+               case 4:\r
+                       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)\r
+                       {\r
+                               if(player[pn].q<=player[pn].spt)\r
+                               {\r
+                                       pip[pip[0].pan->pn].page->dy+=4;\r
+                                       modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+                                       player[pn].q++;\r
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; }\r
+                       }\r
+               break;\r
+\r
+               //up movement\r
+               case 0:\r
+                       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)\r
+                       {\r
+                               if(player[pn].q<=player[pn].spt)\r
+                               {\r
+                                       pip[pip[0].pan->pn].page->dy-=4;\r
+                                       modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+                                       player[pn].q++;\r
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; }\r
+                       }\r
+                       break;\r
+       }\r
+       //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q);\r
+}\r
+\r
 /*map_t\r
 allocMap(int w, int h) {\r
        map_t result;\r
index 75117f5e5ac1087b723e3044471ccaa44344eee1..a29f1f50eade5f596aeb5f83619d22dd42c68acd 100755 (executable)
@@ -126,7 +126,8 @@ extern char global_temp_status_text[512];
 //map_t allocMap(int w, int h);\r
 //void initMap(map_t *map);\r
 void walk(map_view_t *pip, player_t *player, word pn);\r
-void panpagemanual(map_view_t *pip,  player_t *player, word pn);\r
+void panPageManual(map_view_t *pip,  player_t *player, word pn);\r
+void panVmemManual(map_view_t *pip, player_t *player, word pn);\r
 void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid);\r
 void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid);\r
 void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid);\r
index 18df0c768f997436afa8fdb63bacc53fd34d577e..855ffb091dc2af73cf8a464952ebb787e5515f8f 100755 (executable)
@@ -188,7 +188,7 @@ void main(int argc, char *argv[])
        if(!panswitch){\r
                walk(mv, &player, 0);\r
        }else{\r
-               panpagemanual(mv, &player, 0);\r
+               panPageManual(mv, &player, 0);\r
                //printf("      player[0].q: %d", player[0].q); printf("        player[0].d: %d\n", player[0].d);\r
        }\r
 \r
index 6ada8a7befd22d1e6765c42f8b43bb61c1f4eea1..09aca18b07e77cc6d4e6f0fe1c4e506a1d24db78 100755 (executable)
@@ -10,8 +10,9 @@
 #include <hw/vga/vga.h>\r
 #include <hw/vga/vrl.h>\r
 \r
+//panPageManual(mv, player, 0);\r
 #define PANKEY0EXE \\r
-                       panpagemanual(mv, player, 0); \\r
+                       panVmemManual(mv, player, 0); \\r
                        if(IN_KeyDown(1+1)){ pan.pn=0; modexShowPage(&(gvar.video.page[pan.pn])); } \\r
                        if(IN_KeyDown(2+1)){ pan.pn=1; modexShowPage(&(gvar.video.page[pan.pn])); } \\r
                        if(IN_KeyDown(3+1)){ pan.pn=2; modexShowPage(&(gvar.video.page[pan.pn])); } \\r