]> 4ch.mooo.com Git - 16.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorJonathan Campbell <jonathan@castus.tv>
Fri, 8 Apr 2016 13:53:04 +0000 (06:53 -0700)
committerJonathan Campbell <jonathan@castus.tv>
Fri, 8 Apr 2016 13:53:04 +0000 (06:53 -0700)
design.txt
makefile
src/bakapi.c
src/bakapi.h
src/inputest.c
src/lib/doslib
src/lib/modex16.c
src/lib/modex16.h
src/scroll.c

index 3de430a778da424b1df3867a515c453b541b8934..a7ff175facf2d5e489f701e4ac95e9076906444b 100755 (executable)
@@ -28,3 +28,32 @@ model, overriding certain functions as being near.  In this manner, the stack ch
 in any code group, which the other code groups can still access.  Alternatively, a command-line switch may\r
 be used to turn off stack checking, so no stack checking routines get called.\r
 "\r
+\r
+\r
+00:00:19   joncampbell123 | okay you're makefile is already using -zu, -zff and other options that I'm     │\r
+                          | sure would tell Watcom C to separate stack from data segment, but the MAP file │\r
+                          | says it's still associating STACK with DGROUP :(                               │\r
+00:08:56   joncampbell123 | argh                                                                           │\r
+00:10:04   joncampbell123 | sparky, it's probably better to refactor your code not to require so much      │\r
+                          | stack                                                                          │\r
+00:10:20   joncampbell123 | in most of doslib I test and dev the code against far smaller stack sizes,     │\r
+                          | usually 8KB                                                                    │\r
+00:11:03   joncampbell123 | besides you don't want a stack that occupies 1/10th of all conventional memory │\r
+                          | in DOS, right? ^^                                                              │\r
+00:11:50   joncampbell123 | 64KB is a more appropriate stack size if you're targeting 32-bit DOS or Win32, │\r
+                          | not 16-bit DOS                                                                 │\r
+00:12:34   joncampbell123 | if you need so much storage please try using global variables or memory        │\r
+                          | allocation, but don't eat up your stack like that                              │\r
+00:13:59   joncampbell123 | don't forget you can move a char[] declaration within your function off the    │\r
+                          | stack by declaring it static                                                   │\r
+00:14:17   joncampbell123 | then it's a local variable that lives in the data segment, not stack \r
+\r
+\r
+00:19:40   joncampbell123 | meaning you go through your functions, locate ones that declare a lot of local │\r
+                          | stack storage,                                                                 │\r
+00:19:53   joncampbell123 | and refactor them to put the storage elsewhere, other than the stack           │\r
+00:20:03   sparky4_derpy4 | joncampbell123: ah ok ^^ i will!!!                                             │\r
+00:20:16   sparky4_derpy4 | joncampbell123: look for large variables too? ww                               │\r
+00:20:21   joncampbell123 | yes.                                                                           │\r
+00:20:29   sparky4_derpy4 | scroll16 needs a bunch of work                                                 │\r
+00:20:29   joncampbell123 | the less you declare on the stack, the less stack the function needs.\r
index e33d63e464534e2c8b3906231aa43171f0e5241d..9da998721726f9f8cdfa147f2b5c809ce592721b 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -64,7 +64,7 @@ UPXQ=-qqq
 AFLAGS=-mh -0 -d1
 16FLAGS=-fh=16.hed
 BAKAPIFLAGS=-fh=bakapi.hed
-SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k55808#60000#32768
+SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k40000#55808#60000#32768
 DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS)
 ZFLAGS=-zk0 -zc -zp8 $(WCLQ) ## -zm
 CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo -i$(DOSLIB)##wwww
@@ -433,8 +433,6 @@ clean: .symbolic
        @$(REMOVECOMMAND) *.MAP
        @$(REMOVECOMMAND) *.map
        @$(REMOVECOMMAND) *.err
