]> 4ch.mooo.com Git - 16.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorJonathan Campbell <jonathan@castus.tv>
Sun, 17 Apr 2016 07:00:37 +0000 (00:00 -0700)
committerJonathan Campbell <jonathan@castus.tv>
Sun, 17 Apr 2016 07:00:37 +0000 (00:00 -0700)
24 files changed:
makefile
pcx2vrl
pcxsscut
src/16.c
src/bakapi.c
src/drawvrl5.c [deleted file]
src/fontgfx.c
src/lib/16_head.h
src/lib/16_in.c
src/lib/16_in.h
src/lib/bakapee.c
src/lib/bakapee.h
src/lib/doslib
src/lib/modex16.c
src/lib/modex16.h
src/lib/modex16/16render.c
src/lib/modex16/16render.h
src/lib/scroll16.c
src/lib/scroll16.h
src/palettel.c
src/planrpcx.c
src/scroll.c
vrl2vrs
vrsdump

index d29eb7c4cffad77c5c85d086ca5be7d9d96cd5ec..57a260fb8e3d1cd63930164c5a096deda99bbfde 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -82,7 +82,7 @@ DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
 
 GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ) $(DOSLIBLIBS)
 
-DOSLIBLIBS=$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib
+DOSLIBLIBS=$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vgatty.lib
 
 TESTEXEC = exmmtest.exe test.exe pcxtest.exe pcxtest2.exe test2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe planrpcx.exe
 # tsthimem.exe
@@ -132,8 +132,8 @@ fonttest.exe: fonttest.$(OBJ) $(16LIBOBJS) gfx.lib
 #fonttes0.exe: fonttes0.$(OBJ) $(16LIBOBJS)
 #      wcl $(FLAGS) fonttes0.$(OBJ) $(16LIBOBJS)
 
-fontgfx.exe: fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib
-       wcl $(FLAGS) fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib -fm=fontgfx.map
+fontgfx.exe: fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib $(DOSLIBLIBS)
+       wcl $(FLAGS) fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib $(DOSLIBLIBS) -fm=fontgfx.map
 
 inputest.exe: inputest.$(OBJ) $(16LIBOBJS)
        wcl $(FLAGS) inputest.$(OBJ) $(16LIBOBJS) -fm=inputest.map
@@ -293,8 +293,11 @@ $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib:
        cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu && .$(DIRSEP)make.sh
 $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib:
        cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos && .$(DIRSEP)make.sh
+$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vgatty.lib:
+       cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga && .$(DIRSEP)make.sh
 $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib:
        cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga && .$(DIRSEP)make.sh
+
 joytest.exe:
        cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)joystick && .$(DIRSEP)make.sh && $(COPYCOMMAND) dos86h$(DIRSEP)test.exe $(PDIR)$(PDIR)$(PDIR)$(PDIR)$(PDIR)joytest.exe
 #$(DOSLIBLIBS): .symbolic
@@ -460,7 +463,7 @@ comq: .symbolic
 
 www: .symbolic
        @ssh -p 26 sparky4@4ch.mooo.com 'rm -f /var/www/16/*exe.zip*'
