1 /* Project 16 Source Code~
2 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
4 * This file is part of Project 16.
6 * Project 16 is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * Project 16 is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
19 * Fifth Floor, Boston, MA 02110-1301 USA.
23 #if !defined(__LARGE__) && !defined(__COMPACT__) && !defined(__HUGE__)
24 #error Invalid memory model for compiling project 16
27 #if !defined(__i86__) && defined(__i386__)
36 #include <conio.h> // just for wait
37 #include <time.h> // just for wait
46 #include "src/lib/nyan/kitten.h"
47 #include "src/lib/types.h"
50 struct list __based(__self) *next;
54 /* Control codes for all keys on the keyboard */
93 #define KEY_DASH (0x0C) // -_
94 #define KEY_EQUAL (0x0D) // =+
95 #define KEY_LBRACKET (0x1A) // [{
96 #define KEY_RBRACKET (0x1B) // ]}
97 #define KEY_SEMICOLON (0x27) // ;:
98 #define KEY_RQUOTE (0x28) // '"
99 #define KEY_LQUOTE (0x29) // `~
100 #define KEY_PERIOD (0x33) // .>
101 #define KEY_COMMA (0x34) // ,<
102 #define KEY_SLASH (0x35) // /?
103 #define KEY_BACKSLASH (0x2B) // \|
104 #define KEY_F1 (0x3B)
105 #define KEY_F2 (0x3C)
106 #define KEY_F3 (0x3D)
107 #define KEY_F4 (0x3E)
108 #define KEY_F5 (0x3F)
109 #define KEY_F6 (0x40)
110 #define KEY_F7 (0x41)
111 #define KEY_F8 (0x42)
112 #define KEY_F9 (0x43)
113 #define KEY_F10 (0x44)
114 #define KEY_ESC (0x01)
115 #define KEY_BACKSPACE (0x0E)
116 #define KEY_TAB (0x0F)
117 #define KEY_ENTER (0x1C)
118 #define KEY_CONTROL (0x1D)
119 #define KEY_LSHIFT (0x2A)
120 #define KEY_RSHIFT (0x36)
121 #define KEY_PRTSC (0x37)
122 #define KEY_ALT (0x38)
123 #define KEY_SPACE (0x39)
124 #define KEY_CAPSLOCK (0x3A)
125 #define KEY_NUMLOCK (0x45)
126 #define KEY_SCROLLLOCK (0x46)
127 #define KEY_HOME (0x47)
128 #define KEY_UP (0x48)
129 #define KEY_PGUP (0x49)
130 #define KEY_MINUS (0x4A)
131 #define KEY_LEFT (0x4B)
132 #define KEY_CENTER (0x4C)
133 #define KEY_RIGHT (0x4D)
134 #define KEY_PLUS (0x4E)
135 #define KEY_END (0x4F)
136 #define KEY_DOWN (0x50)
137 #define KEY_PGDOWN (0x51)
138 #define KEY_INS (0x52)
139 #define KEY_DEL (0x53)
141 #define KEY_LWIN (0x73)
142 #define KEY_RWIN (0x74)
143 #define KEY_MENU (0x75)
146 static dword far* clockdw= (dword far*) 0x046C; /* 18.2hz clock */
147 //static dword clockdw=0;
148 extern int profilehandle,debughandle; //make it into game global
152 //#define _SEGU(__p) ((unsigned)((unsigned long)(void __huge*)(__p) >> 16))
154 #define nil ((void *)0)
156 #define peekb(segm,ofs) (*(byte far*)MK_FP((segm),(ofs)))
\r
157 #define peekw(segm,ofs) (*(word far*)MK_FP((segm),(ofs)))
\r
158 #define pokeb(segm,ofs,value) (peekb((segm),(ofs)) = (byte)(value))
\r
159 #define pokew(segm,ofs,value) (peekw((segm),(ofs)) = (word)(value))
\r
161 typedef union REGPACK regs_t;
162 //typedef struct SREGS sregs_t;
164 typedef enum {false,true} boolean;
165 //I hope this is correct!
166 typedef void __based(__self) * memptr;
167 //typedef sregs.w.es * memptr
168 //typedef __segment * memptr;
169 //typedef fenp.op_ptr_seg * memptr;
172 int old_mode; //old video mode before game!
173 word frames_per_second;
175 } global_game_variables_t;
\r
177 /* local function */
\r
178 void wait(clock_t wait);
179 void __near* LargestFreeBlock(size_t* Size);
180 size_t _coreleft(void);
181 void far* LargestFarFreeBlock(size_t* Size);
182 size_t _farcoreleft(void);
183 void huge* LargestHugeFreeBlock(size_t* Size);
184 size_t _hugecoreleft(void);
185 //void __based(__self)* LargestBasedFreeBlock(size_t* Size);
186 //size_t _basedcoreleft(void);
187 size_t GetFreeSize(void);
188 size_t GetFarFreeSize(void);
189 size_t GetNearFreeSize(void);
190 long int filesize(FILE *fp);
191 void print_normal_entry(char *text, dword total, dword used, dword free);
192 void convert(const char *format, dword num);
194 void heapstat(int heap_status);
195 int US_CheckParm(char *parm,char **strings);
197 extern void CA_OpenDebug (void);
\r
198 extern void CA_CloseDebug (void);
200 #endif/*_LIBHEAD_H_*/