]> 4ch.mooo.com Git - 16.git/blob - src/lib/16_tail.c
====XMS MOSTLY translated but crashes EXMMTEST.EXE ====
[16.git] / src / lib / 16_tail.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 /*\r
23  * 16 library\r
24  */\r
25 \r
26 #include "src/lib/16_tail.h"\r
27 \r
28 //===========================================================================\r
29 \r
30 /*\r
31 ==================\r
32 =\r
33 = DebugMemory\r
34 =\r
35 ==================\r
36 */\r
37 \r
38 void DebugMemory_(global_game_variables_t *gvar, boolean q)\r
39 {\r
40         /*VW_FixRefreshBuffer ();\r
41         US_CenterWindow (16,7);\r
42 \r
43         US_CPrint ("Memory Usage");\r
44         US_CPrint ("------------");\r
45         US_Print ("Total     :");\r
46         US_PrintUnsigned (mminfo.mainmem/1024);\r
47         US_Print ("k\nFree      :");\r
48         US_PrintUnsigned (MM_UnusedMemory()/1024);\r
49         US_Print ("k\nWith purge:");\r
50         US_PrintUnsigned (MM_TotalFree()/1024);\r
51         US_Print ("k\n");\r
52         VW_UpdateScreen();*/\r
53         if(q){\r
54         printf("========================================\n");\r
55         printf("                DebugMemory_\n");\r
56         printf("========================================\n");}\r
57         if(q) { printf("Memory Usage\n");\r
58         printf("------------\n"); }else printf("  ");\r
59         printf("Total:  "); if(q) printf("      "); printf("%uk", gvar->mmi.mainmem/1024);\r
60         if(q) printf("\n"); else printf("       ");\r
61         printf("Free:   "); if(q) printf("      "); printf("%uk", MM_UnusedMemory(gvar)/1024);\r
62         if(q) printf("\n"); else printf("       ");\r
63         printf("With purge:"); if(q) printf("   "); printf("%uk\n", MM_TotalFree(gvar)/1024);\r
64         if(q) printf("------------\n");\r
65 #ifdef __WATCOMC__\r
66         IN_Ack ();\r
67 #endif\r
68         if(q) MM_ShowMemory (gvar);\r
69 }\r
70 #ifdef __WATCOMC__\r
71 /*\r
72 ==========================\r
73 =\r
74 = Quit\r
75 =\r
76 ==========================\r
77 */\r
78 \r
79 void Quit (char *error)\r
80 {\r
81         unsigned        finscreen;\r
82         memptr  screen;\r
83         union REGS in, out;\r
84 \r
85         //ClearMemory ();\r
86         if (!*error)\r
87         {\r
88          //WriteConfig ();\r
89         }\r
90         else\r
91         {\r
92          //CA_CacheGrChunk (ERRORSCREEN);\r
93          //screen = grsegs[ERRORSCREEN];\r
94         }\r
95 \r
96         //ShutdownId ();\r
97         IN_Shutdown();\r
98         //modexLeave();\r
99         in.h.ah = 0x00;\r
100         in.h.al = 0x3;\r
101         int86(0x10, &in, &out);\r
102 \r
103         if (error && *error)\r
104         {\r
105           //movedata ((unsigned)screen,7,0xb800,0,7*160);\r
106           //gotoxy (10,4);\r
107           fprintf(stderr, "%s\n", error);\r
108           //gotoxy (1,8);\r
109           exit(1);\r
110         }\r
111         else\r
112         if (!error || !(*error))\r
113         {\r
114                 //clrscr();\r
115                 //#ifndef JAPAN\r
116                 movedata ((unsigned)screen,7,0xb800,0,4000);\r
117                 //gotoxy(1,24);\r
118                 //#endif\r
119 //asm   mov     bh,0\r
120 //asm   mov     dh,23   // row\r
121 //asm   mov     dl,0    // collumn\r
122 //asm   mov ah,2\r
123 //asm   int     0x10\r
124         }\r
125 \r
126         exit(0);\r
127 }\r
128 #endif\r
129 \r
130 //===========================================================================\r