OSDN Git Service

__seguse.txt added to show _seg usage also OpenVGMFile needs to be ported to 16_snd...
authorsparky4 <sparky4@cock.li>
Fri, 10 Mar 2017 20:00:18 +0000 (14:00 -0600)
committersparky4 <sparky4@cock.li>
Fri, 10 Mar 2017 20:00:18 +0000 (14:00 -0600)
21 files changed:
DEBUG.16B
MEMINFO.16W [new file with mode: 0755]
MMDUMP.16B
bcexmm.dsk
bcexmm.exe
bcexmm.prj
db.exe
makefile
src/0.c
src/inntest.c
src/inputest.c
src/lib/16_in.c
src/lib/16_in.h
src/lib/16_in_.c
src/lib/16_in_.h
src/lib/16_in__.c [new file with mode: 0755]
src/lib/16_in__.h [new file with mode: 0755]
src/lib/16_tail.c
src/lib/16_tdef.h
wbuild.sh
wcpu.exe

index f476aef..47d8a9f 100755 (executable)
--- a/DEBUG.16B
+++ b/DEBUG.16B
-\e[0mSeg:0      Size:5515       Owner:0x0\r
-\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m0\r
-\e[0m\e[0mSeg:158b       Size:256        Owner:0x2e15\r
-\e[44;34m+++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:168b       Size:256        Owner:0x2c18\r
+\e[0mSeg:0      Size:4884       Owner:0x0\r
+\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:1314       Size:256        Owner:0x2e31\r
+\e[44;34m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:1414       Size:256        Owner:0x2c34\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:178b       Size:256        Owner:0x2c1a\r
+\e[0m\e[0mSeg:1514       Size:256        Owner:0x2c36\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:188b       Size:256        Owner:0x2c1c\r
+\e[0m\e[0mSeg:1614       Size:256        Owner:0x2c38\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:198b       Size:256        Owner:0x2c1e\r
-\e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:1a8b       Size:256        Owner:0x2c20\r
+\e[0m\e[0mSeg:1714       Size:256        Owner:0x2c3a\r
 \e[45;35m+++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:1b8b       Size:256        Owner:0x2c22\r
+\e[0m\e[0mSeg:1814       Size:256        Owner:0x2c3c\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:1c8b       Size:256        Owner:0x2c24\r
+\e[0m\e[0mSeg:1914       Size:256        Owner:0x2c3e\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:1d8b       Size:256        Owner:0x2c26\r
+\e[0m\e[0mSeg:1a14       Size:256        Owner:0x2c40\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:1e9e       Size:34 Owner:0x0\r
-\e[41;31m++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:1ec0       Size:256        Owner:0x2c28\r
+\e[0m\e[0mSeg:1b14       Size:256        Owner:0x2c42\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:1fc0       Size:256        Owner:0x2c2a\r
+\e[0m\e[0mSeg:1c14       Size:256        Owner:0x2c44\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:1d14       Size:256        Owner:0x2c46\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:20c0       Size:256        Owner:0x2c2c\r
+\e[0m\e[0mSeg:1e14       Size:256        Owner:0x2c48\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:21c0       Size:256        Owner:0x2c2e\r
+\e[0m\e[0mSeg:1fde       Size:34 Owner:0x0\r
+\e[41;31m++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2000       Size:256        Owner:0x2c4a\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:22c0       Size:256        Owner:0x2c30\r
+\e[0m\e[0mSeg:2100       Size:256        Owner:0x2c4c\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:23c0       Size:256        Owner:0x2c32\r
+\e[0m\e[0mSeg:2200       Size:256        Owner:0x2c4e\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:24c0       Size:256        Owner:0x2c34\r
+\e[0m\e[0mSeg:2300       Size:256        Owner:0x2c50\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:25c0       Size:256        Owner:0x2c36\r
+\e[0m\e[0mSeg:2400       Size:256        Owner:0x2c52\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:26c0       Size:256        Owner:0x2c38\r
+\e[0m\e[0mSeg:2500       Size:256        Owner:0x2c54\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:27c0       Size:256        Owner:0x2c3a\r
+\e[0m\e[0mSeg:2600       Size:256        Owner:0x2c56\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:28c0       Size:256        Owner:0x2c3c\r
+\e[0m\e[0mSeg:2700       Size:256        Owner:0x2c58\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:29c0       Size:256        Owner:0x2c3e\r
+\e[0m\e[0mSeg:2800       Size:256        Owner:0x2c5a\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:2ac0       Size:256        Owner:0x2c40\r
+\e[0m\e[0mSeg:2900       Size:256        Owner:0x2c5c\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:2bc0       Size:256        Owner:0x2c42\r
+\e[0m\e[0mSeg:2a00       Size:256        Owner:0x2c5e\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:2cc0       Size:256        Owner:0x2c44\r
+\e[0m\e[0mSeg:2b00       Size:256        Owner:0x2c60\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:2dc0       Size:256        Owner:0x2c46\r
+\e[0m\e[0mSeg:2c00       Size:256        Owner:0x2c62\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:2ec0       Size:256        Owner:0x2c48\r
+\e[0m\e[0mSeg:2d00       Size:256        Owner:0x2c64\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:2fc0       Size:256        Owner:0x2c4a\r
+\e[0m\e[0mSeg:2e00       Size:256        Owner:0x2c66\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:30c0       Size:256        Owner:0x2c4c\r
+\e[0m\e[0mSeg:2f00       Size:256        Owner:0x2c68\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:31c0       Size:256        Owner:0x2c4e\r
+\e[0m\e[0mSeg:3000       Size:256        Owner:0x2c6a\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:32c0       Size:256        Owner:0x2c50\r
+\e[0m\e[0mSeg:3100       Size:256        Owner:0x2c6c\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:33c0       Size:256        Owner:0x2c52\r
+\e[0m\e[0mSeg:3200       Size:256        Owner:0x2c6e\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:34c0       Size:256        Owner:0x2c54\r
+\e[0m\e[0mSeg:3300       Size:256        Owner:0x2c70\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:35c0       Size:256        Owner:0x2c56\r
+\e[0m\e[0mSeg:3400       Size:256        Owner:0x2c72\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:36c0       Size:256        Owner:0x2c58\r
+\e[0m\e[0mSeg:3500       Size:256        Owner:0x2c74\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:37c0       Size:256        Owner:0x2c5a\r
+\e[0m\e[0mSeg:3600       Size:256        Owner:0x2c76\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:38c0       Size:256        Owner:0x2c5c\r
+\e[0m\e[0mSeg:3700       Size:256        Owner:0x2c78\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:39c0       Size:256        Owner:0x2c5e\r
+\e[0m\e[0mSeg:3800       Size:256        Owner:0x2c7a\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:3ac0       Size:256        Owner:0x2c60\r
+\e[0m\e[0mSeg:3900       Size:256        Owner:0x2c7c\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:3bc0       Size:256        Owner:0x2c62\r
+\e[0m\e[0mSeg:3a00       Size:256        Owner:0x2c7e\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:3cc0       Size:256        Owner:0x2c64\r
+\e[0m\e[0mSeg:3b00       Size:256        Owner:0x2c80\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:3dc0       Size:256        Owner:0x2c66\r
+\e[0m\e[0mSeg:3c00       Size:256        Owner:0x2c82\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:3ec0       Size:256        Owner:0x2c68\r
+\e[0m\e[0mSeg:3d00       Size:256        Owner:0x2c84\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:3fc0       Size:256        Owner:0x2c6a\r
+\e[0m\e[0mSeg:3e00       Size:256        Owner:0x2c86\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:40c0       Size:256        Owner:0x2c6c\r
+\e[0m\e[0mSeg:3f00       Size:256        Owner:0x2c88\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:41c0       Size:256        Owner:0x2c6e\r
+\e[0m\e[0mSeg:4000       Size:256        Owner:0x2c8a\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:42c0       Size:256        Owner:0x2c70\r
+\e[0m\e[0mSeg:4100       Size:256        Owner:0x2c8c\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:43c0       Size:256        Owner:0x2c72\r
+\e[0m\e[0mSeg:4200       Size:256        Owner:0x2c8e\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:44c0       Size:256        Owner:0x2c74\r
+\e[0m\e[0mSeg:4300       Size:256        Owner:0x2c90\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:45c0       Size:256        Owner:0x2c76\r
+\e[0m\e[0mSeg:4400       Size:256        Owner:0x2c92\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:46c0       Size:256        Owner:0x2c78\r
+\e[0m\e[0mSeg:4500       Size:256        Owner:0x2c94\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:47c0       Size:256        Owner:0x2c7a\r
+\e[0m\e[0mSeg:4600       Size:256        Owner:0x2c96\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:48c0       Size:256        Owner:0x2c7c\r
+\e[0m\e[0mSeg:4700       Size:256        Owner:0x2c98\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:49c0       Size:256        Owner:0x2c7e\r
+\e[0m\e[0mSeg:4800       Size:256        Owner:0x2c9a\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:4ac0       Size:256        Owner:0x2c80\r
+\e[0m\e[0mSeg:4900       Size:256        Owner:0x2c9c\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:4bc0       Size:256        Owner:0x2c82\r
+\e[0m\e[0mSeg:4a00       Size:256        Owner:0x2c9e\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:4cc0       Size:256        Owner:0x2c84\r
+\e[0m\e[0mSeg:4b00       Size:256        Owner:0x2ca0\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:4dc0       Size:256        Owner:0x2c86\r
+\e[0m\e[0mSeg:4c00       Size:256        Owner:0x2ca2\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:4ec0       Size:256        Owner:0x2c88\r
+\e[0m\e[0mSeg:4d00       Size:256        Owner:0x2ca4\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:4fc0       Size:256        Owner:0x2c8a\r
+\e[0m\e[0mSeg:4e00       Size:256        Owner:0x2ca6\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:50c0       Size:256        Owner:0x2c8c\r
+\e[0m\e[0mSeg:4f00       Size:256        Owner:0x2ca8\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:51c0       Size:256        Owner:0x2c8e\r
+\e[0m\e[0mSeg:5000       Size:256        Owner:0x2caa\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:52c0       Size:256        Owner:0x2c90\r
+\e[0m\e[0mSeg:5100       Size:256        Owner:0x2cac\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:53c0       Size:256        Owner:0x2c92\r
+\e[0m\e[0mSeg:5200       Size:256        Owner:0x2cae\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:54c0       Size:256        Owner:0x2c94\r
+\e[0m\e[0mSeg:5300       Size:256        Owner:0x2cb0\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:55c0       Size:256        Owner:0x2c96\r
+\e[0m\e[0mSeg:5400       Size:256        Owner:0x2cb2\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:56c0       Size:256        Owner:0x2c98\r
+\e[0m\e[0mSeg:5500       Size:256        Owner:0x2cb4\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:57c0       Size:256        Owner:0x2c9a\r
+\e[0m\e[0mSeg:5600       Size:256        Owner:0x2cb6\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:58c0       Size:256        Owner:0x2c9c\r
+\e[0m\e[0mSeg:5700       Size:256        Owner:0x2cb8\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:59c0       Size:256        Owner:0x2c9e\r
+\e[0m\e[0mSeg:5800       Size:256        Owner:0x2cba\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:5ac0       Size:256        Owner:0x2ca0\r
+\e[0m\e[0mSeg:5900       Size:256        Owner:0x2cbc\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:5bc0       Size:256        Owner:0x2ca2\r
+\e[0m\e[0mSeg:5a00       Size:256        Owner:0x2cbe\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:5cc0       Size:256        Owner:0x2ca4\r
+\e[0m\e[0mSeg:5b00       Size:256        Owner:0x2cc0\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:5dc0       Size:256        Owner:0x2ca6\r
+\e[0m\e[0mSeg:5c00       Size:256        Owner:0x2cc2\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:5ec0       Size:256        Owner:0x2ca8\r
+\e[0m\e[0mSeg:5d00       Size:256        Owner:0x2cc4\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:5fc0       Size:256        Owner:0x2caa\r
+\e[0m\e[0mSeg:5e00       Size:256        Owner:0x2cc6\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:60c0       Size:256        Owner:0x2cac\r
+\e[0m\e[0mSeg:5f00       Size:256        Owner:0x2cc8\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:61c0       Size:256        Owner:0x2cae\r
+\e[0m\e[0mSeg:6000       Size:256        Owner:0x2cca\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:62c0       Size:256        Owner:0x2cb0\r
+\e[0m\e[0mSeg:6100       Size:256        Owner:0x2ccc\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:63c0       Size:256        Owner:0x2cb2\r
+\e[0m\e[0mSeg:6200       Size:256        Owner:0x2cce\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:64c0       Size:256        Owner:0x2cb4\r
+\e[0m\e[0mSeg:6300       Size:256        Owner:0x2cd0\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:65c0       Size:256        Owner:0x2cb6\r
+\e[0m\e[0mSeg:6400       Size:256        Owner:0x2cd2\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:66c0       Size:256        Owner:0x2cb8\r
+\e[0m\e[0mSeg:6500       Size:256        Owner:0x2cd4\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:67c0       Size:256        Owner:0x2cba\r
+\e[0m\e[0mSeg:6600       Size:256        Owner:0x2cd6\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:68c0       Size:256        Owner:0x2cbc\r
+\e[0m\e[0mSeg:6700       Size:256        Owner:0x2cd8\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:69c0       Size:256        Owner:0x2cbe\r
+\e[0m\e[0mSeg:6800       Size:256        Owner:0x2cda\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:6ac0       Size:256        Owner:0x2cc0\r
+\e[0m\e[0mSeg:6900       Size:256        Owner:0x2cdc\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:6bc0       Size:256        Owner:0x2cc2\r
+\e[0m\e[0mSeg:6a00       Size:256        Owner:0x2cde\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:6cc0       Size:256        Owner:0x2cc4\r
+\e[0m\e[0mSeg:6b00       Size:256        Owner:0x2ce0\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:6dc0       Size:256        Owner:0x2cc6\r
+\e[0m\e[0mSeg:6c00       Size:256        Owner:0x2ce2\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:6ec0       Size:256        Owner:0x2cc8\r
+\e[0m\e[0mSeg:6d00       Size:256        Owner:0x2ce4\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:6fc0       Size:256        Owner:0x2cca\r
+\e[0m\e[0mSeg:6e00       Size:256        Owner:0x2ce6\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:70c0       Size:256        Owner:0x2ccc\r
+\e[0m\e[0mSeg:6f00       Size:256        Owner:0x2ce8\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:71c0       Size:256        Owner:0x2cce\r
+\e[0m\e[0mSeg:7000       Size:256        Owner:0x2cea\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:72c0       Size:256        Owner:0x2cd0\r
+\e[0m\e[0mSeg:7100       Size:256        Owner:0x2cec\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:73c0       Size:256        Owner:0x2cd2\r
+\e[0m\e[0mSeg:7200       Size:256        Owner:0x2cee\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:74c0       Size:256        Owner:0x2cd4\r
+\e[0m\e[0mSeg:7300       Size:256        Owner:0x2cf0\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:75c0       Size:256        Owner:0x2cd6\r
+\e[0m\e[0mSeg:7400       Size:256        Owner:0x2cf2\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:76c0       Size:256        Owner:0x2cd8\r
+\e[0m\e[0mSeg:7500       Size:256        Owner:0x2cf4\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:77c0       Size:256        Owner:0x2cda\r
+\e[0m\e[0mSeg:7600       Size:256        Owner:0x2cf6\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:78c0       Size:256        Owner:0x2cdc\r
+\e[0m\e[0mSeg:7700       Size:256        Owner:0x2cf8\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:79c0       Size:256        Owner:0x2cde\r
+\e[0m\e[0mSeg:7800       Size:256        Owner:0x2cfa\r
 \e[45;35m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:7ac0       Size:273        Owner:0x2bee\r
-\e[44;34m+++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:9dff       Size:25088      Owner:0x0\r
-\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m
\ No newline at end of file
+\e[0m\e[0mSeg:7900       Size:273        Owner:0x2c0a\r
+\e[44;34m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:9f3f       Size:24768      Owner:0x0\r
+\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m
\ No newline at end of file
diff --git a/MEMINFO.16W b/MEMINFO.16W
new file mode 100755 (executable)
index 0000000..e69de29
index fe3f37d..5053477 100755 (executable)
Binary files a/MMDUMP.16B and b/MMDUMP.16B differ
index 3f30f2e..a2a7f77 100755 (executable)
Binary files a/bcexmm.dsk and b/bcexmm.dsk differ
index 00dd4fb..cf74b44 100755 (executable)
Binary files a/bcexmm.exe and b/bcexmm.exe differ
index 7ec1ecd..30807dc 100755 (executable)
Binary files a/bcexmm.prj and b/bcexmm.prj differ
diff --git a/db.exe b/db.exe
index 587c001..457a9fa 100755 (executable)
Binary files a/db.exe and b/db.exe differ
index 58f4ec1..3462153 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -125,8 +125,8 @@ LIBFLAGS=$(WLIBQ) -b -n
 VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
 #OLDLIBOBJS=bitmap.$(OBJ) 16render.$(OBJ)
 GFXLIBOBJS = 16_vl.$(OBJ) 16_vlpal.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16_vrs.$(OBJ) 16_spri.$(OBJ) $(OLDLIBOBJS)
-16LIBNOINOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ) 16_enti.$(OBJ)
-16LIBOBJS = $(16LIBNOINOBJS) 16_in.$(OBJ)
+16LIBNOINOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ)
+16LIBOBJS = $(16LIBNOINOBJS) 16_in.$(OBJ) 16_enti.$(OBJ)
 DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
 !ifeq DEBUGSERIAL 1
 DOSLIBOBJ += 8250.$(OBJ)
@@ -243,7 +243,7 @@ fonttest.exe:        fonttest.$(OBJ) gfx.lib
 #fonttes0.exe: fonttes0.$(OBJ) $(16LIB)
 fontgfx.exe:   fontgfx.$(OBJ) gfx.lib $(DOSLIB)
 inputest.exe:   inputest.$(OBJ) $(16LIB) $(DOSLIB) gfx.lib
-inntest.exe:    inntest.$(OBJ) $(DOSLIB) $(16LIBNOINOBJS) 16_in_.$(OBJ)
+inntest.exe:    inntest.$(OBJ) $(16LIBNOINOBJS) 16_in__.$(OBJ)
 #sountest.exe: sountest.$(OBJ) $(16LIB)
 pcxtest.exe:   pcxtest.$(OBJ) gfx.lib $(DOSLIB) $(16LIB)
 vrstest.exe:   vrstest.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
@@ -339,7 +339,7 @@ mapread.$(OBJ):$(SRCLIB)/mapread.c $(SRCLIB)/mapread.h
 16_map.$(OBJ):$(SRCLIB)/16_map.c $(SRCLIB)/16_map.h
 16_timer.$(OBJ):$(SRCLIB)/16_timer.c $(SRCLIB)/16_timer.h
 16_in.$(OBJ):   $(SRCLIB)/16_in.c $(SRCLIB)/16_in.h
-16_in_.$(OBJ):  $(SRCLIB)/16_in_.c $(SRCLIB)/16_in.h
+16_in__.$(OBJ):         $(SRCLIB)/16_in__.c $(SRCLIB)/16_in.h
 16_rf.$(OBJ):   $(SRCLIB)/16_rf.c      $(SRCLIB)/16_rf.h
 16_mm.$(OBJ):   $(SRCLIB)/16_mm.c      $(SRCLIB)/16_mm.h
 16_pm.$(OBJ):   $(SRCLIB)/16_pm.c      $(SRCLIB)/16_pm.h
diff --git a/src/0.c b/src/0.c
index ba9ced8..d3c6ba5 100755 (executable)
--- a/src/0.c
+++ b/src/0.c
@@ -102,7 +102,7 @@ int main(int argc,char **argv)
        vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
        if (vrl_lineoffs == NULL) return 1;\r
 \r
-       IN_Startup();\r
+       IN_Startup(&gvar);\r
        IN_Default(0,&gvar.player,ctrl_Keyboard1);\r
        EN_initPlayer(&gvar.player, 0, &gvar.video);\r
 \r
@@ -302,7 +302,7 @@ if(!noanim) {
                }\r
        }\r
 }\r
-       IN_Shutdown();\r
+       IN_Shutdown(&gvar);\r
        VGAmodeX(0, 1, &gvar);\r
        free(vrl_lineoffs);\r
        buffer = NULL;\r
index 1ba8b22..3742f87 100755 (executable)
 /*\r
        input test\r
 */\r
-#include "src/lib/16_in.h"\r
-#include "src/lib/16_tail.h"\r
+#include "src/lib/16_in_.h"\r
+\r
+void probe_dos(){}\r
+void cpu_probe(){}\r
+int probe_vga(){ return 0; }\r
+void VGAmodeX(){}\r
 \r
 void\r
 main(int argc, char *argv[])\r
@@ -34,23 +38,23 @@ main(int argc, char *argv[])
        dbg_testcontrolnoisy=1;\r
        start_timer(&gvar);\r
        //Startup16(&gvar);\r
-       IN_Startup();\r
+       IN_Startup(&gvar);\r
        //IN_Default(0,&gvar.player,ctrl_Joystick1);\r
        //IN_SetControlType(0,&gvar.player,ctrl_Joystick1);\r
-       IN_Default(0,&gvar.player,ctrl_Keyboard1);\r
+       IN_Default(0,&gvar.player,ctrl_Keyboard1, &gvar);\r
        IN_SetControlType(0,&gvar.player,ctrl_Keyboard1);\r
 \r
        gvar.player[0].enti.q=1;\r
        gvar.player[0].enti.d=2;\r
        gvar.player[0].enti.speed=4;\r
 \r
-//0000 nibbletest();\r
-//0000 booleantest();\r
+//0000 nibbletest(){}\r
+//0000 booleantest(){}\r
        //printf("dbg_testkeyin=%u      dbg_testcontrolnoisy=%u dbg_nogvar.playerinpu=%u\nloop if this is not responsive then please KILL or reset machine sorry!!\n", dbg_testkeyin, dbg_testcontrolnoisy, dbg_nogvar.playerinpu);\r
-       while(!IN_KeyDown(sc_Escape))\r
+       while(!IN_KeyDown(sc_Escape, &gvar))\r
        {\r
 //0000         shinkutxt(&gvar);\r
-               IN_ReadControl(0, &gvar.player);\r
+               IN_ReadControl(0, &gvar.player, &gvar);\r
                switch(gvar.player[0].enti.d)\r
                {\r
                //right movement\r
@@ -87,8 +91,8 @@ main(int argc, char *argv[])
        }\r
                //printf("%u\n", IN_KeyDown(sc_Escape));\r
                //if(\r
-               IN_qb(sc_9);//>0) printf("IN_qb(sc_9)=%u\n", IN_qb(sc_9));\r
-               if(IN_KeyDown(88))      //speed\r
+               IN_qb(sc_9, &gvar);//>0) printf("IN_qb(sc_9)=%u\n", IN_qb(sc_9));\r
+               if(IN_KeyDown(88, &gvar))       //speed\r
                {\r
                        switch(gvar.kurokku.fpscap)\r
                        {\r
@@ -99,10 +103,10 @@ main(int argc, char *argv[])
                                        gvar.kurokku.fpscap=0;\r
                                break;\r
                        }\r
-                       //IN_Ack();\r
+                       //IN_Ack(){}\r
                }\r
        }\r
-       IN_Shutdown();\r
+       IN_Shutdown(&gvar);\r
                //Shutdown16(&gvar);\r
        //printf("%u\n", in.Keyboard[sc_Escape]);\r
        printf("inputest.exe ");\r
index 1ba8b22..6481ad7 100755 (executable)
@@ -34,7 +34,7 @@ main(int argc, char *argv[])
        dbg_testcontrolnoisy=1;\r
        start_timer(&gvar);\r
        //Startup16(&gvar);\r
-       IN_Startup();\r
+       IN_Startup(&gvar);\r
        //IN_Default(0,&gvar.player,ctrl_Joystick1);\r
        //IN_SetControlType(0,&gvar.player,ctrl_Joystick1);\r
        IN_Default(0,&gvar.player,ctrl_Keyboard1);\r
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
                        //IN_Ack();\r
                }\r
        }\r
-       IN_Shutdown();\r
+       IN_Shutdown(&gvar);\r
                //Shutdown16(&gvar);\r
        //printf("%u\n", in.Keyboard[sc_Escape]);\r
        printf("inputest.exe ");\r
index a2b2804..c2550ec 100755 (executable)
@@ -61,7 +61,6 @@ struct inconfig
        JoystickDef     JoyDefs[MaxJoys];\r
 } inpu;\r
 \r
-//extern inconfig inpu;\r
 //inpu.KbdDefs = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/};\r
 \r
 /*\r
@@ -150,15 +149,9 @@ static     byte        far ASCIINames[] =          // Unshifted ASCII for scan codes
 \r
 static Direction       DirTable[] =            // Quick lookup for total direction\r
                                        {\r
-                                               //dir_Nortinest,\r
-                                               dir_North,\r
-                                               dir_West,\r
-                                               dir_None,\r
-                                               dir_East,\r
-                                               dir_South\r
-                                               //dir_NorthEast,\r
-                                               //dir_Soutinest,\r
-                                               //,dir_SouthEast\r
+                                               /*dir_NorthWest,        */dir_North,/*  dir_NorthEast,*/\r
+                                               dir_West,               dir_None,       dir_East,\r
+                                               /*dir_SouthWest,        */dir_South/*,  dir_SouthEast*/\r
                                        };\r
 #ifdef __cplusplus\r
 }\r
@@ -175,8 +168,8 @@ void interrupt
 INL_KeyService()\r
 {\r
 static boolean special;\r
-               byte    k,c;\r
-               register byte temp;\r
+               byte    k,c,\r
+                               temp;\r
 \r
        k = inp(0x60);  // Get the scan code\r
 \r
index 4c03916..86980fe 100755 (executable)
@@ -218,48 +218,48 @@ typedef   struct          {
 #endif\r
 \r
 //     Internal routines\r
-extern void interrupt INL_KeyService();\r
-extern void Mouse(int x);\r
+void interrupt INL_KeyService();\r
+void Mouse(int x);\r
 //static void INL_GetMouseDelta(int *x,int *y);\r
 //static word INL_GetMouseButtons(void);\r
-extern void IN_GetJoyAbs(word joy,word *xp,word *yp);\r
+void IN_GetJoyAbs(word joy,word *xp,word *yp);\r
 //static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);\r
 //static word INL_GetJoyButtons(word joy);\r
-extern word IN_GetJoyButtonsDB(word joy);\r
+word IN_GetJoyButtonsDB(word joy);\r
 //static void INL_StartKbd(void);\r
 //static void INL_ShutKbd(void);\r
 //static boolean INL_StartMouse(void);\r
 //static void INL_ShutMouse(void);\r
 //static void INL_SetJoyScale(word joy);\r
-extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);\r
+void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);\r
 //static boolean INL_StartJoy(word joy);\r
 //static void INL_ShutJoy(word joy);\r
-extern void IN_Startup();\r
-extern void IN_Default(boolean gotit,player_t *player,ControlType nt);\r
-extern void IN_Shutdown();\r
-extern void IN_SetKeyHook(void (*hook)());\r
-extern void IN_ClearKeysDown();\r
+void IN_Startup();\r
+void IN_Default(boolean gotit,player_t *player,ControlType nt);\r
+void IN_Shutdown();\r
+void IN_SetKeyHook(void (*hook)());\r
+void IN_ClearKeysDown();\r
 //static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);\r
-extern void IN_ReadCursor(CursorInfo *info);\r
-extern void near IN_ReadControl(word pn, player_t *player);\r
-extern void IN_SetControlType(word pn,player_t *player,ControlType type);\r
+void IN_ReadCursor(CursorInfo *info);\r
+void near IN_ReadControl(word pn, player_t *player);\r
+void IN_SetControlType(word pn,player_t *player,ControlType type);\r
 #if DEMO0\r
-extern boolean IN_StartDemoRecord(word bufsize);\r
-extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
-extern void IN_StopDemo(void);\r
-extern void IN_FreeDemoBuffer(void);\r
+boolean IN_StartDemoRecord(word bufsize);\r
+void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
+void IN_StopDemo(void);\r
+void IN_FreeDemoBuffer(void);\r
 #endif\r
-extern byte *IN_GetScanName(ScanCode scan);\r
-extern ScanCode IN_WaitForKey();\r
-extern char IN_WaitForASCII();\r
-extern void IN_AckBack();\r
-extern void IN_Ack();\r
-extern boolean IN_IsUserInput();\r
-extern boolean IN_UserInput(dword delay,boolean clear);\r
-extern boolean IN_KeyDown(byte code);\r
-extern void IN_ClearKey(byte code);\r
-extern boolean IN_qb(byte kee);\r
-extern ScanCode IN_GetLastScan();\r
-extern ScanCode IN_GetCurCode();\r
+byte *IN_GetScanName(ScanCode scan);\r
+ScanCode IN_WaitForKey();\r
+char IN_WaitForASCII();\r
+void IN_AckBack();\r
+void IN_Ack();\r
+boolean IN_IsUserInput();\r
+boolean IN_UserInput(dword delay,boolean clear);\r
+boolean IN_KeyDown(byte code);\r
+void IN_ClearKey(byte code);\r
+boolean IN_qb(byte kee);\r
+ScanCode IN_GetLastScan();\r
+ScanCode IN_GetCurCode();\r
 \r
 #endif\r
index 9b6bc7a..c04d15a 100755 (executable)
@@ -36,7 +36,7 @@
 //     DEBUG - there are more globals\r
 //\r
 \r
-#include "src/lib/16_in.h"\r
+#include "src/lib/16_in_.h"\r
 #pragma        hdrstop\r
 \r
 /*\r
 extern "C" {\r
 #endif\r
 \r
+static void                    (*INL_KeyHook)(void);\r
+static void interrupt  (*OldKeyVect)(void);\r
+static char                    *ParmStringsIN[] = {"nojoys","nomouse",nil};\r
+\r
 static byte        far ASCIINames[] =          // Unshifted ASCII for scan codes\r
                                        {\r
 //      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
@@ -128,22 +132,11 @@ static    byte        far ASCIINames[] =          // Unshifted ASCII for scan codes
 \r
 static Direction       DirTable[] =            // Quick lookup for total direction\r
                                        {\r
-                                               //dir_Nortinest,\r
-                                               dir_North,\r
-                                               dir_West,\r
-                                               dir_None,\r
-                                               dir_East,\r
-                                               dir_South\r
-                                               //dir_NorthEast,\r
-                                               //dir_Soutinest,\r
-                                               //,dir_SouthEast\r
+                                               /*dir_NorthWest,        */dir_North,/*  dir_NorthEast,*/\r
+                                               dir_West,               dir_None,       dir_East,\r
+                                               /*dir_SouthWest,        */dir_South/*,  dir_SouthEast*/\r
                                        };\r
 \r
-static void                    (*INL_KeyHook)(void);\r
-static void interrupt  (*OldKeyVect)(void);\r
-\r
-static char                    *ParmStringsIN[] = {"nojoys","nomouse",nil};\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
@@ -155,12 +148,12 @@ static    char                    *ParmStringsIN[] = {"nojoys","nomouse",nil};
 //     INL_KeyService() - Handles a keyboard interrupt (key up/down)\r
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
-void interrupt\r
-INL_KeyService()\r
+/*static */void interrupt\r
+INL_KeyService(global_game_variables_t *gvar)\r
 {\r
 static boolean special;\r
-               byte    k,c;\r
-               register byte temp;\r
+               byte    k,c,\r
+                               temp;\r
 \r
        k = inp(0x60);  // Get the scan code\r
 \r
@@ -171,7 +164,7 @@ static      boolean special;
        if (k == 0xe0)          // Special key prefix\r
                special = true;\r
        else if (k == 0xe1)     // Handle Pause key\r
-               inpu.Paused = true;\r
+               gvar->in.Paused = true;\r
        else\r
        {\r
                if (k & 0x80)   // Break code\r
@@ -180,13 +173,13 @@ static    boolean special;
 \r
 // DEBUG - handle special keys: ctl-alt-delete, print scrn\r
 \r
-                       inpu.Keyboard[k] = false;\r
+                       gvar->in.Keyboard[k] = false;\r
                }\r
                else                    // Make code\r
                {\r
-                       inst.LastCode = inst.CurCode;\r
-                       inst.CurCode = inpu.LastScan = k;\r
-                       inpu.Keyboard[k] = true;\r
+                       gvar->in.LastCode = gvar->in.CurCode;\r
+                       gvar->in.CurCode = gvar->in.LastScan = k;\r
+                       gvar->in.Keyboard[k] = true;\r
 \r
                        if (special)\r
                                c = SpecialNames[k];\r
@@ -194,25 +187,25 @@ static    boolean special;
                        {\r
                                if (k == sc_CapsLock)\r
                                {\r
-                                       inst.CapsLock ^= true;\r
+                                       gvar->in.CapsLock ^= true;\r
                                        // DEBUG - make caps lock light work\r
                                }\r
 \r
-                               if (inpu.Keyboard[sc_LShift] || inpu.Keyboard[sc_RShift])       // If shifted\r
+                               if (gvar->in.Keyboard[sc_LShift] || gvar->in.Keyboard[sc_RShift])       // If shifted\r
                                {\r
                                        c = ShiftNames[k];\r
-                                       if ((c >= 'A') && (c <= 'Z') && inst.CapsLock)\r
+                                       if ((c >= 'A') && (c <= 'Z') && gvar->in.CapsLock)\r
                                                c += 'a' - 'A';\r
                                }\r
                                else\r
                                {\r
                                        c = ASCIINames[k];\r
-                                       if ((c >= 'a') && (c <= 'z') && inst.CapsLock)\r
+                                       if ((c >= 'a') && (c <= 'z') && gvar->in.CapsLock)\r
                                                c -= 'a' - 'A';\r
                                }\r
                        }\r
                        if (c)\r
-                               inpu.LastASCII = c;\r
+                               gvar->in.LastASCII = c;\r
                }\r
 \r
                special = false;\r
@@ -221,7 +214,7 @@ static      boolean special;
        if (INL_KeyHook && !special)\r
                INL_KeyHook();\r
 #ifdef __DEBUG_InputMgr__\r
-       if(dbg_testkeyin > 0) printf("%c        %u      [0x%x %u]       %u\n", c, c, k, k, inpu.Keyboard[k]);\r
+       if(dbg_testkeyin > 0) printf("%c        %u      [0x%x %u]       %u\n", c, c, k, k, gvar->in.Keyboard[k]);\r
 #endif\r
        outp(0x20,0x20);\r
 }\r
@@ -366,16 +359,16 @@ done:
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 static void\r
-INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive)\r
+INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive, global_game_variables_t *gvar)\r
 {\r
        word            x,y;\r
        word    time;\r
-       word TimeCount = *clockw;\r
+       word TimeCount = gvar->kurokku.clock_start;\r
        JoystickDef     *def;\r
 static word    lasttime;\r
 \r
        IN_GetJoyAbs(joy,&x,&y);\r
-       def = inpu.JoyDefs + joy;\r
+       def = gvar->in.JoyDefs + joy;\r
 \r
        if (x < def->threshMinX)\r
        {\r
@@ -462,9 +455,9 @@ register    word    result;
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 word\r
-IN_GetJoyButtonsDB(word joy)\r
+IN_GetJoyButtonsDB(word joy, global_game_variables_t *gvar)\r
 {\r
-       word TimeCount = *clockw;\r
+       word TimeCount = gvar->kurokku.clock_start;\r
        word    lasttime;\r
        word            result1,result2;\r
 \r
@@ -484,12 +477,12 @@ IN_GetJoyButtonsDB(word joy)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 static void\r
-INL_StartKbd()\r
+INL_StartKbd(global_game_variables_t *gvar)\r
 {\r
        byte far *lock_key;\r
        INL_KeyHook = 0;        // Clear key hook\r
 \r
-       IN_ClearKeysDown();\r
+       IN_ClearKeysDown(gvar);\r
 \r
        OldKeyVect = _dos_getvect(KeyInt);\r
 \r
@@ -545,11 +538,11 @@ INL_ShutMouse(void)
 //     INL_SetJoyScale() - Sets up scaling values for the specified joystick\r
 //\r
 static void\r
-INL_SetJoyScale(word joy)\r
+INL_SetJoyScale(word joy, global_game_variables_t *gvar)\r
 {\r
        JoystickDef     *def;\r
 \r
-       def = &(inpu.JoyDefs[joy]);\r
+       def = &(gvar->in.JoyDefs[joy]);\r
        def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX);\r
        def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX);\r
        def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY);\r
@@ -563,12 +556,12 @@ INL_SetJoyScale(word joy)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)\r
+IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy, global_game_variables_t *gvar)\r
 {\r
        word            d,r;\r
        JoystickDef     *def;\r
 \r
-       def = &(inpu.JoyDefs[joy]);\r
+       def = &(gvar->in.JoyDefs[joy]);\r
 \r
        def->joyMinX = minx;\r
        def->joyMaxX = maxx;\r
@@ -584,7 +577,7 @@ IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)
        def->threshMinY = ((r / 2) - d) + miny;\r
        def->threshMaxY = ((r / 2) + d) + miny;\r
 \r
-       INL_SetJoyScale(joy);\r
+       INL_SetJoyScale(joy, gvar);\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -594,7 +587,7 @@ IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 static boolean\r
-INL_StartJoy(word joy)\r
+INL_StartJoy(word joy, global_game_variables_t *gvar)\r
 {\r
        word            x,y;\r
 \r
@@ -608,7 +601,7 @@ INL_StartJoy(word joy)
                return(false);\r
        else\r
        {\r
-               IN_SetupJoy(joy,0,x * 2,0,y * 2);\r
+               IN_SetupJoy(joy,0,x * 2,0,y * 2, gvar);\r
                return(true);\r
        }\r
 }\r
@@ -619,9 +612,9 @@ INL_StartJoy(word joy)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 static void\r
-INL_ShutJoy(word joy)\r
+INL_ShutJoy(word joy, global_game_variables_t *gvar)\r
 {\r
-       inpu.JoysPresent[joy] = false;\r
+       gvar->in.JoysPresent[joy] = false;\r
 }\r
 \r
 //     Public routines\r
@@ -632,12 +625,12 @@ INL_ShutJoy(word joy)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_Startup()\r
+IN_Startup(global_game_variables_t *gvar)\r
 {\r
        boolean checkjoys,checkmouse;\r
        word    i;\r
 \r
-       if (inst.IN_Started)\r
+       if (gvar->in.IN_Started)\r
                return;\r
 \r
        checkjoys = true;\r
@@ -655,16 +648,16 @@ IN_Startup()
                }\r
        }\r
 \r
-       INL_StartKbd();\r
-       inpu.MousePresent = checkmouse? INL_StartMouse() : false;\r
+       INL_StartKbd(gvar);\r
+       gvar->in.MousePresent = checkmouse? INL_StartMouse() : false;\r
 \r
        for (i = 0;i < MaxJoys;i++)\r
-               ININFO_JoysPresent[i] = checkjoys? INL_StartJoy(i) : false;\r
+               gvar->in.JoysPresent[i] = checkjoys? INL_StartJoy(i, gvar) : false;\r
 \r
-       for (i = 0;i < MaxKbds;i++)\r
-               ININFO_KbdDefs[i] = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/};\r
+       //for (i = 0;i < MaxKbds;i++)\r
+       //      gvar->in.KbdDefs[i] = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/};\r
 \r
-       inst.IN_Started = true;\r
+       gvar->in.IN_Started = true;\r
 \r
 }\r
 \r
@@ -674,26 +667,26 @@ IN_Startup()
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_Default(boolean gotit,player_t *player,ControlType nt)\r
+IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar)\r
 {\r
        int i;\r
        if\r
        (\r
                (!gotit)\r
-       ||      ((nt == ctrl_Joystick1) && !inpu.JoysPresent[0])\r
-       ||      ((nt == ctrl_Joystick2) && !inpu.JoysPresent[1])\r
-       ||      ((nt == ctrl_Mouse) && !inpu.MousePresent)\r
+       ||      ((nt == ctrl_Joystick1) && !gvar->in.JoysPresent[0])\r
+       ||      ((nt == ctrl_Joystick2) && !gvar->in.JoysPresent[1])\r
+       ||      ((nt == ctrl_Mouse) && !gvar->in.MousePresent)\r
        )\r
                nt = ctrl_Keyboard1;\r
-       ININFO_KbdDefs[0].button0 = 0x1c;\r
-       ININFO_KbdDefs[0].button1 = 0x38;\r
+       gvar->in.KbdDefs[0].button0 = 0x1c;\r
+       gvar->in.KbdDefs[0].button1 = 0x38;\r
        //in.KbdDefs[0].upleft = 0x47;\r
-       ININFO_KbdDefs[0].up = 0x48;\r
+       gvar->in.KbdDefs[0].up = 0x48;\r
        //in.KbdDefs[0].upright = 0x49;\r
-       ININFO_KbdDefs[0].left = 0x4b;\r
-       ININFO_KbdDefs[0].right = 0x4d;\r
+       gvar->in.KbdDefs[0].left = 0x4b;\r
+       gvar->in.KbdDefs[0].right = 0x4d;\r
        //in.KbdDefs[0].downleft = 0x4f;\r
-       ININFO_KbdDefs[0].down = 0x50;\r
+       gvar->in.KbdDefs[0].down = 0x50;\r
        //in.KbdDefs[0].downright = 0x51;\r
        IN_SetControlType(0,player,nt);\r
        for(i=0; i>MaxPlayers;i++)\r
@@ -706,19 +699,19 @@ IN_Default(boolean gotit,player_t *player,ControlType nt)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_Shutdown()\r
+IN_Shutdown(global_game_variables_t *gvar)\r
 {\r
        word    i;\r
 \r
-       if (!inst.IN_Started)\r
+       if (!gvar->in.IN_Started)\r
                return;\r
 \r
        INL_ShutMouse();\r
        for (i = 0;i < MaxJoys;i++)\r
-               INL_ShutJoy(i);\r
+               INL_ShutJoy(i, gvar);\r
        INL_ShutKbd();\r
 \r
-       inst.IN_Started = false;\r
+       gvar->in.IN_Started = false;\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -739,13 +732,13 @@ IN_SetKeyHook(void (*hook)())
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_ClearKeysDown()\r
+IN_ClearKeysDown(global_game_variables_t *gvar)\r
 {\r
        //int   i;\r
 \r
-       inpu.LastScan = sc_None;\r
-       inpu.LastASCII = key_None;\r
-       memset (inpu.Keyboard,0,sizeof(inpu.Keyboard));\r
+       gvar->in.LastScan = sc_None;\r
+       gvar->in.LastASCII = key_None;\r
+       memset (gvar->in.Keyboard,0,sizeof(gvar->in.Keyboard));\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -772,7 +765,7 @@ INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_ReadCursor(CursorInfo *info)\r
+IN_ReadCursor(CursorInfo *info, global_game_variables_t *gvar)\r
 {\r
        word    i,\r
                        buttons;\r
@@ -781,7 +774,7 @@ IN_ReadCursor(CursorInfo *info)
        info->x = info->y = 0;\r
        info->button0 = info->button1 = false;\r
 \r
-       if (inpu.MousePresent)\r
+       if (gvar->in.MousePresent)\r
        {\r
                buttons = INL_GetMouseButtons();\r
                INL_GetMouseDelta(&dx,&dy);\r
@@ -790,11 +783,11 @@ IN_ReadCursor(CursorInfo *info)
 \r
        for (i = 0;i < MaxJoys;i++)\r
        {\r
-               if (!inpu.JoysPresent[i])\r
+               if (!gvar->in.JoysPresent[i])\r
                        continue;\r
 \r
                buttons = INL_GetJoyButtons(i);\r
-               INL_GetJoyDelta(i,&dx,&dy,true);\r
+               INL_GetJoyDelta(i,&dx,&dy,true, gvar);\r
                dx /= 64;\r
                dy /= 64;\r
                INL_AdjustCursor(info,buttons,dx,dy);\r
@@ -808,7 +801,7 @@ IN_ReadCursor(CursorInfo *info)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void near\r
-IN_ReadControl(word pn, player_t *player)\r
+IN_ReadControl(word pn, player_t *player, global_game_variables_t *gvar)\r
 {\r
                        boolean         realdelta;\r
 #if DEMO0\r
@@ -852,7 +845,7 @@ register    KeyboardDef     *def;
                {\r
                case ctrl_Keyboard1:\r
                case ctrl_Keyboard2:\r
-                       def = &(ININFO_KbdDefs[type - ctrl_Keyboard]);\r
+                       def = &(gvar->in.KbdDefs[type - ctrl_Keyboard]);\r
 \r
 /*                     if (Keyboard[def->upleft])\r
                                mx = motion_Left,my = motion_Up;\r
@@ -865,28 +858,28 @@ register  KeyboardDef     *def;
 //TODO: make this into a function that the joystick AND keyboard can use wwww\r
                        if(DIRECTIONIFELSE)//(player[pn].info.dir == 2)\r
                        {\r
-                       if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){\r
-                               if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]))\r
+                       if(!gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right]){\r
+                               if((gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down]))\r
                                        my = motion_Up;\r
-                               if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up]))\r
+                               if((gvar->in.Keyboard[def->down] && !gvar->in.Keyboard[def->up]))\r
                                        my = motion_Down;\r
-                       }else if(!inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]){\r
-                               if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]))\r
+                       }else if(!gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down]){\r
+                               if((gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right]))\r
                                        mx = motion_Left;\r
-                               if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left]))\r
+                               if((gvar->in.Keyboard[def->right] && !gvar->in.Keyboard[def->left]))\r
                                        mx = motion_Right;\r
                        }else{  //2 keys pressed\r
                                        switch (player[pn].pdir)\r
                                        {\r
                                                case 0:\r
                                                case 4:\r
-                                                       if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right])){ dir = DirTable[1]; }//mx = motion_Left; }\r
-                                                       else if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left])){ dir = DirTable[3]; }//mx = motion_Right; }\r
+                                                       if((gvar->in.Keyboard[def->left] && !gvar->in.Keyboard[def->right])){ dir = DirTable[1]; }//mx = motion_Left; }\r
+                                                       else if((gvar->in.Keyboard[def->right] && !gvar->in.Keyboard[def->left])){ dir = DirTable[3]; }//mx = motion_Right; }\r
                                                break;\r
                                                case 1:\r
                                                case 3:\r
-                                                       if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])){ dir = DirTable[0]; }//my = motion_Up; }\r
-                                                       else if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up])){ dir = DirTable[4]; }//my = motion_Down; }\r
+                                                       if((gvar->in.Keyboard[def->up] && !gvar->in.Keyboard[def->down])){ dir = DirTable[0]; }//my = motion_Up; }\r
+                                                       else if((gvar->in.Keyboard[def->down] && !gvar->in.Keyboard[def->up])){ dir = DirTable[4]; }//my = motion_Down; }\r
                                                break;\r
                                                default:\r
                                                break;\r
@@ -897,15 +890,15 @@ register  KeyboardDef     *def;
                                }\r
                        }\r
                        //input from player\r
-                       if (inpu.Keyboard[def->button0])\r
+                       if (gvar->in.Keyboard[def->button0])\r
                                buttons += 1 << 0;\r
-                       if (inpu.Keyboard[def->button1])\r
+                       if (gvar->in.Keyboard[def->button1])\r
                                buttons += 1 << 1;\r
                        realdelta = false;\r
                        break;\r
                case ctrl_Joystick1:\r
                case ctrl_Joystick2:\r
-                       INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy,false);\r
+                       INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy,false, gvar);\r
                        buttons = INL_GetJoyButtons(type - ctrl_Joystick);\r
                        realdelta = true;\r
                        break;\r
@@ -976,14 +969,14 @@ register  KeyboardDef     *def;
 #endif\r
 #ifdef __DEBUG_InputMgr__\r
 if(dbg_testcontrolnoisy > 0)\r
-if(player[pn].info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])*/ || player[pn].enti.q>1)\r
+if(player[pn].info.dir!=2/*(gvar->in.Keyboard[def->up] || gvar->in.Keyboard[def->down] || gvar->in.Keyboard[def->left] || gvar->in.Keyboard[def->right])*/ || player[pn].enti.q>1)\r
 {\r
        //printf("b1=%u b2=%u b3=%u b4=%u       ", player[pn].info.button0, player[pn].info.button1, player[pn].info.button2, player[pn].info.button3);\r
        //printf("q=%d ", player[pn].enti.q);\r
        //printf("cpee=%c ", dirchar(conpee));\r
        printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].enti.d), dirchar(player[pn].info.dir));\r
        /*if(realdelta) */printf("dx=%d dy=%d   mx=%d   my=%d", player[pn].info.x, player[pn].info.y, player[pn].info.xaxis, player[pn].info.yaxis);\r
-       //else if(!realdelta) printf("%c%d %c%d %c%d %c%d", dirchar(0), inpu.Keyboard[def->up], dirchar(4), inpu.Keyboard[def->down], dirchar(1), inpu.Keyboard[def->left], dirchar(3), inpu.Keyboard[def->right]);\r
+       //else if(!realdelta) printf("%c%d %c%d %c%d %c%d", dirchar(0), gvar->in.Keyboard[def->up], dirchar(4), gvar->in.Keyboard[def->down], dirchar(1), gvar->in.Keyboard[def->left], dirchar(3), gvar->in.Keyboard[def->right]);\r
        printf("\n");\r
 }\r
 #endif\r
@@ -1092,13 +1085,13 @@ IN_GetScanName(ScanCode scan)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 ScanCode\r
-IN_WaitForKey()\r
+IN_WaitForKey(global_game_variables_t *gvar)\r
 {\r
        ScanCode        result;\r
 \r
-       while (!(result = inpu.LastScan))\r
+       while (!(result = gvar->in.LastScan))\r
                ;\r
-       inpu.LastScan = 0;\r
+       gvar->in.LastScan = 0;\r
        return(result);\r
 }\r
 \r
@@ -1109,13 +1102,13 @@ IN_WaitForKey()
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 char\r
-IN_WaitForASCII()\r
+IN_WaitForASCII(global_game_variables_t *gvar)\r
 {\r
        char            result;\r
 \r
-       while (!(result = inpu.LastASCII))\r
+       while (!(result = gvar->in.LastASCII))\r
                ;\r
-       inpu.LastASCII = '\0';\r
+       gvar->in.LastASCII = '\0';\r
        return(result);\r
 }\r
 \r
@@ -1125,13 +1118,13 @@ IN_WaitForASCII()
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_AckBack()\r
+IN_AckBack(global_game_variables_t *gvar)\r
 {\r
        word    i;\r
 \r
-       while (!inpu.LastScan)\r
+       while (!gvar->in.LastScan)\r
        {\r
-               if (inpu.MousePresent)\r
+               if (gvar->in.MousePresent)\r
                {\r
                        if (INL_GetMouseButtons())\r
                        {\r
@@ -1143,11 +1136,11 @@ IN_AckBack()
 \r
                for (i = 0;i < MaxJoys;i++)\r
                {\r
-                       if (inpu.JoysPresent[i])\r
+                       if (gvar->in.JoysPresent[i])\r
                        {\r
-                               if (IN_GetJoyButtonsDB(i))\r
+                               if (IN_GetJoyButtonsDB(i, gvar))\r
                                {\r
-                                       while (IN_GetJoyButtonsDB(i))\r
+                                       while (IN_GetJoyButtonsDB(i, gvar))\r
                                                ;\r
                                        return;\r
                                }\r
@@ -1155,8 +1148,8 @@ IN_AckBack()
                }\r
        }\r
 \r
-       IN_ClearKey(inpu.LastScan);\r
-       inpu.LastScan = sc_None;\r
+       IN_ClearKey(gvar->in.LastScan, gvar);\r
+       gvar->in.LastScan = sc_None;\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -1165,25 +1158,25 @@ IN_AckBack()
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 void\r
-IN_Ack()\r
+IN_Ack(global_game_variables_t *gvar)\r
 {\r
        word    i;\r
 \r
-       if (!inst.IN_Started)\r
+       if (!gvar->in.IN_Started)\r
                return;\r
 \r
-       IN_ClearKey(inpu.LastScan);\r
-       inpu.LastScan = sc_None;\r
+       IN_ClearKey(gvar->in.LastScan, gvar);\r
+       gvar->in.LastScan = sc_None;\r
 \r
-       if (inpu.MousePresent)\r
+       if (gvar->in.MousePresent)\r
                while (INL_GetMouseButtons())\r
                                        ;\r
        for (i = 0;i < MaxJoys;i++)\r
-               if (inpu.JoysPresent[i])\r
-                       while (IN_GetJoyButtonsDB(i))\r
+               if (gvar->in.JoysPresent[i])\r
+                       while (IN_GetJoyButtonsDB(i, gvar))\r
                                ;\r
 \r
-       IN_AckBack();\r
+       IN_AckBack(gvar);\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -1193,19 +1186,19 @@ IN_Ack()
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 boolean\r
-IN_IsUserInput()\r
+IN_IsUserInput(global_game_variables_t *gvar)\r
 {\r
        boolean result;\r
        word    i;\r
 \r
-       result = inpu.LastScan;\r
+       result = gvar->in.LastScan;\r
 \r
-       if (inpu.MousePresent)\r
+       if (gvar->in.MousePresent)\r
                if (INL_GetMouseButtons())\r
                        result = true;\r
 \r
        for (i = 0;i < MaxJoys;i++)\r
-               if (inpu.JoysPresent[i])\r
+               if (gvar->in.JoysPresent[i])\r
                        if (INL_GetJoyButtons(i))\r
                                result = true;\r
 \r
@@ -1221,18 +1214,18 @@ IN_IsUserInput()
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 boolean\r
-IN_UserInput(dword delay,boolean clear)\r
+IN_UserInput(dword delay,boolean clear, global_game_variables_t *gvar)\r
 {\r
-       word TimeCount = *clockw;\r
+       word TimeCount = gvar->kurokku.clock_start;\r
        word    lasttime;\r
 \r
        lasttime = TimeCount;\r
        do\r
        {\r
-               if (IN_IsUserInput())\r
+               if (IN_IsUserInput(gvar))\r
                {\r
                        if (clear)\r
-                               IN_AckBack();\r
+                               IN_AckBack(gvar);\r
                        return(true);\r
                }\r
        } while (TimeCount - lasttime < delay);\r
@@ -1249,10 +1242,10 @@ IN_UserInput(dword delay,boolean clear)
 ===================\r
 */\r
 \r
-byte   IN_MouseButtons (void)\r
+byte   IN_MouseButtons (global_game_variables_t *gvar)\r
 {\r
        union REGS CPURegs;\r
-       if (inpu.MousePresent)\r
+       if (gvar->in.MousePresent)\r
        {\r
                Mouse(MButtons);\r
                return CPURegs.x.bx;\r
@@ -1281,12 +1274,12 @@ byte    IN_JoyButtons (void)
        return joybits;\r
 }\r
 \r
-boolean IN_KeyDown(byte code)\r
+boolean IN_KeyDown(byte code, global_game_variables_t *gvar)\r
 {\r
 #ifdef __DEBUG_InputMgr__\r
        if(!dbg_nointest)\r
 #endif\r
-       return inpu.Keyboard[code];\r
+       return gvar->in.Keyboard[code];\r
 #ifdef __DEBUG_InputMgr__\r
        else\r
                if(dbg_nointest && kbhit())\r
@@ -1296,28 +1289,28 @@ boolean IN_KeyDown(byte code)
 #endif\r
 }\r
 \r
-void IN_ClearKey(byte code)\r
+void IN_ClearKey(byte code, global_game_variables_t *gvar)\r
 {\r
-       inpu.Keyboard[code] = false;\r
-       if(code == inpu.LastScan)\r
-               inpu.LastScan = sc_None;\r
+       gvar->in.Keyboard[code] = false;\r
+       if(code == gvar->in.LastScan)\r
+               gvar->in.LastScan = sc_None;\r
        }\r
 \r
-boolean IN_qb(byte kee)\r
+boolean IN_qb(byte kee, global_game_variables_t *gvar)\r
 {\r
 #ifdef __DEBUG_InputMgr__\r
-       if(dbg_testkeyin) printf("%u\n", inpu.Keyboard[kee]);\r
+       if(dbg_testkeyin) printf("%u\n", gvar->in.Keyboard[kee]);\r
 #endif\r
-       if(inpu.Keyboard[kee]==true) return 1;\r
+       if(gvar->in.Keyboard[kee]==true) return 1;\r
        else return 0;\r
 }\r
 \r
-ScanCode IN_GetLastScan()\r
+ScanCode IN_GetLastScan(global_game_variables_t *gvar)\r
 {\r
-       return inpu.LastScan;\r
+       return gvar->in.LastScan;\r
 }\r
 \r
-ScanCode IN_GetCurCode()\r
+ScanCode IN_GetCurCode(global_game_variables_t *gvar)\r
 {\r
-       return inst.CurCode;\r
+       return gvar->in.CurCode;\r
 }\r
index 39519c2..f84b3a4 100755 (executable)
@@ -202,37 +202,7 @@ typedef    struct          {
                                                                        joyMaxX,joyMaxY,\r
                                                                        joyMultXL,joyMultYL,\r
                                                                        joyMultXH,joyMultYH;\r
-                                       } JoystickDef;\r
-\r
-typedef        struct\r
-{\r
-       int x; //player exact position on the viewable map\r
-       int y; //player exact position on the viewable map\r
-       int tx; //player tile position on the viewable map\r
-       int ty; //player tile position on the viewable map\r
-       int triggerx; //player's trigger box tile position on the viewable map\r
-       int triggery; //player's trigger box tile position on the viewable map\r
-       int sheetsetx; //NOT USED YET! player sprite sheet set on the image x\r
-       int sheetsety; //NOT USED YET! player sprite sheet set on the image y\r
-       byte d;         //direction to render sprite!! wwww\r
-       byte q;         //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www\r
-       byte near pdir; //previous direction~\r
-       word speed;             //player speed!\r
-       word spt;               //speed per tile\r
-#ifdef __WATCOMC__\r
-       struct sprite   *spri;  //supposively the sprite sheet data\r
-       memptr          gr;\r
-       entity_t                *ent;\r
-#endif\r
-       bitmap_t        *data;          //supposively the sprite sheet data//old format\r
-       bitmap_t        bmp;\r
-       sword hp; //hitpoints of the player\r
-       int persist_aniframe;    // gonna be increased to 1 before being used, so 0 is ok for default\r
-       CursorInfo      info;\r
-       ControlType     Controls;\r
-//newer vars\r
-       int dx, dy, delta;      //TODO: what is this? ^^\r
-} player_t;*/\r
+                                       } JoystickDef;*/\r
 \r
 /*\r
 =============================================================================\r
@@ -241,19 +211,6 @@ typedef    struct
 \r
 =============================================================================\r
 */\r
-/*extern struct inconfig\r
-{\r
-       boolean                 MousePresent;\r
-       boolean                 JoysPresent[MaxJoys];\r
-       boolean         Keyboard[NumCodes];\r
-       boolean         Paused;\r
-       char            LastASCII;\r
-       ScanCode        LastScan;\r
-\r
-       KeyboardDef     KbdDefs[MaxKbds];\r
-       JoystickDef     JoyDefs[MaxJoys];\r
-} inpu;*/\r
-\r
 #ifdef DEMO0\r
                static Demo             DemoMode = demo_Off;\r
                static byte /*_seg*/    *DemoBuffer;\r
@@ -261,48 +218,48 @@ typedef   struct
 #endif\r
 \r
 //     Internal routines\r
-extern void interrupt INL_KeyService();\r
-extern void Mouse(int x);\r
+//void interrupt INL_KeyService(global_game_variables_t *gvar);\r
+void Mouse(int x);\r
 //static void INL_GetMouseDelta(int *x,int *y);\r
 //static word INL_GetMouseButtons(void);\r
-extern void IN_GetJoyAbs(word joy,word *xp,word *yp);\r
+void IN_GetJoyAbs(word joy,word *xp,word *yp);\r
 //static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);\r
 //static word INL_GetJoyButtons(word joy);\r
-extern word IN_GetJoyButtonsDB(word joy);\r
+word IN_GetJoyButtonsDB(word joy, global_game_variables_t *gvar);\r
 //static void INL_StartKbd(void);\r
 //static void INL_ShutKbd(void);\r
 //static boolean INL_StartMouse(void);\r
 //static void INL_ShutMouse(void);\r
 //static void INL_SetJoyScale(word joy);\r
-extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);\r
+void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy, global_game_variables_t *gvar);\r
 //static boolean INL_StartJoy(word joy);\r
 //static void INL_ShutJoy(word joy);\r
-extern void IN_Startup();\r
-extern void IN_Default(boolean gotit,player_t *player,ControlType nt);\r
-extern void IN_Shutdown();\r
-extern void IN_SetKeyHook(void (*hook)());\r
-extern void IN_ClearKeysDown();\r
+void IN_Startup(global_game_variables_t *gvar);\r
+void IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar);\r
+void IN_Shutdown(global_game_variables_t *gvar);\r
+void IN_SetKeyHook(void (*hook)());\r
+void IN_ClearKeysDown(global_game_variables_t *gvar);\r
 //static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);\r
-extern void IN_ReadCursor(CursorInfo *info);\r
-extern void near IN_ReadControl(word pn, player_t *player);\r
-extern void IN_SetControlType(word pn,player_t *player,ControlType type);\r
+void IN_ReadCursor(CursorInfo *info, global_game_variables_t *gvar);\r
+void near IN_ReadControl(word pn, player_t *player, global_game_variables_t *gvar);\r
+void IN_SetControlType(word pn,player_t *player,ControlType type);\r
 #if DEMO0\r
-extern boolean IN_StartDemoRecord(word bufsize);\r
-extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
-extern void IN_StopDemo(void);\r
-extern void IN_FreeDemoBuffer(void);\r
+boolean IN_StartDemoRecord(word bufsize);\r
+void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
+void IN_StopDemo(void);\r
+void IN_FreeDemoBuffer(void);\r
 #endif\r
-extern byte *IN_GetScanName(ScanCode scan);\r
-extern ScanCode IN_WaitForKey();\r
-extern char IN_WaitForASCII();\r
-extern void IN_AckBack();\r
-extern void IN_Ack();\r
-extern boolean IN_IsUserInput();\r
-extern boolean IN_UserInput(dword delay,boolean clear);\r
-extern boolean IN_KeyDown(byte code);\r
-extern void IN_ClearKey(byte code);\r
-extern boolean IN_qb(byte kee);\r
-extern ScanCode IN_GetLastScan();\r
-extern ScanCode IN_GetCurCode();\r
+byte *IN_GetScanName(ScanCode scan);\r
+ScanCode IN_WaitForKey(global_game_variables_t *gvar);\r
+char IN_WaitForASCII(global_game_variables_t *gvar);\r
+void IN_AckBack(global_game_variables_t *gvar);\r
+void IN_Ack(global_game_variables_t *gvar);\r
+boolean IN_IsUserInput(global_game_variables_t *gvar);\r
+boolean IN_UserInput(dword delay,boolean clear, global_game_variables_t *gvar);\r
+boolean IN_KeyDown(byte code, global_game_variables_t *gvar);\r
+void IN_ClearKey(byte code, global_game_variables_t *gvar);\r
+boolean IN_qb(byte kee, global_game_variables_t *gvar);\r
+ScanCode IN_GetLastScan(global_game_variables_t *gvar);\r
+ScanCode IN_GetCurCode(global_game_variables_t *gvar);\r
 \r
 #endif\r
diff --git a/src/lib/16_in__.c b/src/lib/16_in__.c
new file mode 100755 (executable)
index 0000000..2534af7
--- /dev/null
@@ -0,0 +1,991 @@
+//\r
+//     ID Engine\r
+//     ID_IN.c - Input Manager\r
+//     v1.0d1w\r
+//     By Jason Blochowiak\r
+//     Open Watcom port by sparky4\r
+//\r
+\r
+//\r
+//     This module handles dealing with the various input devices\r
+//\r
+//     Depends on: Memory Mgr (for demo recording), Sound Mgr (for timing stuff),\r
+//                             User Mgr (for command line parms)\r
+//\r
+//     Globals:\r
+//             LastScan - The keyboard scan code of the last key pressed\r
+//             LastASCII - The ASCII value of the last key pressed\r
+//     DEBUG - there are more globals\r
+//\r
+\r
+#include "src/lib/16_in__.h"\r
+#pragma        hdrstop\r
+\r
+#define        KeyInt          9       // The keyboard ISR number\r
+\r
+//\r
+// mouse constants\r
+//\r
+#define        MReset          0\r
+#define        MButtons        3\r
+#define        MDelta          11\r
+\r
+#define        MouseInt        0x33\r
+#define        Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
+\r
+//\r
+// joystick constants\r
+//\r
+#define        JoyScaleMax             32768\r
+#define        JoyScaleShift   8\r
+#define        MaxJoyValue             5000\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+//\r
+// configuration variables\r
+//\r
+boolean                        MousePresent;\r
+boolean                        JoysPresent[MaxJoys];\r
+boolean                        JoyPadPresent;\r
+\r
+\r
+//     Global variables\r
+               boolean         Keyboard[NumCodes];\r
+               boolean         Paused;\r
+               char            LastASCII;\r
+               ScanCode        LastScan;\r
+\r
+               KeyboardDef     KbdDefs = {{0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51}};\r
+               JoystickDef     JoyDefs[MaxJoys];\r
+               ControlType     Controls[MaxPlayers];\r
+\r
+               dword   MouseDownCount;\r
+\r
+               Demo            DemoMode = demo_Off;\r
+               byte _seg       *DemoBuffer;\r
+               word            DemoOffset,DemoSize;\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+static byte        far ASCIINames[] =          // Unshifted ASCII for scan codes\r
+                                       {\r
+//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
+       0  ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8  ,9  ,        // 0\r
+       'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0  ,'a','s',        // 1\r
+       'd','f','g','h','j','k','l',';',39 ,'`',0  ,92 ,'z','x','c','v',        // 2\r
+       'b','n','m',',','.','/',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',        // 4\r
+       '2','3','0',127,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
+                                       },\r
+                                       far ShiftNames[] =              // Shifted ASCII for scan codes\r
+                                       {\r
+//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
+       0  ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',8  ,9  ,        // 0\r
+       'Q','W','E','R','T','Y','U','I','O','P','{','}',13 ,0  ,'A','S',        // 1\r
+       'D','F','G','H','J','K','L',':',34 ,'~',0  ,'|','Z','X','C','V',        // 2\r
+       'B','N','M','<','>','?',0  ,'*',0  ,' ',0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,'7','8','9','-','4','5','6','+','1',        // 4\r
+       '2','3','0',127,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
+                                       },\r
+                                       far SpecialNames[] =    // ASCII for 0xe0 prefixed codes\r
+                                       {\r
+//      0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 0\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,13 ,0  ,0  ,0  ,        // 1\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 2\r
+       0  ,0  ,0  ,0  ,0  ,'/',0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 3\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 4\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 5\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,        // 6\r
+       0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0  ,0           // 7\r
+                                       };\r
+\r
+\r
+static boolean         IN_Started;\r
+static boolean         CapsLock;\r
+static ScanCode        CurCode,LastCode;\r
+\r
+static Direction       DirTable[] =            // Quick lookup for total direction\r
+                                       {\r
+                                               dir_NorthWest,  dir_North,      dir_NorthEast,\r
+                                               dir_West,               dir_None,       dir_East,\r
+                                               dir_SouthWest,  dir_South,      dir_SouthEast\r
+                                       };\r
+\r
+static void                    (*INL_KeyHook)(void);\r
+static void interrupt  (*OldKeyVect)(void);\r
+\r
+static char                    *ParmStrings[] = {"nojoys","nomouse",nil};\r
+\r
+//     Internal routines\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_KeyService() - Handles a keyboard interrupt (key up/down)\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void interrupt\r
+INL_KeyService(void)\r
+{\r
+static boolean special;\r
+               byte    k,c,\r
+                               temp;\r
+               int             i;\r
+\r
+       k = inp(0x60);  // Get the scan code\r
+\r
+       // Tell the XT keyboard controller to clear the key\r
+       outportb(0x61,(temp = inp(0x61)) | 0x80);\r
+       outportb(0x61,temp);\r
+\r
+       if (k == 0xe0)          // Special key prefix\r
+               special = true;\r
+       else if (k == 0xe1)     // Handle Pause key\r
+               Paused = true;\r
+       else\r
+       {\r
+               if (k & 0x80)   // Break code\r
+               {\r
+                       k &= 0x7f;\r
+\r
+// DEBUG - handle special keys: ctl-alt-delete, print scrn\r
+\r
+                       Keyboard[k] = false;\r
+               }\r
+               else                    // Make code\r
+               {\r
+                       LastCode = CurCode;\r
+                       CurCode = LastScan = k;\r
+                       Keyboard[k] = true;\r
+\r
+                       if (special)\r
+                               c = SpecialNames[k];\r
+                       else\r
+                       {\r
+                               if (k == sc_CapsLock)\r
+                               {\r
+                                       CapsLock ^= true;\r
+                                       // DEBUG - make caps lock light work\r
+                               }\r
+\r
+                               if (Keyboard[sc_LShift] || Keyboard[sc_RShift]) // If shifted\r
+                               {\r
+                                       c = ShiftNames[k];\r
+                                       if ((c >= 'A') && (c <= 'Z') && CapsLock)\r
+                                               c += 'a' - 'A';\r
+                               }\r
+                               else\r
+                               {\r
+                                       c = ASCIINames[k];\r
+                                       if ((c >= 'a') && (c <= 'z') && CapsLock)\r
+                                               c -= 'a' - 'A';\r
+                               }\r
+                       }\r
+                       if (c)\r
+                               LastASCII = c;\r
+               }\r
+\r
+               special = false;\r
+       }\r
+\r
+       if (INL_KeyHook && !special)\r
+               INL_KeyHook();\r
+       outportb(0x20,0x20);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_GetMouseDelta() - Gets the amount that the mouse has moved from the\r
+//             mouse driver\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_GetMouseDelta(int *x,int *y)\r
+{\r
+       Mouse(MDelta);\r
+       *x = _CX;\r
+       *y = _DX;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_GetMouseButtons() - Gets the status of the mouse buttons from the\r
+//             mouse driver\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static word\r
+INL_GetMouseButtons(void)\r
+{\r
+       word    buttons;\r
+\r
+       Mouse(MButtons);\r
+       buttons = _BX;\r
+       return(buttons);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_GetJoyAbs() - Reads the absolute position of the specified joystick\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_GetJoyAbs(word joy,word *xp,word *yp)\r
+{\r
+       byte    xb,yb,\r
+                       xs,ys;\r
+       word    x,y;\r
+\r
+       x = y = 0;\r
+       xs = joy? 2 : 0;                // Find shift value for x axis\r
+       xb = 1 << xs;                   // Use shift value to get x bit mask\r
+       ys = joy? 3 : 1;                // Do the same for y axis\r
+       yb = 1 << ys;\r
+\r
+// Read the absolute joystick values\r
+asm            pushf                           // Save some registers\r
+asm            push    si\r
+asm            push    di\r
+asm            cli                                     // Make sure an interrupt doesn't screw the timings\r
+\r
+\r
+asm            mov             dx,0x201\r
+asm            in              al,dx\r
+asm            out             dx,al           // Clear the resistors\r
+\r
+asm            mov             ah,[xb]         // Get masks into registers\r
+asm            mov             ch,[yb]\r
+\r
+asm            xor             si,si           // Clear count registers\r
+asm            xor             di,di\r
+asm            xor             bh,bh           // Clear high byte of bx for later\r
+\r
+asm            push    bp                      // Don't mess up stack frame\r
+asm            mov             bp,MaxJoyValue\r
+\r
+loop:\r
+asm            in              al,dx           // Get bits indicating whether all are finished\r
+\r
+asm            dec             bp                      // Check bounding register\r
+asm            jz              done            // We have a silly value - abort\r
+\r
+asm            mov             bl,al           // Duplicate the bits\r
+asm            and             bl,ah           // Mask off useless bits (in [xb])\r
+asm            add             si,bx           // Possibly increment count register\r
+asm            mov             cl,bl           // Save for testing later\r
+\r
+asm            mov             bl,al\r
+asm            and             bl,ch           // [yb]\r
+asm            add             di,bx\r
+\r
+asm            add             cl,bl\r
+asm            jnz             loop            // If both bits were 0, drop out\r
+\r
+done:\r
+asm     pop            bp\r
+\r
+asm            mov             cl,[xs]         // Get the number of bits to shift\r
+asm            shr             si,cl           //  and shift the count that many times\r
+\r
+asm            mov             cl,[ys]\r
+asm            shr             di,cl\r
+\r
+asm            mov             [x],si          // Store the values into the variables\r
+asm            mov             [y],di\r
+\r
+asm            pop             di\r
+asm            pop             si\r
+asm            popf                            // Restore the registers\r
+\r
+       *xp = x;\r
+       *yp = y;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_GetJoyDelta() - Returns the relative movement of the specified\r
+//             joystick (from +/-127)\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void INL_GetJoyDelta(word joy,int *dx,int *dy)\r
+{\r
+       word            x,y;\r
+       dword   time;\r
+       JoystickDef     *def;\r
+static dword   lasttime;\r
+\r
+       IN_GetJoyAbs(joy,&x,&y);\r
+       def = JoyDefs + joy;\r
+\r
+       if (x < def->threshMinX)\r
+       {\r
+               if (x < def->joyMinX)\r
+                       x = def->joyMinX;\r
+\r
+               x = -(x - def->threshMinX);\r
+               x *= def->joyMultXL;\r
+               x >>= JoyScaleShift;\r
+               *dx = (x > 127)? -127 : -x;\r
+       }\r
+       else if (x > def->threshMaxX)\r
+       {\r
+               if (x > def->joyMaxX)\r
+                       x = def->joyMaxX;\r
+\r
+               x = x - def->threshMaxX;\r
+               x *= def->joyMultXH;\r
+               x >>= JoyScaleShift;\r
+               *dx = (x > 127)? 127 : x;\r
+       }\r
+       else\r
+               *dx = 0;\r
+\r
+       if (y < def->threshMinY)\r
+       {\r
+               if (y < def->joyMinY)\r
+                       y = def->joyMinY;\r
+\r
+               y = -(y - def->threshMinY);\r
+               y *= def->joyMultYL;\r
+               y >>= JoyScaleShift;\r
+               *dy = (y > 127)? -127 : -y;\r
+       }\r
+       else if (y > def->threshMaxY)\r
+       {\r
+               if (y > def->joyMaxY)\r
+                       y = def->joyMaxY;\r
+\r
+               y = y - def->threshMaxY;\r
+               y *= def->joyMultYH;\r
+               y >>= JoyScaleShift;\r
+               *dy = (y > 127)? 127 : y;\r
+       }\r
+       else\r
+               *dy = 0;\r
+\r
+       lasttime = TimeCount;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_GetJoyButtons() - Returns the button status of the specified\r
+//             joystick\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static word\r
+INL_GetJoyButtons(word joy)\r
+{\r
+register       word    result;\r
+\r
+       result = inp(0x201);    // Get all the joystick buttons\r
+       result >>= joy? 6 : 4;  // Shift into bits 0-1\r
+       result &= 3;                            // Mask off the useless bits\r
+       result ^= 3;\r
+       return(result);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_GetJoyButtonsDB() - Returns the de-bounced button status of the\r
+//             specified joystick\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+word\r
+IN_GetJoyButtonsDB(word joy)\r
+{\r
+       dword   lasttime;\r
+       word            result1,result2;\r
+\r
+       do\r
+       {\r
+               result1 = INL_GetJoyButtons(joy);\r
+               lasttime = TimeCount;\r
+               while (TimeCount == lasttime)\r
+                       ;\r
+               result2 = INL_GetJoyButtons(joy);\r
+       } while (result1 != result2);\r
+       return(result1);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_StartKbd() - Sets up my keyboard stuff for use\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_StartKbd(void)\r
+{\r
+       INL_KeyHook = NULL;                     // no key hook routine\r
+\r
+       IN_ClearKeysDown();\r
+\r
+       OldKeyVect = getvect(KeyInt);\r
+       setvect(KeyInt,INL_KeyService);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_ShutKbd() - Restores keyboard control to the BIOS\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_ShutKbd(void)\r
+{\r
+       poke(0x40,0x17,peek(0x40,0x17) & 0xfaf0);       // Clear ctrl/alt/shift flags\r
+\r
+       setvect(KeyInt,OldKeyVect);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_StartMouse() - Detects and sets up the mouse\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+INL_StartMouse(void)\r
+{\r
+#if 0\r
+       if (getvect(MouseInt))\r
+       {\r
+               Mouse(MReset);\r
+               if (_AX == 0xffff)\r
+                       return(true);\r
+       }\r
+       return(false);\r
+#endif\r
+ union REGS regs;\r
+ unsigned char far *vector;\r
+\r
+\r
+ if ((vector=MK_FP(peek(0,0x33*4+2),peek(0,0x33*4)))==NULL)\r
+   return false;\r
+\r
+ if (*vector == 207)\r
+   return false;\r
+\r
+ Mouse(MReset);\r
+ return true;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_ShutMouse() - Cleans up after the mouse\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_ShutMouse(void)\r
+{\r
+}\r
+\r
+//\r
+//     INL_SetJoyScale() - Sets up scaling values for the specified joystick\r
+//\r
+static void\r
+INL_SetJoyScale(word joy)\r
+{\r
+       JoystickDef     *def;\r
+\r
+       def = &JoyDefs[joy];\r
+       def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX);\r
+       def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX);\r
+       def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY);\r
+       def->joyMultYH = JoyScaleMax / (def->joyMaxY - def->threshMaxY);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale()\r
+//             to set up scaling values\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)\r
+{\r
+       word            d,r;\r
+       JoystickDef     *def;\r
+\r
+       def = &JoyDefs[joy];\r
+\r
+       def->joyMinX = minx;\r
+       def->joyMaxX = maxx;\r
+       r = maxx - minx;\r
+       d = r / 3;\r
+       def->threshMinX = ((r / 2) - d) + minx;\r
+       def->threshMaxX = ((r / 2) + d) + minx;\r
+\r
+       def->joyMinY = miny;\r
+       def->joyMaxY = maxy;\r
+       r = maxy - miny;\r
+       d = r / 3;\r
+       def->threshMinY = ((r / 2) - d) + miny;\r
+       def->threshMaxY = ((r / 2) + d) + miny;\r
+\r
+       INL_SetJoyScale(joy);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_StartJoy() - Detects & auto-configures the specified joystick\r
+//                                     The auto-config assumes the joystick is centered\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static boolean\r
+INL_StartJoy(word joy)\r
+{\r
+       word            x,y;\r
+\r
+       IN_GetJoyAbs(joy,&x,&y);\r
+\r
+       if\r
+       (\r
+               ((x == 0) || (x > MaxJoyValue - 10))\r
+       ||      ((y == 0) || (y > MaxJoyValue - 10))\r
+       )\r
+               return(false);\r
+       else\r
+       {\r
+               IN_SetupJoy(joy,0,x * 2,0,y * 2);\r
+               return(true);\r
+       }\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     INL_ShutJoy() - Cleans up the joystick stuff\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+static void\r
+INL_ShutJoy(word joy)\r
+{\r
+       JoysPresent[joy] = false;\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_Startup() - Starts up the Input Mgr\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_Startup(void)\r
+{\r
+       boolean checkjoys,checkmouse;\r
+       word    i;\r
+\r
+       if (IN_Started)\r
+               return;\r
+\r
+       checkjoys = true;\r
+       checkmouse = true;\r
+       for (i = 1;i < _argc;i++)\r
+       {\r
+               switch (US_CheckParm(_argv[i],ParmStrings))\r
+               {\r
+               case 0:\r
+                       checkjoys = false;\r
+                       break;\r
+               case 1:\r
+                       checkmouse = false;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       INL_StartKbd();\r
+       MousePresent = checkmouse? INL_StartMouse() : false;\r
+\r
+       for (i = 0;i < MaxJoys;i++)\r
+               JoysPresent[i] = checkjoys? INL_StartJoy(i) : false;\r
+\r
+       IN_Started = true;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_Default() - Sets up default conditions for the Input Mgr\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_Default(boolean gotit,ControlType in)\r
+{\r
+       if\r
+       (\r
+               (!gotit)\r
+       ||      ((in == ctrl_Joystick1) && !JoysPresent[0])\r
+       ||      ((in == ctrl_Joystick2) && !JoysPresent[1])\r
+       ||      ((in == ctrl_Mouse) && !MousePresent)\r
+       )\r
+               in = ctrl_Keyboard1;\r
+       IN_SetControlType(0,in);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_Shutdown() - Shuts down the Input Mgr\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_Shutdown(void)\r
+{\r
+       word    i;\r
+\r
+       if (!IN_Started)\r
+               return;\r
+\r
+       INL_ShutMouse();\r
+       for (i = 0;i < MaxJoys;i++)\r
+               INL_ShutJoy(i);\r
+       INL_ShutKbd();\r
+\r
+       IN_Started = false;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_SetKeyHook() - Sets the routine that gets called by INL_KeyService()\r
+//                     everytime a real make/break code gets hit\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_SetKeyHook(void (*hook)())\r
+{\r
+       INL_KeyHook = hook;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_ClearKeysDown() - Clears the keyboard array\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_ClearKeysDown(void)\r
+{\r
+       int     i;\r
+\r
+       LastScan = sc_None;\r
+       LastASCII = key_None;\r
+       memset (Keyboard,0,sizeof(Keyboard));\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_ReadControl() - Reads the device associated with the specified\r
+//             player and fills in the control info struct\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_ReadControl(int player,CursorInfo *info)\r
+{\r
+                       boolean         realdelta;\r
+                       byte            dbyte;\r
+                       word            buttons;\r
+                       int                     dx,dy;\r
+                       Motion          mx,my;\r
+                       ControlType     type;\r
+register       KeyboardDef     *def;\r
+\r
+       dx = dy = 0;\r
+       mx = my = motion_None;\r
+       buttons = 0;\r
+\r
+       if (DemoMode == demo_Playback)\r
+       {\r
+               dbyte = DemoBuffer[DemoOffset + 1];\r
+               my = (dbyte & 3) - 1;\r
+               mx = ((dbyte >> 2) & 3) - 1;\r
+               buttons = (dbyte >> 4) & 3;\r
+\r
+               if (!(--DemoBuffer[DemoOffset]))\r
+               {\r
+                       DemoOffset += 2;\r
+                       if (DemoOffset >= DemoSize)\r
+                               DemoMode = demo_PlayDone;\r
+               }\r
+\r
+               realdelta = false;\r
+       }\r
+       else if (DemoMode == demo_PlayDone)\r
+               Quit("Demo playback exceeded");\r
+       else\r
+       {\r
+               switch (type = Controls[player])\r
+               {\r
+               case ctrl_Keyboard:\r
+                       def = &KbdDefs;\r
+\r
+                       if (Keyboard[def->upleft])\r
+                               mx = motion_Left,my = motion_Up;\r
+                       else if (Keyboard[def->upright])\r
+                               mx = motion_Right,my = motion_Up;\r
+                       else if (Keyboard[def->downleft])\r
+                               mx = motion_Left,my = motion_Down;\r
+                       else if (Keyboard[def->downright])\r
+                               mx = motion_Right,my = motion_Down;\r
+\r
+                       if (Keyboard[def->up])\r
+                               my = motion_Up;\r
+                       else if (Keyboard[def->down])\r
+                               my = motion_Down;\r
+\r
+                       if (Keyboard[def->left])\r
+                               mx = motion_Left;\r
+                       else if (Keyboard[def->right])\r
+                               mx = motion_Right;\r
+\r
+                       if (Keyboard[def->button0])\r
+                               buttons += 1 << 0;\r
+                       if (Keyboard[def->button1])\r
+                               buttons += 1 << 1;\r
+                       realdelta = false;\r
+                       break;\r
+               case ctrl_Joystick1:\r
+               case ctrl_Joystick2:\r
+                       INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy);\r
+                       buttons = INL_GetJoyButtons(type - ctrl_Joystick);\r
+                       realdelta = true;\r
+                       break;\r
+               case ctrl_Mouse:\r
+                       INL_GetMouseDelta(&dx,&dy);\r
+                       buttons = INL_GetMouseButtons();\r
+                       realdelta = true;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       if (realdelta)\r
+       {\r
+               mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None);\r
+               my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None);\r
+       }\r
+       else\r
+       {\r
+               dx = mx * 127;\r
+               dy = my * 127;\r
+       }\r
+\r
+       info->x = dx;\r
+       info->xaxis = mx;\r
+       info->y = dy;\r
+       info->yaxis = my;\r
+       info->button0 = buttons & (1 << 0);\r
+       info->button1 = buttons & (1 << 1);\r
+       info->button2 = buttons & (1 << 2);\r
+       info->button3 = buttons & (1 << 3);\r
+       info->dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
+\r
+       if (DemoMode == demo_Record)\r
+       {\r
+               // Pack the control info into a byte\r
+               dbyte = (buttons << 4) | ((mx + 1) << 2) | (my + 1);\r
+\r
+               if\r
+               (\r
+                       (DemoBuffer[DemoOffset + 1] == dbyte)\r
+               &&      (DemoBuffer[DemoOffset] < 255)\r
+               )\r
+                       (DemoBuffer[DemoOffset])++;\r
+               else\r
+               {\r
+                       if (DemoOffset || DemoBuffer[DemoOffset])\r
+                               DemoOffset += 2;\r
+\r
+                       if (DemoOffset >= DemoSize)\r
+                               Quit("Demo buffer overflow");\r
+\r
+                       DemoBuffer[DemoOffset] = 1;\r
+                       DemoBuffer[DemoOffset + 1] = dbyte;\r
+               }\r
+       }\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_SetControlType() - Sets the control type to be used by the specified\r
+//             player\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+void\r
+IN_SetControlType(int player,ControlType type)\r
+{\r
+       // DEBUG - check that requested type is present?\r
+       Controls[player] = type;\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_WaitForKey() - Waits for a scan code, then clears LastScan and\r
+//             returns the scan code\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+ScanCode\r
+IN_WaitForKey(void)\r
+{\r
+       ScanCode        result;\r
+\r
+       while (!(result = LastScan))\r
+               ;\r
+       LastScan = 0;\r
+       return(result);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and\r
+//             returns the ASCII value\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+char\r
+IN_WaitForASCII(void)\r
+{\r
+       char            result;\r
+\r
+       while (!(result = LastASCII))\r
+               ;\r
+       LastASCII = '\0';\r
+       return(result);\r
+}\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_Ack() - waits for a button or key press.  If a button is down, upon\r
+// calling, it must be released for it to be recognized\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+\r
+boolean        btnstate[8];\r
+\r
+void IN_StartAck(void)\r
+{\r
+       unsigned        i,buttons;\r
+\r
+//\r
+// get initial state of everything\r
+//\r
+       IN_ClearKeysDown();\r
+       memset (btnstate,0,sizeof(btnstate));\r
+\r
+       buttons = IN_JoyButtons () << 4;\r
+       if (MousePresent)\r
+               buttons |= IN_MouseButtons ();\r
+\r
+       for (i=0;i<8;i++,buttons>>=1)\r
+               if (buttons&1)\r
+                       btnstate[i] = true;\r
+}\r
+\r
+\r
+boolean IN_CheckAck (void)\r
+{\r
+       unsigned        i,buttons;\r
+\r
+//\r
+// see if something has been pressed\r
+//\r
+       if (LastScan)\r
+               return true;\r
+\r
+       buttons = IN_JoyButtons () << 4;\r
+       if (MousePresent)\r
+               buttons |= IN_MouseButtons ();\r
+\r
+       for (i=0;i<8;i++,buttons>>=1)\r
+               if ( buttons&1 )\r
+               {\r
+                       if (!btnstate[i])\r
+                               return true;\r
+               }\r
+               else\r
+                       btnstate[i]=false;\r
+\r
+       return false;\r
+}\r
+\r
+\r
+void IN_Ack (void)\r
+{\r
+       IN_StartAck ();\r
+\r
+       while (!IN_CheckAck ())\r
+       ;\r
+}\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////\r
+//\r
+//     IN_UserInput() - Waits for the specified delay time (in ticks) or the\r
+//             user pressing a key or a mouse button. If the clear flag is set, it\r
+//             then either clears the key or waits for the user to let the mouse\r
+//             button up.\r
+//\r
+///////////////////////////////////////////////////////////////////////////\r
+boolean IN_UserInput(dword delay)\r
+{\r
+       dword   lasttime;\r
+\r
+       lasttime = TimeCount;\r
+       IN_StartAck ();\r
+       do\r
+       {\r
+               if (IN_CheckAck())\r
+                       return true;\r
+       } while (TimeCount - lasttime < delay);\r
+       return(false);\r
+}\r
+\r
+//===========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= IN_MouseButtons\r
+=\r
+===================\r
+*/\r
+\r
+byte   IN_MouseButtons (void)\r
+{\r
+       if (MousePresent)\r
+       {\r
+               Mouse(MButtons);\r
+               return _BX;\r
+       }\r
+       else\r
+               return 0;\r
+}\r
+\r
+\r
+/*\r
+===================\r
+=\r
+= IN_JoyButtons\r
+=\r
+===================\r
+*/\r
+\r
+byte   IN_JoyButtons (void)\r
+{\r
+       unsigned joybits;\r
+\r
+       joybits = inp(0x201);   // Get all the joystick buttons\r
+       joybits >>= 4;                          // only the high bits are useful\r
+       joybits ^= 15;                          // return with 1=pressed\r
+\r
+       return joybits;\r
+}\r
+\r
+\r
diff --git a/src/lib/16_in__.h b/src/lib/16_in__.h
new file mode 100755 (executable)
index 0000000..f493ce6
--- /dev/null
@@ -0,0 +1,213 @@
+//\r
+//     ID Engine\r
+//     ID_IN.h - Header file for Input Manager\r
+//     v1.0d1w\r
+//     By Jason Blochowiak\r
+//     Open Watcom port by sparky4\r
+//\r
+\r
+#ifndef        __16_IN__\r
+#define        __16_IN__\r
+#include "src/lib/16_head.h"\r
+\r
+#ifdef __DEBUG__\r
+#define        __DEBUG_InputMgr__\r
+#endif\r
+\r
+#define        MaxPlayers      4\r
+#define        MaxKbds         2\r
+#define        MaxJoys         2\r
+#define        NumCodes        128\r
+\r
+typedef        byte            ScanCode;\r
+#define        sc_None                 0\r
+#define        sc_Bad                  0xff\r
+#define        sc_Return               0x1c\r
+#define        sc_Enter                sc_Return\r
+#define        sc_Escape               0x01\r
+#define        sc_Space                0x39\r
+#define        sc_BackSpace    0x0e\r
+#define        sc_Tab                  0x0f\r
+#define        sc_Alt                  0x38\r
+#define        sc_Control              0x1d\r
+#define        sc_CapsLock             0x3a\r
+#define        sc_LShift               0x2a\r
+#define        sc_RShift               0x36\r
+#define        sc_UpArrow              0x48\r
+#define        sc_DownArrow    0x50\r
+#define        sc_LeftArrow    0x4b\r
+#define        sc_RightArrow   0x4d\r
+#define        sc_Insert               0x52\r
+#define        sc_Delete               0x53\r
+#define        sc_Home                 0x47\r
+#define        sc_End                  0x4f\r
+#define        sc_PgUp                 0x49\r
+#define        sc_PgDn                 0x51\r
+#define        sc_F1                   0x3b\r
+#define        sc_F2                   0x3c\r
+#define        sc_F3                   0x3d\r
+#define        sc_F4                   0x3e\r
+#define        sc_F5                   0x3f\r
+#define        sc_F6                   0x40\r
+#define        sc_F7                   0x41\r
+#define        sc_F8                   0x42\r
+#define        sc_F9                   0x43\r
+#define        sc_F10                  0x44\r
+#define        sc_F11                  0x57\r
+#define        sc_F12                  0x59\r
+\r
+#define        sc_1                    0x02\r
+#define        sc_2                    0x03\r
+#define        sc_3                    0x04\r
+#define        sc_4                    0x05\r
+#define        sc_5                    0x06\r
+#define        sc_6                    0x07\r
+#define        sc_7                    0x08\r
+#define        sc_8                    0x09\r
+#define        sc_9                    0x0a\r
+#define        sc_0                    0x0b\r
+\r
+#define        sc_A                    0x1e\r
+#define        sc_B                    0x30\r
+#define        sc_C                    0x2e\r
+#define        sc_D                    0x20\r
+#define        sc_E                    0x12\r
+#define        sc_F                    0x21\r
+#define        sc_G                    0x22\r
+#define        sc_H                    0x23\r
+#define        sc_I                    0x17\r
+#define        sc_J                    0x24\r
+#define        sc_K                    0x25\r
+#define        sc_L                    0x26\r
+#define        sc_M                    0x32\r
+#define        sc_N                    0x31\r
+#define        sc_O                    0x18\r
+#define        sc_P                    0x19\r
+#define        sc_Q                    0x10\r
+#define        sc_R                    0x13\r
+#define        sc_S                    0x1f\r
+#define        sc_T                    0x14\r
+#define        sc_U                    0x16\r
+#define        sc_V                    0x2f\r
+#define        sc_W                    0x11\r
+#define        sc_X                    0x2d\r
+#define        sc_Y                    0x15\r
+#define        sc_Z                    0x2c\r
+\r
+#define        key_None                0\r
+#define        key_Return              0x0d\r
+#define        key_Enter               key_Return\r
+#define        key_Escape              0x1b\r
+#define        key_Space               0x20\r
+#define        key_BackSpace   0x08\r
+#define        key_Tab                 0x09\r
+#define        key_Delete              0x7f\r
+\r
+//     Stuff for the mouse\r
+#define        MReset          0\r
+#define        MButtons        3\r
+#define        MDelta          11\r
+\r
+#define        MouseInt        0x33\r
+#define        Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
+\r
+#ifdef DEMO0\r
+typedef        enum            {\r
+                                               demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
+                                       } Demo;\r
+#endif\r
+//moved to 16_tdef.h\r
+/*typedef      enum            {\r
+                                               //ctrl_None,                            // MDM (GAMERS EDGE) - added\r
+                                               ctrl_Keyboard,\r
+                                                       ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
+                                               ctrl_Joystick,\r
+                                                       ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
+                                               ctrl_Mouse,\r
+                                       } ControlType;\r
+typedef        enum            {\r
+                                               motion_Left = -1,motion_Up = -1,\r
+                                               motion_None = 0,\r
+                                               motion_Right = 1,motion_Down = 1\r
+                                       } Motion;\r
+typedef        enum            {\r
+                                               dir_North,//dir_NorthEast,\r
+                                               dir_West,//dir_Nortinest,\r
+                                               dir_None,\r
+                                               dir_East,//,dir_SouthEast,\r
+                                               dir_South,//dir_Soutinest,\r
+                                       } Direction;\r
+typedef        struct          {\r
+                                               boolean near    button0,button1,button2,button3;\r
+                                               int     near            x,y;\r
+                                               Motion  near    xaxis,yaxis;\r
+                                               Direction near  dir;\r
+                                       } CursorInfo;\r
+\r
+typedef        struct          {\r
+                                               ScanCode near   button0,button1,\r
+                                                                       //upleft,\r
+                                                                       up,\r
+                                                                       down,\r
+                                                                       left,\r
+                                                                       right\r
+                                                                       //upright,\r
+                                                                       //downleft,\r
+                                                                       //,downright\r
+                                                                       ;\r
+                                       } KeyboardDef;\r
+typedef        struct          {\r
+                                               word    near    joyMinX,joyMinY,\r
+                                                                       threshMinX,threshMinY,\r
+                                                                       threshMaxX,threshMaxY,\r
+                                                                       joyMaxX,joyMaxY,\r
+                                                                       joyMultXL,joyMultYL,\r
+                                                                       joyMultXH,joyMultYH;\r
+                                       } JoystickDef;*/\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+#ifdef DEMO0\r
+               static Demo             DemoMode = demo_Off;\r
+               static byte /*_seg*/    *DemoBuffer;\r
+               static word             DemoOffset,DemoSize;\r
+#endif\r
+\r
+// Function prototypes\r
+#define        IN_KeyDown(code)        (Keyboard[(code)])\r
+#define        IN_ClearKey(code)       {Keyboard[code] = false;\\r
+                                                       if (code == LastScan) LastScan = sc_None;}\r
+\r
+// DEBUG - put names in prototypes\r
+extern void            IN_Startup(void),IN_Shutdown(void),\r
+                                       IN_Default(boolean gotit,ControlType in),\r
+                                       IN_SetKeyHook(void (*)()),\r
+                                       IN_ClearKeysDown(void),\r
+                                       IN_ReadCursor(CursorInfo *),\r
+                                       IN_ReadControl(int,CursorInfo *),\r
+                                       IN_SetControlType(int,ControlType),\r
+                                       IN_GetJoyAbs(word joy,word *xp,word *yp),\r
+                                       IN_SetupJoy(word joy,word minx,word maxx,\r
+                                                               word miny,word maxy),\r
+                                       IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
+                                       IN_Ack(void),IN_AckBack(void);\r
+extern boolean         IN_UserInput(dword delay);\r
+extern char            IN_WaitForASCII(void);\r
+extern ScanCode        IN_WaitForKey(void);\r
+extern word            IN_GetJoyButtonsDB(word joy);\r
+extern byte            *IN_GetScanName(ScanCode);\r
+\r
+\r
+byte   IN_MouseButtons (void);\r
+byte   IN_JoyButtons (void);\r
+\r
+void INL_GetJoyDelta(word joy,int *dx,int *dy);\r
+void IN_StartAck(void);\r
+boolean IN_CheckAck (void);\r
+\r
+#endif\r
index 7b5fdcb..c1cef87 100755 (executable)
@@ -57,10 +57,10 @@ void Startup16(global_game_variables_t *gvar)
                return;\r
        }\r
        // hardware must be VGA or higher!\r
-       if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
-               printf("This program requires VGA or higher graphics hardware\n");\r
-               return;\r
-       }\r
+//     if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
+//             printf("This program requires VGA or higher graphics hardware\n");\r
+//             return;\r
+//     }\r
 \r
        if (_DEBUG_INIT() == 0) {\r
 #ifdef DEBUGSERIAL\r
index 3aa8e14..504e673 100755 (executable)
@@ -261,16 +261,11 @@ typedef   struct          {
                                                                        joyMultXH,joyMultYH;\r
                                        } JoystickDef;\r
 \r
-typedef struct// instat\r
+/*typedef struct// inconfig\r
 {\r
        boolean         IN_Started;\r
        boolean         CapsLock;\r
        ScanCode        CurCode,LastCode;\r
-} in_status_t;\r
-\r
-typedef struct// inconfig\r
-{\r
-       in_status_t instat;\r
 //\r
 // configuration variables\r
 //\r
@@ -286,8 +281,7 @@ typedef struct// inconfig
 \r
        KeyboardDef     KbdDefs[MaxKbds];\r
        JoystickDef     JoyDefs[MaxJoys];\r
-} in_info_t;\r
-#define ININFO_                        gvar->in.\r
+} in_info_t;*/\r
 \r
 //==========================================================================\r
 \r
@@ -619,7 +613,7 @@ typedef struct
        loghandle_t     handle; //handles for file logging\r
        kurokku_t       kurokku;        //clock struct\r
        mminfo_t        mm; mminfotype  mmi;    // mm stuff\r
-       in_info_t       in;             // 16_in info\r
+//++++ in_info_t       in;             // 16_in info\r
        player_t        player[MaxPlayers];     // player vars\r
 //==== word far*       clockw;         /* 18.2hz clock */\r
 } global_game_variables_t;\r
index fa6245c..17c1b3e 100755 (executable)
--- a/wbuild.sh
+++ b/wbuild.sh
@@ -12,3 +12,4 @@ wmake -h comp
 #then
 #      rm *.o
 #fi
+####wmake -h inntest.exe
index 75555b8..6a5fae4 100755 (executable)
Binary files a/wcpu.exe and b/wcpu.exe differ