2017-05-30 03:38:38 +02:00
|
|
|
/*
|
|
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Emulation core dispatcher.
|
|
|
|
|
*
|
2017-10-07 00:46:54 -04:00
|
|
|
* Version: @(#)pc.c 1.0.17 2017/10/04
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2017-06-04 02:11:19 -04:00
|
|
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
2017-05-30 03:38:38 +02:00
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
2017-10-01 16:56:15 -04:00
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
2017-05-30 03:38:38 +02:00
|
|
|
* Copyright 2008-2017 Sarah Walker.
|
2017-08-25 02:21:26 -04:00
|
|
|
* Copyright 2016,2017 Miran Grca.
|
2017-10-01 16:56:15 -04:00
|
|
|
* Copyright 2017 Fred N. van Kempen.
|
2017-05-30 03:38:38 +02:00
|
|
|
*/
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <stdio.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdint.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <stdlib.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <string.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <stdarg.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <wchar.h>
|
2017-05-05 01:49:42 +02:00
|
|
|
#include "86box.h"
|
2017-09-04 01:52:29 -04:00
|
|
|
#include "config.h"
|
2017-05-05 01:49:42 +02:00
|
|
|
#include "ibm.h"
|
2017-10-07 00:46:54 -04:00
|
|
|
#include "io.h"
|
2017-05-06 17:48:33 +02:00
|
|
|
#include "mem.h"
|
2017-09-25 04:31:20 -04:00
|
|
|
#include "rom.h"
|
2017-08-27 04:33:47 +01:00
|
|
|
#include "cpu/codegen.h"
|
2017-09-02 23:39:26 +02:00
|
|
|
#include "cpu/cpu.h"
|
2017-05-06 17:48:33 +02:00
|
|
|
#include "dma.h"
|
2017-09-04 01:52:29 -04:00
|
|
|
#include "random.h"
|
2017-05-05 01:49:42 +02:00
|
|
|
#include "device.h"
|
2017-10-02 02:15:35 -04:00
|
|
|
#include "cdrom/cdrom.h"
|
|
|
|
|
#include "cdrom/cdrom_image.h"
|
|
|
|
|
#include "cdrom/cdrom_ioctl.h"
|
|
|
|
|
#include "cdrom/cdrom_null.h"
|
|
|
|
|
#include "disk/hdd.h"
|
|
|
|
|
#include "disk/hdc.h"
|
|
|
|
|
#include "disk/hdc_ide.h"
|
2017-09-04 01:52:29 -04:00
|
|
|
#include "floppy/floppy.h"
|
|
|
|
|
#include "floppy/floppy_86f.h"
|
|
|
|
|
#include "floppy/floppy_fdi.h"
|
|
|
|
|
#include "floppy/floppy_imd.h"
|
|
|
|
|
#include "floppy/floppy_img.h"
|
|
|
|
|
#include "floppy/floppy_td0.h"
|
|
|
|
|
#include "floppy/fdc.h"
|
|
|
|
|
#include "floppy/fdd.h"
|
2017-10-02 02:15:35 -04:00
|
|
|
#include "game/gameport.h"
|
2016-06-26 00:34:39 +02:00
|
|
|
#include "keyboard.h"
|
|
|
|
|
#include "keyboard_at.h"
|
2017-09-02 23:39:26 +02:00
|
|
|
#include "lpt.h"
|
|
|
|
|
#include "machine/machine.h"
|
2017-08-27 04:33:47 +01:00
|
|
|
#include "sound/midi.h"
|
2016-06-26 00:34:39 +02:00
|
|
|
#include "mouse.h"
|
2017-08-27 04:33:47 +01:00
|
|
|
#include "network/network.h"
|
2017-09-02 23:39:26 +02:00
|
|
|
#include "nvr.h"
|
|
|
|
|
#include "pic.h"
|
|
|
|
|
#include "pit.h"
|
2017-06-19 06:46:08 +02:00
|
|
|
#ifdef WALTJE
|
|
|
|
|
# define UNICODE
|
2017-09-25 04:31:20 -04:00
|
|
|
# include <direct.h>
|
2017-09-02 23:39:26 +02:00
|
|
|
# include "win/plat_dir.h"
|
2017-06-19 06:46:08 +02:00
|
|
|
# undef UNICODE
|
|
|
|
|
#endif
|
2017-09-02 23:39:26 +02:00
|
|
|
#include "win/plat_joystick.h"
|
|
|
|
|
#include "win/plat_keyboard.h"
|
|
|
|
|
#include "win/plat_midi.h"
|
|
|
|
|
#include "win/plat_mouse.h"
|
|
|
|
|
#include "win/plat_ui.h"
|
2017-10-03 16:26:55 -04:00
|
|
|
#include "win/win.h"
|
2017-10-07 00:46:54 -04:00
|
|
|
#include "win/win_language.h"
|
2017-08-27 04:33:47 +01:00
|
|
|
#include "scsi/scsi.h"
|
2016-06-26 00:34:39 +02:00
|
|
|
#include "serial.h"
|
2017-08-27 04:33:47 +01:00
|
|
|
#include "sound/sound.h"
|
|
|
|
|
#include "sound/snd_cms.h"
|
|
|
|
|
#include "sound/snd_dbopl.h"
|
|
|
|
|
#include "sound/snd_mpu401.h"
|
|
|
|
|
#include "sound/snd_opl.h"
|
|
|
|
|
#include "sound/snd_gus.h"
|
|
|
|
|
#include "sound/snd_sb.h"
|
|
|
|
|
#include "sound/snd_speaker.h"
|
|
|
|
|
#include "sound/snd_ssi2001.h"
|
2017-09-02 23:39:26 +02:00
|
|
|
#include "timer.h"
|
2017-08-27 04:33:47 +01:00
|
|
|
#include "video/video.h"
|
|
|
|
|
#include "video/vid_voodoo.h"
|
2017-09-02 23:39:26 +02:00
|
|
|
#include "cpu/x86_ops.h"
|
2017-05-06 17:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
int window_w, window_h, window_x, window_y, window_remember;
|
|
|
|
|
int dump_on_exit = 0;
|
|
|
|
|
int start_in_fullscreen = 0;
|
|
|
|
|
int CPUID;
|
|
|
|
|
int vid_resize, vid_api;
|
|
|
|
|
int output;
|
|
|
|
|
int atfullspeed;
|
|
|
|
|
int cycles_lost = 0;
|
|
|
|
|
int clockrate;
|
|
|
|
|
int insc = 0;
|
|
|
|
|
float mips, flops;
|
|
|
|
|
int framecount, fps;
|
|
|
|
|
int win_title_update = 0;
|
|
|
|
|
int updatestatus = 0;
|
|
|
|
|
int pollmouse_delay = 2;
|
|
|
|
|
int mousecapture;
|
|
|
|
|
int suppress_overscan = 0;
|
|
|
|
|
int cpuspeed2;
|
2017-10-03 16:26:55 -04:00
|
|
|
wchar_t exe_path[1024];
|
|
|
|
|
wchar_t cfg_path[1024];
|
2016-06-26 00:34:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
extern int mmuflush;
|
|
|
|
|
extern int readlnum,writelnum;
|
|
|
|
|
|
2017-05-07 02:14:44 -04:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
/* Log something to the logfile or stdout. */
|
|
|
|
|
void
|
|
|
|
|
pclog(const char *format, ...)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
|
|
|
|
#ifndef RELEASE_BUILD
|
|
|
|
|
va_list ap;
|
|
|
|
|
va_start(ap, format);
|
|
|
|
|
vprintf(format, ap);
|
|
|
|
|
va_end(ap);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
|
|
|
|
/* Log a fatal error, and display a UI message before exiting. */
|
|
|
|
|
void
|
|
|
|
|
fatal(const char *format, ...)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-02-21 01:18:46 +01:00
|
|
|
char msg[1024];
|
2016-06-26 00:34:39 +02:00
|
|
|
va_list ap;
|
2017-10-02 02:15:35 -04:00
|
|
|
char *sp;
|
|
|
|
|
|
2016-06-26 00:34:39 +02:00
|
|
|
va_start(ap, format);
|
2017-02-21 01:18:46 +01:00
|
|
|
vsprintf(msg, format, ap);
|
|
|
|
|
printf(msg);
|
2016-06-26 00:34:39 +02:00
|
|
|
va_end(ap);
|
|
|
|
|
fflush(stdout);
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-03 16:26:55 -04:00
|
|
|
nvr_save();
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
config_save();
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2016-06-26 00:34:39 +02:00
|
|
|
dumppic();
|
2017-05-05 01:49:42 +02:00
|
|
|
dumpregs(1);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
/* Make sure the message does not have a trailing newline. */
|
|
|
|
|
if ((sp = strchr(msg, '\n')) != NULL) *sp = '\0';
|
2017-05-07 02:14:44 -04:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
#ifndef __unix
|
|
|
|
|
plat_msgbox_fatal(msg);
|
|
|
|
|
#endif
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
fflush(stdout);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
exit(-1);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-03 16:26:55 -04:00
|
|
|
/*
|
|
|
|
|
* This function returns the absolute pathname to a file (str)
|
|
|
|
|
* that is to be found in the user (formerly 'nvr_path' area.
|
|
|
|
|
*/
|
|
|
|
|
wchar_t *
|
|
|
|
|
pc_concat(wchar_t *str)
|
|
|
|
|
{
|
|
|
|
|
static wchar_t temp[1024];
|
|
|
|
|
|
|
|
|
|
/* Get the full prefix in place. */
|
|
|
|
|
memset(temp, 0x00, sizeof(temp));
|
|
|
|
|
wcscpy(temp, cfg_path);
|
|
|
|
|
|
|
|
|
|
#ifndef __unix
|
|
|
|
|
/* Create the directory if needed. */
|
|
|
|
|
if (! DirectoryExists(temp))
|
|
|
|
|
CreateDirectory(temp, NULL);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Now append the actual filename. */
|
|
|
|
|
wcscat(temp, L"\\");
|
|
|
|
|
wcscat(temp, str);
|
|
|
|
|
|
|
|
|
|
return(temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
/*
|
|
|
|
|
* Perform initial startup of the PC.
|
|
|
|
|
*
|
|
|
|
|
* This is the platform-indepenent part of the startup,
|
|
|
|
|
* where we check commandline arguments and loading a
|
|
|
|
|
* configuration file.
|
|
|
|
|
*/
|
2017-10-07 00:46:54 -04:00
|
|
|
int
|
2017-10-02 02:15:35 -04:00
|
|
|
pc_init(int argc, wchar_t *argv[])
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-03 16:26:55 -04:00
|
|
|
wchar_t *cfg = NULL;
|
2017-10-02 02:15:35 -04:00
|
|
|
wchar_t *p;
|
2017-06-16 06:44:11 +02:00
|
|
|
#ifdef WALTJE
|
2017-10-02 02:15:35 -04:00
|
|
|
struct direct *dp;
|
|
|
|
|
DIR *dir;
|
2017-06-16 06:44:11 +02:00
|
|
|
#endif
|
2017-10-02 02:15:35 -04:00
|
|
|
int c;
|
|
|
|
|
|
|
|
|
|
/* Grab the executable's full path. */
|
|
|
|
|
get_executable_name(exe_path, sizeof(exe_path)-1);
|
|
|
|
|
p = get_filename_w(exe_path);
|
|
|
|
|
*p = L'\0';
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get the current working directory.
|
|
|
|
|
* This is normally the directory from where the
|
|
|
|
|
* program was run. If we have been started via
|
|
|
|
|
* a shortcut (desktop icon), however, the CWD
|
|
|
|
|
* could have been set to something else.
|
|
|
|
|
*/
|
|
|
|
|
_wgetcwd(cfg_path, sizeof(cfg_path)-1);
|
|
|
|
|
|
|
|
|
|
for (c=1; c<argc; c++) {
|
|
|
|
|
if (! _wcsicmp(argv[c], L"--help")) {
|
2017-09-23 21:12:26 -04:00
|
|
|
usage:
|
2017-10-07 00:46:54 -04:00
|
|
|
printf("\nCommand line options:\n\n");
|
|
|
|
|
printf("--config file.cfg - use given file as configuration\n");
|
|
|
|
|
printf("--dump - always dump memory on exit\n");
|
|
|
|
|
printf("--fullscreen - start in fullscreen mode\n");
|
|
|
|
|
printf("--vmpath pathname - set 'path' to be root for vm\n");
|
|
|
|
|
return(0);
|
2017-10-02 02:15:35 -04:00
|
|
|
} else if (!_wcsicmp(argv[c], L"--config") ||
|
|
|
|
|
!_wcsicmp(argv[c], L"-C")) {
|
|
|
|
|
if ((c+1) == argc) break;
|
|
|
|
|
|
2017-10-03 16:26:55 -04:00
|
|
|
cfg = argv[++c];
|
2017-10-02 02:15:35 -04:00
|
|
|
} else if (!_wcsicmp(argv[c], L"--dump") ||
|
|
|
|
|
!_wcsicmp(argv[c], L"-D")) {
|
|
|
|
|
dump_on_exit = 1;
|
|
|
|
|
} else if (!_wcsicmp(argv[c], L"--fullscreen") ||
|
|
|
|
|
!_wcsicmp(argv[c], L"-F")) {
|
|
|
|
|
start_in_fullscreen = 1;
|
|
|
|
|
} else if (!_wcsicmp(argv[c], L"--test")) {
|
|
|
|
|
/* some (undocumented) test function here.. */
|
2017-05-12 22:16:19 -04:00
|
|
|
#ifdef WALTJE
|
2017-10-02 02:15:35 -04:00
|
|
|
dir = opendirw(exe_path);
|
|
|
|
|
if (dir != NULL) {
|
2017-10-03 16:26:55 -04:00
|
|
|
printf("Directory '%ws':\n", exe_path);
|
2017-10-02 02:15:35 -04:00
|
|
|
for (;;) {
|
|
|
|
|
dp = readdir(dir);
|
|
|
|
|
if (dp == NULL) break;
|
2017-10-03 16:26:55 -04:00
|
|
|
printf(">> '%ws'\n", dp->d_name);
|
2017-05-12 22:16:19 -04:00
|
|
|
}
|
2017-10-02 02:15:35 -04:00
|
|
|
closedir(dir);
|
|
|
|
|
} else {
|
2017-10-03 16:26:55 -04:00
|
|
|
printf("Could not open '%ws'..\n", exe_path);
|
2017-10-02 02:15:35 -04:00
|
|
|
}
|
2017-05-12 22:16:19 -04:00
|
|
|
#endif
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
/* .. and then exit. */
|
2017-10-07 00:46:54 -04:00
|
|
|
return(0);
|
2017-10-02 02:15:35 -04:00
|
|
|
} else if (!_wcsicmp(argv[c], L"--vmpath") ||
|
|
|
|
|
!_wcsicmp(argv[c], L"-P")) {
|
|
|
|
|
if ((c+1) == argc) break;
|
|
|
|
|
|
|
|
|
|
wcscpy(cfg_path, argv[++c]);
|
2016-09-27 21:38:29 +02:00
|
|
|
}
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
/* Uhm... out of options here.. */
|
|
|
|
|
else goto usage;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/*
|
|
|
|
|
* This is where we start outputting to the log file,
|
|
|
|
|
* if there is one. Maybe we should log a header with
|
|
|
|
|
* application build info and such? --FvK
|
|
|
|
|
*/
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
/* Make sure cfg_path has a trailing backslash. */
|
2017-10-07 00:46:54 -04:00
|
|
|
pclog("exe_path=%ws\n", exe_path);
|
2017-10-02 02:15:35 -04:00
|
|
|
if ((cfg_path[wcslen(cfg_path)-1] != L'\\') &&
|
|
|
|
|
(cfg_path[wcslen(cfg_path)-1] != L'/')) {
|
|
|
|
|
wcscat(cfg_path, L"\\");
|
|
|
|
|
}
|
2017-10-03 16:26:55 -04:00
|
|
|
pclog("cfg_path=%ws\n", cfg_path);
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-03 16:26:55 -04:00
|
|
|
if (cfg != NULL) {
|
2017-10-01 16:29:15 -04:00
|
|
|
/*
|
2017-10-02 02:15:35 -04:00
|
|
|
* The user specified a configuration file.
|
|
|
|
|
*
|
|
|
|
|
* If this is an absolute path, keep it, as
|
|
|
|
|
* they probably have a reason to do that.
|
|
|
|
|
* Otherwise, assume the pathname given is
|
|
|
|
|
* relative to whatever the cfg_path is.
|
2017-10-01 16:29:15 -04:00
|
|
|
*/
|
2017-10-03 16:26:55 -04:00
|
|
|
if ((cfg[1] == L':') || /* drive letter present */
|
|
|
|
|
(cfg[0] == L'\\')) /* backslash, root dir */
|
2017-10-02 02:15:35 -04:00
|
|
|
append_filename_w(config_file_default,
|
2017-10-03 16:26:55 -04:00
|
|
|
NULL, cfg, 511);
|
2017-10-02 02:15:35 -04:00
|
|
|
else
|
|
|
|
|
append_filename_w(config_file_default,
|
2017-10-03 16:26:55 -04:00
|
|
|
cfg_path, cfg, 511);
|
|
|
|
|
cfg = NULL;
|
2017-10-02 02:15:35 -04:00
|
|
|
} else {
|
|
|
|
|
append_filename_w(config_file_default, cfg_path, CONFIG_FILE_W, 511);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* We are about to read the configuration file, which MAY
|
|
|
|
|
* put data into global variables (the hard- and floppy
|
|
|
|
|
* disks are an example) so we have to initialize those
|
|
|
|
|
* modules before we load the config..
|
|
|
|
|
*/
|
|
|
|
|
hdd_init();
|
2017-10-07 00:46:54 -04:00
|
|
|
network_init();
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Load the configuration file. */
|
2017-10-03 16:26:55 -04:00
|
|
|
config_load(cfg);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
/* All good! */
|
|
|
|
|
return(1);
|
2017-10-02 02:15:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pc_full_speed(void)
|
|
|
|
|
{
|
|
|
|
|
cpuspeed2 = cpuspeed;
|
|
|
|
|
|
|
|
|
|
if (! atfullspeed) {
|
|
|
|
|
pclog("Set fullspeed - %i %i %i\n", is386, AT, cpuspeed2);
|
|
|
|
|
if (AT)
|
|
|
|
|
setpitclock(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed);
|
|
|
|
|
else
|
|
|
|
|
setpitclock(14318184.0);
|
|
|
|
|
}
|
|
|
|
|
atfullspeed = 1;
|
2017-10-01 16:29:15 -04:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
nvr_recalc();
|
2017-05-29 01:18:32 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pc_speed_changed(void)
|
2017-05-29 01:18:32 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
if (AT)
|
|
|
|
|
setpitclock(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed);
|
|
|
|
|
else
|
|
|
|
|
setpitclock(14318184.0);
|
|
|
|
|
|
|
|
|
|
nvr_recalc();
|
|
|
|
|
}
|
2017-05-29 01:18:32 +02:00
|
|
|
|
2017-02-18 23:45:30 +01:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
/* Initialize modules, ran once, after pc_init. */
|
2017-10-07 00:46:54 -04:00
|
|
|
int
|
2017-10-02 02:15:35 -04:00
|
|
|
pc_init_modules(void)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
int c, i;
|
|
|
|
|
|
|
|
|
|
pclog("Scanning for ROM images:\n");
|
|
|
|
|
c = 0;
|
|
|
|
|
for (i=0; i<ROM_MAX; i++) {
|
|
|
|
|
romspresent[i] = rom_load_bios(i);
|
|
|
|
|
c += romspresent[i];
|
|
|
|
|
}
|
|
|
|
|
if (c == 0) {
|
|
|
|
|
/* No usable ROMs found, aborting. */
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
pclog("A total of %d ROM sets have been loaded.\n", c);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Load the ROMs for the selected machine.
|
|
|
|
|
*
|
|
|
|
|
* FIXME:
|
|
|
|
|
* We should not do that here. If something turns out
|
|
|
|
|
* to be wrong with the configuration (such as missing
|
|
|
|
|
* ROM images, we should just display a fatal message
|
|
|
|
|
* in the render window's center, let them click OK,
|
|
|
|
|
* and then exit so they can remedy the situation.
|
|
|
|
|
*/
|
|
|
|
|
again:
|
|
|
|
|
if (! rom_load_bios(romset)) {
|
|
|
|
|
/* Whoops, ROMs not found. */
|
|
|
|
|
if (romset != -1)
|
|
|
|
|
msgbox_info(hwndMain, IDS_2063);
|
|
|
|
|
|
|
|
|
|
/* Select another machine to use. */
|
|
|
|
|
for (c=0; c<ROM_MAX; c++) {
|
|
|
|
|
if (romspresent[c]) {
|
|
|
|
|
romset = c;
|
|
|
|
|
machine = machine_getmachine(romset);
|
|
|
|
|
config_save();
|
|
|
|
|
|
|
|
|
|
/* This can loop if all ROMs are now bad.. */
|
|
|
|
|
goto again;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make sure we have a usable video card. */
|
|
|
|
|
for (c=0; c<GFX_MAX; c++)
|
|
|
|
|
gfx_present[c] = video_card_available(video_old_to_new(c));
|
|
|
|
|
again2:
|
|
|
|
|
if (! video_card_available(video_old_to_new(gfxcard))) {
|
|
|
|
|
if (romset != -1) {
|
|
|
|
|
msgbox_info(hwndMain, IDS_2064);
|
|
|
|
|
}
|
|
|
|
|
for (c=GFX_MAX-1; c>=0; c--) {
|
|
|
|
|
if (gfx_present[c]) {
|
|
|
|
|
gfxcard = c;
|
|
|
|
|
config_save();
|
|
|
|
|
|
|
|
|
|
/* This can loop if all cards now bad.. */
|
|
|
|
|
goto again2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-02 02:15:35 -04:00
|
|
|
|
|
|
|
|
cpuspeed2 = (AT) ? 2 : 1;
|
|
|
|
|
atfullspeed = 0;
|
|
|
|
|
|
|
|
|
|
random_init();
|
2017-10-01 16:29:15 -04:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
mem_init();
|
2017-10-03 05:33:31 +02:00
|
|
|
|
|
|
|
|
codegen_init();
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
mouse_init();
|
|
|
|
|
#ifdef WALTJE
|
|
|
|
|
serial_init();
|
|
|
|
|
#endif
|
|
|
|
|
joystick_init();
|
|
|
|
|
video_init();
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
ide_init_first();
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
#if 1
|
|
|
|
|
/* should be in cdrom.c */
|
|
|
|
|
cdrom_init_host_drives();
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
for (c=0; c<CDROM_NUM; c++) {
|
|
|
|
|
if (cdrom_drives[c].bus_type) {
|
|
|
|
|
SCSIReset(cdrom_drives[c].scsi_device_id, cdrom_drives[c].scsi_device_lun);
|
2017-10-02 02:15:35 -04:00
|
|
|
}
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (cdrom_drives[c].host_drive == 200) {
|
|
|
|
|
image_open(c, cdrom_image[c].image_path);
|
2017-10-02 02:15:35 -04:00
|
|
|
} else
|
2017-10-07 00:46:54 -04:00
|
|
|
if ((cdrom_drives[c].host_drive>='A') && (cdrom_drives[c].host_drive <= 'Z'))
|
2017-01-16 01:49:19 +01:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
ioctl_open(c, cdrom_drives[c].host_drive);
|
2017-10-02 02:15:35 -04:00
|
|
|
} else {
|
2017-10-07 00:46:54 -04:00
|
|
|
cdrom_null_open(c, cdrom_drives[c].host_drive);
|
2017-01-16 01:49:19 +01:00
|
|
|
}
|
2017-10-02 02:15:35 -04:00
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
device_init();
|
|
|
|
|
|
|
|
|
|
timer_reset();
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
sound_reset();
|
|
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
|
/* This should be in floppy.c and fdc.c --FvK */
|
|
|
|
|
fdc_init();
|
|
|
|
|
|
|
|
|
|
floppy_init();
|
|
|
|
|
fdi_init();
|
|
|
|
|
img_init();
|
|
|
|
|
d86f_init();
|
|
|
|
|
td0_init();
|
|
|
|
|
imd_init();
|
|
|
|
|
|
|
|
|
|
floppy_load(0, floppyfns[0]);
|
|
|
|
|
floppy_load(1, floppyfns[1]);
|
|
|
|
|
floppy_load(2, floppyfns[2]);
|
|
|
|
|
floppy_load(3, floppyfns[3]);
|
|
|
|
|
#endif
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
sound_init();
|
2017-10-01 16:29:15 -04:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
hdc_init(hdc_name);
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
ide_reset();
|
|
|
|
|
|
|
|
|
|
for (i=0; i<CDROM_NUM; i++) {
|
|
|
|
|
if (cdrom_drives[i].host_drive == 200) {
|
|
|
|
|
image_reset(i);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2017-10-02 02:15:35 -04:00
|
|
|
else if ((cdrom_drives[i].host_drive >= 'A') && (cdrom_drives[i].host_drive <= 'Z')) {
|
|
|
|
|
ioctl_reset(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
scsi_card_init();
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
pc_full_speed();
|
2017-10-02 02:15:35 -04:00
|
|
|
shadowbios = 0;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
return(1);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Insert keystrokes into the machine's keyboard buffer. */
|
|
|
|
|
static void
|
2017-10-02 02:15:35 -04:00
|
|
|
pc_keyboard_send(uint8_t val)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
if (AT)
|
|
|
|
|
keyboard_at_adddata_keyboard_raw(val);
|
|
|
|
|
else
|
|
|
|
|
keyboard_send(val);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Send the machine a Control-Alt-DEL sequence. */
|
2017-10-02 02:15:35 -04:00
|
|
|
void
|
|
|
|
|
pc_send_cad(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
pc_keyboard_send(29); /* Ctrl key pressed */
|
|
|
|
|
pc_keyboard_send(56); /* Alt key pressed */
|
|
|
|
|
pc_keyboard_send(83); /* Delete key pressed */
|
|
|
|
|
pc_keyboard_send(157); /* Ctrl key released */
|
|
|
|
|
pc_keyboard_send(184); /* Alt key released */
|
|
|
|
|
pc_keyboard_send(211); /* Delete key released */
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-07-16 22:07:06 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Send the machine a Control-Alt-ESC sequence. */
|
2017-10-02 02:15:35 -04:00
|
|
|
void
|
|
|
|
|
pc_send_cae(void)
|
2017-07-16 22:07:06 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
pc_keyboard_send(29); /* Ctrl key pressed */
|
|
|
|
|
pc_keyboard_send(56); /* Alt key pressed */
|
|
|
|
|
pc_keyboard_send(1); /* Esc key pressed */
|
|
|
|
|
pc_keyboard_send(157); /* Ctrl key released */
|
|
|
|
|
pc_keyboard_send(184); /* Alt key released */
|
|
|
|
|
pc_keyboard_send(129); /* Esc key released */
|
2017-07-16 22:07:06 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-24 01:03:23 +01:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
void
|
2017-10-07 00:46:54 -04:00
|
|
|
pc_reset_hard_close(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
suppress_overscan = 0;
|
2017-01-24 01:03:23 +01:00
|
|
|
|
2017-10-03 16:26:55 -04:00
|
|
|
nvr_save();
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
device_close_all();
|
|
|
|
|
mouse_emu_close();
|
|
|
|
|
closeal();
|
2017-06-19 06:46:08 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/*
|
|
|
|
|
* This is basically the spot where we start up the actual machine,
|
|
|
|
|
* by issuing a 'hard reset' to the entire configuration. Order is
|
|
|
|
|
* somewhat important here. Functions here should be named _reset
|
|
|
|
|
* really, as that is what they do.
|
|
|
|
|
*/
|
2017-10-02 02:15:35 -04:00
|
|
|
void
|
2017-10-07 00:46:54 -04:00
|
|
|
pc_reset_hard_init(void)
|
2017-06-19 06:46:08 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
int i;
|
2017-06-19 06:46:08 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* First, we reset the modules that are not part of the
|
|
|
|
|
* actual machine, but which support some of the modules
|
|
|
|
|
* that are.
|
|
|
|
|
*/
|
2017-10-02 02:15:35 -04:00
|
|
|
sound_realloc_buffers();
|
2017-10-07 00:46:54 -04:00
|
|
|
sound_cd_thread_reset();
|
|
|
|
|
initalmain(0, NULL);
|
2017-06-22 18:32:53 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Reset the general machine support modules. */
|
|
|
|
|
mem_resize();
|
|
|
|
|
io_init();
|
2017-10-02 02:15:35 -04:00
|
|
|
device_init();
|
2017-10-07 00:46:54 -04:00
|
|
|
timer_reset();
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
midi_device_init();
|
|
|
|
|
inital();
|
|
|
|
|
sound_reset();
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
fdc_init();
|
2017-10-07 00:46:54 -04:00
|
|
|
fdc_update_is_nsc(0);
|
2017-10-02 02:15:35 -04:00
|
|
|
floppy_reset();
|
2017-05-07 02:14:44 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Initialize the actual machine and its basic modules. */
|
2017-10-02 02:15:35 -04:00
|
|
|
machine_init();
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Once the machine has been initialized, all that remains
|
|
|
|
|
* should be resetting all devices set up for it, to their
|
|
|
|
|
* current configurations !
|
|
|
|
|
*
|
|
|
|
|
* For, we will call their reset functions here, but that
|
|
|
|
|
* will be a call to device_reset_all() later !
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Reset some basic devices. */
|
2017-10-02 02:15:35 -04:00
|
|
|
speaker_init();
|
2017-10-07 00:46:54 -04:00
|
|
|
serial_reset();
|
2017-10-02 02:15:35 -04:00
|
|
|
lpt1_device_init();
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Reset keyboard and/or mouse. */
|
|
|
|
|
keyboard_at_reset();
|
|
|
|
|
mouse_emu_init();
|
|
|
|
|
|
|
|
|
|
/* Reset the video card. */
|
|
|
|
|
video_reset();
|
|
|
|
|
|
|
|
|
|
/* Reset the Floppy Disk controller. */
|
|
|
|
|
fdc_reset();
|
|
|
|
|
|
|
|
|
|
/* Reset the Hard Disk Controller module. */
|
2017-10-02 02:15:35 -04:00
|
|
|
hdc_reset();
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Reconfire and reset the IDE layer. */
|
2017-10-02 02:15:35 -04:00
|
|
|
ide_ter_disable();
|
|
|
|
|
ide_qua_disable();
|
|
|
|
|
if (ide_enable[2])
|
|
|
|
|
ide_ter_init();
|
|
|
|
|
if (ide_enable[3])
|
|
|
|
|
ide_qua_init();
|
|
|
|
|
ide_reset();
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Reset and reconfigure the SCSI layer. */
|
2017-10-02 02:15:35 -04:00
|
|
|
scsi_card_init();
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
/* Reset and reconfigure the Network Card layer. */
|
2017-10-02 02:15:35 -04:00
|
|
|
network_reset();
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Reset and reconfigure the Sound Card layer. */
|
2017-10-02 02:15:35 -04:00
|
|
|
sound_card_init();
|
|
|
|
|
if (mpu401_standalone_enable)
|
|
|
|
|
mpu401_device_add();
|
|
|
|
|
if (GUS)
|
2017-02-04 06:53:46 +01:00
|
|
|
device_add(&gus_device);
|
2017-10-02 02:15:35 -04:00
|
|
|
if (GAMEBLASTER)
|
2017-02-04 06:53:46 +01:00
|
|
|
device_add(&cms_device);
|
2017-10-02 02:15:35 -04:00
|
|
|
if (SSI2001)
|
2017-02-04 06:53:46 +01:00
|
|
|
device_add(&ssi2001_device);
|
2017-10-02 02:15:35 -04:00
|
|
|
if (voodoo_enabled)
|
2017-03-15 01:37:09 +01:00
|
|
|
device_add(&voodoo_device);
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Reset the CPU module. */
|
|
|
|
|
cpu_set();
|
|
|
|
|
resetx86();
|
|
|
|
|
dma_reset();
|
|
|
|
|
pic_reset();
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (AT)
|
|
|
|
|
setpitclock(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed);
|
|
|
|
|
else
|
|
|
|
|
setpitclock(14318184.0);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
shadowbios = 0;
|
|
|
|
|
cpu_cache_int_enabled = cpu_cache_ext_enabled = 0;
|
2016-12-23 03:16:24 +01:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
for (i=0; i<CDROM_NUM; i++) {
|
|
|
|
|
if (cdrom_drives[i].host_drive == 200) {
|
|
|
|
|
image_reset(i);
|
|
|
|
|
}
|
|
|
|
|
else if ((cdrom_drives[i].host_drive >= 'A') && (cdrom_drives[i].host_drive <= 'Z'))
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
ioctl_reset(i);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2017-10-02 02:15:35 -04:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pc_reset_hard(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
pc_reset_hard_close();
|
2017-10-02 02:15:35 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
pc_reset_hard_init();
|
2017-06-19 06:46:08 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pc_close(void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<CDROM_NUM; i++)
|
|
|
|
|
cdrom_drives[i].handler->exit(i);
|
|
|
|
|
|
|
|
|
|
dumppic();
|
|
|
|
|
|
|
|
|
|
for (i=0; i<FDD_NUM; i++)
|
|
|
|
|
floppy_close(i);
|
|
|
|
|
|
|
|
|
|
dumpregs(0);
|
|
|
|
|
|
|
|
|
|
video_close();
|
|
|
|
|
|
|
|
|
|
lpt1_device_close();
|
|
|
|
|
|
|
|
|
|
device_close_all();
|
|
|
|
|
|
|
|
|
|
midi_close();
|
|
|
|
|
|
|
|
|
|
network_close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Run the actual configured PC.
|
|
|
|
|
*/
|
2016-06-26 00:34:39 +02:00
|
|
|
int framecountx=0;
|
|
|
|
|
int sndcount=0;
|
|
|
|
|
int sreadlnum,swritelnum,segareads,segawrites, scycles_lost;
|
|
|
|
|
int serial_fifo_read, serial_fifo_write;
|
|
|
|
|
int emu_fps = 0;
|
|
|
|
|
|
2017-09-02 20:39:57 +02:00
|
|
|
static wchar_t wmachine[2048];
|
2017-06-15 06:34:08 +02:00
|
|
|
static wchar_t wcpu[2048];
|
2017-05-05 22:36:10 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pollmouse(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
int x, y, z;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
if (--pollmouse_delay) return;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
pollmouse_delay = 2;
|
|
|
|
|
|
|
|
|
|
mouse_poll_host();
|
|
|
|
|
|
|
|
|
|
mouse_get_mickeys(&x, &y, &z);
|
|
|
|
|
|
|
|
|
|
mouse_poll(x, y, z, mouse_buttons);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pc_run(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
wchar_t s[200];
|
|
|
|
|
int done = 0;
|
|
|
|
|
|
|
|
|
|
startblit();
|
|
|
|
|
clockrate = machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed;
|
|
|
|
|
|
|
|
|
|
if (is386) {
|
|
|
|
|
if (cpu_use_dynarec)
|
|
|
|
|
exec386_dynarec(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed / 100);
|
|
|
|
|
else
|
|
|
|
|
exec386(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed / 100);
|
|
|
|
|
} else if (AT) {
|
|
|
|
|
exec386(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed / 100);
|
|
|
|
|
} else {
|
|
|
|
|
execx86(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed / 100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keyboard_process();
|
|
|
|
|
|
|
|
|
|
pollmouse();
|
|
|
|
|
|
|
|
|
|
if (joystick_type != 7)
|
|
|
|
|
joystick_poll();
|
|
|
|
|
|
|
|
|
|
endblit();
|
|
|
|
|
|
|
|
|
|
framecountx++;
|
|
|
|
|
framecount++;
|
|
|
|
|
if (framecountx >= 100) {
|
|
|
|
|
framecountx = 0;
|
|
|
|
|
mips = (float)insc/1000000.0f;
|
|
|
|
|
insc = 0;
|
|
|
|
|
flops = (float)fpucount/1000000.0f;
|
|
|
|
|
fpucount = 0;
|
|
|
|
|
sreadlnum = readlnum;
|
|
|
|
|
swritelnum = writelnum;
|
|
|
|
|
segareads = egareads;
|
|
|
|
|
segawrites = egawrites;
|
|
|
|
|
scycles_lost = cycles_lost;
|
|
|
|
|
|
|
|
|
|
cpu_recomp_blocks_latched = cpu_recomp_blocks;
|
|
|
|
|
cpu_recomp_ins_latched = cpu_state.cpu_recomp_ins;
|
|
|
|
|
cpu_recomp_full_ins_latched = cpu_recomp_full_ins;
|
|
|
|
|
cpu_new_blocks_latched = cpu_new_blocks;
|
|
|
|
|
cpu_recomp_flushes_latched = cpu_recomp_flushes;
|
|
|
|
|
cpu_recomp_evicted_latched = cpu_recomp_evicted;
|
|
|
|
|
cpu_recomp_reuse_latched = cpu_recomp_reuse;
|
|
|
|
|
cpu_recomp_removed_latched = cpu_recomp_removed;
|
|
|
|
|
cpu_reps_latched = cpu_reps;
|
|
|
|
|
cpu_notreps_latched = cpu_notreps;
|
|
|
|
|
|
|
|
|
|
cpu_recomp_blocks = 0;
|
|
|
|
|
cpu_state.cpu_recomp_ins = 0;
|
|
|
|
|
cpu_recomp_full_ins = 0;
|
|
|
|
|
cpu_new_blocks = 0;
|
|
|
|
|
cpu_recomp_flushes = 0;
|
|
|
|
|
cpu_recomp_evicted = 0;
|
|
|
|
|
cpu_recomp_reuse = 0;
|
|
|
|
|
cpu_recomp_removed = 0;
|
|
|
|
|
cpu_reps = 0;
|
|
|
|
|
cpu_notreps = 0;
|
|
|
|
|
|
|
|
|
|
updatestatus = 1;
|
|
|
|
|
readlnum = writelnum = 0;
|
|
|
|
|
egareads = egawrites = 0;
|
|
|
|
|
cycles_lost = 0;
|
|
|
|
|
mmuflush = 0;
|
|
|
|
|
emu_fps = frames;
|
|
|
|
|
frames = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (win_title_update) {
|
|
|
|
|
mbstowcs(wmachine, machine_getname(), strlen(machine_getname())+1);
|
|
|
|
|
mbstowcs(wcpu, machines[machine].cpu[cpu_manufacturer].cpus[cpu].name,
|
|
|
|
|
strlen(machines[machine].cpu[cpu_manufacturer].cpus[cpu].name)+1);
|
|
|
|
|
_swprintf(s, L"%s v%s - %i%% - %s - %s - %s",
|
|
|
|
|
EMU_NAME_W, EMU_VERSION_W,
|
|
|
|
|
fps, wmachine, wcpu,
|
|
|
|
|
(!mousecapture) ? plat_get_string_from_id(IDS_2077)
|
|
|
|
|
: ((mouse_get_type(mouse_type) & MOUSE_TYPE_3BUTTON) ? plat_get_string_from_id(IDS_2078) : plat_get_string_from_id(IDS_2079)));
|
|
|
|
|
set_window_title(s);
|
|
|
|
|
|
|
|
|
|
win_title_update = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
done++;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-02 02:15:35 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
onesec(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-02 02:15:35 -04:00
|
|
|
fps = framecount;
|
|
|
|
|
framecount = 0;
|
|
|
|
|
win_title_update = 1;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|