From: sparky4 Date: Fri, 28 Nov 2014 20:03:20 +0000 (-0600) Subject: new file: 16/modex16.tar.7z X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=f66b2c6a16e6f6c2c9c07a39d1855b5ea178fead new file: 16/modex16.tar.7z deleted: 16/modex16/286@12.LOG deleted: 16/modex16/286@8.LOG deleted: 16/modex16/BITMAP.C deleted: 16/modex16/dos_kb.c deleted: 16/modex16/dos_kb.h deleted: 16/modex16/gfx.pal deleted: 16/modex16/lib/lib_head.cpp deleted: 16/modex16/lib/lib_head.h deleted: 16/modex16/makefile deleted: 16/modex16/modex16.c deleted: 16/modex16/modex16.h deleted: 16/modex16/pcxtest.exe deleted: 16/modex16/ptmp.pcx deleted: 16/modex16/ptmp.png deleted: 16/modex16/scroll.c deleted: 16/modex16/scroll.exe deleted: 16/modex16/test.exe deleted: 16/modex16/test.txt deleted: 16/modex16/test2.exe deleted: 16/modex16/types.h deleted: BITMAP.H modified: Project 16.bfproject renamed: 16/modex16/46113319.pcx -> data/46113319.pcx renamed: 16/modex16/COMPUTER.PCX -> data/COMPUTER.PCX renamed: 16/modex16/EDw.PCX -> data/EDw.PCX renamed: 16/modex16/MAYU.PCX -> data/MAYU.PCX renamed: 16/modex16/chikyuu.pcx -> data/chikyuu.pcx renamed: 16/modex16/ed.pcx -> data/ed.pcx renamed: 16/modex16/ed2.pcx -> data/ed2.pcx renamed: 16/modex16/koishi.pcx -> data/koishi.pcx renamed: 16/modex16/koishi^^.pcx -> data/koishi^^.pcx renamed: 16/modex16/koishi~.pcx -> data/koishi~.pcx renamed: ptmp.pcx -> data/ptmp.pcx renamed: 16/modex16/q.pcx -> data/q.pcx renamed: 16/modex16/rarity.pcx -> data/rarity.pcx renamed: 16/modex16/w.pcx -> data/w.pcx modified: makefile new file: makefile~ deleted: palettec.c deleted: pcxtest.c modified: pcxtest.exe modified: scroll.exe renamed: BITMAP.C -> src/lib/bitmap.c renamed: 16/modex16/BITMAP.H -> src/lib/bitmap.h renamed: dos_kb.c -> src/lib/dos_kb.c renamed: dos_kb.h -> src/lib/dos_kb.h renamed: lib/lib_head.cpp -> src/lib/lib_head.cpp renamed: lib/lib_head.h -> src/lib/lib_head.h renamed: modex16.c -> src/lib/modex16.c renamed: modex16.h -> src/lib/modex16.h renamed: types.h -> src/lib/types.h renamed: lib/wtest/WTEST.EXE -> src/lib/wtest/WTEST.EXE renamed: lib/wtest/makefile -> src/lib/wtest/makefile renamed: lib/wtest/wtest.c -> src/lib/wtest/wtest.c renamed: lib/wtest/wtest.h -> src/lib/wtest/wtest.h renamed: 16/modex16/palettec.c -> src/palettec.c renamed: 16/modex16/pcxtest.c -> src/pcxtest.c renamed: scroll.c -> src/scroll.c renamed: 16/modex16/test.c -> src/test.c renamed: 16/modex16/test2.c -> src/test2.c deleted: test.c modified: test.exe deleted: test2.c modified: test2.exe --- diff --git a/16/modex16.tar.7z b/16/modex16.tar.7z new file mode 100644 index 00000000..9782ad73 Binary files /dev/null and b/16/modex16.tar.7z differ diff --git a/16/modex16/286@12.LOG b/16/modex16/286@12.LOG deleted file mode 100644 index 34027049..00000000 --- a/16/modex16/286@12.LOG +++ /dev/null @@ -1,4 +0,0 @@ -Old non-sprite: 7.032967 -New non-sprite: 1.043956 -Old Sprite: 6.648352 -New Sprite: 1.648352 diff --git a/16/modex16/286@8.LOG b/16/modex16/286@8.LOG deleted file mode 100644 index a29ceffc..00000000 --- a/16/modex16/286@8.LOG +++ /dev/null @@ -1,4 +0,0 @@ -Old non-sprite: 10.439561 -New non-sprite: 1.373626 -Old Sprite: 9.945055 -New Sprite: 2.362637 diff --git a/16/modex16/BITMAP.H b/16/modex16/BITMAP.H deleted file mode 100644 index 4c4af98e..00000000 --- a/16/modex16/BITMAP.H +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/16/modex16/dos_kb.h b/16/modex16/dos_kb.h deleted file mode 100644 index 846946b3..00000000 --- a/16/modex16/dos_kb.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _DOSLIB_KB_H_ -#define _DOSLIB_KB_H_ -#include "lib\lib_head.h" - -/* Maximum number of scan codes on keyboard controllers */ -#define NUM_SCANCODES 128 - -#ifdef __cplusplus /* Functions must be declared C style */ -extern "C" { -#endif -void interrupt far newkb(void); -//extern void interrupt (far *oldkb)(void); -void setkb(int vq); -int keyp(byte c); - -/* Define macro */ -//#define kepn(c) key[c & 0x7F] - -#ifdef __cplusplus -} -#endif - -#endif/*_DOSLIB_KB_H_*/ diff --git a/16/modex16/gfx.pal b/16/modex16/gfx.pal deleted file mode 100644 index e98ae60e..00000000 Binary files a/16/modex16/gfx.pal and /dev/null differ diff --git a/16/modex16/lib/lib_head.cpp b/16/modex16/lib/lib_head.cpp deleted file mode 100644 index cc40b93b..00000000 --- a/16/modex16/lib/lib_head.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//#include "src\lib\lib_head.h" -#include "lib\lib_head.h" - -/* local function */ -void wait(clock_t wait); - -/* Function: Wait ********************************************************** -* -* Parameters: wait - time in microseconds -* -* Description: pauses for a specified number of microseconds. -* -*/ -void wait(clock_t wait){ - clock_t goal; - - if(!wait) return; - - goal = wait + clock(); - while((goal > clock()) && !kbhit()) ; -} /* End of wait */ \ No newline at end of file diff --git a/16/modex16/lib/lib_head.h b/16/modex16/lib/lib_head.h deleted file mode 100644 index ba2c8b59..00000000 --- a/16/modex16/lib/lib_head.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef _LIBHEAD_H_ -#define _LIBHEAD_H_ -#include -#include -#include // just for wait -#include // just for wait -#include "types.h" - -/* Control codes for all keys on the keyboard */ -//here temperarly -#define KEY_A (0x1E) -#define KEY_B (0x30) -#define KEY_C (0x2E) -#define KEY_D (0x20) -#define KEY_E (0x12) -#define KEY_F (0x21) -#define KEY_G (0x22) -#define KEY_H (0x23) -#define KEY_I (0x17) -#define KEY_J (0x24) -#define KEY_K (0x25) -#define KEY_L (0x26) -#define KEY_M (0x32) -#define KEY_N (0x31) -#define KEY_O (0x18) -#define KEY_P (0x19) -#define KEY_Q (0x10) -#define KEY_R (0x13) -#define KEY_S (0x1F) -#define KEY_T (0x14) -#define KEY_U (0x16) -#define KEY_V (0x2F) -#define KEY_W (0x11) -#define KEY_X (0x2D) -#define KEY_Y (0x15) -#define KEY_Z (0x2C) -#define KEY_1 (0x02) -#define KEY_2 (0x03) -#define KEY_3 (0x04) -#define KEY_4 (0x05) -#define KEY_5 (0x06) -#define KEY_6 (0x07) -#define KEY_7 (0x08) -#define KEY_8 (0x09) -#define KEY_9 (0x0A) -#define KEY_0 (0x0B) -#define KEY_DASH (0x0C) /* -_ */ -#define KEY_EQUAL (0x0D) /* =+ */ -#define KEY_LBRACKET (0x1A) /* [{ */ -#define KEY_RBRACKET (0x1B) /* ]} */ -#define KEY_SEMICOLON (0x27) /* ;: */ -#define KEY_RQUOTE (0x28) /* '" */ -#define KEY_LQUOTE (0x29) /* `~ */ -#define KEY_PERIOD (0x33) /* .> */ -#define KEY_COMMA (0x34) /* ,< */ -#define KEY_SLASH (0x35) /* /? */ -#define KEY_BACKSLASH (0x2B) /* \| */ -#define KEY_F1 (0x3B) -#define KEY_F2 (0x3C) -#define KEY_F3 (0x3D) -#define KEY_F4 (0x3E) -#define KEY_F5 (0x3F) -#define KEY_F6 (0x40) -#define KEY_F7 (0x41) -#define KEY_F8 (0x42) -#define KEY_F9 (0x43) -#define KEY_F10 (0x44) -#define KEY_ESC (0x01) -#define KEY_BACKSPACE (0x0E) -#define KEY_TAB (0x0F) -#define KEY_ENTER (0x1C) -#define KEY_CONTROL (0x1D) -#define KEY_LSHIFT (0x2A) -#define KEY_RSHIFT (0x36) -#define KEY_PRTSC (0x37) -#define KEY_ALT (0x38) -#define KEY_SPACE (0x39) -#define KEY_CAPSLOCK (0x3A) -#define KEY_NUMLOCK (0x45) -#define KEY_SCROLLLOCK (0x46) -#define KEY_HOME (0x47) -#define KEY_UP (0x48) -#define KEY_PGUP (0x49) -#define KEY_MINUS (0x4A) -#define KEY_LEFT (0x4B) -#define KEY_CENTER (0x4C) -#define KEY_RIGHT (0x4D) -#define KEY_PLUS (0x4E) -#define KEY_END (0x4F) -#define KEY_DOWN (0x50) -#define KEY_PGDOWN (0x51) -#define KEY_INS (0x52) -#define KEY_DEL (0x53) - -#define KEY_LWIN (0x73) -#define KEY_RWIN (0x74) -#define KEY_MENU (0x75) - - -//typedef unsigned char byte; -//typedef unsigned int word; -//typedef unsigned short syte; - -void wait(clock_t wait); - -#endif/*_LIBHEAD_H_*/ diff --git a/16/modex16/makefile b/16/modex16/makefile deleted file mode 100644 index b11f89a0..00000000 --- a/16/modex16/makefile +++ /dev/null @@ -1,37 +0,0 @@ -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/16/modex16/modex16.c b/16/modex16/modex16.c deleted file mode 100644 index f01116b5..00000000 --- a/16/modex16/modex16.c +++ /dev/null @@ -1,605 +0,0 @@ -#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/16/modex16/pcxtest.c b/16/modex16/pcxtest.c deleted file mode 100644 index 7373e885..00000000 --- a/16/modex16/pcxtest.c +++ /dev/null @@ -1,79 +0,0 @@ -#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/16/modex16/pcxtest.exe b/16/modex16/pcxtest.exe deleted file mode 100644 index de765ece..00000000 Binary files a/16/modex16/pcxtest.exe and /dev/null differ diff --git a/16/modex16/ptmp.png b/16/modex16/ptmp.png deleted file mode 100644 index e3e46aa8..00000000 Binary files a/16/modex16/ptmp.png and /dev/null differ diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c deleted file mode 100644 index 65ea0279..00000000 --- a/16/modex16/scroll.c +++ /dev/null @@ -1,508 +0,0 @@ -#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, *spri, *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 */ - draw = &mv; - spri = &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(spri, 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)) - { - modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 0, 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, 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--; - } - } - } - - 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==0) modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); - if(ls<1) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } - if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 48, 0, 24, 32, bmp); } - if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 0, 0, 24, 32, bmp); } - if(ls>=7) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } - break; - case 1: - // right - //if(ls==0) modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); - if(ls<1) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } - if(4>ls && ls>=1) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 48, 32, 24, 32, bmp); } - if(7>ls && ls>=4) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 0, 32, 24, 32, bmp); } - if(ls>=7) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } - break; - case 2: - //down - //if(ls==0) modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); - if(ls<1) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } - if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 48, 64, 24, 32, bmp); } - if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 0, 64, 24, 32, bmp); } - if(ls>=7) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } - break; - case 3: - //left - //if(ls==0) modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); - if(ls<1) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } - if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 48, 96, 24, 32, bmp); } - if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 0, 96, 24, 32, bmp); } - if(ls>=7) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } - break; - } -} diff --git a/16/modex16/scroll.exe b/16/modex16/scroll.exe deleted file mode 100755 index 6bf9ba9f..00000000 Binary files a/16/modex16/scroll.exe and /dev/null differ diff --git a/16/modex16/test.exe b/16/modex16/test.exe deleted file mode 100644 index 99404b1a..00000000 Binary files a/16/modex16/test.exe and /dev/null differ diff --git a/16/modex16/test.txt b/16/modex16/test.txt deleted file mode 100644 index 05adc9ec..00000000 --- a/16/modex16/test.txt +++ /dev/null @@ -1,258 +0,0 @@ -64 x 64 Pixels - -0 0 0 -20 0 0 -0 20 0 -20 20 0 -0 0 20 -20 0 20 -0 20 20 -30 30 30 -30 37 30 -29 32 3c -3f 3f 33 -3f 3f 26 -3f 3f 19 -3f 3f c -3f 33 3f -3f 33 33 -3f 33 26 -3f 33 19 -3f 33 c -3f 33 0 -3f 26 3f -3f 26 33 -3f 26 26 -3f 26 19 -3f 26 c -3f 26 0 -3f 19 3f -3f 19 33 -3f 19 26 -3f 19 19 -3f 19 c -3f 19 0 -3f c 3f -3f c 33 -3f c 26 -3f c 19 -3f c c -3f c 0 -3f 0 33 -3f 0 26 -3f 0 19 -3f 0 c -33 3f 3f -33 3f 33 -33 3f 26 -33 3f 19 -33 3f c -33 3f 0 -33 33 3f -33 33 33 -33 33 26 -33 33 19 -33 33 c -33 33 0 -33 26 3f -33 26 33 -33 26 26 -33 26 19 -33 26 c -33 26 0 -33 19 3f -33 19 33 -33 19 26 -33 19 19 -33 19 c -33 19 0 -33 c 3f -33 c 33 -33 c 26 -33 c 19 -33 c c -33 c 0 -33 0 3f -33 0 33 -33 0 26 -33 0 19 -33 0 c -33 0 0 -26 3f 3f -26 3f 33 -26 3f 26 -26 3f 19 -26 3f c -26 3f 0 -26 33 3f -26 33 33 -26 33 26 -26 33 19 -26 33 c -26 33 0 -26 26 3f -26 26 33 -26 26 26 -26 26 19 -26 26 c -26 26 0 -26 19 3f -26 19 33 -26 19 26 -26 19 19 -26 19 c -26 19 0 -26 c 3f -26 c 33 -26 c 26 -26 c 19 -26 c c -26 c 0 -26 0 3f -26 0 33 -26 0 26 -26 0 19 -26 0 c -26 0 0 -19 3f 3f -19 3f 33 -19 3f 26 -19 3f 19 -19 3f c -19 3f 0 -19 33 3f -19 33 33 -19 33 26 -19 33 19 -19 33 c -19 33 0 -19 26 3f -19 26 33 -19 26 26 -19 26 19 -19 26 c -19 26 0 -19 19 3f -19 19 33 -19 19 26 -19 19 19 -19 19 c -19 19 0 -19 c 3f -19 c 33 -19 c 26 -19 c 19 -19 c c -19 c 0 -19 0 3f -19 0 33 -19 0 26 -19 0 19 -19 0 c -19 0 0 -c 3f 3f -c 3f 33 -c 3f 26 -c 3f 19 -c 3f c -c 3f 0 -c 33 3f -c 33 33 -c 33 26 -c 33 19 -c 33 c -c 33 0 -c 26 3f -c 26 33 -c 26 26 -c 26 19 -c 26 c -c 26 0 -c 19 3f -c 19 33 -c 19 26 -c 19 19 -c 19 c -c 19 0 -c c 3f -c c 33 -c c 26 -c c 19 -c c c -c c 0 -c 0 3f -c 0 33 -c 0 26 -c 0 19 -c 0 c -c 0 0 -0 3f 33 -0 3f 26 -0 3f 19 -0 3f c -0 33 3f -0 33 33 -0 33 26 -0 33 19 -0 33 c -0 33 0 -0 26 3f -0 26 33 -0 26 26 -0 26 19 -0 26 c -0 26 0 -0 19 3f -0 19 33 -0 19 26 -0 19 19 -0 19 c -0 19 0 -0 c 3f -0 c 33 -0 c 26 -0 c 19 -0 c c -0 c 0 -0 0 33 -0 0 26 -0 0 19 -0 0 c -20 3f 3f -10 20 20 -20 3f 0 -10 10 0 -3f 3f 20 -3f 20 0 -3f 20 20 -20 10 0 -20 0 3f -20 0 10 -10 20 3f -0 10 20 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -3f 3e 3c -28 28 29 -20 20 20 -3f 0 0 -0 3f 0 -3f 3f 0 -0 0 3f -3f 0 3f -0 3f 3f -3f 3f 3f \ No newline at end of file diff --git a/16/modex16/test2.c b/16/modex16/test2.c deleted file mode 100644 index 9118279f..00000000 --- a/16/modex16/test2.c +++ /dev/null @@ -1,19 +0,0 @@ -#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/16/modex16/test2.exe b/16/modex16/test2.exe deleted file mode 100644 index 2b870eff..00000000 Binary files a/16/modex16/test2.exe and /dev/null differ diff --git a/BITMAP.C b/BITMAP.C deleted file mode 100644 index 8287e57d..00000000 --- a/BITMAP.C +++ /dev/null @@ -1,162 +0,0 @@ -#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/Project 16.bfproject b/Project 16.bfproject index af705867..2db68fb4 100644 --- a/Project 16.bfproject +++ b/Project 16.bfproject @@ -1,20 +1,20 @@ c2e.convert_special: 0 e2c.convert_num: 0 openfiles: /dos/z/16/doc/project.txt:60:0:0: -openfiles: /dos/z/16/scroll.c:10823:10140:1: -openfiles: /dos/z/16/modex16.c:6838:6141:0: -openfiles: /dos/z/16/modex16.h:1057:344:0: -openfiles: /dos/z/16/pcxtest.c:753:655:0: -openfiles: /dos/z/16/dos_kb.c:3759:0:0: -openfiles: /dos/z/16/dos_kb.h:464:0:0: -openfiles: /dos/z/16/lib/lib_head.h:2536:0:0: -openfiles: /dos/z/16/makefile:181:0:0: -openfiles: /dos/z/keen-src/id_mm.c:1835:14248:0: -openfiles: /dos/z/keen-src/id_mm.h:0:1024:0: -openfiles: /dos/z/keen-src/id_rf.c:46629:47657:0: -openfiles: /dos/z/keen-src/id_rf.h:0:0:0: -openfiles: /dos/z/keen-src/id_rf_a.asm:3987:3375:0: -openfiles: /dos/z/16/types.h:154:0:0: +openfiles: /dos/z/16/src/scroll.c:2536:1770:0: +openfiles: /dos/z/16/src/lib/modex16.c:136:0:0: +openfiles: /dos/z/16/src/lib/modex16.h:1931:1068:0: +openfiles: /dos/z/16/src/pcxtest.c:785:655:0: +openfiles: /dos/z/16/src/lib/dos_kb.c:107:0:0: +openfiles: /dos/z/16/src/lib/dos_kb.h:62:0:0: +openfiles: /dos/z/16/src/lib/lib_head.h:165:0:0: +openfiles: /dos/z/16/src/palettec.c:176:0:1: +openfiles: /dos/z/16/src/test.c:18:0:0: +openfiles: /dos/z/16/src/test2.c:18:0:0: +openfiles: /dos/z/16/src/lib/bitmap.c:59:0:0: +openfiles: /dos/z/16/src/lib/bitmap.h:125:0:0: +openfiles: /dos/z/16/src/lib/lib_head.cpp:0:0:0: +openfiles: /dos/z/16/src/lib/types.h:0:0:0: snr_recursion_level: 0 convertcolumn_horizontally: 0 adv_open_matchname: 0 @@ -26,10 +26,10 @@ view_left_panel: 0 default_mime_type: text/plain e2c.convert_xml: 1 c2e.convert_iso: 0 -opendir: file:///dos/z/16 +opendir: file:///dos/z/16/src/lib wrap_text_default: 0 bookmarks_filename_mode: 1 -ssearch_text: dxThresh +ssearch_text: PalFile snr_casesens: 1 view_blocks: 1 name: project 16 @@ -61,20 +61,6 @@ ssearch_regex: 0 e2c.convert_iso: 0 ssearch_casesens: 0 charmap_block: 1 -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 @@ -97,22 +83,36 @@ recent_files: file:///dos/z/16/doc/16.16 recent_files: file:///dos/z/16/doc/16story.txt recent_files: file:///dos/z/16/README recent_files: file:///dos/z/16/scroll.c -recent_files: file:///dos/z/16/doc/project.txt recent_files: file:///dos/z/16/dos_kb.h recent_files: file:///dos/z/16/dos_kb.c recent_files: file:///dos/z/16/lib/lib_head.h recent_files: file:///dos/z/16/modex16.c recent_files: file:///dos/z/16/modex16.h -recent_files: file:///dos/z/keen-src/id_rf.h recent_files: file:///dos/z/16/types.h -recent_files: file:///dos/z/keen-src/id_mm.h -recent_files: file:///dos/z/16/makefile recent_files: file:///dos/z/16/pcxtest.c -recent_files: file:///dos/z/keen-src/id_rf_a.asm +recent_files: file:///dos/z/16/src/scroll.c +recent_files: file:///dos/z/16/doc/project.txt +recent_files: file:///dos/z/16/src/lib/dos_kb.c +recent_files: file:///dos/z/16/src/lib/dos_kb.h +recent_files: file:///dos/z/16/src/lib/lib_head.h +recent_files: file:///dos/z/16/src/lib/modex16.h +recent_files: file:///dos/z/16/src/pcxtest.c +recent_files: file:///dos/z/16/src/lib/modex16.c +recent_files: file:///dos/z/16/makefile +recent_files: file:///dos/z/keen-src/id_mm.h recent_files: file:///dos/z/keen-src/id_mm.c +recent_files: file:///dos/z/keen-src/id_rf.h +recent_files: file:///dos/z/keen-src/id_rf_a.asm recent_files: file:///dos/z/keen-src/id_rf.c +recent_files: file:///dos/z/16/src/palettec.c +recent_files: file:///dos/z/16/src/test.c +recent_files: file:///dos/z/16/src/test2.c +recent_files: file:///dos/z/16/src/lib/bitmap.c +recent_files: file:///dos/z/16/src/lib/bitmap.h +recent_files: file:///dos/z/16/src/lib/lib_head.cpp +recent_files: file:///dos/z/16/src/lib/types.h snr_replacetype: 0 -savedir: file:///dos/z/16 +savedir: file:///dos/z/16/src spell_check_default: 1 spell_insert_entities: 0 last_filefilter: @@ -122,7 +122,6 @@ snr_escape_chars: 0 htmlbar_view: 0 spell_lang: en ssearch_dotmatchall: 0 -searchlist: return searchlist: enter searchlist: bg->tx == bg->ty searchlist: data @@ -137,6 +136,7 @@ searchlist: MAPY/2 searchlist: MAPX/2 searchlist: mapDrawTile searchlist: dxThresh +searchlist: PalFile autocomplete: 1 outputb_show_all_output: 0 bookmarks_show_mode: 0 diff --git a/16/modex16/46113319.pcx b/data/46113319.pcx similarity index 100% rename from 16/modex16/46113319.pcx rename to data/46113319.pcx diff --git a/16/modex16/COMPUTER.PCX b/data/COMPUTER.PCX similarity index 100% rename from 16/modex16/COMPUTER.PCX rename to data/COMPUTER.PCX diff --git a/16/modex16/EDw.PCX b/data/EDw.PCX similarity index 100% rename from 16/modex16/EDw.PCX rename to data/EDw.PCX diff --git a/16/modex16/MAYU.PCX b/data/MAYU.PCX similarity index 100% rename from 16/modex16/MAYU.PCX rename to data/MAYU.PCX diff --git a/16/modex16/chikyuu.pcx b/data/chikyuu.pcx similarity index 100% rename from 16/modex16/chikyuu.pcx rename to data/chikyuu.pcx diff --git a/16/modex16/ed.pcx b/data/ed.pcx similarity index 100% rename from 16/modex16/ed.pcx rename to data/ed.pcx diff --git a/16/modex16/ed2.pcx b/data/ed2.pcx similarity index 100% rename from 16/modex16/ed2.pcx rename to data/ed2.pcx diff --git a/16/modex16/koishi.pcx b/data/koishi.pcx similarity index 100% rename from 16/modex16/koishi.pcx rename to data/koishi.pcx diff --git a/16/modex16/koishi^^.pcx b/data/koishi^^.pcx similarity index 100% rename from 16/modex16/koishi^^.pcx rename to data/koishi^^.pcx diff --git a/16/modex16/koishi~.pcx b/data/koishi~.pcx similarity index 100% rename from 16/modex16/koishi~.pcx rename to data/koishi~.pcx diff --git a/16/modex16/ptmp.pcx b/data/ptmp.pcx similarity index 100% rename from 16/modex16/ptmp.pcx rename to data/ptmp.pcx diff --git a/16/modex16/q.pcx b/data/q.pcx similarity index 100% rename from 16/modex16/q.pcx rename to data/q.pcx diff --git a/16/modex16/rarity.pcx b/data/rarity.pcx similarity index 100% rename from 16/modex16/rarity.pcx rename to data/rarity.pcx diff --git a/16/modex16/w.pcx b/data/w.pcx similarity index 100% rename from 16/modex16/w.pcx rename to data/w.pcx diff --git a/dos_kb.c b/dos_kb.c deleted file mode 100644 index dd924189..00000000 --- a/dos_kb.c +++ /dev/null @@ -1,142 +0,0 @@ -/* Thanks to Alex Russell for example code */ -/* 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" { -#endif -static void interrupt (far *oldkb)(void) = NULL; /* BIOS keyboard handler */ -#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; - - 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 */ - - /* Interpret the scan code and set our flags */ - #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 */ -void setkb(int vq){ - int i; /* Index variable */ - if(!vq){ // deinitiation - /* 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 */ - oldkb = NULL; - #ifdef TESTING - /* Print the key heap */ - printf("\n"); - for(i=0; i #include -#include "bitmap.h" -#include "modex16.h" +#include "src\lib\bitmap.h" +#include "src\lib\modex16.h" static struct pcxHeader { byte id; diff --git a/BITMAP.H b/src/lib/bitmap.h similarity index 91% rename from BITMAP.H rename to src/lib/bitmap.h index 4c4af98e..c11a5d6f 100644 --- a/BITMAP.H +++ b/src/lib/bitmap.h @@ -3,7 +3,7 @@ */ #ifndef BITMAP_H #define BITMAP_H -#include "types.h" +#include "src\lib\types.h" typedef struct { byte *data; word width; diff --git a/16/modex16/dos_kb.c b/src/lib/dos_kb.c similarity index 99% rename from 16/modex16/dos_kb.c rename to src/lib/dos_kb.c index dd924189..a99f2ca4 100644 --- a/16/modex16/dos_kb.c +++ b/src/lib/dos_kb.c @@ -1,6 +1,6 @@ /* Thanks to Alex Russell for example code */ /* Thanks to Gary Neal for example code */ -#include "dos_kb.h" +#include "src\lib\dos_kb.h" // keyboard buffer static byte key[NUM_SCANCODES]; // pressed diff --git a/dos_kb.h b/src/lib/dos_kb.h similarity index 93% rename from dos_kb.h rename to src/lib/dos_kb.h index 09617895..debb0c30 100644 --- a/dos_kb.h +++ b/src/lib/dos_kb.h @@ -1,6 +1,6 @@ #ifndef _DOSLIB_KB_H_ #define _DOSLIB_KB_H_ -#include "lib\lib_head.h" +#include "src\lib\lib_head.h" /* Maximum number of scan codes on keyboard controllers */ #define NUM_SCANCODES 128 diff --git a/lib/lib_head.cpp b/src/lib/lib_head.cpp similarity index 79% rename from lib/lib_head.cpp rename to src/lib/lib_head.cpp index cc40b93b..42bbb026 100644 --- a/lib/lib_head.cpp +++ b/src/lib/lib_head.cpp @@ -1,5 +1,4 @@ -//#include "src\lib\lib_head.h" -#include "lib\lib_head.h" +#include "src\lib\lib_head.h" /* local function */ void wait(clock_t wait); diff --git a/lib/lib_head.h b/src/lib/lib_head.h similarity index 98% rename from lib/lib_head.h rename to src/lib/lib_head.h index 7e034ad6..86b55b89 100644 --- a/lib/lib_head.h +++ b/src/lib/lib_head.h @@ -4,7 +4,7 @@ #include #include // just for wait #include // just for wait -#include "types.h" +#include "src\lib\types.h" /* Control codes for all keys on the keyboard */ //here temperarly diff --git a/modex16.c b/src/lib/modex16.c similarity index 95% rename from modex16.c rename to src/lib/modex16.c index aadbe523..1e1757be 100644 --- a/modex16.c +++ b/src/lib/modex16.c @@ -4,7 +4,7 @@ #include #include #include -#include "modex16.h" +#include "src\lib\modex16.h" byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */ diff --git a/modex16.h b/src/lib/modex16.h similarity index 95% rename from modex16.h rename to src/lib/modex16.h index 65b37d9d..1a5debdf 100644 --- a/modex16.h +++ b/src/lib/modex16.h @@ -4,8 +4,8 @@ #ifndef MODEX16_H #define MODEX16_H #include -#include "types.h" -#include "bitmap.h" +#include "src\lib\types.h" +#include "src\lib\bitmap.h" /* -========================== Types & Macros ==========================- */ #define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2)) diff --git a/16/modex16/types.h b/src/lib/types.h similarity index 100% rename from 16/modex16/types.h rename to src/lib/types.h diff --git a/lib/wtest/WTEST.EXE b/src/lib/wtest/WTEST.EXE similarity index 100% rename from lib/wtest/WTEST.EXE rename to src/lib/wtest/WTEST.EXE diff --git a/lib/wtest/makefile b/src/lib/wtest/makefile similarity index 100% rename from lib/wtest/makefile rename to src/lib/wtest/makefile diff --git a/lib/wtest/wtest.c b/src/lib/wtest/wtest.c similarity index 100% rename from lib/wtest/wtest.c rename to src/lib/wtest/wtest.c diff --git a/lib/wtest/wtest.h b/src/lib/wtest/wtest.h similarity index 100% rename from lib/wtest/wtest.h rename to src/lib/wtest/wtest.h diff --git a/16/modex16/palettec.c b/src/palettec.c similarity index 77% rename from 16/modex16/palettec.c rename to src/palettec.c index 340a9303..630d7b35 100644 --- a/16/modex16/palettec.c +++ b/src/palettec.c @@ -1,4 +1,4 @@ -#include "modex16.h" +#include "src\lib\modex16.h" void main() { diff --git a/pcxtest.c b/src/pcxtest.c similarity index 89% rename from pcxtest.c rename to src/pcxtest.c index 7373e885..e2c133cb 100644 --- a/pcxtest.c +++ b/src/pcxtest.c @@ -1,6 +1,6 @@ #include -#include "modex16.h" -#include "bitmap.h" +#include "src\lib\modex16.h" +#include "src\lib\bitmap.h" word far* clock= (word far*) 0x046C; /* 18.2hz clock */ @@ -33,7 +33,7 @@ void main() { page=modexDefaultPage(); - bmp = bitmapLoadPcx("46113319.pcx"); + bmp = bitmapLoadPcx("data\46113319.pcx"); modexEnter(); /* fix up the palette and everything */ diff --git a/scroll.c b/src/scroll.c similarity index 99% rename from scroll.c rename to src/scroll.c index 846fcff5..c8a5a621 100644 --- a/scroll.c +++ b/src/scroll.c @@ -1,8 +1,8 @@ -#include "modex16.h" +#include "src\lib\modex16.h" #include #include -#include "dos_kb.h" -#include "lib\wtest\wtest.c" +#include "src\lib\dos_kb.h" +#include "src\lib\wtest\wtest.c" //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ @@ -87,7 +87,7 @@ void main() { /* draw the tiles */ ptr = map.data; - ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite + ptmp = bitmapLoadPcx("data\ptmp.pcx"); // load sprite modexEnter(); modexPalUpdate(ptmp.palette); screen = modexDefaultPage(); diff --git a/16/modex16/test.c b/src/test.c similarity index 93% rename from 16/modex16/test.c rename to src/test.c index c5b9d7dc..fd2ec3f9 100644 --- a/16/modex16/test.c +++ b/src/test.c @@ -1,4 +1,4 @@ -#include "modex16.h" +#include "src\lib\modex16.h" #include word far* clock= (word far*) 0x046C; /* 18.2hz clock */ diff --git a/test2.c b/src/test2.c similarity index 84% rename from test2.c rename to src/test2.c index 9118279f..5b3d32c0 100644 --- a/test2.c +++ b/src/test2.c @@ -1,4 +1,4 @@ -#include "modex16.h" +#include "src\lib\modex16.h" word far* clock= (word far*) 0x046C; /* 18.2hz clock */ diff --git a/test.c b/test.c deleted file mode 100644 index c5b9d7dc..00000000 --- a/test.c +++ /dev/null @@ -1,75 +0,0 @@ -#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 index 640194bc..70d01767 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 731dd1c6..ecbbf0e5 100644 Binary files a/test2.exe and b/test2.exe differ diff --git a/types.h b/types.h deleted file mode 100644 index 039653f2..00000000 --- a/types.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * 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;