c2e.convert_special: 0
e2c.convert_num: 0
-openfiles: /dos/z/16/16/dos_gfx.cpp:8775:7736:1:
-openfiles: /dos/z/16/16/dos_gfx.h:665:285:0:
+openfiles: /dos/z/16/16/dos_gfx.cpp:9064:8494:1:
+openfiles: /dos/z/16/16/dos_gfx.h:391:285:0:
openfiles: /dos/z/16/16/dos_kb.c:1039:46:0:
openfiles: /dos/z/16/16/dos_kb.h:23:0:0:
openfiles: /dos/z/16/16/lib/lib_com.cpp:0:0:0:
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/16/16/dos_gfx.cpp
-recent_files: file:///dos/z/16/16/lib/lib_com.h
-recent_files: file:///dos/z/16/16/dos_gfx.h
+recent_files: file:///dos/z/16/16/lib/lib_com.cpp
recent_files: file:///dos/z/16/16/dos_kb.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/scroll.txt
+recent_files: file:///dos/z/16/16/dos_gfx.h
recent_files: file:///dos/z/16/16/project16.txt
+recent_files: file:///dos/z/16/16/scroll.txt
+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/lib/x/MXBB.ASM
+recent_files: file:///dos/z/16/16/scrasm/MAIN.ASM
+recent_files: file:///dos/z/4x4_16/modex/DEMO07.PAS
+recent_files: file:///dos/z/4x4_16/modex/DEMO01.PAS
recent_files: file:///dos/z/16/src/lib/dos_gfx.h
recent_files: file:///dos/z/16/src/lib/dos_gfx.cpp
recent_files: file:///dos/z/16/16/lib/intro/lib.c
-recent_files: file:///dos/z/4x4_16/modex/DEMO01.PAS
-recent_files: file:///dos/z/4x4_16/modex/DEMO07.PAS
recent_files: file:///dos/z/16/16/lib/x/MXCR.ASM
-recent_files: file:///dos/z/16/16/scrasm/MAIN.ASM
snr_replacetype: 0
savedir: file:///dos/z/16/16
spell_check_default: 1
--- /dev/null
+#define PEL_READ_REG 0x03C7 /* Color register, read address */\r
+#define PEL_WRITE_REG 0x03C8 /* Color register, write address */\r
+#define PEL_DATA_REG 0x03C9 /* Color register, data port */\r
+#define PAL_SIZE 768 /* Size of palette in bytes */\r
+#define SC_INDEX 0x03C4 /* Sequence Controller Index */\r
+#define CRTC_INDEX 0x03D4 /* CRT Controller Index */\r
+#define MISC_OUTPUT 0x03C2 /* Miscellaneous Output register */\r
+#define SCREEN_SEG 0x0a000 /* segment of display memory in mode X */\r
+#define INPUT_STATUS_1 0x03DA /* Input Status 1 register */\r
+#define ATC_INDEX 0x03C0 /* Attribute Controller */\r
+#define START_ADDRESS_HIGH 0x0C /* bitmap start address high byte */\r
+#define START_ADDRESS_LOW 0x0D /* bitmap start address low byte */\r
+#define GC_INDEX 0x03CE\r
+#define BIT_MASK 0x08\r
+#define MAP_MASK 0x02\r
+\r
+#define ALL_COPY_BITS 0x00000+BIT_MASK\r
+#define ALL_DRAW_BITS 0x0FF00+BIT_MASK\r
+\r
+#define SQUARE_WIDTH 16\r
+#define SQUARE_HEIGHT 16\r
+#define SCREEN_WIDTH 320\r
+#define SCREEN_HEIGHT 200\r
+#define VIRTUAL_WIDTH 352\r
+#define VIRTUAL_HEIGHT 240\r
+\r
+#define PAGE_0 0\r
+#define PAGE_1 0x05540 /* 05470h ;5540h */\r
+#define PAGE_2 0x0AA80 /* 0A8E0h ;AA80h */\r
+\r
+#define SCROLL_SPEED 1 /* Don't let it go above 8! */\r
+#define MAGIC_NUM 100\r
+\r
+#define CPU8086 0\r
+#define CPU80286 1\r
+#define CPU80386 2\r
+#define CPU80486 3\r
+\r
+/* ====================================================================== */\r
+/* Key Assignments */\r
+/* ====================================================================== */\r
+#define kESC 2\r
+#define kONE 4\r
+#define kTWO 6\r
+#define kTHREE 8\r
+#define kFOUR 10\r
+#define kFIVE 12\r
+#define kSIX 14\r
+#define kSEVEN 16\r
+#define kEIGHT 18\r
+#define kNINE 20\r
+#define kZERO 22\r
+#define kMINUS 24\r
+#define kEQUAL 26\r
+#define kBACKSPACE 28\r
+#define kTAB 30\r
+#define kQ 32\r
+#define kW 34\r
+#define kE 36\r
+#define kR 38\r
+#define kT 40\r
+#define kY 42\r
+#define kU 44\r
+#define kI 46\r
+#define kO 48\r
+#define kP 50\r
+#define kL_BRACE 52\r
+#define kR_BRACE 54\r
+#define kENTER 56\r
+#define kCTRL 58\r
+#define kA 60\r
+#define kS 62\r
+#define kD 64\r
+#define kF 66\r
+#define kG 68\r
+#define kH 70\r
+#define kJ 72\r
+#define kK 74\r
+#define kL 76\r
+#define kSEMICOLON 78\r
+#define kQUOTE 80\r
+#define kBACKQUOTE 82\r
+#define kL_SHIFT 84\r
+#define kBACKSLASH 86\r
+#define kZ 88\r
+#define kX 90\r
+#define kC 92\r
+#define kV 94\r
+#define kB 96\r
+#define kN 98\r
+#define kM 100\r
+#define kCOMMA 102\r
+#define kPERIOD 104\r
+#define kSLASH 106\r
+#define kR_SHIFT 108\r
+#define kGREY_STAR 110\r
+#define kALT 112\r
+#define kSPACE 114\r
+#define kCAPSLOCK 116\r
+#define kF1 118\r
+#define kF2 120\r
+#define kF3 122\r
+#define kF4 124\r
+#define kF5 126\r
+#define kF6 128\r
+#define kF7 130\r
+#define kF8 132\r
+#define kF9 134\r
+#define kF10 136\r
+#define kNUMLOCK 138\r
+#define kSCRLLOCK 140\r
+#define kHOME 142\r
+#define kUP 144\r
+#define kPAGE_UP 146\r
+#define kGREY_MINUS 148\r
+#define kLEFT 150\r
+#define kPAD_FIVE 152\r
+#define kRIGHT 154\r
+#define kGREY_PLUS 156\r
+#define kEND 158\r
+#define kDOWN 160\r
+#define kPAGE_DOWN 162\r
+#define kINSERT 164\r
+#define kDELETE 166\r
+\r
+#define kF11 174\r
+#define kF12 176\r
+\r
+\r
+/* handy types */\r
+typedef char byte;\r
+typedef short word;\r
--- /dev/null
+all: test.exe\r
+\r
+test.exe: test.obj palette.obj\r
+ wcl test.obj palette.obj\r
+\r
+test.obj: test.c\r
+ wcl -c test.c\r
+\r
+palette.obj: palette.h palette.c constant.h\r
+ wcl -c palette.c\r
--- /dev/null
+/*\r
+ * File: PALETTE.C\r
+ * Purpose: This file contains routines for manipulating the VGA palette.\r
+ */\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <conio.h>\r
+#include "palette.h"\r
+\r
+static void fadePalette(byte fade, byte start, word iter, byte *palette);\r
+static byte tmppal[PAL_SIZE];\r
+\r
+/* fade and flash */\r
+void\r
+fadeOn(word fade, byte *palette) {\r
+ fadePalette(-fade, 64, 64/fade+1, palette);\r
+}\r
+\r
+\r
+void\r
+fadeOff(word fade, byte *palette) {\r
+ fadePalette(fade, 0, 64/fade+1, palette);\r
+}\r
+\r
+\r
+void\r
+flashOn(word fade, byte *palette) {\r
+ fadePalette(fade, -64, 64/fade+1, palette);\r
+}\r
+\r
+\r
+void\r
+flashOff(word fade, byte *palette) {\r
+ fadePalette(-fade, 0, 64/fade+1, palette);\r
+}\r
+\r
+\r
+static void\r
+fadePalette(byte fade, byte start, word iter, byte *palette) {\r
+ word i;\r
+ byte dim = start;\r
+\r
+ /* handle the case where we just update */\r
+ if(iter == 0) {\r
+ palUpdate(palette);\r
+ return;\r
+ }\r
+\r
+ while(iter > 0) { /* FadeLoop */\r
+ for(i=0; i<PAL_SIZE; i++) { /* loadpal_loop */\r
+ tmppal[i] = palette[i] - dim;\r
+ if(tmppal[i] > 127) {\r
+ tmppal[i] = 0;\r
+ } else if(tmppal[i] > 63) {\r
+ tmppal[i] = 63;\r
+ }\r
+ }\r
+ palUpdate(tmppal);\r
+ iter--;\r
+ dim += fade;\r
+ }\r
+}\r
+\r
+\r
+/* save and load */\r
+void\r
+palSave(byte *palette) {\r
+ int i;\r
+\r
+ outp(PEL_READ_REG, 0); /* start at palette entry 0 */\r
+ for(i=0; i<PAL_SIZE; i++) {\r
+ palette[i] = inp(PEL_DATA_REG); /* read the palette data */\r
+ }\r
+}\r
+\r
+\r
+byte *\r
+newPal() {\r
+ byte *ptr;\r
+ ptr = malloc(PAL_SIZE);\r
+\r
+ /* handle errors */\r
+ if(!ptr) {\r
+ printf("Could not allocate palette.\n");\r
+ exit(-1);\r
+ }\r
+\r
+ return ptr;\r
+}\r
+\r
+\r
+void\r
+loadPaletteFile(byte *filename, byte **palette) {\r
+ FILE *file;\r
+ byte *ptr;\r
+\r
+ /* free the palette if it exists */\r
+ if(*palette) {\r
+ free(*palette);\r
+ }\r
+\r
+ /* allocate the new palette */\r
+ *palette = newPal();\r
+\r
+ /* open the file */\r
+ file = fopen(filename, "rb");\r
+ if(!file) {\r
+ printf("Could not open palette file: %s\n", filename);\r
+ exit(-2);\r
+ }\r
+\r
+ /* read the file */\r
+ ptr = *palette;\r
+ while(!feof(file)) {\r
+ *ptr++ = fgetc(file);\r
+ }\r
+\r
+ fclose(file);\r
+}\r
+\r
+\r
+/* blanking */\r
+void\r
+palBlack() {\r
+ fadePalette(-1, 64, 1, tmppal);\r
+}\r
+\r
+\r
+void\r
+palWhite() {\r
+ fadePalette(-1, -64, 1, tmppal);\r
+}\r
+\r
+\r
+/* utility */\r
+void\r
+palUpdate(byte *p) {\r
+ int i;\r
+ waitborder();\r
+ outp(PEL_WRITE_REG, 0); /* start at the beginning of palette */\r
+ for(i=0; i<PAL_SIZE/2; i++) {\r
+ outp(PEL_DATA_REG, p[i]);\r
+ }\r
+ waitborder(); /* waits one retrace -- less flicker */\r
+ for(i=PAL_SIZE/2; i<PAL_SIZE; i++) {\r
+ outp(PEL_DATA_REG, p[i]);\r
+ }\r
+}\r
+\r
+\r
+void\r
+waitborder() {\r
+ while(inp(INPUT_STATUS_1) & 8) {\r
+ /* spin */\r
+ }\r
+\r
+ while(!(inp(INPUT_STATUS_1) & 8)) {\r
+ /* spin */\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Headers and definitions for the palette routines.\r
+ */\r
+#include "constant.h"\r
+\r
+/* fade and flash */\r
+void fadeOn(word fade, byte *palette);\r
+void fadeOff(word fade, byte *palette);\r
+void flashOn(word fade, byte *palette);\r
+void flashOff(word fade, byte *palette);\r
+\r
+/* save and load */\r
+void palSave(byte *palette);\r
+byte *newPal();\r
+void loadPaletteFile(char *filename, byte **palette);\r
+\r
+/* blanking */\r
+void palBlack();\r
+void palWhite();\r
+\r
+/* utility */\r
+void palUpdate();\r
+void waitborder();\r
+\r
--- /dev/null
+#include <stdio.h>\r
+#include "palette.h"\r
+\r
+void main() {\r
+ byte *palette;\r
+ int i;\r
+\r
+ /* get our starting point */\r
+ palette = newPal();\r
+ palSave(palette);\r
+\r
+ /* fade to black and back */\r
+ fadeOff(1, palette);\r
+ palBlack();\r
+ fadeOn(1, palette);\r
+ palUpdate(palette);\r
+\r
+ /* fade to white and back */\r
+ flashOff(1, palette);\r
+ palWhite();\r
+ flashOn(1, palette);\r
+ palUpdate(palette);\r
+\r
+ free(palette);\r
+ return;\r
+}\r
--- /dev/null
+#include <stdio.h>
+
+/* a function pointer to a void pointer which takes one int argument */
+typedef void (*trigger)(int);
+
+
+/* invokes a list of functions from an array */
+void invokeTriggers(trigger *list, int n) {
+ int i;
+ trigger *tf = list;
+
+ for(i=0; i<n; i++) {
+ //invoke each function
+ (*tf)(i);
+ tf++;
+ }
+}
+
+
+void f1(int x) {
+ printf("f1: %d\n", x);
+}
+
+void f2(int x) {
+ printf("f2: %d\n", x);
+}
+
+
+void main() {
+ trigger list[3];
+
+ /* set up the list */
+ list[0] = f1;
+ list[1] = f2;
+ list[2] = f1;
+
+ invokeTriggers(list, 3);
+
+ return;
+}
+
+
//if((xpos>(VW-SW-1)) || (xpos<1))delay(500);\r
//mxWaitRetrace();\r
//mxBitBlt(32, (SH+32), SW, SH, xpos, ypos);
-//mxBitBlt(32, (SH+64+32), SW, SH, 32, 32);\r
+mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2);\r
//xpos=ypos=TILEWH*2;\r
mxPan(32,32);\r
//}\r
if( (ypos>(BH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change\r
// direction! }\r
//mxBitBlt(32, (SH+64+32), SW, SH, xpos, ypos);
-mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2);\r
+//mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2);\r
}\r
ch=getch();\r
if(ch==0x71)break; // 'q'\r