OSDN Git Service

====----==== this is a messed up build that contains a busted 0.exe pan page system
[proj16/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> // just for wait\r
37 #include <time.h> // just for wait\r
38 #include <malloc.h>\r
39 #include <ctype.h>\r
40 #include <fcntl.h>\r
41 #include <io.h>\r
42 #include <sys/stat.h>\r
43 #include <mem.h>\r
44 #include <string.h>\r
45 #include <limits.h>\r
46 #include <errno.h>\r
47 #include <process.h>\r
48 #ifdef __WATCOMC__\r
49 #include <i86.h>\r
50 #include <unistd.h>\r
51 #include <alloca.h>\r
52 #include <stdint.h> //16_vrs.h\r
53 #include "src/lib/16_dbg.h"\r
54 #endif\r
55 #ifdef __BORLANDC__\r
56 #include <values.h>\r
57 #include <dir.h>\r
58 #define TILEWH  16\r
59 #endif\r
60 #include "src/lib/16_t.h"\r
61 #include "src/lib/16_tdef.h"\r
62 #include "src/lib/nyan/kitten.h"\r
63 \r
64 #define VERSION __DATE__ " " __TIME__\r
65 \r
66 /* Control codes for all keys on the keyboard */\r
67 //here temperarly\r
68 /*\r
69 #define KEY_A           (0x1E)\r
70 #define KEY_B           (0x30)\r
71 #define KEY_C           (0x2E)\r
72 #define KEY_D           (0x20)\r
73 #define KEY_E           (0x12)\r
74 #define KEY_F           (0x21)\r
75 #define KEY_G           (0x22)\r
76 #define KEY_H           (0x23)\r
77 #define KEY_I           (0x17)\r
78 #define KEY_J           (0x24)\r
79 #define KEY_K           (0x25)\r
80 #define KEY_L           (0x26)\r
81 #define KEY_M           (0x32)\r
82 #define KEY_N           (0x31)\r
83 #define KEY_O           (0x18)\r
84 #define KEY_P           (0x19)\r
85 #define KEY_Q           (0x10)\r
86 #define KEY_R           (0x13)\r
87 #define KEY_S           (0x1F)\r
88 #define KEY_T           (0x14)\r
89 #define KEY_U           (0x16)\r
90 #define KEY_V           (0x2F)\r
91 #define KEY_W           (0x11)\r
92 #define KEY_X           (0x2D)\r
93 #define KEY_Y           (0x15)\r
94 #define KEY_Z           (0x2C)\r
95 #define KEY_1           (0x02)\r
96 #define KEY_2           (0x03)\r
97 #define KEY_3           (0x04)\r
98 #define KEY_4           (0x05)\r
99 #define KEY_5           (0x06)\r
100 #define KEY_6           (0x07)\r
101 #define KEY_7           (0x08)\r
102 #define KEY_8           (0x09)\r
103 #define KEY_9           (0x0A)\r
104 #define KEY_0           (0x0B)\r
105 #define KEY_DASH                (0x0C)  // -_\r
106 #define KEY_EQUAL               (0x0D)  // =+\r
107 #define KEY_LBRACKET    (0x1A)  // [{\r
108 #define KEY_RBRACKET    (0x1B)  // ]}\r
109 #define KEY_SEMICOLON   (0x27)  // ;:\r
110 #define KEY_RQUOTE      (0x28)  // '"\r
111 #define KEY_LQUOTE      (0x29)  // `~\r
112 #define KEY_PERIOD      (0x33)  // .>\r
113 #define KEY_COMMA               (0x34)  // ,<\r
114 #define KEY_SLASH               (0x35)  // /?\r
115 #define KEY_BACKSLASH   (0x2B)  // \|\r
116 #define KEY_F1          (0x3B)\r
117 #define KEY_F2          (0x3C)\r
118 #define KEY_F3          (0x3D)\r
119 #define KEY_F4          (0x3E)\r
120 #define KEY_F5          (0x3F)\r
121 #define KEY_F6          (0x40)\r
122 #define KEY_F7          (0x41)\r
123 #define KEY_F8          (0x42)\r
124 #define KEY_F9          (0x43)\r
125 #define KEY_F10         (0x44)\r
126 #define KEY_ESC         (0x01)\r
127 #define KEY_BACKSPACE   (0x0E)\r
128 #define KEY_TAB         (0x0F)\r
129 #define KEY_ENTER               (0x1C)\r
130 #define KEY_CONTROL     (0x1D)\r
131 #define KEY_LSHIFT      (0x2A)\r
132 #define KEY_RSHIFT      (0x36)\r
133 #define KEY_PRTSC               (0x37)\r
134 #define KEY_ALT         (0x38)\r
135 #define KEY_SPACE               (0x39)\r
136 #define KEY_CAPSLOCK    (0x3A)\r
137 #define KEY_NUMLOCK     (0x45)\r
138 #define KEY_SCROLLLOCK  (0x46)\r
139 #define KEY_HOME                (0x47)\r
140 #define KEY_UP          (0x48)\r
141 #define KEY_PGUP                (0x49)\r
142 #define KEY_MINUS               (0x4A)\r
143 #define KEY_LEFT                (0x4B)\r
144 #define KEY_CENTER      (0x4C)\r
145 #define KEY_RIGHT               (0x4D)\r
146 #define KEY_PLUS                (0x4E)\r
147 #define KEY_END         (0x4F)\r
148 #define KEY_DOWN                (0x50)\r
149 #define KEY_PGDOWN      (0x51)\r
150 #define KEY_INS         (0x52)\r
151 #define KEY_DEL         (0x53)\r
152 \r
153 #define KEY_LWIN                (0x73)\r
154 #define KEY_RWIN                (0x74)\r
155 #define KEY_MENU                (0x75)\r
156 */\r
157 \r
158 //static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
159 extern  int                     profilehandle,debughandle;      //make it into game global\r
160 \r
161 //#define OLD16_VL\r
162 \r
163 #define nil     ((void *)0)\r
164 #ifdef __BORLANDC__\r
165 #define _FCORELEFT 0x90000UL-16UL\r
166 #define sprite\r
167 #endif\r
168 #ifdef __WATCOMC__\r
169 #define _FCORELEFT 0x90000UL+16UL\r
170 /*static union REGS CPURegs;\r
171 \r
172 #define _AX CPURegs.x.ax\r
173 #define _BX CPURegs.x.bx\r
174 #define _CX CPURegs.x.cx\r
175 #define _DX CPURegs.x.dx\r
176 \r
177 #define _SI CPURegs.x.si\r
178 \r
179 #define _AH CPURegs.h.ah\r
180 #define _AL CPURegs.h.al\r
181 #define _BH CPURegs.h.bh\r
182 #define _BL CPURegs.h.bl\r
183 #define _CH CPURegs.h.ch\r
184 #define _CL CPURegs.h.cl\r
185 #define _DH CPURegs.h.dh\r
186 #define _DL CPURegs.h.dl\r
187 \r
188 #define geninterrupt(n) int86(n,&CPURegs,&CPURegs);*/\r
189 #define peekb(segm,ofs) (*(byte far*)MK_FP((segm),(ofs)))\r
190 #define peekw(segm,ofs) (*(word far*)MK_FP((segm),(ofs)))\r
191 #define pokeb(segm,ofs,value) (peekb((segm),(ofs)) = (byte)(value))\r
192 #define pokew(segm,ofs,value) (peekw((segm),(ofs)) = (word)(value))\r
193 \r
194 typedef union REGPACK   regs_t;\r
195 #endif\r
196 \r
197 #define INPUT_STATUS_1          0x03da\r
198 \r
199 /* local function */\r
200 long int filesize(FILE *fp);\r
201 void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free);\r
202 int US_CheckParm(char *parm,char **strings);\r
203 byte dirchar(byte in);\r
204 \r
205 #endif/*__16_HEAD_H__*/\r