1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\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
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
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
26 #include "src/lib/16_tail.h"
\r
29 ==========================
\r
33 = Load a few things right away
\r
35 ==========================
\r
38 void Startup16(global_game_variables_t *gvar)
\r
41 // DOSLIB: check our environment
\r
44 // DOSLIB: what CPU are we using?
\r
45 // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
\r
46 // So this code by itself shouldn't care too much what CPU it's running on. Except that other
\r
47 // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
\r
48 // the CPU to carry out tasks. --J.C.
\r
51 // DOSLIB: check for VGA
\r
53 printf("VGA probe failed\n");
\r
56 // hardware must be VGA or higher!
\r
57 if (!(vga_state.vga_flags & VGA_IS_VGA)) {
\r
58 printf("This program requires VGA or higher graphics hardware\n");
\r
62 if (_DEBUG_INIT() == 0) {
\r
64 printf("WARNING: Failed to initialize DEBUG output\n");
\r
67 _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log
\r
68 _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);
\r
70 gvar->mm.mmstarted=0;
\r
71 gvar->pm.PMStarted=0;
\r
75 PM_UnlockMainMem(gvar);
\r
84 //===========================================================================
\r
87 ==========================
\r
91 = Shuts down all ID_?? managers
\r
93 ==========================
\r
96 void Shutdown16(global_game_variables_t *gvar)
\r
105 //===========================================================================
\r
115 void DebugMemory_(global_game_variables_t *gvar, boolean q)
\r
117 /*VW_FixRefreshBuffer ();
\r
118 US_CenterWindow (16,7);
\r
120 US_CPrint ("Memory Usage");
\r
121 US_CPrint ("------------");
\r
122 US_Print ("Total :");
\r
123 US_PrintUnsigned (mminfo.mainmem/1024);
\r
124 US_Print ("k\nFree :");
\r
125 US_PrintUnsigned (MM_UnusedMemory()/1024);
\r
126 US_Print ("k\nWith purge:");
\r
127 US_PrintUnsigned (MM_TotalFree()/1024);
\r
129 VW_UpdateScreen();*/
\r
131 printf("========================================\n");
\r
132 printf(" DebugMemory_\n");
\r
133 printf("========================================\n");}
\r
134 if(q) { printf("Memory Usage\n");
\r
135 printf("------------\n"); }else printf(" %c%c", 0xD3, 0xC4);
\r
136 printf("Total: "); if(q) printf(" "); printf("%uk", gvar->mmi.mainmem/1024);
\r
137 if(q) printf("\n"); else printf(" ");
\r
138 printf("Free: "); if(q) printf(" "); printf("%uk", MM_UnusedMemory(gvar)/1024);
\r
139 if(q) printf("\n"); else printf(" ");
\r
140 printf("With purge:"); if(q) printf(" "); printf("%uk\n", MM_TotalFree(gvar)/1024);
\r
141 if(q) printf("------------\n");
\r
145 if(q) MM_ShowMemory (gvar);
\r
149 ==========================
\r
153 ==========================
\r
156 void Quit (char *error)
\r
158 unsigned finscreen;
\r
160 union REGS in, out;
\r
169 //CA_CacheGrChunk (ERRORSCREEN);
\r
170 //screen = grsegs[ERRORSCREEN];
\r
178 int86(0x10, &in, &out);
\r
180 if (error && *error)
\r
182 //movedata ((unsigned)screen,7,0xb800,0,7*160);
\r
184 fprintf(stderr, "%s\n", error);
\r
189 if (!error || !(*error))
\r
193 movedata ((unsigned)screen,7,0xb800,0,4000);
\r
197 //asm mov dh,23 // row
\r
198 //asm mov dl,0 // collumn
\r
207 //===========================================================================
\r