-       @rm "/var/www/$(EXEC).zip*"
+       @rm -f /var/www/*.exe.zip*
        #@cp ./$(EXEC) $(DIRSEP)var$(DIRSEP)www$(DIRSEP)
        @./z.sh $(EXEC) $(EXEC)
        @scp -r -P 26 *.exe 4ch.mooo.com:/var/www/16/
diff --git a/pcx2vrl b/pcx2vrl
index bd947e55158b82b4f9d900234745aca806cde60e..06179c758ee3353a54ef7bc76b2422c342d53dd7 100755 (executable)
Binary files a/pcx2vrl and b/pcx2vrl differ
index 1deec74dc0487422bfdb03acb381df671e83a049..2ce56d285d26ddb8a30e5f7bf2839df2bde1fa75 100755 (executable)
Binary files a/pcxsscut and b/pcxsscut differ
index bfe777e253ad2ed5b686b1b9be92fd29e54c4cc3..27c17a58c57641cb14d8324a26b040567f53b8d0 100755 (executable)
--- a/src/16.c
+++ b/src/16.c
@@ -32,6 +32,27 @@ player_t player[MaxPlayers];
 void\r
 main(int argc, char *argv[])\r
 {\r
+       // DOSLIB: check our environment\r
+       probe_dos();\r
+\r
+       // DOSLIB: what CPU are we using?\r
+       // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
+       //      So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
+       //      parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
+       //      the CPU to carry out tasks. --J.C.\r
+       cpu_probe();\r
+\r
+       // DOSLIB: check for VGA\r
+       if (!probe_vga()) {\r
+               printf("VGA probe failed\n");\r
+               return;\r
+       }\r
+       // hardware must be VGA or higher!\r
+       if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
+               printf("This program requires VGA or higher graphics hardware\n");\r
+               return;\r
+       }\r
+\r
        //screen = modexDefaultPage();\r
        engi_stat = ENGI_RUN;\r
        //textInit();\r
index 6d04e5470eba75baabc399d6e44b9099e8d51218..333887021409b8452ee8047d7fe55a569ae57302 100755 (executable)
@@ -200,6 +200,7 @@ main(int argc, char *argvar[])
                        VGAmodeX(0, 0, &gvar);
                        // user imput switch
                        //fprintf(stderr, "xx=%d        yy=%d   tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
+                       fprintf(stderr, "dx=%d  dy=%d   ", gvar.video.page[0].dx, gvar.video.page[0].dy);
                        printf("Tiled mode is ");
                        switch (bakapee.tile)
                        {
@@ -302,8 +303,8 @@ pee:
 
 //     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;}
+//     if( (xpos>(gvar.video.page[0].sw-gvar.video.page[0].width-1))  || (xpos<1)){xdir=-xdir;}
+//     if( (ypos>(gvar.video.page[0].sh-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;}
 //     ch=getch();
        if(ch==0x71)break; // 'q'
        if(ch==0x1b)break; // 'ESC'
diff --git a/src/drawvrl5.c b/src/drawvrl5.c
deleted file mode 100755 (executable)
index 3e01c14..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-
-#include <stdio.h>
-#include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <math.h>
-#include <dos.h>
-
-#include <hw/cpu/cpu.h>
-#include <hw/dos/dos.h>
-#include <hw/vga/vga.h>
-#include <hw/vga/vrl.h>
-
-static unsigned char palette[768];
-
-int main(int argc,char **argv) {
-       struct vrl1_vgax_header *vrl_header;
-       vrl1_vgax_offset_t *vrl_lineoffs;
-       unsigned char *buffer;
-       unsigned int bufsz;
-       int fd;
-
-       if (argc < 3) {
-               fprintf(stderr,"drawvrl <VRL file> <palette file>\n");
-               return 1;
-       }
-
-       fd = open(argv[1],O_RDONLY|O_BINARY);
-       if (fd < 0) {
-               fprintf(stderr,"Unable to open '%s'\n",argv[1]);
-               return 1;
-       }
-       {
-               unsigned long sz = lseek(fd,0,SEEK_END);
-               if (sz < sizeof(*vrl_header)) return 1;
-               if (sz >= 65535UL) return 1;
-
-               bufsz = (unsigned int)sz;
-               buffer = malloc(bufsz);
-               if (buffer == NULL) return 1;
-
-               lseek(fd,0,SEEK_SET);
-               if ((unsigned int)read(fd,buffer,bufsz) < bufsz) return 1;
-
-               vrl_header = (struct vrl1_vgax_header*)buffer;
-               if (memcmp(vrl_header->vrl_sig,"VRL1",4) || memcmp(vrl_header->fmt_sig,"VGAX",4)) return 1;
-               if (vrl_header->width == 0 || vrl_header->height == 0) return 1;
-       }
-       close(fd);
-
-       probe_dos();
-       if (!probe_vga()) {
-               printf("VGA probe failed\n");
-               return 1;
-       }
-       int10_setmode(19);
-       update_state_from_vga();
-       vga_enable_256color_modex(); // VGA mode X
-       vga_state.vga_width = 320; // VGA lib currently does not update this
-       vga_state.vga_height = 200; // VGA lib currently does not update this
-
-#if 1 // 320x240 test mode: this is how Project 16 is using our code, enable for test case
-       {
-               struct vga_mode_params cm;
-
-               vga_read_crtc_mode(&cm);
-
-               // 320x240 mode 60Hz
-               cm.vertical_total = 525;
-               cm.vertical_start_retrace = 0x1EA;
-               cm.vertical_end_retrace = 0x1EC;
-               cm.vertical_display_end = 480;
-               cm.vertical_blank_start = 489;
-               cm.vertical_blank_end = 517;
-
-               vga_write_crtc_mode(&cm,0);
-       }
-       vga_state.vga_height = 240; // VGA lib currently does not update this
-#endif
-
-       /* load color palette */
-       fd = open(argv[2],O_RDONLY|O_BINARY);
-       if (fd >= 0) {
-               unsigned int i;
-
-               read(fd,palette,768);
-               close(fd);
-
-               vga_palette_lseek(0);
-               for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);
-       }
-
-       /* preprocess the sprite to generate line offsets */
-       vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
-       if (vrl_lineoffs == NULL) return 1;
-
-       {
-               unsigned int i,j,o;
-
-               /* fill screen with a distinctive pattern */
-               for (i=0;i < vga_state.vga_width;i++) {
-                       o = i >> 2;
-                       vga_write_sequencer(0x02/*map mask*/,1 << (i&3));
-                       for (j=0;j < vga_state.vga_height;j++,o += vga_state.vga_stride)
-                               vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15!
-               }
-       }
-       while (getch() != 13);
-
-       /* make distinctive pattern offscreen, render sprite, copy onscreen */
-       {
-               const unsigned int offscreen_ofs = (vga_state.vga_stride * vga_state.vga_height);
-               unsigned int i,j,o,o2,x,y,rx,ry,w,h;
-               unsigned int overdraw = 1;      // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.
-                                               // if the sprite's edge pixels are clear anyway, you can set this to 0.
-               VGA_RAM_PTR omemptr;
-               int xdir=1,ydir=1;
-
-               /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */
-               x = 0;
-               y = 0;
-
-               /* do it */
-               omemptr = vga_state.vga_graphics_ram; // save original mem ptr
-               while (1) {
-                       /* stop animating if the user hits ENTER */
-                       if (kbhit()) {
-                               if (getch() == 13) break;
-                       }
-
-                       /* render box bounds. y does not need modification, but x and width must be multiple of 4 */
-                       if (x >= overdraw) rx = (x - overdraw) & (~3);
-                       else rx = 0;
-                       if (y >= overdraw) ry = (y - overdraw);
-                       else ry = 0;
-                       h = vrl_header->height + overdraw + y - ry;
-                       w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3);
-                       if ((rx+w) > vga_state.vga_width) w = vga_state.vga_width-rx;
-                       if ((ry+h) > vga_state.vga_height) h = vga_state.vga_height-ry;
-
-                       /* replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0) */
-                       vga_state.vga_draw_stride_limit = (vga_state.vga_width + 3/*round up*/ - x) >> 2;
-                       vga_state.vga_draw_stride = w >> 2;
-                       vga_state.vga_graphics_ram = omemptr + offscreen_ofs;
-
-                       /* first draw pattern corresponding to that part of the screen. this COULD be optimized, obviously, but it's designed for study.
-                        * also note we don't have to use the same stride as the display! */
-                       for (i=rx;i < (rx+w);i++) {
-                               o = (i-rx) >> 2;
-                               vga_write_sequencer(0x02/*map mask*/,1 << (i&3));
-                               for (j=ry;j < (ry+h);j++,o += vga_state.vga_draw_stride)
-                                       vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15!
-                       }
-
-                       /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */
-                       draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
-
-                       /* restore ptr */
-                       vga_state.vga_graphics_ram = omemptr;
-
-                       /* block copy to visible RAM from offscreen */
-                       vga_setup_wm1_block_copy();
-                       o = offscreen_ofs; // source offscreen
-                       o2 = (ry * vga_state.vga_stride) + (rx >> 2); // dest visible (original stride)
-                       for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2);
-                       /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
-                       vga_restore_rm0wm0();
-
-                       /* restore stride */
-                       vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;
-
-                       /* step */
-                       x += xdir;
-                       y += ydir;
-                       if (x >= (vga_state.vga_width - 1) || x == 0)
-                               xdir = -xdir;
-                       if (y >= (vga_state.vga_height - 1) || y == 0)
-                               ydir = -ydir;
-               }
-       }
-
-       /* make distinctive pattern offscreen, render sprite, copy onscreen.
-        * this time, we render the distinctive pattern to another offscreen location and just copy.
-        * note this version is much faster too! */
-       {
-               const unsigned int offscreen_ofs = (vga_state.vga_stride * vga_state.vga_height);
-               const unsigned int pattern_ofs = 0x10000UL - (vga_state.vga_stride * vga_state.vga_height);
-               unsigned int i,j,o,o2,x,y,rx,ry,w,h;
-               unsigned int overdraw = 1;      // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.
-                                               // if the sprite's edge pixels are clear anyway, you can set this to 0.
-               VGA_RAM_PTR omemptr;
-               int xdir=1,ydir=1;
-
-               /* fill pattern offset with a distinctive pattern */
-               for (i=0;i < vga_state.vga_width;i++) {
-                       o = (i >> 2) + pattern_ofs;
-                       vga_write_sequencer(0x02/*map mask*/,1 << (i&3));
-                       for (j=0;j < vga_state.vga_height;j++,o += vga_state.vga_stride)
-                               vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15!
-               }
-
-               /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */
-               x = 0;
-               y = 0;
-
-               /* do it */
-               omemptr = vga_state.vga_graphics_ram; // save original mem ptr
-               while (1) {
-                       /* stop animating if the user hits ENTER */
-                       if (kbhit()) {
-                               if (getch() == 13) break;
-                       }
-
-                       /* render box bounds. y does not need modification, but x and width must be multiple of 4 */
-                       if (x >= overdraw) rx = (x - overdraw) & (~3);
-                       else rx = 0;
-                       if (y >= overdraw) ry = (y - overdraw);
-                       else ry = 0;
-                       h = vrl_header->height + overdraw + y - ry;
-                       w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3);
-                       if ((rx+w) > vga_state.vga_width) w = vga_state.vga_width-rx;
-                       if ((ry+h) > vga_state.vga_height) h = vga_state.vga_height-ry;
-
-                       /* block copy pattern to where we will draw the sprite */
-                       vga_setup_wm1_block_copy();
-                       o2 = offscreen_ofs;
-                       o = pattern_ofs + (ry * vga_state.vga_stride) + (rx >> 2); // source offscreen
-                       for (i=0;i < h;i++,o += vga_state.vga_stride,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2);
-                       /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
-                       vga_restore_rm0wm0();
-
-                       /* replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0) */
-                       vga_state.vga_draw_stride_limit = (vga_state.vga_width + 3/*round up*/ - x) >> 2;
-                       vga_state.vga_draw_stride = w >> 2;
-                       vga_state.vga_graphics_ram = omemptr + offscreen_ofs;
-
-                       /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */
-                       draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
-
-                       /* restore ptr */
-                       vga_state.vga_graphics_ram = omemptr;
-
-                       /* block copy to visible RAM from offscreen */
-                       vga_setup_wm1_block_copy();
-                       o = offscreen_ofs; // source offscreen
-                       o2 = (ry * vga_state.vga_stride) + (rx >> 2); // dest visible (original stride)
-                       for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2);
-                       /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
-                       vga_restore_rm0wm0();
-
-                       /* restore stride */
-                       vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;
-
-                       /* step */
-                       x += xdir;
-                       y += ydir;
-                       if (x >= (vga_state.vga_width - 1) || x == 0)
-                               xdir = -xdir;
-                       if (y >= (vga_state.vga_height - 1) || y == 0)
-                               ydir = -ydir;
-               }
-       }
-
-       /* another handy "demo" effect using VGA write mode 1.
-        * we can take what's on screen and vertically squash it like an old analog TV set turning off. */
-       {
-               unsigned int blank_line_ofs = (vga_state.vga_stride * vga_state.vga_height * 2);
-               unsigned int copy_ofs = (vga_state.vga_stride * vga_state.vga_height);
-               unsigned int display_ofs = 0x0000;
-               unsigned int i,y,soh,doh,dstart;
-               unsigned int dh_blankfill = 8;
-               unsigned int dh_step = 8;
-               uint32_t sh,dh,yf,ystep;
-
-               /* copy active display (0) to offscreen buffer (0x4000) */
-               vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;
-               vga_setup_wm1_block_copy();
-               vga_wm1_mem_block_copy(copy_ofs,display_ofs,vga_state.vga_stride * vga_state.vga_height);
-               vga_restore_rm0wm0();
-
-               /* need a blank line as well */
-               for (i=0;i < vga_state.vga_stride;i++) vga_state.vga_graphics_ram[i+blank_line_ofs] = 0;
-
-               sh = dh = vga_state.vga_height;
-               while (dh >= dh_step) {
-                       /* stop animating if the user hits ENTER */
-                       if (kbhit()) {
-                               if (getch() == 13) break;
-                       }
-
-                       /* wait for vsync end */
-                       vga_wait_for_vsync_end();
-
-                       /* what scalefactor to use for stretching? */
-                       ystep = (0x10000UL * sh) / dh;
-                       dstart = (vga_state.vga_height - dh) / 2; // center the squash effect on screen, otherwise it would squash to top of screen
-                       doh = display_ofs;
-                       soh = copy_ofs;
-                       yf = 0;
-                       y = 0;
-
-                       /* for performance, keep VGA in write mode 1 the entire render */
-                       vga_setup_wm1_block_copy();
-
-                       /* blank lines */
-                       if (dstart >= dh_blankfill) y = dstart - dh_blankfill;
-                       else y = 0;
-                       doh = vga_state.vga_stride * y;
-
-                       while (y < dstart) {
-                               vga_wm1_mem_block_copy(doh,blank_line_ofs,vga_state.vga_stride);
-                               doh += vga_state.vga_stride;
-                               y++;
-                       }
-
-                       /* draw */
-                       while (y < (dh+dstart)) {
-                               soh = copy_ofs + ((yf >> 16UL) * vga_state.vga_stride);
-                               vga_wm1_mem_block_copy(doh,soh,vga_state.vga_stride);
-                               doh += vga_state.vga_stride;
-                               yf += ystep;
-                               y++;
-                       }
-
-                       /* blank lines */
-                       while (y < vga_state.vga_height && y < (dh+dstart+dh_blankfill)) {
-                               vga_wm1_mem_block_copy(doh,blank_line_ofs,vga_state.vga_stride);
-                               doh += vga_state.vga_stride;
-                               y++;
-                       }
-
-                       /* done */
-                       vga_restore_rm0wm0();
-
-                       /* wait for vsync */
-                       vga_wait_for_vsync();
-
-                       /* make it shrink */
-                       dh -= dh_step;
-                       if (dh < 40) dh_step = 1;
-               }
-       }
-
-       int10_setmode(3);
-       free(vrl_lineoffs);
-       buffer = NULL;
-       free(buffer);
-       bufsz = 0;
-       return 0;
-}
-
index 2abb13ffe93dfa88a15c9b88a486a67c169c7177..50427a3ad8af9075a7b5924beb3e27b221f8b34d 100755 (executable)
 //#include "lib/16text.h"\r
 #include "lib/modex16.h"\r
 \r
