/* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
*\r
* This file is part of Project 16.\r
*\r
\r
// DOSLIB: what CPU are we using?\r
// NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
- // So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
- // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
- // the CPU to carry out tasks. --J.C.\r
+ // So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
+ // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
+ // the CPU to carry out tasks. --J.C.\r
cpu_probe();\r
\r
// DOSLIB: check for VGA\r
\r
if (_DEBUG_INIT() == 0) {\r
#ifdef DEBUGSERIAL\r
- printf("WARNING: Failed to initialize DEBUG output\n");\r
+ //printf("WARNING: Failed to initialize DEBUG output\n");\r
#endif\r
}\r
_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
#ifdef __DEBUG_InputMgr__\r
if(!dbg_nointest)\r
#endif\r
- IN_Startup(gvar);\r
+ IN_Startup();\r
#endif\r
+#ifdef __16_PM__\r
PM_Startup(gvar);\r
+ PM_CheckMainMem(gvar);\r
PM_UnlockMainMem(gvar);\r
+#endif\r
CA_Startup(gvar);\r
}\r
\r
\r
void Shutdown16(global_game_variables_t *gvar)\r
{\r
+#ifdef __16_PM__\r
PM_Shutdown(gvar);\r
+#endif\r
#ifdef __WATCOMC__\r
#ifdef __DEBUG_InputMgr__\r
if(!dbg_nointest)\r
#endif\r
- IN_Shutdown(gvar);\r
+ IN_Shutdown();\r
#endif\r
CA_Shutdown(gvar);\r
MM_Shutdown(gvar);\r
+#ifdef __WATCOMC__\r
+ VGAmodeX(0, 1, gvar);\r
+#endif\r
}\r
\r
\r
\r
/*void ReadConfig(void)\r
{\r
- int file;\r
- SDMode sd;\r
- SMMode sm;\r
- SDSMode sds;\r
+ int file;\r
+ SDMode sd;\r
+ SMMode sm;\r
+ SDSMode sds;\r
\r
\r
if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1)\r
\r
/*void WriteConfig(void)\r
{\r
- int file;\r
+ int file;\r
\r
file = open(configname,O_CREAT | O_BINARY | O_WRONLY,\r
S_IREAD | S_IWRITE | S_IFREG);\r
\r
US_CPrint ("Memory Usage");\r
US_CPrint ("------------");\r
- US_Print ("Total :");\r
+ US_Print ("Total :");\r
US_PrintUnsigned (mminfo.mainmem/1024);\r
- US_Print ("k\nFree :");\r
+ US_Print ("k\nFree :");\r
US_PrintUnsigned (MM_UnusedMemory()/1024);\r
US_Print ("k\nWith purge:");\r
US_PrintUnsigned (MM_TotalFree()/1024);\r
\r
void ClearMemory (global_game_variables_t *gvar)\r
{\r
+#ifdef __16_PM__\r
PM_UnlockMainMem(gvar);\r
+#endif\r
//snd\r
MM_SortMem (gvar);\r
}\r
\r
void Quit (global_game_variables_t *gvar, char *error)\r
{\r
- //unsigned finscreen;\r
+ //unsigned finscreen;\r
memptr screen=0;\r
\r
ClearMemory (gvar);\r
\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
\r
//===========================================================================\r
\r
+#ifndef __WATCOMC__\r
+char global_temp_status_text[512];\r
+char global_temp_status_text2[512];\r
+#else\r
+//\r
+// for mary4 (XT)\r
+// this is from my XT's BIOS\r
+// http://www.phatcode.net/downloads.php?id=101\r
+//\r
+void turboXT(byte bakapee)\r
+{\r
+ __asm {\r
+ push ax\r
+ push bx\r
+ push cx\r
+ in al, 61h //; Read equipment flags\r
+ xor al, bakapee //; toggle speed\r
+ out 61h, al //; Write new flags back\r
+\r
+ mov bx, 0F89h //; low pitch blip\r
+ and al, 4 //; Is turbo mode set?\r
+ jz @@do_beep\r
+ mov bx, 52Eh //; high pitch blip\r
+\r
+@@do_beep:\r
+ mov al, 10110110b //; Timer IC 8253 square waves\r
+ out 43h, al //; channel 2, speaker\r
+ mov ax, bx\r
+ out 42h, al //; send low order\r
+ mov al, ah //; load high order\r
+ out 42h, al //; send high order\r
+ in al, 61h //; Read IC 8255 machine status\r
+ push ax\r
+ or al, 00000011b\r
+ out 61h, al //; Turn speaker on\r
+ mov cx, 2000h\r
+@@delay:\r
+ loop @@delay\r
+ pop ax\r
+ out 61h, al //; Turn speaker off\r
+ pop cx\r
+ pop bx\r
+ pop ax\r
+ }\r
+}\r
+#endif\r
+\r
+const char *word_to_binary(word x)\r
+{\r
+ static char b[17];\r
+ int z;\r
+\r
+ b[0] = '\0';\r
+ for (z = 16; z > 0; z >>= 1)\r
+ {\r
+ strcat(b, ((x & z) == z) ? "1" : "0");\r
+ }\r
+ return b;\r
+}\r
+\r
const char *nibble_to_binary(nibble x)\r
{\r
static char b[9];\r