*\r
*/\r
/*\r
- * 16 library\r
+ * 16 tail library\r
*/\r
\r
#include "src/lib/16_tail.h"\r
#include "src/lib/16text.h"\r
\r
+static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
+\r
/*\r
==========================\r
=\r
{\r
#ifdef __WATCOMC__\r
start_timer(gvar);\r
-\r
- // DOSLIB: check our environment\r
- probe_dos();\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
- cpu_probe();\r
-\r
- // DOSLIB: check for VGA\r
- if (!probe_vga()) {\r
- printf("VGA probe failed\n");\r
- return;\r
- }\r
- // hardware must be VGA or higher!\r
- if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
- printf("This program requires VGA or higher graphics hardware\n");\r
- return;\r
- }\r
-\r
- if (_DEBUG_INIT() == 0) {\r
-#ifdef DEBUGSERIAL\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
- _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);\r
-\r
- textInit();\r
#endif\r
+ gvar->video.VL_Started=0;\r
+ TL_VidInit(gvar);\r
gvar->mm.mmstarted=0;\r
gvar->pm.PMStarted=0;\r
MM_Startup(gvar);\r
CA_Shutdown(gvar);\r
MM_Shutdown(gvar);\r
#ifdef __WATCOMC__\r
- VGAmodeX(0, 1, gvar);\r
+ if(gvar->video.VL_Started)\r
+ VGAmodeX(0, 1, gvar);\r
+#endif\r
+}\r
+\r
+void TL_VidInit(global_game_variables_t *gvar)\r
+{\r
+#ifdef __WATCOMC__\r
+ // DOSLIB: check our environment\r
+ probe_dos();\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
+ cpu_probe();\r
+\r
+ // DOSLIB: check for VGA\r
+ if (!probe_vga()) {\r
+ printf("VGA probe failed\n");\r
+ return;\r
+ }\r
+ // hardware must be VGA or higher!\r
+ if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
+ printf("This program requires VGA or higher graphics hardware\n");\r
+ return;\r
+ }\r
+\r
+ if (_DEBUG_INIT() == 0) {\r
+#ifdef DEBUGSERIAL\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
+ _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);\r
+\r
+ textInit();\r
+\r
+ // get old video mode\r
+ //in.h.ah = 0xf;\r
+ //int86(0x10, &in, &out);\r
+ if(!gvar->video.old_mode) gvar->video.old_mode = vgaGetMode();//out.h.al;\r
+#else\r
+ gvar->video.old_mode = 3;\r
#endif\r
}\r
\r
\r
//===========================================================================\r
\r
+/*\r
+===================\r
+=\r
+= FizzleFade\r
+=\r
+===================\r
+*/\r
+\r
+#define PIXPERFRAME 1600\r
+\r
+void FizzleFade (unsigned source, unsigned dest,\r
+ unsigned width,unsigned height, boolean abortable, global_game_variables_t *gv)\r
+{\r
+ unsigned drawofs,pagedelta;\r
+ unsigned char maskb[8] = {1,2,4,8,16,32,64,128};\r
+ unsigned x,y,p,frame;\r
+ long rndval;\r
+ word TimeCount = *clockw;\r
+ word screenseg = SCREENSEG;\r
+\r
+ pagedelta = dest-source;\r
+//++++ VL_SetScreen (dest,0);\r
+ rndval = 1;\r
+ x = y = 0;\r
+\r
+ __asm {\r
+ mov es,[screenseg]\r
+ mov dx,SC_INDEX\r
+ mov al,SC_MAPMASK\r
+ out dx,al\r
+ }\r
+\r
+ TimeCount=frame=0;\r
+ do // while (1)\r
+ {\r
+ if (abortable)\r
+ {\r
+ IN_ReadControl(0,gv);\r
+ if (gv->player[0].info.button0 || gv->player[0].info.button1 || gv->in.inst->Keyboard[sc_Space]\r
+ || gv->in.inst->Keyboard[sc_Enter])\r
+ {\r
+//++++ VW_ScreenToScreen (source,dest,width/8,height);\r
+ return;\r
+ }\r
+ }\r
+\r
+ for (p=0;p<PIXPERFRAME;p++)\r
+ {\r
+ //\r
+ // seperate random value into x/y pair\r
+ //\r
+ __asm {\r
+ mov ax,[WORD PTR rndval]\r
+ mov dx,[WORD PTR rndval+2]\r
+ mov bx,ax\r
+ dec bl\r
+ mov [BYTE PTR y],bl // low 8 bits - 1 = y xoordinate\r
+ mov bx,ax\r
+ mov cx,dx\r
+ shr cx,1\r
+ rcr bx,1\r
+ shr bx,1\r
+ shr bx,1\r
+ shr bx,1\r
+ shr bx,1\r
+ shr bx,1\r
+ shr bx,1\r
+ shr bx,1\r
+ mov [x],bx // next 9 bits = x xoordinate\r
+ //\r
+ // advance to next random element\r
+ //\r
+ shr dx,1\r
+ rcr ax,1\r
+ jnc noxor\r
+ xor dx,0x0001\r
+ xor ax,0x2000\r
+#ifdef __BORLANDC__\r
+ }\r
+#endif\r
+noxor:\r
+#ifdef __BORLANDC__\r
+ __asm {\r
+#endif\r
+ mov [WORD PTR rndval],ax\r
+ mov [WORD PTR rndval+2],dx\r
+ }\r
+\r
+ if (x>width || y>height)\r
+ continue;\r
+ drawofs = source+gv->video.ofs.ylookup[y];\r
+\r
+ __asm {\r
+ mov cx,[x]\r
+ mov si,cx\r
+ and si,7\r
+ mov dx,GC_INDEX\r
+ mov al,GC_BITMASK\r
+ mov ah,BYTE PTR [maskb+si]\r
+ out dx,ax\r
+\r
+ mov si,[drawofs]\r
+ shr cx,1\r
+ shr cx,1\r
+ shr cx,1\r
+ add si,cx\r
+ mov di,si\r
+ add di,[pagedelta]\r
+\r
+ mov dx,GC_INDEX\r
+ mov al,GC_READMAP // leave GC_INDEX set to READMAP\r
+ out dx,al\r
+\r
+ mov dx,SC_INDEX+1\r
+ mov al,1\r
+ out dx,al\r
+ mov dx,GC_INDEX+1\r
+ mov al,0\r
+ out dx,al\r
+\r
+ mov bl,[es:si]\r
+ xchg [es:di],bl\r
+\r
+ mov dx,SC_INDEX+1\r
+ mov al,2\r
+ out dx,al\r
+ mov dx,GC_INDEX+1\r
+ mov al,1\r
+ out dx,al\r
+\r
+ mov bl,[es:si]\r
+ xchg [es:di],bl\r
+\r
+ mov dx,SC_INDEX+1\r
+ mov al,4\r
+ out dx,al\r
+ mov dx,GC_INDEX+1\r
+ mov al,2\r
+ out dx,al\r
+\r
+ mov bl,[es:si]\r
+ xchg [es:di],bl\r
+\r
+ mov dx,SC_INDEX+1\r
+ mov al,8\r
+ out dx,al\r
+ mov dx,GC_INDEX+1\r
+ mov al,3\r
+ out dx,al\r
+\r
+ mov bl,[es:si]\r
+ xchg [es:di],bl\r
+ }\r
+\r
+ if (rndval == 1) // entire sequence has been completed\r
+ {\r
+//++++ VGABITMASK(255);\r
+//++++ VGAMAPMASK(15);\r
+ return;\r
+ }\r
+ }\r
+ frame++;\r
+//++++ while (TimeCount<frame){} // don't go too fast\r
+ } while (1);\r
+\r
+\r
+}\r
+\r
+//===========================================================================\r
+\r
/*\r
==================\r
=\r
#ifdef __WATCOMC__\r
//IN_Ack ();\r
#endif\r
- if(q) MM_ShowMemory (gvar);\r
+// if(q) MM_ShowMemory (gvar);\r
}\r
\r
/*\r
printf(" sizeof(boolean)=%s\n", boolean_to_binary(sizeof(boolean)));\r
printf("end of boolean test\n");\r
}\r
+\r
+#ifdef __BORLANDC__\r
+word modexPalOverscan(word col)\r
+{\r
+ //modexWaitBorder();\r
+ outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */\r
+ outp(PAL_DATA_REG, col);\r
+ return col;\r
+}\r
+#endif\r