]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_tail.c
__seguse.txt added to show _seg usage also OpenVGMFile needs to be ported to 16_snd...
[16.git] / src / lib / 16_tail.c
index d7a86f56e9a5f8b981c2a75575c0051ed8138482..7b5fdcb4de0c44ea65d8a5809290383c367d39d7 100755 (executable)
@@ -1,5 +1,5 @@
 /* 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
@@ -46,9 +46,9 @@ void Startup16(global_game_variables_t *gvar)
 \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
@@ -64,7 +64,7 @@ void Startup16(global_game_variables_t *gvar)
 \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
@@ -77,12 +77,15 @@ void Startup16(global_game_variables_t *gvar)
        MM_Startup(gvar);\r
 #ifdef __WATCOMC__\r
 #ifdef __DEBUG_InputMgr__\r
-       if(!dbg_notest)\r
+       if(!dbg_nointest)\r
 #endif\r
        IN_Startup(gvar);\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
@@ -100,15 +103,20 @@ void Startup16(global_game_variables_t *gvar)
 \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_notest)\r
+       if(!dbg_nointest)\r
 #endif\r
        IN_Shutdown(gvar);\r
 #endif\r
        CA_Shutdown(gvar);\r
        MM_Shutdown(gvar);\r
+#ifdef __WATCOMC__\r
+       VGAmodeX(0, 1, gvar);\r
+#endif\r
 }\r
 \r
 \r
@@ -124,10 +132,10 @@ void Shutdown16(global_game_variables_t *gvar)
 \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
@@ -226,7 +234,7 @@ void Shutdown16(global_game_variables_t *gvar)
 \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
@@ -274,9 +282,9 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q)
 \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
@@ -310,7 +318,9 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q)
 \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
@@ -325,7 +335,7 @@ void ClearMemory (global_game_variables_t *gvar)
 \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
@@ -346,7 +356,7 @@ void Quit (global_game_variables_t *gvar, char *error)
 \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
@@ -372,6 +382,66 @@ void Quit (global_game_variables_t *gvar, char *error)
 \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