-       @$(COPYCOMMAND) .git$(DIRSEP)config git_con.fig
-       @$(COPYCOMMAND) .gitmodules git_modu.les
        @cd $(DOSLIB)
        #@./buildall.sh clean
        @cd $(PDIR)$(PDIR)$(PDIR)
@@ -448,6 +446,10 @@ clean: .symbolic
 #      @echo $(watcom)
 #      @echo $(INCLUDE)
 
+backupconfig: .symbolic
+       @$(COPYCOMMAND) .git$(DIRSEP)config git_con.fig
+       @$(COPYCOMMAND) .gitmodules git_modu.les
+
 comp: .symbolic
        @upx -9 $(EXEC)
 
index c6ae3ce3b9c93cf196c4ffe90a0bf1f02224ff56..6d04e5470eba75baabc399d6e44b9099e8d51218 100755 (executable)
@@ -36,6 +36,8 @@ main(int argc, char *argvar[])
 {
        char *a;
        int i;
+       word panq=1, pand=0;
+       boolean panswitch=0;
 
        // allow changing default mode from command line
        for (i=1;i < argc;) {
@@ -123,18 +125,75 @@ main(int argc, char *argvar[])
 #ifdef BOINK
        while(d>0)      // on!
        {
+               int c;
                /* run screensaver routine until keyboard input */
                while (key > 0) {
                        if (kbhit()) {
-                               getch(); // eat keyboard input
-                               break;
+                               if(!panswitch)
+                               {
+                                       getch(); // eat keyboard input
+                                       break;
+                               }else c=getch();
                        }
 
-                       ding(&gvar.video.page[0], &bakapee, key);
+                       if(!panswitch)  ding(&gvar.video.page[0], &bakapee, key);
+                       else                    ding(&gvar.video.page[0], &bakapee, 2);
+                       if(panswitch!=0)
+                       {
+                               //right movement
+                               if((c==0x4d && pand == 0) || pand == 2)
+                               {
+                                       if(pand == 0){ pand = 2; }
+                                       if(panq<=(TILEWH/(4)))
+                                       {
+                                               gvar.video.page[0].dx++;
+                                               modexShowPage(&gvar.video.page[0]);
+                                               panq++;
+                                       } else { panq = 1; pand = 0; }
+                               }
+                               //left movement
+                               if((c==0x4b && pand == 0) || pand == 4)
+                               {
+                                       if(pand == 0){ pand = 4; }
+                                       if(panq<=(TILEWH/(4)))
+                                       {
+                                               gvar.video.page[0].dx--;
+                                               modexShowPage(&gvar.video.page[0]);
+                                               panq++;
+                                       } else { panq = 1; pand = 0; }
+                               }
+                               //down movement
+                               if((c==0x50 && pand == 0) || pand == 3)
+                               {
+                                       if(pand == 0){ pand = 3; }
+                                       if(panq<=(TILEWH/(4)))
+                                       {
+                                               gvar.video.page[0].dy++;
+                                               modexShowPage(&gvar.video.page[0]);
+                                               panq++;
+                                       } else { panq = 1; pand = 0; }
+                               }
+                               //up movement
+                               if((c==0x48 && pand == 0) || pand == 1)
+                               {
+                                       if(pand == 0){ pand = 1; }
+                                       if(panq<=(TILEWH/(4)))
+                                       {
+                                               gvar.video.page[0].dy--;
+                                               modexShowPage(&gvar.video.page[0]);
+                                               panq++;
+                                       } else { panq = 1; pand = 0; }
+                               }
+                               if(c==0x71 || c==0xb1 || c=='p')
+                               {
+                                       //getch(); // eat keyboard input
+                                       panswitch=0;
+                                       break; // 'q' or 'ESC' or 'p'
+                               }
+                       }
                }
 
                {
-                       int c;
 
                // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
                // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
@@ -143,6 +202,17 @@ main(int argc, char *argvar[])
                        //fprintf(stderr, "xx=%d        yy=%d   tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
                        printf("Tiled mode is ");
                        switch (bakapee.tile)
+                       {
+                               case 0:
+                                       printf("off.    ");
+                               break;
+                               case 1:
+                                       printf("on.     ");
+                               break;
+                       }
+                       //printf("\n");
+                       printf("Pan mode is ");
+                       switch (panswitch)
                        {
                                case 0:
                                        printf("off.\n");
@@ -152,13 +222,25 @@ main(int argc, char *argvar[])
                                break;
                        }
                        printf("Enter 1, 2, 3, 4, 5, 6, 8, or 9 to run a screensaver, or enter 0 to quit.\n");
-
+pee:
                        c = getch();
                        switch (c) {
                                case 27: /* Escape key */
                                case '0':
                                        d=0;
                                        break;
+                               case 'p': // test pan
+                               switch (panswitch)
+                               {
+                                       case 0:
+                                               panswitch=1;
+                                       break;
+                                       case 1:
+                                               panswitch=0;
+                                       break;
+                               }
+                               goto pee;
+                               break;
                                case 'b': // test tile change
                                        switch (bakapee.tile)
                                        {
@@ -200,77 +282,33 @@ main(int argc, char *argvar[])
 // TODO: This is a testing sextion for textrendering and panning for project 16 --sparky4
        while(1)
        { // conditions of screen saver
-               while(!kbhit())
-               {
-                       ding(&gvar.video.page[0], &bakapee, key);
-               }
+//             while(!kbhit())
+//             {
+//                     ding(&gvar.video.page[0], &bakapee, key);
+//             }
                //end of screen savers
-               /*for(int x = 0; x < gvar.video.page[0].width; ++x)
-               {
-                       modexputPixel(&page, x, 0, 15);
-                       mxPutPixel(x, gvar.video.page[0].height-1, 15);
-                       }
-               for (int y = 0; y < VH; ++y)
-                       {
-                               mxPutPixel(0, y, 15);
-                               mxPutPixel(gvar.video.page[0].width-1, y, 15);
-                       }
-               for (int x = 0; x < VW; ++x)
-                       {
-                               mxPutPixel(x, 0, 15);
-                               mxPutPixel(x, VH-1, 15);
-                       }
-               for (int y = 240; y < VH; ++y)
-                       {
-                               mxPutPixel(0, y, 15);
-                               mxPutPixel(VW-1, y, 15);
-                       }*/
-               pdump(&gvar.video.page[0]);
-               getch();
-               //text box
-               /*++++mxBitBlt(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, BS); //copy background
-               mxFillBox(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, OP_SET); // background for text box
-               //+(QUADWH*6)
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "|    |Chikyuu:$line1");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "|    |$line2");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "|    |$line3");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "|    |$line4");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-8,  "========================================");
-               mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~
-               getch();
-               mxBitBlt(0, BS, gvar.video.page[0].width, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background
-               getch();++++*/
-               while(!kbhit())
-               {
-                       //for(int i=0;i<TILEWH;i++){
-                               ding(&gvar.video.page[0], &bakapee, key);
-                               modexPanPage(&gvar.video.page[0], xpos, ypos);
-//++++mxFillBox(384, 304, 384, 304, 10, OP_SET);
-//mxBitBlt(xpos, ypos, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
-//++++mxBitBlt(TILEWH*2, TILEWH*2, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
-                               //for(word o = 0; o<TILEWH; o++){
-                                       xpos+=xdir;
-                                       ypos+=ydir;
-                                       //if(ypos==1 || (ypos==(BH-gvar.video.page[0].height-1)))delay(500);
-                                       //if((xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1))delay(500);
-                                       //mxWaitRetrace();
-//mxBitBlt(32, (gvar.video.page[0].height+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
-//++++mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
-//xpos=ypos=TILEWH*2;
-                                       //????modexPanPage(&gvar.video.page[0], 32, 32);
-                               //}
-                               if( (xpos>(VW-gvar.video.page[0].width-1))  || (xpos<1)){xdir=-xdir;}
-                               if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
-                       //}//    direction!
-//mxBitBlt(32, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
-//mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
-               }
-       ch=getch();
+               //pdump(&gvar.video.page[0]);
+
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================");
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "|    |Chikyuu:$line1");
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "|    |$line2");
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "|    |$line3");
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "|    |$line4");
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-8,  "========================================");
+
+       ding(&gvar.video.page[0], &bakapee, key);
+       modexPanPage(&gvar.video.page[0], xpos, ypos);
+       c = getch();
+
+//     xpos+=xdir;
+//     ypos+=ydir;
+//     if( (xpos>(VW-gvar.video.page[0].width-1))  || (xpos<1)){xdir=-xdir;}
+//     if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;}
+//     ch=getch();
        if(ch==0x71)break; // 'q'
        if(ch==0x1b)break; // 'ESC'
        }
-//     VGAmodeX(0, &gvar);
+       VGAmodeX(0, 1, &gvar);
 #endif // defined(BOINK)
        printf("bakapi ver. 1.04.16.04\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v3\n");
        printf("compiled on 2016/04/04\n");
index 70b2f2aba7ecc3b12d49fe8813209439ad02cf4b..729e3b19b1af423bb078c4ee976822f12edaa370 100755 (executable)
@@ -25,6 +25,7 @@
 
 #include "src/lib/bakapee.h"
 
+//project 16 testing define switch for veiwing the contents of the video memory
 #define BOINK // what does this mean? --J.C.
 
 #endif /*__BAKAPI_H_*/
index edd86d62c7cbc968126892393132fdbfdb066733..44195363d18a91232ebb1e41742158bd04dd4e4b 100755 (executable)
@@ -31,7 +31,7 @@ main(int argc, char *argv[])
        player_t player[MaxPlayers];\r
        //extern struct inconfig inpu;\r
        testkeyin=0;\r
-       testcontrolnoisy=1;\r
+       testcontrolnoisy=0;\r
        testctrltype=1;\r
        IN_Startup();\r
        IN_Default(0,&player,ctrl_Joystick1);\r
index b84bf02ac8fffdfc6ff569a36efe57ed3a450ef0..3c110fd249406b11b5301568b7c69d961fb91e79 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b84bf02ac8fffdfc6ff569a36efe57ed3a450ef0
+Subproject commit 3c110fd249406b11b5301568b7c69d961fb91e79
index 0d10603776a3b35de763651a6d1a274fa78e3998..a2152825ee9638110111f011c051bdc1ff646a99 100755 (executable)
@@ -62,11 +62,7 @@ void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv)
 static void\r
 vgaSetMode(byte mode)\r
 {\r
-  union REGS regs;\r
-\r
-  regs.h.ah = SET_MODE;\r
-  regs.h.al = mode;\r
-  int86(VIDEO_INT, &regs, &regs);\r
+  int10_setmode(mode);\r
 }\r
 \r
 //---------------------------------------------------\r
