/* ================ Sys_DoubleTime ================ */ double Sys_DoubleTime ( void ) { int r; unsigned t, tick; double ft, time; static int sametimecount; Sys_PushFPCW_SetHigh (); //{static float t = 0; t=t+0.05; return t;} // DEBUG t = *(unsigned short*)real2ptr(0x46c) * 65536; dos_outportb(0x43, 0); // latch time r = dos_inportb(0x40); r |= dos_inportb(0x40) << 8; r = (r-1) & 0xffff; tick = *(unsigned short*)real2ptr(0x46c) * 65536; if ((tick != t) && (r & 0x8000)) t = tick; ft = (double) (t+(65536-r)) / 1193200.0; time = ft - oldtime; oldtime = ft; if (time < 0) { if (time > -3000.0) time = 0.0; else time += 3600.0; } curtime += time; if (curtime == lastcurtime) { sametimecount++; if (sametimecount > 100000) { curtime += 1.0; sametimecount = 0; } } else { sametimecount = 0; } lastcurtime = curtime; Sys_PopFPCW (); return curtime; }
void Sys_Quit (void) { byte screen[80*25*2]; // byte *d; // 2001-09-12 Returning information about loaded file by Maddes char ver[6]; int i; loadedfile_t *fileinfo; // 2001-09-12 Returning information about loaded file by Maddes // load the sell screen before shuting everything down if (registered->value) // 2001-09-12 Returning information about loaded file by Maddes start // d = COM_LoadHunkFile ("end2.bin"); fileinfo = COM_LoadHunkFile ("end2.bin"); // 2001-09-12 Returning information about loaded file by Maddes end else // 2001-09-12 Returning information about loaded file by Maddes start // d = COM_LoadHunkFile ("end1.bin"); fileinfo = COM_LoadHunkFile ("end1.bin"); // 2001-09-12 Returning information about loaded file by Maddes end // 2001-09-12 Returning information about loaded file by Maddes start /* if (d) memcpy (screen, d, sizeof(screen)); */ if (fileinfo) memcpy (screen, fileinfo->data, sizeof(screen)); // 2001-09-12 Returning information about loaded file by Maddes end // write the version number directly to the end screen sprintf (ver, " v%4.2f", VERSION); for (i=0 ; i<6 ; i++) screen[0*80*2 + 72*2 + i*2] = ver[i]; Host_Shutdown(); // do the text mode sell screen // 2001-09-12 Returning information about loaded file by Maddes start // if (d) if (fileinfo) // 2001-09-12 Returning information about loaded file by Maddes end { memcpy ((void *)real2ptr(0xb8000), screen,80*25*2); // set text pos regs.x.ax = 0x0200; regs.h.bh = 0; regs.h.dl = 0; regs.h.dh = 22; dos_int86 (0x10); } else printf ("couldn't load endscreen.\n"); exit(0); }
void Sys_Quit(void) { byte screen[80*25*2]; byte *d; char ver[6]; int i; // load the sell screen before shuting everything down if (registered.value) { d = COM_LoadHunkFile("end2.bin"); } else { d = COM_LoadHunkFile("end1.bin"); } if (d) { memcpy(screen, d, sizeof(screen)); } // write the version number directly to the end screen sprintf(ver, " v%4.2f", VERSION); for (i=0 ; i<6 ; i++) { screen[0*80*2 + 72*2 + i*2] = ver[i]; } Host_Shutdown(); // do the text mode sell screen if (d) { memcpy((void *)real2ptr(0xb8000), screen,80*25*2); // set text pos regs.x.ax = 0x0200; regs.h.bh = 0; regs.h.dl = 0; regs.h.dh = 22; dos_int86(0x10); } else { printf("couldn't load endscreen.\n"); } exit(0); }
/* ================ VID_InitExtra ================ */ void VID_InitExtra (void) { int nummodes; short *pmodenums; vbeinfoblock_t *pinfoblock; __dpmi_meminfo phys_mem_info; pinfoblock = dos_getmemory(sizeof(vbeinfoblock_t)); *(long *)pinfoblock->VbeSignature = 'V' + ('B'<<8) + ('E'<<16) + ('2'<<24); // see if VESA support is available regs.x.ax = 0x4f00; regs.x.es = ptr2real(pinfoblock) >> 4; regs.x.di = ptr2real(pinfoblock) & 0xf; dos_int86(0x10); if (regs.x.ax != 0x4f) return; // no VESA support if (pinfoblock->VbeVersion[1] < 0x02) return; // not VESA 2.0 or greater Con_Printf ("VESA 2.0 compliant adapter:\n%s\n", VID_ExtraFarToLinear (*(byte **)&pinfoblock->OemStringPtr[0])); totalvidmem = *(unsigned short *)&pinfoblock->TotalMemory[0] << 16; pmodenums = (short *) VID_ExtraFarToLinear (*(byte **)&pinfoblock->VideoModePtr[0]); // find 8 bit modes until we either run out of space or run out of modes nummodes = 0; while ((*pmodenums != -1) && (nummodes < MAX_VESA_MODES)) { if (VID_ExtraGetModeInfo (*pmodenums)) { vesa_modes[nummodes].pnext = &vesa_modes[nummodes+1]; if (modeinfo.width > 999) { if (modeinfo.height > 999) { sprintf (&names[nummodes][0], "%4dx%4d", modeinfo.width, modeinfo.height); names[nummodes][9] = 0; } else { sprintf (&names[nummodes][0], "%4dx%3d", modeinfo.width, modeinfo.height); names[nummodes][8] = 0; } } else { if (modeinfo.height > 999) { sprintf (&names[nummodes][0], "%3dx%4d", modeinfo.width, modeinfo.height); names[nummodes][8] = 0; } else { sprintf (&names[nummodes][0], "%3dx%3d", modeinfo.width, modeinfo.height); names[nummodes][7] = 0; } } vesa_modes[nummodes].name = &names[nummodes][0]; vesa_modes[nummodes].width = modeinfo.width; vesa_modes[nummodes].height = modeinfo.height; vesa_modes[nummodes].aspect = ((float)modeinfo.height / (float)modeinfo.width) * (320.0 / 240.0); vesa_modes[nummodes].rowbytes = modeinfo.bytes_per_scanline; vesa_modes[nummodes].planar = 0; vesa_modes[nummodes].pextradata = &vesa_extra[nummodes]; vesa_modes[nummodes].setmode = VID_ExtraInitMode; vesa_modes[nummodes].swapbuffers = VID_ExtraSwapBuffers; vesa_modes[nummodes].setpalette = VID_SetVESAPalette; if (modeinfo.mode_attributes & LINEAR_FRAME_BUFFER) { // add linear bit to mode for linear modes vesa_extra[nummodes].vesamode = modeinfo.modenum | LINEAR_MODE; vesa_extra[nummodes].pages[0] = 0; vesa_extra[nummodes].pages[1] = modeinfo.pagesize; vesa_extra[nummodes].pages[2] = modeinfo.pagesize * 2; vesa_modes[nummodes].numpages = modeinfo.numpages; vesa_modes[nummodes].begindirectrect = VGA_BeginDirectRect; vesa_modes[nummodes].enddirectrect = VGA_EndDirectRect; phys_mem_info.address = (int)modeinfo.pptr; phys_mem_info.size = 0x400000; if (__dpmi_physical_address_mapping(&phys_mem_info)) goto NextMode; vesa_extra[nummodes].plinearmem = real2ptr (phys_mem_info.address); } else { // banked at 0xA0000 vesa_extra[nummodes].vesamode = modeinfo.modenum; vesa_extra[nummodes].pages[0] = 0; vesa_extra[nummodes].plinearmem = real2ptr(modeinfo.winasegment<<4); vesa_modes[nummodes].begindirectrect = VGA_BankedBeginDirectRect; vesa_modes[nummodes].enddirectrect = VGA_BankedEndDirectRect; vesa_extra[nummodes].pages[1] = modeinfo.pagesize; vesa_extra[nummodes].pages[2] = modeinfo.pagesize * 2; vesa_modes[nummodes].numpages = modeinfo.numpages; } vesa_extra[nummodes].vga_incompatible = modeinfo.mode_attributes & VGA_INCOMPATIBLE; nummodes++; } NextMode: pmodenums++; } // add the VESA modes at the start of the mode list (if there are any) if (nummodes) { vesa_modes[nummodes-1].pnext = pvidmodes; pvidmodes = &vesa_modes[0]; numvidmodes += nummodes; ppal = dos_getmemory(256*4); } dos_freememory(pinfoblock); }