+#include <hw/cpu/cpu.h>\r
+#include <hw/dos/dos.h>\r
+#include <hw/vga/vga.h>\r
+#include <hw/vga/vgatty.h>\r
+\r
 global_game_variables_t gvar;\r
 \r
 void main(int argc, char near *argv[])\r
 {\r
+       struct vga_mode_params cm;\r
        //JMOJI\r
        static byte e;\r
        //word ri;\r
-       byte pee[2];\r
+       byte pee[6]; // must be large enough for sprintf("%zc",...) and sprintf("%u",(byte value))\r
        static byte ibmlogo[]="IIIIIII  BBBBBBBBB    MMMMM       MMMMM\n\\r
 IIIIIII  BBBBBBBBBBB  MMMMMM     MMMMMM\n\\r
   III     BBB    BBB   MMMMMM   MMMMMM\n\\r
@@ -61,19 +67,46 @@ IIIIIII  BBBBBBBBB    MMMM    M    MMMM\n\
 ,'___...---~~~\n\\r
 ";\r
 //     static byte *rosa;\r
-       static word chx, chy, colpee;\r
+       static word chx, chy, colpee, addr;\r
        textInit();\r
+\r
+       // DOSLIB: check our environment\r
+       probe_dos();\r
+\r
+       // DOSLIB: what CPU are we using?\r
+       // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
+       //      So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
+       //      parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
+       //      the CPU to carry out tasks. --J.C.\r
+       cpu_probe();\r
+\r
+       // DOSLIB: check for VGA\r
+       if (!probe_vga()) {\r
+               printf("VGA probe failed\n");\r
+               return;\r
+       }\r
+       // hardware must be VGA or higher!\r
+       if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
+               printf("This program requires VGA or higher graphics hardware\n");\r
+               return;\r
+       }\r
        VGAmodeX(1, 1, &gvar);\r
        /* setup camera and screen~ */\r
        gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);\r
-       //gvar.video.page[0].width += (16*2);\r
-       //gvar.video.page[0].height += (16*2);\r
-//++++ modexShowPage(&gvar.video.page[0]);\r
+       gvar.video.page[0].width += (16*2);\r
+       gvar.video.page[0].height += (16*2);\r
+       modexShowPage(&gvar.video.page[0]);\r
+       vga_read_crtc_mode(&cm);\r
+       // NTS: We're in Mode-X now. printf() is useless. Do not use printf(). Or INT 10h text printing. Or DOS console output.\r
        //modexprint(16, 16, 1, 15, "wwww");\r
        //getch();\r
        chx=0;\r
        chy=0;\r
        colpee=32;\r
+//     bios_cls();\r
+       /* position the cursor to home */\r
+//     vga_moveto(0,0);\r
+//     vga_sync_bios_cursor();\r
        for(e=0x00; e<=0xFE; e++)\r
        {\r
                if(chx+8>(gvar.video.page[0].width/2))\r
@@ -81,25 +114,28 @@ IIIIIII  BBBBBBBBB    MMMM    M    MMMM\n\
                        chx=0;\r
                        chy+=8;\r
                        sprintf(pee,"%u", colpee);\r
-                       modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 1);\r
+                       modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee);\r
                        //getch();\r
                }\r
-               modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 1);\r
+               sprintf(pee, "%zc", e);\r
+               modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e);\r
                chx+=9;\r
                colpee++;\r
                if(colpee>=32+24) colpee=32;\r
        }\r
-       //modexprint(100, 100, 1, 47, 0, "wwww");\r
        getch();\r
+       //modexprint(100, 100, 1, 47, 0, "wwww");\r
 //     modexprint(0, 0, 1, 0, colpee, &rose);\r
 //++++ modexprint(&gvar.video.page[0], 0, 0, 0, 0, colpee, &ibmlogo);\r
 //     modexprintbig(&gvar.video.page[0], 0, 0, 1, colpee, 0, "IBM");\r
 //     modexprint(0, 0, 1, 0, colpee, ROSE);\r
-       getch();\r
+//++++ getch();\r
        VGAmodeX(0, 1, &gvar);\r
 //     rosa=malloc(sizeof(ROSE));\r
 //     (*rosa)=(byte)ROSE;\r
        printf("\n%s\n", rose);\r
        //printf("\nh=%d\n", '8');\r
 //     printf("\n%c\n", e);\r
