From: sparky4 Date: Tue, 11 Oct 2016 18:42:10 +0000 (-0500) Subject: wwww X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=6ea0cf6263907c85547614cb009eb1bfca0566d1 wwww --- diff --git a/16/16_tail.c b/16/16_tail.c new file mode 100755 index 00000000..6d66ec1c --- /dev/null +++ b/16/16_tail.c @@ -0,0 +1,194 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +/* + * 16 library + */ + +#include "src/lib/16_tail.h" + +/* +========================== += += Startup16 += += Load a few things right away += +========================== +*/ + +void Startup16(global_game_variables_t *gvar) +{ + // DOSLIB: check our environment + probe_dos(); + + // 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. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + + gvar->mm.mmstarted=0; + gvar->pm.PMStarted=0; + MM_Startup(gvar); + IN_Startup(gvar); + PM_Startup(gvar); + PM_UnlockMainMem(gvar); + CA_Startup(gvar); + +} + +//=========================================================================== + +/* +========================== += += Shutdown16 += += Shuts down all ID_?? managers += +========================== +*/ + +void Shutdown16(global_game_variables_t *gvar) +{ + PM_Shutdown(gvar); + IN_Shutdown(gvar); + CA_Shutdown(gvar); + MM_Shutdown(gvar); +} + + +//=========================================================================== + +/* +================== += += DebugMemory += +================== +*/ + +void DebugMemory_(global_game_variables_t *gvar, boolean q) +{ + /*VW_FixRefreshBuffer (); + US_CenterWindow (16,7); + + US_CPrint ("Memory Usage"); + US_CPrint ("------------"); + US_Print ("Total :"); + US_PrintUnsigned (mminfo.mainmem/1024); + US_Print ("k\nFree :"); + US_PrintUnsigned (MM_UnusedMemory()/1024); + US_Print ("k\nWith purge:"); + US_PrintUnsigned (MM_TotalFree()/1024); + US_Print ("k\n"); + VW_UpdateScreen();*/ + if(q){ + printf("========================================\n"); + printf(" DebugMemory_\n"); + printf("========================================\n");} + if(q) { printf("Memory Usage\n"); + printf("------------\n"); }else printf(" %c%c", 0xD3, 0xC4); + printf("Total: "); if(q) printf(" "); printf("%uk", gvar->mmi.mainmem/1024); + if(q) printf("\n"); else printf(" "); + printf("Free: "); if(q) printf(" "); printf("%uk", MM_UnusedMemory(gvar)/1024); + if(q) printf("\n"); else printf(" "); + printf("With purge:"); if(q) printf(" "); printf("%uk\n", MM_TotalFree(gvar)/1024); + if(q) printf("------------\n"); +#ifdef __WATCOMC__ + IN_Ack (); +#endif + if(q) MM_ShowMemory (gvar); +} +#ifdef __WATCOMC__ +/* +========================== += += Quit += +========================== +*/ + +void Quit (char *error) +{ + unsigned finscreen; + memptr screen; + union REGS in, out; + + //ClearMemory (); + if (!*error) + { + //WriteConfig (); + } + else + { + //CA_CacheGrChunk (ERRORSCREEN); + //screen = grsegs[ERRORSCREEN]; + } + + //ShutdownId (); + IN_Shutdown(); + //modexLeave(); + in.h.ah = 0x00; + in.h.al = 0x3; + int86(0x10, &in, &out); + + if (error && *error) + { + //movedata ((unsigned)screen,7,0xb800,0,7*160); + //gotoxy (10,4); + fprintf(stderr, "%s\n", error); + //gotoxy (1,8); + exit(1); + } + else + if (!error || !(*error)) + { + //clrscr(); + //#ifndef JAPAN + movedata ((unsigned)screen,7,0xb800,0,4000); + //gotoxy(1,24); + //#endif +//asm mov bh,0 +//asm mov dh,23 // row +//asm mov dl,0 // collumn +//asm mov ah,2 +//asm int 0x10 + } + + exit(0); +} +#endif + +//=========================================================================== diff --git a/16/16_tail.h b/16/16_tail.h new file mode 100755 index 00000000..6dddc516 --- /dev/null +++ b/16/16_tail.h @@ -0,0 +1,36 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#ifndef __16_TAIL__ +#define __16_TAIL__ + +#include "src/lib/16_head.h" +#include "src/lib/16_pm.h" +#include "src/lib/16_mm.h" +#include "src/lib/16_in.h" + +void DebugMemory_(global_game_variables_t *gvar, boolean q); +#ifdef __WATCOMC__ +void Quit (char *error); +#endif + +#endif diff --git a/src/lib/jsmn b/src/lib/jsmn index 6021415c..0f574ea3 160000 --- a/src/lib/jsmn +++ b/src/lib/jsmn @@ -1 +1 @@ -Subproject commit 6021415cc75e7922d45b12935f56348b064d8a7f +Subproject commit 0f574ea35becadb10f302795a5ffbc0b8bda8934 diff --git a/swaptail.sh b/swaptail.sh new file mode 100755 index 00000000..7e9180d3 --- /dev/null +++ b/swaptail.sh @@ -0,0 +1,8 @@ +#!/bin/bash +mv src/lib/16_tail.c 16/1__tail.c +mv 16/_6_tail.c src/lib/16_tail.c +mv 16/1__tail.c 16/_6_tail.c +mv src/lib/16_tail.h 16/1__tail.h +mv 16/_6_tail.h src/lib/16_tail.h +mv 16/1__tail.h 16/_6_tail.h +