1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\r
6 * Project 16 is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * Project 16 is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
\r
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
\r
19 * Fifth Floor, Boston, MA 02110-1301 USA.
\r
23 //#if !defined(__LARGE__) && !defined(__COMPACT__) && !defined(__HUGE__)
\r
24 //#error Invalid memory model for compiling project 16
\r
27 #if !defined(__i86__) && defined(__i386__)
\r
31 #ifndef __16_HEAD_H__
\r
32 #define __16_HEAD_H__
\r
36 #include <conio.h> // this is where Open Watcom hides the outp() etc. functions // just for wait
\r
37 #include <time.h> // just for wait
\r
41 #include <sys/stat.h>
\r
46 #include <process.h>
\r
51 #include <stdint.h> //16_vrs.h
\r
58 #include "src/lib/16_t.h"
\r
59 #include "src/lib/16_tdef.h"
\r
60 #include "src/lib/nyan/kitten.h"
\r
61 #include "src/lib/16_dbg.h"
\r
63 #define VERSION __DATE__ " " __TIME__
\r
65 /* Control codes for all keys on the keyboard */
\r
68 #define KEY_A (0x1E)
\r
69 #define KEY_B (0x30)
\r
70 #define KEY_C (0x2E)
\r
71 #define KEY_D (0x20)
\r
72 #define KEY_E (0x12)
\r
73 #define KEY_F (0x21)
\r
74 #define KEY_G (0x22)
\r
75 #define KEY_H (0x23)
\r
76 #define KEY_I (0x17)
\r
77 #define KEY_J (0x24)
\r
78 #define KEY_K (0x25)
\r
79 #define KEY_L (0x26)
\r
80 #define KEY_M (0x32)
\r
81 #define KEY_N (0x31)
\r
82 #define KEY_O (0x18)
\r
83 #define KEY_P (0x19)
\r
84 #define KEY_Q (0x10)
\r
85 #define KEY_R (0x13)
\r
86 #define KEY_S (0x1F)
\r
87 #define KEY_T (0x14)
\r
88 #define KEY_U (0x16)
\r
89 #define KEY_V (0x2F)
\r
90 #define KEY_W (0x11)
\r
91 #define KEY_X (0x2D)
\r
92 #define KEY_Y (0x15)
\r
93 #define KEY_Z (0x2C)
\r
94 #define KEY_1 (0x02)
\r
95 #define KEY_2 (0x03)
\r
96 #define KEY_3 (0x04)
\r
97 #define KEY_4 (0x05)
\r
98 #define KEY_5 (0x06)
\r
99 #define KEY_6 (0x07)
\r
100 #define KEY_7 (0x08)
\r
101 #define KEY_8 (0x09)
\r
102 #define KEY_9 (0x0A)
\r
103 #define KEY_0 (0x0B)
\r
104 #define KEY_DASH (0x0C) // -_
\r
105 #define KEY_EQUAL (0x0D) // =+
\r
106 #define KEY_LBRACKET (0x1A) // [{
\r
107 #define KEY_RBRACKET (0x1B) // ]}
\r
108 #define KEY_SEMICOLON (0x27) // ;:
\r
109 #define KEY_RQUOTE (0x28) // '"
\r
110 #define KEY_LQUOTE (0x29) // `~
\r
111 #define KEY_PERIOD (0x33) // .>
\r
112 #define KEY_COMMA (0x34) // ,<
\r
113 #define KEY_SLASH (0x35) // /?
\r
114 #define KEY_BACKSLASH (0x2B) // \|
\r
115 #define KEY_F1 (0x3B)
\r
116 #define KEY_F2 (0x3C)
\r
117 #define KEY_F3 (0x3D)
\r
118 #define KEY_F4 (0x3E)
\r
119 #define KEY_F5 (0x3F)
\r
120 #define KEY_F6 (0x40)
\r
121 #define KEY_F7 (0x41)
\r
122 #define KEY_F8 (0x42)
\r
123 #define KEY_F9 (0x43)
\r
124 #define KEY_F10 (0x44)
\r
125 #define KEY_ESC (0x01)
\r
126 #define KEY_BACKSPACE (0x0E)
\r
127 #define KEY_TAB (0x0F)
\r
128 #define KEY_ENTER (0x1C)
\r
129 #define KEY_CONTROL (0x1D)
\r
130 #define KEY_LSHIFT (0x2A)
\r
131 #define KEY_RSHIFT (0x36)
\r
132 #define KEY_PRTSC (0x37)
\r
133 #define KEY_ALT (0x38)
\r
134 #define KEY_SPACE (0x39)
\r
135 #define KEY_CAPSLOCK (0x3A)
\r
136 #define KEY_NUMLOCK (0x45)
\r
137 #define KEY_SCROLLLOCK (0x46)
\r
138 #define KEY_HOME (0x47)
\r
139 #define KEY_UP (0x48)
\r
140 #define KEY_PGUP (0x49)
\r
141 #define KEY_MINUS (0x4A)
\r
142 #define KEY_LEFT (0x4B)
\r
143 #define KEY_CENTER (0x4C)
\r
144 #define KEY_RIGHT (0x4D)
\r
145 #define KEY_PLUS (0x4E)
\r
146 #define KEY_END (0x4F)
\r
147 #define KEY_DOWN (0x50)
\r
148 #define KEY_PGDOWN (0x51)
\r
149 #define KEY_INS (0x52)
\r
150 #define KEY_DEL (0x53)
\r
152 #define KEY_LWIN (0x73)
\r
153 #define KEY_RWIN (0x74)
\r
154 #define KEY_MENU (0x75)
\r
157 //static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */
\r
158 extern int profilehandle,debughandle; //make it into game global
\r
162 #define nil ((void *)0)
\r
163 #ifdef __BORLANDC__
\r
164 //#define _FCORELEFT 0x90000UL-16UL
\r
165 #define _FCORELEFT HC_farcoreleft()
\r
169 //#define _FCORELEFT 0x90000UL+16UL
\r
170 #define _FCORELEFT HC_farcoreleft()
\r
171 /*static union REGS CPURegs;
\r
173 #define _AX CPURegs.x.ax
\r
174 #define _BX CPURegs.x.bx
\r
175 #define _CX CPURegs.x.cx
\r
176 #define _DX CPURegs.x.dx
\r
178 #define _SI CPURegs.x.si
\r
180 #define _AH CPURegs.h.ah
\r
181 #define _AL CPURegs.h.al
\r
182 #define _BH CPURegs.h.bh
\r
183 #define _BL CPURegs.h.bl
\r
184 #define _CH CPURegs.h.ch
\r
185 #define _CL CPURegs.h.cl
\r
186 #define _DH CPURegs.h.dh
\r
187 #define _DL CPURegs.h.dl
\r
189 #define geninterrupt(n) int86(n,&CPURegs,&CPURegs);*/
\r
190 #define peekb(segm,ofs) (*(byte far*)MK_FP((segm),(ofs)))
\r
191 #define peekw(segm,ofs) (*(word far*)MK_FP((segm),(ofs)))
\r
192 #define pokeb(segm,ofs,value) (peekb((segm),(ofs)) = (byte)(value))
\r
193 #define pokew(segm,ofs,value) (peekw((segm),(ofs)) = (word)(value))
\r
195 typedef union REGPACK regs_t;
\r
198 #define INPUT_STATUS_1 0x03da
\r
200 // local function //
\r
201 long int filesize(FILE *fp);
\r
203 char *remove_ext(char* mystr, char dot, char sep);
\r
204 void rotateR(byte arr[], byte n);
\r
205 void rotateL(byte arr[], byte n);
\r
206 void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free);
\r
207 int US_CheckParm(char *parm,char **strings);
\r
208 byte dirchar(byte in);
\r
209 void print_mem(void const *vp, size_t n);
\r
211 #define PRINT_OPAQUE_STRUCT(p) print_mem((p), sizeof(*(p)))
\r
213 #endif/*__16_HEAD_H__*/
\r