+       printf("cm.offset=%d\n", cm.offset);\r
+       printf("vga_state.vga_stride=%d\n", vga_state.vga_stride);\r
 }\r
index 3217ea2ed760a07cde59f424e31c3134415776d6..4b9972f1e3bdc3d0020738a6248002906e7a2efd 100755 (executable)
@@ -50,6 +50,7 @@
 #include "src/lib/nyan/kitten.h"\r
 #include "src/lib/types.h"\r
 #include "src/lib/typdefst.h"\r
+#include "src/lib/16_in.h"\r
 \r
 #define VERSION __DATE__ " " __TIME__\r
 \r
index aef50c68b5f0ba4542446d4eff06da65921d11cf..5bccecafde8529eb59983c6a1674d35a2a92f877 100755 (executable)
@@ -1282,3 +1282,19 @@ boolean IN_qb(byte kee)
        if(inpu.Keyboard[kee]==true) return 1;\r
        else return 0;\r
 }\r
+\r
+//init player!\r
+void IN_initplayer(player_t *player, word pn)\r
+{\r
+       player[pn].x = player[pn].tx*TILEWH;\r
+       player[pn].y = player[pn].ty*TILEWH;\r
+       player[pn].triggerx = player[pn].tx;\r
+       player[pn].triggery = player[pn].ty+1;\r
+/*     player[0].info.x = player[0].tx;\r
+       player[0].info.xaxis = player[0].tx*TILEWH;\r
+       player[0].info.y = player[0].ty;\r
+       player[0].info.yaxis = player[0].ty*TILEWH;*/\r
+       player[pn].q=1;\r
+       player[pn].d=2;\r
+       player[pn].hp=4;\r
+}\r
index 0990a55089d68ccdcf3b3cd786c7d0ab991e324c..78ebd8053db4bec143f7dc2995773c0712fd92db 100755 (executable)
@@ -303,5 +303,6 @@ extern boolean IN_UserInput(dword delay,boolean clear);
 extern boolean IN_KeyDown(byte code);\r
 extern void IN_ClearKey(byte code);\r
 extern boolean IN_qb(byte kee);\r
+void IN_initplayer(player_t *player, word pn);\r
 \r
 #endif\r
index 1626fd1dc6fcd1e92d5421e7b3f576ff5d88ff24..b50c16e184212eb97efeae0c543f9a673abac50d 100755 (executable)
@@ -34,7 +34,7 @@ void colortest(page_t *page, bakapee_t *pee)
 {
        //if(pee->coor < 256)
        //{
-               cls(page, pee->coor, VGA);
+               modexcls(page, pee->coor, VGA);
                pee->coor++;
        //}else pee->coor = 0;
 }
@@ -44,7 +44,7 @@ void colorz(page_t *page, bakapee_t *pee)
 {
        if(pee->coor <= HGQ)
        {
-               cls(page, pee->coor, VGA);
+               modexcls(page, pee->coor, VGA);
                pee->coor++;
        }else pee->coor = LGQ;
 }
@@ -228,7 +228,7 @@ void ding(page_t *page, bakapee_t *pee, word q)
                break;
                case 6:
                        pee->coor = rand()%256;
-                       cls(page, pee->coor, VGA);
+                       modexcls(page, pee->coor, VGA);
                break;
                case 7:
                        if(pee->coor <= HGQ)
@@ -239,7 +239,7 @@ void ding(page_t *page, bakapee_t *pee, word q)
                break;
                case 8:
                        colorz(page, pee);
-                       modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi", 1);
+                       modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi");
                break;
                case 9:
                        if(pee->coor <= HGQ)
index e06c0b8f51378b9b33dcf2a16dfc0ece7fa66bfa..a6076dafcef6069112d47e48a849ad57bc0b7de4 100755 (executable)
@@ -28,6 +28,7 @@
 #include <hw/cpu/cpu.h>\r
 #include <hw/dos/dos.h>\r
 #include <hw/vga/vga.h>\r
+\r
 //#include "src/lib/modex/modex.h"\r
 //#include "16/x/modex.h"\r
 \r
index 05fc315e3b435866873be945a61f672f62f9199d..9990f0adb22b4fed2598c8733172d131d1a412f2 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 05fc315e3b435866873be945a61f672f62f9199d
+Subproject commit 9990f0adb22b4fed2598c8733172d131d1a412f2
index 42d4f6c8be8bd193845ae388e26e42403ba6cd5d..cab1376675720d225ca62f6d01f1204c020a5ce4 100755 (executable)
@@ -80,7 +80,6 @@ vgaGetMode()
 void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)\r
 {\r
        word i;\r
-       dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA;      /* used for faster screen clearing */\r
        struct vga_mode_params cm;\r
        int CRTParmCount;\r
 \r
@@ -94,9 +93,12 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)
                case 1:\r
                        //CRTParmCount = sizeof(ModeX_320x240regs) / sizeof(ModeX_320x240regs[0]);\r
                        /* width and height */\r
-                       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
+                       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
+                       // mode X BYTE mode\r
+                       cm.word_mode = 0;\r
+                       cm.dword_mode = 0;\r
                        // 320x240 mode 60Hz\r
                        cm.horizontal_total=0x5f + 5; /* CRTC[0]             -5 */\r
                        cm.horizontal_display_end=0x4f + 1; /* CRTC[1]       -1 */\r
@@ -115,6 +117,7 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)
                        cm.clock_select = 0; /* misc register = 0xE3  25MHz */\r
                        cm.vsync_neg = 1;\r
                        cm.hsync_neg = 1;\r
+                       cm.offset = (vga_state.vga_width / (4 * 2)); // 320 wide (40 x 4 pixel groups x 2)\r
                        break;\r
                case 2: // TODO: 160x120 according to ModeX_160x120regs\r
                        return;\r
@@ -128,15 +131,18 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)
                        return;\r
        }\r
 \r
+       vga_state.vga_stride = cm.offset * 2;\r
        vga_write_crtc_mode(&cm,0);\r
 \r
        /* clear video memory */\r
        switch (cmem)\r
        {\r
-               case 1:\r
-               /* clear video memory */\r
-               vga_write_sequencer(2/*map mask register*/,0xf/*all 4 planes*/);\r
-               for(i=0; i<0x8000; i++) ptr[i] = 0x0000;\r
+               case 1: {\r
+                       /* clear video memory */\r
+                       dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA;      /* used for faster screen clearing */\r
+                       vga_write_sequencer(2/*map mask register*/,0xf/*all 4 planes*/);\r
+                       for(i = 0;i < 0x4000; i++) ptr[i] = 0x0000; // 0x4000 x dword = 64KB\r
+               }\r
                break;\r
        }\r
        gv->video.page[0].tilesw = gv->video.page[0].sw/TILEWH;\r
@@ -545,7 +551,8 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset)
        static word a[PAL_SIZE];        //palette array of change values!\r
        word z=0, aq=0, aa=0, pp=0;\r
 \r
-       modexWaitBorder();\r
+       //modexWaitBorder();\r
+       vga_wait_for_vsync();\r
        if((*i)==0)\r
        {\r
                memset(a, -1, sizeof(a));\r
@@ -595,7 +602,8 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset)
                //if(qp>0) printf("qp=%d\n", qp);\r
                //if(qp>0) printf("                                          (*i)=%d\n", (*i)/3);\r
        }\r
