From 9603f9511aceaee61cf873f6ac2b9876a6892fc1 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Sun, 21 Aug 2016 16:38:38 -0500 Subject: [PATCH] branch is in the master swap branch code added to swap the files out ^^ --- makefile | 10 +++- src/vrstest.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 2 deletions(-) create mode 100755 src/vrstest.c diff --git a/makefile b/makefile index 45b51334..520042e1 100755 --- a/makefile +++ b/makefile @@ -91,7 +91,7 @@ FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS) # VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ) DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) -16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ) +16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ) GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) $(DOSLIBLIBS) 16_vrs.$(OBJ) 16_sprite.$(OBJ) #planar.$(OBJ) 16planar.$(OBJ) 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 @@ -102,7 +102,7 @@ DOSLIBOBJ += 8250.$(OBJ) DOSLIBLIBS += $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)8250$(DIRSEP)dos86h$(DIRSEP)8250.lib !endif -TESTEXEC = test.exe test0.exe pcxtest.exe pcxtest2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe exmmtest.exe +TESTEXEC = test.exe test0.exe pcxtest.exe pcxtest2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe exmmtest.exe vrstest.exe #planrpcx.exe test2.exe EXEC = 16.exe bakapi.exe tesuto.exe 0.exe $(TESTEXEC) @@ -184,6 +184,9 @@ inputest.exe: inputest.$(OBJ) $(16LIB) pcxtest.exe: pcxtest.$(OBJ) gfx.lib wcl $(FLAGS) pcxtest.$(OBJ) gfx.lib -fm=pcxtest.mah +vrstest.exe: vrstest.$(OBJ) gfx.lib + wcl $(FLAGS) vrstest.$(OBJ) gfx.lib -fm=vrstest.mah + palettec.exe: palettec.$(OBJ) gfx.lib #$(16LIB) wcl $(FLAGS) palettec.$(OBJ) gfx.lib -fm=palettec.mah #$(16LIB) @@ -232,6 +235,9 @@ test0.$(OBJ): $(SRC)test0.c pcxtest.$(OBJ): $(SRC)pcxtest.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)pcxtest.c +vrstest.$(OBJ): $(SRC)vrstest.c $(SRCLIB)modex16.h + wcl $(FLAGS) -c $(SRC)vrstest.c + ##planrpcx.$(OBJ): $(SRC)planrpcx.c $(SRCLIB)modex16.h ## wcl $(FLAGS) -c $(SRC)planrpcx.c diff --git a/src/vrstest.c b/src/vrstest.c new file mode 100755 index 00000000..d27889d9 --- /dev/null +++ b/src/vrstest.c @@ -0,0 +1,129 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include +#include "src/lib/modex16.h" +#include "src/lib/16_sprite.h" +#include "src/lib/16_ca.h" +#include "src/lib/16_mm.h" + + +global_game_variables_t gvar; + +void main() { + int i; + word start; + int plane; + float t1, t2; + + // 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; + } + + //bmp = bitmapLoadPcx("data/chikyuu.pcx"); + + VGAmodeX(1, 1, &gvar); + gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); + + /* fix up the palette and everything */ + //modexPalUpdate1(bmp.palette); + + /* clear and draw one sprite and one bitmap */ + modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1); + + /* non sprite comparison */ + start = *clockw; + //for(i=0; i<100 ;i++) { + // oldDrawBmp(VGA, 20, 20, &bmp, 0); + //} + + start = *clockw; + //for(i=0; i<100 ;i++) { +//0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp); + // modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp); + //} + t1 = (*clockw-start) /18.2; + + start = *clockw; + //for(i=0; i<100; i++) { +//0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64); + modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240); + //} + t2 = (*clockw-start)/18.2; + + + start = *clockw; + //for(i=0; i<100 ;i++) { + // oldDrawBmp(VGA, 20, 20, &bmp, 1); + //} + + + start = *clockw; + //for(i=0; i<100 ;i++) { +//0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp); + // modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp); + //} + //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2)); + //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp); + while(!kbhit()) + { + //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0); + } + VGAmodeX(0, 1, &gvar); + /*printf("\nmain=%Fp\n\n", &i); + printf("bmp.data=%Fp\n", bmp.data); + printf("*bmp.data=%Fp\n", *(bmp.data)); + printf("&bmp.data=%Fp\n", &(bmp.data)); + + printf("\n%d\n", sizeof(p->plane)); + printf("%d\n", sizeof(bmp));*/ + + /*for(i=0; i<(320*240); i++) + { + fprintf(stdout, "%d", bmp.data[i]); + if(i%bmp.width==0) fprintf(stdout, "\n"); + }*/ + printf("CPU to VGA: %f\n", t1); + printf("VGA to VGA: %f\n", t2); + printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width); + printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height); + return; +} -- 2.39.2