]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_mm.c
16_ca needs huge amounts of work and I should remember what needs to be done soon...
[16.git] / src / lib / 16_mm.c
index 706aaff19a0f217bed5152a375ab3d54edd61bcf..d43432fe61707e682132b1efdf1d8c2bd70e9783 100755 (executable)
@@ -1,23 +1,19 @@
-/* Project 16 Source Code~\r
- * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+/* Catacomb Apocalypse Source Code\r
+ * Copyright (C) 1993-2014 Flat Rock Software\r
  *\r
- * This file is part of Project 16.\r
- *\r
- * Project 16 is free software; you can redistribute it and/or modify\r
+ * This program is free software; you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 3 of the License, or\r
+ * the Free Software Foundation; either version 2 of the License, or\r
  * (at your option) any later version.\r
  *\r
- * Project 16 is distributed in the hope that it will be useful,\r
+ * This program is distributed in the hope that it will be useful,\r
  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
  * GNU General Public License for more details.\r
  *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
- * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
- * Fifth Floor, Boston, MA 02110-1301 USA.\r
- *\r
+ * You should have received a copy of the GNU General Public License along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
  */\r
 \r
 // NEWMM.C\r
@@ -554,7 +550,7 @@ getmemory:
        }\r
 #endif\r
 //     printf("base=%u ", base); printf("size=%u\n", size);\r
-       MML_UseSpace (base,size, gvar);\r
+       MML_UseSpace(base,size, gvar);\r
        gvar->mmi.XMSmem += size*16;\r
        gvar->mm.UMBbase[gvar->mm.numUMBs] = base;\r
        gvar->mm.numUMBs++;\r
@@ -613,7 +609,7 @@ void MML_ShutdownXMS(global_game_variables_t *gvar)
        {\r
                scan->blob=segm;\r
 \r
-               //MML_UseSpace (segstart, seglength, gvar);\r
+               //MML_UseSpace(segstart, seglength, gvar);\r
 \r
                printf("MML_UseSpace: Segment spans two blocks!\n");\r
        //}\r
@@ -628,7 +624,7 @@ void MML_ShutdownXMS(global_game_variables_t *gvar)
        }\r
 //++++todo: linked list of segment!\r
 */\r
-void MML_UseSpace (word segstart, dword seglength, global_game_variables_t *gvar)\r
+void MML_UseSpace(word segstart, dword seglength, global_game_variables_t *gvar)\r
 {\r
        mmblocktype far *scan,far *last;\r
        word    oldend;\r
@@ -744,7 +740,7 @@ void MML_ClearBlock(global_game_variables_t *gvar)
 ===================\r
 */\r
 \r
-void MM_Startup (global_game_variables_t *gvar)\r
+void MM_Startup(global_game_variables_t *gvar)\r
 {\r
        int i;\r
        //dword length,seglength;\r
@@ -797,7 +793,7 @@ void MM_Startup (global_game_variables_t *gvar)
        length -= SAVENEARHEAP;\r
        seglength = length / 16;                        // now in paragraphs\r
        segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;\r
-       MML_UseSpace (segstart,seglength, gvar);\r
+       MML_UseSpace(segstart,seglength, gvar);\r
        gvar->mmi.nearheap = length;\r
        //0000printf("near:     start=%Fp       segstart=%x     seglen=%lu      len=%lu\n", start, segstart, (dword)seglength, length);\r
 \r
@@ -818,7 +814,7 @@ void MM_Startup (global_game_variables_t *gvar)
        length -= SAVEFARHEAP;\r
        seglength = length / 16;                        // now in paragraphs\r
        segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;\r
-       MML_UseSpace (segstart,seglength, gvar);\r
+       MML_UseSpace(segstart,seglength, gvar);\r
        gvar->mmi.farheap = length;\r
        //0000printf("far:      start=%Fp       segstart=%x     seglen=%lu      len=%lu\n", start, segstart, (dword)seglength, length);\r
 \r
@@ -841,7 +837,7 @@ void MM_Startup (global_game_variables_t *gvar)
        {\r
                MML_SetupEMS(gvar);                                     // allocate space\r
                //16_PM: EMS4! AND EMS 3.2 MASSIVE DATA HANDLMENT!\r
-               MML_UseSpace (gvar->mm.EMSPageFrame,(MAPPAGES)*0x4000lu, gvar);\r
+               MML_UseSpace(gvar->mm.EMSPageFrame,(MAPPAGES)*0x4000lu, gvar);\r
                //if(gvar->pm.emm.EMSVer<0x40)\r
                        MM_MapEMS(gvar);                                        // map in used pages\r
                //else\r
@@ -888,7 +884,7 @@ xmsskip:
 ====================\r
 */\r
 \r
-void MM_Shutdown (global_game_variables_t *gvar)\r
+void MM_Shutdown(global_game_variables_t *gvar)\r
 {\r
        if(!(gvar->mm.mmstarted))\r
                return;\r
@@ -940,14 +936,13 @@ void MM_GetPtr (memptr *baseptr, dword size, global_game_variables_t *gvar)
        gvar->mm.mmnew->useptr = baseptr;\r
        //if(gvar->mm.mmnew->useptr==NULL){\r
 #ifdef __DEBUG_MM__\r
-       printf("MM_GetPtr\n");\r
        if(dbg_debugmm>0){\r
+               printf("MM_GetPtr\n");\r
                //%04x\r
                printf("        baseptr=%Fp     ", baseptr); printf("useptr=%Fp\n", gvar->mm.mmnew->useptr);\r
                printf("        *baseptr=%Fp    ", *baseptr); printf("*useptr=%Fp\n", *(gvar->mm.mmnew->useptr));\r
                printf("        &baseptr=%Fp    ", &baseptr); printf("&useptr=%Fp\n", &(gvar->mm.mmnew->useptr));\r
        }\r
-       printf("        size is %lu\n", size);\r
 #endif\r
        //Quit(gvar, "gvar->mm.mmnew->useptr==NULL"); }\r
        gvar->mm.mmnew->attributes = BASEATTRIBUTES;\r