-       modexWaitBorder();        /* waits one retrace -- less flicker */\r
+       //modexWaitBorder();      /* waits one retrace -- less flicker */\r
+       vga_wait_for_vsync();\r
        if((*i)>=PAL_SIZE/2 && w==0)\r
        {\r
                for(; (*i)<PAL_SIZE; (*i)++)\r
@@ -634,7 +642,7 @@ printf("\nqqqqqqqq\n\n");
                pp = q;\r
                //printf("1(*i)=%02d\n", (*i)/3);\r
                //printf("1z=%02d\n", z/3);\r
-               chkcolor(bmp, &q, &a, &aa, &z, i);\r
+               modexchkcolor(bmp, &q, &a, &aa, &z, i);\r
                //printf("2(*i)=%02d\n", (*i)/3);\r
                //printf("2z=%02d\n", z/3);\r
                aq=0;\r
@@ -706,13 +714,15 @@ void
 modexPalUpdate1(byte *p)\r
 {\r
        int i;\r
-       modexWaitBorder();\r
+       //modexWaitBorder();\r
+       vga_wait_for_vsync();\r
        outp(PAL_WRITE_REG, 0);  /* start at the beginning of palette */\r
        for(i=0; i<PAL_SIZE/2; i++)\r
        {\r
                outp(PAL_DATA_REG, p[i]);\r
        }\r
-       modexWaitBorder();        /* waits one retrace -- less flicker */\r
+       //modexWaitBorder();      /* waits one retrace -- less flicker */\r
+       vga_wait_for_vsync();\r
        for(; i<PAL_SIZE; i++)\r
        {\r
                outp(PAL_DATA_REG, p[(i)]);\r
@@ -723,13 +733,15 @@ void
 modexPalUpdate0(byte *p)\r
 {\r
        int i;\r
-       modexWaitBorder();\r
+       //modexWaitBorder();\r
+       vga_wait_for_vsync();\r
        outp(PAL_WRITE_REG, 0);  /* start at the beginning of palette */\r
        for(i=0; i<PAL_SIZE/2; i++)\r
        {\r
                outp(PAL_DATA_REG, rand());\r
        }\r
-       modexWaitBorder();        /* waits one retrace -- less flicker */\r
+       //modexWaitBorder();      /* waits one retrace -- less flicker */\r
+       vga_wait_for_vsync();\r
        for(; i<PAL_SIZE; i++)\r
        {\r
                outp(PAL_DATA_REG, rand());\r
@@ -739,14 +751,15 @@ modexPalUpdate0(byte *p)
 void\r
 modexPalOverscan(byte *p, word col)\r
 {\r
-       modexWaitBorder();\r
+       //modexWaitBorder();\r
+       vga_wait_for_vsync();\r
        outp(PAL_WRITE_REG, 0);  /* start at the beginning of palette */\r
        outp(PAL_DATA_REG, col);\r
 }\r
 \r
 //color checker~\r
 //i want to make another vesion that checks the palette when the palette is being appened~\r
-void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)\r
+void modexchkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)\r
 {\r
                byte *pal;\r
                word zz=0;\r
@@ -864,23 +877,11 @@ byte modexgetPixel(page_t *page, int x, int y)
 \r
 }\r
 \r
-void modexhlin(page_t *page, word xl, word xh, word y, word color)\r
-{\r
-       word x;\r
-       word yy=0;\r
-\r
-       for(x=0;x<xh*4;x+=4)\r
-       {\r
-               if(x+4>=page[0].sw-1){ x=0; yy+=4; }\r
-               modexClearRegion(page, x+xl, y+yy, 4, 4, color);\r
-       }\r
-       //modexputPixel(page, x+xl, y, color);\r
-}\r
-\r
-void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q)\r
+void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
 {\r
        word s, o, w;\r
        word addr = (word) romFontsData.l;\r
+       word addrq = (page->width/4) * y + (x / 4) + ((word)page->data);\r
        byte c;\r
 \r
        s=romFonts[t].seg;\r
@@ -917,7 +918,8 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons
                JNZ L1\r
        }\r
 //TODO: OPTIMIZE THIS!!!!\r
-               modexDrawCharPBuf(page, x, y, t, col, bgcol, q);\r
+               modexDrawCharPBuf(page, x/*for mode X planar use*/, y/*redunant, remove*/, t, col, bgcol, addrq);\r
+               addrq += 2; /* move 8 pixels over (2 x 4 planar pixels per byte) */\r
 \r
                //if(!q) getch();\r
        }\r
@@ -999,7 +1001,7 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c
 }\r
 \r
 /* palette dump on display! */\r
-void pdump(page_t *pee)\r
+void modexpdump(page_t *pee)\r
 {\r
        int mult=(QUADWH);\r
        int palq=(mult)*TILEWH;\r
@@ -1019,7 +1021,7 @@ void pdump(page_t *pee)
 //              the Virtual screen.                                                                                     //\r
 //                                                                                                                                              //\r
 /////////////////////////////////////////////////////////////////////////////\r
-void cls(page_t *page, byte color, byte *Where)\r
+void modexcls(page_t *page, byte color, byte *Where)\r
 {\r
        //modexClearRegion(page, 0, 0, page->width, page->height, color);\r
        /* set map mask to all 4 planes */\r
@@ -1028,13 +1030,40 @@ void cls(page_t *page, byte color, byte *Where)
        _fmemset(Where, color, page->width*(page->height)/4);\r
 }\r
 \r
-void\r
+/*void\r
 modexWaitBorder() {\r
     while(inp(INPUT_STATUS_1)  & 8)  {\r
-       /* spin */\r
+       // spin\r
     }\r
 \r
     while(!(inp(INPUT_STATUS_1)  & 8))  {\r
-       /* spin */\r
+       // spin\r
     }\r
+}*/\r
+\r
+void bios_cls() {\r
+       VGA_ALPHA_PTR ap;\r
+       VGA_RAM_PTR rp;\r
+       unsigned char m;\r
+\r
+       m = int10_getmode();\r
+       if ((rp=vga_state.vga_graphics_ram) != NULL && !(m <= 3 || m == 7)) {\r
+               unsigned int i,im;\r
+\r
+               im = (FP_SEG(vga_state.vga_graphics_ram_fence) - FP_SEG(vga_state.vga_graphics_ram));\r
+               if (im > 0xFFE) im = 0xFFE;\r
+               im <<= 4;\r
+               for (i=0;i < im;i++) vga_state.vga_graphics_ram[i] = 0;\r
+       }\r
+       else if ((ap=vga_state.vga_alpha_ram) != NULL) {\r
+               unsigned int i,im;\r
+\r
+               im = (FP_SEG(vga_state.vga_alpha_ram_fence) - FP_SEG(vga_state.vga_alpha_ram));\r
+               if (im > 0x7FE) im = 0x7FE;\r
+               im <<= 4 - 1; /* because ptr is type uint16_t */\r
+               for (i=0;i < im;i++) vga_state.vga_alpha_ram[i] = 0x0720;\r
+       }\r
+       else {\r
+               printf("WARNING: bios cls no ptr\n");\r
+       }\r
 }\r
index 3621466f0e3a496cfbbb7bd64c893c92b920533b..f85eb055a2de9b60b47e8d9a0c7faecc4248a4ce 100755 (executable)
@@ -71,7 +71,7 @@ static struct pcxHeader {
 
 /* -========================== Types & Macros ==========================- */
 #define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2))
-#define PLANE(x) (1<< (x&3))
+#define PLANE(x) (1 << ((x) & 3))
 #define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02)
 #define     PALSIZE            768
 
@@ -82,6 +82,32 @@ typedef union
        byte blue;
 } rgb_t;
 
+/* -======================= Constants & Vars ==========================- */
+extern byte far*  VGA;  /* The VGA Memory */
+#define SCREEN_SEG             0xa000
+#define VIDEO_INT              0x10
+#define SET_MODE               0x00
+#define VGA_256_COLOR_MODE     0x13
+#define TEXT_MODE              0x03
+
+#define AC_INDEX               0x03c0
+#define SC_INDEX               0x03c4
+#define SC_DATA                        0x03c5
+#define CRTC_INDEX             0x03d4
+#define CRTC_DATA              0x03d5
+#define GC_INDEX               0x03ce
+#define MISC_OUTPUT            0x03c2
+#define HIGH_ADDRESS           0x0C
+#define LOW_ADDRESS            0x0D
+#define VRETRACE               0x08
+//#define INPUT_STATUS_1               0x03da  defined in 16_head
+#define DISPLAY_ENABLE         0x01
+#define MAP_MASK               0x02
+#define PAL_READ_REG                   0x03C7   /* Color register, read address */
+#define PAL_WRITE_REG             0x03C8   /* Color register, write address */
+#define PAL_DATA_REG                   0x03C9   /* Color register, data port */
+#define PAL_SIZE                               (256 * 3)
+
 /* -============================ Functions =============================- */
 /* mode switching, page, and plane functions */
 void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv);
