#
# Possible optimizations for 8088 class processors
#
-# -oa Relax alias checking
-# -ob Try to generate straight line code
+# -oaRelax alias checking
+# -obTry to generate straight line code
# -oe - expand user functions inline (-oe=20 is default, adds lots of code)
-# -oh Enable repeated optimizations
-# -oi generate certain lib funcs inline
-# -oi+ Set max inline depth (C++ only, use -oi for C)
-# -ok Flowing of register save into function flow graph
-# -ol loop optimizations
-# -ol+ loop optimizations plus unrolling
-# -or Reorder for pipelined (486+ procs); not sure if good to use
-# -os Favor space over time
-# -ot Favor time over space
-# -ei Allocate an "int" for all enum types
-# -zp2 Allow compiler to add padding to structs
-# -zpw Use with above; make sure you are warning free!
-# -0 8088/8086 class code generation
-# -s disable stack overflow checking
+# -ohEnable repeated optimizations
+# -oigenerate certain lib funcs inline
+# -oi+Set max inline depth (C++ only, use -oi for C)
+# -okFlowing of register save into function flow graph
+# -olloop optimizations
+# -ol+loop optimizations plus unrolling
+# -orReorder for pipelined (486+ procs); not sure if good to use
+# -osFavor space over time
+# -otFavor time over space
+# -eiAllocate an "int" for all enum types
+# -zp2Allow compiler to add padding to structs
+# -zpwUse with above; make sure you are warning free!
+# -0 8088/8086 class code generation
+# -s disable stack overflow checking
# -zk0u translate kanji to unicode... wwww
# -zk0 kanji support~
#
VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
GFXLIBOBJS = 16_vl.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16_vrs.$(OBJ) 16_sprit.$(OBJ)
-OLDGFXLIBOBJS=bitmap.$(OBJ)
+OLDLIBOBJS=bitmap.$(OBJ) mapread.$(OBJ)
16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) wcpu.$(OBJ) 16_timer.$(OBJ) 16_map.$(OBJ) jsmn.$(OBJ)
#16planar.$(OBJ) planar.$(OBJ)
DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
# List of executables to build
#
TESTEXEC = &
- tesuto.exe &
- 0.exe &
- scroll.exe &
- zcroll.exe &
- exmmtest.exe &
- vrstest.exe
+ tesuto.exe &
+ 0.exe &
+ zcroll.exe &
+ exmmtest.exe &
+ vrstest.exe
TESTEXEC2 = &
- vgmtest.exe &
- inputest.exe &
- maptest.exe &
- fmemtest.exe &
- fonttest.exe &
- fontgfx.exe &
- test.exe &
- test0.exe &
- pcxtest.exe &
- pcxtest2.exe
+ scroll.exe &
+ vgmtest.exe &
+ inputest.exe &
+ maptest.exe &
+ fmemtest.exe &
+ fonttest.exe &
+ fontgfx.exe &
+ test.exe &
+ test0.exe &
+ pcxtest.exe &
+ pcxtest2.exe
UTILEXEC = &
- palettel.exe &
- palettec.exe
+ palettel.exe &
+ palettec.exe
EXEC = &
- 16.exe &
- bakapi.exe &
- $(UTILEXEC) &
- $(TESTEXEC)
+ 16.exe &
+ bakapi.exe &
+ $(UTILEXEC) &
+ $(TESTEXEC)
all: $(EXEC) joytest.exe
testexec: $(EXEC) joytest.exe $(TESTEXEC2)
#
# game and bakapi executables
#
-16.exe: 16.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
-bakapi.exe: bakapi.$(OBJ) gfx.lib $(DOSLIBLIBS)
+16.exe: 16.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
+bakapi.exe: bakapi.$(OBJ) gfx.lib $(DOSLIBLIBS)
#
# Test Executables!
#
-scroll.exe: scroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS) $(OLDGFXLIBOBJS)
-scroll.$(OBJ): $(SRC)/scroll.c
-zcroll.exe: zcroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
-zcroll.$(OBJ): $(SRC)/zcroll.c
-tesuto.exe: tesuto.$(OBJ) 16_head.$(OBJ) gfx.lib $(DOSLIBLIBS)
-tesuto.$(OBJ): $(SRC)/tesuto.c
-0.exe: 0.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
-0.$(OBJ): $(SRC)/0.c
-test.exe: test.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
-#test2.exe: test2.$(OBJ) gfx.lib $(DOSLIBLIBS)
-test0.exe: test0.$(OBJ)
-fonttest.exe: fonttest.$(OBJ) gfx.lib
-#fonttes0.exe: fonttes0.$(OBJ) $(16LIB)
-fontgfx.exe: fontgfx.$(OBJ) gfx.lib $(DOSLIBLIBS)
-inputest.exe: inputest.$(OBJ) $(16LIB) $(DOSLIBLIBS)
-#sountest.exe: sountest.$(OBJ) $(16LIB)
-pcxtest.exe: pcxtest.$(OBJ) gfx.lib $(DOSLIBLIBS) $(OLDGFXLIBOBJS)
-vrstest.exe: vrstest.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
-#vgacamm.exe: vgacamm.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
-palettec.exe: palettec.$(OBJ) gfx.lib $(DOSLIBLIBS)
-palettel.exe: palettel.$(OBJ) gfx.lib $(DOSLIBLIBS)
-pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib $(DOSLIBLIBS) $(OLDGFXLIBOBJS)
-#planrpcx.exe: planrpcx.$(OBJ) gfx.lib
-maptest.exe: maptest.$(OBJ) 16_map.$(OBJ) 16_head.$(OBJ) gfx.lib $(DOSLIBLIBS)
-fmemtest.exe: fmemtest.$(OBJ)
-exmmtest.exe: exmmtest.$(OBJ) $(16LIB) $(DOSLIBLIBS)
-vgmtest.exe: vgmtest.$(OBJ) vgmsnd.lib $(16LIB) $(DOSLIBLIBS)
+scroll.exe: scroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS) $(OLDLIBOBJS)
+scroll.$(OBJ): $(SRC)/scroll.c
+zcroll.exe: zcroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
+zcroll.$(OBJ): $(SRC)/zcroll.c
+tesuto.exe: tesuto.$(OBJ) 16_head.$(OBJ) gfx.lib $(DOSLIBLIBS)
+tesuto.$(OBJ): $(SRC)/tesuto.c
+0.exe: 0.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
+0.$(OBJ): $(SRC)/0.c
+test.exe: test.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
+#test2.exe: test2.$(OBJ) gfx.lib $(DOSLIBLIBS)
+test0.exe: test0.$(OBJ)
+fonttest.exe: fonttest.$(OBJ) gfx.lib
+#fonttes0.exe: fonttes0.$(OBJ) $(16LIB)
+fontgfx.exe: fontgfx.$(OBJ) gfx.lib $(DOSLIBLIBS)
+inputest.exe: inputest.$(OBJ) $(16LIB) $(DOSLIBLIBS)
+#sountest.exe: sountest.$(OBJ) $(16LIB)
+pcxtest.exe: pcxtest.$(OBJ) gfx.lib $(DOSLIBLIBS) $(OLDLIBOBJS)
+vrstest.exe: vrstest.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
+#vgacamm.exe: vgacamm.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
+palettec.exe: palettec.$(OBJ) gfx.lib $(DOSLIBLIBS)
+palettel.exe: palettel.$(OBJ) gfx.lib $(DOSLIBLIBS)
+pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib $(DOSLIBLIBS) $(OLDLIBOBJS)
+#planrpcx.exe: planrpcx.$(OBJ) gfx.lib
+maptest.exe: maptest.$(OBJ) 16_map.$(OBJ) 16_head.$(OBJ) gfx.lib $(DOSLIBLIBS)
+fmemtest.exe: fmemtest.$(OBJ)
+exmmtest.exe: exmmtest.$(OBJ) $(16LIB) $(DOSLIBLIBS)
+vgmtest.exe: vgmtest.$(OBJ) vgmsnd.lib $(16LIB) $(DOSLIBLIBS)
#
# executable's objects
#
-16.$(OBJ): $(SRC)/16.c $(SRC)/16.h
-bakapi.$(OBJ): $(SRC)/bakapi.c $(SRC)/bakapi.h
-test.$(OBJ): $(SRC)/test.c $(SRCLIB)/16_vl.h
-#test2.$(OBJ): $(SRC)/test2.c $(SRCLIB)/16_vl.h
-test0.$(OBJ): $(SRC)/test0.c
-pcxtest.$(OBJ): $(SRC)/pcxtest.c $(SRCLIB)/16_vl.h
-vrstest.$(OBJ): $(SRC)/vrstest.c $(SRCLIB)/16_vl.h
-#vgacamm.$(OBJ): $(SRC)/vgacamm.c $(SRCLIB)/16_vl.h
+16.$(OBJ): $(SRC)/16.c $(SRC)/16.h
+bakapi.$(OBJ): $(SRC)/bakapi.c $(SRC)/bakapi.h
+test.$(OBJ): $(SRC)/test.c $(SRCLIB)/16_vl.h
+#test2.$(OBJ): $(SRC)/test2.c $(SRCLIB)/16_vl.h
+test0.$(OBJ): $(SRC)/test0.c
+pcxtest.$(OBJ):$(SRC)/pcxtest.c $(SRCLIB)/16_vl.h
+vrstest.$(OBJ):$(SRC)/vrstest.c $(SRCLIB)/16_vl.h
+#vgacamm.$(OBJ):$(SRC)/vgacamm.c $(SRCLIB)/16_vl.h
#planrpcx.$(OBJ): $(SRC)/planrpcx.c $(SRCLIB)/16_vl.h
-pcxtest2.$(OBJ): $(SRC)/pcxtest2.c $(SRCLIB)/16_vl.h
-palettec.$(OBJ): $(SRC)/palettec.c
-palettel.$(OBJ): $(SRC)/palettel.c
-maptest.$(OBJ): $(SRC)/maptest.c $(SRCLIB)/16_vl.h
-#emmtest.$(OBJ): $(SRC)/emmtest.c
-#emsdump.$(OBJ): $(SRC)/emsdump.c
-fmemtest.$(OBJ): $(SRC)/fmemtest.c
-fonttest.$(OBJ): $(SRC)/fonttest.c
+pcxtest2.$(OBJ):$(SRC)/pcxtest2.c $(SRCLIB)/16_vl.h
+palettec.$(OBJ):$(SRC)/palettec.c
+palettel.$(OBJ):$(SRC)/palettel.c
+maptest.$(OBJ):$(SRC)/maptest.c $(SRCLIB)/16_vl.h
+#emmtest.$(OBJ):$(SRC)/emmtest.c
+#emsdump.$(OBJ):$(SRC)/emsdump.c
+fmemtest.$(OBJ):$(SRC)/fmemtest.c
+fonttest.$(OBJ):$(SRC)/fonttest.c
#fonttes0.$(OBJ): $(SRC)/fonttes0.c
-fontgfx.$(OBJ): $(SRC)/fontgfx.c
-inputest.$(OBJ): $(SRC)/inputest.c
+fontgfx.$(OBJ):$(SRC)/fontgfx.c
+inputest.$(OBJ):$(SRC)/inputest.c
#sountest.$(OBJ): $(SRC)/sountest.c
#miditest.$(OBJ): $(SRC)/miditest.c
-#testemm.$(OBJ): $(SRC)/testemm.c
+#testemm.$(OBJ):$(SRC)/testemm.c
#testemm0.$(OBJ): $(SRC)/testemm0.c
#tsthimem.$(OBJ): $(SRC)/tsthimem.c
-exmmtest.$(OBJ): $(SRC)/exmmtest.c
-vgmtest.$(OBJ): $(SRC)/vgmtest.c
+exmmtest.$(OBJ):$(SRC)/exmmtest.c
+vgmtest.$(OBJ):$(SRC)/vgmtest.c
#
# non executable objects libraries
cd $(DOSLIB_JOYSTICK:$(to_os_path)) && $(DOSLIBMAKE) && cd $(BUILD_ROOT)
$(COPYCOMMAND) $(DOSLIB_JOYSTICK:$(to_os_path))$(DIRSEP)dos86h$(DIRSEP)test.exe joytest.exe
-16_vl.$(OBJ): $(SRCLIB)/16_vl.c $(SRCLIB)/16_vl.h
-bakapee.$(OBJ): $(SRCLIB)/bakapee.c $(SRCLIB)/bakapee.h
-16render.$(OBJ): $(SRCLIB)/16render.c $(SRCLIB)/16render.h
-16planar.$(OBJ): $(MODEXLIB16)/16planar.c $(MODEXLIB16)/16planar.h
-16_vrs.$(OBJ): $(SRCLIB)/16_vrs.c $(SRCLIB)/16_vrs.h $(DOSLIBLIBS)
-16_sprit.$(OBJ): $(SRCLIB)/16_sprit.c $(SRCLIB)/16_sprit.h
-bitmap.$(OBJ): $(SRCLIB)/bitmap.c $(SRCLIB)/bitmap.h
-planar.$(OBJ): $(SRCLIB)/planar.c $(SRCLIB)/planar.h
-scroll16.$(OBJ): $(SRCLIB)/scroll16.c $(SRCLIB)/scroll16.h
-16text.$(OBJ): $(SRCLIB)/16text.c
-mapread.$(OBJ): $(SRCLIB)/mapread.c $(SRCLIB)/mapread.h
-16_map.$(OBJ): $(SRCLIB)/16_map.c $(SRCLIB)/16_map.h
-16_timer.$(OBJ): $(SRCLIB)/16_timer.c $(SRCLIB)/16_timer.h
-16_in.$(OBJ): $(SRCLIB)/16_in.c $(SRCLIB)/16_in.h
-16_mm.$(OBJ): $(SRCLIB)/16_mm.c $(SRCLIB)/16_mm.h
-16_pm.$(OBJ): $(SRCLIB)/16_pm.c $(SRCLIB)/16_pm.h
-16_ca.$(OBJ): $(SRCLIB)/16_ca.c $(SRCLIB)/16_ca.h
-16_dbg.$(OBJ): $(SRCLIB)/16_dbg.c $(SRCLIB)/16_dbg.h
-midi.$(OBJ): $(SRCLIB)/midi.c $(SRCLIB)/midi.h
-16_head.$(OBJ): $(SRCLIB)/16_head.c $(SRCLIB)/16_head.h
-16_tail.$(OBJ): $(SRCLIB)/16_tail.c $(SRCLIB)/16_tail.h
-16_hc.$(OBJ): $(SRCLIB)/16_hc.c $(SRCLIB)/16_hc.h
-16_snd.$(OBJ): $(SRCLIB)/16_snd.c $(SRCLIB)/16_snd.h
-jsmn.$(OBJ): $(JSMNLIB)/jsmn.c $(JSMNLIB)/jsmn.h
-kitten.$(OBJ): $(NYANLIB)/kitten.c $(NYANLIB)/kitten.h
-vgmSnd.$(OBJ): $(VGMSNDLIB)/vgmSnd.c $(VGMSNDLIB)/vgmSnd.h
-wcpu.$(OBJ): $(WCPULIB)/wcpu.c $(WCPULIB)/wcpu.h
-#memory.$(OBJ): $(EXMMLIB)/memory.c $(EXMMLIB)/memory.h
-c_utils.$(OBJ): $(MODEXLIB)/c_utils.asm
-modex.$(OBJ): $(MODEXLIB)/modex.asm
+16_vl.$(OBJ):$(SRCLIB)/16_vl.c $(SRCLIB)/16_vl.h
+bakapee.$(OBJ):$(SRCLIB)/bakapee.c $(SRCLIB)/bakapee.h
+16render.$(OBJ):$(SRCLIB)/16render.c $(SRCLIB)/16render.h
+16planar.$(OBJ):$(MODEXLIB16)/16planar.c $(MODEXLIB16)/16planar.h
+16_vrs.$(OBJ): $(SRCLIB)/16_vrs.c $(SRCLIB)/16_vrs.h $(DOSLIBLIBS)
+16_sprit.$(OBJ):$(SRCLIB)/16_sprit.c $(SRCLIB)/16_sprit.h
+bitmap.$(OBJ): $(SRCLIB)/bitmap.c $(SRCLIB)/bitmap.h
+planar.$(OBJ): $(SRCLIB)/planar.c $(SRCLIB)/planar.h
+scroll16.$(OBJ):$(SRCLIB)/scroll16.c $(SRCLIB)/scroll16.h
+16text.$(OBJ): $(SRCLIB)/16text.c
+mapread.$(OBJ):$(SRCLIB)/mapread.c $(SRCLIB)/mapread.h
+16_map.$(OBJ):$(SRCLIB)/16_map.c $(SRCLIB)/16_map.h
+16_timer.$(OBJ):$(SRCLIB)/16_timer.c $(SRCLIB)/16_timer.h
+16_in.$(OBJ): $(SRCLIB)/16_in.c $(SRCLIB)/16_in.h
+16_mm.$(OBJ): $(SRCLIB)/16_mm.c $(SRCLIB)/16_mm.h
+16_pm.$(OBJ): $(SRCLIB)/16_pm.c $(SRCLIB)/16_pm.h
+16_ca.$(OBJ): $(SRCLIB)/16_ca.c $(SRCLIB)/16_ca.h
+16_dbg.$(OBJ): $(SRCLIB)/16_dbg.c $(SRCLIB)/16_dbg.h
+midi.$(OBJ): $(SRCLIB)/midi.c $(SRCLIB)/midi.h
+16_head.$(OBJ):$(SRCLIB)/16_head.c $(SRCLIB)/16_head.h
+16_tail.$(OBJ):$(SRCLIB)/16_tail.c $(SRCLIB)/16_tail.h
+16_hc.$(OBJ): $(SRCLIB)/16_hc.c $(SRCLIB)/16_hc.h
+16_snd.$(OBJ): $(SRCLIB)/16_snd.c $(SRCLIB)/16_snd.h
+jsmn.$(OBJ): $(JSMNLIB)/jsmn.c $(JSMNLIB)/jsmn.h
+kitten.$(OBJ): $(NYANLIB)/kitten.c $(NYANLIB)/kitten.h
+vgmSnd.$(OBJ): $(VGMSNDLIB)/vgmSnd.c $(VGMSNDLIB)/vgmSnd.h
+wcpu.$(OBJ): $(WCPULIB)/wcpu.c $(WCPULIB)/wcpu.h
+#memory.$(OBJ):$(EXMMLIB)/memory.c $(EXMMLIB)/memory.h
+c_utils.$(OBJ):$(MODEXLIB)/c_utils.asm
+modex.$(OBJ): $(MODEXLIB)/modex.asm
#
#other~
*x4get.bat $(EXEC)
vomitchan: .symbolic
- @$(DUMP) *.err
+ @if exist *.err $(DUMP) *.err
##
## External library management~ ^^
byte/*FIXME: why long? "long" is 32-bit datatype, VGA modes are 8-bit numbers. */\r
vgaGetMode()\r
{\r
- return int10_getmode();\r
+ return int10_getmode();\r
}\r
\r
/* -========================= Entry Points ==========================- */\r
{\r
word i;\r
struct vga_mode_params cm;\r
- int CRTParmCount;\r
+ //int CRTParmCount;\r
\r
vgaSetMode(VGA_256_COLOR_MODE);\r
vga_enable_256color_modex();\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
+ 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 *///skewing ^^;\r
cm.horizontal_start_retrace=0x54;/* CRTC[4] */\r
{\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
+ 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
page_t\r
modexDefaultPage(page_t *p)\r
{\r
- page_t page;\r
+ page_t page;\r
\r
- /* default page values */\r
+ /* default page values */\r
//page.data = VGA;\r
//page.data = (byte far *)(vga_state.vga_graphics_ram);\r
page.data = (vga_state.vga_graphics_ram);\r
- page.dx = 0;\r
- page.dy = 0;\r
+ page.dx = 0;\r
+ page.dy = 0;\r
page.sw = p->sw;\r
page.sh = p->sh;\r
page.width = p->sw+TILEWHD;\r
page.pi=page.width*4;\r
page.id = 0;\r
\r
- return page;\r
+ return page;\r
}\r
\r
/* returns the next page in contiguous memory\r
*/\r
page_t\r
modexNextPage(page_t *p) {\r
- page_t result;\r
+ page_t result;\r
\r
- result.data = p->data + (p->pagesize);\r
- result.dx = 0;\r
- result.dy = 0;\r
+ result.data = p->data + (p->pagesize);\r
+ result.dx = 0;\r
+ result.dy = 0;\r
result.sw = p->sw;\r
result.sh = p->sh;\r
- result.width = p->width;\r
- result.height = p->height;\r
+ result.width = p->width;\r
+ result.height = p->height;\r
result.tw = p->tw;\r
result.th = p->th;\r
result.tilesw = p->tilesw;\r
\r
void\r
modexShowPage(page_t *page) {\r
- word high_address;\r
- word low_address;\r
- word offset;\r
- byte crtcOffset;\r
-\r
- /* calculate offset */\r
- offset = (word) page->data;\r
- offset += page->dy * (page->width >> 2 );\r
- offset += page->dx >> 2;\r
-\r
- /* calculate crtcOffset according to virtual width */\r
- crtcOffset = page->width >> 3;\r
-\r
- high_address = HIGH_ADDRESS | (offset & 0xff00);\r
- low_address = LOW_ADDRESS | (offset << 8);\r
-\r
- /* wait for appropriate timing and then program CRTC */\r
- //while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE));\r
- outpw(CRTC_INDEX, high_address);\r
- outpw(CRTC_INDEX, low_address);\r
- outp(CRTC_INDEX, 0x13);\r
- outp(CRTC_DATA, crtcOffset);\r
-\r
- /* wait for one retrace */\r
- //while (!(inp(INPUT_STATUS_1) & VRETRACE));\r
-\r
- /* do PEL panning here */\r
- outp(AC_INDEX, 0x33);\r
- outp(AC_INDEX, (page->dx & 0x03) << 1);\r
+ word high_address;\r
+ word low_address;\r
+ word offset;\r
+ byte crtcOffset;\r
+\r
+ /* calculate offset */\r
+ offset = (word) page->data;\r
+ offset += page->dy * (page->width >> 2 );\r
+ offset += page->dx >> 2;\r
+\r
+ /* calculate crtcOffset according to virtual width */\r
+ crtcOffset = page->width >> 3;\r
+\r
+ high_address = HIGH_ADDRESS | (offset & 0xff00);\r
+ low_address = LOW_ADDRESS | (offset << 8);\r
+\r
+ /* wait for appropriate timing and then program CRTC */\r
+ //while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE));\r
+ outpw(CRTC_INDEX, high_address);\r
+ outpw(CRTC_INDEX, low_address);\r
+ outp(CRTC_INDEX, 0x13);\r
+ outp(CRTC_DATA, crtcOffset);\r
+\r
+ /* wait for one retrace */\r
+ //while (!(inp(INPUT_STATUS_1) & VRETRACE));\r
+\r
+ /* do PEL panning here */\r
+ outp(AC_INDEX, 0x33);\r
+ outp(AC_INDEX, (page->dx & 0x03) << 1);\r
}\r
\r
void\r
modexPanPage(page_t *page, int dx, int dy) {\r
- page->dx = dx;\r
- page->dy = dy;\r
+ page->dx = dx;\r
+ page->dy = dy;\r
}\r
\r
void\r
modexSelectPlane(byte plane) {\r
- outp(SC_INDEX, MAP_MASK); /* select plane */\r
- outp(SC_DATA, plane);\r
+ outp(SC_INDEX, MAP_MASK); /* select plane */\r
+ outp(SC_DATA, plane);\r
}\r
\r
void\r
modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) {\r
- word pageOff = (word) page->data;\r
- word xoff=x/4; /* xoffset that begins each row */\r
- word scanCount=w/4; /* number of iterations per row (excluding right clip)*/\r
- word poffset = pageOff + y*(page->stridew) + xoff; /* starting offset */\r
- word nextRow = page->stridew-scanCount-1; /* loc of next row */\r
- byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */\r
- byte rclip[] = {0x00, 0x01, 0x03, 0x07};\r
- byte left = lclip[x&0x03];\r
- byte right = rclip[(x+w)&0x03];\r
-\r
- /* handle the case which requires an extra group */\r
- if((x & 0x03) && !((x+w) & 0x03)) {\r
- right=0x0f;\r
- }\r
+ word pageOff = (word) page->data;\r
+ word xoff=x/4; /* xoffset that begins each row */\r
+ word scanCount=w/4; /* number of iterations per row (excluding right clip)*/\r
+ word poffset = pageOff + y*(page->stridew) + xoff; /* starting offset */\r
+ word nextRow = page->stridew-scanCount-1; /* loc of next row */\r
+ byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */\r
+ byte rclip[] = {0x00, 0x01, 0x03, 0x07};\r
+ byte left = lclip[x&0x03];\r
+ byte right = rclip[(x+w)&0x03];\r
+\r
+ /* handle the case which requires an extra group */\r
+ if((x & 0x03) && !((x+w) & 0x03)) {\r
+ right=0x0f;\r
+ }\r
\r
//printf("modexClearRegion(x=%u, y=%u, w=%u, h=%u, left=%u, right=%u)\n", x, y, w, h, left, right);\r
\r
- __asm {\r
- PUSHF\r
- PUSH ES\r
- PUSH AX\r
- PUSH BX\r
- PUSH CX\r
- PUSH DX\r
- PUSH SI\r
- PUSH DI\r
- MOV AX, SCREEN_SEG ; go to the VGA memory\r
+ __asm {\r
+ PUSHF\r
+ PUSH ES\r
+ PUSH AX\r
+ PUSH BX\r
+ PUSH CX\r
+ PUSH DX\r
+ PUSH SI\r
+ PUSH DI\r
+ MOV AX, SCREEN_SEG ; go to the VGA memory\r
MOV ES, AX\r
MOV DI, poffset ; go to the first pixel\r
MOV DX, SC_INDEX ; point to the map mask\r
INC DX\r
MOV AL, color ; get ready to write colors\r
SCAN_START:\r
- MOV CX, scanCount ; count the line\r
- MOV BL, AL ; remember color\r
- MOV AL, left ; do the left clip\r
- OUT DX, AL ; set the left clip\r
- MOV AL, BL ; restore color\r
+ MOV CX, scanCount ; count the line\r
+ MOV BL, AL ; remember color\r
+ MOV AL, left ; do the left clip\r
+ OUT DX, AL ; set the left clip\r
+ MOV AL, BL ; restore color\r
STOSB ; write the color\r
DEC CX\r
- JZ SCAN_DONE ; handle 1 group stuff\r
+ JZ SCAN_DONE ; handle 1 group stuff\r
\r
;-- write the main body of the scanline\r
- MOV BL, AL ; remember color\r
- MOV AL, 0x0f ; write to all pixels\r
+ MOV BL, AL ; remember color\r
+ MOV AL, 0x0f ; write to all pixels\r
OUT DX, AL\r
- MOV AL, BL ; restore color\r
- REP STOSB ; write the color\r
+ MOV AL, BL ; restore color\r
+ REP STOSB ; write the color\r
SCAN_DONE:\r
- MOV BL, AL ; remeber color\r
+ MOV BL, AL ; remeber color\r
MOV AL, right\r
- OUT DX, AL ; do the right clip\r
- MOV AL, BL ; restore color\r
+ OUT DX, AL ; do the right clip\r
+ MOV AL, BL ; restore color\r
STOSB ; write pixel\r
ADD DI, nextRow ; go to the next row\r
DEC h\r
JNZ SCAN_START\r
- POP DI\r
- POP SI\r
- POP DX\r
- POP CX\r
- POP BX\r
- POP AX\r
- POP ES\r
- POPF\r
- }\r
+ POP DI\r
+ POP SI\r
+ POP DX\r
+ POP CX\r
+ POP BX\r
+ POP AX\r
+ POP ES\r
+ POPF\r
+ }\r
}\r
\r
/* moved to src/lib/modex16/16render.c */\r
*/\r
void\r
modexCopyPageRegion(page_t *dest, page_t *src,\r
- word sx, word sy,\r
- word dx, word dy,\r
- word width, word height)\r
+ word sx, word sy,\r
+ word dx, word dy,\r
+ word width, word height)\r
{\r
- word doffset = (word)dest->data + dy*(dest->stridew) + dx/4;\r
- word soffset = (word)src->data + sy*(src->stridew) + sx/4;\r
- word scans = vga_state.vga_stride; //++++0000 the quick and dirty fix of the major issue with p16 video display wwww\r
- word nextSrcRow = src->stridew - scans - 1;\r
- word nextDestRow = dest->stridew - scans - 1;\r
- byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */\r
- byte rclip[] = {0x00, 0x01, 0x03, 0x07};\r
- byte left = lclip[sx&0x03];\r
- byte right = rclip[(sx+width)&0x03];\r
+ word doffset = (word)dest->data + dy*(dest->stridew) + dx/4;\r
+ word soffset = (word)src->data + sy*(src->stridew) + sx/4;\r
+ word scans = vga_state.vga_stride; //++++0000 the quick and dirty fix of the major issue with p16 video display wwww\r
+ word nextSrcRow = src->stridew - scans - 1;\r
+ word nextDestRow = dest->stridew - scans - 1;\r
+ byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */\r
+ byte rclip[] = {0x00, 0x01, 0x03, 0x07};\r
+ byte left = lclip[sx&0x03];\r
+ byte right = rclip[(sx+width)&0x03];\r
\r
/* handle the case which requires an extra group */\r
if((sx & 0x03) && !((sx+width) & 0x03)) {\r
\r
// printf("modexCopyPageRegion(src->stridew=%u, dest->stridew=%u, sx=%u, sy=%u, dx=%u, dy=%u, width=%u, height=%u, left=%u, right=%u)\n", src->stridew, dest->stridew, sx, sy, dx, dy, width, height, left, right);\r
\r
- __asm {\r
- PUSHF\r
- PUSH ES\r
- PUSH AX\r
- PUSH BX\r
- PUSH CX\r
- PUSH DX\r
- PUSH SI\r
- PUSH DI\r
-\r
- MOV AX, SCREEN_SEG ; work in the vga space\r
- MOV ES, AX ;\r
+ __asm {\r
+ PUSHF\r
+ PUSH ES\r
+ PUSH AX\r
+ PUSH BX\r
+ PUSH CX\r
+ PUSH DX\r
+ PUSH SI\r
+ PUSH DI\r
+\r
+ MOV AX, SCREEN_SEG ; work in the vga space\r
+ MOV ES, AX ;\r
MOV DI, doffset ;\r
MOV SI, soffset ;\r
\r
OUT DX, AX\r
\r
MOV AX, SC_INDEX ; point to the mask register\r
- MOV DX, AX ;\r
+ MOV DX, AX ;\r
MOV AL, MAP_MASK ;\r
- OUT DX, AL ;\r
+ OUT DX, AL ;\r
INC DX ;\r
\r
ROW_START:\r
MOV DS, AX\r
MOV CX, scans ; the number of latches\r
\r
- MOV AL, left ; do the left column\r
- OUT DX, AL ;\r
+ MOV AL, left ; do the left column\r
+ OUT DX, AL ;\r
MOVSB ;\r
DEC CX ;\r
\r
- MOV AL, 0fh ; do the inner columns\r
+ MOV AL, 0fh ; do the inner columns\r
OUT DX, AL\r
- REP MOVSB ; copy the pixels\r
+ REP MOVSB ; copy the pixels\r
\r
MOV AL, right ; do the right column\r
OUT DX, AL\r
MOVSB\r
POP DS\r
\r
- MOV AX, SI ; go the start of the next row\r
- ADD AX, nextSrcRow ;\r
- MOV SI, AX ;\r
- MOV AX, DI ;\r
- ADD AX, nextDestRow ;\r
- MOV DI, AX ;\r
+ MOV AX, SI ; go the start of the next row\r
+ ADD AX, nextSrcRow ;\r
+ MOV SI, AX ;\r
+ MOV AX, DI ;\r
+ ADD AX, nextDestRow ;\r
+ MOV DI, AX ;\r
\r
- DEC height ; do the rest of the actions\r
+ DEC height ; do the rest of the actions\r
JNZ ROW_START ;\r
\r
- MOV DX, GC_INDEX+1 ; go back to CPU data\r
- MOV AL, 0ffh ; none from latches\r
- OUT DX, AL ;\r
-\r
- POP DI\r
- POP SI\r
- POP DX\r
- POP CX\r
- POP BX\r
- POP AX\r
- POP ES\r
- POPF\r
- }\r
+ MOV DX, GC_INDEX+1 ; go back to CPU data\r
+ MOV AL, 0ffh ; none from latches\r
+ OUT DX, AL ;\r
+\r
+ POP DI\r
+ POP SI\r
+ POP DX\r
+ POP CX\r
+ POP BX\r
+ POP AX\r
+ POP ES\r
+ POPF\r
+ }\r
}\r
\r
\r
/* fade and flash */\r
void\r
modexFadeOn(word fade, byte *palette) {\r
- fadePalette(-fade, 64, 64/fade+1, palette);\r
+ fadePalette(-fade, 64, 64/fade+1, palette);\r
}\r
\r
\r
void\r
modexFadeOff(word fade, byte *palette) {\r
- fadePalette(fade, 0, 64/fade+1, palette);\r
+ fadePalette(fade, 0, 64/fade+1, palette);\r
}\r
\r
\r
void\r
modexFlashOn(word fade, byte *palette) {\r
- fadePalette(fade, -64, 64/fade+1, palette);\r
+ fadePalette(fade, -64, 64/fade+1, palette);\r
}\r
\r
\r
void\r
modexFlashOff(word fade, byte *palette) {\r
- fadePalette(-fade, 0, 64/fade+1, palette);\r
+ fadePalette(-fade, 0, 64/fade+1, palette);\r
}\r
\r
\r
static void\r
fadePalette(sbyte fade, sbyte start, word iter, byte *palette) {\r
- word i;\r
- byte dim = start;\r
+ word i;\r
+ byte dim = start;\r
\r
- /* handle the case where we just update */\r
- if(iter == 0) {\r
+ /* handle the case where we just update */\r
+ if(iter == 0) {\r
modexPalUpdate1(palette);\r
return;\r
- }\r
+ }\r
\r
- while(iter > 0) { /* FadeLoop */\r
+ while(iter > 0) { /* FadeLoop */\r
for(i=0; i<PAL_SIZE; i++) { /* loadpal_loop */\r
- tmppal[i] = palette[i] - dim;\r
- if(tmppal[i] > 127) {\r
+ tmppal[i] = palette[i] - dim;\r
+ if(tmppal[i] > 127) {\r
tmppal[i] = 0;\r
- } else if(tmppal[i] > 63) {\r
+ } else if(tmppal[i] > 63) {\r
tmppal[i] = 63;\r
- }\r
+ }\r
}\r
modexPalUpdate1(tmppal);\r
iter--;\r
dim += fade;\r
- }\r
+ }\r
}\r
\r
\r
/* save and load */\r
void\r
modexPalSave(byte *palette) {\r
- int i;\r
+ int i;\r
\r
- outp(PAL_READ_REG, 0); /* start at palette entry 0 */\r
- for(i=0; i<PAL_SIZE; i++) {\r
+ outp(PAL_READ_REG, 0); /* start at palette entry 0 */\r
+ for(i=0; i<PAL_SIZE; i++) {\r
palette[i] = inp(PAL_DATA_REG); /* read the palette data */\r
- }\r
+ }\r
}\r
\r
\r
byte *\r
modexNewPal() {\r
- byte *ptr;\r
- ptr = malloc(PAL_SIZE);\r
+ byte *ptr;\r
+ ptr = malloc(PAL_SIZE);\r
\r
- /* handle errors */\r
- if(!ptr) {\r
+ /* handle errors */\r
+ if(!ptr) {\r
printf("Could not allocate palette.\n");\r
exit(-1);\r
- }\r
+ }\r
\r
- return ptr;\r
+ return ptr;\r
}\r
\r
\r
void\r
modexLoadPalFile(byte *filename, byte **palette) {\r
- FILE *file;\r
- byte *ptr;\r
+ FILE *file;\r
+ byte *ptr;\r
\r
- /* free the palette if it exists */\r
- if(*palette) {\r
+ /* free the palette if it exists */\r
+ if(*palette) {\r
free(*palette);\r
- }\r
+ }\r
\r
- /* allocate the new palette */\r
- *palette = modexNewPal();\r
+ /* allocate the new palette */\r
+ *palette = modexNewPal();\r
\r
- /* open the file */\r
- file = fopen(filename, "rb");\r
- if(!file) {\r
+ /* open the file */\r
+ file = fopen(filename, "rb");\r
+ if(!file) {\r
printf("Could not open palette file: %s\n", filename);\r
exit(-2);\r
- }\r
+ }\r
\r
- /* read the file */\r
- ptr = *palette;\r
- while(!feof(file)) {\r
+ /* read the file */\r
+ ptr = *palette;\r
+ while(!feof(file)) {\r
*ptr++ = fgetc(file);\r
- }\r
+ }\r
\r
- fclose(file);\r
+ fclose(file);\r
}\r
\r
\r
void\r
modexSavePalFile(char *filename, byte *pal) {\r
- unsigned int i;\r
- FILE *file;\r
+ //unsigned int i;\r
+ FILE *file;\r
\r
- /* open the file for writing */\r
- file = fopen(filename, "wb");\r
- if(!file) {\r
+ /* open the file for writing */\r
+ file = fopen(filename, "wb");\r
+ if(!file) {\r
printf("Could not open %s for writing\n", filename);\r
exit(-2);\r
- }\r
+ }\r
\r
- /* write the data to the file */\r
- fwrite(pal, 1, PAL_SIZE, file);\r
- fclose(file);\r
+ /* write the data to the file */\r
+ fwrite(pal, 1, PAL_SIZE, file);\r
+ fclose(file);\r
}\r
\r
\r
/* blanking */\r
void\r
modexPalBlack() {\r
- fadePalette(-1, 64, 1, tmppal);\r
+ fadePalette(-1, 64, 1, tmppal);\r
}\r
\r
\r
void\r
modexPalWhite() {\r
- fadePalette(-1, -64, 1, tmppal);\r
+ fadePalette(-1, -64, 1, tmppal);\r
}\r
\r
\r
{\r
q=(*i);\r
qq=(*i)/3;\r
-// printf("q: %02d\n", (q));\r
-// printf("qq: %02d\n", (qq));\r
- //printf(" (*i)-q=%02d\n", (*i)-q);\r
+// printf("q: %02d\n", (q));\r
+// printf("qq: %02d\n", (qq));\r
+ //printf(" (*i)-q=%02d\n", (*i)-q);\r
outp(PAL_WRITE_REG, qq); /* start at the beginning of palette */\r
}\r
if((*i)<PAL_SIZE/2 && w==0)\r
else if(qp>0 && (*i)>=(qp) && (*i)<((qp)+3))\r
{\r
//printf("qp=%d\n", qp);\r
- //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]);\r
+ //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]);\r
printf(" %d's color=%d\n", (*i), (a[qp])-(bmp->offset*3)+qp);\r
//outp(PAL_DATA_REG, p[((a[qp])-(bmp->offset*3)+qp)]);// fix this shit!\r
if((*i)+1==(qp)+3){ w++; /*(*i)++;*/ break; }\r
}\r
}\r
//if(qp>0) printf("qp=%d\n", qp);\r
- //if(qp>0) printf(" (*i)=%d\n", (*i)/3);\r
+ //if(qp>0) printf(" (*i)=%d\n", (*i)/3);\r
}\r
//modexWaitBorder(); /* waits one retrace -- less flicker */\r
vga_wait_for_vsync();\r
else if(qp>0 && (*i)>=(qp) && (*i)<((qp)+3))\r
{\r
//printf("qp=%d\n", qp);\r
- //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]);\r
+ //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]);\r
printf(" %d's color=%d\n", (*i), (a[qp]-(bmp->offset*3)+qp));\r
//outp(PAL_DATA_REG, p[((a[qp])-(bmp->offset*3)+qp)]);// fix this shit!\r
if((*i)+1==(qp)+3){ w++; /*(*i)++;*/ break; }\r
printf("p[]=%d qp=%d p[]-qp=%d\n", ((*i)-(bmp->offset*3)), qp, ((*i)-(bmp->offset*3))+qp); }\r
}\r
}\r
- //printf(" (*i)=%d\n", (*i)/3);\r
+ //printf(" (*i)=%d\n", (*i)/3);\r
}\r
\r
printf("\nqqqqqqqq\n\n");\r
aqpee:\r
while(aq<=aa)\r
{\r
-// printf("a[%02d]=(%d)\n", aq, a[aq]);\r
+// printf("a[%02d]=(%d)\n", aq, a[aq]);\r
if(a[aq]==-1) aq++;\r
else { aqoffset++; break; }\r
}\r
//printf("%02d", bmp->data[lq]);\r
//printf("\n%02d\n", bmp->offset);\r
printf("aq=%02d ", aq);\r
- printf("a[aq]=%02d ", a[aq]);\r
+ printf("a[aq]=%02d ", a[aq]);\r
printf("a[aq]+aqpp=%02d ", a[aq]+aqpp);\r
printf("a[aq]-aqpp=%02d\n", a[aq]-aqpp);\r
//bmp->data[lq]=((bmp->data[lq]+bmp->offset)-a[aq]);\r
//++++ bmp->data[lq]=a[aq]-aqpp;\r
-// printf("_%d ", bmp->data[lq]);\r
+// printf("_%d ", bmp->data[lq]);\r
//if(lq > 0 && lq%bmp->width==0) printf("\n");\r
}\r
else if(bmp->data[lq]+bmp->offset < ((*i)/3)-aqpp)\r
//if(lq > 0 && lq%bmp->width==0) printf("\n");\r
}\r
\r
-//printf(" aq=%02d\n", aq);\r
-//printf(" aa=%02d\n", aa);\r
+//printf(" aq=%02d\n", aq);\r
+//printf(" aa=%02d\n", aa);\r
\r
//update the palette~\r
modexPalUpdate(bmp, &pp, aq, aqoffset);\r
modexPalSave(pal);\r
//printf("q: %02d\n", (*q));\r
printf("chkcolor start~\n");\r
- printf("1 (*z): %d\n", (*z)/3);\r
- printf("1 (*i): %d\n", (*i)/3);\r
-// printf("1 offset of color in palette (*q): %d\n", (*q)/3);\r
+ printf("1 (*z): %d\n", (*z)/3);\r
+ printf("1 (*i): %d\n", (*i)/3);\r
+// printf("1 offset of color in palette (*q): %d\n", (*q)/3);\r
printf("wwwwwwwwwwwwwwww\n");\r
//check palette for dups\r
for(; (*z)<PAL_SIZE; (*z)+=3)\r
{\r
- //printf("\n z: %d\n", (*z));\r
- //printf(" q: %d\n", (*q));\r
- //printf(" z+q: %d\n\n", ((*z)+(*q)));\r
+ //printf("\n z: %d\n", (*z));\r
+ //printf(" q: %d\n", (*q));\r
+ //printf(" z+q: %d\n\n", ((*z)+(*q)));\r
//if((*z)%3==0)\r
//{\r
//---- if(pal[(*z)]==pal[(*z)+3] && pal[(*z)+1]==pal[(*z)+4] && pal[(*z)+2]==pal[(*z)+5])\r
if((*z)==(*i))\r
{\r
-// printf("\n%d [%02d][%02d][%02d]\n", (*z), pal[(*z)], pal[(*z)+1], pal[(*z)+2]);\r
-// printf("%d [%02d][%02d][%02d]\n\n", (*z)+3, pal[(*z)+3], pal[(*z)+4], pal[(*z)+5]);\r
+// printf("\n%d [%02d][%02d][%02d]\n", (*z), pal[(*z)], pal[(*z)+1], pal[(*z)+2]);\r
+// printf("%d [%02d][%02d][%02d]\n\n", (*z)+3, pal[(*z)+3], pal[(*z)+4], pal[(*z)+5]);\r
//0000 (*z)-=3;\r
break;\r
}\r
//printf("zz: %02d\n", zz/3);\r
if(zz%3==0)\r
{\r
- if(pal[((*z)+(*q))]==pal[((*z)+(*q))+3] && pal[((*z)+(*q))+1]==pal[((*z)+(*q))+4] && pal[((*z)+(*q))+2]==pal[((*z)+(*q))+5]) //break if duplicate colors found in palette because it have reached the end of the current data of the palette\r
+ if(pal[((*z)+(*q))]==pal[((*z)+(*q))+3] && pal[((*z)+(*q))+1]==pal[((*z)+(*q))+4] && pal[((*z)+(*q))+2]==pal[((*z)+(*q))+5]) //break if duplicate colors found in palette because it have reached the end of the current data of the palette\r
{\r
-// (*z)-=3;\r
-// (*i)-=3;\r
-// printf("\nzq1:%d[%02d][%02d][%02d]\n", (zz+q), pal[(zz+q)], pal[(zz+q)+1], pal[(zz+q)+2]);\r
-// printf("zq2:%d[%02d][%02d][%02d]\n\n", (zz+q)+3, pal[(zz+q)+3], pal[(zz+q)+4], pal[(zz+q)+5]);\r
+// (*z)-=3;\r
+// (*i)-=3;\r
+// printf("\nzq1:%d[%02d][%02d][%02d]\n", (zz+q), pal[(zz+q)], pal[(zz+q)+1], pal[(zz+q)+2]);\r
+// printf("zq2:%d[%02d][%02d][%02d]\n\n", (zz+q)+3, pal[(zz+q)+3], pal[(zz+q)+4], pal[(zz+q)+5]);\r
break;\r
}\r
else if(pal[zz]==pal[((*z)+(*q))] && pal[zz+1]==pal[((*z)+(*q))+1] && pal[zz+2]==pal[((*z)+(*q))+2])\r
{\r
-// printf("\n\nwwwwwwwwwwwwwwww\n");\r
-// printf(" zq: %d [%02d][%02d][%02d] value that is needing to be changed~\n", ((*z)+(*q))/3, pal[((*z)+(*q))], pal[((*z)+(*q))+1], pal[((*z)+(*q))+2]);\r
-// printf(" zz: %d [%02d][%02d][%02d] value that the previous value is going to change to~\n", (zz)/3, pal[zz], pal[zz+1], pal[zz+2]);\r
-// //printf(" zv: %d [%02d][%02d][%02d] wwww\n", (zz-z+q)/3, pal[(zz-z+q)], pal[(zz-z+q)+1], pal[(zz-z+q)+2]);\r
-// printf(" z : %d [%02d][%02d][%02d] offset value~\n", (*z)/3, pal[(*z)], pal[(*z)+1], pal[(*z)+2]);\r
+// printf("\n\nwwwwwwwwwwwwwwww\n");\r
+// printf(" zq: %d [%02d][%02d][%02d] value that is needing to be changed~\n", ((*z)+(*q))/3, pal[((*z)+(*q))], pal[((*z)+(*q))+1], pal[((*z)+(*q))+2]);\r
+// printf(" zz: %d [%02d][%02d][%02d] value that the previous value is going to change to~\n", (zz)/3, pal[zz], pal[zz+1], pal[zz+2]);\r
+// //printf(" zv: %d [%02d][%02d][%02d] wwww\n", (zz-z+q)/3, pal[(zz-z+q)], pal[(zz-z+q)+1], pal[(zz-z+q)+2]);\r
+// printf(" z : %d [%02d][%02d][%02d] offset value~\n", (*z)/3, pal[(*z)], pal[(*z)+1], pal[(*z)+2]);\r
//++++ (*i)--;\r
-// (*z)--;\r
+// (*z)--;\r
//expand dong here\r
/*\r
planned features that i plan to implement~\r
a[(((*z)+(*q)))]=zz;\r
//}\r
(*aa)=(((*z)+(*q)));\r
- printf("!! a[%02d]: %d\n", (((*z)+(*q))/3), zz/3);\r
-// printf("\n aa: %d\n\n", (*aa));\r
-// printf(" a[%02d]=(%02d) offset array i think the palette should be updated again~\n", ((*z)+(*q))/3, a[((*z)+(*q))/3]);\r
-// printf("wwwwwwwwwwwwwwww\n\n");\r
+ printf("!! a[%02d]: %d\n", (((*z)+(*q))/3), zz/3);\r
+// printf("\n aa: %d\n\n", (*aa));\r
+// printf(" a[%02d]=(%02d) offset array i think the palette should be updated again~\n", ((*z)+(*q))/3, a[((*z)+(*q))/3]);\r
+// printf("wwwwwwwwwwwwwwww\n\n");\r
}\r
/*else\r
{\r
}\r
}\r
printf("wwwwwwwwwwwwwwww\n");\r
- printf("2 (*z): %d\n", (*z)/3);\r
- printf("2 (*i): %d\n", (*i)/3);\r
-// printf("2 offset of color in palette (*q): %d\n", (*q)/3);\r
+ printf("2 (*z): %d\n", (*z)/3);\r
+ printf("2 (*i): %d\n", (*i)/3);\r
+// printf("2 offset of color in palette (*q): %d\n", (*q)/3);\r
printf("chkcolor end~\n");\r
free(pal);\r
}\r
\r
}\r
\r
+void modexDrawChar(page_t *page, int x/*for planar selection only*/, word t, word col, word bgcol, word addr)\r
+{\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 rows = romFonts[t].charSize;\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 < rows;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
+\r
+ m1 >>= 1;\r
+ m2 >>= 1;\r
+ if ((++plane) == 4) {\r
+ addr++;\r
+ plane = 0;\r
+ }\r
+ }\r
+}\r
+\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 x_draw = x;\r
- word addr = (word) romFontsData.l;\r
+ //word addr = (word) romFontsData.l;\r
word addrq = (page->width/4) * y + (x / 4) + ((word)page->data);\r
word addrr = addrq;\r
byte c;\r
}\r
//load the letter 'A'\r
__asm {\r
- PUSHF\r
- PUSH ES\r
- PUSH AX\r
- PUSH BX\r
- PUSH CX\r
- PUSH DX\r
- PUSH SI\r
- PUSH DI\r
+ PUSHF\r
+ PUSH ES\r
+ PUSH AX\r
+ PUSH BX\r
+ PUSH CX\r
+ PUSH DX\r
+ PUSH SI\r
+ PUSH DI\r
\r
MOV DI, addr\r
MOV SI, o\r
DEC CX\r
JNZ L1\r
\r
- POP DI\r
- POP SI\r
- POP DX\r
- POP CX\r
- POP BX\r
- POP AX\r
- POP ES\r
- POPF\r
+ POP DI\r
+ POP SI\r
+ POP DX\r
+ POP CX\r
+ POP BX\r
+ POP AX\r
+ POP ES\r
+ POPF\r
}\r
\r
for(i=0; i<w; i++)\r