]> 4ch.mooo.com Git - 16.git/commitdiff
====PM WORKS! XMS PORTING IS NEXT!====
authorsparky4 <sparky4@cock.li>
Tue, 27 Sep 2016 16:27:12 +0000 (11:27 -0500)
committersparky4 <sparky4@cock.li>
Tue, 27 Sep 2016 16:27:12 +0000 (11:27 -0500)
DEBUG.16W
HEAP.16W
MMDUMP.16W
src/exmmtest.c
src/lib/16_head.h
src/lib/16_lib.c
src/lib/16_mm.c
src/lib/16_pm.c

index b3ed514bf3eaf5171b9ef596fc8080fb074755ec..d3ab7a602d1f0234f3ec560ea40f4aed0af5cf5b 100755 (executable)
--- a/DEBUG.16W
+++ b/DEBUG.16W
-\e[0mSeg:0      Size:8558       Owner:0x1\r
-\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m0\r
-\e[0m\e[0mSeg:216e       Size:256        Owner:0x5448\r
-\e[44;34m+++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:226e       Size:273        Owner:0x94a0\r
+\e[0mSeg:0      Size:9821       Owner:0x0\r
+\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:265d       Size:256        Owner:0x18a8\r
 \e[44;34m++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:27e0       Size:44 Owner:0x0\r
-\e[41;31m++\e[0m\e[42;32m0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\r
-\e[0m\e[0mSeg:b80c       Size:10228      Owner:0x0\r
-\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:e000       Size:8191       Owner:0x0\r
-\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m
\ No newline at end of file
+\e[0m\e[0mSeg:27d9       Size:53 Owner:0x0\r
+\e[41;31m++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:280e       Size:256        Owner:0x1696\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:290e       Size:256        Owner:0x1698\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2a0e       Size:256        Owner:0x169a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2b0e       Size:256        Owner:0x169c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2c0e       Size:256        Owner:0x169e\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2d0e       Size:256        Owner:0x16a0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2e0e       Size:256        Owner:0x16a2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2f0e       Size:256        Owner:0x16a4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:300e       Size:256        Owner:0x16a6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:310e       Size:256        Owner:0x16a8\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:320e       Size:256        Owner:0x16aa\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:330e       Size:256        Owner:0x16ac\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:340e       Size:256        Owner:0x16ae\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:350e       Size:256        Owner:0x16b0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:360e       Size:256        Owner:0x16b2\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:370e       Size:256        Owner:0x16b4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:380e       Size:256        Owner:0x16b6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:390e       Size:256        Owner:0x16b8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3a0e       Size:256        Owner:0x16ba\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3b0e       Size:256        Owner:0x16bc\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3c0e       Size:256        Owner:0x16be\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3d0e       Size:256        Owner:0x16c0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3e0e       Size:256        Owner:0x16c2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3f0e       Size:256        Owner:0x16c4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:400e       Size:256        Owner:0x16c6\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:410e       Size:256        Owner:0x16c8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:420e       Size:256        Owner:0x16ca\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:430e       Size:256        Owner:0x16cc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:440e       Size:256        Owner:0x16ce\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:450e       Size:256        Owner:0x16d0\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:460e       Size:256        Owner:0x16d2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:470e       Size:256        Owner:0x16d4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:480e       Size:256        Owner:0x16d6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:490e       Size:256        Owner:0x16d8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4a0e       Size:256        Owner:0x16da\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4b0e       Size:256        Owner:0x16dc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4c0e       Size:256        Owner:0x16de\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4d0e       Size:256        Owner:0x16e0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4e0e       Size:256        Owner:0x16e2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4f0e       Size:256        Owner:0x16e4\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:500e       Size:256        Owner:0x16e6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:510e       Size:256        Owner:0x16e8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:520e       Size:256        Owner:0x16ea\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:530e       Size:256        Owner:0x16ec\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:540e       Size:256        Owner:0x16ee\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:550e       Size:256        Owner:0x16f0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:560e       Size:256        Owner:0x16f2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:570e       Size:256        Owner:0x16f4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:580e       Size:256        Owner:0x16f6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:590e       Size:256        Owner:0x16f8\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5a0e       Size:256        Owner:0x16fa\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5b0e       Size:256        Owner:0x16fc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5c0e       Size:256        Owner:0x16fe\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5d0e       Size:256        Owner:0x1700\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5e0e       Size:256        Owner:0x1702\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5f0e       Size:256        Owner:0x1704\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:600e       Size:256        Owner:0x1706\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:610e       Size:256        Owner:0x1708\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:620e       Size:256        Owner:0x170a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:630e       Size:256        Owner:0x170c\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:640e       Size:256        Owner:0x170e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:650e       Size:256        Owner:0x1710\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:660e       Size:256        Owner:0x1712\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:670e       Size:256        Owner:0x1714\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:680e       Size:256        Owner:0x1716\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:690e       Size:256        Owner:0x1718\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6a0e       Size:256        Owner:0x171a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6b0e       Size:256        Owner:0x171c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6c0e       Size:256        Owner:0x171e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6d0e       Size:256        Owner:0x1720\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6e0e       Size:256        Owner:0x1722\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6f0e       Size:256        Owner:0x1724\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:700e       Size:256        Owner:0x1726\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:710e       Size:256        Owner:0x1728\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:720e       Size:256        Owner:0x172a\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:730e       Size:256        Owner:0x172c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:740e       Size:256        Owner:0x172e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:750e       Size:256        Owner:0x1730\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:760e       Size:256        Owner:0x1732\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:770e       Size:256        Owner:0x1734\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:780e       Size:256        Owner:0x1736\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:790e       Size:256        Owner:0x1738\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7a0e       Size:256        Owner:0x173a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7b0e       Size:256        Owner:0x173c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7c0e       Size:256        Owner:0x173e\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7d0e       Size:256        Owner:0x1740\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7e0e       Size:256        Owner:0x1742\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7f0e       Size:256        Owner:0x1744\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:800e       Size:256        Owner:0x1746\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:810e       Size:256        Owner:0x1748\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:820e       Size:256        Owner:0x174a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:830e       Size:256        Owner:0x174c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:840e       Size:256        Owner:0x174e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:850e       Size:256        Owner:0x1750\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:860e       Size:256        Owner:0x1752\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:870e       Size:256        Owner:0x1754\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:880e       Size:256        Owner:0x1756\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:890e       Size:256        Owner:0x1758\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8a0e       Size:256        Owner:0x175a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8b0e       Size:256        Owner:0x175c\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8c0e       Size:273        Owner:0xe400\r
+\e[44;34m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:b80e       Size:18417      Owner:0x0\r
+\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m
\ No newline at end of file
index 2b94206e8c61d86672aff49a51be5d9b6f84cdc8..b777259b181ae510517871008282d5a0d9bc7341 100755 (executable)
--- a/HEAP.16W
+++ b/HEAP.16W
@@ -1,47 +1,47 @@
 \r
        == default ==\r
 \r
-  USED block at 28020016 of size 66\r
-  USED block at 28020058 of size 66\r
-  FREE block at 2802009a of size 18\r
-  USED block at 280200ac of size 136\r
-  USED block at 28020134 of size 20\r
-  FREE block at 28020148 of size 7860\r
+  USED block at 27fb0016 of size 66\r
+  USED block at 27fb0058 of size 66\r
+  USED block at 27fb009a of size 136\r
+  FREE block at 27fb0122 of size 18\r
+  USED block at 27fb0134 of size 20\r
+  FREE block at 27fb0148 of size 7860\r
 OK - end of heap\r
 \r
        == near ==\r
 \r
-  USED block at 180194d6 of size 12\r
-  USED block at 180194e2 of size 332\r
-  USED block at 1801962e of size 52\r
-  USED block at 18019662 of size 20\r
-  USED block at 18019676 of size 20\r
-  USED block at 1801968a of size 20\r
-  USED block at 1801969e of size 20\r
-  USED block at 180196b2 of size 20\r
-  USED block at 180196c6 of size 26934\r
+  USED block at 17fae436 of size 12\r
+  USED block at 17fae442 of size 332\r
+  USED block at 17fae58e of size 52\r
+  USED block at 17fae5c2 of size 20\r
+  USED block at 17fae5d6 of size 20\r
+  USED block at 17fae5ea of size 20\r
+  USED block at 17fae5fe of size 20\r
+  USED block at 17fae612 of size 20\r
+  USED block at 17fae626 of size 6614\r
 OK - end of heap\r
 \r
        == far ==\r
 \r
-  USED block at 28020016 of size 66\r
-  USED block at 28020058 of size 66\r
-  USED block at 2802009a of size 18\r
-  USED block at 280200ac of size 136\r
-  USED block at 28020134 of size 20\r
-  USED block at 28020148 of size 7860\r
+  USED block at 27fb0016 of size 66\r
+  USED block at 27fb0058 of size 66\r
+  USED block at 27fb009a of size 136\r
+  USED block at 27fb0122 of size 18\r
+  USED block at 27fb0134 of size 20\r
+  USED block at 27fb0148 of size 7860\r
 OK - end of heap\r
 \r
 Memory Type         Total      Used       Free\r
 ----------------  --------   --------   --------\r
 Default                   8166         288       7878\r
-Near              27430        496       26934\r
-Far               8166         288       7878\r
+Near              7110         496       6614\r
+Far               8166         0         7878\r
 ----------------  --------   --------   --------\r
-coreleft = 26932\r
-farcoreleft = 51040\r
+coreleft = 6612\r
+farcoreleft = 30720\r
 GetFreeSize = 24128\r
-GetNearFreeSize = 26934\r
+GetNearFreeSize = 6614\r
 GetFarFreeSize = 24128\r
-memavl = 26932\r
-stackavail = 11268\r
+memavl = 6612\r
+stackavail = 31588\r
index 2f5e7ecfa7fabedb4836a18f552f166b815237f7..cb01f5beec81552a1dad5e9db36e08d725416db8 100755 (executable)
Binary files a/MMDUMP.16W and b/MMDUMP.16W differ
index 905bdc15db2297c5e9903e09804cac9c0b5ca735..b57a6f055b23357c71ca68b072ca702a11d6fb9c 100755 (executable)
@@ -67,7 +67,7 @@ void
 main(int argc, char *argv[])\r
 {\r
        byte w=1;\r
-       global_game_variables_t gvar;\r
+       static global_game_variables_t gvar;\r
 #ifdef __WATCOMC__\r
        __segment sega;\r
 #endif\r
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
        //file name //\r
 \r
        gvar.mm.mmstarted=0;\r
-       debugpm=1;\r
+       debugpm=1;      //debug pm\r
 \r
        //PRINTBB\r
        if(argv[1]){ bakapee1 = argv[1];\r
@@ -96,11 +96,13 @@ main(int argc, char *argv[])
                bakapee1 = "data/koishi~.pcx";\r
                bakapee2 = "data/test.map";\r
        }\r
-       //printf("main()=%Fp    start MM\n", *argv[0]);\r
+       printf("main()=%Fp      start MM\n", *argv[0]);\r
        MM_Startup(&gvar);\r
+       printf("ok\n");\r
        if(debugpm>0)\r
        {\r
                PM_Startup(&gvar);\r
+               printf("pmstarted ok\n");\r
                //PM_CheckMainMem(&gvar);\r
                PM_UnlockMainMem(&gvar);\r
        }\r
index 2d080d520a501aa07803c37c4baf746cc10729f6..aab4c0334e7a74c9e958b816d1bc5cfb4c12501d 100755 (executable)
@@ -152,7 +152,7 @@ static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */
 extern int                     profilehandle,debughandle;      //make it into game global\r
 \r
 #define __DEBUG__\r
-#define __DEBUG_PM__\r
+//#define __DEBUG_PM__\r
 //#define __DEBUG_MM__\r
 \r
 #define        nil     ((void *)0)\r
index 57a062175e291cc1268861973dce5432f48b09bc..12a4288b6aab4e1ccc97f7a7bf36b82d2cf89dcf 100755 (executable)
@@ -88,7 +88,7 @@ void Quit (char *error)
 \r
        if (error && *error)\r
        {\r
-         movedata ((unsigned)screen,7,0xb800,0,7*160);\r
+         //movedata ((unsigned)screen,7,0xb800,0,7*160);\r
          //gotoxy (10,4);\r
          fprintf(stderr, "%s\n", error);\r
          //gotoxy (1,8);\r
index 859a5b4aed31ee74fde4a5dcfeb534e7778857ba..8d93438a3c0d27ebd6a1ebe958ad6ff532684793 100755 (executable)
@@ -836,9 +836,8 @@ void MM_Startup(global_game_variables_t *gvar)
 
        gvar->mmi.mainmem = gvar->mmi.nearheap + gvar->mmi.farheap;
 
-#ifdef __DEBUG__
+#ifndef __16_PM__
        if(!debugpm) {
-#endif
 //
 // detect EMS and allocate up to 64K at page frame
 //
@@ -903,7 +902,7 @@ goto xmsskip;//0000
        {
                MML_SetupXMS(gvar);                                     // allocate as many UMBs as possible
        }
-#ifdef __DEBUG__
+
        }
 #endif
 //
@@ -1619,9 +1618,9 @@ void MM_Report_(global_game_variables_t *gvar)
        if(MML_CheckForEMS())
        {
                printf("        LIMEMS\n");
-               printf("                EMM v%x.%x available\n", gvar->mm.EMSVer>>4,gvar->mm.EMSVer&0x0F);
-               printf("                totalEMSpages:  %u      ", gvar->mm.totalEMSpages); printf("freeEMSpages:       %u\n", gvar->mm.freeEMSpages);
-               printf("                EMSPageFrame:   %x\n", gvar->mm.EMSPageFrame);
+               printf("                EMM v%x.%x available\n", gvar->pm.emm.EMSVer>>4,gvar->pm.emm.EMSVer&0x0F);
+               printf("                totalEMSpages:  %u      ", gvar->pm.emm.totalEMSpages); printf("freeEMSpages:   %u\n", gvar->pm.emm.freeEMSpages);
+               printf("                EMSPageFrame:   %x\n", gvar->pm.emm.EMSPageFrame);
        }
        if(MML_CheckForXMS(gvar))
        {
@@ -1629,7 +1628,7 @@ void MM_Report_(global_game_variables_t *gvar)
                printf("                XMSaddr:        %X\n", *XMSaddr);
        }
        printf("near:   %lu     ", gvar->mmi.nearheap); printf("far:    %lu\n", gvar->mmi.farheap); if(MML_CheckForEMS())
-       printf("EMSmem: %lu     ", gvar->mmi.EMSmem); if(MML_CheckForXMS(gvar)) printf("XMSmem: %lu", gvar->mmi.XMSmem); printf("\n");
+       printf("EMSmem: %lu     ", gvar->pm.emm.EMSAvail/*gvar->mmi.EMSmem*/); if(MML_CheckForXMS(gvar)) printf("XMSmem:        %lu", gvar->mmi.XMSmem); printf("\n");
        //printf("mainmem:      %lu\n", gvar->mmi.mainmem);
        printf("Total convmem:  %lu     ", gvar->mmi.mainmem); printf("TotalFree:       %lu     ", MM_TotalFree(gvar)); printf("TotalUsed:      %lu\n", gvar->mmi.mainmem+gvar->mmi.EMSmem+gvar->mmi.XMSmem+gvar->mmi.XMSmem);
        printf("                        UnusedMemory:   %lu\n", MM_UnusedMemory(gvar));
index 22cd7ea57bb276792f4aac787715c4c5f53dacc4..ef2d6d5ad38fbae46e632c3d35933adc24c65101 100755 (executable)
@@ -34,20 +34,20 @@ boolean debugpm=0;
 #endif\r
 \r
 //     Main Mem specific variables\r
-/*     boolean                 MainPresent;\r
-       memptr                  MainMemPages[PMMaxMainMem];\r
+       boolean                 MainPresent;\r
+/*     memptr                  MainMemPages[PMMaxMainMem];\r
        PMBlockAttr             gvar->pm.mm.MainMemUsed[PMMaxMainMem];\r
-       int                             gvar->pm.mm.MainPagesAvail;\r
+       int                             gvar->pm.mm.MainPagesAvail;*/\r
 \r
 //     EMS specific variables\r
        boolean                 EMSPresent;\r
-       word                    gvar->pm.emm.EMSAvail,gvar->pm.emm.EMSPagesAvail,gvar->pm.emm.EMSHandle,\r
+/*     word                    gvar->pm.emm.EMSAvail,gvar->pm.emm.EMSPagesAvail,gvar->pm.emm.EMSHandle,\r
                                        gvar->pm.emm.EMSPageFrame,gvar->pm.emm.EMSPhysicalPage;\r
-       gvar->pm.emm.EMSListStruct      gvar->pm.emm.EMSList[EMSFrameCount];\r
+       gvar->pm.emm.EMSListStruct      gvar->pm.emm.EMSList[EMSFrameCount];*/\r
 \r
 //     XMS specific variables\r
        boolean                 XMSPresent;\r
-       word                    gvar->pm.xmm.XMSAvail,gvar->pm.xmm.XMSPagesAvail,gvar->pm.xmm.XMSHandle;*/\r
+       //word                  gvar->pm.xmm.XMSAvail,gvar->pm.xmm.XMSPagesAvail,gvar->pm.xmm.XMSHandle;\r
        word            XMSDriver;\r
 /*     int                             gvar->pm.xmm.XMSProtectPage = -1;\r
 \r
@@ -55,10 +55,10 @@ boolean debugpm=0;
        char                    gvar->pm.fi.PageFileName[13] = {"VSWAP."};\r
        int                             PageFile = -1;\r
        word                    gvar->pm.fi.ChunksInFile;\r
-       word                    PMSpriteStart,PMSoundStart;\r
+       word                    PMSpriteStart,PMSoundStart;*/\r
 \r
 //     General usage variables\r
-       boolean                 PMStarted,\r
+       boolean                 PMStarted;/*,\r
                                        gvar->pm.PMPanicMode,\r
                                        gvar->pm.PMThrashing;\r
        word                    gvar->pm.XMSPagesUsed,\r
@@ -67,9 +67,8 @@ boolean debugpm=0;
                                        gvar->pm.PMNumBlocks;\r
        long                    PMFrameCount;\r
        PageListStruct  far *gvar->pm.PMPages,\r
-                                       _seg *gvar->pm.PMSegPages;\r
-*/\r
-boolean                PMStarted, MainPresent, EMSPresent, XMSPresent;\r
+                                       _seg *gvar->pm.PMSegPages;*/\r
+\r
 static char            *ParmStrings[] = {"nomain","noems","noxms",nil};\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
@@ -141,7 +140,7 @@ PML_StartupEMS(global_game_variables_t *gvar)
 {\r
        int             i;\r
        long    size;\r
-       byte    str[160];\r
+       byte    str[64];\r
        byte err;\r
 \r
        boolean errorflag=0;\r
@@ -226,6 +225,7 @@ End1:
 #ifdef __WATCOMC__\r
        }\r
 #endif\r
+/*\r
        if(errorflag==false)\r
        {\r
                // Don't hog all available EMS\r
@@ -236,7 +236,7 @@ End1:
                        gvar->pm.emm.EMSAvail = size / EMSPageSize;\r
                }\r
        }\r
-\r
+*/\r
        __asm {\r
                mov     ah,EMS_ALLOCPAGES\r
                mov     bx,[EMSAvail];\r
@@ -285,6 +285,8 @@ End2:
        gvar->pm.emm.EMSAvail = EMSAvail;\r
        gvar->pm.emm.EMSVer = EMSVer;\r
        gvar->pm.emm.EMSHandle = EMSHandle;\r
+       gvar->pm.emm.freeEMSpages = freeEMSpages;\r
+       gvar->pm.emm.totalEMSpages = totalEMSpages;\r
 \r
        return(EMSPresent);\r
 }\r
@@ -296,6 +298,10 @@ void
 PML_ShutdownEMS(global_game_variables_t *gvar)\r
 {\r
        word EMSHandle;\r
+       byte err;\r
+       byte    str[64];\r
+       boolean errorflag=false;\r
+\r
        EMSHandle=gvar->pm.emm.EMSHandle;\r
 \r
        if (EMSPresent)\r
@@ -304,9 +310,30 @@ PML_ShutdownEMS(global_game_variables_t *gvar)
                        mov     ah,EMS_FREEPAGES\r
                        mov     dx,[EMSHandle]\r
                        int     EMS_INT\r
+                       jc      errors\r
+                       jmp     Ends\r
+#ifdef __BORLANDC__\r
+               }\r
+#endif\r
+                       errors:\r
+#ifdef __BORLANDC__\r
+               __asm {\r
+#endif\r
+                       mov     err,ah\r
+                       mov     errorflag,1\r
+                       jmp Ends\r
+#ifdef __BORLANDC__\r
                }\r
-               if (_AH)\r
+#endif\r
+               Ends:\r
+#ifdef __WATCOMC__\r
+               }\r
+#endif\r
+               if(errorflag==true)\r
                {\r
+                       strcpy(str,"PML_ShutdownEMS: Error freeing EMS ");\r
+                       MM_EMSerr(str, err);\r
+                       printf("%s\n",str);\r
                        Quit("PML_ShutdownEMS: Error freeing EMS\n");\r
                        //return;\r
                }\r
@@ -480,11 +507,7 @@ PM_SetMainMemPurge(int level, global_game_variables_t *gvar)
        {\r
 #ifdef __DEBUG_PM__\r
                printf("PM_SetMainMemPurge()    info of gvar->pm.mm.MainMemPages[i]\n");\r
-               //printf("      %Fp,    %Fp\n", gvar->pm.mm.MainMemPages[i],            (gvar->pm.mm.MainMemPages[i]));\r
                printf("&       %Fp,    %Fp\n", &gvar->pm.mm.MainMemPages[i],   &(gvar->pm.mm.MainMemPages[i]));\r
-               //MM_ShowMemory(gvar);\r
-               //MM_DumpData(gvar);\r
-               //MM_Report_(gvar);\r
 #endif\r
                if (gvar->pm.mm.MainMemPages[i])\r
                        MM_SetPurge(&(gvar->pm.mm.MainMemPages[i]),level, gvar);\r
@@ -492,9 +515,7 @@ PM_SetMainMemPurge(int level, global_game_variables_t *gvar)
 \r
        else\r
        {\r
-               printf("MainPresent IS NULL\n");\r
-               printf("%x      ", MainPresent);\r
-               exit(-4);\r
+               Quit("MainPresent IS NULL\n");\r
        }\r
 }\r
 \r
@@ -679,10 +700,7 @@ PML_OpenPageFile(global_game_variables_t *gvar)
        gvar->pm.fi.PageFile = open(gvar->pm.fi.PageFileName,O_RDONLY + O_BINARY);\r
        if (gvar->pm.fi.PageFile == -1)\r
        {\r
-               //Quit("PML_OpenPageFile: Unable to open page file");\r
-               printf("PML_OpenPageFile: Unable to open page file");\r
-               printf(": %s\n", gvar->pm.fi.PageFileName);\r
-               exit(-1);\r
+               Quit("PML_OpenPageFile: Unable to open page file");\r
                //return;\r
        }\r
 \r
@@ -1383,19 +1401,18 @@ PM_Startup(global_game_variables_t *gvar)
                }\r
        }\r
 \r
-       PML_OpenPageFile(gvar);\r
+       //0000++++PML_OpenPageFile(gvar);\r
 \r
        if (!noems)\r
                PML_StartupEMS(gvar);\r
        if (!noxms)\r
-               PML_StartupXMS(gvar);\r
+               //++++PML_StartupXMS(gvar);     //TODO: convert\r
 \r
-       if (nomain && !EMSPresent)\r
+       if (!nomain && !EMSPresent)\r
        {\r
                Quit("PM_Startup: No main or EMS\n");\r
                //return;\r
        }\r
-       printf("PML_StartupMainMem\n");\r
        PML_StartupMainMem(gvar);\r
 \r
        PM_Reset(gvar);\r