@@ -120,39 +146,41 @@ void modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset);
 void modexPalUpdate1(byte *p);
 void modexPalUpdate0(byte *p);
 void modexPalOverscan(byte *p, word col);
-void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/);
+void modexchkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/);
 void modexputPixel(page_t *page, int x, int y, byte color);
 byte modexgetPixel(page_t *page, int x, int y);
-void modexhlin(page_t *page, word xl, word xh, word y, word color);
-void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q);
-void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str);
-void pdump(page_t *pee);
-void cls(page_t *page, byte color, byte *Where);
-void modexWaitBorder();
 
-/* -======================= Constants & Vars ==========================- */
-extern byte far*  VGA;  /* The VGA Memory */
-#define SCREEN_SEG             0xa000
-#define VIDEO_INT              0x10
-#define SET_MODE               0x00
-#define VGA_256_COLOR_MODE     0x13
-#define TEXT_MODE              0x03
+#if 0 // not needed anymore. maybe good for reference purposes though.
+static inline void modexwritepixel(page_t *page, int x, int y, word addr, byte color)
+{
+       /* Each address accesses four neighboring pixels, so set
+          Write Plane Enable according to which pixel we want
+          to modify.  The plane is determined by the two least
+          significant bits of the x-coordinate: */
+       modexSelectPlane(PLANE(x));
+       //outp(SC_INDEX, 0x02);
+       //outp(SC_DATA, 0x01 << (x & 3));
+
+       /* The offset of the pixel into the video segment is
+          offset = (width * y + x) / 4, and write the given
+          color to the plane we selected above.  Heed the active
+          page start selection. */
+       vga_state.vga_graphics_ram[addr] = color;
+}
+static inline byte modexreadPixel(page_t *page, int x, int y, word addr)
+{
+       /* Select the plane from which we must read the pixel color: */
+       outpw(GC_INDEX, 0x04);
+       outpw(GC_INDEX+1, x & 3);
+       return vga_state.vga_graphics_ram[addr];
+}
+#endif
+
+void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str);
+void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str);
+void modexpdump(page_t *pee);
+void modexcls(page_t *page, byte color, byte *Where);
+//void modexWaitBorder();
+void bios_cls();
 
-#define AC_INDEX               0x03c0
-#define SC_INDEX               0x03c4
-#define SC_DATA                        0x03c5
-#define CRTC_INDEX             0x03d4
-#define CRTC_DATA              0x03d5
-#define GC_INDEX               0x03ce
-#define MISC_OUTPUT            0x03c2
-#define HIGH_ADDRESS           0x0C
-#define LOW_ADDRESS            0x0D
-#define VRETRACE               0x08
-//#define INPUT_STATUS_1               0x03da  defined in 16_head
-#define DISPLAY_ENABLE         0x01
-#define MAP_MASK               0x02
-#define PAL_READ_REG                   0x03C7   /* Color register, read address */
-#define PAL_WRITE_REG             0x03C8   /* Color register, write address */
-#define PAL_DATA_REG                   0x03C9   /* Color register, data port */
-#define PAL_SIZE                               (256 * 3)
 #endif
index 0399a7771738f489fe3a77a936387183319ab571..8e6fa43624cd41be40f3b0b7fbd4ffbdb7809f53 100755 (executable)
@@ -435,34 +435,38 @@ modexDrawSpritePBufRegion(page_t *page, int x, int y,
     }\r
 }\r
 \r
-void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q)\r
+void modexDrawCharPBuf(page_t *page, int x/*for planar selection only*/, int y/*redundant, remove*/, word t, word col, word bgcol, word addr)\r
 {\r
-       word i, j, k;\r
-       for(i=0; i<romFonts[t].charSize; i++)\r
-       {\r
-               j=1<<8;\r
-               k=0;\r
-               //every "pixel" row\r
-               while(j)\r
-               {\r
-                       if(q)\r
-                       //_fmemcpy(page->data + (((page->width/4) * (y+i)) + ((x+romFontsData.chw+k) / 4)), romFontsData.l[i] & j ? col:bgcol, 2);\r
-                       modexputPixel(page, x+k+romFontsData.chw, y+i, romFontsData.l[i] & j ? col:bgcol);\r
-                       else\r
-                               //printf("l[i]=%c j=%02u l[i] & j=%02u %c\n", l[i] , j, l[i] & j, l[i] & j ? '*':' ');\r
-                               //printf("%c", l[i] & j ? '*':' ');\r
-                               romFontsData.z[k]=romFontsData.l[i] & j ? '*':' ';\r
-                       j>>=1;\r
-                       k++;\r
+       /* vertical drawing routine by joncampbell123.\r
+        *\r
+        * optimize for VGA mode X planar memory to minimize the number of times we do I/O write to map mask register.\r
+        * so, we enumerate over columns (not rows!) to draw every 4th pixel. bit masks are used because of the font bitmap.\r
+        * \r
+        * NTS: addr defines what VGA memory address we use, "x" is redundant except to specify which of the 4 pixels we select in the map mask register. */\r
+       word drawaddr;\r
+       word colm, row;\r
+       byte fontbyte;\r
+       byte plane;\r
+       byte m1,m2;\r
+\r
+       plane = x & 3;\r
+       m1 = 0x80; // left half\r
+       m2 = 0x08; // right half\r
+       for (colm=0;colm < 4;colm++) {\r
+               drawaddr = addr;\r
+               modexSelectPlane(PLANE(plane));\r
+               for (row=0;row < 8;row++) {\r
+                       fontbyte = romFontsData.l[row];\r
+                       vga_state.vga_graphics_ram[drawaddr  ] = (fontbyte & m1) ? col : bgcol;\r
+                       vga_state.vga_graphics_ram[drawaddr+1] = (fontbyte & m2) ? col : bgcol;\r
+                       drawaddr += page->width >> 2;\r
                }\r
-               if(!q)\r
-               {\r
-                       for(k=0;k<9;k++)\r
-                       {\r
-                               printf("%c", romFontsData.z[k]);\r
-                       }\r
-                       printf("\n");\r
+\r
+               m1 >>= 1;\r
+               m2 >>= 1;\r
+               if ((++plane) == 4) {\r
+                       addr++;\r
+                       plane = 0;\r
                }\r
        }\r
-       romFontsData.chw += k;\r
 }\r
index 308944c34e9a02cb0780bc941c4d6218e380e04b..abf8f1f585099b23dc9ed699f21a47f84d642b49 100755 (executable)
@@ -36,6 +36,6 @@ void modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp); /*pbuf ver
 void modexDrawBmpPBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp);\r
 void modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp);\r
 void modexDrawSpritePBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp);\r
-void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q);\r
+void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, word addr);\r
 \r
 #endif\r
index 41634957455fae46f0847231cece1246f845cb44..e9a9fc1536f0476ae5ba04ea98fd78b47db60745 100755 (executable)
@@ -489,6 +489,8 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y)
                                //cannot print number value du to it being slow as bakapee
 #else
                                PBUFBFUN                (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));
+                               /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */
+                               //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
                                //modexDrawBmpRegion    (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));
 #endif
                        break;
@@ -597,9 +599,9 @@ void shinku(map_view_t *pip, global_game_variables_t *gv)
                word bgcol = 0;
                word type = 1;
                //t=(((*(gv->clock))-gv->clock_start) /18.2);
-               //sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv));
-               printf("%f fps", (double)gv->kurokku.tiku/ticktock(gv));
-               //modexprint(pip[1].page, 16, 16, 1, 15, 0, gv->pee, 1);
+               sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv));
+               printf("%s", gv->pee);
+               //modexprint(pip[1].page, 16, 16, 1, 15, 0, gv->pee);
                //(gv->clock_start)=*(gv->clock);
                gv->kurokku.tiku=0;
        }
