From: sparky4 Date: Sun, 23 Nov 2014 19:03:57 +0000 (-0600) Subject: deleted: 16.bat X-Git-Url: http://git.osdn.net/view?p=proj16%2F16.git;a=commitdiff_plain;h=d910ad2fc48491c391e1984e74616e50d28d95d7 deleted: 16.bat deleted: 16/MODEX16.ZIP deleted: 16/MODEX16_.ZIP modified: 16/modex16/dos_kb.h renamed: src/lib/lib_com.cpp -> 16/modex16/lib/lib_head.cpp renamed: 16/modex16/lib/lib_com.h -> 16/modex16/lib/lib_head.h modified: 16/modex16/scroll.c modified: 16/modex16/scroll.exe new file: 16/w_modex.7z deleted: 16/w_modex/BUDDHA.PCX deleted: 16/w_modex/CHIKYUU.PCX deleted: 16/w_modex/FIXED32.CPP deleted: 16/w_modex/FIXED32.HPP deleted: 16/w_modex/M.BAT deleted: 16/w_modex/MODEX.CPP deleted: 16/w_modex/MODEX.HPP deleted: 16/w_modex/MONSTER.PCX deleted: 16/w_modex/SINTAB.DAT deleted: 16/w_modex/SPOCK.PCX deleted: 16/w_modex/TEST.CPP deleted: 16/w_modex/TEST.EXE deleted: 16/w_modex/VGA8X8.FNT deleted: 16/w_modex/XBLITBUF.CPP deleted: 16/w_modex/XBLITBUF.HPP deleted: 16/w_modex/XPAL.CPP deleted: 16/w_modex/XPAL.HPP deleted: 16/w_modex/XPRIM.CPP deleted: 16/w_modex/XPRIM.HPP deleted: 16/w_modex/XTYPES.HPP deleted: 16proj.bfproject new file: BITMAP.C new file: BITMAP.H deleted: CORE16.EXE deleted: CORE16.SMP deleted: CORE16.SYM deleted: Makefile new file: Project 16.bfproject modified: README deleted: core16.map renamed: 16/project16.txt -> doc/project16.txt renamed: 16/scroll.txt -> doc/scroll.txt renamed: src/lib/dos_comm.c -> dos_kb.c renamed: src/lib/dos_comm.h -> dos_kb.h new file: gfx.pal renamed: 16/modex16/lib/lib_com.cpp -> lib/lib_head.cpp renamed: src/lib/lib_com.h -> lib/lib_head.h new file: makefile new file: modex16.c new file: modex16.h new file: old.7z new file: palettec.c new file: pcxtest.c new file: pcxtest.exe new file: ptmp.pcx deleted: remake.bat deleted: run.bat new file: scroll.c new file: scroll.exe deleted: src/eng_ai.cpp deleted: src/eng_ai.h deleted: src/eng_comm.cpp deleted: src/eng_comm.h deleted: src/eng_core.cpp deleted: src/eng_core.h deleted: src/eng_gfx.cpp deleted: src/eng_gfx.h deleted: src/eng_snd.cpp deleted: src/eng_snd.h deleted: src/engine.h deleted: src/lib/dos_gfx.cpp deleted: src/lib/dos_gfx.h deleted: src/lib/dos_opl2.cpp deleted: src/lib/opl2.h deleted: src/main.cpp deleted: src/timer.cpp deleted: src/timer.h new file: test.c new file: test.exe new file: test2.c new file: test2.exe new file: types.h deleted: wide/16.bat deleted: wide/core16.lk1 deleted: wide/proj16.mk deleted: wide/proj16.mk1 deleted: wide/proj16.tgt deleted: wide/proj16.wpj deleted: wide/remake.bat --- diff --git a/16.bat b/16.bat deleted file mode 100644 index 66e2ab36..00000000 --- a/16.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -wmake all > 16.err -beep -echo ********* -echo * done! * -echo ********* diff --git a/16/MODEX16.ZIP b/16/MODEX16.ZIP deleted file mode 100644 index 847cf7dc..00000000 Binary files a/16/MODEX16.ZIP and /dev/null differ diff --git a/16/MODEX16_.ZIP b/16/MODEX16_.ZIP deleted file mode 100644 index a1480fab..00000000 Binary files a/16/MODEX16_.ZIP and /dev/null differ diff --git a/16/modex16/dos_kb.h b/16/modex16/dos_kb.h index ea81462a..846946b3 100644 --- a/16/modex16/dos_kb.h +++ b/16/modex16/dos_kb.h @@ -1,6 +1,6 @@ #ifndef _DOSLIB_KB_H_ #define _DOSLIB_KB_H_ -#include "lib\lib_com.h" +#include "lib\lib_head.h" /* Maximum number of scan codes on keyboard controllers */ #define NUM_SCANCODES 128 diff --git a/src/lib/lib_com.cpp b/16/modex16/lib/lib_head.cpp similarity index 79% rename from src/lib/lib_com.cpp rename to 16/modex16/lib/lib_head.cpp index b9851613..cc40b93b 100644 --- a/src/lib/lib_com.cpp +++ b/16/modex16/lib/lib_head.cpp @@ -1,4 +1,5 @@ -#include "src\lib\lib_com.h" +//#include "src\lib\lib_head.h" +#include "lib\lib_head.h" /* local function */ void wait(clock_t wait); diff --git a/16/modex16/lib/lib_com.h b/16/modex16/lib/lib_head.h similarity index 93% rename from 16/modex16/lib/lib_com.h rename to 16/modex16/lib/lib_head.h index 5a203b9d..ba2c8b59 100644 --- a/16/modex16/lib/lib_com.h +++ b/16/modex16/lib/lib_head.h @@ -1,5 +1,5 @@ -#ifndef _LIBCOM_H_ -#define _LIBCOM_H_ +#ifndef _LIBHEAD_H_ +#define _LIBHEAD_H_ #include #include #include // just for wait @@ -103,4 +103,4 @@ void wait(clock_t wait); -#endif/*_LIBCOM_H_*/ +#endif/*_LIBHEAD_H_*/ diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c index 65d28d10..03d4b2c8 100644 --- a/16/modex16/scroll.c +++ b/16/modex16/scroll.c @@ -122,11 +122,11 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { // modexDrawBmp(draw->page, &bmp); - animatePlayer(show, 1, 1, player.x, player.y, q, &ptmp); + animatePlayer(draw, 1, 1, player.x, player.y, q, &ptmp); mapScrollRight(draw, SPEED); modexShowPage(draw->page); - mapScrollRight(show, SPEED); - SWAP(draw, show); +// mapScrollRight(show, SPEED); +// SWAP(draw, show); } player.tx++; } @@ -136,7 +136,7 @@ void main() { { player.x+=SPEED; // modexDrawBmp(draw->page, player.x, player.y, &bmp); - animatePlayer(show, 1, 0, player.x, player.y, q, &ptmp); + animatePlayer(draw, 1, 0, player.x, player.y, q, &ptmp); modexShowPage(draw->page); SWAP(draw, show); } @@ -152,11 +152,11 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { // modexDrawBmp(draw->page, player.x-((q+1)*SPEED), player.y, &bmp); - animatePlayer(show, 3, 1, player.x, player.y, q, &ptmp); + animatePlayer(draw, 3, 1, player.x, player.y, q, &ptmp); mapScrollLeft(draw, SPEED); modexShowPage(draw->page); - mapScrollLeft(show, SPEED); - SWAP(draw, show); +// mapScrollLeft(show, SPEED); +// SWAP(draw, show); } player.tx--; } @@ -166,7 +166,7 @@ void main() { { player.x-=SPEED; // modexDrawBmp(draw->page, player.x, player.y, &bmp); - animatePlayer(show, 3, 0, player.x, player.y, q, &ptmp); + animatePlayer(draw, 3, 0, player.x, player.y, q, &ptmp); modexShowPage(draw->page); SWAP(draw, show); } @@ -182,11 +182,11 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { // modexDrawBmp(draw->page, player.x, player.y+((q+1)*SPEED), &bmp); - animatePlayer(show, 2, 1, player.x, player.y, q, &ptmp); + animatePlayer(draw, 2, 1, player.x, player.y, q, &ptmp); mapScrollDown(draw, SPEED); modexShowPage(draw->page); - mapScrollDown(show, SPEED); - SWAP(draw, show); +// mapScrollDown(show, SPEED); +// SWAP(draw, show); } player.ty++; } @@ -196,9 +196,9 @@ void main() { { player.y+=SPEED; // modexDrawBmp(draw->page, player.x, player.y, &bmp); - animatePlayer(show, 2, 0, player.x, player.y, q, &ptmp); + animatePlayer(draw, 2, 0, player.x, player.y, q, &ptmp); modexShowPage(draw->page); - SWAP(draw, show); +// SWAP(draw, show); } player.ty++; } @@ -211,11 +211,11 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { // modexDrawBmp(draw->page, player.x, player.y-((q+1)*SPEED), &bmp); - animatePlayer(show, 0, 1, player.x, player.y, q, &ptmp); + animatePlayer(draw, 0, 1, player.x, player.y, q, &ptmp); mapScrollUp(draw, SPEED); modexShowPage(draw->page); - mapScrollUp(show, SPEED); - SWAP(draw, show); +// mapScrollUp(show, SPEED); +// SWAP(draw, show); } player.ty--; } @@ -225,9 +225,9 @@ void main() { { player.y-=SPEED; // modexDrawBmp(draw->page, player.x, player.y, &bmp); - animatePlayer(show, 0, 0, player.x, player.y, q, &ptmp); + animatePlayer(draw, 0, 0, player.x, player.y, q, &ptmp); modexShowPage(draw->page); - SWAP(draw, show); +// SWAP(draw, show); } player.ty--; } diff --git a/16/modex16/scroll.exe b/16/modex16/scroll.exe index 5aac8bb1..9ad1236c 100755 Binary files a/16/modex16/scroll.exe and b/16/modex16/scroll.exe differ diff --git a/16/w_modex.7z b/16/w_modex.7z new file mode 100644 index 00000000..22867f3d Binary files /dev/null and b/16/w_modex.7z differ diff --git a/16/w_modex/BUDDHA.PCX b/16/w_modex/BUDDHA.PCX deleted file mode 100644 index 687beebf..00000000 Binary files a/16/w_modex/BUDDHA.PCX and /dev/null differ diff --git a/16/w_modex/CHIKYUU.PCX b/16/w_modex/CHIKYUU.PCX deleted file mode 100644 index 610a6c32..00000000 Binary files a/16/w_modex/CHIKYUU.PCX and /dev/null differ diff --git a/16/w_modex/FIXED32.CPP b/16/w_modex/FIXED32.CPP deleted file mode 100644 index ae06630e..00000000 --- a/16/w_modex/FIXED32.CPP +++ /dev/null @@ -1,114 +0,0 @@ -#include - -#include "fixed32.hpp" - -Fixed32 SinTab[256]; -Fixed32 CosTab[256]; - - -void -initFixed32(void) -{ - FILE *fp; - - fp = fopen("sintab.dat", "rb"); - fread(SinTab, 4, 256, fp); - fread(CosTab, 4, 256, fp); - fclose(fp); -} - - -Fixed32 -FixedMul(Fixed32 num1, Fixed32 num2) -{ - long Mm1, Mm2; - short int MM, mm; - short int hi1, hi2, lo1, lo2; - - hi1 = (num1 >> 16); - hi2 = (num2 >> 16); - lo1 = (num1 & 0xFFFF); - lo2 = (num2 & 0xFFFF); - - MM = (hi1 * hi2); - Mm1 = (lo2 * hi1); - Mm2 = (lo1 * hi2); - mm = (lo1 * lo2); - - return (Mm1 + Mm2 + mm + (((long)MM) << 16)); -} - - -Fixed32 -FixedDiv(Fixed32 numer, Fixed32 denom) -{ - return (numer / ROUND_FIXED_TO_INT(denom)); -} - - -void -CosSin(Iangle theta, Fixed32 *Cos, Fixed32 *Sin) -{ - *Sin = SinTab[theta]; - *Cos = CosTab[theta]; -} - - -/* ASM fixedpoint math routines -;-------------------------------------------------- -; Sqrt - Fixed Point Square Root (High/Normal Precision) -; IN : ecx -; OUT : eax -; Modified : ebx,ecx,edx -Sqrt PROC - -;This is the High Precision version for the sqrt. -;It gives the optimal 8.16 precision but takes -;a little longer (24 iterations, 48 bits intead of -;16 iterations and 32 bits) - - xor eax,eax ;eax is root - mov ebx,40000000h -sqrt1: - mov edx,ecx ;edx = val - sub edx,ebx ;val - bitsqr - jb sqrt2 - sub edx,eax ;val - root - jb sqrt2 - mov ecx,edx ;val >= (root+bitsqr) -> accept subs - shr eax,1 ;root >> 1 - or eax,ebx ;root | bitsqr - shr ebx,2 ;bitsqr>>2 - jnz sqrt1 - jz sqrt5 -sqrt2: - shr eax,1 ;val < (root+bitsqr) -> dont change val - shr ebx,2 ;bitsqr>>2 - jnz sqrt1 -; we now have the 8.8 precision - -sqrt5: - mov ebx,00004000h - shl eax,16 - shl ecx,16 -sqrt3: - mov edx,ecx ;edx = val - sub edx,ebx ;val - bitsqr - jb sqrt4 - sub edx,eax ;val - root - jb sqrt4 - mov ecx,edx ;val >= (root+bitsqr) -> accept subs - shr eax,1 ;root >> 1 - or eax,ebx ;root | bitsqr - shr ebx,2 ;bitsqr>>2 - jnz sqrt3 - ret -sqrt4: - shr eax,1 ;val < (root+bitsqr) -> dont change val - shr ebx,2 ;bitsqr>>2 - jnz sqrt3 - ret - -Sqrt ENDP -*/ - diff --git a/16/w_modex/FIXED32.HPP b/16/w_modex/FIXED32.HPP deleted file mode 100644 index 49a084fe..00000000 --- a/16/w_modex/FIXED32.HPP +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef FIXEDPOINT_HPP - #define FIXEDPOINT_HPP - -typedef long Fixed32; // 16.16 FixedPoint -typedef unsigned char Iangle; // Integer angle (0..255) - -/* Macros for Type Conversion */ -#define INT_TO_FIXED(x) ((x) << 16) -#define FIXED_TO_INT(x) ((x) >> 16) -#define ROUND_FIXED_TO_INT(x) (((x) + 0x8000) >> 16) - -// Loads Fixed32 datafiles -void initFixed32(void); - -// Common math functions -Fixed32 FixedMul(Fixed32 num1, Fixed32 num2); -Fixed32 FixedDiv(Fixed32 numer, Fixed32 denom); -void CosSin(Iangle theta, Fixed32 *Cos, Fixed32 *Sin); - -Fixed32 FixedMulASM(Fixed32 num1, Fixed32 num2); -#pragma aux FixedMulASM = \ - "imul edx" \ - "add eax, 8000h" \ - "adc edx, 0" \ - "shrd eax, edx, 16" \ - parm caller [eax] [edx] \ - value [eax] \ - modify [eax edx]; - -Fixed32 FixedDivASM(Fixed32 numer, Fixed32 denom); // No rounding! -#pragma aux FixedDivASM = \ - "xor eax, eax" \ - "shrd eax, edx, 16" \ - "sar edx, 16" \ - "idiv ebx" \ - parm caller [edx] [ebx] \ - value [eax] \ - modify [eax ebx edx]; - -#endif - diff --git a/16/w_modex/M.BAT b/16/w_modex/M.BAT deleted file mode 100644 index 5bcb63a5..00000000 --- a/16/w_modex/M.BAT +++ /dev/null @@ -1,2 +0,0 @@ -wcl386 test modex xprim xpal xblitbuf fixed32 -erase *.obj diff --git a/16/w_modex/MODEX.CPP b/16/w_modex/MODEX.CPP deleted file mode 100644 index f266a986..00000000 --- a/16/w_modex/MODEX.CPP +++ /dev/null @@ -1,913 +0,0 @@ -#include -#include -#include - -#include "modex.hpp" - -#define ATTRCON_ADDR 0x3C0 -#define MISC_ADDR 0x3C2 -#define VGAENABLE_ADDR 0x3C3 -#define SEQU_ADDR 0x3C4 -#define GRACON_ADDR 0x3CE -#define CRTC_ADDR 0x3D4 -#define STATUS_ADDR 0x3DA - -unsigned short width, height, widthBytes, num_pages; -unsigned short pageSize, activeStart, visibleStart; -unsigned char write_plane, read_plane; -unsigned char *RowsX[600]; -unsigned char line_head[4] = { 0xFF, 0x0E, 0x0C, 0x08 }; -unsigned char line_tail[4] = { 0x00, 0x01, 0x03, 0x07 }; -unsigned short plane_mask[4] = { PLANE_0, PLANE_1, PLANE_2, PLANE_3 }; -unsigned short read_mask[4] = { READ_PLANE_0, READ_PLANE_1, - READ_PLANE_2, READ_PLANE_3 }; -unsigned short text_mask[16] = { 0x0002, 0x0102, 0x0202, 0x0302, - 0x0402, 0x0502, 0x0602, 0x0702, - 0x0802, 0x0902, 0x0A02, 0x0B02, - 0x0C02, 0x0D02, 0x0E02, 0x0F02 }; -unsigned short page_offset[5]; -unsigned short page_mask_high[5]; -unsigned short page_mask_low[5]; - - -unsigned short ModeX_256x224regs[75] = -{ - 0x3c2, 0x00, 0xe3, - 0x3d4, 0x00, 0x5f, - 0x3d4, 0x01, 0x3f, - 0x3d4, 0x02, 0x40, - 0x3d4, 0x03, 0x82, - 0x3d4, 0x04, 0x4a, - 0x3d4, 0x05, 0x9a, - 0x3d4, 0x06, 0x0b, - 0x3d4, 0x07, 0x3e, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x41, - 0x3d4, 0x10, 0xda, - 0x3d4, 0x11, 0x9c, - 0x3d4, 0x12, 0xbf, - 0x3d4, 0x13, 0x20, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0xc7, - 0x3d4, 0x16, 0x04, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_256x240regs[75] = -{ - 0x3c2, 0x00, 0xe3, - 0x3d4, 0x00, 0x5f, - 0x3d4, 0x01, 0x3f, - 0x3d4, 0x02, 0x40, - 0x3d4, 0x03, 0x82, - 0x3d4, 0x04, 0x4e, - 0x3d4, 0x05, 0x96, - 0x3d4, 0x06, 0x0d, - 0x3d4, 0x07, 0x3e, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x41, - 0x3d4, 0x10, 0xea, - 0x3d4, 0x11, 0xac, - 0x3d4, 0x12, 0xdf, - 0x3d4, 0x13, 0x20, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0xe7, - 0x3d4, 0x16, 0x06, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_256x256regs[75] = -{ - 0x3c2, 0x00, 0xe3, - 0x3d4, 0x00, 0x5f, - 0x3d4, 0x01, 0x3f, - 0x3d4, 0x02, 0x40, - 0x3d4, 0x03, 0x82, - 0x3d4, 0x04, 0x4a, - 0x3d4, 0x05, 0x9a, - 0x3d4, 0x06, 0x23, - 0x3d4, 0x07, 0xb2, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x61, - 0x3d4, 0x10, 0x0a, - 0x3d4, 0x11, 0xac, - 0x3d4, 0x12, 0xff, - 0x3d4, 0x13, 0x20, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x07, - 0x3d4, 0x16, 0x1a, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_256x480regs[75] = -{ - 0x3c2, 0x00, 0xe3, - 0x3d4, 0x00, 0x5f, - 0x3d4, 0x01, 0x3f, - 0x3d4, 0x02, 0x40, - 0x3d4, 0x03, 0x82, - 0x3d4, 0x04, 0x4e, - 0x3d4, 0x05, 0x96, - 0x3d4, 0x06, 0x0d, - 0x3d4, 0x07, 0x3e, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x40, - 0x3d4, 0x10, 0xea, - 0x3d4, 0x11, 0xac, - 0x3d4, 0x12, 0xdf, - 0x3d4, 0x13, 0x20, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0xe7, - 0x3d4, 0x16, 0x06, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_320x200regs[75] = -{ - 0x3c2, 0x00, 0x63, - 0x3d4, 0x00, 0x5f, - 0x3d4, 0x01, 0x4f, - 0x3d4, 0x02, 0x50, - 0x3d4, 0x03, 0x82, - 0x3d4, 0x04, 0x54, - 0x3d4, 0x05, 0x80, - 0x3d4, 0x06, 0xbf, - 0x3d4, 0x07, 0x1f, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x41, - 0x3d4, 0x10, 0x9c, - 0x3d4, 0x11, 0x8e, - 0x3d4, 0x12, 0x8f, - 0x3d4, 0x13, 0x28, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x96, - 0x3d4, 0x16, 0xb9, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_320x240regs[75] = -{ - 0x3c2, 0x00, 0xe3, - 0x3d4, 0x00, 0x5f, - 0x3d4, 0x01, 0x4f, - 0x3d4, 0x02, 0x50, - 0x3d4, 0x03, 0x82, - 0x3d4, 0x04, 0x54, - 0x3d4, 0x05, 0x80, - 0x3d4, 0x06, 0x0d, - 0x3d4, 0x07, 0x3e, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x41, - 0x3d4, 0x10, 0xea, - 0x3d4, 0x11, 0xac, - 0x3d4, 0x12, 0xdf, - 0x3d4, 0x13, 0x28, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0xe7, - 0x3d4, 0x16, 0x06, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_320x400regs[75] = -{ - 0x3c2, 0x00, 0x63, - 0x3d4, 0x00, 0x5f, - 0x3d4, 0x01, 0x4f, - 0x3d4, 0x02, 0x50, - 0x3d4, 0x03, 0x82, - 0x3d4, 0x04, 0x54, - 0x3d4, 0x05, 0x80, - 0x3d4, 0x06, 0xbf, - 0x3d4, 0x07, 0x1f, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x40, - 0x3d4, 0x10, 0x9c, - 0x3d4, 0x11, 0x8e, - 0x3d4, 0x12, 0x8f, - 0x3d4, 0x13, 0x28, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x96, - 0x3d4, 0x16, 0xb9, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_320x480regs[75] = -{ - 0x3c2, 0x00, 0xe3, - 0x3d4, 0x00, 0x5f, - 0x3d4, 0x01, 0x4f, - 0x3d4, 0x02, 0x50, - 0x3d4, 0x03, 0x82, - 0x3d4, 0x04, 0x54, - 0x3d4, 0x05, 0x80, - 0x3d4, 0x06, 0x0d, - 0x3d4, 0x07, 0x3e, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x40, - 0x3d4, 0x10, 0xea, - 0x3d4, 0x11, 0xac, - 0x3d4, 0x12, 0xdf, - 0x3d4, 0x13, 0x28, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0xe7, - 0x3d4, 0x16, 0x06, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_360x200regs[75] = -{ - 0x3c2, 0x00, 0x67, - 0x3d4, 0x00, 0x6b, - 0x3d4, 0x01, 0x59, - 0x3d4, 0x02, 0x5a, - 0x3d4, 0x03, 0x8e, - 0x3d4, 0x04, 0x5e, - 0x3d4, 0x05, 0x8a, - 0x3d4, 0x06, 0xbf, - 0x3d4, 0x07, 0x1f, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x41, - 0x3d4, 0x10, 0x9c, - 0x3d4, 0x11, 0x8e, - 0x3d4, 0x12, 0x8f, - 0x3d4, 0x13, 0x2d, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x96, - 0x3d4, 0x16, 0xb9, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_360x240regs[75] = -{ - 0x3c2, 0x00, 0xe7, - 0x3d4, 0x00, 0x6b, - 0x3d4, 0x01, 0x59, - 0x3d4, 0x02, 0x5a, - 0x3d4, 0x03, 0x8e, - 0x3d4, 0x04, 0x5e, - 0x3d4, 0x05, 0x8a, - 0x3d4, 0x06, 0x0d, - 0x3d4, 0x07, 0x3e, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x41, - 0x3d4, 0x10, 0xea, - 0x3d4, 0x11, 0xac, - 0x3d4, 0x12, 0xdf, - 0x3d4, 0x13, 0x2d, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0xe7, - 0x3d4, 0x16, 0x06, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_360x270regs[75] = -{ - 0x3c2, 0x00, 0xe7, - 0x3d4, 0x00, 0x6b, - 0x3d4, 0x01, 0x59, - 0x3d4, 0x02, 0x5a, - 0x3d4, 0x03, 0x8e, - 0x3d4, 0x04, 0x5e, - 0x3d4, 0x05, 0x8a, - 0x3d4, 0x06, 0x30, - 0x3d4, 0x07, 0xf0, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x61, - 0x3d4, 0x10, 0x20, - 0x3d4, 0x11, 0xa9, - 0x3d4, 0x12, 0x1b, - 0x3d4, 0x13, 0x2d, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x1f, - 0x3d4, 0x16, 0x2f, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_360x360regs[75] = -{ - 0x3c2, 0x00, 0x67, - 0x3d4, 0x00, 0x6b, - 0x3d4, 0x01, 0x59, - 0x3d4, 0x02, 0x5a, - 0x3d4, 0x03, 0x8e, - 0x3d4, 0x04, 0x5e, - 0x3d4, 0x05, 0x8a, - 0x3d4, 0x06, 0xbf, - 0x3d4, 0x07, 0x1f, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x40, - 0x3d4, 0x10, 0x88, - 0x3d4, 0x11, 0x85, - 0x3d4, 0x12, 0x67, - 0x3d4, 0x13, 0x2d, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x6d, - 0x3d4, 0x16, 0xba, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_360x400regs[75] = -{ - 0x3c2, 0x00, 0x67, - 0x3d4, 0x00, 0x6b, - 0x3d4, 0x01, 0x59, - 0x3d4, 0x02, 0x5a, - 0x3d4, 0x03, 0x8e, - 0x3d4, 0x04, 0x5e, - 0x3d4, 0x05, 0x8a, - 0x3d4, 0x06, 0xbf, - 0x3d4, 0x07, 0x1f, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x40, - 0x3d4, 0x10, 0x9c, - 0x3d4, 0x11, 0x8e, - 0x3d4, 0x12, 0x8f, - 0x3d4, 0x13, 0x2d, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x96, - 0x3d4, 0x16, 0xb9, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_360x480regs[75] = -{ - 0x3c2, 0x00, 0xe7, - 0x3d4, 0x00, 0x6b, - 0x3d4, 0x01, 0x59, - 0x3d4, 0x02, 0x5a, - 0x3d4, 0x03, 0x8e, - 0x3d4, 0x04, 0x5e, - 0x3d4, 0x05, 0x8a, - 0x3d4, 0x06, 0x0d, - 0x3d4, 0x07, 0x3e, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x40, - 0x3d4, 0x10, 0xea, - 0x3d4, 0x11, 0xac, - 0x3d4, 0x12, 0xdf, - 0x3d4, 0x13, 0x2d, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0xe7, - 0x3d4, 0x16, 0x06, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_376x282regs[75] = -{ - 0x3c2, 0x00, 0xe7, - 0x3d4, 0x00, 0x6e, - 0x3d4, 0x01, 0x5d, - 0x3d4, 0x02, 0x5e, - 0x3d4, 0x03, 0x91, - 0x3d4, 0x04, 0x62, - 0x3d4, 0x05, 0x8f, - 0x3d4, 0x06, 0x62, - 0x3d4, 0x07, 0xf0, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x61, - 0x3d4, 0x10, 0x37, - 0x3d4, 0x11, 0x89, - 0x3d4, 0x12, 0x33, - 0x3d4, 0x13, 0x2f, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x3c, - 0x3d4, 0x16, 0x5c, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_376x564regs[75] = -{ - 0x3c2, 0x00, 0xe7, - 0x3d4, 0x00, 0x6e, - 0x3d4, 0x01, 0x5d, - 0x3d4, 0x02, 0x5e, - 0x3d4, 0x03, 0x91, - 0x3d4, 0x04, 0x62, - 0x3d4, 0x05, 0x8f, - 0x3d4, 0x06, 0x62, - 0x3d4, 0x07, 0xf0, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x60, - 0x3d4, 0x10, 0x37, - 0x3d4, 0x11, 0x89, - 0x3d4, 0x12, 0x33, - 0x3d4, 0x13, 0x2f, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x3c, - 0x3d4, 0x16, 0x5c, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_400x300regs[78] = -{ - 0x3c2, 0x00, 0xa7, - 0x3d4, 0x00, 0x71, - 0x3d4, 0x01, 0x63, - 0x3d4, 0x02, 0x64, - 0x3d4, 0x03, 0x92, - 0x3d4, 0x04, 0x65, - 0x3d4, 0x05, 0x82, - 0x3d4, 0x06, 0x46, - 0x3d4, 0x07, 0x1f, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x40, - 0x3d4, 0x10, 0x31, - 0x3d4, 0x11, 0x80, - 0x3d4, 0x12, 0x2b, - 0x3d4, 0x13, 0x32, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x2f, - 0x3d4, 0x16, 0x44, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x02, 0x0f, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - -unsigned short ModeX_400x600regs[78] = -{ - 0x3c2, 0x00, 0xe7, - 0x3d4, 0x00, 0x70, - 0x3d4, 0x01, 0x63, - 0x3d4, 0x02, 0x64, - 0x3d4, 0x03, 0x92, - 0x3d4, 0x04, 0x65, - 0x3d4, 0x05, 0x82, - 0x3d4, 0x06, 0x70, - 0x3d4, 0x07, 0xf0, - 0x3d4, 0x08, 0x00, - 0x3d4, 0x09, 0x60, - 0x3d4, 0x10, 0x5b, - 0x3d4, 0x11, 0x8c, - 0x3d4, 0x12, 0x57, - 0x3d4, 0x13, 0x32, - 0x3d4, 0x14, 0x00, - 0x3d4, 0x15, 0x58, - 0x3d4, 0x16, 0x70, - 0x3d4, 0x17, 0xe3, - 0x3c4, 0x01, 0x01, - 0x3c4, 0x02, 0x0f, - 0x3c4, 0x04, 0x06, - 0x3ce, 0x05, 0x40, - 0x3ce, 0x06, 0x05, - 0x3c0, 0x10, 0x41, - 0x3c0, 0x13, 0x00 -}; - - -void -calc_rows(void) -{ - int i; - - // Each byte addresses four pixels, so the width of a scan line - // in *bytes* is one fourth of the number of pixels on a line. - widthBytes = width / 4; - - pageSize = (widthBytes * height); - - for (i=0; i < height; i++) { - RowsX[i] = (unsigned char *)((0xA000 << 4) + (widthBytes * i)); - } - - // Clear entire video memory, by selecting all four planes, then - // writing 0 to entire segment. - outpw(SEQU_ADDR, ALL_PLANES); - memset((unsigned char *)(0xA000 << 4), 0x00, 0x00010000); - - // By default we want screen refreshing and drawing operations - // to be based at offset 0 in the video segment. - activeStart = visibleStart = 0; - - // Set current plane to invalid value - write_plane = -1; - read_plane = -1; - - // How many pages fit in 256K VGA Card? - num_pages = ((64 * 1024) / pageSize); - - for (i=0; i < num_pages; i++) { - page_offset[i] = (pageSize * i); - page_mask_high[i] = (0x0C | (page_offset[i] & 0xFF00)); - page_mask_low[i] = (0x0D | ((page_offset[i] & 0x00FF) << 8)); - } -} - - -// setBaseXMode() does the initialization to make the VGA ready to -// accept any combination of configuration register settings. This -// involves enabling writes to index 0 to 7 of the CRT controller (port -// 0x3D4), by clearing the most significant bit (bit 7) of index 0x11. -void -setBaseXMode(void) -{ - int temp; - union REGS r; - - r.x.eax = 0x0013; - int386(0x10, &r, &r); - - outp(0x3D4, 0x11); - temp = inp(0x3D5) & 0x7F; - outp(0x3D4, 0x11); - outp(0x3D5, temp); -} - - -void -outReg(unsigned short *r) -{ - switch (r[0]) { - // First handle special cases: - - case ATTRCON_ADDR: - // reset read/write flip-flop - inp(STATUS_ADDR); - outp(ATTRCON_ADDR, r[1] | 0x20); - // ensure VGA output is enabled - outp(ATTRCON_ADDR, r[2]); - break; - - case MISC_ADDR: - case VGAENABLE_ADDR: - // Copy directly to port - outp(r[0], r[2]); - break; - - case SEQU_ADDR: - case GRACON_ADDR: - case CRTC_ADDR: - default: - // Index to port - outp(r[0], r[1]); - // Value to port+1 - outp(r[0] + 1, r[2]); - break; - } -} - -void -outRegArray(unsigned short *r, int n) -{ - while (n--) { - outReg(r); - r += 3; - } -} - - -void -set80x25(void) -{ - union REGS r; - r.x.eax = 0x0003; - - int386(0x10, &r, &r); -} - -void -set256x224x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_256x224regs, 25); - - width = 256; - height = 224; - - calc_rows(); -} - -void -set256x240x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_256x240regs, 25); - - width = 256; - height = 240; - - calc_rows(); -} - -void -set256x256x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_256x256regs, 25); - - width = 256; - height = 256; - - calc_rows(); -} - -void -set256x480x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_256x480regs, 25); - - width = 256; - height = 480; - - calc_rows(); -} - -void -set320x200x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_320x200regs, 25); - - width = 320; - height = 200; - - calc_rows(); -} - -void -set320x240x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_320x240regs, 25); - - width = 320; - height = 240; - - calc_rows(); -} - -void -set320x400x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_320x400regs, 25); - - width = 320; - height = 400; - - calc_rows(); -} - -void -set320x480x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_320x480regs, 25); - - width = 320; - height = 480; - - calc_rows(); -} - -void -set360x200x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_360x200regs, 25); - - width = 360; - height = 200; - - calc_rows(); -} - -void -set360x240x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_360x240regs, 25); - - width = 360; - height = 240; - - calc_rows(); -} - -void -set360x270x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_360x270regs, 25); - - width = 360; - height = 270; - - calc_rows(); -} - -void -set360x360x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_360x360regs, 25); - - width = 360; - height = 360; - - calc_rows(); -} - -void -set360x400x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_360x400regs, 25); - - width = 360; - height = 400; - - calc_rows(); -} - -void -set360x480x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_360x480regs, 25); - - width = 360; - height = 480; - - calc_rows(); -} - -void -set376x282x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_376x282regs, 25); - - width = 376; - height = 282; - - calc_rows(); -} - -void -set376x564x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_376x564regs, 25); - - width = 376; - height = 564; - - calc_rows(); -} - -void -set400x300x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_400x300regs, 26); - - width = 400; - height = 300; - - calc_rows(); -} - -void -set400x600x256_X(void) -{ - setBaseXMode(); - outRegArray(ModeX_400x600regs, 26); - - width = 400; - height = 600; - - calc_rows(); -} - - -COORD -get_xres(void) -{ - return width; -} - - -COORD -get_yres(void) -{ - return height; -} - - -void -set_write_plane(unsigned short int plane_mask) -{ - write_plane = -1; - outpw(SEQU_ADDR, plane_mask); -} - - -void -set_read_plane(unsigned short int plane_mask) -{ - read_plane = -1; - outpw(GRACON_ADDR, plane_mask); -} - diff --git a/16/w_modex/MODEX.HPP b/16/w_modex/MODEX.HPP deleted file mode 100644 index d17c93b3..00000000 --- a/16/w_modex/MODEX.HPP +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef MODEX_HPP - #define MODEX_HPP - -#include "xtypes.hpp" - -// Some defines -#define PLANE_0 0x0102 -#define PLANE_1 0x0202 -#define PLANE_2 0x0402 -#define PLANE_3 0x0802 -#define ALL_PLANES 0x0F02 -#define READ_PLANE_0 0x0004 -#define READ_PLANE_1 0x0104 -#define READ_PLANE_2 0x0204 -#define READ_PLANE_3 0x0304 - - -// External Variables needed by graphics routines -extern unsigned short width, height, widthBytes, num_pages; -extern unsigned short activeStart, visibleStart, pageSize; -extern unsigned char write_plane, read_plane; -extern unsigned char *RowsX[600]; -extern unsigned char line_head[4]; -extern unsigned char line_tail[4]; -extern unsigned short plane_mask[4]; -extern unsigned short read_mask[4]; -extern unsigned short text_mask[16]; -extern unsigned short page_offset[5]; -extern unsigned short page_mask_high[5]; -extern unsigned short page_mask_low[5]; - - -// Return to text mode -void set80x25(void); - -// Set various ModeX resolutions -void set256x224x256_X(void); -void set256x240x256_X(void); -void set256x256x256_X(void); -void set256x480x256_X(void); -void set320x200x256_X(void); -void set320x240x256_X(void); -void set320x400x256_X(void); -void set320x480x256_X(void); -void set360x200x256_X(void); -void set360x240x256_X(void); -void set360x270x256_X(void); -void set360x360x256_X(void); -void set360x400x256_X(void); -void set360x480x256_X(void); -void set376x282x256_X(void); -void set376x564x256_X(void); -void set400x300x256_X(void); -void set400x600x256_X(void); - -COORD get_xres(void); -COORD get_yres(void); - -void set_write_plane(unsigned short int plane_mask); -void set_read_plane(unsigned short int plane_mask); - -#endif - diff --git a/16/w_modex/MONSTER.PCX b/16/w_modex/MONSTER.PCX deleted file mode 100644 index 59b8a3b8..00000000 Binary files a/16/w_modex/MONSTER.PCX and /dev/null differ diff --git a/16/w_modex/SINTAB.DAT b/16/w_modex/SINTAB.DAT deleted file mode 100644 index 51b9d4e9..00000000 Binary files a/16/w_modex/SINTAB.DAT and /dev/null differ diff --git a/16/w_modex/SPOCK.PCX b/16/w_modex/SPOCK.PCX deleted file mode 100644 index 459f7a9e..00000000 Binary files a/16/w_modex/SPOCK.PCX and /dev/null differ diff --git a/16/w_modex/TEST.CPP b/16/w_modex/TEST.CPP deleted file mode 100644 index 63d1c46d..00000000 --- a/16/w_modex/TEST.CPP +++ /dev/null @@ -1,634 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "fixed32.hpp" -#include "modex.hpp" -#include "xprim.hpp" -#include "xpal.hpp" -#include "xblitbuf.hpp" - -#define FIRE_DEMO 0 -#define ROTATE_DEMO 0 -#define MONSTER_DEMO_ONE 0 -#define MONSTER_DEMO_TWO 0 -#define MATH_DEMO 0 - -int -monster_demo1(void) -{ - clock_t begin, end; - short int i; - blitbuf sprite_image, blit_image; - - clearX(0); - - load_blitbufPCX("chikyuu.pcx", &sprite_image); - aligned_bitblitX(0, 20, &sprite_image); - getch(); - - blit_image.image = NULL; - - i=99; - - begin = clock(); - - while (i > 0) { - scale_blitbuf(120 + (i << 1), (i << 1), &sprite_image, &blit_image); - boxX((99 - i), (119 - i), (220 + i), (120 + i), 0); - vanilla_bitblitX(100 - i, 120 - i, &blit_image); - i--; - } - - end = clock(); - - i=120; - while (i > 0) { - scale_blitbuf(i, 2, &sprite_image, &blit_image); - - putpixelX(159 - (i >> 1), 119, 0); - putpixelX(159 - (i >> 1), 120, 0); - putpixelX(160 + (i >> 1), 119, 0); - putpixelX(160 + (i >> 1), 120, 0); - - vanilla_bitblitX(160 - (i >> 1), 119, &blit_image); - delay(10); - i -= 2; - } - - filledboxX(156, 119, 163, 120, 0); - putpixelX(159, 120, 1); - delay(250); - putpixelX(159, 120, 0); - - filledboxX(156, 119, 163, 120, 0); - clear_blitbuf(&sprite_image); - clear_blitbuf(&blit_image); - - getch(); - - return (end - begin); -} - - -void -monster_demo2(void) -{ - short int i; - blitbuf sprite_image, blit_image; - - clearX(0); - - load_blitbufPCX("chikyuu.pcx", &sprite_image); - aligned_bitblitX(0, 20, &sprite_image); - getch(); - - blit_image.image = NULL; - - i=99; - while (i) { - vertical_scale_blitbuf((i << 1), &sprite_image, &blit_image); - boxX(0, (119 - i), 319, (120 + i), 0); - aligned_bitblitX(0, 120 - i, &blit_image); - i--; - } - - filledboxX(0, 120, 319, 120, 0); - - i=318; - while (i > 0) { - scale_blitbuf(i, 1, &blit_image, &sprite_image); - - putpixelX(159 - (i >> 1), 119, 0); - putpixelX(159 - (i >> 1), 120, 0); - putpixelX(160 + (i >> 1), 119, 0); - putpixelX(160 + (i >> 1), 120, 0); - - vanilla_bitblitX(160 - (i >> 1), 119, &sprite_image); - delay(5); - i -= 2; - } - - filledboxX(156, 119, 163, 120, 0); - putpixelX(159, 120, 1); - delay(250); - putpixelX(159, 120, 0); - filledboxX(156, 119, 163, 120, 0); - clear_blitbuf(&sprite_image); - clear_blitbuf(&blit_image); - - getch(); -} - - -void -fire_demo(void) -{ - #define V_WIDTH 80 - #define V_HEIGHT 50 - #define BUF_WIDTH 80 - #define BUF_HEIGHT 56 - #define REWIND (V_WIDTH * 3) - #define BUF_SIZE (BUF_WIDTH * BUF_HEIGHT) - -unsigned char fire_pal[768] = { - 0, 0, 0, 0, 0, 24, 0, 0, 24, 0, 0, 28, - 0, 0, 32, 0, 0, 32, 0, 0, 36, 0, 0, 40, - 8, 0, 40, 16, 0, 36, 24, 0, 36, 32, 0, 32, - 40, 0, 28, 48, 0, 28, 56, 0, 24, 64, 0, 20, - 72, 0, 20, 80, 0, 16, 88, 0, 16, 96, 0, 12, - 104, 0, 8, 112, 0, 8, 120, 0, 4, 128, 0, 0, - 128, 0, 0, 132, 0, 0, 136, 0, 0, 140, 0, 0, - 144, 0, 0, 144, 0, 0, 148, 0, 0, 152, 0, 0, - 156, 0, 0, 160, 0, 0, 160, 0, 0, 164, 0, 0, - 168, 0, 0, 172, 0, 0, 176, 0, 0, 180, 0, 0, - 184, 4, 0, 188, 4, 0, 192, 8, 0, 196, 8, 0, - 200, 12, 0, 204, 12, 0, 208, 16, 0, 212, 16, 0, - 216, 20, 0, 220, 20, 0, 224, 24, 0, 228, 24, 0, - 232, 28, 0, 236, 28, 0, 240, 32, 0, 244, 32, 0, - 252, 36, 0, 252, 36, 0, 252, 40, 0, 252, 40, 0, - 252, 44, 0, 252, 44, 0, 252, 48, 0, 252, 48, 0, - 252, 52, 0, 252, 52, 0, 252, 56, 0, 252, 56, 0, - 252, 60, 0, 252, 60, 0, 252, 64, 0, 252, 64, 0, - 252, 68, 0, 252, 68, 0, 252, 72, 0, 252, 72, 0, - 252, 76, 0, 252, 76, 0, 252, 80, 0, 252, 80, 0, - 252, 84, 0, 252, 84, 0, 252, 88, 0, 252, 88, 0, - 252, 92, 0, 252, 96, 0, 252, 96, 0, 252, 100, 0, - 252, 100, 0, 252, 104, 0, 252, 104, 0, 252, 108, 0, - 252, 108, 0, 252, 112, 0, 252, 112, 0, 252, 116, 0, - 252, 116, 0, 252, 120, 0, 252, 120, 0, 252, 124, 0, - 252, 124, 0, 252, 128, 0, 252, 128, 0, 252, 132, 0, - 252, 132, 0, 252, 136, 0, 252, 136, 0, 252, 140, 0, - 252, 140, 0, 252, 144, 0, 252, 144, 0, 252, 148, 0, - 252, 152, 0, 252, 152, 0, 252, 156, 0, 252, 156, 0, - 252, 160, 0, 252, 160, 0, 252, 164, 0, 252, 164, 0, - 252, 168, 0, 252, 168, 0, 252, 172, 0, 252, 172, 0, - 252, 176, 0, 252, 176, 0, 252, 180, 0, 252, 180, 0, - 252, 184, 0, 252, 184, 0, 252, 188, 0, 252, 188, 0, - 252, 192, 0, 252, 192, 0, 252, 196, 0, 252, 196, 0, - 252, 200, 0, 252, 200, 0, 252, 204, 0, 252, 208, 0, - 252, 208, 0, 252, 208, 0, 252, 208, 0, 252, 208, 0, - 252, 212, 0, 252, 212, 0, 252, 212, 0, 252, 212, 0, - 252, 216, 0, 252, 216, 0, 252, 216, 0, 252, 216, 0, - 252, 216, 0, 252, 220, 0, 252, 220, 0, 252, 220, 0, - 252, 220, 0, 252, 224, 0, 252, 224, 0, 252, 224, 0, - 252, 224, 0, 252, 228, 0, 252, 228, 0, 252, 228, 0, - 252, 228, 0, 252, 228, 0, 252, 232, 0, 252, 232, 0, - 252, 232, 0, 252, 232, 0, 252, 236, 0, 252, 236, 0, - 252, 236, 0, 252, 236, 0, 252, 240, 0, 252, 240, 0, - 252, 240, 0, 252, 240, 0, 252, 240, 0, 252, 244, 0, - 252, 244, 0, 252, 244, 0, 252, 244, 0, 252, 248, 0, - 252, 248, 0, 252, 248, 0, 252, 248, 0, 252, 252, 0, - 252, 252, 4, 252, 252, 8, 252, 252, 12, 252, 252, 16, - 252, 252, 20, 252, 252, 24, 252, 252, 28, 252, 252, 32, - 252, 252, 36, 252, 252, 40, 252, 252, 40, 252, 252, 44, - 252, 252, 48, 252, 252, 52, 252, 252, 56, 252, 252, 60, - 252, 252, 64, 252, 252, 68, 252, 252, 72, 252, 252, 76, - 252, 252, 80, 252, 252, 84, 252, 252, 84, 252, 252, 88, - 252, 252, 92, 252, 252, 96, 252, 252, 100, 252, 252, 104, - 252, 252, 108, 252, 252, 112, 252, 252, 116, 252, 252, 120, - 252, 252, 124, 252, 252, 124, 252, 252, 128, 252, 252, 132, - 252, 252, 136, 252, 252, 140, 252, 252, 144, 252, 252, 148, - 252, 252, 152, 252, 252, 156, 252, 252, 160, 252, 252, 164, - 252, 252, 168, 252, 252, 168, 252, 252, 172, 252, 252, 176, - 252, 252, 180, 252, 252, 184, 252, 252, 188, 252, 252, 192, - 252, 252, 196, 252, 252, 200, 252, 252, 204, 252, 252, 208, - 252, 252, 208, 252, 252, 212, 252, 252, 216, 252, 252, 220, - 252, 252, 224, 252, 252, 228, 252, 252, 232, 252, 252, 236, - 252, 252, 240, 252, 252, 244, 252, 252, 248, 252, 252, 252 -}; - - unsigned char *screen; - unsigned char *flamebuf_ptr; - unsigned char *flamebuf; - unsigned char temp; - unsigned short int i, j, skip; - unsigned char temp_byte; - - set_paletteX(fire_pal); - set_write_plane(ALL_PLANES); - flamebuf = new unsigned char[BUF_SIZE]; - skip = V_WIDTH; - - // Initialize the video buffer to 0's - memset(flamebuf, 0, BUF_SIZE); - - while (!kbhit()) { - // Transform current buffer - flamebuf_ptr = flamebuf; - i = (BUF_HEIGHT - 2); - while (i--) { - *flamebuf_ptr = (*(flamebuf_ptr + BUF_WIDTH) + - *(flamebuf_ptr + (BUF_WIDTH - 1)) + - *(flamebuf_ptr + (BUF_WIDTH + 1)) + - *(flamebuf_ptr + (BUF_WIDTH * 2))) >> 2; - - flamebuf_ptr += BUF_WIDTH; - temp = *flamebuf_ptr; - if (temp > 11) { - *flamebuf_ptr -= 12; - } else if (temp > 3) { - *flamebuf_ptr -= 4; - } else { - *flamebuf_ptr = 0; - } - flamebuf_ptr += (1 - BUF_WIDTH); - - j = (BUF_WIDTH - 2); - while (j--) { - *flamebuf_ptr = (*(flamebuf_ptr + BUF_WIDTH) + - *(flamebuf_ptr + (BUF_WIDTH - 1)) + - *(flamebuf_ptr + (BUF_WIDTH + 1)) + - *(flamebuf_ptr + (BUF_WIDTH * 2))) >> 2; - - flamebuf_ptr += BUF_WIDTH; - temp = *flamebuf_ptr; - if (temp > 11) { - *flamebuf_ptr -= 12; - } else if (temp > 3) { - *flamebuf_ptr -= 4; - } else { - *flamebuf_ptr = 0; - } - flamebuf_ptr += (1 - BUF_WIDTH); - } - - *flamebuf_ptr = (*(flamebuf_ptr + BUF_WIDTH) + - *(flamebuf_ptr + (BUF_WIDTH - 1)) + - *(flamebuf_ptr + (BUF_WIDTH * 2)) + - *(flamebuf_ptr + (BUF_WIDTH * 2) + - (BUF_WIDTH - 1))) >> 2; - - flamebuf_ptr += BUF_WIDTH; - temp = *flamebuf_ptr; - if (temp > 11) { - *flamebuf_ptr -= 12; - } else if (temp > 3) { - *flamebuf_ptr -= 4; - } else { - *flamebuf_ptr = 0; - } - flamebuf_ptr += (1 - BUF_WIDTH); - } - - // Set new bottom line with random white or black - temp = 0; - flamebuf_ptr = flamebuf + (BUF_WIDTH * (BUF_HEIGHT - 2)); - - j = BUF_WIDTH; - temp = 0; - while (j--) { - // We change the value 1/4 of the time - if ((rand() & 0x03) == 3) { - temp = (255 - temp); - } - - *(flamebuf_ptr + BUF_WIDTH) = temp; - *flamebuf_ptr++ = temp; - } - - // Write the buffer to the screen -// wait_for_retrace(); - screen = RowsX[40]; - flamebuf_ptr = flamebuf; - i = V_HEIGHT; - while (i--) { - j = V_WIDTH; - while (j--) { - temp_byte = *flamebuf_ptr++; - *screen = temp_byte; - screen += skip; - *screen = temp_byte; - screen += skip; - *screen = temp_byte; - screen += skip; - *screen++ = temp_byte; - screen -= REWIND; - } - screen += REWIND; - } - } - - getch(); - - delete flamebuf; -} - - -void -main(void) -{ - FILE *fp; - char ch; - unsigned char pal[768]; - COORD x1, y1, x2, y2; - Iangle theta1, theta2; - Fixed32 trigSin, trigCos; - blitbuf blit_image, sprite_image; - clock_t begin, end; - short int x, y, temp, done; - long i, time1, time2, time3, count, mtime; - BYTE *ptr1; - BYTE *ptr2; - - set320x240x256_X(); - clearX(0); - - getch(); - - temp = loadfontX("vga8x8.fnt"); - - if (temp) { - putstringX(0, 0, "Hello!", 2); - } else { - return; - } - - getch(); - -#if ROTATE_DEMO - get_BIOSpaletteX(pal, 0); - set_paletteX(pal, 0); - - clearX(0); - for (x=0; x < 320; x++) { - for (y=0; y < 240; y++) { - putpixelX(x, y, (x & 0xFF)); - } - } - - getch(); - - while (!kbhit()) { - wait_for_retrace(); - rot_palette(-1); - } - - getch(); -#endif - - load_blitbufPCX("chikyuu.pcx", &blit_image); - scale_blitbuf(160, 100, &blit_image); - aligned_bitblitX(0, 0, &blit_image); - - getch(); - - clearX(0); - - getch(); - - scale_blitbuf(224, 140, &blit_image); - aligned_bitblitX(0, 0, &blit_image); - - getch(); - - greyscale_blitbuf(&blit_image); - grey_paletteX(); - aligned_bitblitX(0, 0, &blit_image); - - getch(); - - clearX(0); - - getch(); - - scale_blitbuf(160, 100, &blit_image); - aligned_bitblitX(0, 0, &blit_image); - - getch(); - - clear_blitbuf(&blit_image); - load_blitbufPCX("chikyuu.pcx", &blit_image); - greyscale_blitbuf(&blit_image); - smooth64_paletteX(1, 0, 1); - aligned_bitblitX(0, 0, &blit_image); - - getch(); - - flip_vertical_blitbuf(&blit_image); - aligned_bitblitX(0, 0, &blit_image); - - getch(); - - clear_blitbuf(&blit_image); - load_blitbufPCX("chikyuu.pcx", &blit_image); - aligned_bitblitX(0, 0, &blit_image); - - done = 0; - while (!done) { - ch = getch(); - switch (ch) { - case 'q': - case 'Q': - done = 1; - break; - - case '+': - brighten_paletteX(1, 1, 1); - break; - - case '-': - brighten_paletteX(-1, -1, -1); - break; - - case '<': - stretch_paletteX(11, 11, 11); - break; - - case '>': - stretch_paletteX(24, 24, 24); - break; - - case 'S': - case 's': - save_blitbufPCX("dump.pcx", &blit_image); - break; - - case 'L': - case 'l': - load_blitbufPCX("chikyuu.pcx", &blit_image); - break; - - case 'R': - brighten_paletteX(1, 0, 0); - break; - - case 'G': - brighten_paletteX(0, 1, 0); - break; - - case 'B': - brighten_paletteX(0, 0, 1); - break; - - case 'r': - brighten_paletteX(-1, 0, 0); - break; - - case 'g': - brighten_paletteX(0, -1, 0); - break; - - case 'b': - brighten_paletteX(0, 0, -1); - break; - - } - } - - clearX(0); - srand(0); - grey_paletteX(); - - begin = clock(); - - for (i=0; i < 10000; i++) { - x1 = rand() % 320; - y1 = rand() % 200; - x2 = rand() % 320; - y2 = rand() % 200; - - lineX(x1, y1, x2, y2, (i & 0x3F)); - } - - end = clock(); - - time1 = (end - begin); - - begin = end; - - for (i=0; i < 10000; i++) { - x1 = rand() % 320; - y1 = rand() % 200; - x2 = rand() % 320; - y2 = rand() % 200; - - temp = ((x1 + x2 + y1 + y2) & 0x3F); - } - - end = clock(); - - time2 = (end - begin); - - getch(); - - for (i=0; i < 120; i++) { - filledboxX(i, i, (319-i), (239-i), (i & 0x3F)); - } - - getch(); - - load_blitbufPCX("chikyuu.pcx", &sprite_image); - transparent_bitblitX(100, 100, &sprite_image); - - getch(); - - clearX(0); - clear_blitbuf(&blit_image); - scale_blitbuf(152, 168, &sprite_image); - alloc_blitbuf(&blit_image, 152, 168); - - // 152x168 image - aligned_bitblitX(84, 36, &sprite_image); - getch(); - - initFixed32(); - - theta1=0; - count=0; - - begin = clock(); - - while (!kbhit()) { - ptr1 = sprite_image.image; - ptr2 = blit_image.image; - theta2 = theta1; - - y=168; - while (y--) { - CosSin(theta2, &trigCos, &trigSin); - scale_scanline(ptr1, ptr2, 152, 152, (trigCos >> 10) + 88); -#if 0 - memcpy(ptr2+152, ptr2, 152); - ptr1 += 304; - ptr2 += 304; - theta2 += 4; - y--; -#else - ptr1 += 152; - ptr2 += 152; - theta2 += 2; -#endif - } - - theta1 += 2; - - aligned_bitblitX(84, 36, &blit_image); - count++; - } - - end = clock(); - - getch(); - getch(); - - clear_blitbuf(&blit_image); - clear_blitbuf(&sprite_image); - -#if FIRE_DEMO - clearX(0); - fire_demo(); -#endif - -#if MONSTER_DEMO_ONE - mtime = monster_demo1(); -#endif - -#if MONSTER_DEMO_TWO - monster_demo2(); -#endif - - set80x25(); - -/*#if MATH_DEMO - Fixed32 c1, c2, c3, a1, a2, a3; - - c1 = INT_TO_FIXED(50); - c2 = INT_TO_FIXED(70); - c3 = INT_TO_FIXED(50 * 70); - - a1 = FixedMul(c1, c2); - a2 = FixedMulASM(c1, c2); - - printf("MUL C version = %d\n", FIXED_TO_INT(a1)); - printf("MUL ASM version = %d\n", FIXED_TO_INT(a2)); - - getch(); - - a1 = FixedDiv(c3, c1); - a2 = FixedDivASM(c3, c1); - - printf("DIV C version = %d\n", FIXED_TO_INT(a1)); - printf("DIV ASM version = %d\n", FIXED_TO_INT(a2)); - - getch(); -#endif*/ - - temp = (time1 - time2); - printf("10000 lines took %4d ticks\n", time1); - printf("rand() overhead = %4d ticks\n", time2); - printf("Time in lineX = %4d ticks\n", temp); - printf("%d lines per second!\n\n", (10000 * 1000) / (55 * temp)); - - temp = (end-begin); - printf("Buddha = %4d blits\n", count); - printf(" = %4d per second\n", (count * 1000) / (55 * temp)); - printf("Buddha = %4d scanline stretches\n", (count * 168)); - printf(" = %4d per second!\n\n", (count * 168000) / (55 * temp)); - - printf("Monster took %d ticks for 99 frames\n", mtime); -} - diff --git a/16/w_modex/TEST.EXE b/16/w_modex/TEST.EXE deleted file mode 100644 index 903a5a1e..00000000 Binary files a/16/w_modex/TEST.EXE and /dev/null differ diff --git a/16/w_modex/VGA8X8.FNT b/16/w_modex/VGA8X8.FNT deleted file mode 100644 index d2bcc392..00000000 Binary files a/16/w_modex/VGA8X8.FNT and /dev/null differ diff --git a/16/w_modex/XBLITBUF.CPP b/16/w_modex/XBLITBUF.CPP deleted file mode 100644 index 98528326..00000000 --- a/16/w_modex/XBLITBUF.CPP +++ /dev/null @@ -1,1027 +0,0 @@ -#include -#include -#include - -#include "xtypes.hpp" -#include "modex.hpp" -#include "xpal.hpp" -#include "xblitbuf.hpp" - -#define SEQU_ADDR 0x3C4 -#define GRACON_ADDR 0x3CE - - -void -clear_blitbuf(blitbuf *buf) -{ - buf->xsize = 0; - buf->ysize = 0; - - delete buf->image; -} - - -void -fill_blitbuf(BYTE color, blitbuf *buf) -{ - memset(buf->image, color, buf->xsize * buf->ysize); -} - - -void -alloc_blitbuf(blitbuf *buf, DIST xsize, DIST ysize) -{ - buf->xsize = xsize; - buf->ysize = ysize; - buf->image = new BYTE[xsize * ysize]; -} - - -void -lin_2_pln_blitbuf(blitbuf *buf) -{ - int i, j, size; - BYTE *oldbuf; - BYTE *newbuf; - BYTE *src_ptr; - BYTE *dest_ptr; - - oldbuf = buf->image; - - size = (buf->xsize * buf->ysize); - newbuf = new BYTE[size]; - size = (size >> 2); - - dest_ptr = newbuf; - - for (i=0; i < 4; i++) { - src_ptr = oldbuf + i; - - j=size; - while (j--) { - *dest_ptr++ = *src_ptr; - src_ptr += 4; - } - } - - buf->image = newbuf; - delete oldbuf; -} - - -void -pln_2_lin_blitbuf(blitbuf *buf) -{ - int i, j, size; - BYTE *oldbuf; - BYTE *newbuf; - BYTE *src_ptr; - BYTE *dest_ptr; - - oldbuf = buf->image; - - size = (buf->xsize * buf->ysize); - newbuf = new BYTE[size]; - size = (size >> 2); - - src_ptr = oldbuf; - for (i=0; i < 4; i++) { - dest_ptr = newbuf + i; - - j=size; - while (j--) { - *dest_ptr = *src_ptr++; - dest_ptr += 4; - } - } - - buf->image = newbuf; - delete oldbuf; -} - - -void -vanilla_bitblitX(COORD x, COORD y, blitbuf *buf) -{ - short int ysize, plane, i, j, loop, skip, rewind, len; - short int xsize[4]; - BYTE *base_vga; - BYTE *vga_ptr; - BYTE *buf_ptr; - - // Length of bitmap in each plane - plane = (x & 3); - i = buf->xsize + plane - 1; - xsize[0] = ((i--) >> 2); - xsize[1] = ((i--) >> 2); - xsize[2] = ((i--) >> 2); - xsize[3] = (i >> 2) + 1; - - for (i=plane; i < 3; i++) { - xsize[i]++; - } - - ysize = buf->ysize; - base_vga = RowsX[y] + (x >> 2) + activeStart; - write_plane = -1; - - for (loop = 0; loop < 4; loop++) { - len = xsize[plane]; - rewind = buf->xsize - (len << 2); - skip = widthBytes - len; - buf_ptr = buf->image + loop; - vga_ptr = base_vga; - - outpw(SEQU_ADDR, plane_mask[plane++]); - if (plane == 4) { - plane = 0; - base_vga++; - } - - i=ysize; - while (i--) { - j=len; - while (j--) { - *vga_ptr++ = *buf_ptr; - buf_ptr += 4; - } - - buf_ptr += rewind; - vga_ptr += skip; - } - } -} - - -void -vanilla_getblitX(COORD x, COORD y, blitbuf *buf) -{ - // Do nothing -} - - -void -aligned_bitblitX(COORD x, COORD y, blitbuf *buf) -{ - short int i, j, plane, skip, xsize, ysize; - BYTE *base_vga; - BYTE *vga_ptr; - BYTE *buf_ptr; - - xsize = (buf->xsize >> 2); - ysize = buf->ysize; - skip = widthBytes - xsize; - base_vga = RowsX[y] + (x >> 2) + activeStart; - - for (plane=0; plane < 4; plane++) { - buf_ptr = buf->image + plane; - vga_ptr = base_vga; - - outpw(SEQU_ADDR, plane_mask[plane]); - - i=ysize; - while (i--) { - j=xsize; - while (j--) { - *vga_ptr++ = *buf_ptr; - buf_ptr += 4; - } - vga_ptr += skip; - } - } - - write_plane = 3; -} - - -void -aligned_getblitX(COORD x, COORD y, blitbuf *buf) -{ - short int i, j, plane, skip, xsize, ysize; - BYTE *base_vga; - BYTE *vga_ptr; - BYTE *buf_ptr; - - xsize = (buf->xsize >> 2); - ysize = buf->ysize; - skip = widthBytes - xsize; - base_vga = RowsX[y] + (x >> 2) + activeStart; - - for (plane=0; plane < 4; plane++) { - buf_ptr = buf->image + plane; - vga_ptr = base_vga; - - outpw(GRACON_ADDR, read_mask[plane]); - - i=ysize; - while (i--) { - j=xsize; - while (j--) { - *buf_ptr = *vga_ptr++; - buf_ptr += 4; - } - vga_ptr += skip; - } - } - - read_plane = 3; -} - - -void -transparent_bitblitX(COORD x, COORD y, blitbuf *buf) -{ - short int i, j, plane, skip, xsize, ysize; - BYTE *base_vga; - BYTE *vga_ptr; - BYTE *buf_ptr; - - xsize = (buf->xsize >> 2); - ysize = buf->ysize; - skip = widthBytes - xsize; - base_vga = RowsX[y] + (x >> 2) + activeStart; - - for (plane=0; plane < 4; plane++) { - buf_ptr = buf->image + plane; - vga_ptr = base_vga; - - outpw(SEQU_ADDR, plane_mask[plane]); - - i=ysize; - while (i--) { - j=xsize; - while (j--) { - if (*buf_ptr) { - *vga_ptr = *buf_ptr; - } - vga_ptr++; - buf_ptr += 4; - } - vga_ptr += skip; - } - } - - write_plane = 3; -} - - -void -planar_bitblitX(COORD x, COORD y, blitbuf *buf) -{ - short int i, plane, xsize, ysize; - BYTE *base_vga; - BYTE *vga_ptr; - BYTE *buf_ptr; - - xsize = (buf->xsize >> 2); - ysize = buf->ysize; - base_vga = RowsX[y] + (x >> 2) + activeStart; - buf_ptr = buf->image; - - for (plane=0; plane < 4; plane++) { - vga_ptr = base_vga; - - outpw(SEQU_ADDR, plane_mask[plane]); - - i=ysize; - while (i--) { - memcpy(vga_ptr, buf_ptr, xsize); - vga_ptr += widthBytes; - buf_ptr += xsize; - } - } - - write_plane = 3; -} - - -void -planar_getblitX(COORD x, COORD y, blitbuf *buf) -{ - short int i, plane, xsize, ysize; - BYTE *base_vga; - BYTE *vga_ptr; - BYTE *buf_ptr; - - xsize = (buf->xsize >> 2); - ysize = buf->ysize; - base_vga = RowsX[y] + (x >> 2) + activeStart; - buf_ptr = buf->image; - - for (plane=0; plane < 4; plane++) { - vga_ptr = base_vga; - - outpw(GRACON_ADDR, read_mask[plane]); - - i=ysize; - while (i--) { - memcpy(buf_ptr, vga_ptr, xsize); - vga_ptr += widthBytes; - buf_ptr += xsize; - } - } - - read_plane = 3; -} - - -void -wide_bitblitX(COORD y, blitbuf *buf) -{ - short int bufsize; - BYTE *vga_ptr; - BYTE *buf_ptr; - - write_plane = 3; - buf_ptr = buf->image; - vga_ptr = RowsX[y] + activeStart; - bufsize = (buf->ysize * widthBytes); - - outpw(SEQU_ADDR, PLANE_0); - memcpy(vga_ptr, buf_ptr, bufsize); - buf_ptr += bufsize; - - outpw(SEQU_ADDR, PLANE_1); - memcpy(vga_ptr, buf_ptr, bufsize); - buf_ptr += bufsize; - - outpw(SEQU_ADDR, PLANE_2); - memcpy(vga_ptr, buf_ptr, bufsize); - buf_ptr += bufsize; - - outpw(SEQU_ADDR, PLANE_3); - memcpy(vga_ptr, buf_ptr, bufsize); -} - - -void -wide_getblitX(COORD y, blitbuf *buf) -{ - short int bufsize; - BYTE *vga_ptr; - BYTE *buf_ptr; - - read_plane = 3; - buf_ptr = buf->image; - vga_ptr = RowsX[y] + activeStart; - bufsize = (buf->ysize * widthBytes); - - outpw(GRACON_ADDR, READ_PLANE_0); - memcpy(buf_ptr, vga_ptr, bufsize); - buf_ptr += bufsize; - - outpw(GRACON_ADDR, READ_PLANE_1); - memcpy(buf_ptr, vga_ptr, bufsize); - buf_ptr += bufsize; - - outpw(GRACON_ADDR, READ_PLANE_2); - memcpy(buf_ptr, vga_ptr, bufsize); - buf_ptr += bufsize; - - outpw(GRACON_ADDR, READ_PLANE_3); - memcpy(buf_ptr, vga_ptr, bufsize); -} - - -void -save_blitbufPCX(char *fname, blitbuf *buf) -{ - FILE *fp; - unsigned int i, size, temp_int; - BYTE VGA_pal[768]; - BYTE *buf_ptr; - BYTE temp_char, match, count; - - fp = fopen(fname, "wb"); - - if (fp != NULL) { - // Write manufacturer's byte - temp_char = 10; - fwrite(&temp_char, 1, 1, fp); - - // Write version of PCX. 5 = 256 color (PCX Version 5.0) - temp_char = 5; - fwrite(&temp_char, 1, 1, fp); - - // Write encoding type, always 1 for RLE. - temp_char = 1; - fwrite(&temp_char, 1, 1, fp); - - // Write bits_per_pixel = 8. - temp_char = 8; - fwrite(&temp_char, 1, 1, fp); - - // Write starting X and Y coords - temp_int = 0; - fwrite(&temp_int, 2, 1, fp); - fwrite(&temp_int, 2, 1, fp); - - // Write X size - temp_int = (buf->xsize - 1); - fwrite(&temp_int, 2, 1, fp); - - // Write Y size - temp_int = (buf->ysize - 1); - fwrite(&temp_int, 2, 1, fp); - - // Do HRES and VRES ** - temp_int = buf->xsize; - fwrite(&temp_int, 2, 1, fp); - temp_int = buf->ysize; - fwrite(&temp_int, 2, 1, fp); - - // Write 16 color palette, not used. - temp_int = 0; - i=24; - while (i--) { - fwrite(&temp_int, 2, 1, fp); - } - - // Write vmode byte. - temp_char = 0; - fwrite(&temp_char, 1, 1, fp); - - // Write bit_planes - temp_char = 1; - fwrite(&temp_char, 1, 1, fp); - - // Write bytes_per_line - temp_int = buf->xsize; - fwrite(&temp_int, 2, 1, fp); - - // Write palette type - temp_int = 1; - fwrite(&temp_int, 2, 1, fp); - - // Write junk filler - temp_int = 0; - i=29; - while (i--) { - fwrite(&temp_int, 2, 1, fp); - } - - // Write the actual image - buf_ptr = buf->image; - size = (buf->xsize * buf->ysize); - - count = 0; - match = *buf_ptr; - - i=size; - while (i--) { - temp_char = *buf_ptr++; - - if ((temp_char == match) && (count < 63)) { - count++; - } else { - if ((count == 1) && (match < 192)) { - // Write single byte - fwrite(&match,1,1,fp); - } else { - // Write run of pixels - count += 192; - fwrite(&count, 1, 1, fp); - fwrite(&match, 1, 1, fp); - } - count = 1; - match = temp_char; - } - } - - if ((count == 1) && (match < 192)) { - // Write single byte - fwrite(&match,1,1,fp); - } else { - // Write run of pixels - count += 192; - fwrite(&count, 1, 1, fp); - fwrite(&match, 1, 1, fp); - } - - // Write palette verification byte - temp_char = 12; - fwrite(&temp_char, 1, 1, fp); - - get_paletteX(VGA_pal); - - // Write 256 color palette - fwrite(VGA_pal, 1, 768, fp); - - fclose(fp); - } -} - - -int -load_blitbufPCX(char *fname, blitbuf *buf) -{ - FILE *fp; - int size; - BYTE VGA_pal[768]; - BYTE PCX_byte, RLE_byte; - BYTE *buf_ptr; - BYTE *end_of_buf; - - fp = fopen(fname, "rb"); - - if (fp == NULL) { - buf->xsize = 0; - buf->ysize = 0; - buf->image = NULL; - return 0; - } else { - fseek(fp, 8, SEEK_SET); - fread(&buf->xsize, 2, 1, fp); - fread(&buf->ysize, 2, 1, fp); - - buf->xsize++; - buf->ysize++; - - size = (buf->xsize * buf->ysize); - - buf->image = new BYTE[size]; - buf_ptr = buf->image; - end_of_buf = buf_ptr + size; - - // Load 256 color PCX palette - fseek(fp, -768, SEEK_END); - fread(VGA_pal, 1, 768, fp); - - set_paletteX(VGA_pal); - - fseek(fp, 128, SEEK_SET); - - while (buf_ptr < end_of_buf) { - // Read next packet - fread(&PCX_byte, 1, 1, fp); - - if (PCX_byte < 192) { - // Raw Pixel - *buf_ptr++ = PCX_byte; - } else { - // RLE Pixels - PCX_byte = PCX_byte & 0x3F; - fread(&RLE_byte, 1, 1, fp); - memset(buf_ptr, RLE_byte, PCX_byte); - buf_ptr += PCX_byte; - } - } - - fclose(fp); - return 1; - } -} - - -void -scale_blitbuf(DIST dest_x, DIST dest_y, blitbuf *buf1, blitbuf *buf2) -{ - unsigned long ErrorAccX, ErrorAccY, ErrorAdjX, ErrorAdjY; - DIST oldx, oldy, newx, newy; - short int i, j, count; - BYTE *src_base; - BYTE *src_ptr; - BYTE *dest_ptr; - BYTE *newbuf; - - oldx = buf1->xsize; - oldy = buf1->ysize; - newx = dest_x; - newy = dest_y; - - newbuf = new BYTE[newx * newy]; - - src_base = buf1->image; - dest_ptr = newbuf; - - // My bitmap scaling routine. As you probably noticed, it's - // pretty Bresenhammy! - - ErrorAccY = 0x8000; - - if (newx > oldx) { - // Biggering - ErrorAdjX = ((((unsigned long)newx) << 16) / - (((unsigned long)oldx))); - - ErrorAdjY = ((((unsigned long)newy) << 16) / - (((unsigned long)oldy))); - - i=oldy; - while (i--) { - ErrorAccX = 0x8000; - src_ptr = src_base; - - j=oldx; - while (j--) { - ErrorAccX += ErrorAdjX; - if (count = (ErrorAccX >> 16)) { - ErrorAccX &= 0xFFFFL; - while (count--) { - *dest_ptr++ = *src_ptr; - } - } - src_ptr++; - } - - ErrorAccY += ErrorAdjY; - count = (ErrorAccY >> 16) - 1; - while (count--) { - memcpy(dest_ptr, dest_ptr - newx, newx); - dest_ptr += newx; - } - ErrorAccY &= 0xFFFFL; - src_base += oldx; - } - } else { - // Smallering - ErrorAdjX = ((((unsigned long)oldx) << 16) / - (((unsigned long)newx))); - - ErrorAdjY = ((((unsigned long)oldy) << 16) / - (((unsigned long)newy))); - - i=newy; - while (i--) { - ErrorAccX = 0x8000; - src_ptr = src_base; - - j=newx; - while (j--) { - *dest_ptr++ = *src_ptr; - ErrorAccX += ErrorAdjX; - src_ptr += (ErrorAccX >> 16); - ErrorAccX &= 0xFFFFL; - } - - ErrorAccY += ErrorAdjY; - src_base += (oldx * (ErrorAccY >> 16)); - ErrorAccY &= 0xFFFFL; - } - } - - if (buf2 == NULL) { - delete buf1->image; - buf1->xsize = newx; - buf1->ysize = newy; - buf1->image = newbuf; - } else { - if (buf2->image != NULL) { - delete buf2->image; - } - buf2->xsize = newx; - buf2->ysize = newy; - buf2->image = newbuf; - } -} - - -void -vertical_scale_blitbuf(DIST dest_y, blitbuf *buf1, blitbuf *buf2) -{ - unsigned long ErrorAccY, ErrorAdjY; - DIST xsize, oldy, newy; - short int i, count; - BYTE *src_ptr; - BYTE *dest_ptr; - BYTE *newbuf; - - xsize = buf1->xsize; - oldy = buf1->ysize; - newy = dest_y; - - newbuf = new BYTE[xsize * newy]; - - src_ptr = buf1->image; - dest_ptr = newbuf; - - // My bitmap scaling routine. As you probably noticed, it's - // pretty Bresenhammy! - - ErrorAccY = 0x8000; - ErrorAdjY = ((((unsigned long)newy) << 16) / - (((unsigned long)oldy))); - - if (newy >= oldy) { - // Biggering - i=oldy; - while (i--) { - ErrorAccY += ErrorAdjY; - if (count = (ErrorAccY >> 16)) { - ErrorAccY &= 0xFFFFL; - - while (count--) { - memcpy(dest_ptr, src_ptr, xsize); - dest_ptr += xsize; - } - } - - src_ptr += xsize; - } - } else { - // Smallering - i=oldy; - while (i--) { - ErrorAccY += ErrorAdjY; - if (ErrorAccY & ~0xFFFFL) { - ErrorAccY &= 0xFFFFL; - memcpy(dest_ptr, src_ptr, xsize); - dest_ptr += xsize; - } - - src_ptr += xsize; - } - } - - if (buf2 == NULL) { - delete buf1->image; - buf1->ysize = newy; - buf1->image = newbuf; - } else { - if (buf2->image != NULL) { - delete buf2->image; - } - buf2->xsize = xsize; - buf2->ysize = newy; - buf2->image = newbuf; - } -} - - -void -greyscale_blitbuf(blitbuf *buf) -{ - BYTE temp_pal[768]; - BYTE *buf_ptr; - BYTE *temp; - BYTE r, g; - unsigned int i; - - buf_ptr = buf->image; - - get_paletteX(temp_pal, 0); - - for (i = (buf->xsize * buf->ysize); i; i--) { - temp = temp_pal + ((*buf_ptr) * 3); - r = *temp++; - g = *temp++; - - *buf_ptr++ = ((r * 19) + (g * 37) + (*temp << 3)) >> 6; - } -} - - -void -RGB_blitbuf(blitbuf *buf) -{ - BYTE temp_pal[768]; - BYTE *buf_ptr; - BYTE *temp; - BYTE r, g, b; - unsigned int i; - - buf_ptr = buf->image; - - get_paletteX(temp_pal, 0); - - for (i = (buf->xsize * buf->ysize); i; i--) { - temp = temp_pal + ((*buf_ptr) * 3); - r = (*temp) + 4; - temp++; - g = (*temp) + 4; - temp++; - b = (*temp) + 8; - - *buf_ptr++ = ((r >> 3) << 5) + ((g >> 3) << 2) + (b >> 4); - } -} - - -void -flip_vertical_blitbuf(blitbuf *buf) -{ - BYTE *top; - BYTE *bottom; - BYTE *temp; - DIST i, x, y;; - - x = buf->xsize; - y = buf->ysize; - - temp = new BYTE[x]; - - top = buf->image; - bottom = buf->image + (x * (y-1)); - - i = (y >> 1); - while (i--) { - memcpy(temp, top, x); - memcpy(top, bottom, x); - memcpy(bottom, temp, x); - top += x; - bottom -= x; - } - - delete temp; -} - - -void -flip_horizontal_blitbuf(blitbuf *buf) -{ - BYTE *buf_ptr; - BYTE *temp_ptr; - BYTE *temp; - DIST i, j, x; - - x = buf->xsize; - - temp = new BYTE[x]; - - buf_ptr = buf->image; - - i = buf->ysize; - while (i--) { - memcpy(temp, buf_ptr, x); - temp_ptr = temp + (x - 1); - j=x; - while (j--) { - *buf_ptr++ = *temp_ptr--; - } - } - - delete temp; -} - - -void -brighten_blitbuf(SBYTE factor, blitbuf *buf) -{ - BYTE *buf_ptr; - short int scratch; - unsigned int i; - - buf_ptr = buf->image; - - for (i = (buf->xsize * buf->ysize); i; i--) { - scratch = (*buf_ptr + factor); - if (scratch <= 0) { - *buf_ptr++ = 0; - } else if (scratch >= 63) { - *buf_ptr++ = 63; - } else { - *buf_ptr++ = scratch; - } - } -} - - -void -stretch_blitbuf(BYTE factor, blitbuf *buf) -{ - BYTE *buf_ptr; - short int scratch; - unsigned int i; - - buf_ptr = buf->image; - - for (i = (buf->xsize * buf->ysize); i; i--) { - scratch = ((((*buf_ptr - 32) * factor) + 8) >> 4) + 32; - if (scratch <= 0) { - *buf_ptr++ = 0; - } else if (scratch >= 63) { - *buf_ptr++ = 63; - } else { - *buf_ptr++ = scratch; - } - } -} - - -void -pixelize(DIST pixfactor, blitbuf *buf) -{ - // Do nothing -} - - -void -GREYconvolve_blitbuf(BYTE *kernel, blitbuf *buf) -{ - // Do nothing -} - - -void -RGBconvolve_blitbuf(BYTE *kernel, blitbuf *buf) -{ - // Do nothing -} - - -void -scale_scanline(BYTE *source, BYTE *dest, DIST smap_size, DIST dmap_size, - DIST dline_size) -{ - unsigned long ErrorAcc, ErrorAdj; - short int i, temp, invert; - - ErrorAcc = 0x8000; - - // Prepare for backwards scanlines - if (dline_size >= 0) { - invert = 0; - } else { - invert = 1; - dline_size = -dline_size; - } - - if (dline_size > smap_size) { - // Biggering - if (smap_size == 0) { - return; - } - ErrorAdj = ((((unsigned long)dline_size) << 16) / - (((unsigned long)smap_size))); - - i=smap_size; - while (i--) { - ErrorAcc += ErrorAdj; - temp = (ErrorAcc >> 16); - ErrorAcc &= 0xFFFFL; - while (temp--) { - *dest++ = *source; - } - source++; - } - } else { - // Smallering - if (dline_size == 0) { - memset(dest, 0, dmap_size); - } else { - temp = dmap_size - dline_size; - i = temp >> 1; - temp -= i; - while (i--) { - *dest++ = 0; - } - - ErrorAdj = ((((unsigned long)smap_size) << 16) / - (((unsigned long)dline_size))); - - i=dline_size; - - while (i--) { - *dest++ = *source; - ErrorAcc += ErrorAdj; - source += (ErrorAcc >> 16); - ErrorAcc &= 0xFFFFL; - } - - while (temp--) { - *dest++ = 0; - } - } - } -} - - -int -load_blitbufRAW(char *rawname, char *palname, blitbuf *buf) -{ - FILE *fp; - BYTE VGA_pal[768]; - - fp = fopen(rawname, "rb"); - - if (fp == NULL) { - buf->xsize = 0; - buf->ysize = 0; - buf->image = NULL; - return 0; - } else { - buf->xsize = 320; - buf->ysize = 200; - buf->image = new BYTE[64000L]; - - // Load image - fread(buf->image, 64000L, 1, fp); - - if (palname == NULL) { - fread(VGA_pal, 1, 768, fp); - set_paletteX(VGA_pal); - fclose(fp); - } else { - fclose(fp); - fp = fopen(palname, "rb"); - if (fp != NULL) { - fread(VGA_pal, 1, 768, fp); - set_paletteX(VGA_pal); - fclose(fp); - } - } - - return 1; - } -} - diff --git a/16/w_modex/XBLITBUF.HPP b/16/w_modex/XBLITBUF.HPP deleted file mode 100644 index 9907c5f3..00000000 --- a/16/w_modex/XBLITBUF.HPP +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef X_BLITBUF_HPP - #define X_BLITBUF_HPP - -// Basic BlitBuf functions -void clear_blitbuf(blitbuf *buf); -void fill_blitbuf(BYTE color, blitbuf *buf); -void alloc_blitbuf(blitbuf *buf, DIST xsize, DIST ysize); -void lin_2_pln_blitbuf(blitbuf *buf); -void pln_2_lin_blitbuf(blitbuf *buf); - -// Adjust color in blitbuf -void greyscale_blitbuf(blitbuf *buf); -void RGB_blitbuf(blitbuf *buf); -void brighten_blitbuf(SBYTE factor, blitbuf *buf); -void stretch_blitbuf(BYTE factor, blitbuf *buf); // factor = 1/16 units - -// Image processing: These expect a linear blitbuf -void scale_blitbuf(DIST dest_x, DIST dest_y, - blitbuf *buf1, blitbuf *buf2 = NULL); -void vertical_scale_blitbuf(DIST dest_y, blitbuf *buf1, blitbuf *buf2 = NULL); -void flip_vertical_blitbuf(blitbuf *buf); -void flip_horizontal_blitbuf(blitbuf *buf); -void pixelize(DIST pixfactor, blitbuf *buf); // Not written yet -void scale_scanline(BYTE *source, BYTE *dest, DIST smap_size, - DIST dmap_size, DIST dline_size); - -// Image Convolution by a 3x3 kernel (linear) -void GREYconvolve_blitbuf(BYTE *kernel, blitbuf *buf); // Not written yet -void RGBconvolve_blitbuf(BYTE *kernel, blitbuf *buf); // Not written yet - -// Vanilla blits can be any size, anywhere -void vanilla_bitblitX(COORD x, COORD y, blitbuf *buf); -void vanilla_getblitX(COORD x, COORD y, blitbuf *buf); - -// Transparent blits must be aligned and 0 is the "transparent" value -void transparent_bitblitX(COORD x, COORD y, blitbuf *buf); - -// Aligned blits must have X and XSIZE evenly divisible by 4 -void aligned_bitblitX(COORD x, COORD y, blitbuf *buf); -void aligned_getblitX(COORD x, COORD y, blitbuf *buf); - -// Planar blits must be aligned and also be ordered in 4-planar fashion -void planar_bitblitX(COORD x, COORD y, blitbuf *buf); -void planar_getblitX(COORD x, COORD y, blitbuf *buf); - -// Wide blits must be planar and are assumed to be as wide as the screen -void wide_bitblitX(COORD y, blitbuf *buf); -void wide_getblitX(COORD y, blitbuf *buf); - -// PCX functions -void save_blitbufPCX(char *fname, blitbuf *buf); -int load_blitbufPCX(char *fname, blitbuf *buf); - -// RAW file functions (320x200 only) -int load_blitbufRAW(char *rawname, char *palname, blitbuf *buf); - -#endif - diff --git a/16/w_modex/XPAL.CPP b/16/w_modex/XPAL.CPP deleted file mode 100644 index b052855f..00000000 --- a/16/w_modex/XPAL.CPP +++ /dev/null @@ -1,265 +0,0 @@ -#include -#include -#include - -#include "modex.hpp" -#include "xpal.hpp" - -BYTE Xpal[768]; - -void -set_paletteX(BYTE *pal, FLAG downgrade) -{ - short int i; - BYTE *buf; - - memcpy(Xpal, pal, 768); - - buf = Xpal; - if (downgrade) { - i=768; - while (i--) { - *buf++ = (*buf >> 2); - } - } - - outp(0x03c8, 0); // Start with color 0 - buf = Xpal; - i=256; - while (i--) { - outp(0x03c9, *buf++); - outp(0x03c9, *buf++); - outp(0x03c9, *buf++); - } -} - - -void -get_paletteX(BYTE *pal, FLAG upgrade) -{ - int i; - - memcpy(pal, Xpal, 768); - - if (upgrade) { - i=768; - while (i--) { - *pal++ = (*pal << 2); - } - } -} - - -void -get_BIOSpaletteX(BYTE *pal, FLAG upgrade) -{ - int i; - union REGS r; - - r.x.eax = 0x1017; - r.x.ebx = 0; - r.x.ecx = 256; - r.x.edx = (unsigned long) pal; - - int386(0x10, &r, &r); - - if (upgrade) { - i=768; - while (i--) { - *pal++ = (*pal << 2); - } - } -} - - -void -photo_negativeX(void) -{ - short int i; - BYTE temp_pal[768]; - BYTE *temp; - - get_paletteX(temp_pal, 0); - temp = temp_pal; - - for (i=0; i < 256; i++) { - *temp++ = (64 - (*temp)); - *temp++ = (64 - (*temp)); - *temp++ = (64 - (*temp)); - } - - set_paletteX(temp_pal, 0); -} - - -void -grey_paletteX(void) -{ - smooth64_paletteX(1, 1, 1); -} - - -void -RGB_paletteX(void) -{ - BYTE r, g, b; - BYTE temp_pal[768]; - BYTE *temp; - - temp = temp_pal; - - for (r=0; r < 8; r++) { - for (g=0; g < 8; g++) { - for (b=0; b < 4; b++) { - *temp++ = (r << 3); - *temp++ = (g << 3); - *temp++ = (b << 4); - } - } - } - - set_paletteX(temp_pal, 0); -} - - -void -smooth64_paletteX(BYTE r, BYTE g, BYTE b) -{ - short int i; - BYTE temp_pal[768]; - BYTE *temp; - - memset(temp_pal, 0, 768); - - - if (r) { - temp = temp_pal; - for (i=0; i < 64; i++) { - *temp = i; - temp += 3; - } - } - - if (g) { - temp = temp_pal + 1; - for (i=0; i < 64; i++) { - *temp = i; - temp += 3; - } - } - - if (b) { - temp = temp_pal + 2; - for (i=0; i < 64; i++) { - *temp = i; - temp += 3; - } - } - - set_paletteX(temp_pal, 0); -} - - -void -brighten_paletteX(SBYTE r, SBYTE g, SBYTE b) -{ - short int i, j, scratch; - BYTE temp_pal[768]; - BYTE *temp; - SBYTE dummy[3]; - - get_paletteX(temp_pal, 0); - temp = temp_pal; - - dummy[0] = r; - dummy[1] = g; - dummy[2] = b; - - for (i=0; i < 256; i++) { - for (j=0; j < 3; j++) { - scratch = *temp + dummy[j]; - if (scratch <= 0) { - *temp++ = 0; - } else if (scratch >= 63) { - *temp++ = 63; - } else { - *temp++ = scratch; - } - } - } - - set_paletteX(temp_pal, 0); -} - - -void -stretch_paletteX(BYTE r, BYTE g, BYTE b) -{ - short int i, j, scratch; - BYTE temp_pal[768]; - BYTE *temp; - BYTE dummy[3]; - - get_paletteX(temp_pal, 0); - temp = temp_pal; - - dummy[0] = r; - dummy[1] = g; - dummy[2] = b; - - for (i=0; i < 256; i++) { - for (j=0; j < 3; j++) { - scratch = ((((*temp - 32) * dummy[j]) + 8) >> 4) + 32; - if (scratch <= 0) { - *temp++ = 0; - } else if (scratch >= 63) { - *temp++ = 63; - } else { - *temp++ = scratch; - } - } - } - - set_paletteX(temp_pal, 0); -} - - -void -rot_palette(BYTE dist) -{ - int shift, i; - BYTE temp_pal[768]; - - shift = (dist * 3); - memcpy(temp_pal, Xpal + shift, 768 - shift); - memcpy(temp_pal + (768 - shift), Xpal, shift); - - set_paletteX(temp_pal, 0); -} - - -BYTE -find_RGB(BYTE r, BYTE g, BYTE b) -{ - long shortest_dist, temp_dist; - short int i, shortest_pal; - - shortest_pal = 0; - shortest_dist = (r - Xpal[0]) * (r - Xpal[0]) + - (g - Xpal[1]) * (g - Xpal[1]) + - (b - Xpal[2]) * (b - Xpal[2]); - - for (i=1; i < 256; i++) { - temp_dist = (r - Xpal[(i * 3) + 0]) * (r - Xpal[(i * 3) + 0]) + - (g - Xpal[(i * 3) + 1]) * (g - Xpal[(i * 3) + 1]) + - (b - Xpal[(i * 3) + 2]) * (b - Xpal[(i * 3) + 2]); - - if (temp_dist < shortest_dist) { - shortest_dist = temp_dist; - shortest_pal = i; - } - } - - return i; -} - diff --git a/16/w_modex/XPAL.HPP b/16/w_modex/XPAL.HPP deleted file mode 100644 index a04dd48c..00000000 --- a/16/w_modex/XPAL.HPP +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef X_PALETTE_HPP - #define X_PALETTE_HPP - -#include "xtypes.hpp" - -// Palette setting/getting functions -void set_paletteX(BYTE *pal, FLAG downgrade = 1); -void get_paletteX(BYTE *pal, FLAG upgrade = 1); -void get_BIOSpaletteX(BYTE *pal, FLAG upgrade = 1); - -// Palette adjusting functions -void photo_negativeX(void); -void grey_paletteX(void); -void RGB_paletteX(void); -void smooth64_paletteX(BYTE r, BYTE g, BYTE b); -void brighten_paletteX(SBYTE r, SBYTE g, SBYTE b); -void stretch_paletteX(BYTE r, BYTE g, BYTE b); // 1/16 units - -// Misc palette functions -void rot_palette(BYTE distance); -BYTE find_RGB(BYTE r, BYTE g, BYTE b); - -#endif - diff --git a/16/w_modex/XPRIM.CPP b/16/w_modex/XPRIM.CPP deleted file mode 100644 index 66e2f72a..00000000 --- a/16/w_modex/XPRIM.CPP +++ /dev/null @@ -1,561 +0,0 @@ -#include -#include -#include -#include - -#include "modex.hpp" -#include "xprim.hpp" - -#define SEQU_ADDR 0x3C4 -#define GRACON_ADDR 0x3CE -#define CRTC_ADDR 0x3D4 -#define STATUS_ADDR 0x3DA - -BYTE Xfont[2048]; - - -void -wait_for_retrace(void) -{ - while (!(inp(STATUS_ADDR) & 0x08)); -} - - -void -setDrawPage(unsigned int page) -{ - activeStart = page_offset[page]; -} - - -void -setVisiblePage(unsigned int page) -{ - // setVisibleStart() tells the VGA from which byte to fetch the first - // pixel when starting refresh at the top of the screen. - visibleStart = page_offset[page]; - - // set high byte - outpw(CRTC_ADDR, page_mask_high[page]); - - // set low byte - outpw(CRTC_ADDR, page_mask_low[page]); -} - - -void -clearX(BYTE color) -{ - outpw(SEQU_ADDR, 0x0F02); - memset((unsigned char *)(0xA000 << 4) + activeStart, color, 0x00010000); -} - - -void -putpixelX(COORD x, COORD y, BYTE color) -{ - BYTE temp; - - if (write_plane != (temp = (x & 3))) { - write_plane = temp; - outpw(SEQU_ADDR, plane_mask[temp]); - } - - *(RowsX[y] + (x >> 2) + activeStart) = color; -} - - -BYTE -getpixelX(COORD x, COORD y) -{ - BYTE temp; - - if (read_plane != (temp = (x & 3))) { - read_plane = temp; - outpw(GRACON_ADDR, read_mask[temp]); - } - - return (*(RowsX[y] + (x >> 2) + activeStart)); -} - - -void -internal_vert_lineX(COORD x, COORD top_y, int len, BYTE color) -{ - BYTE *ptr; - BYTE temp; - - if (write_plane != (temp = (x & 3))) { - write_plane = temp; - outpw(SEQU_ADDR, plane_mask[temp]); - } - - ptr = RowsX[top_y] + (x >> 2) + activeStart; - - while (len--) { - *ptr = color; - ptr += widthBytes; - } -} - - -void -internal_horiz_lineX(COORD left_x, COORD y, int len, BYTE color) -{ - BYTE *ptr; - BYTE temp; - - ptr = RowsX[y] + (left_x >> 2) + activeStart; - - // Set current plane to invalid value - write_plane = -1; - - if (temp = (left_x & 3)) { - outp(SEQU_ADDR, 0x02); - outp(0x3C5, line_head[temp]); - *ptr++ = color; - len -= (4 - temp); - } - - if (temp = (len >> 2)) { - outpw(SEQU_ADDR, 0x0F02); - - len &= 3; - - memset(ptr, color, temp); - ptr += temp; - } - - if (len) { - outp(SEQU_ADDR, 0x02); - outp(0x3C5, line_tail[len]); - *ptr = color; - } -} - - -void -boxX(COORD x1, COORD y1, COORD x2, COORD y2, BYTE color) -{ - int xsize, ysize; - - xsize = (x2 - x1) + 1; - internal_horiz_lineX(x1, y1, xsize, color); - internal_horiz_lineX(x1, y2, xsize, color); - - y1++; - ysize = (y2 - y1); - - internal_vert_lineX(x1, y1, ysize, color); - internal_vert_lineX(x2, y1, ysize, color); -} - - -void -filledboxX(COORD x1, COORD y1, COORD x2, COORD y2, BYTE color) -{ - BYTE *base_ptr; - BYTE *ptr; - BYTE temp; - short int i, xsize, ysize; - - // Set current plane to invalid value - write_plane = -1; - - xsize = (x2 - x1) + 1; - ysize = (y2 - y1) + 1; - - if (ysize == 1) { - internal_horiz_lineX(x1, y1, xsize, color); - return; - } - - base_ptr = RowsX[y1] + (x1 >> 2) + activeStart; - - if (temp = (x1 & 3)) { - outp(SEQU_ADDR, 0x02); - outp(0x3C5, line_head[temp]); - ptr = base_ptr; - i=ysize; - while (i--) { - *ptr = color; - ptr += widthBytes; - } - xsize -= (4 - temp); - base_ptr++; - } - - if (temp = (xsize >> 2)) { - outpw(SEQU_ADDR, 0x0F02); - - xsize &= 3; - ptr = base_ptr; - i=ysize; - while (i--) { - memset(ptr, color, temp); - ptr += widthBytes; - } - base_ptr += temp; - } - - if (xsize) { - outp(SEQU_ADDR, 0x02); - outp(0x3C5, line_tail[xsize]); - while (ysize--) { - *base_ptr = color; - base_ptr += widthBytes; - } - } -} - - -void -circleX(COORD x, COORD y, DIST r, BYTE color) -{ - int ix, iy, d, deltaE, deltaSE; - - ix = 0; - iy = r; - d = 1 - r; - deltaE = 3; - deltaSE = (-2 * r) + 5; - - putpixelX(x + ix, y + iy, color); - putpixelX(x + ix, y - iy, color); - putpixelX(x + iy, y + ix, color); - putpixelX(x + iy, y - ix, color); - putpixelX(x - ix, y + iy, color); - putpixelX(x - ix, y - iy, color); - putpixelX(x - iy, y + ix, color); - putpixelX(x - iy, y - ix, color); - - while (iy > ix++) { - if (d < 0) { - d += deltaE; - deltaE += 2; - deltaSE += 2; - } else { - d += deltaSE; - deltaE += 2; - deltaSE += 4; - iy--; - } - - putpixelX(x + ix, y + iy, color); - putpixelX(x + ix, y - iy, color); - putpixelX(x + iy, y + ix, color); - putpixelX(x + iy, y - ix, color); - putpixelX(x - ix, y + iy, color); - putpixelX(x - ix, y - iy, color); - putpixelX(x - iy, y + ix, color); - putpixelX(x - iy, y - ix, color); - } -} - - -void -filledcircleX(COORD x, COORD y, DIST r, BYTE color) -{ - int ix, iy, d, deltaE, deltaSE; - - ix = 0; - iy = r; - d = 1 - r; - deltaE = 3; - deltaSE = (-2 * r) + 5; - - internal_horiz_lineX(x - ix, y + iy, (ix << 1) + 1, color); - internal_horiz_lineX(x - ix, y - iy, (ix << 1) + 1, color); - internal_horiz_lineX(x - iy, y + ix, (iy << 1) + 1, color); - internal_horiz_lineX(x - iy, y - ix, (iy << 1) + 1, color); - - while (iy > ix++) { - if (d < 0) { - d += deltaE; - deltaE += 2; - deltaSE += 2; - } else { - d += deltaSE; - deltaE += 2; - deltaSE += 4; - iy--; - } - - internal_horiz_lineX(x - ix, y + iy, (ix << 1) + 1, color); - internal_horiz_lineX(x - ix, y - iy, (ix << 1) + 1, color); - internal_horiz_lineX(x - iy, y + ix, (iy << 1) + 1, color); - internal_horiz_lineX(x - iy, y - ix, (iy << 1) + 1, color); - } -} - - -void -internal_xmajor(BYTE *vga_ptr, short int len, short int yskip, - unsigned long ErrorAcc, unsigned long ErrorAdj, BYTE color) -{ - if (len) { - len--; - while (len--) { - *vga_ptr++ = color; - ErrorAcc += ErrorAdj; - - if (ErrorAcc & ~0xFFFFL) { - ErrorAcc &= 0xFFFFL; - vga_ptr += yskip; - } - } - *vga_ptr = color; - } -} - - -void -internal_middle(BYTE *vga_ptr, short int len, short int yskip, - unsigned long ErrorAcc, unsigned long ErrorAdj, BYTE color) -{ - if (len) { - len--; - while (len--) { - *vga_ptr++ = color; - ErrorAcc += ErrorAdj; - vga_ptr += (yskip * (ErrorAcc >> 16)); - ErrorAcc &= 0xFFFFL; - } - *vga_ptr = color; - } -} - - -void -internal_ymajor(BYTE *vga_ptr, short int len, short int yskip, - unsigned long ErrorAcc, unsigned long ErrorAdj, BYTE color) -{ - unsigned long TinyAdj; - short int i; - - if (len) { - TinyAdj = (ErrorAdj >> 2); - ErrorAdj -= TinyAdj; - - len--; - while (len--) { - ErrorAcc += TinyAdj; - i = (ErrorAcc >> 16); - ErrorAcc &= 0xFFFFL; - - while (i--) { - *vga_ptr = color; - vga_ptr += yskip; - } - - ErrorAcc += ErrorAdj; - vga_ptr += (yskip * (ErrorAcc >> 16)) + 1; - ErrorAcc &= 0xFFFFL; - } - ErrorAcc += TinyAdj; - i = (ErrorAcc >> 16); - while (i--) { - *vga_ptr = color; - vga_ptr += yskip; - } - } -} - - -void -lineX(COORD x1, COORD y1, COORD x2, COORD y2, BYTE color) -{ - unsigned long ErrorAcc, ErrorAdj, TinyAdj; - short int i, DeltaX, DeltaY, yskip; - short int len[4]; - BYTE *vga_ptr; - COORD temp; - - // Mode X 4-way folded Bresenham line function - by David Boeren - - // Set invalid plane, because we're screwing with the plane mask - write_plane = -1; - - // Make sure the line runs left to right - if (x1 > x2) { - temp = x1; x1 = x2; x2 = temp; - temp = y1; y1 = y2; y2 = temp; - } - - DeltaX = (x2 - x1); - DeltaY = (y2 - y1); - - if (DeltaY >= 0) { - yskip = widthBytes; - } else { - DeltaY = -DeltaY; // Make DeltaY positive - yskip = -widthBytes; - } - - if (DeltaX == 0) { - // Vertical Line (and one pixel lines) - if (yskip > 0) { - internal_vert_lineX(x1, y1, (DeltaY + 1), color); - } else { - internal_vert_lineX(x1, y2, (DeltaY + 1), color); - } - return; - } - - if (DeltaY == 0) { - // Horizontal Line - internal_horiz_lineX(x1, y1, (DeltaX + 1), color); - return; - } - - vga_ptr = RowsX[y1] + (x1 >> 2) + activeStart; - ErrorAcc = 0x8000; - - // Length of sub-line in each plane - temp = (x1 & 3); - i = DeltaX + temp; - len[0] = ((i--) >> 2); - len[1] = ((i--) >> 2); - len[2] = ((i--) >> 2); - len[3] = (i >> 2) + 1; - - for (i=temp; i < 3; i++) { - len[i]++; - } - - if ((DeltaX >> 2) >= DeltaY) { - // X-Major line (0.00 < slope <= 0.25) - ErrorAdj = ((((unsigned long)DeltaY << 18) / (unsigned long)DeltaX)); - TinyAdj = (ErrorAdj >> 2); - while (i--) { - outpw(SEQU_ADDR, plane_mask[temp]); - internal_xmajor(vga_ptr, len[temp++], yskip, ErrorAcc, ErrorAdj, color); - if (temp == 4) { - temp = 0; - vga_ptr++; - } - ErrorAcc += TinyAdj; - if (ErrorAcc & ~0xFFFFL) { - ErrorAcc &= 0xFFFFL; - vga_ptr += yskip; - } - } - outpw(SEQU_ADDR, plane_mask[temp]); - internal_xmajor(vga_ptr, len[temp], yskip, ErrorAcc, ErrorAdj, color); - } else if (DeltaX >= DeltaY) { - // Middle line (0.25 < slope <= 1.00) - ErrorAdj = ((((unsigned long)DeltaY << 18) / (unsigned long)DeltaX)); - TinyAdj = (ErrorAdj >> 2); - while (i--) { - outpw(SEQU_ADDR, plane_mask[temp]); - internal_middle(vga_ptr, len[temp++], yskip, ErrorAcc, ErrorAdj, color); - if (temp == 4) { - temp = 0; - vga_ptr++; - } - ErrorAcc += TinyAdj; - if (ErrorAcc & ~0xFFFFL) { - vga_ptr += yskip; - ErrorAcc &= 0xFFFFL; - } - } - outpw(SEQU_ADDR, plane_mask[temp]); - internal_middle(vga_ptr, len[temp], yskip, ErrorAcc, ErrorAdj, color); - } else { - // Y-Major line (slope > 1) - ErrorAdj = ((((unsigned long)(DeltaY+1) << 18) / - (unsigned long)(DeltaX+1))); - TinyAdj = (ErrorAdj >> 2); - while (i--) { - outpw(SEQU_ADDR, plane_mask[temp]); - internal_ymajor(vga_ptr, len[temp++], yskip, ErrorAcc, ErrorAdj, color); - if (temp == 4) { - temp = 0; - vga_ptr++; - } - ErrorAcc += TinyAdj; - vga_ptr += (yskip * (ErrorAcc >> 16)); - ErrorAcc &= 0xFFFFL; - } - outpw(SEQU_ADDR, plane_mask[temp]); - internal_ymajor(vga_ptr, len[temp], yskip, ErrorAcc, ErrorAdj, color); - } -} - - -int -loadfontX(char *fname) -{ - FILE *fp; - - fp = fopen(fname, "rb"); - - if (fp == NULL) { - return 0; - } else { - fread(Xfont, 8, 256, fp); - fclose(fp); - return 1; - } -} - - -void -putchX(COORD x, COORD y, char c, BYTE color) -{ - int i; - BYTE *vga_ptr; - BYTE *font_ptr; - BYTE temp; - - // 8x8 font - vga_ptr = RowsX[y << 3] + (x << 1) + activeStart; - write_plane = -1; - - font_ptr = Xfont + (c << 3); - - i=8; - while (i--) { - temp = *font_ptr++; - outpw(SEQU_ADDR, text_mask[temp & 0x0F]); - *vga_ptr++ = color; - - outpw(SEQU_ADDR, text_mask[temp >> 4]); - *vga_ptr-- = color; - vga_ptr += widthBytes; - } -} - - -void -putstringX(COORD x, COORD y, char *str, BYTE color) -{ - int i, skip; - BYTE *vga_ptr; - BYTE *font_ptr; - BYTE c, temp; - - // 8x8 font - vga_ptr = RowsX[y << 3] + (x << 1) + activeStart; - write_plane = -1; - - skip = 2 - (widthBytes << 3); - - while (c = *str++) { - font_ptr = Xfont + (c << 3); - - i=8; - while (i--) { - temp = *font_ptr++; - outpw(SEQU_ADDR, text_mask[temp & 0x0F]); - *vga_ptr++ = color; - - outpw(SEQU_ADDR, text_mask[temp >> 4]); - *vga_ptr-- = color; - vga_ptr += widthBytes; - } - - vga_ptr += skip; - } -} - diff --git a/16/w_modex/XPRIM.HPP b/16/w_modex/XPRIM.HPP deleted file mode 100644 index e9948369..00000000 --- a/16/w_modex/XPRIM.HPP +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef X_PRIMITIVES_HPP - #define X_PRIMITIVES_HPP - -#include "xtypes.hpp" - -// Waits for vertical retrace -void wait_for_retrace(void); - -// Page setting functions -void setDrawPage(unsigned int page); -void setVisiblePage(unsigned int page); - -// Screen clearing functions -void clearX(BYTE color); - -// Drawing functions -void putpixelX(COORD x, COORD y, BYTE color); -BYTE getpixelX(COORD x, COORD y); -void boxX(COORD x1, COORD y1, COORD x2, COORD y2, BYTE color); -void filledboxX(COORD x1, COORD y1, COORD x2, COORD y2, BYTE color); -void circleX(COORD x, COORD y, DIST r, BYTE color); -void filledcircleX(COORD x, COORD y, DIST r, BYTE color); -void lineX(COORD lx1, COORD ly1, COORD lx2, COORD ly2, BYTE color); - -// Text output functions -int loadfontX(char *fname); -void putchX(COORD x, COORD y, char c, BYTE color); -void putstringX(COORD x, COORD y, char *str, BYTE color); - -#endif - diff --git a/16/w_modex/XTYPES.HPP b/16/w_modex/XTYPES.HPP deleted file mode 100644 index 1a0d8e69..00000000 --- a/16/w_modex/XTYPES.HPP +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef XTYPES_HPP - #define XTYPES_HPP - -typedef unsigned char BYTE; -typedef signed char SBYTE; -typedef unsigned char FLAG; -typedef unsigned short COORD; -typedef unsigned short DIST; - -struct blitbuf { - DIST xsize; - DIST ysize; - BYTE *image; -}; - -#endif - diff --git a/16proj.bfproject b/16proj.bfproject deleted file mode 100644 index 8f71eca3..00000000 --- a/16proj.bfproject +++ /dev/null @@ -1,152 +0,0 @@ -c2e.convert_special: 0 -e2c.convert_num: 0 -openfiles: /dos/z/16/doc/project.txt:19:0:0: -openfiles: /dos/z/16/src/eng_core.cpp:0:4107:1: -openfiles: /dos/z/16/src/eng_core.h:0:0:0: -openfiles: /dos/z/16/src/eng_comm.cpp:0:0:0: -openfiles: /dos/z/16/src/eng_comm.h:0:0:0: -openfiles: /dos/z/16/src/lib/dos_comm.c:0:0:0: -openfiles: /dos/z/16/src/lib/dos_comm.h:0:0:0: -openfiles: /dos/z/16/src/eng_gfx.cpp:0:0:0: -openfiles: /dos/z/16/src/eng_gfx.h:0:0:0: -openfiles: /dos/z/16/src/lib/dos_gfx.cpp:0:0:0: -openfiles: /dos/z/16/src/lib/dos_gfx.h:0:0:0: -openfiles: /dos/z/16/src/eng_snd.cpp:0:0:0: -openfiles: /dos/z/16/src/eng_snd.h:0:0:0: -openfiles: /dos/z/16/src/lib/dos_opl2.cpp:0:0:0: -openfiles: /dos/z/16/src/lib/opl2.h:0:0:0: -openfiles: /dos/z/16/src/lib/lib_com.cpp:0:0:0: -openfiles: /dos/z/16/src/lib/lib_com.h:0:0:0: -openfiles: /dos/z/16/src/eng_ai.cpp:0:0:0: -openfiles: /dos/z/16/src/eng_ai.h:0:0:0: -openfiles: /dos/z/16/src/timer.cpp:0:0:0: -openfiles: /dos/z/16/src/timer.h:0:0:0: -openfiles: /dos/z/16/src/engine.h:0:0:0: -openfiles: /dos/z/16/src/main.cpp:0:0:0: -openfiles: /dos/z/16/doc/ojoww.cpp:0:0:0: -openfiles: /dos/z/16/doc/char.txt:0:0:0: -snr_recursion_level: 0 -convertcolumn_horizontally: 0 -adv_open_matchname: 0 -show_mbhl: 1 -view_line_numbers: 1 -fb_show_backup_f: 0 -htmlbar_thumbnailwidth: 300 -view_left_panel: 0 -default_mime_type: text/plain -e2c.convert_xml: 1 -c2e.convert_iso: 0 -opendir: file:///dos/z/16/doc -wrap_text_default: 0 -bookmarks_filename_mode: 1 -snr_casesens: 0 -view_blocks: 1 -name: Project 16 -convertcolumn_separator: -convertcolumn_fillempty: -replacelist: NUM_SCANCODES -replacelist: keer -replacelist: keep -replacelist: kee -replacelist: keyp -fb_show_hidden_f: 0 -editor_tab_width: 4 -template: /usr/share/bluefish/templates/C_Header_GPL -show_visible_spacing: 0 -view_statusbar: 1 -display_right_margin: 0 -c2e.IE_apos_workaround: 0 -outputb_scroll_mode: 0 -leftpanel_active_tab: 1 -enable_syntax_scan: 1 -ssearch_regex: 0 -e2c.convert_iso: 0 -ssearch_casesens: 0 -charmap_block: 11 -recent_files: file:///dos/z/16/remake.sh -recent_files: file:///dos/z/16/16.sh -recent_files: file:///dos/z/16/16.bat -recent_files: file:///dos/z/16/remake.bat -recent_files: file:///dos/z/16/ojowwww.cpp -recent_files: file:///dos/z/16/doc/project.txt -recent_files: file:///dos/z/16/src/eng_core.cpp -recent_files: file:///dos/z/16/src/eng_gfx.cpp -recent_files: file:///dos/z/16/src/eng_core.h -recent_files: file:///dos/z/16/src/lib/dos_comm.c -recent_files: file:///dos/z/16/src/lib/dos_comm.h -recent_files: file:///dos/z/16/src/eng_comm.h -recent_files: file:///dos/z/16/src/eng_comm.cpp -recent_files: file:///dos/z/16/src/eng_gfx.h -recent_files: file:///dos/z/16/src/lib/lib_com.cpp -recent_files: file:///dos/z/16/src/eng_snd.h -recent_files: file:///dos/z/16/src/eng_snd.cpp -recent_files: file:///dos/z/16/src/lib/dos_gfx.h -recent_files: file:///dos/z/16/src/lib/opl2.h -recent_files: file:///dos/z/16/src/lib/dos_gfx.cpp -recent_files: file:///dos/z/16/src/lib/dos_opl2.cpp -recent_files: file:///dos/z/16/src/lib/lib_com.h -recent_files: file:///dos/z/16/src/eng_ai.h -recent_files: file:///dos/z/16/src/eng_ai.cpp -recent_files: file:///dos/z/16/src/timer.h -recent_files: file:///dos/z/16/src/timer.cpp -recent_files: file:///dos/z/16/src/main.cpp -recent_files: file:///dos/z/16/src/engine.h -recent_files: file:///dos/z/16/doc/ojoww.cpp -recent_files: file:///dos/z/16/doc/char.txt -snr_replacetype: 0 -savedir: file:///dos/z/16/doc -spell_check_default: 1 -spell_insert_entities: 0 -last_filefilter: -htmlbar_notebooktab: 0 -view_blockstack: 1 -snr_escape_chars: 0 -htmlbar_view: 0 -spell_lang: en -ssearch_dotmatchall: 0 -searchlist: keynum -searchlist: key -searchlist: scankey -searchlist: keep -searchlist: keer -searchlist: keyWasPressed -searchlist: keyIsPressed -searchlist: scanCode -searchlist: KeyPressed -searchlist: kee -autocomplete: 1 -outputb_show_all_output: 0 -bookmarks_show_mode: 0 -snippets_show_as_menu: 1 -adv_open_recursive: 0 -encoding: UTF-8 -e2c.convert_special: 0 -autoindent: 1 -fb_viewmode: 0 -filegloblist: *.xml -filegloblist: *.txt -filegloblist: *.shtml -filegloblist: *.py -filegloblist: *.pl -filegloblist: *.php -filegloblist: *.js -filegloblist: *.java -filegloblist: *.htm -filegloblist: *.html -filegloblist: *.h -filegloblist: *.css -filegloblist: *.cpp -filegloblist: *.cgi -filegloblist: *.c -fb_focus_follow: 1 -ssearch_unescape: 0 -c2e.convert_symbol: 0 -snr_dotmatchall: 0 -c2e.convert_xml: 1 -editor_indent_wspaces: 0 -view_cline: 0 -snr_type: 0 -snr_scope: 0 -bmarksearchmode: 0 -view_main_toolbar: 1 -e2c.convert_symbol: 0 diff --git a/BITMAP.C b/BITMAP.C new file mode 100644 index 00000000..8287e57d --- /dev/null +++ b/BITMAP.C @@ -0,0 +1,162 @@ +#include +#include +#include "bitmap.h" +#include "modex16.h" + +static struct pcxHeader { + byte id; + byte version; + byte encoding; + byte bpp; + word xmin; + word ymin; + word xmax; + word ymax; + word hres; + word vres; + byte pal16[48]; + byte res1; + word bpplane; + word palType; + word hScreenSize; + word vScreenSize; + byte padding[54]; +} head; + + +static void loadPcxStage1(FILE *file, bitmap_t *result) { + long bufSize; + int index; + byte count, val; + long int pos; + + /* read the header */ + fread(&head, sizeof(char), sizeof(struct pcxHeader), file); + + /* get the width and height */ + result->width = head.xmax - head.xmin + 1; + result->height = head.ymax - head.ymin + 1; + + /* make sure this is 8bpp */ + if(head.bpp != 8) { + printf("I only know how to handle 8bpp pcx files!\n"); + fclose(file); + exit(-2); + } +} + + +static void loadPcxPalette(FILE *file, bitmap_t *result) { + byte val; + int index; + + /* handle the palette */ + fseek(file, -769, SEEK_END); + val = fgetc(file); + result->palette = modexNewPal(); + if(head.version == 5 && val == 12) { + /* use the vga palette */ + for(index=0; !feof(file) && index < PAL_SIZE; index++) { + val = fgetc(file); + result->palette[index] = val >> 2; + } + } else { + /* use the 16 color palette */ + for(index=0; index<48; index++) { + result->palette[index] = head.pal16[index]; + } + } +} + + +bitmap_t +bitmapLoadPcx(char *filename) { + FILE *file; + bitmap_t result; + long bufSize; + int index; + byte count, val; + + /* open the PCX file for reading */ + file = fopen(filename, "rb"); + if(!file) { + printf("Could not open %s for reading.\n", filename); + exit(-2); + } + + /* load the first part of the pcx file */ + loadPcxStage1(file, &result); + + /* allocate the buffer */ + bufSize = result.width * result.height; + result.data = malloc(bufSize); + if(!result.data) { + printf("Could not allocate memory for bitmap data."); + fclose(file); + exit(-1); + } + + /* read the buffer in */ + index = 0; + do { + /* get the run length and the value */ + count = fgetc(file); + if(0xC0 == (count & 0xC0)) { /* this is the run count */ + count &= 0x3f; + val = fgetc(file); + } else { + val = count; + count = 1; + } + + /* write the pixel the specified number of times */ + for(; count && index < bufSize; count--,index++) { + result.data[index] = val; + } + } while(index < bufSize); + + loadPcxPalette(file, &result); + + fclose(file); + + return result; +} + + +tileset_t +bitmapLoadPcxTiles(char *filename, word twidth, word theight) { + tileset_t ts; + FILE *file; + bitmap_t result; + int i; + + /* open the PCX file for reading */ + file = fopen(filename, "rb"); + if(!file) { + printf("Could not open %s for reading.\n", filename); + exit(-2); + } + + /* load the first part of the pcx file */ + loadPcxStage1(file, &result); + + /* get the number of tiles and set up the result structure */ + ts.twidth = twidth; + ts.theight = theight; + ts.ntiles = (result.width/twidth) * (result.height/theight); + ts.palette = result.palette; + + /* allocate the pixel storage for the tiles */ + ts.data = malloc(sizeof(byte*) * ts.ntiles); + ts.data[0] = malloc(sizeof(byte) * ts.ntiles * twidth * theight); + for(i=1; i < ts.ntiles; i++) { + ts.data[i] = ts.data[i-1] + twidth * theight; + } + + /* finish off the file */ + loadPcxPalette(file, &result); + + fclose(file); + + return ts; +} diff --git a/BITMAP.H b/BITMAP.H new file mode 100644 index 00000000..4c4af98e --- /dev/null +++ b/BITMAP.H @@ -0,0 +1,24 @@ +/* + * Functions and types for loading and manipulating bitmaps. + */ +#ifndef BITMAP_H +#define BITMAP_H +#include "types.h" +typedef struct { + byte *data; + word width; + word height; + byte *palette; +} bitmap_t; + +typedef struct { + byte **data; + word ntiles; /* the number of tiles */ + word twidth; /* width of the tiles */ + word theight; /* height of the tiles */ + byte *palette; /* palette for the tile set */ +} tileset_t; + +bitmap_t bitmapLoadPcx(char *filename); +tileset_t bitmapLoadPcxTiles(char *filename, word twidth, word theight); +#endif diff --git a/CORE16.EXE b/CORE16.EXE deleted file mode 100644 index 308abd31..00000000 Binary files a/CORE16.EXE and /dev/null differ diff --git a/CORE16.SMP b/CORE16.SMP deleted file mode 100644 index 802d7a7c..00000000 Binary files a/CORE16.SMP and /dev/null differ diff --git a/CORE16.SYM b/CORE16.SYM deleted file mode 100644 index e7cb05eb..00000000 Binary files a/CORE16.SYM and /dev/null differ diff --git a/Makefile b/Makefile deleted file mode 100644 index b1a00981..00000000 --- a/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -OBJS=main.obj timer.obj eng_ai.obj eng_snd.obj eng_comm.obj & - eng_core.obj eng_gfx.obj dos_comm.obj dos_gfx.obj & - dos_opl2.obj lib_com.obj - -CC=*wcc -CFLAGS=-i"C:\FDOS\WATCOM/H" -w4 -e25 -zkl -zq -otexan -ol -ol+ & - -oh -om -d2 -bt=dos -ml - -CXX=*wpp -CXXFLAGS=-i="C:\FDOS\WATCOM/H" -w4 -e25 -zkl -zq -otexan -ol -ol+ & - -oh -om -d2 -bt=dos -ml -xs -xr - -LD=*wlink -LDFLAGS=d all sys dos op m op maxe=25 op q op symf - -all : core16.exe - -clean : .symbolic - @del *.obj - @del core16.exe - @del *.err - @del *.smp - -core16.exe : $(OBJS) - $(LD) $(LDFLAGS) name core16 file {$(OBJS)} - -.c : src/;src/lib -.cpp : src/;src/lib - -.cpp.obj : .autodepend - $(CXX) $< -fo=$@ $(CXXFLAGS) -.c.obj : .autodepend - $(CC) $< -fo=$@ $(CFLAGS) -$(OBJS) : diff --git a/Project 16.bfproject b/Project 16.bfproject new file mode 100644 index 00000000..c75ec9aa --- /dev/null +++ b/Project 16.bfproject @@ -0,0 +1,153 @@ +c2e.convert_special: 0 +e2c.convert_num: 0 +openfiles: /dos/z/16/doc/project.txt:0:0:0: +openfiles: /dos/z/16/scroll.c:82:0:1: +snr_recursion_level: 0 +convertcolumn_horizontally: 0 +adv_open_matchname: 0 +show_mbhl: 1 +view_line_numbers: 1 +fb_show_backup_f: 0 +htmlbar_thumbnailwidth: 300 +view_left_panel: 0 +default_mime_type: text/plain +e2c.convert_xml: 1 +c2e.convert_iso: 0 +opendir: file:///dos/z/16 +wrap_text_default: 0 +bookmarks_filename_mode: 1 +ssearch_text: mapScrollRight +snr_casesens: 1 +view_blocks: 1 +name: project 16 +replacelist: てすと +replacelist: \t +replacelist: putPixel_X +replacelist: SCREEN_WIDTH +replacelist: SCREEN_HEIGHT +fb_show_hidden_f: 0 +editor_tab_width: 4 +show_visible_spacing: 1 +view_statusbar: 1 +display_right_margin: 0 +c2e.IE_apos_workaround: 0 +outputb_scroll_mode: 0 +leftpanel_active_tab: 0 +enable_syntax_scan: 1 +ssearch_regex: 0 +e2c.convert_iso: 0 +ssearch_casesens: 0 +charmap_block: 1 +recent_files: file:///dos/z/16/16/lib/x/MXPN.ASM +recent_files: file:///dos/z/4x4_16/!/c/TUT10.C +recent_files: file:///dos/z/16/16/lib/x/MXVS.ASM +recent_files: file:///dos/z/16/16/lib/x/MAKEFILE +recent_files: file:///dos/z/16/16/lib/x/MODEX.DEF +recent_files: file:///dos/z/4x4_16/modex/DEMO01.PAS +recent_files: file:///dos/z/16/16/lib/x/MXCR.ASM +recent_files: file:///dos/z/4x4_16/modex/DEMO07.PAS +recent_files: file:///dos/z/16/16/scrasm/MAIN.ASM +recent_files: file:///dos/z/16/16/lib/x/MXBB.ASM +recent_files: file:///dos/z/16/src/lib/dos_gfx.h +recent_files: file:///dos/z/16/16/lib/intro/lib.c +recent_files: file:///dos/z/16/src/lib/dos_gfx.cpp +recent_files: file:///dos/z/16/16/modex16/MODEX16.H +recent_files: file:///dos/z/16/16/modex16/MODEX16.C +recent_files: file:///dos/z/4x4_16/w_modex/MODEX.CPP +recent_files: file:///dos/z/16/16/TYPES.H +recent_files: file:///dos/z/16/16/lib/TYPES.H +recent_files: file:///dos/z/16/16/test.c +recent_files: file:///dos/z/16/16/MODEX16.H +recent_files: file:///dos/z/16/16/MODEX16.C +recent_files: file:///dos/z/16/16/lib/types.h +recent_files: file:///dos/z/16/16/modex16/PCXTEST.C +recent_files: file:///dos/z/16/16/lib/MODEX16.C +recent_files: file:///dos/z/16/16/lib/MODEX16.H +recent_files: file:///dos/z/16/16/modex16/SCROLL.C +recent_files: file:///dos/z/16/src/lib/dos_comm.c +recent_files: file:///dos/z/16/src/eng_comm.cpp +recent_files: file:///dos/z/16/src/eng_comm.h +recent_files: file:///dos/z/16/src/lib/dos_comm.h +recent_files: file:///dos/z/16/16/modex16/lib/lib_com.h +recent_files: file:///dos/z/16/16/modex16/lib/lib_com.cpp +recent_files: file:///dos/z/16/16/modex16/modex16.h +recent_files: file:///dos/z/16/16/modex16/scroll.c +recent_files: file:///dos/z/16/16/modex16/dos_kb.c +recent_files: file:///dos/z/16/16/dos_gfx.cpp +recent_files: file:///dos/z/16/16/dos_gfx.h +recent_files: file:///dos/z/16/16/modex16/makefile +recent_files: file:///dos/z/16/16/dos_kb.c +recent_files: file:///dos/z/16/16/TEST.C +recent_files: file:///dos/z/16/16/dos_kb.h +recent_files: file:///dos/z/16/16/lib/lib_com.cpp +recent_files: file:///dos/z/16/16/lib/lib_com.h +recent_files: file:///dos/z/16/16/16.txt +recent_files: file:///dos/z/16/16/lib/x/MODEX.H +recent_files: file:///dos/z/16/16/modex16/dos_kb.h +recent_files: file:///dos/z/16/doc/16.16 +recent_files: file:///dos/z/16/doc/16story.txt +recent_files: file:///dos/z/16/doc/project.txt +recent_files: file:///dos/z/16/scroll.c +snr_replacetype: 0 +savedir: file:///dos/z/16/16/modex16 +spell_check_default: 1 +spell_insert_entities: 0 +last_filefilter: +htmlbar_notebooktab: 0 +view_blockstack: 1 +snr_escape_chars: 0 +htmlbar_view: 0 +spell_lang: en +ssearch_dotmatchall: 0 +searchlist: QUADWH +searchlist: pdump +searchlist: #include "modex16.h"\r\n#include \r\n\r\nword far* clock= (word far*) 0x046C; /* 18.2hz clock */\r\n\r\nvoid main() {\r\n#include "modex16.h"\r\n#include \r\n\r\nword far* clock= (word far*) 0x046C; /* 18.2hz clock */\r\n\r\nvoid main() {\r\n +searchlist: extern +searchlist: VGA +searchlist: vga +searchlist: clock +searchlist: setvideo +searchlist: gq +searchlist: SC_INDEX +searchlist: draw +searchlist: int index +searchlist: map.dat +searchlist: 32 +searchlist: mapScrollRight +autocomplete: 1 +outputb_show_all_output: 0 +bookmarks_show_mode: 0 +snippets_show_as_menu: 1 +adv_open_recursive: 0 +encoding: SHIFT_JIS +e2c.convert_special: 0 +autoindent: 1 +fb_viewmode: 0 +filegloblist: *.txt +filegloblist: *.shtml +filegloblist: *.py +filegloblist: *.pl +filegloblist: *.php +filegloblist: *.js +filegloblist: *.java +filegloblist: *.htm +filegloblist: *.html +filegloblist: *.h +filegloblist: *.css +filegloblist: *.cpp +filegloblist: *.cgi +filegloblist: *.c +filegloblist: * +recent_dirs: file:///dos/z/16/16 +fb_focus_follow: 1 +ssearch_unescape: 0 +c2e.convert_symbol: 0 +snr_dotmatchall: 0 +c2e.convert_xml: 1 +editor_indent_wspaces: 0 +view_cline: 0 +snr_type: 0 +snr_scope: 0 +bmarksearchmode: 0 +view_main_toolbar: 1 +e2c.convert_symbol: 0 diff --git a/README b/README index 6fc7aec4..42e5dfe9 100644 --- a/README +++ b/README @@ -1,14 +1,14 @@ Open watcom to compile the code of project 16 -/ = main engine code (branched off due to lack of understanding of C++) +/ = copy of pngwen's code 16/ = the current code sparky4 is working with -16/modex16/ = pngwen's code +16/modex16/ = pngwen's code archived TODO not in particular order~: almost done 1. SCROLLING!!!!!!! 2. Fix pngwen's pcx rendering code it dose not render large relolution pcx files well at all! -3. document an understrand how the main engine code works! -4. movement and player movement when reaching edge of map -5. sprite rendering +3. Erase player sprite when moving and tweak it +DONE 4. movement and player movement when reaching edge of map +DONE 5. sprite rendering 6. text box rendering 7. text rendering 8. map loading @@ -16,3 +16,5 @@ almost done 1. SCROLLING!!!!!!! 10. map and item interation 11. item inventory~ +To compile: +You need Open Watcom stable to compile and just run wmake \ No newline at end of file diff --git a/core16.map b/core16.map deleted file mode 100644 index a412a4b7..00000000 --- a/core16.map +++ /dev/null @@ -1,877 +0,0 @@ -Open Watcom Linker Version 1.9 -Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. -Created on: 14/02/24 12:05:08 -Executable Image: core16.exe -creating a DOS executable - - - +------------+ - | Groups | - +------------+ - -Group Address Size -===== ======= ==== - -DGROUP 0fd4:0000 000017b0 - - - - +--------------+ - | Segments | - +--------------+ - -Segment Class Group Address Size -======= ===== ===== ======= ==== - -main_TEXT CODE AUTO 0000:0000 000000de -timer_TEXT CODE AUTO 0000:00e0 000001b4 -eng_ai_TEXT CODE AUTO 0000:02a0 00000013 -eng_snd_TEXT CODE AUTO 0000:02c0 00000077 -eng_comm_TEXT CODE AUTO 0000:0340 00000035 -eng_core_TEXT CODE AUTO 0000:0380 0000067b -eng_gfx_TEXT CODE AUTO 0000:0a00 00000013 -dos_comm_TEXT CODE AUTO 0000:0a20 000002ab -dos_gfx_TEXT CODE AUTO 0000:0cd0 00001d7e -dos_opl2_TEXT CODE AUTO 0000:2a50 000004ae -lib_com_TEXT CODE AUTO 0000:2f00 00000063 -cppdata_TEXT CODE AUTO 0000:2f70 00000000 -fsregist_TEXT CODE AUTO 0000:2f70 000003c1 -undefed_TEXT CODE AUTO 0000:3340 00000013 -cstrt086_TEXT CODE AUTO 0000:3354 00000000 -_TEXT CODE AUTO 0000:3360 00008352 -cmodel_TEXT CODE AUTO 0000:b6b2 00000000 -fsroot_TEXT CODE AUTO 0000:b6c0 0000000b -iofefg_TEXT CODE AUTO 0000:b6d0 00000142 -_8087086_TEXT CODE AUTO 0000:b812 00000000 -manendl_TEXT CODE AUTO 0000:b820 00000020 -ioicout_TEXT CODE AUTO 0000:b840 000000a5 -ostincch_TEXT CODE AUTO 0000:b8f0 000000b4 -ostinomn_TEXT CODE AUTO 0000:b9b0 00000014 -stabdtor_TEXT CODE AUTO 0000:b9d0 000003d5 -stabdisp_TEXT CODE AUTO 0000:bdb0 00000349 -fatalerr_TEXT CODE AUTO 0000:c100 00000025 -crwd086_TEXT CODE AUTO 0000:c126 00000000 -seg086_TEXT CODE AUTO 0000:c126 00000000 -i4m_TEXT CODE AUTO 0000:c126 00000000 -i4d_TEXT CODE AUTO 0000:c126 00000000 -ini87086_TEXT CODE AUTO 0000:c126 00000000 -iofnoefg_TEXT CODE AUTO 0000:c130 00000014 -_i_fcvt__TEXT CODE AUTO 0000:c144 00000005 -ostput_TEXT CODE AUTO 0000:c150 000000e8 -ostflush_TEXT CODE AUTO 0000:c240 00000058 -sdfconfp_TEXT CODE AUTO 0000:c2a0 0000001e -stablcl_TEXT CODE AUTO 0000:c2c0 00000005 -ostconsf_TEXT CODE AUTO 0000:c2d0 00000105 -ostdestr_TEXT CODE AUTO 0000:c3e0 000000f4 -sdfdestr_TEXT CODE AUTO 0000:c4e0 000000f5 -moddtorr_TEXT CODE AUTO 0000:c5e0 00000000 -ostopfx_TEXT CODE AUTO 0000:c5e0 00000072 -iouwrtit_TEXT CODE AUTO 0000:c660 0000034a -iossetst_TEXT CODE AUTO 0000:c9b0 00000071 -stabtrav_TEXT CODE AUTO 0000:ca30 000001f3 -callterm_TEXT CODE AUTO 0000:cc30 0000004f -allocexc_TEXT CODE AUTO 0000:cc80 000004be -stabadt_TEXT CODE AUTO 0000:d140 00000127 -tsequiv_TEXT CODE AUTO 0000:d270 00000191 -xiyi_TEXT CODE AUTO 0000:d402 00000000 -pure_err_TEXT CODE AUTO 0000:d410 00000028 -vfun_err_TEXT CODE AUTO 0000:d440 00000028 -stfconde_TEXT CODE AUTO 0000:d470 0000006e -stfdsgtn_TEXT CODE AUTO 0000:d4e0 00000088 -stfdspun_TEXT CODE AUTO 0000:d570 000000ce -stfpbfai_TEXT CODE AUTO 0000:d640 00000004 -sdfoverf_TEXT CODE AUTO 0000:d650 0000021a -sdfundrf_TEXT CODE AUTO 0000:d870 00000190 -stfsbuf_TEXT CODE AUTO 0000:da00 00000082 -stfseeko_TEXT CODE AUTO 0000:da90 0000000c -stfseekp_TEXT CODE AUTO 0000:daa0 00000022 -sdfsync_TEXT CODE AUTO 0000:dad0 0000002e -stfdoall_TEXT CODE AUTO 0000:db00 00000040 -stabmod_TEXT CODE AUTO 0000:db40 0000007a -iosinit_TEXT CODE AUTO 0000:dbc0 00000062 -iosconde_TEXT CODE AUTO 0000:dc30 00000012 -iosdestr_TEXT CODE AUTO 0000:dc50 000000b2 -opdel_TEXT CODE AUTO 0000:dd10 0000000e -dtorarst_TEXT CODE AUTO 0000:dd20 0000002f -opdelarr_TEXT CODE AUTO 0000:dd50 00000005 -stfdestr_TEXT CODE AUTO 0000:dd60 0000002e -opnewarr_TEXT CODE AUTO 0000:dd90 00000005 -iosfail_TEXT CODE AUTO 0000:dda0 0000000a -stabthrw_TEXT CODE AUTO 0000:ddb0 00000da5 -dointr_TEXT CODE AUTO 0000:eb56 00000000 -bittest_TEXT CODE AUTO 0000:eb60 00000047 -termnate_TEXT CODE AUTO 0000:ebb0 00000051 -exc_pr_TEXT CODE AUTO 0000:ec10 000001bd -areaexc_TEXT CODE AUTO 0000:edd0 00000000 -tssize_TEXT CODE AUTO 0000:edd0 00000053 -bufld086_TEXT CODE AUTO 0000:ee24 00000000 -fpe87_TEXT CODE AUTO 0000:ee24 00000000 -prwdata_TEXT CODE AUTO 0000:ee30 00000000 -stfsetb_TEXT CODE AUTO 0000:ee30 0000008a -ioufrxal_TEXT CODE AUTO 0000:eec0 00000034 -opnew_TEXT CODE AUTO 0000:ef00 0000007a -unexpect_TEXT CODE AUTO 0000:ef80 000000c0 -stjmp086_TEXT CODE AUTO 0000:f040 00000000 -stabinit_TEXT CODE AUTO 0000:f040 00000104 -ljmpinit_TEXT CODE AUTO 0000:f150 00000016 -file086_TEXT CODE AUTO 0000:f166 00000000 -ljmpdtor_TEXT CODE AUTO 0000:f170 000000a5 -error086_TEXT CODE AUTO 0000:f216 00000000 -stfsync_TEXT CODE AUTO 0000:f220 00000022 -main_DATA1 FAR_CONST AUTO 0f25:0000 00000026 -eng_core_DATA1 FAR_CONST AUTO 0f27:0006 00000014 -eng_core_DATA2 FAR_CONST AUTO 0f27:001a 000000f2 -dos_gfx_DATA1 FAR_CONST AUTO 0f27:010c 0000004b -dos_opl2_DATA1 FAR_CONST AUTO 0f27:0157 00000016 -undefed_DATA1 FAR_CONST AUTO 0f27:016d 0000002c -iofefg_DATA1 FAR_CONST AUTO 0f40:000a 00000000 -manendl_DATA1 FAR_CONST AUTO 0f40:000a 00000000 -ioicout_DATA1 FAR_CONST AUTO 0f41:0000 00000076 -ostincch_DATA1 FAR_CONST AUTO 0f48:0006 00000000 -ostinomn_DATA1 FAR_CONST AUTO 0f48:0006 00000000 -iofnoefg_DATA1 FAR_CONST AUTO 0f48:0006 00000000 -iofnoefg_DATA1 FAR_CONST AUTO 0f48:0006 00000028 -ostput_DATA1 FAR_CONST AUTO 0f4a:000e 00000000 -ostflush_DATA1 FAR_CONST AUTO 0f4a:000e 00000000 -sdfconfp_DATA1 FAR_CONST AUTO 0f4a:000e 00000044 -ostconsf_DATA1 FAR_CONST AUTO 0f4a:0052 00000040 -ostdestr_DATA1 FAR_CONST AUTO 0f54:0000 00000034 -sdfdestr_DATA1 FAR_CONST AUTO 0f54:0040 0000002c -ostopfx_DATA1 FAR_CONST AUTO 0f5a:000c 00000000 -iouwrtit_DATA1 FAR_CONST AUTO 0f5a:000c 00000000 -iossetst_DATA1 FAR_CONST AUTO 0f5b:0000 00000056 -callterm_DATA1 FAR_CONST AUTO 0f60:0006 00000041 -allocexc_DATA1 FAR_CONST AUTO 0f65:0000 00000046 -allocexc_DATA2 FAR_CONST AUTO 0f69:0006 0000002b -stabadt_DATA1 FAR_CONST AUTO 0f6d:0000 00000026 -pure_err_DATA1 FAR_CONST AUTO 0f6f:0006 0000001e -vfun_err_DATA1 FAR_CONST AUTO 0f6f:0024 00000032 -stfconde_DATA1 FAR_CONST AUTO 0f74:0006 0000003a -stfdsgtn_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -stfdspun_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -stfpbfai_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -sdfoverf_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -sdfundrf_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -stfsbuf_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -stfseeko_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -stfseekp_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -sdfsync_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -stfdoall_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -iosinit_DATA1 FAR_CONST AUTO 0f74:0040 00000000 -iosconde_DATA1 FAR_CONST AUTO 0f74:0040 00000012 -iosdestr_DATA1 FAR_CONST AUTO 0f7a:0000 00000036 -opdel_DATA1 FAR_CONST AUTO 0f7a:0040 00000000 -opdelarr_DATA1 FAR_CONST AUTO 0f7a:0040 00000000 -stfdestr_DATA1 FAR_CONST AUTO 0f7e:0000 00000000 -opnewarr_DATA1 FAR_CONST AUTO 0f7e:0000 00000000 -iosfail_DATA1 FAR_CONST AUTO 0f7e:0000 00000000 -stabthrw_DATA1 FAR_CONST AUTO 0f7e:0000 000001da -stabthrw_DATA2 FAR_CONST AUTO 0f9b:000a 000001c7 -termnate_DATA1 FAR_CONST AUTO 0f9b:01d1 00000022 -stfsetb_DATA1 FAR_CONST AUTO 0fba:0004 00000000 -ioufrxal_DATA1 FAR_CONST AUTO 0fba:0004 00000000 -opnew_DATA1 FAR_CONST AUTO 0fbb:0000 00000000 -unexpect_DATA1 FAR_CONST AUTO 0fbb:0000 0000000a -unexpect_DATA2 FAR_CONST AUTO 0fbb:000a 00000023 -stfsync_DATA1 FAR_CONST AUTO 0fbd:000e 00000000 -main_DATA2 FAR_DATA AUTO 0fbd:000e 00000014 -FAR_DATA FAR_DATA AUTO 0fbd:0022 00000000 -ioicout_DATA1 FAR_DATA AUTO 0fbd:0022 00000063 -sdfconfp_DATA1 FAR_DATA AUTO 0fbd:0085 00000016 -ostconsf_DATA1 FAR_DATA AUTO 0fbd:009b 00000010 -ostdestr_DATA1 FAR_DATA AUTO 0fbd:00ab 00000000 -sdfdestr_DATA1 FAR_DATA AUTO 0fbd:00ab 00000000 -iossetst_DATA1 FAR_DATA AUTO 0fbd:00ab 00000033 -allocexc_DATA3 FAR_DATA AUTO 0fbd:00de 00000014 -stabadt_DATA2 FAR_DATA AUTO 0fbd:00f2 00000011 -stfconde_DATA1 FAR_DATA AUTO 0fbd:0103 00000000 -iosconde_DATA1 FAR_DATA AUTO 0fbd:0103 00000000 -iosdestr_DATA1 FAR_DATA AUTO 0fbd:0103 00000000 -stfdestr_DATA1 FAR_DATA AUTO 0fbd:0103 00000000 -stabthrw_DATA3 FAR_DATA AUTO 0fbd:0103 00000068 -unexpect_DATA3 FAR_DATA AUTO 0fbd:016b 00000000 -_NULL BEGDATA DGROUP 0fd4:0000 00000020 -_AFTERNULL BEGDATA DGROUP 0fd6:0000 00000002 -CONST DATA DGROUP 0fd6:0002 000000f0 -CONST2 DATA DGROUP 0fe5:0002 00000132 -_DATA DATA DGROUP 0ff9:0000 000007e2 -STRINGS DATA DGROUP 1077:0002 00000000 -XIB DATA DGROUP 1077:0002 00000000 -XI DATA DGROUP 1077:0002 0000004e -XIE DATA DGROUP 107c:0000 00000000 -YIB DATA DGROUP 107c:0000 00000000 -YI DATA DGROUP 107c:0000 00000012 -YIE DATA DGROUP 107d:0002 00000000 -DATA DATA DGROUP 107d:0002 00000000 -_emu_init_start EMU DGROUP 107d:0002 00000000 -_emu_init_end EMU DGROUP 107d:0002 00000000 -_BSS BSS DGROUP 107e:0000 00000506 -STACK STACK DGROUP 10cf:0000 00000800 - - - +----------------+ - | Memory Map | - +----------------+ - -* = unreferenced symbol -+ = symbol only referenced locally - -Address Symbol -======= ====== - -Module: main.obj(C:\Z\16\src\main.cpp) -0000:0000 main_ -Module: timer.obj(C:\Z\16\src\timer.cpp) -0000:00e0 far engine::Timer::Timer() -0000:010c long unsigned far engine::Timer::start_timer() -0000:0150 double far engine::Timer::elapsed_timer() -0000:01a6+ double far engine::Timer::time_in_seconds() -0000:01f0+ double far engine::Timer::time_in_seconds( long unsigned ) -0000:0238+ long unsigned far engine::Timer::_time() -0000:0268 far engine::Timer::~Timer() -Module: eng_ai.obj(C:\Z\16\src\eng_ai.cpp) -0000:02a0 void far engine::do_artificial_intelligence() -Module: eng_snd.obj(C:\Z\16\src\eng_snd.cpp) -0000:02c0 void far engine::do_sound() -Module: eng_comm.obj(C:\Z\16\src\eng_comm.cpp) -0000:0340 __anonymous_enum far engine::do_communication() -Module: eng_core.obj(C:\Z\16\src\eng_core.cpp) -0000:0380 far engine::Core::Core() -0000:0490+ void far engine::Core::update() -0000:0500+ void far engine::Core::sound() -0000:051e+ void far engine::Core::graphics() -0000:053c+ void far engine::Core::comm() -0000:0560+ void far engine::Core::ai() -0000:057e+ __anonymous_enum far engine::Core::_msg() -0000:05a2 void far engine::Core::run() -0000:05ea+ bool far engine::Core::init() -0000:08ca+ void far engine::Core::release() -0000:08f6+ void far engine::Core::input() -0000:0916+ void far engine::Core::sync() -0000:09ae far engine::Core::~Core() -Module: eng_gfx.obj(C:\Z\16\src\eng_gfx.cpp) -0000:0a00 void far engine::do_graphics() -Module: dos_comm.obj(C:\Z\16\src\lib\dos_comm.c) -0000:0a20+ newkb_ -0000:0b00 setkb_ -0000:0c7c keyp_ -Module: dos_gfx.obj(C:\Z\16\src\lib\dos_gfx.cpp) -0000:0cd0+ void far setvideo( char unsigned, int ) -0000:0d6e+ void far setvbuff( int ) -0000:0e02+ void far updatevbuff() -0000:0e44+ void far cls( char unsigned, char unsigned far * ) -0000:0e7e+ void far clearscr() -0000:0ebc+ void far plotpixel( int, int, char unsigned, char unsigned far * ) -0000:0f0a+ void far ppf( int, int, char unsigned, char unsigned far * ) -0000:0f4a+ void far BlockMove() -0000:1046+ void far eraseplayer( int, int ) -0000:1098+ void far drawplayer( int, int, int ) -0000:10ec+ int far colortest() -0000:113e+ int far colorz() -0000:1190+ void far ssd( int ) -0000:1232+ void far pdump( int ) -0000:1328+ void far tulip() -0000:273a+ int far ding( int ) -0fd4:0254+ char unsigned far * far vga -0fd4:0258+ int far gq -0fd4:0ba6+ char unsigned far * far vaddr -0fd4:0baa+ int far old_mode -0fd4:0bac+ int far q -0fd4:0bae+ int far bakax -0fd4:0bb0+ int far bakay -0fd4:0bb2+ int far xx -0fd4:0bb4+ int far yy -0fd4:0bb6+ int far sx -0fd4:0bb8+ int far sy -0fd4:0bba+ char unsigned far coor -Module: dos_opl2.obj(C:\Z\16\src\lib\dos_opl2.cpp) -0000:2a50+ void far WriteFM( int, int ) -0000:2ab2+ int far ReadFM() -0000:2ad6 int far AdlibExists() -0000:2b70 void far FMReset() -0000:2bc4 void far FMKeyOff( int ) -0000:2bfc void far FMKeyOn( int, int, int ) -0000:2c62+ void far FMVoiceVolume( int, int ) -0000:2c94+ void far FMSetVoice( int, __5rfh0rFMInstrument far * ) -0fd4:026c+ short unsigned far Notes[] -0000:2dfc void far fmtest() -0000:2eae+ int far soundtest() -0fd4:0bbc+ int far sq -Module: lib_com.obj(C:\Z\16\src\lib\lib_com.cpp) -0000:2f00 void far wait( long unsigned ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(cppdata) -0fd4:0bbe __wint_thread_data -0fd4:0be2 __compiled_under_generic -Module: c:\fdos\WATCOM/lib286\plbxl.lib(fsregist) -0000:2f70+ __wcpp_4_dispatch_dummy__ -0000:2faa __wcpp_4_fs_lookup__ -0000:30da __wcpp_4_fs_handler_rtn__ -0000:3264 __wcpp_4_unwind_global__ -0000:32dc __wcpp_4_raise_exception__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(undefed) -0000:3340 __wcpp_4_undefed_cdtor__ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(cstart) -0fd4:0000* __nullarea -0fd4:02a6* __ovlflag -0fd4:02a7* __intno -0fd4:02a8* __ovlvec -0000:3360 _cstart_ -0000:3437* _Not_Enough_Memory_ -0000:354a __exit_ -0000:3569 __do_exit_with_msg__ -0000:35bc __GETDS -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(cmodel) -0000:35c6 _big_code_ -0000:35c6* CodeModelMismatch -Module: c:\fdos\WATCOM/lib286\plbxl.lib(fsroot) -0fd4:0a32 ___wcpp_4_data_init_fs_root_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(clockdos) -0000:35c6+ __ibm_bios_get_ticks_ -0000:363c clock_ -Module: c:\fdos\WATCOM/lib286/dos\emu87.lib(initemu) -0000:8000 FJSRQQ -0000:0632 FISRQQ -0000:1632* FIERQQ -0000:5c32 FIDRQQ -0000:a23d FIWRQQ -0000:c000 FJCRQQ -0000:4000* FJARQQ -0000:0e32 FICRQQ -0000:fe32* FIARQQ -0000:369c __init_87_emulator -0000:372d* __fini_87_emulator -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fltused) -0fd4:02dc _fltused_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(iofefg) -0000:b720 std::istream far & far operator >>( std::istream far &, smanip const far & ) -0000:b760 std::istream far & far operator >>( std::istream far &, smanip const far & ) -0000:b7a0 std::ostream far & far operator <<( std::ostream far &, smanip const far & ) -0000:b7e0 std::ostream far & far operator <<( std::ostream far &, smanip const far & ) -0fd4:0a4a __ppfltused_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(_8087) -0fd4:02de __8087 -0fd4:02df __real87 -0fd4:02e0 __dos87emucall -0fd4:02e2 __dos87real -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(sound) -0000:37a4 sound_ -0000:3840 nosound_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(delay) -0000:3860 delay_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(manendl) -0000:b820 std::ostream far & far std::endl( std::ostream far & ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ioicout) -0fd4:0c28 std::ostream near std::cout -0000:b89e+ far cout_initfini::cout_initfini() -0000:b8ac+ far cout_initfini::~cout_initfini() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ostincch) -0000:b8f0 std::ostream far & far std::ostream::operator <<( char const far * ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ostinomn) -0000:b9b0 std::ostream far & far std::ostream::operator <<( std::ostream far & (far *)()) -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(inp) -0000:39bf inp_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(outp) -0000:39c7 outp_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(printf) -0000:39d1 printf_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(d_setvec) -0000:3a00 _dos_setvect_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(d_getvec) -0000:3a0d _dos_getvect_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(intx086) -0000:3a18+ int86x_ -0000:3ab2 int86_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(ffree) -0000:3adf* _ffree_ -0000:3adf free_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(calloc) -0000:3b25 calloc_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(exit) -0000:3b68+ __null_int23_exit_ -0000:3b69 exit_ -0000:3b9a* _exit_ -0fd4:02e4+ ___int23_exit -0fd4:02e8 ___FPE_handler_exit -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(rand) -0000:3bba rand_ -0000:3bfc* srand_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(kbhit) -0000:3c20 kbhit_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stabdtor) -0000:bd58 __wcpp_4_destruct_internal__ -0000:bd76* __wcpp_4_destruct_all__ -0000:bd78* __wcpp_4_destruct__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stabdisp) -0000:c086 __wcpp_4_dispatchable__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(fatalerr) -0000:c100 __wcpp_4_fatal_runtime_error__ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(cmain086) -0000:3c36 __CMain -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(initrtns) -0000:3c9c __InitRtns -0000:3c9c* __FInitRtns -0000:3cf7 __FiniRtns -0000:3cf7* __FFiniRtns -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(xmsg) -0000:3d5b __exit_with_msg_ -0000:3d60 __fatal_runtime_error_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(crwdata) -0fd4:02f0 __curbrk -0fd4:02f8 __STACKLOW -0fd4:02fa __STACKTOP -0fd4:02fc __cbyte -0fd4:02fe __child -0fd4:0300 __no87 -0fd4:030e ___FPE_handler -0fd4:02f2 __psp -0fd4:0302 __get_ovl_stack -0fd4:0306 __restore_ovl_stack -0fd4:030a __close_ovl_file -0fd4:0312 __LpCmdLine -0fd4:0316 __LpPgmName -0fd4:02f4 __osmajor -0fd4:02f5 __osminor -0fd4:02f6 __osmode -0fd4:02f7 __HShift -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(dosseg) -0000:3d7e __DOSseg__ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(i4m) -0000:3d80 __I4M -0000:3d80 __U4M -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(i4d) -0000:3d98 __I4D -0000:3de7 __U4D -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(init8087) -0000:3e6c __init_8087_emu -0000:3e72 __x87id -Module: c:\fdos\WATCOM/lib286/dos\emu87.lib(emu8087) -0000:3fc2 __int34 -0000:3fff __int3c -Module: c:\fdos\WATCOM/lib286/dos\emu87.lib(dosinit) -0000:68ea ___dos87emucall -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(setefg) -0000:6928 __setEFGfmt_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(iofnoefg) -0fd4:0384 void (far * far __EFG_cnvs2d)( char far *, double far * ) -0fd4:0388 int (far * far __EFG_cnvd2f)( double far *, float far * ) -0fd4:038c void (far * far __EFG_LDcvt)( __g4aa8long_double far *, cvt_info far *, char far * ) -0fd4:0390 char far * (far * far __EFG_fcvt)( double, int, int far *, int far * ) -0fd4:0394 void (far * far __EFG__FDLD)( double near *, __g4aa8long_double near * ) -Module: c:\fdos\WATCOM/lib286\math87l.lib(cnvs2d) -0000:6946 __cnvs2d_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(cnvd2f) -0000:6985 __cnvd2f_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(ldcvt) -0000:6b5f _LDScale10x_ -0000:70ce __LDcvt_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(_i_fcvt_) -0000:c144 _fcvt_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(cnvd2ld) -0000:7601 __cnvd2ld_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(chk8087) -0000:7632* _fpreset_ -0000:765d __init_8087_ -0000:7690+ __default_sigfpe_handler_ -0000:76a3 __chk8087_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(nonibm) -0000:7715+ __is_nonIBM_ -0fd4:0424 ___NonIBM -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ostput) -0000:c150 std::ostream far & far std::ostream::put( char ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ostflush) -0000:c240 std::ostream far & far std::ostream::flush() -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(iobaddr) -0000:775c __get_std_stream_ -0000:775c* __get_std_file_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(sdfconfp) -0000:c2a0 far stdiobuf::stdiobuf( __iobuf far * ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stablcl) -0000:c2c0 __wcpp_4_lcl_register__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ostconsf) -0000:c2d0 far std::ostream::ostream( std::streambuf far * ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ostdestr) -0000:c3e0 far std::ostream::~ostream() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(sdfdestr) -0000:c4e0 far stdiobuf::~stdiobuf() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(moddtorr) -0fd4:0a86 ___wcpp_4_data_module_dtor_ref_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ostopfx) -0000:c5e0 int far std::ostream::do_opfx() -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(strlen) -0000:777a strlen_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(iouwrtit) -0000:c660 int far __WATCOM_ios::writeitem( std::ostream far &, char const far *, int, int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(iossetst) -0000:c9f0+ far std::ios::failure::failure( std::ios::failure const far & ) -0000:ca00+ far std::ios::failure::~failure() -0000:ca10+ far __WATCOM_exception::__WATCOM_exception( __WATCOM_exception const far & ) -0000:ca20+ far __WATCOM_exception::~__WATCOM_exception() -0000:c9b0 void far std::ios::setstate( int ) -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(iob) -0fd4:0426 ___iob -0fd4:058e* __fmode -0fd4:0c56 ___OpenStreams -0fd4:0c5a ___ClosedStreams -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fprtf) -0000:77a9 __fprtf_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(intr) -0000:7874 intr_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(segread) -0000:7888 segread_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(nmalloc) -0000:78a8 _nmalloc_ -0fd4:0590 ___nheapbeg -0fd4:0592 ___MiniHeapRover -0fd4:0594 ___LargestSizeB4MiniHeapRover -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(mem) -0000:7980 __MemAllocator -0000:7a4a __MemFree -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fmalloc) -0000:7ba7* _fmalloc_ -0000:7ba7 malloc_ -0fd4:0596+ ___fheap -0fd4:0598 ___fheapRover -0fd4:059a ___LargestSizeB4Rover -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(nfree) -0000:7cb5 _nfree_ -0fd4:0c5e+ ___MiniHeapFreeRover -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stabtrav) -0000:ca30 __wcpp_4_stab_entry__ -0000:ca4a* __wcpp_4_stab_trav_comp__ -0000:cb70 __wcpp_4_stab_trav_init__ -0000:cb9e __wcpp_4_stab_trav_next__ -0000:cc14 __wcpp_4_stab_trav_move__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(callterm) -0000:cc30 __wcpp_4_corrupted_stack__ -0000:cc48 __wcpp_4_call_terminate__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(allocexc) -0000:cc92 __wcpp_4_alloc_exc__ -0000:cf52 __wcpp_4_free_exc__ -0000:cfc6 __wcpp_4_find_active__ -0000:d030 __wcpp_4_dtor_free_exc__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stabadt) -0000:d140+ void far * far dtor_the_array( _RTARCTOR far * ) -0000:d1b0+ far _RTARCTOR::~_RTARCTOR() -0000:d1d0 __wcpp_4_dtor_array__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(tsequiv) -0000:d270 __wcpp_4_ts_refed__ -0000:d290+ __wcpp_4_ts_pnted__ -0000:d2ba __wcpp_4_ts_equiv__ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(enterdb) -0000:7db0 __EnterWVIDEO_ -0fd4:059c+ ___WD_Present -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(___argc) -0fd4:0c60 ____Argv -0fd4:0c64 ____Argc -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(amblksiz) -0fd4:059e __amblksiz -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(sgdef086) -0fd4:0a32 __Start_XI -0fd4:0a80 __End_XI -0fd4:0a80 __Start_YI -0fd4:0a92 __End_YI -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(8087cw) -0fd4:05a0 __8087cw -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(noefgfmt) -0fd4:05a2 ___EFG_printf -0fd4:05a6 ___EFG_scanf -Module: c:\fdos\WATCOM/lib286\math87l.lib(efgfmt) -0000:7de7 _EFG_Format_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(strtod) -0000:84f0+ __Strtold_ -0000:869f strtod_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(ldclass) -0000:884b __LDClass_ -0000:8899* _FLClass_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(efcvt) -0000:88f6* ecvt_ -0000:8930 fcvt_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(save8087) -0fd4:05aa ___Save8087 -0fd4:05ae ___Rest8087 -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(grabfp87) -0000:8973 __GrabFP87_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(pure_err) -0000:d410 __wcpp_4_pure_error__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(vfun_err) -0000:d440 __wcpp_4_undef_vfun__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfconde) -0000:d470 far std::streambuf::streambuf() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfdsgtn) -0000:d4e0 int far std::streambuf::do_sgetn( char far *, int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfdspun) -0000:d570 int far std::streambuf::do_sputn( char const far *, int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfpbfai) -0000:d640 int far std::streambuf::pbackfail( int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(sdfoverf) -0000:d650 int far stdiobuf::overflow( int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(sdfundrf) -0000:d870 int far stdiobuf::underflow() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfsbuf) -0000:da00 std::streambuf far * far std::streambuf::setbuf( char far *, int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfseeko) -0000:da90 long far std::streambuf::seekoff( long, int, int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfseekp) -0000:daa0 long far std::streambuf::seekpos( long, int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(sdfsync) -0000:dad0 int far stdiobuf::sync() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfdoall) -0000:db00 int far std::streambuf::doallocate() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stabmod) -0000:db40 __wcpp_4_module_dtor__ -0000:db96 __wcpp_4_mod_register__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(iosinit) -0000:dbc0 void far std::ios::init( std::streambuf far * ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(iosconde) -0000:dc30 far std::ios::ios() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(iosdestr) -0000:dc50 far std::ios::~ios() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(opdel) -0000:dd10 void far operator delete( void far * ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(dtorarst) -0000:dd20 __wcpp_4_dtor_array_store__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(opdelarr) -0000:dd50 void far operator delete []( void far * ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfdestr) -0000:dd60 far std::streambuf::~streambuf() -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(flush) -0000:89a5 __flush_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(memcpy) -0000:8ad8 memcpy_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(opnewarr) -0000:dd90 void far * far operator new []( int unsigned ) -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(memset) -0000:8afa memset_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(iosfail) -0000:dda0 far std::ios::failure::failure( int ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stabthrw) -0000:e740+ far std::exception::exception() -0000:e7a0+ far std::exception::exception( std::exception const far & ) -0000:e820+ far std::exception::exception( char const far * ) -0000:e880+ far std::exception::~exception() -0000:e920+ char const far * far std::exception::what() const -0000:e990+ far std::bad_exception::bad_exception() -0000:ea10+ far std::bad_exception::bad_exception( std::bad_exception const far & ) -0000:ea70+ far std::bad_exception::~bad_exception() -0000:e582* __wcpp_4_rethrow__ -0000:e5e4* __wcpp_4_catch_done__ -0000:e678 __wcpp_4_throw__ -0000:e6d6* __wcpp_4_throw_zero__ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(initfile) -0000:8b11 __InitFiles_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(ioexit) -0000:8c67* fcloseall_ -0000:8c6e __full_io_exit_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fputc) -0000:8c78 fputc_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(ioalloc) -0000:8d48 __ioalloc_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(prtf) -0000:8de3 __prtf_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(dointr) -0000:9c0c _DoINTR_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(nmemneed) -0000:9f85 __nmemneed_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(grownear) -0000:a00d __LastFree_ -0000:a08a __ExpandDGROUP_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(hpgrw086) -0000:a19b __CMain_nheapgrow_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(growseg) -0000:a1a0 __GrowSeg_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(allocseg) -0000:a292 __AllocSeg_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fmemneed) -0000:a329 __fmemneed_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(bittest) -0000:eb60 __wcpp_4_bit_test__ -0000:eb84 __wcpp_4_bit_off__ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(termnate) -0000:ebb0 void far std::terminate() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(exc_pr) -0000:ec10 far _EXC_PR::_EXC_PR( _RTCTL far *, RW_DTREG far *, EXCSTATE ) -0000:ec94 far _EXC_PR::~_EXC_PR() -0000:ecb4 far _EXC_PR_FREE::_EXC_PR_FREE( _RTCTL far *, RW_DTREG far *, EXCSTATE, ACTIVE_EXC far * ) -0000:ece2 far _EXC_PR_FREE::~_EXC_PR_FREE() -0000:ed24 far _EXC_PR_DTOR::_EXC_PR_DTOR( _RTCTL far *, RW_DTREG far *, EXCSTATE, ACTIVE_EXC far * ) -0000:ed46 far _EXC_PR_FNEXC::_EXC_PR_FNEXC( _RTCTL far *, RW_DTREG far *, RW_DTREG far *, ACTIVE_EXC far * ) -0000:ed94 far _EXC_PR_FNEXC::~_EXC_PR_FNEXC() -0000:ed98 far _EXC_PR_DTOR::~_EXC_PR_DTOR() -Module: c:\fdos\WATCOM/lib286\plbxl.lib(areaexc) -0fd4:05d0 ___EXC_AREA -Module: c:\fdos\WATCOM/lib286\plbxl.lib(tssize) -0000:ede2 __wcpp_4_ts_size__ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(strcmp) -0000:a32c strcmp_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(istable) -0fd4:0112 __IsTable -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(tolower) -0000:a354 tolower_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(bufld086) -0000:a362 __ZBuf2LD -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(seterrno) -0000:a42a __set_errno_ -0000:a43e* __set_EDOM_ -0000:a450 __set_ERANGE_ -0000:a462* __set_EINVAL_ -0000:a477 __set_doserrno_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(inf_nan) -0fd4:0214* ___f_infinity -0fd4:0218* ___f_posqnan -0fd4:021c ___d_infinity -0fd4:0224 ___d_posqnan -0fd4:022c* ___ld_infinity -0fd4:0234* ___ld_posqnan -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(hugeval) -0fd4:023c __HugeValue -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(cvtbuf) -0000:a483 __CVTBuffer_ -Module: c:\fdos\WATCOM/lib286\math87l.lib(cvt) -0000:a48a __cvt_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fpe87) -0000:a528 __Init_FPE_handler_ -0000:a561 __Fini_FPE_handler_ -0000:a598* __FPEHandler -Module: c:\fdos\WATCOM/lib286\plbxl.lib(prwdata) -0fd4:0e92 __wint_pure_error_flag -0fd4:0e94 __wint_undef_vfun_flag -0fd4:0e96 __wint_module_init -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fwrite) -0000:a825 fwrite_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fflush) -0000:aa20 fflush_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(memmove) -0000:aa35 memmove_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fgetc) -0000:aaab+ __fill_buffer_ -0000:ab7b+ __filbuf_ -0000:ab9f fgetc_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfsetb) -0000:ee30 void far std::streambuf::setb( char far *, char far *, int ) -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(liballoc) -0000:ac40 _plib_malloc_ -0000:ac45 _plib_free_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ioufrxal) -0000:eec0 void far __WATCOM_ios::free_xalloc_storage( std::ios far * ) -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(lseekdos) -0000:ac4a __lseek_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(qwrit) -0000:ac88 __qwrite_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fsync) -0000:ace5 fsync_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(opnew) -0000:ef00 void far * far operator new( int unsigned ) -Module: c:\fdos\WATCOM/lib286\plbxl.lib(unexpect) -0000:ef80 void far std::unexpected() -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(setjmp) -0000:acea* _setjmp_ -0000:ad3f longjmp_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stabinit) -0000:f040 __wcpp_4_exc_setup__ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(stack086) -0000:ad9c stackavail_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ljmpinit) -0fd4:0a6e ___wcpp_4_data_init_longjmp_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fclose) -0000:adaa+ __doclose_ -0000:ae5d __shutdown_stream_ -0000:ae77* fclose_ -0fd4:0e9a+ ___RmTmpFileFn -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(freefp) -0000:aec2 __freefp_ -0000:af3d __purgefp_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(chktty) -0000:af7e __chktty_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(wctomb) -0000:afa9 wctomb_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(itoa) -0000:afd2+ utoa_ -0000:b02f itoa_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(lltoa) -0000:b053 ulltoa_ -0000:b138* lltoa_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(strupr) -0000:b19a strupr_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(ltoa) -0000:b1bc ultoa_ -0000:b22b* ltoa_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(mbisdbcs) -0fd4:0e9e ___IsDBCS -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(mbislead) -0000:b25a* _ismbblead_ -0fd4:0ea0 ___MBCSIsTable -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(heapen) -0000:b276* _heapenable_ -0fd4:09e6 ___heap_enabled -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(sbrk) -0000:b287* sbrk_ -0000:b297 __brk_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(heapgrow) -0000:b301* _heapgrow_ -0000:b301* _fheapgrow_ -0000:b302 _nheapgrow_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(errno) -0000:b37c __get_errno_ptr_ -0000:b383 __get_doserrno_ptr_ -0fd4:0fa2+ _errno -0fd4:0fa4+ __doserrno -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(fpeint) -0fd4:09e8 ___FPE_int -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(flushall) -0000:b3a2 __flushall_ -0000:b3ff flushall_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(gtche) -0000:b404 getche_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(qread) -0000:b41e __qread_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(dosret) -0000:b43e* _dosretax_ -0000:b443* _dosret0_ -0000:b44a __set_errno_dos_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(iomode) -0000:b4a8 __GetIOMode_ -0000:b4cd __SetIOMode_nogrow_ -0fd4:09fe+ ___NFiles -0fd4:0a00+ ___init_mode -0fd4:0a28+ ___io_mode -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(dosfile) -0000:b4f0* _dos_close_ -0000:b4fe _dos_commit_ -0000:b50d* _dos_open_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(ljmphdl) -0fd4:0a2c ___longjmp_handler -Module: c:\fdos\WATCOM/lib286\plbxl.lib(ljmpdtor) -0000:f20e __wcpp_4_lj_handler__ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(_clse) -0000:b533 __close_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(isatt) -0000:b566 isatty_ -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(alphabet) -0fd4:00ec ___Alphabet -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(mbinit) -0000:b5c4 __mbinit_ -0fd4:0a30+ ___MBCodePage -Module: c:\fdos\WATCOM/lib286/dos\clibl.lib(doserror) -0000:b6a0 __doserror_ -Module: c:\fdos\WATCOM/lib286\plbxl.lib(stfsync) -0000:f220 int far std::streambuf::sync() - - - +--------------------+ - | Libraries Used | - +--------------------+ - -c:\fdos\WATCOM/lib286/dos\clibl.lib -c:\fdos\WATCOM/lib286\plbxl.lib -c:\fdos\WATCOM/lib286\math87l.lib -c:\fdos\WATCOM/lib286/dos\emu87.lib - - - +-----------------------+ - | Linker Statistics | - +-----------------------+ - -Stack size: 0800 (2048.) -Memory size: 000114f0 (70896.) -Entry point address: 0000:3360 -Link time: 00:01.73 diff --git a/16/project16.txt b/doc/project16.txt similarity index 100% rename from 16/project16.txt rename to doc/project16.txt diff --git a/16/scroll.txt b/doc/scroll.txt similarity index 100% rename from 16/scroll.txt rename to doc/scroll.txt diff --git a/src/lib/dos_comm.c b/dos_kb.c similarity index 78% rename from src/lib/dos_comm.c rename to dos_kb.c index e451b621..dd924189 100644 --- a/src/lib/dos_comm.c +++ b/dos_kb.c @@ -1,56 +1,67 @@ /* Thanks to Alex Russell for example code */ -/* Thanks to Gary Neal for example code */ -#include "src\lib\dos_comm.h" +/* Thanks to Gary Neal for example code */ +#include "dos_kb.h" // keyboard buffer static byte key[NUM_SCANCODES]; // pressed static byte kea[NUM_SCANCODES]; // released -#ifdef __cplusplus /* Function must be declared C style */ -extern "C" { +#ifdef __cplusplus /* Function must be declared C style */ +extern "C" { #endif static void interrupt (far *oldkb)(void) = NULL; /* BIOS keyboard handler */ -#ifdef __cplusplus -} -#endif -/*****************NEW KEYBOARD 09h ISR***********************/ +#ifdef __cplusplus +} +#endif + +/* + * Comment out the following #define if you don't want the testing main() + * to be included. + */ +//#define TESTING +#define TESTING2 + +/*****************NEW KEYBOARD 09h ISR***********************/ void interrupt newkb(void){ byte kee; - register char qx; + register char qx; kee = inp(0x60); /* Read the keyboard scan code */ - /* Clear keyboard controller on XT machines */ - qx = inp(0x61); /* Get keyboard control register */ - qx |= 0x82; - outp(0x61, qx); /* Toggle acknowledge bit high */ - qx &= 0x7F; - outp(0x61, qx); /* Toggle acknowledge bit low */ + /* Clear keyboard controller on XT machines */ + qx = inp(0x61); /* Get keyboard control register */ + qx |= 0x82; + outp(0x61, qx); /* Toggle acknowledge bit high */ + qx &= 0x7F; + outp(0x61, qx); /* Toggle acknowledge bit low */ /* Interpret the scan code and set our flags */ -//tt - printf("%d[%d]\n",kee,key[kee]); - if(kee & 0x80) - key[kee & 0x7F] = 0; // a key is released - else + #ifdef TESTING2 + //printf("%d[%d]\n",kee,key[kee]); + printf("\0"); // bug + #endif + if(kee & 0x80) + key[kee & 0x7F] = 0; // a key is released + else key[kee] = kea[kee] = 1; // a key is pressed - /* Acknowledge the interrupt to the programmable interrupt controller */ - outp(0x20, 0x20); /* Signal non specific end of interrupt */ -} - -/* ---------------------- init_keyboard() ---------------- April 17,1993 */ -/* restore the bios keyboard handler */ -/* ---------------------- deinit_keyboard() -------------- April 17,1993 */ + /* Acknowledge the interrupt to the programmable interrupt controller */ + outp(0x20, 0x20); /* Signal non specific end of interrupt */ +} + +/* ---------------------- init_keyboard() ---------------- April 17,1993 */ +/* restore the bios keyboard handler */ +/* ---------------------- deinit_keyboard() -------------- April 17,1993 */ void setkb(int vq){ - int i; /* Index variable */ + int i; /* Index variable */ if(!vq){ // deinitiation - /* Abort if our function pointer has no valid address */ + /* Abort if our function pointer has no valid address */ if(oldkb == NULL) return; /* Set address in our function pointer in interrupt vector table */ _dos_setvect(9, oldkb); - /* Reset our function pointer to contain no valid address */ + /* Reset our function pointer to contain no valid address */ oldkb = NULL; + #ifdef TESTING /* Print the key heap */ printf("\n"); for(i=0; i #include #include // just for wait -#include // just for wait +#include // just for wait +#include "types.h" /* Control codes for all keys on the keyboard */ //here temperarly @@ -96,8 +97,10 @@ #define KEY_MENU (0x75) -typedef unsigned char byte; +//typedef unsigned char byte; +//typedef unsigned int word; +//typedef unsigned short syte; void wait(clock_t wait); -#endif/*_LIBCOM_H_*/ +#endif/*_LIBHEAD_H_*/ diff --git a/makefile b/makefile new file mode 100644 index 00000000..b11f89a0 --- /dev/null +++ b/makefile @@ -0,0 +1,37 @@ +FLAGS=-0 +all: test.exe pcxtest.exe test2.exe scroll.exe + +scroll.exe: scroll.obj modex16.obj dos_kb.obj bitmap.obj + wcl $(FLAGS) scroll.obj modex16.obj dos_kb.obj bitmap.obj +scroll.obj: scroll.c + wcl $(FLAGS) -c scroll.c +test.exe: test.obj modex16.obj bitmap.obj + wcl $(FLAGS) test.obj modex16.obj bitmap.obj + +test2.exe: test2.obj modex16.obj bitmap.obj + wcl $(FLAGS) test2.obj modex16.obj bitmap.obj + +pcxtest.exe: pcxtest.obj modex16.obj bitmap.obj + wcl $(FLAGS) pcxtest.obj modex16.obj bitmap.obj + +test.obj: test.c modex16.h + wcl $(FLAGS) -c test.c + +test2.obj: test2.c modex16.h + wcl $(FLAGS) -c test2.c + +pcxtest.obj: pcxtest.c modex16.h + wcl $(FLAGS) -c pcxtest.c + +modex16.obj: modex16.h modex16.c + wcl $(FLAGS) -c modex16.c + +dos_kb.obj: dos_kb.h dos_kb.c + wcl $(FLAGS) -c dos_kb.c + +bitmap.obj: bitmap.h bitmap.c + wcl $(FLAGS) -c bitmap.c + +clean: + del *.obj + del *.exe diff --git a/modex16.c b/modex16.c new file mode 100644 index 00000000..f01116b5 --- /dev/null +++ b/modex16.c @@ -0,0 +1,605 @@ +#include +#include +#include +#include +#include +#include +#include "modex16.h" + + +byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */ + +static void fadePalette(sbyte fade, sbyte start, word iter, byte *palette); +static byte tmppal[PAL_SIZE]; + +static void +vgaSetMode(byte mode) +{ + union REGS regs; + + regs.h.ah = SET_MODE; + regs.h.al = mode; + int86(VIDEO_INT, ®s, ®s); +} + + +/* -========================= Entry Points ==========================- */ +void +modexEnter() { + word i; + dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */ + word CRTParms[] = { + 0x0d06, /* vertical total */ + 0x3e07, /* overflow (bit 8 of vertical counts) */ + 0x4109, /* cell height (2 to double-scan */ + 0xea10, /* v sync start */ + 0xac11, /* v sync end and protect cr0-cr7 */ + 0xdf12, /* vertical displayed */ + 0x0014, /* turn off dword mode */ + 0xe715, /* v blank start */ + 0x0616, /* v blank end */ + 0xe317 /* turn on byte mode */ + }; + int CRTParmCount = sizeof(CRTParms) / sizeof(CRTParms[0]); + + /* TODO save current video mode and palette */ + vgaSetMode(VGA_256_COLOR_MODE); + + /* disable chain4 mode */ + outpw(SC_INDEX, 0x0604); + + /* synchronous reset while setting Misc Output */ + outpw(SC_INDEX, 0x0100); + + /* select 25 MHz dot clock & 60 Hz scanning rate */ + outp(MISC_OUTPUT, 0xe3); + + /* undo reset (restart sequencer) */ + outpw(SC_INDEX, 0x0300); + + /* reprogram the CRT controller */ + outp(CRTC_INDEX, 0x11); /* VSync End reg contains register write prot */ + outp(CRTC_DATA, 0x7f); /* get current write protect on varios regs */ + + /* send the CRTParms */ + for(i=0; idata + (p->width/4)*p->height; /* compute the offset */ + result.dx = 0; + result.dy = 0; + result.width = p->width; + result.height = p->height; + + return result; +} + + +void +modexShowPage(page_t *page) { + word high_address; + word low_address; + word offset; + byte crtcOffset; + + /* calculate offset */ + offset = (word) page->data; + offset += page->dy * (page->width >> 2 ); + offset += page->dx >> 2; + + /* calculate crtcOffset according to virtual width */ + crtcOffset = page->width >> 3; + + high_address = HIGH_ADDRESS | (offset & 0xff00); + low_address = LOW_ADDRESS | (offset << 8); + + /* wait for appropriate timing and then program CRTC */ + while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE)); + outpw(CRTC_INDEX, high_address); + outpw(CRTC_INDEX, low_address); + outp(CRTC_INDEX, 0x13); + outp(CRTC_DATA, crtcOffset); + + /* wait for one retrace */ + while (!(inp(INPUT_STATUS_1) & VRETRACE)); + + /* do PEL panning here */ + outp(AC_INDEX, 0x33); + outp(AC_INDEX, (page->dx & 0x03) << 1); +} + + +void +modexPanPage(page_t *page, int dx, int dy) { + page->dx = dx; + page->dy = dy; +} + + +void +modexSelectPlane(byte plane) { + outp(SC_INDEX, MAP_MASK); /* select plane */ + outp(SC_DATA, plane); +} + + +void +modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) { + word pageOff = (word) page->data; + word xoff=x/4; /* xoffset that begins each row */ + word scanCount=w/4; /* number of iterations per row (excluding right clip)*/ + word poffset = pageOff + y*(page->width/4) + xoff; /* starting offset */ + word nextRow = page->width/4-scanCount-1; /* loc of next row */ + byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */ + byte rclip[] = {0x00, 0x01, 0x03, 0x07}; + byte left = lclip[x&0x03]; + byte right = rclip[(x+w)&0x03]; + + /* handle the case which requires an extra group */ + if((x & 0x03) && !((x+w) & 0x03)) { + right=0x0f; + } + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + MOV DI, poffset ; go to the first pixel + MOV DX, SC_INDEX ; point to the map mask + MOV AL, MAP_MASK + OUT DX, AL + INC DX + MOV AL, color ; get ready to write colors + SCAN_START: + MOV CX, scanCount ; count the line + MOV BL, AL ; remember color + MOV AL, left ; do the left clip + OUT DX, AL ; set the left clip + MOV AL, BL ; restore color + STOSB ; write the color + DEC CX + JZ SCAN_DONE ; handle 1 group stuff + + ;-- write the main body of the scanline + MOV BL, AL ; remember color + MOV AL, 0x0f ; write to all pixels + OUT DX, AL + MOV AL, BL ; restore color + REP STOSB ; write the color + SCAN_DONE: + MOV BL, AL ; remeber color + MOV AL, right + OUT DX, AL ; do the right clip + MOV AL, BL ; restore color + STOSB ; write pixel + ADD DI, nextRow ; go to the next row + DEC h + JNZ SCAN_START + } +} + + +void +modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) { + /* draw the region (the entire freakin bitmap) */ + modexDrawBmpRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + + +void +modexDrawBmpRegion(page_t *page, int x, int y, + int rx, int ry, int rw, int rh, bitmap_t *bmp) { + word poffset = (word) page->data + y*(page->width/4) + x/4; + byte *data = bmp->data; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw; + word height = rh; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + MOVSB ; copy the pixel + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} + + +void +modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp) { + /* draw the whole sprite */ + modexDrawSpriteRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp); +} + +void +modexDrawSpriteRegion(page_t *page, int x, int y, + int rx, int ry, int rw, int rh, bitmap_t *bmp) { + word poffset = (word)page->data + y*(page->width/4) + x/4; + byte *data = bmp->data; + word bmpOffset = (word) data + ry * bmp->width + rx; + word width = rw; + word height = rh; + byte plane = 1 << ((byte) x & 0x03); + word scanCount = width/4 + (width%4 ? 1 :0); + word nextPageRow = page->width/4 - scanCount; + word nextBmpRow = (word) bmp->width - width; + word rowCounter; + byte planeCounter = 4; + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + + MOV DX, SC_INDEX ; point at the map mask register + MOV AL, MAP_MASK ; + OUT DX, AL ; + + PLANE_LOOP: + MOV DX, SC_DATA ; select the current plane + MOV AL, plane ; + OUT DX, AL ; + + ;-- begin plane painting + MOV AX, height ; start the row counter + MOV rowCounter, AX ; + MOV DI, poffset ; go to the first pixel + MOV SI, bmpOffset ; go to the bmp pixel + ROW_LOOP: + MOV CX, width ; count the columns + SCAN_LOOP: + LODSB + DEC SI + CMP AL, 0 + JNE DRAW_PIXEL ; draw non-zero pixels + + INC DI ; skip the transparent pixel + ADD SI, 1 + JMP NEXT_PIXEL + DRAW_PIXEL: + MOVSB ; copy the pixel + NEXT_PIXEL: + SUB CX, 3 ; we skip the next 3 + ADD SI, 3 ; skip the bmp pixels + LOOP SCAN_LOOP ; finish the scan + + MOV AX, nextPageRow + ADD DI, AX ; go to the next row on screen + MOV AX, nextBmpRow + ADD SI, AX ; go to the next row on bmp + + DEC rowCounter + JNZ ROW_LOOP ; do all the rows + ;-- end plane painting + + MOV AL, plane ; advance to the next plane + SHL AL, 1 ; + AND AL, 0x0f ; mask the plane properly + MOV plane, AL ; store the plane + + INC bmpOffset ; start bmp at the right spot + + DEC planeCounter + JNZ PLANE_LOOP ; do all 4 planes + } +} + + +/* copy a region of video memory from one page to another. + * It assumes that the left edge of the tile is the same on both + * regions and the memory areas do not overlap. + */ +void +modexCopyPageRegion(page_t *dest, page_t *src, + word sx, word sy, + word dx, word dy, + word width, word height) +{ + word doffset = (word)dest->data + dy*(dest->width/4) + dx/4; + word soffset = (word)src->data + sy*(src->width/4) + sx/4; + word scans = width/4; + word nextSrcRow = src->width/4 - scans - 1; + word nextDestRow = dest->width/4 - scans - 1; + byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */ + byte rclip[] = {0x0f, 0x01, 0x03, 0x07}; + byte left = lclip[sx&0x03]; + byte right = rclip[(sx+width)&0x03]; + + __asm { + MOV AX, SCREEN_SEG ; work in the vga space + MOV ES, AX ; + MOV DI, doffset ; + MOV SI, soffset ; + + MOV DX, GC_INDEX ; turn off cpu bits + MOV AX, 0008h ; + OUT DX, AX + + MOV AX, SC_INDEX ; point to the mask register + MOV DX, AX ; + MOV AL, MAP_MASK ; + OUT DX, AL ; + INC DX ; + + ROW_START: + PUSH DS + MOV AX, ES + MOV DS, AX + MOV CX, scans ; the number of latches + + MOV AL, left ; do the left column + OUT DX, AL ; + MOVSB ; + DEC CX ; + + MOV AL, 0fh ; do the inner columns + OUT DX, AL + REP MOVSB ; copy the pixels + + MOV AL, right ; do the right column + OUT DX, AL + MOVSB + POP DS + + MOV AX, SI ; go the start of the next row + ADD AX, nextSrcRow ; + MOV SI, AX ; + MOV AX, DI ; + ADD AX, nextDestRow ; + MOV DI, AX ; + + DEC height ; do the rest of the actions + JNZ ROW_START ; + + MOV DX, GC_INDEX+1 ; go back to CPU data + MOV AL, 0ffh ; none from latches + OUT DX, AL ; + } +} + + +/* fade and flash */ +void +modexFadeOn(word fade, byte *palette) { + fadePalette(-fade, 64, 64/fade+1, palette); +} + + +void +modexFadeOff(word fade, byte *palette) { + fadePalette(fade, 0, 64/fade+1, palette); +} + + +void +modexFlashOn(word fade, byte *palette) { + fadePalette(fade, -64, 64/fade+1, palette); +} + + +void +modexFlashOff(word fade, byte *palette) { + fadePalette(-fade, 0, 64/fade+1, palette); +} + + +static void +fadePalette(sbyte fade, sbyte start, word iter, byte *palette) { + word i; + byte dim = start; + + /* handle the case where we just update */ + if(iter == 0) { + modexPalUpdate(palette); + return; + } + + while(iter > 0) { /* FadeLoop */ + for(i=0; i 127) { + tmppal[i] = 0; + } else if(tmppal[i] > 63) { + tmppal[i] = 63; + } + } + modexPalUpdate(tmppal); + iter--; + dim += fade; + } +} + + +/* save and load */ +void +modexPalSave(byte *palette) { + int i; + + outp(PAL_READ_REG, 0); /* start at palette entry 0 */ + for(i=0; i +#include "types.h" +#include "bitmap.h" + +/* -========================== Types & Macros ==========================- */ +#define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2)) +#define PLANE(x) (1<< (x&3)) +#define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02) + +typedef struct { + byte far* data; /* the data for the page */ + word dx; /* col we are viewing on the virtual screen */ + word dy; /* row we are viewing on the virtual screen */ + word width; /* virtual width of the page */ + word height; /* virtual height of the page */ +} page_t; + +/* -============================ Functions =============================- */ +/* mode switching, page, and plane functions */ +void modexEnter(); +void modexLeave(); +page_t modexDefaultPage(); +page_t modexNextPage(page_t *p); +void modexShowPage(page_t *page); +void modexPanPage(page_t *page, int dx, int dy); +void modexSelectPlane(byte plane); +void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color); +void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp); +void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); +void modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp); +void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); + +/* Palette fade and flash effects */ +void modexFadeOn(word fade, byte *palette); +void modexFadeOff(word fade, byte *palette); +void modexFlashOn(word fade, byte *palette); +void modexFlashOff(word fade, byte *palette); + +/* palette loading and saving */ +void modexPalSave(byte *palette); +byte *modexNewPal(); +void modexLoadPalFile(char *filename, byte **palette); +void modexSavePalFile(char *filename, byte *palette); + +/* fixed palette functions */ +void modexPalBlack(); +void modexPalWhite(); + +/* utility functions */ +void modexPalUpdate(byte *p); +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 +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 240 +#define PAGE_SIZE (word)(SCREEN_WIDTH/4 * SCREEN_HEIGHT) + +#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 +#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 diff --git a/old.7z b/old.7z new file mode 100644 index 00000000..099b5478 Binary files /dev/null and b/old.7z differ diff --git a/palettec.c b/palettec.c new file mode 100644 index 00000000..340a9303 --- /dev/null +++ b/palettec.c @@ -0,0 +1,16 @@ +#include "modex16.h" + +void +main() { + byte *pal; + + modexEnter(); + + pal = modexNewPal(); + modexPalSave(pal); + + modexSavePalFile("gfx.pal", pal); + + modexLeave(); + +} diff --git a/pcxtest.c b/pcxtest.c new file mode 100644 index 00000000..7373e885 --- /dev/null +++ b/pcxtest.c @@ -0,0 +1,79 @@ +#include +#include "modex16.h" +#include "bitmap.h" + +word far* clock= (word far*) 0x046C; /* 18.2hz clock */ + +void +oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) { + byte plane; + word px, py; + word offset; + + /* TODO Make this fast. It's SLOOOOOOW */ + for(plane=0; plane < 4; plane++) { + modexSelectPlane(PLANE(plane+x)); + for(px = plane; px < bmp->width; px+=4) { + offset=px; + for(py=0; pyheight; py++) { + if(!sprite || bmp->data[offset]) + page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset]; + offset+=bmp->width; + } + } + } +} + +void main() { + bitmap_t bmp; + int i; + page_t page; + word start; + float t1, t2; + + page=modexDefaultPage(); + + bmp = bitmapLoadPcx("46113319.pcx"); + modexEnter(); + + /* fix up the palette and everything */ + modexPalUpdate(bmp.palette); + + /* clear and draw one sprite and one bitmap */ + modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1); + + /* non sprite comparison */ + start = *clock; + for(i=0; i<100 ;i++) { + oldDrawBmp(VGA, 20, 20, &bmp, 0); + } + + start = *clock; + for(i=0; i<100 ;i++) { + modexDrawBmp(&page, 20, 20, &bmp); + } + t1 = (*clock-start) /18.2; + + start = *clock; + for(i=0; i<100; i++) { + modexCopyPageRegion(&page, &page, 20, 20, 128, 20, 64, 64); + } + t2 = (*clock-start)/18.2; + + + start = *clock; + for(i=0; i<100 ;i++) { + oldDrawBmp(VGA, 20, 20, &bmp, 1); + } + + + start = *clock; + for(i=0; i<100 ;i++) { + modexDrawSprite(&page, 20, 20, &bmp); + } + modexLeave(); + + printf("CPU to VGA: %f\n", t1); + printf("VGA to VGA: %f\n", t2); + return; +} diff --git a/pcxtest.exe b/pcxtest.exe new file mode 100644 index 00000000..de765ece Binary files /dev/null and b/pcxtest.exe differ diff --git a/ptmp.pcx b/ptmp.pcx new file mode 100644 index 00000000..e6693f53 Binary files /dev/null and b/ptmp.pcx differ diff --git a/remake.bat b/remake.bat deleted file mode 100644 index 065e52e3..00000000 --- a/remake.bat +++ /dev/null @@ -1 +0,0 @@ -wmake clean diff --git a/run.bat b/run.bat deleted file mode 100644 index 6b825579..00000000 --- a/run.bat +++ /dev/null @@ -1,3 +0,0 @@ -wsample core16.exe -setres 80 50 -wprof core16.smp diff --git a/scroll.c b/scroll.c new file mode 100644 index 00000000..03d4b2c8 --- /dev/null +++ b/scroll.c @@ -0,0 +1,507 @@ +#include "modex16.h" +#include +#include +#include "dos_kb.h" + +//word far *clock= (word far*) 0x046C; /* 18.2hz clock */ + +typedef struct { + bitmap_t *data; + word tileHeight; + word tileWidth; + unsigned int rows; + unsigned int cols; + //unsigned int tilex,tiley; // tile position on the map +} tiles_t; + + +typedef struct { + byte *data; + tiles_t *tiles; + int width; + int height; +} map_t; + + +typedef struct { + map_t *map; + page_t *page; + int tx; //appears to be the top left tile position on the viewable screen map + int ty; //appears to be the top left tile position on the viewable screen map + word dxThresh; //???? + word dyThresh; //???? +} map_view_t; + +struct { + int x; //player exact position on the viewable map + int y; //player exact position on the viewable map + int tx; //player tile position on the viewable map + int ty; //player tile position on the viewable map + int hp; //hitpoints of the player +} player; + + +map_t allocMap(int w, int h); +void initMap(map_t *map); +void mapScrollRight(map_view_t *mv, byte offset); +void mapScrollLeft(map_view_t *mv, byte offest); +void mapScrollUp(map_view_t *mv, byte offset); +void mapScrollDown(map_view_t *mv, byte offset); +void mapGoTo(map_view_t *mv, int tx, int ty); +void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y); +void mapDrawRow(map_view_t *mv, int tx, int ty, word y); +void mapDrawCol(map_view_t *mv, int tx, int ty, word x); +void animatePlayer(map_view_t *mv, short d1, short d2, int x, int y, int ls, bitmap_t *bmp); + +#define TILEWH 16 +#define QUADWH (TILEWH/4) +#define SPEED 2 + +//place holder definitions +#define MAPX 40 +#define MAPY 30 +#define SWAP(a, b) tmp=a; a=b; b=tmp; +void main() { + bitmap_t ptmp; // player sprite + int q=0; + page_t screen, screen2; + map_t map; + map_view_t mv, mv2; + map_view_t *draw, *show, *tmp; + byte *ptr; + + setkb(1); + /* create the map */ + map = allocMap(MAPX,MAPY); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly + initMap(&map); + mv.map = ↦ + mv2.map = ↦ + + /* draw the tiles */ + ptr = map.data; + ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite + modexEnter(); + modexPalUpdate(ptmp.palette); + screen = modexDefaultPage(); + screen.width += (TILEWH*2); + mv.page = &screen; + screen2=modexNextPage(mv.page); + mv2.page = &screen2; + modexShowPage(mv.page); + + /* set up paging */ + show = &mv; + draw = &mv2; +// draw = &mv; + +//TODO: LOAD map data and position the map in the middle of the screen if smaller then screen + mapGoTo(draw, 0, 0); + mapGoTo(show, 0, 0); + + //TODO: put player in starting position of spot + //default player position on the viewable map + player.tx = draw->tx + 10; + player.ty = draw->ty + 8; + player.x = player.tx*TILEWH; + player.y = player.ty*TILEWH; + modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); + + modexShowPage(draw->page); + while(!keyp(1)) + { + //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square + //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction + //when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map + + //TODO: render the player properly with animation and sprite sheet + if(keyp(77)) + { +// modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 32, 24, 32, &ptmp); + if(draw->tx >= 0 && draw->tx+20 < MAPX && player.tx == draw->tx + 10) + { + for(q=0; q<(TILEWH/SPEED); q++) + { +// modexDrawBmp(draw->page, &bmp); + animatePlayer(draw, 1, 1, player.x, player.y, q, &ptmp); + mapScrollRight(draw, SPEED); + modexShowPage(draw->page); +// mapScrollRight(show, SPEED); +// SWAP(draw, show); + } + player.tx++; + } + else if(player.tx < MAPX) + { + for(q=0; q<(TILEWH/SPEED); q++) + { + player.x+=SPEED; +// modexDrawBmp(draw->page, player.x, player.y, &bmp); + animatePlayer(draw, 1, 0, player.x, player.y, q, &ptmp); + modexShowPage(draw->page); + SWAP(draw, show); + } + player.tx++; + } + } + + if(keyp(75)) + { +// modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 96, 24, 32, &ptmp); + if(draw->tx > 0 && draw->tx+20 <= MAPX && player.tx == draw->tx + 10) + { + for(q=0; q<(TILEWH/SPEED); q++) + { +// modexDrawBmp(draw->page, player.x-((q+1)*SPEED), player.y, &bmp); + animatePlayer(draw, 3, 1, player.x, player.y, q, &ptmp); + mapScrollLeft(draw, SPEED); + modexShowPage(draw->page); +// mapScrollLeft(show, SPEED); +// SWAP(draw, show); + } + player.tx--; + } + else if(player.tx > 1) + { + for(q=0; q<(TILEWH/SPEED); q++) + { + player.x-=SPEED; +// modexDrawBmp(draw->page, player.x, player.y, &bmp); + animatePlayer(draw, 3, 0, player.x, player.y, q, &ptmp); + modexShowPage(draw->page); + SWAP(draw, show); + } + player.tx--; + } + } + + if(keyp(80)) + { +// modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); + if(draw->ty >= 0 && draw->ty+15 < MAPY && player.ty == draw->ty + 8) + { + for(q=0; q<(TILEWH/SPEED); q++) + { +// modexDrawBmp(draw->page, player.x, player.y+((q+1)*SPEED), &bmp); + animatePlayer(draw, 2, 1, player.x, player.y, q, &ptmp); + mapScrollDown(draw, SPEED); + modexShowPage(draw->page); +// mapScrollDown(show, SPEED); +// SWAP(draw, show); + } + player.ty++; + } + else if(player.ty < MAPY) + { + for(q=0; q<(TILEWH/SPEED); q++) + { + player.y+=SPEED; +// modexDrawBmp(draw->page, player.x, player.y, &bmp); + animatePlayer(draw, 2, 0, player.x, player.y, q, &ptmp); + modexShowPage(draw->page); +// SWAP(draw, show); + } + player.ty++; + } + } + + if(keyp(72)) + { + if(draw->ty > 0 && draw->ty+15 <= MAPY && player.ty == draw->ty + 8) + { + for(q=0; q<(TILEWH/SPEED); q++) + { +// modexDrawBmp(draw->page, player.x, player.y-((q+1)*SPEED), &bmp); + animatePlayer(draw, 0, 1, player.x, player.y, q, &ptmp); + mapScrollUp(draw, SPEED); + modexShowPage(draw->page); +// mapScrollUp(show, SPEED); +// SWAP(draw, show); + } + player.ty--; + } + else if(player.ty > 1) + { + for(q=0; q<(TILEWH/SPEED); q++) + { + player.y-=SPEED; +// modexDrawBmp(draw->page, player.x, player.y, &bmp); + animatePlayer(draw, 0, 0, player.x, player.y, q, &ptmp); + modexShowPage(draw->page); +// SWAP(draw, show); + } + player.ty--; + } + } +// modexDrawBmp(draw->page, player.x, player.y, &bmp); + //modexShowPage(draw->page); + + } + + modexLeave(); + setkb(0); + printf("Project 16 scroll.exe\n"); + printf("tx: %d\n", draw->tx); + printf("ty: %d\n", draw->ty); + printf("player.x: %d\n", player.x); + printf("player.y: %d\n", player.y); + printf("player.tx: %d\n", player.tx); + printf("player.ty: %d\n", player.ty); +} + + +map_t +allocMap(int w, int h) { + map_t result; + + result.width =w; + result.height=h; + result.data = malloc(sizeof(byte) * w * h); + + return result; +} + + +void +initMap(map_t *map) { + /* just a place holder to fill out an alternating pattern */ + int x, y; + int i; + int tile = 1; + map->tiles = malloc(sizeof(tiles_t)); + + /* create the tile set */ + map->tiles->data = malloc(sizeof(bitmap_t)); + map->tiles->data->width = (TILEWH*2); + map->tiles->data->height= TILEWH; + map->tiles->data->data = malloc((TILEWH*2)*TILEWH); + map->tiles->tileHeight = TILEWH; + map->tiles->tileWidth =TILEWH; + map->tiles->rows = 1; + map->tiles->cols = 2; + + i=0; + for(y=0; ytiles->data->data[i] = 0x24; + else + map->tiles->data->data[i] = 0x34; + i++; + } + } + + i=0; + for(y=0; yheight; y++) { + for(x=0; xwidth; x++) { + map->data[i] = tile; + tile = tile ? 0 : 1; + i++; + } + tile = tile ? 0 : 1; + } +} + + +void +mapScrollRight(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dx += offset; + + /* check to see if this changes the tile */ + if(mv->page->dx >= mv->dxThresh ) { + /* go forward one tile */ + mv->tx++; + /* Snap the origin forward */ + mv->page->data += 4; + mv->page->dx = mv->map->tiles->tileWidth; + + + /* draw the next column */ + x= SCREEN_WIDTH + mv->map->tiles->tileWidth; + mapDrawCol(mv, mv->tx + 20 , mv->ty-1, x); + } +} + + +void +mapScrollLeft(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dx -= offset; + + /* check to see if this changes the tile */ + if(mv->page->dx == 0) { + /* go backward one tile */ + mv->tx--; + + /* Snap the origin backward */ + mv->page->data -= 4; + mv->page->dx = mv->map->tiles->tileWidth; + + /* draw the next column */ + mapDrawCol(mv, mv->tx-1, mv->ty-1, 0); + } +} + + +void +mapScrollUp(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dy -= offset; + + /* check to see if this changes the tile */ + if(mv->page->dy == 0 ) { + /* go down one tile */ + mv->ty--; + /* Snap the origin downward */ + mv->page->data -= mv->page->width*4; + mv->page->dy = mv->map->tiles->tileHeight; + + + /* draw the next row */ + y= 0; + mapDrawRow(mv, mv->tx-1 , mv->ty-1, y); + } +} + + +void +mapScrollDown(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dy += offset; + + /* check to see if this changes the tile */ + if(mv->page->dy >= mv->dyThresh ) { + /* go down one tile */ + mv->ty++; + /* Snap the origin downward */ + mv->page->data += mv->page->width*4; + mv->page->dy = mv->map->tiles->tileHeight; + + + /* draw the next row */ + y= SCREEN_HEIGHT + mv->map->tiles->tileHeight; + mapDrawRow(mv, mv->tx-1 , mv->ty+15, y); + } + +} + + +void +mapGoTo(map_view_t *mv, int tx, int ty) { + int px, py; + unsigned int i; + + /* set up the coordinates */ + mv->tx = tx; + mv->ty = ty; + mv->page->dx = mv->map->tiles->tileWidth; + mv->page->dy = mv->map->tiles->tileHeight; + + /* set up the thresholds */ + mv->dxThresh = mv->map->tiles->tileWidth * 2; + mv->dyThresh = mv->map->tiles->tileHeight * 2; + + /* draw the tiles */ + modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); + py=0; + i=mv->ty * mv->map->width + mv->tx; + for(ty=mv->ty-1; py < SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { + mapDrawRow(mv, tx-1, ty, py); + i+=mv->map->width - tx; + } +} + + +void +mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) { + word rx; + word ry; + rx = (i % t->cols) * t->tileWidth; + ry = (i / t->cols) * t->tileHeight; + modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, t->data); +} + + +void +mapDrawRow(map_view_t *mv, int tx, int ty, word y) { + word x; + int i; + + /* the position within the map array */ + i=ty * mv->map->width + tx; + for(x=0; xdxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) { + if(i>=0) { + /* we are in the map, so copy! */ + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); + } + i++; /* next! */ + } +} + + +void +mapDrawCol(map_view_t *mv, int tx, int ty, word x) { + int y; + int i; + + /* location in the map array */ + i=ty * mv->map->width + tx; + + /* We'll copy all of the columns in the screen, + i + 1 row above and one below */ + for(y=0; ydyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) { + if(i>=0) { + /* we are in the map, so copy away! */ + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); + } + i += mv->map->width; + } +} + +void animatePlayer(map_view_t *mv, short d1, short d2, int x, int y, int ls, bitmap_t *bmp) +{ + int qq; + + if(d2==0) qq = 0; + else qq = ((ls+1)*SPEED); + switch (d1) + { + case 0: + //up + if(ls<2) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); + if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 0, 0, 24, 32, bmp); + if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 48, 0, 24, 32, bmp); + if(ls>6) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); + break; + case 1: + // right + //right + if(ls<2) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); + if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 0, 32, 24, 32, bmp); + if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 48, 32, 24, 32, bmp); + if(ls>6) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); + break; + case 2: + //down + if(ls<2) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); + if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 0, 64, 24, 32, bmp); + if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 48, 64, 24, 32, bmp); + if(ls>6) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); + break; + case 3: + //left + if(ls<2) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); + if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 0, 96, 24, 32, bmp); + if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 48, 96, 24, 32, bmp); + if(ls>6) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); + break; + } +} diff --git a/scroll.exe b/scroll.exe new file mode 100644 index 00000000..9ad1236c Binary files /dev/null and b/scroll.exe differ diff --git a/src/eng_ai.cpp b/src/eng_ai.cpp deleted file mode 100644 index 525e62ef..00000000 --- a/src/eng_ai.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "src\eng_ai.h" -#include - -namespace engine { - - void do_artificial_intelligence() - { - //artificial intelligence here -//==== std::cout << "A.I. HERE" << std::endl; - } - -} \ No newline at end of file diff --git a/src/eng_ai.h b/src/eng_ai.h deleted file mode 100644 index 33da40e5..00000000 --- a/src/eng_ai.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _ENGINE_ARTIFICIAL_INTELLIGENCE_H_ -#define _ENGINE_ARTIFICIAL_INTELLIGENCE_H_ - -namespace engine { - void do_artificial_intelligence(); -} - -#endif/*_ENGINE_ARTIFICIAL_INTELLIGENCE_H_*/ \ No newline at end of file diff --git a/src/eng_comm.cpp b/src/eng_comm.cpp deleted file mode 100644 index 02d90812..00000000 --- a/src/eng_comm.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "src\eng_comm.h" -#include - -namespace engine { - - engine_message do_communication() - /*{ - //communication here -//==== std::cout << "COMMUNICATION HERE" << std::endl; - int msg; - std::cout << "Enter 1 for continue." << std::endl; - std::cin >> msg; - return msg == 1 ? ENGINE_RUN : ENGINE_QUIT; - }*/ - /*engine_message do_communication(bool *input) - { - //communication here -//==== std::cout << "COMMUNICATION HERE" << std::endl; - return input['e'] == true ? ENGINE_QUIT : ENGINE_RUN; - }*/ - //engine_message do_communication(byte input) - { - //communication here -//==== std::cout << "COMMUNICATION HERE" << std::endl; - //if(input) printf("%03d\n", input); - return keyp(1) == 1 ? ENGINE_QUIT : ENGINE_RUN; - } - -} \ No newline at end of file diff --git a/src/eng_comm.h b/src/eng_comm.h deleted file mode 100644 index 140ea216..00000000 --- a/src/eng_comm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _ENGINE_COMMUNICATION_H_ -#define _ENGINE_COMMUNICATION_H_ - -#include "src\engine.h" -#include "src\lib\dos_comm.h" - -namespace engine { - engine_message do_communication(); -// engine_message do_communication(byte input); -} - -#endif/*_ENGINE_COMMUNICATION_H_*/ \ No newline at end of file diff --git a/src/eng_core.cpp b/src/eng_core.cpp deleted file mode 100644 index 853e64cc..00000000 --- a/src/eng_core.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#include "src\eng_core.h" - -#include "src\eng_snd.h" -#include "src\eng_gfx.h" -#include "src\eng_comm.h" -#include "src\eng_ai.h" - -#include - -//#include "src\lib\dos_gfx.h" -//#include "src\lib\opl2.h" -//#include "src\lib\dos_comm.h" - -namespace engine{ - - Core::Core() - { - // Hardware Initiation - this->init(); - - //default constructor - this->msg = ENGINE_RUN; - this->timer.start_timer(); - this->frames_per_second = 60; - - // Global Variables - this->mode = 4; // test global variable - this->x = 0; // X - this->y = 0; // Y - - // Start setttings of flags. I hope I got the same - // logic as it was before, with the STL list. - this->graphics_flag = true; - this->comm_flag = true; - this->release_flag = false; - } - - void Core::update() - { - /*for (std::list::iterator i = fp->begin(); i != fp->end(); i++) - //for (std::list::iterator i = this->fp.begin(); i != this->fp.end(); i++) - { - (this->*(*i))(); - }*/ - // call update functions, instead of traversing a function pointer - // list. Remove this comment! - sound(); - if ( graphics_flag ) - graphics(); - if ( comm_flag ) - comm(); - ai(); - if ( release_flag ) - release(); - } - - void Core::sound() - { - //wrap sound lib - do_sound(); - } - void Core::graphics() - { - //int num_frames = 60; - //double fps = 1.0 / num_frames; - //double now = this->timer.elapsed_timer(); - //std::cout << "fps: " << fps << " now: " << now << std::endl; - //if (this->timer.elapsed_timer() >= fps) - //{ - //wrap graphics lib - do_graphics(); - //this->timer.start_timer(); - //} - } - void Core::comm() - { - //int num_frames = 60; - //double fps = 1.0 / num_frames; - //double now = this->timer.elapsed_timer(); - //std::cout << "fps: " << fps << " now: " << now << std::endl; - //if (this->timer.elapsed_timer() >= fps) - //{ - //wrap comm lib - this->msg = do_communication(); - //this->timer.start_timer(); - //} - } - void Core::ai() - { - //wrap A.I. lib - do_artificial_intelligence(); - } - - engine_message Core::_msg() - { - return this->msg; - } - - void Core::run() - { -//---- int i = 0; - while (ENGINE_EXIT != this->msg) - { - //next line for purely testing purposes -//---- i++;if(i==600){char a;std::cin >> a;this->keeq[a] = true;i=0;} - this->sync(); - this->input(); - this->update(); - } - } - - bool Core::init(){ - bool xz = 0; // error switch... - std::cout << "VIDEO INITIATION" << std::endl; -//____working on mode x setvideo(0x13, 1); -//____working on mode x setvbuff(1); - std::cout << "Checking for Adlib sound card...." << std::endl; - if(!AdlibExists()){ - std::cout << "not found." << std::endl; - xz = 1; - } - std::cout << "found." << std::endl; - std::cout << "OPL2 INITIATION" << std::endl; - fmtest(); - std::cout << "\nPress ESC to quit the game engine core test." << std::endl; - std::cout << "1 - 9 for graphical tests!" << std::endl; - std::cout << "space bar for control and sprite test!" << std::endl; - std::cout << "z key for noise!" << std::endl; - //std::cout << "Press press any key to continue!" << std::endl; - //getch(); - std::cout << "INPUT INITIATION" << std::endl; - setkb(1); - std::cout << "INITIATION" << std::endl; - return xz; - } - - void Core::release() - { - //release contexts and set engine to exit -//____working on mode x setvideo(0x03, 0); -//____working on mode x setvbuff(0); - setkb(0); - FMReset(); - this->msg = ENGINE_EXIT; - } - - void Core::input(){ - //retrieve input device information - //dummy 'w' and 'p' down, t up -//---- bool dummy_input_available = true; -//---- if(dummy_input_available) -//---- { -//---- std::cout << "key down" << std::endl; -//---- this->keeq['w'] = true; -//---- this->keeq['p'] = true; -//---- this->keeq['t'] = false; - //notify engine that input occured - this->msg = ENGINE_INPUT; -//---- } -//---- else -//---- { -//---- std::cout << "key up" << std::endl; -//---- this->msg = ENGINE_RUN; -//---- } - } - - void Core::sync() - { - if (this->timer.elapsed_timer() >= (1.0 / this->frames_per_second)) - { - //int a;std::cin >> a; - graphics_flag = true; - this->timer.start_timer(); -//==== std::cout << "GRAPHICS GRAPHICS GRAPHICS GRAPHICS GRAPHICS" << std::endl; -//____ updatevbuff(); - } - else - { - graphics_flag = false; - } - if (ENGINE_INPUT == this->msg) - { - comm_flag = true; - } - else - { - comm_flag = false; - } - if (ENGINE_QUIT == this->msg) - { - release_flag = true; - } - } - - Core::~Core() - { - //deconstructor - } - -} diff --git a/src/eng_core.h b/src/eng_core.h deleted file mode 100644 index 533c899c..00000000 --- a/src/eng_core.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _ENGINE_CORE_H_ -#define _ENGINE_CORE_H_ - -#include "src\engine.h" -#include "src\timer.h" - -namespace engine { - class Core - { - public: - Core(); - void update(); - void sound(); - void graphics(); - void comm(); - void ai(); - engine_message _msg(); - void run(); - bool init(); - void release(); - void input(); - void sync(); - ~Core(); - - protected: - private: - engine_message msg; - /*std::list *fp;*/ - Timer timer; -// unsigned char key[256]; - int frames_per_second; - //std::list fp; -/* int xxxx = 0; - int yyyy = 0;*/ - int mode; - int x; - int y; - - // Because we removed the function pointer STL list: - bool graphics_flag, comm_flag, release_flag; - }; -} - -#endif/*_ENGINE_CORE_H_*/ diff --git a/src/eng_gfx.cpp b/src/eng_gfx.cpp deleted file mode 100644 index d7e90a87..00000000 --- a/src/eng_gfx.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "src\eng_gfx.h" -#include - -#ifdef __cplusplus /* Functions must be declared C style */ -extern "C" { -#endif -extern void interrupt far newkb(void); -extern int keyp(byte c); -#ifdef __cplusplus -} -#endif - -namespace engine { - - void do_graphics() - { - //graphics here -//==== std::cout << "GRAPHICS HERE" << std::endl; - static int xxxx = 0; //I am confused!!! - static int yyyy = 0; //I am confused!!! - //static int mode = 10; //I am confused!!! - static int paldump = 0; //switch variable - //if(12 >= kee && kee >= 2) mode = kee - 1; - /*if(keyp(2)) mode = 1; - if(keyp(3)) mode = 2; - if(keyp(4)) mode = 3; - if(keyp(5)) mode = 4; - if(keyp(6)) mode = 5; - if(keyp(7)) mode = 6; - if(keyp(8)) mode = 7; - if(keyp(9)) mode = 8; - if(keyp(10)) mode = 9; - if(keyp(11)) mode = 10; - if(keyp(12)) mode = 11;*/ -//____ if(keyp(47) && paldump == 8) paldump = 0; -//____ else if(keyp(47)) paldump++; - /* working on code overall! - if(keyp(57) && mode == 10) mode = 0; - else if(keyp(57) && mode == 0) mode = 10; - if(mode > 0){ - ding(mode); - }else{*/ -//____ if(keyp(KEY_C)) tulip(); -/*____ if(keyp(KEY_UP) || keyp(KEY_DOWN) || keyp(KEY_LEFT) || keyp(KEY_RIGHT)) eraseplayer(xxxx, yyyy); - if(keyp(KEY_UP)){ - if(--yyyy < 0) yyyy = 0; - }else if(keyp(KEY_DOWN)){ - if(++yyyy >= SH) yyyy = SH - 1; - } - if(keyp(KEY_LEFT)){ - if(--xxxx < 0) xxxx = 0; - } - if(keyp(KEY_RIGHT)){ - if(++xxxx >= SW) xxxx = SW - 1; - } - drawplayer(xxxx, yyyy, 14); - //} - if(paldump) pdump(paldump);____*/ - /*clearscr(); - BlockMove();*/ - } - -} diff --git a/src/eng_gfx.h b/src/eng_gfx.h deleted file mode 100644 index 2533c1a1..00000000 --- a/src/eng_gfx.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _ENGINE_GRAPHICS_H_ -#define _ENGINE_GRAPHICS_H_ - -#include "src\lib\dos_gfx.h" - -namespace engine { - void do_graphics(); -} - -#endif/*_ENGINE_GRAPHICS_H_*/ \ No newline at end of file diff --git a/src/eng_snd.cpp b/src/eng_snd.cpp deleted file mode 100644 index c8f1598bb..00000000 --- a/src/eng_snd.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "src\eng_snd.h" -#include - -#ifdef __cplusplus /* Functions must be declared C style */ -extern "C" { -#endif -extern void interrupt far newkb(void); -extern int keyp(byte c); -#ifdef __cplusplus -} -#endif - -namespace engine { - - void do_sound() - { - //sound here -//==== std::cout << "SOUND HERE" << std::endl; - if(keyp(44)){ - FMKeyOn(0, 0x106, 4); - }//else if(!keyp(44)) FMKeyOff(0); - if(keyp(KEY_A)) FMKeyOff(0); - if(keyp(KEY_X)){ - sound(440); - delay(100); - nosound(); - }else if(keyp(KEY_X+0x80)) nosound(); - } - -} diff --git a/src/eng_snd.h b/src/eng_snd.h deleted file mode 100644 index 4f1adebc..00000000 --- a/src/eng_snd.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _ENGINE_SOUND_H_ -#define _ENGINE_SOUND_H_ - -#include "src\lib\opl2.h" - -namespace engine { - void do_sound(); -} - -#endif/*_ENGINE_SOUND_H_*/ \ No newline at end of file diff --git a/src/engine.h b/src/engine.h deleted file mode 100644 index d188c218..00000000 --- a/src/engine.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _ENGINE_H_ -#define _ENGINE_H_ - -typedef enum { - ENGINE_EXIT, - ENGINE_QUIT, - ENGINE_RUN, - ENGINE_INPUT -} engine_message; -#endif diff --git a/src/lib/dos_gfx.cpp b/src/lib/dos_gfx.cpp deleted file mode 100644 index 4491318b..00000000 --- a/src/lib/dos_gfx.cpp +++ /dev/null @@ -1,349 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// // -// TUTPROG4.CPP - VGA Trainer Program 4 (in Turbo C++ 3.0) // -// // -// "The VGA Trainer Program" is written by Denthor of Asphyxia. However it // -// was limited to Pascal only in its first run. All I have done is taken // -// his original release, translated it to C++ and touched up a few things. // -// I take absolutely no credit for the concepts presented in this code and // -// am NOT the person to ask for help if you are having trouble. // -// // -// Program Notes : This program implements virtual screens, a great way // -// to update your screen. // -// // -// For this particular program, I have found the compiler // -// option -mc (Compact memory model) to work better than // -// -ml (Large memory model). However, you must use -mc or // -// greater. // -// Also, you might want to go under "Options...Debugger" // -// and increase your programs Heap size to >64k. I don't // -// know if <64k will lock your system, but I had problems. // -// // -// Author : Grant Smith (Denthor) - denthor@beastie.cs.und.ac.za // -// Translator : Christopher G. Mann - r3cgm@dax.cc.uakron.edu // -// // -// Last Modified : December 23, 1994 // -// // -///////////////////////////////////////////////////////////////////////////// -#include "src\lib\dos_gfx.h" - -// declare a pointer to the offset of the Virtual Screen -byte *vaddr = NULL; -// declare a pointer to the offset of the VGA memory -byte *vga = (byte *) MK_FP(VMEM, 0); -int old_mode; -//color てすと -int gq = LGQ; -//てすと -int q = 0; -int bakax = 0, bakay = 0; -int xx = 0, yy = 0, sx = 0, sy = 0; -byte coor; - -///////////////////////////////////////////////////////////////////////////// -// // -// setvideo() - This function Manages the video modes // -// // -///////////////////////////////////////////////////////////////////////////// -void setvideo(byte mode, int vq){ - union REGS in, out; - - if(!vq){ // deinit the video - // change to the video mode we were in before we switched to mode 13h - in.h.ah = 0x00; - in.h.al = old_mode; - int86(0x10, &in, &out); - }else if(vq == 1){ // init the video - // get old video mode - in.h.ah = 0xf; - int86(0x10, &in, &out); - old_mode = out.h.al; - - // enter mode - in.h.ah = 0x00; - in.h.al = mode; - // vesa - //in.x.ax = 0x4f02; - //in.x.bx = mode; - int86(0x10, &in, &out); - } -} - -///////////////////////////////////////////////////////////////////////////// -// // -// setvbuff() - This manages the memory needed for the virtual screen. // -// // -///////////////////////////////////////////////////////////////////////////// -// manages the buffer/virtual screen -void setvbuff(int vq){ - if(!vq){ - free(vaddr); - }else if(vq == 1){ - vaddr = (byte *) calloc(SW*SH, 1); - - if(vaddr == NULL){ - setvideo(0x03, 1); - cout << "Not enough video memory available, exiting program...."; - exit(1); - } - } -} - -///////////////////////////////////////////////////////////////////////////// -// // -// updatevbuff() - This flips the virtual screen to the VGA screen. // -// // -///////////////////////////////////////////////////////////////////////////// -// updates the buffer/virtual screen -void updatevbuff(){ -/* // wait for vertical re-trace - while(inportb(INPUT_STATUS_0) & 8); - while(!(inportb(INPUT_STATUS_0) & 8));*/ - - // copy everything to video memory - _fmemcpy(vga, vaddr, SW*SH); -} - -///////////////////////////////////////////////////////////////////////////// -// // -// cls() - This clears the screen to the specified color, on the VGA or on // -// the Virtual screen. // -// // -///////////////////////////////////////////////////////////////////////////// -void cls(byte color, byte *Where){ - _fmemset(Where, color, SW*SH); -} - -// clears the entire video output -void clearscr(){ - cls(0, vga); - cls(0, vaddr); -} - -///////////////////////////////////////////////////////////////////////////// -// // -// plotpixel() - This puts a pixel at X,Y using color Col, on VGA or the // -// Virtual Screen; // -// // -///////////////////////////////////////////////////////////////////////////// -void plotpixel(int x, int y, byte color, byte *Where){ - memset(Where+(x+(y*SW)),color,1); -} - -// king_crimson's code -void ppf(int x, int y, byte color, byte *Where) { - byte far *vidptr; - vidptr = (byte far *)(Where + y*SW + x); - *vidptr = color; -} - -///////////////////////////////////////////////////////////////////////////// -// // -// BlockMove() - This tests various ways of moving a block around the // -// screen. // -// // -///////////////////////////////////////////////////////////////////////////// -//てすと -void BlockMove(){ - int loop1, loop2, loop3; - - // This draws a block directly to the VGA with no flipping - for(loop1=1; loop1<271; loop1++){ - for(loop2=1; loop2<51; loop2++) - for(loop3=1; loop3<51; loop3++) - plotpixel(loop1+loop2,loop3,32, vga); - cls(0,vga); - } - - //` - for(loop1=1; loop1<281; loop1++){ - for(loop2=1; loop2<41; loop2++) - for(loop3=1; loop3<41; loop3++) - plotpixel(loop1+loop2,loop3,14, vaddr); - //updatevbuff(); - cls(0,vaddr); - } - -/* // This draws to the virtual screen, waits for retrace, then flips to VGA - for(loop1=1; loop1<51; loop1++){ - for(loop2=1; loop2<51; loop2++) - for(loop3=1; loop3<51; loop3++) - plotpixel(loop1+loop2,loop3,32, vaddr); -// WaitRetrace(); - updatevbuff(); - cls(0,vaddr); - }*/ -} - -void eraseplayer(int x = 160, int y = 100){ - memset(vaddr+(x+(y*SW)),gq-1,1); -} - -void drawplayer(int x = 160, int y = 100, int color = 0){ - memset(vaddr+(x+(y*SW)),color,1); -} - -//color てすと -int colortest(){ - if(gq < NUM_COLORS){ - cls(gq, vaddr); - gq++; - }else gq = 0; - return gq; -} - -//color てすと -int colorz(){ - if(gq < HGQ){ - cls(gq, vaddr); - gq++; - }else gq = LGQ; - return gq; -} - -//slow spectrum down -void ssd(int svq){ - if(sy < SH+1){ - if(sx < SW+1){ - //plotpixel(xx, yy, coor, vga); - ppf(sx, sy, coor, vga); - //printf("%d %d %d %d\n", sx, sy, svq, coor); - sx++; - }else sx = 0; - if(sx == SW){ - sy++; - if(svq == 7) coor++; - if(sy == SH && svq == 8) coor = rand()%NUM_COLORS; - } - }else sy = 0; -} - -//inefficient pallette dumping -void pdump(int mult){ - int palq=mult*16; - int palcol=0; - for(int paly=0; paly0){ - yy++; - d3y--; - } - } - if(bakax<0){ - xx--; - }else - if(bakax>0){ - xx++; - } - }else{ - if(!bakax){ - xx--; - }else{ - xx++; - } - if(!bakay){ - yy--; - }else{ - yy++; - } - } - // plot the pixel - ppf(xx, yy, coor, vga); - if(q==2) ppf(rand()%SW, rand()%SH, 0, vga); - if(q==2||q==4){ bakax = rand()&0x1; bakay = rand()&0x1; } - gq++; -// printf("%d %d %d %d\n", xx, yy, gq, coor); - }else gq = LGQ; - return gq; -} diff --git a/src/lib/dos_gfx.h b/src/lib/dos_gfx.h deleted file mode 100644 index cb4119cb..00000000 --- a/src/lib/dos_gfx.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _DOSLIB_GFX_H_ -#define _DOSLIB_GFX_H_ -#include -#include -#include "src\lib\lib_com.h" - -#define SW 320 // width in pixels of vga mode -#define SH 200 // height in pixels of vga mode -#define NUM_COLORS 256 // number of colors in vga mode -//static lgq=NUM_COLORS/(1/8) -//static hgq=NUM_COLORS/(1/8) -/*#define SW 320 -#define SH 200 -#define NUM_COLORS 4*/ // cga -#define BONK 400 -#define LGQ 32 -#define HGQ 56 -#define VMEM 0xA000 // = vga -//#define VMEM 0xB800 // = cga -//#define VMOD 0x13 - -void setvideo(byte mode, int vq); -void setvbuff(int vq); -void updatevbuff(); -void cls(byte color, byte *Where); -void clearscr(); -void plotpixel(int x, int y, byte color, byte *Where); -void plotpixelfast(int x, int y, byte color, byte *Where); -void BlockMove(); -void eraseplayer(int x, int y); -void drawplayer(int x, int y, int color); -int colortest(); -int colorz(); -void ssd(int svq); -void pdump(int mult); -void tulip(); -int ding(int q); - -#endif/*_DOSLIB_GFX_H_*/ diff --git a/src/lib/dos_opl2.cpp b/src/lib/dos_opl2.cpp deleted file mode 100644 index d78ecb3b..00000000 --- a/src/lib/dos_opl2.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/* C Source File: ADLIB ***************************************************** - -Author: Kevin A. Lee - -Last Amended: 27th March, 1993 - -Description: Low-level interface to the Adlib (or compatible) -FM sound card. All information gleaned from -Jeffrey S. Lee's "Programming the Adlib/Sound -Blaster FM Music Chips". See Lee's document for -further information. -Compiled succesfully under Turbo C, Borland C++, -and Microsoft Quick C (all latest versions). - -****************************************************************************/ -#include "src\lib\opl2.h" - -//sound てすと -int sq = 0; - -/* Function: WriteFM ******************************************************** -* -* Parameters: reg - which FM register to write to. -* value - value to write. -* -* Description: writes a value to the specified register and -* waits for the "official" recommended periods. -* -*/ -void WriteFM(int reg, int value){ - int i; - - outp(ADLIB_FM_ADDRESS, (byte)reg); /* set up the register */ - for (i = 0; i < 6; i++) inp(ADLIB_FM_ADDRESS); /* wait 12 cycles */ - outp(ADLIB_FM_DATA, (byte)value); /* write out the value */ - for(i = 0; i < 35; i++) inp(ADLIB_FM_ADDRESS); /* wait 84 cycles */ -} /* End of WriteFM */ - -/* Function: ReadFM ********************************************************* -* -* Returns: the value in the status register. -* -* Description: return a value in the status register. -* -*/ -int ReadFM(void){ - return(inp(ADLIB_FM_ADDRESS)); -} /* End of ReadFM */ - -/* Function: AdlibExists **************************************************** -* -* Returns: 1 (true) if an Adlib compatible sound card -* is present, else 0 (false). -* -* Description: determines whether an Adlib (or compatible) -* sound card is present. -* -*/ -int AdlibExists(void){ - int stat1, stat2; - - WriteFM(0x04, 0x60); /* reset both timers */ - WriteFM(0x04, 0x80); /* enable timer interrupts */ - stat1 = ReadFM(); /* read status register */ - WriteFM(0x02, 0xFF); - WriteFM(0x04, 0x21); /* start timer 1 */ -// wait(80); /* could do something useful*/ - stat2 = ReadFM(); /* read status register */ - WriteFM(0x04, 0x60); /* reset both timers */ - WriteFM(0x04, 0x80); /* enable timer interrupts */ - - if(((stat1 & 0xE0) == 0x00) && ((stat2 & 0xE0) == 0xC0)) return(1); - return(0); -} /* End of AdlibExists */ - -/* Function: FMResest ******************************************************* -* -* Description: quick and dirty sound card reset (zeros all -* registers). -* -*/ -void FMReset(void/*int percusiveMode*/){ - int i; - - /* zero all registers */ - for(i = MIN_REGISTER; i < MAX_REGISTER+1; i++) WriteFM(i, 0); - - /* allow FM chips to control the waveform of each operator */ - WriteFM(0x01, 0x20); - - /* set rhythm enabled (6 melodic voices, 5 percussive) */ - WriteFM(0xBD, 0x20); - - //FMSetPercusiveMode(percusiveMode); -} /* End of FMReset */ -/* -void FMSetPercusiveMode(int state){ - if(state){ - WriteFM(0xBD, 0x20); - currentBDContents = 0x20; - percussiveMode = 1; - voiceModulator[7] = 16; - voiceModulator[8] = 14; - // we have to set the freq of voice 7 & 8 for the white noise gen. - // these frequency choices could certainly be better - WriteFM(0xa7, 1844 & 0xff); - WriteFM(0xb7, 1844 >> 8); - WriteFM(0xa8, 3764 & 0xff); - WriteFM(0xb8, 3764 >> 8); - }else{ - WriteFM(0xBD, 0); - percussiveMode = 0; - currentBDContents = 0; - voiceModulator[7] = 13; - voiceModulator[8] = 14; - } -} -*/ -/* Function: FMKeyOff ******************************************************* -* -* Parameters: voice - which voice to turn off. -* -* Description: turns off the specified voice. -* -*/ -void FMKeyOff(int voice){ - int regNum; - - /* turn voice off */ - regNum = 0xB0 + voice % NUMVOICE; - WriteFM(regNum, 0x0E); -} /* End of FMKeyOff */ - -/* Function: FMKeyOn ******************************************************* -* -* Parameters: voice - which voice to turn on. -* freq - its frequency (note). -* octave - its octave. -* -* Description: turns on a voice of specfied frequency and -* octave. -* -*/ -void FMKeyOn(int voice, int freq, int octave){ - int regNum, tmp; - - regNum = 0xA0 + voice % NUMVOICE; - WriteFM(regNum, freq & 0xff); - regNum = 0xB0 + voice % NUMVOICE; - tmp = (freq >> 8) | (octave << 2) | 0x20; - WriteFM(regNum, tmp); -} /* End of FMKeyOn */ - -/* Function: FMVoiceVolume ************************************************** -* -* Parameters: voice - which voice to set volume of -* vol - new volume value (experiment). -* -* Description: sets the volume of a voice to the specified -* value in the range (0-63)? -* -*/ -void FMVoiceVolume(int voice, int vol){ - int regNum; - - regNum = 0x40 + voice % NUMVOICE; - WriteFM(regNum, vol); -} /* End of FMVoiceVolume */ - -/* Function: FMSetVoice ***************************************************** -* -* Parameters: voiceNum - which voice to set. -* ins - instrument to set voice. -* -* Description: sets the instrument of a voice. -* -*/ -void FMSetVoice(int voiceNum, FMInstrument *ins){ - int opCellNum, cellOffset; - - voiceNum %= NUMVOICE; - cellOffset = voiceNum % 3 + ((voiceNum / 3) << 3); - - /* set sound characteristic */ - opCellNum = 0x20 + (char)cellOffset; - WriteFM(opCellNum, ins->SoundCharacteristic[0]); - opCellNum += 3; - WriteFM(opCellNum, ins->SoundCharacteristic[1]); - - /* set level/output */ - opCellNum = 0x40 + (char)cellOffset; - WriteFM(opCellNum, ins->Level[0]); - opCellNum += 3; - WriteFM(opCellNum, ins->Level[1]); - - /* set Attack/Decay */ - opCellNum = 0x60 + (char)cellOffset; - WriteFM(opCellNum, ins->AttackDecay[0]); - opCellNum += 3; - WriteFM(opCellNum, ins->AttackDecay[1]); - - /* set Sustain/Release */ - opCellNum = 0x80 + (char)cellOffset; - WriteFM(opCellNum, ins->SustainRelease[0]); - opCellNum += 3; - WriteFM(opCellNum, ins->SustainRelease[1]); - - /* set Wave Select */ - opCellNum = 0xE0 + (char)cellOffset; - WriteFM(opCellNum, ins->WaveSelect[0]); - opCellNum += 3; - WriteFM(opCellNum, ins->WaveSelect[1]); - - /* set Feedback/Selectivity */ - opCellNum = (byte)0xC0 + (byte)voiceNum; - WriteFM(opCellNum, ins->Feedback); -} /* End of FMSetVoice */ - -/* Function: LoadSBI ******************************************************** -* -* Parameters: fileName - name of .SBI file. -* ins - variable to place data in. -* -* Description: loads a .SBI into the instrument structure. -* -*/ -//int LoadSBI(char fileName[], FMInstrument *ins){ -// int i; -// FILE *fp; -// size_t structSize = sizeof(FMInstrument); -// -// if ((fp = fopen(fileName, "rb")) == NULL) return (0); -// -// /* skip the header - or do we? */ -// for (i = 0; i < 36; i++) fgetc(fp); -// -// /* read the data */ -// fread(ins, structSize, 1, fp); -// -// fclose(fp); -// return (1); -//} /* End of LoadSBI */ - -unsigned short Notes[] = { - 19327 , /* C b */ - 18242 , /* C */ - 17218 , /* C # ( D b ) */ - 16252 , /* D */ - 15340 , /* D # ( E b ) */ - 14479 , /* E ( F b ) */ - 13666 , /* F ( E # ) */ - 12899 , /* F # ( G b ) */ - 12175 , /* G */ - 11492 , /* G # ( A b ) */ - 10847 , /* A */ - 10238 , /* A # ( B b ) */ - 9664 , /* B ( C b ) */ - 9121 , /* B # */ - 0 -}; - -/* test of the routines */ -void fmtest(){ - enum SCALE test[] = { D4, E4, F4, G4, A4, B4, C4 }; -// enum SCALE oct4[] = { 493.88, 466.16, 440, 415.3, 392, 369.99, 349.23, 329.63, 311.13, 293.66, 277.18, 261.63 }; - static FMInstrument testInst = -{ -0x00, 0x01, /* modulator frequency multiple... 0x20 */ -0x00, 0x00, /* modulator frequency level... 0x40 */ -0xF0, 0xF0, /* modulator attack/decay... 0x60 */ -0x73, 0x73, /* modulator sustain/release... 0x80 */ -0x03, 0x00, /* output waveform distortion 0xE0 */ -0x36, /* feedback algorithm and strength 0xC0 */ -}; - int i; - printf("Now testing tune....\n"); -// printf("just hit any key 7 times.\n"); - FMReset(); - FMSetVoice(0, &testInst); - //extra -// WriteFM(0xB0, 0x09); -// WriteFM(0xB3, 0x07); - //extra - for(i = 0; i < 7; i++){ - FMKeyOn(0, test[i], 4); - sound(test[i]); - wait(20); -// getche(); - FMKeyOff(0); - nosound(); - wait(1); - } -} - -//sound てすと -int soundtest(){ - enum SCALE test[] = { D4, E4, F4, G4, A4, B4, C4 }; - //FMKeyOn(0, test[sq], 4); - if(sq < 7){ - sq++; - }else sq = 0; - FMKeyOff(0); - return sq; -} \ No newline at end of file diff --git a/src/lib/opl2.h b/src/lib/opl2.h deleted file mode 100644 index 5c0a1cfb..00000000 --- a/src/lib/opl2.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef _DOSLIB_SND_H_ -#define _DOSLIB_SND_H_ -/* C Header File: ADLIB ***************************************************** - -Author: Kevin A. Lee - -Last Amended: 27th April, 1993 - -Description: Low-level interface to the Adlib (or compatible) - FM sound card. All information gleaned from - Jeffrey S. Lee's "Programming the Adlib/Sound - Blaster FM Music Chips". See Lee's document for - further information. - -Compiled succesfully under Turbo C, Borland C++, -and Microsoft Quick C (all latest versions). - -****************************************************************************/ -#include "src\lib\lib_com.h" - -#define NUMVOICE 11 -#define FACTOR 1193180 -#define OCTAVE 4 - -#define MIN_REGISTER 0x01 -#define MAX_REGISTER 0xF5 -#define ADLIB_FM_ADDRESS 0x388 /* adlib address/status register */ -#define ADLIB_FM_DATA 0x389 /* adlib data register */ - -/* -static int percussiveMode = 0,currentBDContents = 0; -//static int opTable[18] = {0,1,2,3,4,5,8,9,10,11,12,13,16,17,18,19,20,21}; -static int voiceModulator[11] = {0,1,2,6,7,8,12,16,14,17,13}; -static int voiceCarrier[9] = {3,4,5,9,10,11,15,16,17}; -*/ - -/* -* FM Instrument definition for .SBI files - SoundBlaster instrument -* - these are the important parts - we will skip the header, but since -* I am not sure where it starts and ends so I have had to guess. -* However it SEEMS! to work. Each array has two values, one for -* each operator. -*/ -typedef struct{ - byte SoundCharacteristic[2]; /* modulator frequency multiple... */ - byte Level[2]; /* modulator frequency level... */ - byte AttackDecay[2]; /* modulator attack/decay... */ - byte SustainRelease[2]; /* modulator sustain/release... */ - byte WaveSelect[2]; /* output waveform distortion */ - byte Feedback; /* feedback algorithm and strength */ -} FMInstrument; - -/* -* Enumerated F-Numbers (in octave 4) for the chromatic scale. -*/ -/*enum oct{ - B4 = 493.88, - B4b = 466.16, - A4 = 440, - A4b = 415.3, - G4 = 392, - G4b = 369.99, - F4 = 349.23, - E4 = 329.63, - E4b = 311.13, - D4 = 293.66, - D4b = 277.18, - C4 = 261.63, - A0 = 27.50 -};*/ -enum SCALE{ - B4 = 0x1EE, - B4b = 0x1D2, - A4 = 440, - A4b = 0x19F, - G4 = 0x188, - G4b = 0x172, - F4 = 0x15D, - E4 = 0x14A, - E4b = 0x137, - D4 = 0x126, - D4b = 0x115, - C4 = 0x106, - A0 = 0x7F2 -}; - -/* function prototyping */ -void WriteFM(int reg, int value); -int ReadFM(void); -int AdlibExists(void); -void FMReset(/*int percusiveMode*/); /* Resets the card, quiets all voices, sets the percussive mode state */ -void FMKeyOff(int voice); -void FMKeyOn(int voice, int freq, int octave); -void FMVoiceVolume(int voice, int vol); -void FMSetVoice(int voiceNum, FMInstrument *ins); -/* Remember: percussion instruments must be assigned only to the correct voice number. */ -//void FMSetPercusiveMode(int state); -//int LoadSBI(char filename[], FMInstrument *ins); -void fmtest(void); -int soundtest(); -#endif/*_DOSLIB_SND_H_*/ \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index dfbabbc9..00000000 --- a/src/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// 16 core version 0.0009.84a // wwww -//Game name: "話の地球"//very 1st game -//Series name: "CRAZY ACORN PROJECT"//temperary name -//Working name: "Project 16"// -#include -#include -#include - -#include "src\eng_core.h" - -int main(/*int argc, const char* argv[]*/) -{ - - engine::Core c; - c.run(); - - //int a; - //std::cin >> a; - return EXIT_SUCCESS; -} \ No newline at end of file diff --git a/src/timer.cpp b/src/timer.cpp deleted file mode 100644 index f491d064..00000000 --- a/src/timer.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "src\timer.h" -#include - -namespace engine { - Timer::Timer() - { - //default constructor - } - - clock_t Timer::start_timer() - { - //time(&(this->t)); - this->t = clock(); - return this->t; - } - - double Timer::elapsed_timer() - { - return static_cast(clock() - this->t) / CLOCKS_PER_SEC;//difftime(time(NULL), this->t); - } - - double Timer::time_in_seconds() - { - return static_cast(this->t) / CLOCKS_PER_SEC; - } - - double Timer::time_in_seconds(time_t in_t) - { - return static_cast(in_t) / CLOCKS_PER_SEC; - } - - clock_t Timer::_time() - { - return this->t; - } - - Timer::~Timer() - { - //deconstructor - } -} \ No newline at end of file diff --git a/src/timer.h b/src/timer.h deleted file mode 100644 index c7ba5877..00000000 --- a/src/timer.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _TIMER_H_ -#define _TIMER_H_ -#include - -namespace engine { - class Timer - { - public: - Timer(); - clock_t start_timer(); - double elapsed_timer(); - double time_in_seconds(); - double time_in_seconds(time_t in_t); - clock_t _time(); - ~Timer(); - protected: - private: - clock_t t; - }; -} - -#endif \ No newline at end of file diff --git a/test.c b/test.c new file mode 100644 index 00000000..c5b9d7dc --- /dev/null +++ b/test.c @@ -0,0 +1,75 @@ +#include "modex16.h" +#include + +word far* clock= (word far*) 0x046C; /* 18.2hz clock */ + +void main() { + int i, j; + word start, end; + page_t page, page2; + byte *pal, *pal2=NULL; + + /* load our palette */ + modexLoadPalFile("gfx.pal", &pal2); + + /* save the palette */ + pal = modexNewPal(); + modexPalSave(pal); + modexFadeOff(1, pal); + modexPalBlack(); + + modexEnter(); + modexPalBlack(); + + /* set up the page, but with 16 pixels on all borders in offscreen mem */ + page=modexDefaultPage(); + page2 = modexNextPage(&page); + page.width += 32; + page.height += 32; + + + /* fill the page with one color, but with a black border */ + modexShowPage(&page2); + modexClearRegion(&page, 16, 16, SCREEN_WIDTH, SCREEN_HEIGHT, 128); + modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42); + modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128); + modexShowPage(&page); + + /* fade in */ + modexFadeOn(1, pal2); + + + start = *clock; + for(i=0; i<5; i++) { + /* go right */ + for(j=0; j<32; j++) { + page.dx++; + modexShowPage(&page); + } + /* go left */ + for(j=0; j<32; j++) { + page.dx--; + modexShowPage(&page); + } + /* go up */ + for(j=0; j<32; j++) { + page.dy++; + modexShowPage(&page); + } + + /* go down */ + for(j=0; j<32; j++) { + page.dy--; + modexShowPage(&page); + } + } + + end = *clock; + + /* fade back to text mode */ + modexFadeOff(1, pal2); + modexPalBlack(); + modexLeave(); + modexPalBlack(); + modexFadeOn(1, pal); +} diff --git a/test.exe b/test.exe new file mode 100644 index 00000000..99404b1a Binary files /dev/null and b/test.exe differ diff --git a/test2.c b/test2.c new file mode 100644 index 00000000..9118279f --- /dev/null +++ b/test2.c @@ -0,0 +1,19 @@ +#include "modex16.h" + +word far* clock= (word far*) 0x046C; /* 18.2hz clock */ + +void main() { + int i; + word start; + page_t page; + + page=modexDefaultPage(); + + modexEnter(); + start = *clock; + for(i=0; i<500; i++) { + modexShowPage(&page); + } + modexLeave(); + +} diff --git a/test2.exe b/test2.exe new file mode 100644 index 00000000..2b870eff Binary files /dev/null and b/test2.exe differ diff --git a/types.h b/types.h new file mode 100644 index 00000000..039653f2 --- /dev/null +++ b/types.h @@ -0,0 +1,11 @@ +/* + * Just some handy typedefs that make it easier to think about the low + * level code + */ + +typedef unsigned char byte; +typedef unsigned short word; +typedef unsigned long dword; +typedef signed char sbyte; +typedef signed short sword; +typedef signed long sdword; diff --git a/wide/16.bat b/wide/16.bat deleted file mode 100644 index 1054c0f9..00000000 --- a/wide/16.bat +++ /dev/null @@ -1,3 +0,0 @@ -del *.err -del *.smp -wmake -f proj16.mk -e -h > 16.err diff --git a/wide/core16.lk1 b/wide/core16.lk1 deleted file mode 100644 index 609d331a..00000000 --- a/wide/core16.lk1 +++ /dev/null @@ -1,2 +0,0 @@ -FIL dos_comm.obj,eng_ai.obj,eng_comm.obj,eng_core.obj,eng_gfx.obj,eng_snd.obj,dos_gfx.obj,dos_opl2.obj,lib_com.obj,main.obj,timer.obj - diff --git a/wide/proj16.mk b/wide/proj16.mk deleted file mode 100644 index 5344e111..00000000 --- a/wide/proj16.mk +++ /dev/null @@ -1,3 +0,0 @@ -project : C:\Z\16\core16.exe .SYMBOLIC - -!include C:\Z\16\proj16.mk1 diff --git a/wide/proj16.mk1 b/wide/proj16.mk1 deleted file mode 100644 index 26d0ae35..00000000 --- a/wide/proj16.mk1 +++ /dev/null @@ -1,82 +0,0 @@ -!define BLANK "" -C:\Z\16\dos_comm.obj : C:\Z\16\src\lib\dos_comm.c .AUTODEPEND - @C: - cd C:\Z\16 - *wcc src\lib\dos_comm.c -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -ol& - -ol+ -oh -om -d2 -bt=dos -fo=.obj -ml - -C:\Z\16\eng_ai.obj : C:\Z\16\src\eng_ai.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\eng_ai.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -ol -ol& -+ -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\eng_comm.obj : C:\Z\16\src\eng_comm.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\eng_comm.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -ol -& -ol+ -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\eng_core.obj : C:\Z\16\src\eng_core.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\eng_core.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -ol -& -ol+ -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\eng_gfx.obj : C:\Z\16\src\eng_gfx.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\eng_gfx.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -ol -o& -l+ -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\eng_snd.obj : C:\Z\16\src\eng_snd.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\eng_snd.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -ol -o& -l+ -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\dos_gfx.obj : C:\Z\16\src\lib\dos_gfx.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\lib\dos_gfx.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -o& -l -ol+ -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\dos_opl2.obj : C:\Z\16\src\lib\dos_opl2.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\lib\dos_opl2.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -& -ol -ol+ -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\lib_com.obj : C:\Z\16\src\lib\lib_com.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\lib\lib_com.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -o& -l -ol+ -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\main.obj : C:\Z\16\src\main.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\main.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -ol -ol+ & --oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\timer.obj : C:\Z\16\src\timer.cpp .AUTODEPEND - @C: - cd C:\Z\16 - *wpp src\timer.cpp -i="c:\fdos\WATCOM/h" -w4 -e25 -zkl -zq -otexan -ol -ol+& - -oh -om -d2 -bt=dos -fo=.obj -ml -xs -xr - -C:\Z\16\core16.exe : C:\Z\16\dos_comm.obj C:\Z\16\eng_ai.obj C:\Z\16\eng_com& -m.obj C:\Z\16\eng_core.obj C:\Z\16\eng_gfx.obj C:\Z\16\eng_snd.obj C:\Z\16\d& -os_gfx.obj C:\Z\16\dos_opl2.obj C:\Z\16\lib_com.obj C:\Z\16\main.obj C:\Z\16& -\timer.obj C:\Z\16\src\eng_ai.h C:\Z\16\src\eng_comm.h C:\Z\16\src\eng_core.& -h C:\Z\16\src\eng_gfx.h C:\Z\16\src\eng_snd.h C:\Z\16\src\engine.h C:\Z\16\s& -rc\lib\dos_comm.h C:\Z\16\src\lib\dos_gfx.h C:\Z\16\src\lib\lib_com.h C:\Z\1& -6\src\lib\opl2.h C:\Z\16\src\timer.h .AUTODEPEND - @C: - cd C:\Z\16 - @%write core16.lk1 FIL dos_comm.obj,eng_ai.obj,eng_comm.obj,eng_core.obj,en& -g_gfx.obj,eng_snd.obj,dos_gfx.obj,dos_opl2.obj,lib_com.obj,main.obj,timer.ob& -j - @%append core16.lk1 - *wlink name core16 d all sys dos op m op maxe=25 op q op symf @core16.lk1 - diff --git a/wide/proj16.tgt b/wide/proj16.tgt deleted file mode 100644 index bdea7782..00000000 --- a/wide/proj16.tgt +++ /dev/null @@ -1,726 +0,0 @@ -40 -targetIdent -0 -MProject -1 -MComponent -0 -2 -WString -3 -EXE -3 -WString -5 -de6e9 -1 -0 -1 -4 -MCommand -0 -5 -MCommand -0 -6 -MItem -10 -core16.exe -7 -WString -3 -EXE -8 -WVList -0 -9 -WVList -2 -10 -ActionStates -11 -WString -5 -&Make -12 -WVList -0 -13 -ActionStates -14 -WString -7 -Sam&ple -15 -WVList -0 --1 -1 -1 -0 -16 -WPickList -25 -17 -MItem -3 -*.c -18 -WString -4 -COBJ -19 -WVList -8 -20 -MRState -21 -WString -3 -WCC -22 -WString -37 -?????No double-byte character support -1 -0 -23 -MRState -24 -WString -3 -WCC -25 -WString -22 -?????Current code page -1 -1 -26 -MRState -27 -WString -3 -WCC -28 -WString -21 -?????No optimizations -1 -0 -29 -MRState -30 -WString -3 -WCC -31 -WString -26 -?????Fastest possible code -1 -1 -32 -MCState -33 -WString -3 -WCC -34 -WString -23 -?????Loop optimizations -1 -1 -35 -MCState -36 -WString -3 -WCC -37 -WString -19 -?????Loop unrolling -1 -1 -38 -MCState -39 -WString -3 -WCC -40 -WString -33 -?????Allow repeated optimizations -1 -1 -41 -MCState -42 -WString -3 -WCC -43 -WString -23 -?????Math optimizations -1 -1 -44 -WVList -0 --1 -1 -1 -0 -45 -MItem -18 -src\lib\dos_comm.c -46 -WString -4 -COBJ -47 -WVList -0 -48 -WVList -0 -17 -1 -1 -0 -49 -MItem -5 -*.cpp -50 -WString -6 -CPPOBJ -51 -WVList -8 -52 -MRState -53 -WString -3 -WPP -54 -WString -37 -?????No double-byte character support -1 -0 -55 -MRState -56 -WString -3 -WPP -57 -WString -22 -?????Current code page -1 -1 -58 -MRState -59 -WString -3 -WPP -60 -WString -21 -?????No optimizations -1 -0 -61 -MRState -62 -WString -3 -WPP -63 -WString -26 -?????Fastest possible code -1 -1 -64 -MCState -65 -WString -3 -WPP -66 -WString -23 -?????Loop optimizations -1 -1 -67 -MCState -68 -WString -3 -WPP -69 -WString -19 -?????Loop unrolling -1 -1 -70 -MCState -71 -WString -3 -WPP -72 -WString -33 -?????Allow repeated optimizations -1 -1 -73 -MCState -74 -WString -3 -WPP -75 -WString -23 -?????Math optimizations -1 -1 -76 -WVList -1 -77 -ActionStates -78 -WString -5 -&Make -79 -WVList -1 -80 -MCState -81 -WString -5 -WMAKE -82 -WString -26 -?????Echo progress of work -1 -1 --1 -1 -1 -0 -83 -MItem -14 -src\eng_ai.cpp -84 -WString -6 -CPPOBJ -85 -WVList -0 -86 -WVList -0 -49 -1 -1 -0 -87 -MItem -16 -src\eng_comm.cpp -88 -WString -6 -CPPOBJ -89 -WVList -0 -90 -WVList -0 -49 -1 -1 -0 -91 -MItem -16 -src\eng_core.cpp -92 -WString -6 -CPPOBJ -93 -WVList -0 -94 -WVList -0 -49 -1 -1 -0 -95 -MItem -15 -src\eng_gfx.cpp -96 -WString -6 -CPPOBJ -97 -WVList -0 -98 -WVList -0 -49 -1 -1 -0 -99 -MItem -15 -src\eng_snd.cpp -100 -WString -6 -CPPOBJ -101 -WVList -0 -102 -WVList -0 -49 -1 -1 -0 -103 -MItem -19 -src\lib\dos_gfx.cpp -104 -WString -6 -CPPOBJ -105 -WVList -0 -106 -WVList -0 -49 -1 -1 -0 -107 -MItem -20 -src\lib\dos_opl2.cpp -108 -WString -6 -CPPOBJ -109 -WVList -0 -110 -WVList -0 -49 -1 -1 -0 -111 -MItem -19 -src\lib\lib_com.cpp -112 -WString -6 -CPPOBJ -113 -WVList -0 -114 -WVList -0 -49 -1 -1 -0 -115 -MItem -12 -src\main.cpp -116 -WString -6 -CPPOBJ -117 -WVList -0 -118 -WVList -0 -49 -1 -1 -0 -119 -MItem -13 -src\timer.cpp -120 -WString -6 -CPPOBJ -121 -WVList -0 -122 -WVList -0 -49 -1 -1 -0 -123 -MItem -3 -*.h -124 -WString -3 -NIL -125 -WVList -0 -126 -WVList -0 --1 -1 -0 -0 -127 -MItem -12 -src\eng_ai.h -128 -WString -3 -NIL -129 -WVList -0 -130 -WVList -0 -123 -1 -1 -0 -131 -MItem -14 -src\eng_comm.h -132 -WString -3 -NIL -133 -WVList -0 -134 -WVList -0 -123 -1 -1 -0 -135 -MItem -14 -src\eng_core.h -136 -WString -3 -NIL -137 -WVList -0 -138 -WVList -0 -123 -1 -1 -0 -139 -MItem -13 -src\eng_gfx.h -140 -WString -3 -NIL -141 -WVList -0 -142 -WVList -0 -123 -1 -1 -0 -143 -MItem -13 -src\eng_snd.h -144 -WString -3 -NIL -145 -WVList -0 -146 -WVList -0 -123 -1 -1 -0 -147 -MItem -12 -src\engine.h -148 -WString -3 -NIL -149 -WVList -0 -150 -WVList -0 -123 -1 -1 -0 -151 -MItem -18 -src\lib\dos_comm.h -152 -WString -3 -NIL -153 -WVList -0 -154 -WVList -0 -123 -1 -1 -0 -155 -MItem -17 -src\lib\dos_gfx.h -156 -WString -3 -NIL -157 -WVList -0 -158 -WVList -0 -123 -1 -1 -0 -159 -MItem -17 -src\lib\lib_com.h -160 -WString -3 -NIL -161 -WVList -0 -162 -WVList -0 -123 -1 -1 -0 -163 -MItem -14 -src\lib\opl2.h -164 -WString -3 -NIL -165 -WVList -0 -166 -WVList -0 -123 -1 -1 -0 -167 -MItem -11 -src\timer.h -168 -WString -3 -NIL -169 -WVList -0 -170 -WVList -0 -123 -1 -1 -0 diff --git a/wide/proj16.wpj b/wide/proj16.wpj deleted file mode 100644 index c78d9631..00000000 --- a/wide/proj16.wpj +++ /dev/null @@ -1,43 +0,0 @@ -40 -projectIdent -0 -VpeMain -1 -WRect --40 -0 -10320 -9946 -2 -MProject -3 -MCommand -0 -4 -MCommand -0 -1 -5 -WFileName -10 -proj16.tgt -6 -WVList -1 -7 -VComponent -8 -WRect -0 -0 -5700 -4293 -0 -0 -9 -WFileName -10 -proj16.tgt -0 -0 -7 diff --git a/wide/remake.bat b/wide/remake.bat deleted file mode 100644 index 2ddbf411..00000000 --- a/wide/remake.bat +++ /dev/null @@ -1 +0,0 @@ -ide2make -p proj16.wpj -h 8 proj16.tgt