X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2F16_tail.c;h=7b5fdcb4de0c44ea65d8a5809290383c367d39d7;hb=af2715fef8681d909afe82f7baaf5e13baabb76f;hp=41379e326ab0ebb14bb1a75ab8a830aac70164ee;hpb=dd49c6d79ba7633ee2cd551d54fbee2c17391f1a;p=16.git diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index 41379e32..7b5fdcb4 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -46,9 +46,9 @@ void Startup16(global_game_variables_t *gvar) // DOSLIB: what CPU are we using? // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. - // So this code by itself shouldn't care too much what CPU it's running on. Except that other - // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for - // the CPU to carry out tasks. --J.C. + // So this code by itself shouldn't care too much what CPU it's running on. Except that other + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for + // the CPU to carry out tasks. --J.C. cpu_probe(); // DOSLIB: check for VGA @@ -81,8 +81,11 @@ void Startup16(global_game_variables_t *gvar) #endif IN_Startup(gvar); #endif +#ifdef __16_PM__ PM_Startup(gvar); + PM_CheckMainMem(gvar); PM_UnlockMainMem(gvar); +#endif CA_Startup(gvar); } @@ -100,7 +103,9 @@ void Startup16(global_game_variables_t *gvar) void Shutdown16(global_game_variables_t *gvar) { +#ifdef __16_PM__ PM_Shutdown(gvar); +#endif #ifdef __WATCOMC__ #ifdef __DEBUG_InputMgr__ if(!dbg_nointest) @@ -109,6 +114,9 @@ void Shutdown16(global_game_variables_t *gvar) #endif CA_Shutdown(gvar); MM_Shutdown(gvar); +#ifdef __WATCOMC__ + VGAmodeX(0, 1, gvar); +#endif } @@ -124,10 +132,10 @@ void Shutdown16(global_game_variables_t *gvar) /*void ReadConfig(void) { - int file; - SDMode sd; - SMMode sm; - SDSMode sds; + int file; + SDMode sd; + SMMode sm; + SDSMode sds; if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1) @@ -226,7 +234,7 @@ void Shutdown16(global_game_variables_t *gvar) /*void WriteConfig(void) { - int file; + int file; file = open(configname,O_CREAT | O_BINARY | O_WRONLY, S_IREAD | S_IWRITE | S_IFREG); @@ -274,9 +282,9 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q) US_CPrint ("Memory Usage"); US_CPrint ("------------"); - US_Print ("Total :"); + US_Print ("Total :"); US_PrintUnsigned (mminfo.mainmem/1024); - US_Print ("k\nFree :"); + US_Print ("k\nFree :"); US_PrintUnsigned (MM_UnusedMemory()/1024); US_Print ("k\nWith purge:"); US_PrintUnsigned (MM_TotalFree()/1024); @@ -310,7 +318,9 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q) void ClearMemory (global_game_variables_t *gvar) { +#ifdef __16_PM__ PM_UnlockMainMem(gvar); +#endif //snd MM_SortMem (gvar); } @@ -325,7 +335,7 @@ void ClearMemory (global_game_variables_t *gvar) void Quit (global_game_variables_t *gvar, char *error) { - //unsigned finscreen; + //unsigned finscreen; memptr screen=0; ClearMemory (gvar); @@ -346,7 +356,7 @@ void Quit (global_game_variables_t *gvar, char *error) if (error && *error) { - movedata((unsigned)screen,7,0xb800,0,7*160); + //movedata((unsigned)screen,7,0xb800,0,7*160); gotoxy (10,4); fprintf(stderr, "%s\n", error); gotoxy (1,8); @@ -372,59 +382,65 @@ void Quit (global_game_variables_t *gvar, char *error) //=========================================================================== -void walktypeinfo(player_t *player, word pn) -{ - switch(player[pn].walktype) - { - case 0: //bump - sprintf(global_temp_status_text, "%s", "b"); - break; - case 1: //walk no scroll - sprintf(global_temp_status_text, "%s", "w"); - break; - case 2: //scrolling walk - sprintf(global_temp_status_text, "%s", "s"); - break; - } -} - +#ifndef __WATCOMC__ +char global_temp_status_text[512]; +char global_temp_status_text2[512]; +#else +// +// for mary4 (XT) +// this is from my XT's BIOS +// http://www.phatcode.net/downloads.php?id=101 +// void turboXT(byte bakapee) { - //byte bakapee = 12; __asm { push ax push bx push cx - in al, 61h ; Read equipment flags - xor al, bakapee ; toggle speed - out 61h, al ; Write new flags back + in al, 61h //; Read equipment flags + xor al, bakapee //; toggle speed + out 61h, al //; Write new flags back - mov bx, 0F89h ; low pitch blip - and al, 4 ; Is turbo mode set? + mov bx, 0F89h //; low pitch blip + and al, 4 //; Is turbo mode set? jz @@do_beep - mov bx, 52Eh ; high pitch blip + mov bx, 52Eh //; high pitch blip @@do_beep: - mov al, 10110110b ; Timer IC 8253 square waves - out 43h, al ; channel 2, speaker + mov al, 10110110b //; Timer IC 8253 square waves + out 43h, al //; channel 2, speaker mov ax, bx - out 42h, al ; send low order - mov al, ah ; load high order - out 42h, al ; send high order - in al, 61h ; Read IC 8255 machine status + out 42h, al //; send low order + mov al, ah //; load high order + out 42h, al //; send high order + in al, 61h //; Read IC 8255 machine status push ax or al, 00000011b - out 61h, al ; Turn speaker on + out 61h, al //; Turn speaker on mov cx, 2000h @@delay: - loop @@delay + loop @@delay pop ax - out 61h, al ; Turn speaker off + out 61h, al //; Turn speaker off pop cx pop bx pop ax } } +#endif + +const char *word_to_binary(word x) +{ + static char b[17]; + int z; + + b[0] = '\0'; + for (z = 16; z > 0; z >>= 1) + { + strcat(b, ((x & z) == z) ? "1" : "0"); + } + return b; +} const char *nibble_to_binary(nibble x) {