1 /* Catacomb Apocalypse Source Code
2 * Copyright (C) 1993-2014 Flat Rock Software
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 =============================================================================
24 ID software memory manager
25 --------------------------
27 Primary coder: John Carmack
31 Quit (char *error) function
36 MM_SizePtr to change the size of a given pointer
38 Multiple purge levels utilized
40 EMS / XMS unmanaged routines
42 =============================================================================
46 Open Watcom port by sparky4
49 #include "src/lib/16_mm.h"
52 =============================================================================
56 =============================================================================
59 void (* beforesort) (void);
60 void (* aftersort) (void);
61 void (* XMSaddr) (void); // far pointer to XMS driver
64 =============================================================================
68 =============================================================================
71 static char *ParmStringsexmm[] = {"noems","noxms",""};
74 ======================
78 = Routine from p36 of Extending DOS
80 =======================
83 boolean MML_CheckForEMS(void)
86 static char emmname[] = "EMMXXXX0"; //fix by andrius4669
87 // mov dx,OFFSET emmname
89 //LEA DX, emmname //fix by andrius4669
90 mov dx,OFFSET emmname //fix by andrius4669
92 int 0x21 // try to open EMMXXXX0 device
98 int 0x21 // get device info
106 int 0x21 // get status
112 int 0x21 // close handle
131 ======================
135 =======================
138 unsigned MML_SetupEMS(mminfo_t *mm)
140 char str[80],str2[10];
142 boolean errorflag=false;
145 unsigned int EMSVer = 0;
146 unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle;
147 totalEMSpages = freeEMSpages = EMSpageframe = EMSpagesmapped = 0;
152 int EMS_INT // make sure EMS hardware is present
160 mov [EMSVer],ax // set EMSVer
161 cmp al,0x32 // only work on ems 3.2 or greater
165 int EMS_INT // find the page frame address
168 mov [EMSpageframe],bx
171 int EMS_INT // find out how much EMS is there
174 mov [totalEMSpages],dx
175 mov [freeEMSpages],bx
177 jz noEMS // no EMS at all to allocate
181 cmp bx,[freeEMSpages]
183 mov bx,[freeEMSpages]
188 jle getpages // there is only 1,2,3,or 4 pages
189 mov bx,4 // we can't use more than 4 pages
192 mov [EMSpagesmapped],bx
193 mov ah,EMS_ALLOCPAGES // allocate up to 64k of EMS
208 strcpy(str,"MML_SetupEMS: EMS error 0x");
214 mm->totalEMSpages=totalEMSpages;
215 mm->freeEMSpages=freeEMSpages;
216 mm->EMSpageframe=EMSpageframe;
217 mm->EMSpagesmapped=EMSpagesmapped;
218 mm->EMShandle=EMShandle;
225 ======================
229 =======================
232 void MML_ShutdownEMS(mminfo_t *mm)
234 boolean errorflag=false;
235 unsigned EMShandle=mm->EMShandle;
249 if(errorflag==true) printf("MML_ShutdownEMS: Error freeing EMS!"); //++++ add something
257 = Maps the 64k of EMS used by memory manager into the page frame
258 = for general use. This only needs to be called if you are keeping
259 = other things in EMS.
264 unsigned MM_MapEMS(mminfo_t *mm)
266 char str[80],str2[10];
267 unsigned err, EMShandle;
268 boolean errorflag=false;
271 EMShandle=mm->EMShandle;
273 for (i=0;i<4/*mm->EMSpagesmapped*/;i++)
278 mov bx,[i] // logical page
279 mov al,bl // physical page
280 mov dx,[EMShandle] // handle
292 strcpy(str,"MM_MapEMS: EMS error 0x");
295 //printf("%s\n",str);
296 printf("FACK! %u\n", err);
304 SUB EMS.MapXPages (PhysicalStart, LogicalStart, NumPages, Handle)
\r
306 'Maps up to 4 logical EMS pages to physical pages in the page frame, where:
\r
308 'PhysicalStart = Physical page first logical page is mapped to
\r
309 'LogicalStart = First logical page to map
\r
310 'NumPages = Number of pages to map (1 to 4)
\r
311 'Handle = EMS handle logical pages are allocated to
\r
313 'Create a buffer containing the page information
\r
314 FOR x = 0 TO NumPages - 1
\r
315 MapInfo$ = MapInfo$ + MKI$(LogicalStart + x) + MKI$(PhysicalStart + x)
\r
318 Regs.ax = &H5000 'Map the pages in the buffer
\r
319 Regs.cx = NumPages 'to the pageframe
\r
321 Regs.ds = VARSEG(MapInfo$)
\r
322 Regs.si = SADD(MapInfo$)
\r
323 InterruptX &H67, Regs, Regs
\r
324 EMS.Error = (Regs.ax AND &HFF00&) \ &H100 'Store the status code
\r
328 void MM_MapXEMS(mminfo_t *mm)
333 //==========================================================================
336 ======================
340 = Check for XMM driver
342 =======================
345 boolean MML_CheckForXMS(mminfo_t *mm)
347 boolean errorflag=false;
353 int 0x2f // query status of installed diver
359 if(errorflag==true) return false;
365 ======================
369 = Try to allocate all upper memory block
371 =======================
374 void MML_SetupXMS(mminfo_t *mm, mminfotype *mmi)
383 mov [WORD PTR XMSaddr],bx
384 mov [WORD PTR XMSaddr+2],es // function pointer to XMS driver
387 mov dx,0xffff // try for largest block possible
388 //mov ax,dx // Set available Kbytes.
389 call [DWORD PTR XMSaddr]
393 cmp bl,0xb0 // error: smaller UMB is available
397 call [DWORD PTR XMSaddr] // DX holds largest available UMB
399 jz done // another error...
406 printf("base=%u ", base); printf("size=%u\n", size);
407 MML_UseSpace(base,size, mm);
408 mmi->XMSmem += size*16;
409 mm->UMBbase[mm->numUMBs] = base;
411 if(mm->numUMBs < MAXUMBS)
417 ======================
421 ======================
424 void MML_ShutdownXMS(mminfo_t *mm)
429 for (i=0;i<mm->numUMBs;i++)
431 base = mm->UMBbase[i];
436 call [DWORD PTR XMSaddr]
441 //==========================================================================
444 ======================
448 = Marks a range of paragraphs as usable by the memory manager
449 = This is used to mark space for the near heap, far heap, ems page frame,
450 = and upper memory blocks
452 ======================
455 void MML_UseSpace(/*d*/word segstart, dword seglength, mminfo_t *mm)
457 mmblocktype huge *scan,huge *last;
462 scan = last = mm->mmhead;
463 mm->mmrover = mm->mmhead; // reset rover to start of memory
466 // search for the block that contains the range of segments
468 while(scan->start+scan->length < segstart)
474 //find out how many blocks it spans!
475 if(seglength>0xffffu)
477 // segm=seglength/0x4000u;
478 segm=seglength/0xffffu;
483 if(segm>1/*extra>0xfffflu*/)
494 //MML_UseSpace(?segstart?, ?length?, mm);
500 //printf("MML_UseSpace: Segment spans two blocks!\n");
504 // take the given range out of the block
506 oldend = scan->start + scan->length;
507 extra = oldend - (segstart+seglength);
509 printf("segm=%u ", segm);
510 printf("ex=%lu ", extra);
511 printf("start+seglen=%lu ", segstart+seglength);
512 printf("len=%u ", scan->length);
513 printf("segsta=%x ", segstart);
514 printf("seglen=%lu\n", seglength);
517 //++++todo: linked list of segment!
518 //printf("segm=%lu\n", segm);
519 if(segstart == scan->start)
521 last->next = scan->next; // unlink block
522 MM_FreeBlock(scan, mm);
526 scan->length = segstart-scan->start; // shorten block
533 mm->mmnew->next = scan->next;
534 scan->next = mm->mmnew;
535 mm->mmnew->start = segstart+seglength;
536 mm->mmnew->length = extra;
537 mm->mmnew->attributes = LOCKBIT;
538 }//else if(segm>0) goto segu;
542 //==========================================================================
549 = We are out of blocks, so free a purgable block
554 void MML_ClearBlock(mminfo_t *mm)
556 mmblocktype huge *scan,huge *last;
558 scan = mm->mmhead->next;
562 if(!(scan->attributes&LOCKBIT) && (scan->attributes&PURGEBITS))
564 MM_FreePtr(scan->useptr, mm);
570 printf("MM_ClearBlock: No purgable blocks!\n");
574 //==========================================================================
581 = Grabs all space from turbo with malloc/farmalloc
582 = Allocates bufferseg misc buffer
587 void MM_Startup(mminfo_t *mm, mminfotype *mmi)
592 unsigned segstart,seglength,endfree;
597 mm->mmstarted = true;
598 mm->bombonerror = true;
600 // set up the linked list (everything in the free list;
603 mm->mmfree = &(mm->mmblocks[0]);
604 for(i=0;i<MAXBLOCKS-1;i++)
606 mm->mmblocks[i].next = &(mm->mmblocks[i+1]);
608 mm->mmblocks[i].next = NULL;
611 // locked block of all memory until we punch out free space
614 mm->mmhead = mm->mmnew; // this will allways be the first node
615 mm->mmnew->start = 0;
616 mm->mmnew->length = 0xffff;
617 mm->mmnew->attributes = LOCKBIT;
618 mm->mmnew->next = NULL;
619 mm->mmrover = mm->mmhead;
621 // farlen=_bios_memsize()*1024;
624 // get all available near conventional memory segments
626 //---- length=coreleft();
629 start = (void huge *)(mm->nearheap = malloc(length));
630 length -= 16-(FP_OFF(start)&15);
631 length -= SAVENEARHEAP;
632 seglength = length / 16; // now in paragraphs
633 segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;
634 MML_UseSpace(segstart,seglength, mm);
635 mmi->nearheap = length;
636 //printf("near heap ok!\n");
639 // get all available far conventional memory segments
641 //---- length=farcoreleft();
644 start = mm->farheap = halloc(length, sizeof(byte));
645 //start = mm->farheap = _fmalloc(length);
646 length -= 16-(FP_OFF(start)&15);
647 length -= SAVEFARHEAP;
648 seglength = length / 16; // now in paragraphs
649 segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;
650 MML_UseSpace(segstart,seglength, mm);
651 mmi->farheap = length;
652 mmi->mainmem = mmi->nearheap + mmi->farheap;
653 //printf("far heap ok!\n");
657 // detect EMS and allocate up to 64K at page frame
659 printf("EMS!\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug!
661 for(i = 1;i < __argc;i++)
663 if(US_CheckParm(__argv[i],ParmStringsexmm) == 0)
664 goto emsskip; // param NOEMS
666 printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug!
667 if(MML_CheckForEMS())
670 MML_SetupEMS(mm); // allocate space
672 printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug!
673 //TODO: EMS4! AND EMS 3.2 MASSIVE DATA HANDLMENT!
674 MML_UseSpace(mm->EMSpageframe,(MAPPAGES)*0x4000lu, mm);
676 MM_MapEMS(mm); // map in used pages
678 mmi->EMSmem = (MAPPAGES)*0x4000lu;
682 // detect XMS and get upper memory blocks
686 for(i = 1;i < __argc;i++)
688 if(US_CheckParm(__argv[i],ParmStringsexmm) == 0)
689 goto xmsskip; // param NOXMS
691 printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug!
692 if(MML_CheckForXMS(mm))
695 //MML_SetupXMS(mm, mmi); // allocate as many UMBs as possible
699 // allocate the misc buffer
702 mm->mmrover = mm->mmhead; // start looking for space after low block
704 MM_GetPtr(&(mm->bufferseg),BUFFERSIZE, mm, mmi);
707 //==========================================================================
714 = Frees all conventional, EMS, and XMS allocated
719 void MM_Shutdown(mminfo_t *mm)
725 printf("far freed\n");
727 printf("near freed\n");
728 //hfree(mm->hugeheap);
729 //printf("huge freed\n");
730 if(MML_CheckForEMS()){ MML_ShutdownEMS(mm); printf("EMS freed\n"); }
731 if(MML_CheckForXMS(mm)){ MML_ShutdownXMS(mm); printf("XMS freed\n"); }
734 //==========================================================================
741 = Allocates an unlocked, unpurgable block
746 void MM_GetPtr(memptr *baseptr,dword size, mminfo_t *mm, mminfotype *mmi)
748 mmblocktype huge *scan,huge *lastscan,huge *endscan,huge *purge,huge *next;
750 unsigned needed,startseg;
752 needed = (size+15)/16; // convert size from bytes to paragraphs
754 MM_GetNewBlock(mm); // fill in start and next after a spot is found
755 mm->mmnew->length = needed;
756 mm->mmnew->useptr = baseptr;
757 mm->mmnew->attributes = BASEATTRIBUTES;
759 for(search = 0; search<3; search++)
762 // first search: try to allocate right after the rover, then on up
763 // second search: search from the head pointer up to the rover
764 // third search: compress memory, then scan from start
765 if(search == 1 && mm->mmrover == mm->mmhead)
771 lastscan = mm->mmrover;
772 scan = mm->mmrover->next;
776 lastscan = mm->mmhead;
777 scan = mm->mmhead->next;
778 endscan = mm->mmrover;
782 lastscan = mm->mmhead;
783 scan = mm->mmhead->next;
788 startseg = lastscan->start + lastscan->length;
790 while(scan != endscan)
792 if(scan->start - startseg >= needed)
795 // got enough space between the end of lastscan and
796 // the start of scan, so throw out anything in the middle
797 // and allocate the new block
799 purge = lastscan->next;
800 lastscan->next = mm->mmnew;
801 mm->mmnew->start = *(unsigned *)baseptr = startseg;
802 mm->mmnew->next = scan;
804 { // free the purgable block
806 MM_FreeBlock(purge, mm);
807 purge = next; // purge another if not at scan
809 mm->mmrover = mm->mmnew;
810 return; // good allocation!
814 // if this block is purge level zero or locked, skip past it
816 if((scan->attributes & LOCKBIT)
817 || !(scan->attributes & PURGEBITS) )
820 startseg = lastscan->start + lastscan->length;
824 scan=scan->next; // look at next line
829 printf(OUT_OF_MEM_MSG,(size-mmi->nearheap));
834 //==========================================================================
841 = Allocates an unlocked, unpurgable block
846 void MM_FreePtr(memptr *baseptr, mminfo_t *mm)
848 mmblocktype huge *scan,huge *last;
853 if(baseptr == mm->mmrover->useptr) // removed the last allocated block
854 mm->mmrover = mm->mmhead;
856 while(scan->useptr != baseptr && scan)
864 printf("MM_FreePtr: Block not found!");
868 last->next = scan->next;
870 MM_FreeBlock(scan, mm);
872 //==========================================================================
875 =====================
879 = Sets the purge level for a block (locked blocks cannot be made purgable)
881 =====================
884 void MM_SetPurge(memptr *baseptr, int purge, mminfo_t *mm)
886 mmblocktype huge *start;
892 if(mm->mmrover->useptr == baseptr)
895 mm->mmrover = mm->mmrover->next;
898 mm->mmrover = mm->mmhead;
899 else if(mm->mmrover == start)
901 printf("MM_SetPurge: Block not found!");
907 mm->mmrover->attributes &= ~PURGEBITS;
908 mm->mmrover->attributes |= purge;
911 //==========================================================================
914 =====================
918 = Locks / unlocks the block
920 =====================
923 void MM_SetLock(memptr *baseptr, boolean locked, mminfo_t *mm)
925 mmblocktype huge *start;
931 if(mm->mmrover->useptr == baseptr)
934 mm->mmrover = mm->mmrover->next;
937 mm->mmrover = mm->mmhead;
938 else if(mm->mmrover == start)
940 printf("MM_SetLock: Block not found!");
946 mm->mmrover->attributes &= ~LOCKBIT;
947 mm->mmrover->attributes |= locked*LOCKBIT;
950 //==========================================================================
953 =====================
957 = Throws out all purgable stuff and compresses movable blocks
959 =====================
962 void MM_SortMem(mminfo_t *mm)
964 mmblocktype huge *scan,huge *last,huge *next;
965 unsigned start,length,source,dest,oldborder;
969 // lock down a currently playing sound
971 /*++++ playing = SD_SoundPlaying ();
977 playing += STARTPCSOUNDS;
980 playing += STARTADLIBSOUNDS;
983 MM_SetLock(&(memptr)audiosegs[playing],true);
988 // oldborder = bordercolor;
989 // VW_ColorBorder (15);
996 last = NULL; // shut up compiler warning
1000 if(scan->attributes & LOCKBIT)
1003 // block is locked, so try to pile later blocks right after it
1005 start = scan->start + scan->length;
1009 if(scan->attributes & PURGEBITS)
1012 // throw out the purgable block
1015 MM_FreeBlock(scan, mm);
1023 // push the non purgable block on top of the last moved block
1025 if(scan->start != start)
1027 length = scan->length;
1028 source = scan->start;
1030 while(length > 0xf00)
1032 movedata(source,0,dest,0,0xf00*16);
1037 movedata(source,0,dest,0,length*16);
1039 scan->start = start;
1040 *(unsigned *)scan->useptr = start;
1042 start = scan->start + scan->length;
1047 scan = scan->next; // go to next block
1050 mm->mmrover = mm->mmhead;
1055 // VW_ColorBorder (oldborder);
1058 MM_SetLock(&(memptr)audiosegs[playing],false);*/
1062 //==========================================================================
1066 =====================
1070 =====================
1073 void MM_ShowMemory(page_t *page, mminfo_t *mm)
1075 mmblocktype huge *scan;
1076 unsigned color,temp;
1079 char scratch[160],str[16];
1081 //**** VW_SetDefaultColors();
1082 //**** VW_SetLineWidth(40);
1083 //++++mh temp = bufferofs;
1084 //++++mh bufferofs = 0;
1085 //**** VW_SetScreen (0,0);
1098 if(scan->attributes & PURGEBITS)
1099 color = 5; // dark purple = purgable
1101 color = 9; // medium blue = non purgable
1102 if(scan->attributes & LOCKBIT)
1103 color = 12; // red = locked
1104 if(scan->start<=end)
1107 write(debughandle,"\nMM_ShowMemory: Memory block order currupted!\n",strlen("\nMM_ShowMemory: Memory block order currupted!\n"));
1108 //modexprint(&page, chx, chy, 1, 0, 24, "\nMM_ShowMemory: Memory block order currupted!\n");
1111 end = scan->start+scan->length-1;
1112 modexhlin(page, scan->start, (unsigned)end, chy, color);
1113 //++++ VW_Hlin(scan->start,(unsigned)end,0,color);
1114 //void VW_Plot(unsigned x, unsigned y, unsigned color);
1115 //void VW_Hlin(unsigned xl, unsigned xh, unsigned y, unsigned color);
1117 //++++ VW_Plot(scan->start,0,15);
1118 //modexputPixel(page, scan->start, chy, 15);
1119 modexClearRegion(page, scan->start, chy, 4, 4, 15);
1120 if(scan->next->start > end+1)
1121 //++++ VW_Hlin(end+1,scan->next->start,0,0); // black = free
1122 modexhlin(page, end+1,scan->next->start, chy, 9);
1125 printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug!
1126 strcpy(scratch,"Seg:");
1127 ultoa (scan->start,str,16);
1128 strcat (scratch,str);
1129 strcat (scratch,"\tSize:");
1130 ltoa ((dword)scan->length*16,str,10);
1131 strcat (scratch,str);
1132 strcat (scratch,"\tOwner:0x");
1133 owner = (unsigned)scan->useptr;
1134 ultoa (owner,str,16);
1135 strcat (scratch,str);
1136 strcat (scratch,"\n");
1137 write(debughandle,scratch,strlen(scratch));
1138 //modexprint(page, chx, chy, 1, 0, 24, &scratch);
1140 //fprintf(stdout, "%s", scratch);
1149 //**** VW_SetLineWidth(64);
1150 //++++mh bufferofs = temp;
1154 //==========================================================================
\r
1157 =====================
\r
1161 =====================
\r
1164 void MM_DumpData(mminfo_t *mm)
\r
1166 mmblocktype far *scan,far *best;
\r
1167 long lowest,oldlowest;
\r
1173 free (mm->nearheap);
\r
1174 dumpfile = fopen ("mmdump.txt","w");
\r
1176 printf("MM_DumpData: Couldn't open MMDUMP.TXT!");
1183 oldlowest = lowest;
\r
1186 scan = mm->mmhead;
\r
1189 owner = (unsigned)scan->useptr;
\r
1191 if (owner && owner<lowest && owner > oldlowest)
\r
1197 scan = scan->next;
\r
1200 if (lowest != 0xffff)
\r
1202 if (best->attributes & PURGEBITS)
\r
1206 if (best->attributes & LOCKBIT)
\r
1210 fprintf (dumpfile,"0x%p (%c%c) = %u\n"
\r
1211 ,(unsigned)lowest,lock,purge,best->length);
\r
1214 } while (lowest != 0xffff);
\r
1216 fclose (dumpfile);
\r
1217 printf("MMDUMP.TXT created.");
\r
1220 //==========================================================================
1224 ======================
1228 = Returns the total free space without purging
1230 ======================
1233 dword MM_UnusedMemory(mminfo_t *mm)
1236 mmblocktype huge *scan;
1243 free += scan->next->start - (scan->start + scan->length);
1251 //==========================================================================
1255 ======================
1259 = Returns the total free space with purging
1261 ======================
1264 dword MM_TotalFree(mminfo_t *mm)
1267 mmblocktype huge *scan;
1274 if((scan->attributes&PURGEBITS) && !(scan->attributes&LOCKBIT))
1275 free += scan->length;
1276 free += scan->next->start - (scan->start + scan->length);
1284 //==========================================================================
1287 =====================
1291 =====================
1294 void MM_Report(page_t *page, mminfo_t *mm, mminfotype *mmi)
1296 if(MML_CheckForEMS())
1298 printf("EMM v%x.%x available\n", mm->EMSVer>>4,mm->EMSVer&0x0F);
1299 printf("totalEMSpages=%u\n", mm->totalEMSpages);
1300 printf("freeEMSpages=%u\n", mm->freeEMSpages);
1301 printf("EMSpageframe=%x\n", mm->EMSpageframe);
1303 if(MML_CheckForXMS(mm)) printf("XMSaddr=%Fp\n", *XMSaddr);
1304 printf("near=%lu\n", mmi->nearheap);
1305 printf("far=%lu\n", mmi->farheap);
1306 printf("EMSmem=%lu\n", mmi->EMSmem);
1307 printf("XMSmem=%lu\n", mmi->XMSmem);
1308 printf("mainmem=%lu\n", mmi->mainmem);
1309 printf("UnusedMemory=%lu\n", MM_UnusedMemory(mm));
1310 printf("TotalFree=%lu\n", MM_TotalFree(mm));
1312 // printf("UnusedMemory=%lu kb\n", MM_UnusedMemory()/10248);
1313 // printf("TotalFree=%lu kb\n", MM_TotalFree()/10248);
1316 //==========================================================================
1319 =====================
1323 =====================
1338 //==========================================================================
1341 =====================
1345 =====================
1348 void MM_BombOnError(boolean bomb, mminfo_t *mm)
1350 mm->bombonerror = bomb;
1353 void MM_GetNewBlock(mminfo_t *mm)
1357 mm->mmnew=mm->mmfree;
1358 mm->mmfree=mm->mmfree->next;
1359 /*if(!(mm->mmnew=mm->mmfree))
1361 printf("MM_GETNEWBLOCK: No free blocks!");
1364 mm->mmfree=mm->mmfree->next;*/
1367 void MM_FreeBlock(mmblocktype *x, mminfo_t *mm)
1374 void MM_seguin(void)
1385 void MM_segude(void)
1394 pull data from far and put it into ds var