@@ -74,15 +70,10 @@ vgaSetMode(byte mode)
 // Use the bios to get the current video mode\r
 //\r
 \r
-long\r
+long/*FIXME: why long? "long" is 32-bit datatype, VGA modes are 8-bit numbers. */\r
 vgaGetMode()\r
 {\r
-    union REGS rg;\r
-\r
-    rg.h.ah = 0x0f;\r
-    int86(VIDEO_INT, &rg, &rg);\r
-\r
-    return rg.h.al;\r
+    return int10_getmode();\r
 }\r
 \r
 /* -========================= Entry  Points ==========================- */\r
@@ -90,9 +81,13 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)
 {\r
        word i;\r
        dword far*ptr=(dword far*)VGA;      /* used for faster screen clearing */\r
+       struct vga_mode_params cm;\r
        int CRTParmCount;\r
-       /* common mode X initiation stuff~ */\r
-       modexsetBaseXMode();\r
+\r
+       vgaSetMode(VGA_256_COLOR_MODE);\r
+       vga_enable_256color_modex();\r
+       update_state_from_vga();\r
+       vga_read_crtc_mode(&cm);\r
 \r
        switch(vq)\r
        {\r
@@ -102,106 +97,46 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)
                        gv->video.page[0].sw=vga_state.vga_width = 320; // VGA lib currently does not update this\r
                        gv->video.page[0].sh=vga_state.vga_height = 240; // VGA lib currently does not update this\r
 \r
-                       /* send the CRTParms */\r
-                       /*for(i=0; i<CRTParmCount; i++) {\r
-                               outpw(CRTC_INDEX, ModeX_320x240regs[i]);\r
-                       }*/\r
-                       {\r
-                       struct vga_mode_params cm;\r
-                       vga_read_crtc_mode(&cm);\r
-\r
-//     0x5f00,         /* Horizontal total */\r
-//     0x4f01,         /* horizontal display enable end */\r
-//     0x5002,         /* Start horizontal blanking */\r
-//     0x8203,         /* End horizontal blanking */\r
-//     0x5404,         /* Start horizontal retrace */\r
-//     0x8005,         /* End horizontal retrace */\r
-//     0x0d06,          /* vertical total */\r
-//     0x3e07,          /* overflow (bit 8 of vertical counts) */\r
-//     0x4109,          /* cell height (2 to double-scan */\r
-//     0xea10,          /* v sync start */\r
-//     0xac11,          /* v sync end and protect cr0-cr7 */\r
-//     0xdf12,          /* vertical displayed */\r
-//     0x2813,         /* offset/logical width */\r
-//     0x0014,          /* turn off dword mode */\r
-//     0xe715,          /* v blank start */\r
-//     0x0616,          /* v blank end */\r
-//     0xe317            /* turn on byte mode */\r
-\r
                        // 320x240 mode 60Hz\r
-                       cm.horizontal_total=0x5f; /* CRTC[0]             -5 */\r
-                       cm.horizontal_display_end=0x4f; /* CRTC[1]       -1 */\r
-                       cm.horizontal_blank_start=0x50; /* CRTC[2] */\r
-                       cm.horizontal_blank_end=0x82;   /* CRTC[3] bit 0-4 & CRTC[5] bit 7 */\r
+                       cm.horizontal_total=0x5f + 5; /* CRTC[0]             -5 */\r
+                       cm.horizontal_display_end=0x4f + 1; /* CRTC[1]       -1 */\r
+                       cm.horizontal_blank_start=0x50 + 1; /* CRTC[2] */\r
+                       cm.horizontal_blank_end=0x82 + 1;   /* CRTC[3] bit 0-4 & CRTC[5] bit 7 */\r
                        cm.horizontal_start_retrace=0x54;/* CRTC[4] */\r
                        cm.horizontal_end_retrace=0x80; /* CRTC[5] bit 0-4 */\r
                        //cm.horizontal_start_delay_after_total=0x3e; /* CRTC[3] bit 5-6 */\r
                        //cm.horizontal_start_delay_after_retrace=0x41; /* CRTC[5] bit 5-6 */\r
-                       cm.vertical_total = 525;\r
+                       cm.vertical_total = 0x20D + 2;\r
                        cm.vertical_start_retrace = 0x1EA;\r
                        cm.vertical_end_retrace = 0x1EC;\r
                        cm.vertical_display_end = 480;\r
-                       cm.vertical_blank_start = 489;\r
-                       cm.vertical_blank_end = 517;\r
-\r
-                       vga_write_crtc_mode(&cm,0);\r
-                       }\r
-               break;\r
-               case 2:\r
-                       CRTParmCount = sizeof(ModeX_160x120regs) / sizeof(ModeX_160x120regs[0]);\r
-                       /* width and height */\r
-                       gv->video.page[0].sw=120;\r
-                       gv->video.page[0].sh=160;\r
-\r
-                       /* send the CRTParms */\r
-                       for(i=0; i<CRTParmCount; i++) {\r
-                               outpw(CRTC_INDEX, ModeX_160x120regs[i]);\r
-                       }\r
-               break;\r
-               case 3:\r
-                       CRTParmCount = sizeof(ModeX_320x200regs) / sizeof(ModeX_320x200regs[0]);\r
-                       /* width and height */\r
-                       gv->video.page[0].sw=320;\r
-                       gv->video.page[0].sh=200;\r
-\r
-                       /* send the CRTParms */\r
-                       for(i=0; i<CRTParmCount; i++) {\r
-                               outpw(CRTC_INDEX, ModeX_320x200regs[i]);\r
-                       }\r
-               break;\r
-               case 4:\r
-                       CRTParmCount = sizeof(ModeX_192x144regs) / sizeof(ModeX_192x144regs[0]);\r
-                       /* width and height */\r
-                       gv->video.page[0].sw=192;\r
-                       gv->video.page[0].sh=144;\r
-\r
-                       /* send the CRTParms */\r
-                       for(i=0; i<CRTParmCount; i++) {\r
-                               outpw(CRTC_INDEX, ModeX_192x144regs[i]);\r
-                       }\r
-               break;\r
-               case 5:\r
-                       CRTParmCount = sizeof(ModeX_256x192regs) / sizeof(ModeX_256x192regs[0]);\r
-                       /* width and height */\r
-                       gv->video.page[0].sw=256;\r
-                       gv->video.page[0].sh=192;\r
-\r
-                       /* send the CRTParms */\r
-                       for(i=0; i<CRTParmCount; i++) {\r
-                               outpw(CRTC_INDEX, ModeX_256x192regs[i]);\r
-                       }\r
-               break;\r
+                       cm.vertical_blank_start = 0x1E7 + 1;\r
+                       cm.vertical_blank_end = 0x206 + 1;\r
+                       cm.clock_select = 0; /* misc register = 0xE3  25MHz */\r
+                       cm.vsync_neg = 1;\r
+                       cm.hsync_neg = 1;\r
+                       break;\r
+               case 2: // TODO: 160x120 according to ModeX_160x120regs\r
+                       return;\r
+               case 3: // TODO: 160x120 according to ModeX_320x200regs\r
+                       return;\r
+               case 4: // TODO: 160x120 according to ModeX_192x144regs\r
+                       return;\r
+               case 5: // TODO: 160x120 according to ModeX_256x192regs\r
+                       return;\r
+               default:\r
+                       return;\r
        }\r
 \r