@@ -613,7 +615,8 @@ void shinku(map_view_t *pip, global_game_variables_t *gv)
                break;
                case 1:
                        //turn this off if XT
-                       modexWaitBorder();
+                       //modexWaitBorder();
+                       vga_wait_for_vsync();
                        gv->kurokku.frames_per_second=60;
                break;
        }
@@ -662,6 +665,10 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll
        }
 
 #ifdef SPRITE
+// #define FRAME1 PBUFSFUN(pip[1].page, x, y, 48, dire, 24, 32,        PLAYERBMPDATA);
+// #define FRAME2 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32,        PLAYERBMPDATA);
+// #define FRAME3 PBUFSFUN(pip[1].page, x, y, 0, dire, 24, 32, PLAYERBMPDATA);
+// #define FRAME4 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32,        PLAYERBMPDATA);
 #define FRAME1 PBUFSFUN(pip[1].page, x, y, 48, dire, 24, 32,   PLAYERBMPDATA);
 #define FRAME2 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32,   PLAYERBMPDATA);
 #define FRAME3 PBUFSFUN(pip[1].page, x, y, 0, dire, 24, 32,    PLAYERBMPDATA);
index b39e95b049293c31504a818738e8d70c83406bde..77065af9f8ac4512bc2cd0f2f3ccb855611461c7 100755 (executable)
 #include "src/lib/16_timer.h"
 #include "src/lib/wcpu/wcpu.h"
 
+#include <hw/cpu/cpu.h>
+#include <hw/dos/dos.h>
+#include <hw/vga/vga.h>
+#include <hw/vga/vrl.h>
+#include <hw/vga/vgatty.h>
+
 //#define SPRITE
-#define TILERENDER
+//#define TILERENDER
 
 #define PBUFSFUN               modexDrawSpritePBufRegion
 #define PBUFBFUN               modexDrawBmpPBufRegion
index d07452b6dc8c7edab50b0de2cd743531e33b7960..5ce5c809c2c6bf7efca575f76156541eb979c651 100755 (executable)
@@ -45,7 +45,7 @@ main(int argc, char *argv[])
        modexLoadPalFile(bakapee, &pal);\r
        modexPalUpdate1(pal);\r
        modexFadeOn(1, pal);\r
-       pdump(&gvar.video.page[0]);\r
+       modexpdump(&gvar.video.page[0]);\r
        getch();\r
        VGAmodeX(0, 0, &gvar);\r
        modexPalUpdate1(pal);\r
index 06b1f29c8eb812887bf6bd089ff940d67f81d64c..d3ac3bef1a89547088d9eae05238bed35d8e9f1b 100755 (executable)
@@ -41,8 +41,6 @@ void main(int argc, char *argv[])
 {\r
 \r
        byte l[1024];\r
-       static byte e;\r
-       static word chx, chy, colpee;\r
        byte pee[2];\r
 \r
 //w=0;\r
@@ -124,25 +122,6 @@ getch();
                }\r
        }\r
 \r
-       chx=0;\r
-       chy=0;\r
-       colpee=32;\r
-       for(e=0x00; e<=0xFE; e++)\r
-       {\r
-               if(chx+8>(gvar.video.page[0].width/2))\r
-               {\r
-                       chx=0;\r
-                       chy+=8;\r
-                       sprintf(pee,"%u", colpee);\r
-                       modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 0);\r
-                       //getch();\r
-               }\r
-               modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 0);\r
-               chx+=9;\r
-               colpee++;\r
-               if(colpee>=32+24) colpee=32;\r
-       }\r
-\r
        fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n");\r
        fprintf(stderr,"version %s\n", VERSION);\r
        fprintf(stderr,"%d\n", sizeof(p.plane));\r
index 53b86d6bad212d70f3ad69e985b1b540571900ac..b1b9d5ae9875e0aaccf3893c59b583d4abaf9a01 100755 (executable)
@@ -34,7 +34,6 @@ static map_t map;
 player_t player[MaxPlayers];
 //page_t screen, gvar.video.page[1], gvar.video.page[2];
 map_view_t mv[3];
-map_view_t *bg, *spri, *mask;//, *tmp;
 bitmap_t p;
 word pn=0;
 static planar_buf_t huge *pp;
@@ -85,8 +84,6 @@ void main(int argc, char *argv[])
                return;
        }
 
-       testcontrolnoisy=0;
-
        player[0].persist_aniframe=0;
        player[0].speed=4;
        //player[0].data = &pp;
@@ -137,7 +134,7 @@ void main(int argc, char *argv[])
        modexFadeOff(4, dpal);
 #endif
 
-       textInit();
+       //textInit();
        VGAmodeX(bakapee, 1, &gvar);
 //     printf("%dx%d\n", gvar.video.page[0].sw, gvar.video.page[0].sh);
 #ifdef FADE
@@ -148,7 +145,7 @@ void main(int argc, char *argv[])
 //++++ player[0].data.offset=(paloffset/3);
 //++++ modexPalUpdate1(&player[0].data, &paloffset, 0, 0);
                //modexPalUpdate1(p.palette);
-               modexPalUpdate1(map.tiles->btdata->palette);
+//++++0000             modexPalUpdate1(map.tiles->btdata->palette);
        //printf("      %d\n", sizeof(ptmp->data));
        //printf("1:    %d\n", paloffset);
 //++++ map.tiles->data->offset=(paloffset/3);
@@ -168,7 +165,7 @@ void main(int argc, char *argv[])
        /* setup camera and screen~ */
        gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
        gvar.video.page[0].width += (TILEWH*2);
-       gvar.video.page[0].height += (TILEWH*2);//+QUADWH;
+       gvar.video.page[0].height += (TILEWH*2);
        mv[0].page = &gvar.video.page[0];
        gvar.video.page[1] = modexNextPage(mv[0].page);
        mv[1].page = &gvar.video.page[1];
@@ -178,51 +175,25 @@ void main(int argc, char *argv[])
        mv[2].page = &gvar.video.page[2];
 
        /* set up paging */
-       bg = &mv[0];
-       spri = &mv[1];
-       mask = &mv[2];
-//IN_Ack();
 //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen
-       mapGoTo(bg, 0, 0);
-       mapGoTo(spri, 0, 0);
+       mapGoTo(&mv[0], 0, 0);
+       mapGoTo(&mv[1], 0, 0);
        //mapGoTo(mask, 0, 0);
-//IN_Ack();
        //TODO: put player in starting position of spot
        //default player position on the viewable map
-       player[0].tx = bg->tx + bg->page->tilemidposscreenx;
-       player[0].ty = bg->ty + bg->page->tilemidposscreeny;
-       player[0].x = player[0].tx*TILEWH;
-       player[0].y = player[0].ty*TILEWH;
-       player[0].triggerx = player[0].tx;
-       player[0].triggery = player[0].ty+1;
-/*     player[0].info.x = player[0].tx;
-       player[0].info.xaxis = player[0].tx*TILEWH;
-       player[0].info.y = player[0].ty;
-       player[0].info.yaxis = player[0].ty*TILEWH;*/
-       player[0].q=1;
-       player[0].d=2;
-       player[0].hp=4;
-//     player[0].persist_aniframe=0;
-       //npc
-       /*npc0.tx = bg->tx + 1;
-       npc0.ty = bg->ty + 1;
-       npc0.x = npc0.tx*TILEWH;
-       npc0.y = npc0.ty*TILEWH;
-       npc0.triggerx = npc0.tx;
-       npc0.triggery = npc0.ty+1;
-       npc0.q=1;
-       npc0.d=0;
-       modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 64, 24, 32, &npctmp);*/
+       player[0].tx = mv[0].tx + mv[0].page->tilemidposscreenx;
+       player[0].ty = mv[0].ty + mv[0].page->tilemidposscreeny;
+       IN_initplayer(&player, 0);
 
        modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);
 #ifndef        SPRITE
        modexClearRegion(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 32, 15);
 #else
