From: sparky4 Date: Fri, 20 Jun 2014 20:14:41 +0000 (-0500) Subject: modified: 16/Project 16.bfproject X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=64264f5a322853c8e9c4b96b4d2366303b60f050;p=16.git modified: 16/Project 16.bfproject new file: 16/SCRC/CONSTANT.H new file: 16/SCRC/MAKEFILE new file: 16/SCRC/PALETTE.C new file: 16/SCRC/PALETTE.H new file: 16/SCRC/TEST.C new file: 16/SCRC/funptr.c modified: 16/dos_gfx.cpp --- diff --git a/16/Project 16.bfproject b/16/Project 16.bfproject index c4218076..6612d80b 100644 --- a/16/Project 16.bfproject +++ b/16/Project 16.bfproject @@ -1,7 +1,7 @@ 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: @@ -84,23 +84,23 @@ 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/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 diff --git a/16/SCRC/CONSTANT.H b/16/SCRC/CONSTANT.H new file mode 100644 index 00000000..fe3a27ff --- /dev/null +++ b/16/SCRC/CONSTANT.H @@ -0,0 +1,132 @@ +#define PEL_READ_REG 0x03C7 /* Color register, read address */ +#define PEL_WRITE_REG 0x03C8 /* Color register, write address */ +#define PEL_DATA_REG 0x03C9 /* Color register, data port */ +#define PAL_SIZE 768 /* Size of palette in bytes */ +#define SC_INDEX 0x03C4 /* Sequence Controller Index */ +#define CRTC_INDEX 0x03D4 /* CRT Controller Index */ +#define MISC_OUTPUT 0x03C2 /* Miscellaneous Output register */ +#define SCREEN_SEG 0x0a000 /* segment of display memory in mode X */ +#define INPUT_STATUS_1 0x03DA /* Input Status 1 register */ +#define ATC_INDEX 0x03C0 /* Attribute Controller */ +#define START_ADDRESS_HIGH 0x0C /* bitmap start address high byte */ +#define START_ADDRESS_LOW 0x0D /* bitmap start address low byte */ +#define GC_INDEX 0x03CE +#define BIT_MASK 0x08 +#define MAP_MASK 0x02 + +#define ALL_COPY_BITS 0x00000+BIT_MASK +#define ALL_DRAW_BITS 0x0FF00+BIT_MASK + +#define SQUARE_WIDTH 16 +#define SQUARE_HEIGHT 16 +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 200 +#define VIRTUAL_WIDTH 352 +#define VIRTUAL_HEIGHT 240 + +#define PAGE_0 0 +#define PAGE_1 0x05540 /* 05470h ;5540h */ +#define PAGE_2 0x0AA80 /* 0A8E0h ;AA80h */ + +#define SCROLL_SPEED 1 /* Don't let it go above 8! */ +#define MAGIC_NUM 100 + +#define CPU8086 0 +#define CPU80286 1 +#define CPU80386 2 +#define CPU80486 3 + +/* ====================================================================== */ +/* Key Assignments */ +/* ====================================================================== */ +#define kESC 2 +#define kONE 4 +#define kTWO 6 +#define kTHREE 8 +#define kFOUR 10 +#define kFIVE 12 +#define kSIX 14 +#define kSEVEN 16 +#define kEIGHT 18 +#define kNINE 20 +#define kZERO 22 +#define kMINUS 24 +#define kEQUAL 26 +#define kBACKSPACE 28 +#define kTAB 30 +#define kQ 32 +#define kW 34 +#define kE 36 +#define kR 38 +#define kT 40 +#define kY 42 +#define kU 44 +#define kI 46 +#define kO 48 +#define kP 50 +#define kL_BRACE 52 +#define kR_BRACE 54 +#define kENTER 56 +#define kCTRL 58 +#define kA 60 +#define kS 62 +#define kD 64 +#define kF 66 +#define kG 68 +#define kH 70 +#define kJ 72 +#define kK 74 +#define kL 76 +#define kSEMICOLON 78 +#define kQUOTE 80 +#define kBACKQUOTE 82 +#define kL_SHIFT 84 +#define kBACKSLASH 86 +#define kZ 88 +#define kX 90 +#define kC 92 +#define kV 94 +#define kB 96 +#define kN 98 +#define kM 100 +#define kCOMMA 102 +#define kPERIOD 104 +#define kSLASH 106 +#define kR_SHIFT 108 +#define kGREY_STAR 110 +#define kALT 112 +#define kSPACE 114 +#define kCAPSLOCK 116 +#define kF1 118 +#define kF2 120 +#define kF3 122 +#define kF4 124 +#define kF5 126 +#define kF6 128 +#define kF7 130 +#define kF8 132 +#define kF9 134 +#define kF10 136 +#define kNUMLOCK 138 +#define kSCRLLOCK 140 +#define kHOME 142 +#define kUP 144 +#define kPAGE_UP 146 +#define kGREY_MINUS 148 +#define kLEFT 150 +#define kPAD_FIVE 152 +#define kRIGHT 154 +#define kGREY_PLUS 156 +#define kEND 158 +#define kDOWN 160 +#define kPAGE_DOWN 162 +#define kINSERT 164 +#define kDELETE 166 + +#define kF11 174 +#define kF12 176 + + +/* handy types */ +typedef char byte; +typedef short word; diff --git a/16/SCRC/MAKEFILE b/16/SCRC/MAKEFILE new file mode 100644 index 00000000..571aaa60 --- /dev/null +++ b/16/SCRC/MAKEFILE @@ -0,0 +1,10 @@ +all: test.exe + +test.exe: test.obj palette.obj + wcl test.obj palette.obj + +test.obj: test.c + wcl -c test.c + +palette.obj: palette.h palette.c constant.h + wcl -c palette.c diff --git a/16/SCRC/PALETTE.C b/16/SCRC/PALETTE.C new file mode 100644 index 00000000..7a7e7342 --- /dev/null +++ b/16/SCRC/PALETTE.C @@ -0,0 +1,160 @@ +/* + * File: PALETTE.C + * Purpose: This file contains routines for manipulating the VGA palette. + */ +#include +#include +#include +#include "palette.h" + +static void fadePalette(byte fade, byte start, word iter, byte *palette); +static byte tmppal[PAL_SIZE]; + +/* fade and flash */ +void +fadeOn(word fade, byte *palette) { + fadePalette(-fade, 64, 64/fade+1, palette); +} + + +void +fadeOff(word fade, byte *palette) { + fadePalette(fade, 0, 64/fade+1, palette); +} + + +void +flashOn(word fade, byte *palette) { + fadePalette(fade, -64, 64/fade+1, palette); +} + + +void +flashOff(word fade, byte *palette) { + fadePalette(-fade, 0, 64/fade+1, palette); +} + + +static void +fadePalette(byte fade, byte start, word iter, byte *palette) { + word i; + byte dim = start; + + /* handle the case where we just update */ + if(iter == 0) { + palUpdate(palette); + return; + } + + while(iter > 0) { /* FadeLoop */ + for(i=0; i 127) { + tmppal[i] = 0; + } else if(tmppal[i] > 63) { + tmppal[i] = 63; + } + } + palUpdate(tmppal); + iter--; + dim += fade; + } +} + + +/* save and load */ +void +palSave(byte *palette) { + int i; + + outp(PEL_READ_REG, 0); /* start at palette entry 0 */ + for(i=0; i +#include "palette.h" + +void main() { + byte *palette; + int i; + + /* get our starting point */ + palette = newPal(); + palSave(palette); + + /* fade to black and back */ + fadeOff(1, palette); + palBlack(); + fadeOn(1, palette); + palUpdate(palette); + + /* fade to white and back */ + flashOff(1, palette); + palWhite(); + flashOn(1, palette); + palUpdate(palette); + + free(palette); + return; +} diff --git a/16/SCRC/funptr.c b/16/SCRC/funptr.c new file mode 100644 index 00000000..90fcbde3 --- /dev/null +++ b/16/SCRC/funptr.c @@ -0,0 +1,42 @@ +#include + +/* 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(VW-SW-1)) || (xpos<1))delay(500); //mxWaitRetrace(); //mxBitBlt(32, (SH+32), SW, SH, xpos, ypos); -//mxBitBlt(32, (SH+64+32), SW, SH, 32, 32); +mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2); //xpos=ypos=TILEWH*2; mxPan(32,32); //} @@ -365,7 +365,7 @@ mxPan(32,32); if( (ypos>(BH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change // direction! } //mxBitBlt(32, (SH+64+32), SW, SH, xpos, ypos); -mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2); +//mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2); } ch=getch(); if(ch==0x71)break; // 'q'