]> 4ch.mooo.com Git - 16.git/blob - src/lib/16_head.h
1c95d512bbb8d00df5616395bf872c12b0f66661
[16.git] / src / lib / 16_head.h
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\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
10  *\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
15  *\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
20  *\r
21  */\r
22 \r
23 //#if !defined(__LARGE__) && !defined(__COMPACT__) && !defined(__HUGE__)\r
24 //#error Invalid memory model for compiling project 16\r
25 //#endif\r
26 \r
27 #if !defined(__i86__) && defined(__i386__)\r
28 #error i8088 only\r
29 #endif\r
30 \r
31 #ifndef __16_HEAD_H__\r
32 #define __16_HEAD_H__\r
33 #include <dos.h>\r
34 #include <stdio.h>\r
35 #include <stdlib.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
38 #include <ctype.h>\r
39 #include <fcntl.h>\r
40 #include <io.h>\r
41 #include <sys/stat.h>\r
42 #include <mem.h>\r
43 #include <string.h>\r
44 #include <limits.h>\r
45 #include <errno.h>\r
46 #include <process.h>\r
47 #ifdef __WATCOMC__\r
48 #include <i86.h>\r
49 #include <unistd.h>\r
50 #include <alloca.h>\r
51 #include <stdint.h> //16_vrs.h\r
52 #endif\r
53 #ifdef __BORLANDC__\r
54 #include <values.h>\r
55 #include <dir.h>\r
56 #define TILEWH  16\r
57 #endif\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
62 \r
63 #define VERSION __DATE__ " " __TIME__\r
64 \r
65 /* Control codes for all keys on the keyboard */\r
66 //here temperarly\r
67 /*\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
151 \r
152 #define KEY_LWIN                (0x73)\r
153 #define KEY_RWIN                (0x74)\r
154 #define KEY_MENU                (0x75)\r
155 */\r
156 \r
157 //static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
158 extern  int                     profilehandle,debughandle;      //make it into game global\r
159 \r
160 //#define OLD16_VL\r
161 \r
162 #define nil     ((void *)0)\r
163 \r
164 #ifdef __WATCOMC__\r
165 //#define _FCORELEFT 0x90000UL+16UL\r
166 /*static union REGS CPURegs;\r
167 \r
168 #define _AX CPURegs.x.ax\r
169 #define _BX CPURegs.x.bx\r
170 #define _CX CPURegs.x.cx\r
171 #define _DX CPURegs.x.dx\r
172 \r
173 #define _SI CPURegs.x.si\r
174 \r
175 #define _AH CPURegs.h.ah\r
176 #define _AL CPURegs.h.al\r
177 #define _BH CPURegs.h.bh\r
178 #define _BL CPURegs.h.bl\r
179 #define _CH CPURegs.h.ch\r
180 #define _CL CPURegs.h.cl\r
181 #define _DH CPURegs.h.dh\r
182 #define _DL CPURegs.h.dl\r
183 \r
184 #define geninterrupt(n) int86(n,&CPURegs,&CPURegs);*/\r
185 \r
186 \r
187 typedef union REGPACK   regs_t;\r
188 #endif\r
189 \r
190 // local function //\r
191 long int filesize(FILE *fp);\r
192 void clrstdin();\r
193 char *remove_ext(char* mystr, char dot, char sep);\r
194 void rotateR(byte arr[], byte n);\r
195 void rotateL(byte arr[], byte n);\r
196 void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free);\r
197 int US_CheckParm(char *parm,char **strings);\r
198 byte dirchar(byte in);\r
199 void print_mem(void const *vp, size_t n);\r
200 \r
201 #define PRINT_OPAQUE_STRUCT(p)  print_mem((p), sizeof(*(p)))\r
202 \r
203 #endif/*__16_HEAD_H__*/\r