-       //PBUFSFUN(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32,       PLAYERBMPDATA);
-       PBUFSFUN(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &pp);
+       //PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32,       PLAYERBMPDATA);
+       PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &pp);
 #endif
 
-       modexShowPage(spri->page);
+       modexShowPage(mv[1].page);
        //modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 1);
 #ifdef MODEX
 #ifdef FADE
@@ -252,18 +223,18 @@ void main(int argc, char *argv[])
                                {
                                        case 0:
                                                //bg
-                                               bg->page->dx++;
-                                               modexShowPage(bg->page);
+                                               mv[0].page->dx++;
+                                               modexShowPage(mv[0].page);
                                        break;
                                        case 1:
                                                //spri
-                                               spri->page->dx++;
-                                               modexShowPage(spri->page);
+                                               mv[1].page->dx++;
+                                               modexShowPage(mv[1].page);
                                        break;
                                        case 2:
                                                //fg
-                                               mask->page->dx++;
-                                               modexShowPage(mask->page);
+                                               mv[2].page->dx++;
+                                               modexShowPage(mv[2].page);
                                        break;
                                }
                                panq++;
@@ -279,18 +250,18 @@ void main(int argc, char *argv[])
                                {
                                        case 0:
                                                //bg
-                                               bg->page->dx--;
-                                               modexShowPage(bg->page);
+                                               mv[0].page->dx--;
+                                               modexShowPage(mv[0].page);
                                        break;
                                        case 1:
                                                //spri
-                                               spri->page->dx--;
-                                               modexShowPage(spri->page);
+                                               mv[1].page->dx--;
+                                               modexShowPage(mv[1].page);
                                        break;
                                        case 2:
                                                //fg
-                                               mask->page->dx--;
-                                               modexShowPage(mask->page);
+                                               mv[2].page->dx--;
+                                               modexShowPage(mv[2].page);
                                        break;
                                }
                                panq++;
@@ -306,18 +277,18 @@ void main(int argc, char *argv[])
                                {
                                        case 0:
                                                //bg
-                                               bg->page->dy--;
-                                               modexShowPage(bg->page);
+                                               mv[0].page->dy--;
+                                               modexShowPage(mv[0].page);
                                        break;
                                        case 1:
                                                //spri
-                                               spri->page->dy--;
-                                               modexShowPage(spri->page);
+                                               mv[1].page->dy--;
+                                               modexShowPage(mv[1].page);
                                        break;
                                        case 2:
                                                //fg
-                                               mask->page->dy--;
-                                               modexShowPage(mask->page);
+                                               mv[2].page->dy--;
+                                               modexShowPage(mv[2].page);
                                        break;
                                }
                                panq++;
@@ -333,18 +304,18 @@ void main(int argc, char *argv[])
                                {
                                        case 0:
                                                //bg
-                                               bg->page->dy++;
-                                               modexShowPage(bg->page);
+                                               mv[0].page->dy++;
+                                               modexShowPage(mv[0].page);
                                        break;
                                        case 1:
                                                //spri
-                                               spri->page->dy++;
-                                               modexShowPage(spri->page);
+                                               mv[1].page->dy++;
+                                               modexShowPage(mv[1].page);
                                        break;
                                        case 2:
                                                //fg
-                                               mask->page->dy++;
-                                               modexShowPage(mask->page);
+                                               mv[2].page->dy++;
+                                               modexShowPage(mv[2].page);
                                        break;
                                }
                                panq++;
@@ -356,7 +327,7 @@ void main(int argc, char *argv[])
        //the scripting stuf....
 
        //if(((player[0].triggerx == TRIGGX && player[0].triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5))
-       if(((bg->map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5))
+       if(((mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5))
        {
                short i;
                for(i=800; i>=400; i--)
@@ -368,19 +339,19 @@ void main(int argc, char *argv[])
        if(player[0].q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].hp--; }
        //debugging binds!
        //if(IN_KeyDown(0x0E)) while(1){ if(xmsmalloc(24)) break; }
-       if(IN_KeyDown(2)){ modexShowPage(bg->page); panpagenum=0; }
-       if(IN_KeyDown(3)){ modexShowPage(spri->page); panpagenum=1; }
-       if(IN_KeyDown(4)){ modexShowPage(mask->page); panpagenum=2; }
-       if(IN_KeyDown(25)){ pdump(bg->page); pdump(spri->page); }       //p
+       if(IN_KeyDown(2)){ modexShowPage(mv[0].page); panpagenum=0; }
+       if(IN_KeyDown(3)){ modexShowPage(mv[1].page); panpagenum=1; }
+       if(IN_KeyDown(4)){ modexShowPage(mv[2].page); panpagenum=2; }
+       if(IN_KeyDown(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page); }   //p
 #ifdef MODEX
 #ifdef FADE
-       if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; pdump(bg->page); pdump(spri->page); }
+       if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); }
        if(IN_KeyDown(22)){
        paloffset=0; modexPalBlack(); modexPalUpdate(&player[0].data, &paloffset, 0, 0);
        printf("1paloffset      =       %d\n", paloffset/3);
         modexPalUpdate(map.tiles->data, &paloffset, 0, 0);
        printf("2paloffset      =       %d\n", paloffset/3);
-        pdump(bg->page); pdump(spri->page); }
+        modexpdump(mv[0].page); modexpdump(mv[1].page); }
 #endif
 #endif
        //pan switch
@@ -436,8 +407,8 @@ void main(int argc, char *argv[])
        IN_Shutdown();
        printf("Project 16 scroll.exe. This is just a test file!\n");
        printf("version %s\n", VERSION);
-       printf("tx: %d\n", bg->tx);
-       printf("ty: %d\n", bg->ty);
+       printf("tx: %d\n", mv[0].tx);
+       printf("ty: %d\n", mv[0].ty);
        printf("player[0].x: %d", player[0].x); printf("                player[0].y: %d\n", player[0].y);
        //if(player[0].hp==0) printf("%d wwww\n", player[0].y+8);
        //else printf("\nplayer[0].y: %d\n", player[0].y);
@@ -445,7 +416,7 @@ void main(int argc, char *argv[])
        printf("player[0].triggx: %d", player[0].triggerx); printf("    player[0].triggy: %d\n", player[0].triggery);
        printf("player[0].hp: %d", (player[0].hp));     printf("        player[0].q: %d", player[0].q); printf("        player[0].info.dir: %d", player[0].info.dir);   printf("        player[0].d: %d\n", player[0].d);
                printf("pdir=%d\n", player[0].pdir);
-       printf("tile data value at player trigger position: %d\n", bg->map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]);
+       printf("tile data value at player trigger position: %d\n", mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]);
 //     printf("palette offset: %d\n", paloffset/3);
 //++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize());
 //++++ printf("Total free: %zu\n", GetFreeSize());
@@ -460,7 +431,7 @@ void main(int argc, char *argv[])
 //     printf("\n");
 //     printf("player[0].info.x: %d", player[0].info.xaxis); printf("          player[0].info.y: %d\n", player[0].info.yaxis);
 //     printf("player[0].info.tx: %d", player[0].info.x); printf("             player[0].info.ty: %d\n", player[0].info.y);
-       //printf("map.width=%d  map.height=%d   map.data[0]=%d\n", bg->map->width, bg->map->height, bg->map->data[0]);
+       //printf("map.width=%d  map.height=%d   map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]);
 
        switch(detectcpu())
        {
diff --git a/vrl2vrs b/vrl2vrs
index b67956b7baa37941b88ad79da1a2ff49c0c435a0..cee2d1d5ec2093825ded51e0e6c9b8b836e38ee9 100755 (executable)
Binary files a/vrl2vrs and b/vrl2vrs differ
diff --git a/vrsdump b/vrsdump
index dbaba30e42b8639969d3bdd4433243eb338adcbe..a75a903a84ae3d98973e3aecab4a6c08fce8a764 100755 (executable)
Binary files a/vrsdump and b/vrsdump differ