From: sparky4 Date: Sat, 6 Aug 2022 00:45:23 +0000 (-0500) Subject: checking concistancy and fade.exe remade! X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=436d05c0510c7fe21d1f36b628e3648d25d15fce;p=16.git checking concistancy and fade.exe remade! --- diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100755 index 00000000..f9f45091 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,31 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "gnu17", + "cppStandard": "gnu++14", + "intelliSenseMode": "linux-gcc-x64" + }, + { + "name": "open watcom 2.0", + "includePath": [ + "${workspaceFolder}/**", + "/dos/fdos/watcom2/h/**" + ], + "defines": [], + "compilerPath": "/dos/fdos/watcom2/binl/wcl", + "cStandard": "c89", + "cppStandard": "c++98", + "intelliSenseMode": "${default}", + "compilerArgs": [ + "-0" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/16/16/SCRC/MAKEFILE b/16/16/SCRC/MAKEFILE index 571aaa60..124a30b5 100755 --- a/16/16/SCRC/MAKEFILE +++ b/16/16/SCRC/MAKEFILE @@ -1,10 +1,16 @@ -all: test.exe +all: test.exe fade.exe -test.exe: test.obj palette.obj - wcl test.obj palette.obj +fade.exe: fade.o palette.o + wcl -l=dos -0 fade.o palette.o -test.obj: test.c - wcl -c test.c +test.exe: test.o palette.o + wcl -l=dos -0 test.o palette.o -palette.obj: palette.h palette.c constant.h - wcl -c palette.c +test.o: test.c + wcl -0 -c test.c + +fade.o: fade.c + wcl -0 -c fade.c + +palette.o: palette.h palette.c constant.h + wcl -0 -c palette.c diff --git a/16/16/SCRC/TEST.C b/16/16/SCRC/TEST.C index 0f6d77cc..bd1005ae 100755 --- a/16/16/SCRC/TEST.C +++ b/16/16/SCRC/TEST.C @@ -1,6 +1,8 @@ #include #include "palette.h" + + void main() { byte *palette; int i; diff --git a/16/16/SCRC/TEST.EXE b/16/16/SCRC/TEST.EXE index 15f56f81..bc4f11dc 100755 Binary files a/16/16/SCRC/TEST.EXE and b/16/16/SCRC/TEST.EXE differ diff --git a/16/16/SCRC/constant.h b/16/16/SCRC/constant.h new file mode 100755 index 00000000..fe3a27ff --- /dev/null +++ b/16/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/16/SCRC/fade.c b/16/16/SCRC/fade.c new file mode 100755 index 00000000..76557c12 --- /dev/null +++ b/16/16/SCRC/fade.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include "palette.h" + +void main() { + byte *palette; + int i; + + /* get our starting point */ + palette = newPal(); + palSave(palette); + + /* fade to black and back */ + while (1) + { + fadeOff(1, palette); + palBlack(); + fadeOn(1, palette); + palUpdate(palette); + + if (kbhit) + { + // Terminates the loop + // when escape is pressed + if (getch() == 27) + break; + } + } + + free(palette); + return; +} diff --git a/16/16/SCRC/fade.exe b/16/16/SCRC/fade.exe new file mode 100755 index 00000000..e164f2d9 Binary files /dev/null and b/16/16/SCRC/fade.exe differ diff --git a/16/16/SCRC/funptr.exe b/16/16/SCRC/funptr.exe new file mode 100755 index 00000000..c6053f30 Binary files /dev/null and b/16/16/SCRC/funptr.exe differ diff --git a/16/16/SCRC/makefile b/16/16/SCRC/makefile new file mode 100755 index 00000000..124a30b5 --- /dev/null +++ b/16/16/SCRC/makefile @@ -0,0 +1,16 @@ +all: test.exe fade.exe + +fade.exe: fade.o palette.o + wcl -l=dos -0 fade.o palette.o + +test.exe: test.o palette.o + wcl -l=dos -0 test.o palette.o + +test.o: test.c + wcl -0 -c test.c + +fade.o: fade.c + wcl -0 -c fade.c + +palette.o: palette.h palette.c constant.h + wcl -0 -c palette.c diff --git a/16/16/SCRC/palette.c b/16/16/SCRC/palette.c new file mode 100755 index 00000000..7a7e7342 --- /dev/null +++ b/16/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/16/SCRC/test.exe b/16/16/SCRC/test.exe new file mode 100755 index 00000000..bc4f11dc Binary files /dev/null and b/16/16/SCRC/test.exe differ diff --git a/src/lib/doslib b/src/lib/doslib index b12b1cb7..88c15e21 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit b12b1cb71f93e2844d6272b9ad77d05edca0eede +Subproject commit 88c15e215fc1df044ab9647baa65a5826a1ac063 diff --git a/src/lib/jsmn b/src/lib/jsmn index 1aa2e8f8..25647e69 160000 --- a/src/lib/jsmn +++ b/src/lib/jsmn @@ -1 +1 @@ -Subproject commit 1aa2e8f80849c983466b165d53542da9b1bd1b32 +Subproject commit 25647e692c7906b96ffd2b05ca54c097948e879c