/* 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
#endif\r
CA_Shutdown(gvar);\r
MM_Shutdown(gvar);\r
+ VGAmodeX(0, 1, gvar);\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 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
-void walktypeinfo(player_t *player, word pn)\r
-{\r
- switch(player[pn].walktype)\r
- {\r
- case 0: //bump\r
- sprintf(global_temp_status_text, "%s", "b");\r
- break;\r
- case 1: //walk no scroll\r
- sprintf(global_temp_status_text, "%s", "w");\r
- break;\r
- case 2: //scrolling walk\r
- sprintf(global_temp_status_text, "%s", "s");\r
- break;\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
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
+ 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
+ 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
+ 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 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
+ 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
+ out 61h, al //; Turn speaker on\r
mov cx, 2000h\r
@@delay:\r
- loop @@delay\r
+ loop @@delay\r
pop ax\r
- out 61h, al ; Turn speaker off\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