+       vga_write_crtc_mode(&cm,0);\r
+\r
        /* clear video memory */\r
        switch (cmem)\r
        {\r
                case 1:\r
                /* clear video memory */\r
-               outpw(SC_INDEX, 0x0f02);\r
-               for(i=0; i<0x8000; i++) {\r
-                       ptr[i] = 0x0000;\r
-               }\r
+               vga_write_sequencer(2/*map mask register*/,0xf/*all 4 planes*/);\r
+               for(i=0; i<0x8000; i++) ptr[i] = 0x0000;\r
                break;\r
        }\r
        gv->video.page[0].tilesw = gv->video.page[0].sw/TILEWH;\r
@@ -218,46 +153,13 @@ modexLeave() {
        vgaSetMode(TEXT_MODE);\r
 }\r
 \r
-//    setBaseXMode() does the initialization to make the VGA ready to\r
-//    accept any combination of configuration register settings.  This\r
-//    involves enabling writes to index 0 to 7 of the CRT controller (port\r
-//    0x3D4), by clearing the most significant bit (bit 7) of index 0x11.\r
-void\r
-modexsetBaseXMode()\r
-{\r
-       /* TODO save current video mode and palette */\r
-       vgaSetMode(VGA_256_COLOR_MODE);\r
-\r
-       vga_enable_256color_modex();\r
-\r
-       /* disable chain4 mode */\r
-       //outpw(SC_INDEX, 0x0604);\r
-\r
-       /* synchronous reset while setting Misc Output */\r
-       //outpw(SC_INDEX, 0x0100);\r
-\r
-       /* select 25 MHz dot clock & 60 Hz scanning rate */\r
-       outp(MISC_OUTPUT, 0xe3);\r
-\r
-       /* undo reset (restart sequencer) */\r
-       //outpw(SC_INDEX, 0x0300);\r
-\r
-       /* reprogram the CRT controller */\r
-       outp(CRTC_INDEX, 0x11); /* VSync End reg contains register write prot */\r
-//     temp = inp(CRTC_DATA) & 0x7F;\r
-//     outp(CRTC_INDEX, 0x11);\r
-       outp(CRTC_DATA, 0x7f);  /* get current write protect on varios regs */\r
-//     outp(CRTC_DATA, temp);  /* get current write protect on varios regs */\r
-       update_state_from_vga();\r
-}\r
-\r
 page_t\r
 modexDefaultPage(page_t *p)\r
 {\r
     page_t page;\r
 \r
     /* default page values */\r
-    page.data = VGA;\r
+    page.data = vga_state.vga_graphics_ram;//VGA;\r
     page.dx = 0;\r
     page.dy = 0;\r
        page.sw = p->sw;\r
index fff256c30b7dedb19b15c154978a1d3f6d41022b..94a69ad59a38cefabb9fb0b8b6c5c7fd25f16116 100755 (executable)
 #include "src/lib/modex16/16planar.h"
 #include "src/lib/16text.h"
 #include "src/lib/modex16/16render.h"
-#include "src/lib/modex16/320x240.h"
-#include "src/lib/modex16/320x200.h"
-#include "src/lib/modex16/256x192.h"
-#include "src/lib/modex16/192x144_.h"
-#include "src/lib/modex16/160x120.h"
+// #include "src/lib/modex16/320x240.h"
+// #include "src/lib/modex16/320x200.h"
+// #include "src/lib/modex16/256x192.h"
+// #include "src/lib/modex16/192x144_.h"
+// #include "src/lib/modex16/160x120.h"
 
 #include <hw/cpu/cpu.h>
 #include <hw/dos/dos.h>
 #include <hw/vga/vga.h>
 #include <hw/vga/vrl.h>
 
-//TODO dos lib vga implementation ^^
-//#define DOSLIBVGA
-
 static struct pcxHeader {
        byte id;
        byte version;
index 5b480cf88da201e342916d146d5110bdc00a0f95..53b86d6bad212d70f3ad69e985b1b540571900ac 100755 (executable)
@@ -64,6 +64,27 @@ 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;
+       }
+
        testcontrolnoisy=0;
 
        player[0].persist_aniframe=0;
@@ -73,7 +94,6 @@ void main(int argc, char *argv[])
        printf("starting timer  ");
        start_timer(&gvar);
        printf("ok\n");
-       //extern struct inconfig inpu;
 
 //     atexit(qclean());
 
@@ -93,14 +113,14 @@ void main(int argc, char *argv[])
        //mappalptr = map.tiles->btdata->palette;
 
        /* data */
-       p = bitmapLoadPcx("data/ptmp.pcx"); // load sprite
+       //++++p = bitmapLoadPcx("data/ptmp.pcx"); // load sprite
        //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite
 
        /* create the planar buffer */
 ////++++       (player[0].data) = *planar_buf_from_bitmap(&p);
-       printf("load pee!!      ");
+       /*++++printf("load pee!!        ");
        pp = planar_buf_from_bitmap(&p);
-       printf("done!\n");
+       printf("done!\n");*/
 
 #endif
        /*      input!  */