Deprecate and invalidate the PC-98 entry VM events, and prepare hardware emulation to set up in PC-98 mode rather than setup in IBM PC mode only to restart in PC-98 mode

This commit is contained in:
Jonathan Campbell 2018-02-15 17:40:43 -08:00
parent 3c9351b9f4
commit 488f8f58b1
26 changed files with 53 additions and 279 deletions

View File

@ -298,8 +298,8 @@ enum vm_event {
VM_EVENT_DOS_EXIT_REBOOT_KERNEL=15, // DOS kernel has just finished exiting (hard reset)
VM_EVENT_DOS_SURPRISE_REBOOT, // DOS kernel asked to boot, when apparently having never been shut down (jmp to FFFF:0000)
VM_EVENT_ENTER_PC98_MODE, // Switching into PC-98 emulation mode, phase 1 (unregistering devices) (NOTE: This is TEMPORARY until full implementation is complete)
VM_EVENT_ENTER_PC98_MODE_END, // Switching into PC-98 emulation mode, phase 2 (registering devices) (NOTE: This is TEMPORARY until full implementation is complete)
__DEAD__VM_EVENT_ENTER_PC98_MODE, // Switching into PC-98 emulation mode, phase 1 (unregistering devices) (NOTE: This is TEMPORARY until full implementation is complete)
__DEAD__VM_EVENT_ENTER_PC98_MODE_END, // Switching into PC-98 emulation mode, phase 2 (registering devices) (NOTE: This is TEMPORARY until full implementation is complete)
VM_EVENT_MAX
};

View File

@ -5660,6 +5660,12 @@ int main(int argc, char* argv[]) {
MAPPER_RunInternal();
}
/* if we're supposed to run in PC-98 mode, then do it NOW */
if (enable_pc98_jump) {
machine = MCH_PC98;
enable_pc98_jump = false;
}
/* The machine just "powered on", and then reset finished */
if (!VM_PowerOn()) E_Exit("VM failed to power on");

View File

@ -550,14 +550,6 @@ static IO_WriteHandleObject WriteHandler[2];
void CMOS_Destroy(Section* sec) {
}
void CMOS_EnterPC98(Section* sec) {
/* No such device on PC-98 */
WriteHandler[0].Uninstall();
WriteHandler[1].Uninstall();
ReadHandler[0].Uninstall();
ReadHandler[1].Uninstall();
}
void CMOS_Reset(Section* sec) {
LOG(LOG_MISC,LOG_DEBUG)("CMOS_Reset(): reinitializing CMOS/RTC controller");
@ -613,7 +605,5 @@ void CMOS_Init() {
AddExitFunction(AddExitFunctionFuncPair(CMOS_Destroy),true);
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(CMOS_Reset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(CMOS_EnterPC98));
}

View File

@ -425,13 +425,6 @@ static void DISNEY_ShutDown(Section* sec){
}
}
static void DISNEY_OnEnterPC98(Section* sec){
if (test) {
delete test;
test = NULL;
}
}
Bitu DISNEY_BasePort() {
return DISNEY_BASE;
}
@ -458,11 +451,5 @@ void DISNEY_Init() {
LOG(LOG_MISC,LOG_DEBUG)("Initializing Disney Sound Source emulation");
AddExitFunction(AddExitFunctionFuncPair(DISNEY_ShutDown),true);
/* FIXME: We *could* emulate a Disney Sound Source / LPT DAC / etc. attached to the parallel port
* of a PC-98 system, but, since this code attaches to the I/O ports to emulate the hardware
* we have to disable it in PC-98 mode until such time that this code can remap to emulate
* the PC-98's printer port. */
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(DISNEY_OnEnterPC98));
}

View File

@ -480,10 +480,6 @@ void DMA_Destroy(Section* /*sec*/) {
DMA_FreeControllers();
}
void DMA_OnEnterPC98(Section* /*sec*/) {
DMA_FreeControllers();
}
void DMA_Reset(Section* /*sec*/) {
Bitu i;
@ -568,6 +564,5 @@ void Init_DMA() {
AddExitFunction(AddExitFunctionFuncPair(DMA_Destroy));
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(DMA_Reset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(DMA_OnEnterPC98));
}

View File

@ -180,13 +180,6 @@ static void DONGLE_ShutDown(Section* sec){
}
}
static void DONGLE_OnEnterPC98(Section* sec){
if (test) {
delete test;
test = NULL;
}
}
void DONGLE_OnReset(Section* sec) {
if (test == NULL && !IS_PC98_ARCH) {
LOG(LOG_MISC,LOG_DEBUG)("Allocating parallel dongle emulation");
@ -199,5 +192,4 @@ void DONGLE_Init() {
AddExitFunction(AddExitFunctionFuncPair(DONGLE_ShutDown),true);
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(DONGLE_OnReset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(DONGLE_OnEnterPC98));
}

View File

@ -315,25 +315,10 @@ void FDC_OnReset(Section *sec) {
FDC_Init(control->GetSection("fdc, primary"),0);
}
void FDC_OnEnterPC98(Section *sec) {
for (unsigned int i=0;i < MAX_FLOPPY_CONTROLLERS;i++) {
if (floppycontroller[i] != NULL) {
delete floppycontroller[i];
floppycontroller[i] = NULL;
}
}
init_floppy = 0;
}
void FDC_Primary_Init() {
LOG(LOG_MISC,LOG_DEBUG)("Initializing floppy controller emulation");
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(FDC_OnReset));
// TODO: I *think* the floppy controller is the same NEC chipset as used on IBM.
// However I don't know what the I/O ports and IRQ are yet.
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(FDC_OnEnterPC98));
}
void FloppyController::update_ST3() {

View File

@ -2234,16 +2234,6 @@ void GUS_DOS_Boot(Section *sec) {
if (test != NULL) test->DOS_Startup();
}
void GUS_OnEnterPC98(Section *sec) {
/* PC-98 does not have Gravis Ultrasound.
* Upon entry, remove all I/O ports and shutdown emulation */
GUS_DOS_Shutdown();
if (test != NULL) {
delete test;
test = NULL;
}
}
void GUS_Init() {
LOG(LOG_MISC,LOG_DEBUG)("Initializing Gravis Ultrasound emulation");
@ -2253,7 +2243,5 @@ void GUS_Init() {
AddVMEventFunction(VM_EVENT_DOS_SURPRISE_REBOOT,AddVMEventFunctionFuncPair(GUS_DOS_Exit));
AddVMEventFunction(VM_EVENT_DOS_EXIT_REBOOT_BEGIN,AddVMEventFunctionFuncPair(GUS_DOS_Exit));
AddVMEventFunction(VM_EVENT_DOS_INIT_SHELL_READY,AddVMEventFunctionFuncPair(GUS_DOS_Boot));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(GUS_OnEnterPC98));
}

View File

@ -3933,28 +3933,10 @@ void IDE_OnReset(Section *sec) {
for (size_t i=0;i < MAX_IDE_CONTROLLERS;i++) ide_inits[i](control->GetSection(ide_names[i]));
}
void IDE_OnEnterPC98(Section *sec) {
/* TODO: Late PC-9801 and PC-9821 have IDE controllers.
* What I'm not familiar with is what I/O ports the IDE controller is mapped at
* and what IRQ is used by IDE.
*
* When I better understand the IDE controller I will reenable this code to match it */
for (unsigned int i=0;i < MAX_IDE_CONTROLLERS;i++) {
if (idecontroller[i] != NULL) {
delete idecontroller[i];
idecontroller[i] = NULL;
}
}
init_ide = 0;
}
void IDE_Init() {
LOG(LOG_MISC,LOG_DEBUG)("Initializing IDE controllers");
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(IDE_OnReset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(IDE_OnEnterPC98));
}
void BIOS_Post_register_IDE() {

View File

@ -120,14 +120,6 @@ static void INNOVA_ShutDown(Section* sec){
}
}
static void INNOVA_OnEnterPC98(Section* sec){
/* No such device on PC-98 */
if (test != NULL) {
delete test;
test = NULL;
}
}
void INNOVA_OnReset(Section *sec) {
if (test == NULL && !IS_PC98_ARCH) {
LOG(LOG_MISC,LOG_DEBUG)("Allocating Innova emulation");
@ -140,7 +132,5 @@ void INNOVA_Init() {
AddExitFunction(AddExitFunctionFuncPair(INNOVA_ShutDown),true);
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(INNOVA_OnReset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(INNOVA_OnEnterPC98));
}

View File

@ -220,13 +220,6 @@ void JOYSTICK_OnPowerOn(Section* sec) {
}
}
void JOYSTICK_OnEnterPC98(Section* sec) {
if (test != NULL) {
delete test;
test = NULL;
}
}
void JOYSTICK_Init() {
LOG(LOG_MISC,LOG_DEBUG)("Initializing joystick emulation");
@ -256,9 +249,9 @@ void JOYSTICK_Init() {
stick[1].ytick = PIC_FullIndex();
}
AddExitFunction(AddExitFunctionFuncPair(JOYSTICK_Destroy),true);
AddVMEventFunction(VM_EVENT_POWERON,AddVMEventFunctionFuncPair(JOYSTICK_OnPowerOn));
AddExitFunction(AddExitFunctionFuncPair(JOYSTICK_Destroy),true);
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(JOYSTICK_OnEnterPC98));
if (!IS_PC98_ARCH)
AddVMEventFunction(VM_EVENT_POWERON,AddVMEventFunctionFuncPair(JOYSTICK_OnPowerOn));
}

View File

@ -2209,6 +2209,7 @@ void KEYBOARD_OnReset(Section *sec) {
if (IS_PC98_ARCH) {
KEYBOARD_OnEnterPC98(NULL);
KEYBOARD_OnEnterPC98_phase2(NULL);
}
else {
IO_RegisterWriteHandler(0x60,write_p60,IO_MB);
@ -2231,9 +2232,6 @@ void KEYBOARD_Init() {
AddExitFunction(AddExitFunctionFuncPair(KEYBOARD_ShutDown));
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(KEYBOARD_OnReset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(KEYBOARD_OnEnterPC98));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE_END,AddVMEventFunctionFuncPair(KEYBOARD_OnEnterPC98_phase2));
}
void AUX_Reset() {

View File

@ -1804,19 +1804,10 @@ void PS2Port92_OnReset(Section *sec) {
}
}
void PS2Port92_OnEnterPC98(Section *sec) {
PS2_Port_92h_WriteHandler2.Uninstall();
PS2_Port_92h_WriteHandler.Uninstall();
PS2_Port_92h_ReadHandler.Uninstall();
}
void Init_PS2_Port_92h() {
LOG(LOG_MISC,LOG_DEBUG)("Initializing PS/2 port 92h emulation");
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(PS2Port92_OnReset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(PS2Port92_OnEnterPC98));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE_END,AddVMEventFunctionFuncPair(PS2Port92_OnReset));
}
void Init_MemHandles() {

View File

@ -730,15 +730,6 @@ void MPU401_Destroy(Section* sec){
}
}
void MPU401_EnterPC98(Section* sec){
/* NTS: PC-98 systems do have add-in cards for MIDI, but not in the same
* way that IBM PC/XT/AT systems present it to the software. */
if (test != NULL) {
delete test;
test = NULL;
}
}
void MPU401_Reset(Section* sec) {
if (test == NULL) {
LOG(LOG_MISC,LOG_DEBUG)("Allocating MPU401 emulation");
@ -765,9 +756,6 @@ void MPU401_Init() {
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(MPU401_Reset));
AddExitFunction(AddExitFunctionFuncPair(MPU401_Destroy),true);
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(MPU401_EnterPC98));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE_END,AddVMEventFunctionFuncPair(MPU401_Reset));
control->GetSection("midi")->onpropchange.push_back(&MIDI_OnSectionPropChange);
}

View File

@ -1670,13 +1670,6 @@ void NE2K_ShutDown(Section* sec) {
}
}
void NE2k_OnEnterPC98(Section* sec) {
if (test) {
delete test;
test = NULL;
}
}
void NE2K_OnReset(Section* sec) {
if (test == NULL && !IS_PC98_ARCH) {
LOG(LOG_MISC,LOG_DEBUG)("Allocating NE2000 emulation");
@ -1695,7 +1688,6 @@ void NE2K_Init() {
AddExitFunction(AddExitFunctionFuncPair(NE2K_ShutDown),true);
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(NE2K_OnReset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(NE2k_OnEnterPC98));
}
#endif // C_NE2000

View File

@ -319,6 +319,9 @@ public:
PARPORTS (Section * configuration):Module_base (configuration) {
// TODO: PC-98 does have one parallel port, if at all
if (IS_PC98_ARCH) return;
// default ports & interrupts
Bit8u defaultirq[] = { 7, 5, 12};
Section_prop *section = static_cast <Section_prop*>(configuration);
@ -434,31 +437,16 @@ void PARALLEL_OnReset (Section * sec) {
}
}
void PARALLEL_OnPC98Enter (Section * sec) {
/* TODO: PC-98 systems do have parallel ports.
* Update this code to match when I figure out how they work and what I/O ports are involved. */
unsigned int i;
for (i=0;i < 3;i++) {
if (parallelPortObjects[i] != NULL)
parallelPortObjects[i]->unregisterDOSDevice();
}
if (testParallelPortsBaseclass != NULL) {
delete testParallelPortsBaseclass;
testParallelPortsBaseclass = NULL;
}
}
void PARALLEL_Init () {
LOG(LOG_MISC,LOG_DEBUG)("Initializing parallel port emulation");
AddExitFunction(AddExitFunctionFuncPair(PARALLEL_Destroy),true);
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(PARALLEL_OnReset));
AddVMEventFunction(VM_EVENT_POWERON,AddVMEventFunctionFuncPair(PARALLEL_OnPowerOn));
AddVMEventFunction(VM_EVENT_DOS_EXIT_BEGIN,AddVMEventFunctionFuncPair(PARALLEL_OnDOSKernelExit));
AddVMEventFunction(VM_EVENT_DOS_INIT_KERNEL_READY,AddVMEventFunctionFuncPair(PARALLEL_OnDOSKernelInit));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(PARALLEL_OnPC98Enter));
if (!IS_PC98_ARCH) {
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(PARALLEL_OnReset));
AddVMEventFunction(VM_EVENT_POWERON,AddVMEventFunctionFuncPair(PARALLEL_OnPowerOn));
AddVMEventFunction(VM_EVENT_DOS_EXIT_BEGIN,AddVMEventFunctionFuncPair(PARALLEL_OnDOSKernelExit));
AddVMEventFunction(VM_EVENT_DOS_INIT_KERNEL_READY,AddVMEventFunctionFuncPair(PARALLEL_OnDOSKernelInit));
}
}

View File

@ -811,22 +811,6 @@ void PIC_Reset(Section *sec) {
void PIC_Destroy(Section* sec) {
}
void PIC_EnterPC98_Phase1(Section* sec) {
ReadHandler[0].Uninstall();
ReadHandler[1].Uninstall();
WriteHandler[0].Uninstall();
WriteHandler[1].Uninstall();
ReadHandler[2].Uninstall();
ReadHandler[3].Uninstall();
WriteHandler[2].Uninstall();
WriteHandler[3].Uninstall();
PCXT_NMI_WriteHandler.Uninstall();
}
void PIC_EnterPC98_Phase2(Section* sec) {
PIC_Reset(sec);
}
void Init_PIC() {
Bitu i;
@ -845,7 +829,5 @@ void Init_PIC() {
AddExitFunction(AddExitFunctionFuncPair(PIC_Destroy));
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(PIC_Reset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(PIC_EnterPC98_Phase1));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE_END,AddVMEventFunctionFuncPair(PIC_EnterPC98_Phase2));
}

View File

@ -395,13 +395,6 @@ void PS1SOUND_ShutDown(Section* sec) {
}
}
void PS1SOUND_OnEnterPC98(Section* sec) {
if (test) {
delete test;
test = NULL;
}
}
void PS1SOUND_OnReset(Section* sec) {
if (test == NULL && !IS_PC98_ARCH) {
LOG(LOG_MISC,LOG_DEBUG)("Allocating PS/1 sound emulation");
@ -414,7 +407,5 @@ void PS1SOUND_Init() {
AddExitFunction(AddExitFunctionFuncPair(PS1SOUND_ShutDown),true);
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(PS1SOUND_OnReset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(PS1SOUND_OnEnterPC98));
}

View File

@ -3584,17 +3584,6 @@ void SBLASTER_DOS_Boot(Section *sec) {
if (test != NULL) test->DOS_Startup();
}
void SBLASTER_OnEnterPC98(Section *sec) {
/* PC-98 does not have Sound Blaster (that I'm aware of anyway).
* Upon entry, remove all I/O ports and shutdown emulation */
SBLASTER_DOS_Shutdown();
if (test != NULL) {
delete test;
test = NULL;
}
HWOPL_Cleanup();
}
void SBLASTER_Init() {
LOG(LOG_MISC,LOG_DEBUG)("Initializing Sound Blaster emulation");
@ -3604,7 +3593,5 @@ void SBLASTER_Init() {
AddVMEventFunction(VM_EVENT_DOS_SURPRISE_REBOOT,AddVMEventFunctionFuncPair(SBLASTER_DOS_Exit));
AddVMEventFunction(VM_EVENT_DOS_EXIT_REBOOT_BEGIN,AddVMEventFunctionFuncPair(SBLASTER_DOS_Exit));
AddVMEventFunction(VM_EVENT_DOS_INIT_SHELL_READY,AddVMEventFunctionFuncPair(SBLASTER_DOS_Boot));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(SBLASTER_OnEnterPC98));
}

View File

@ -1304,6 +1304,10 @@ public:
SERIALPORTS (Section * configuration):Module_base (configuration) {
Section_prop *section = static_cast <Section_prop*>(configuration);
// TODO: PC-98 does have serial ports, though differently.
// COM1 is a 8251 UART, while COM2 and higher if they exist are 8250/16xxx UARTs
if (IS_PC98_ARCH) return;
char s_property[] = "serialx";
for(Bitu i = 0; i < 4; i++) {
// get the configuration property
@ -1413,39 +1417,16 @@ void SERIAL_OnReset (Section * sec) {
}
}
void SERIAL_OnEnterPC98Mode (Section * sec) {
// TODO: PC-98 systems do have serial port(s).
//
// I will update the code to match when I better understand them.
//
// Note that up to two different chipsets are involved.
//
// COM1 is usually an Intel 8251, which is completely different from the 8250/16550 used on IBM PC.
//
// COM2 however, is usually an 16550.
unsigned int i;
for (i=0;i < 3;i++) {
if (serialports[i] != NULL)
serialports[i]->unregisterDOSDevice();
}
if (testSerialPortsBaseclass) {
LOG(LOG_MISC,LOG_DEBUG)("Deleting serial port base class");
delete testSerialPortsBaseclass;
testSerialPortsBaseclass = NULL;
}
}
void SERIAL_Init () {
LOG(LOG_MISC,LOG_DEBUG)("Initializing serial port emulation");
AddExitFunction(AddExitFunctionFuncPair(SERIAL_Destroy),true);
AddVMEventFunction(VM_EVENT_POWERON,AddVMEventFunctionFuncPair(SERIAL_OnPowerOn));
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(SERIAL_OnReset));
AddVMEventFunction(VM_EVENT_DOS_EXIT_BEGIN,AddVMEventFunctionFuncPair(SERIAL_OnDOSKernelExit));
AddVMEventFunction(VM_EVENT_DOS_INIT_KERNEL_READY,AddVMEventFunctionFuncPair(SERIAL_OnDOSKernelInit));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(SERIAL_OnEnterPC98Mode));
if (!IS_PC98_ARCH) {
AddVMEventFunction(VM_EVENT_POWERON,AddVMEventFunctionFuncPair(SERIAL_OnPowerOn));
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(SERIAL_OnReset));
AddVMEventFunction(VM_EVENT_DOS_EXIT_BEGIN,AddVMEventFunctionFuncPair(SERIAL_OnDOSKernelExit));
AddVMEventFunction(VM_EVENT_DOS_INIT_KERNEL_READY,AddVMEventFunctionFuncPair(SERIAL_OnDOSKernelInit));
}
}

View File

@ -520,13 +520,6 @@ void TANDYSOUND_ShutDown(Section* /*sec*/) {
}
}
void TANDYSOUND_OnEnterPC98(Section* /*sec*/) {
if (test) {
delete test;
test = NULL;
}
}
void TANDYSOUND_OnReset(Section* sec) {
if (test == NULL && !IS_PC98_ARCH) {
LOG(LOG_MISC,LOG_DEBUG)("Allocating Tandy speaker emulation");
@ -539,7 +532,5 @@ void TANDYSOUND_Init() {
AddExitFunction(AddExitFunctionFuncPair(TANDYSOUND_ShutDown),true);
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(TANDYSOUND_OnReset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(TANDYSOUND_OnEnterPC98));
}

View File

@ -542,6 +542,11 @@ void TIMER_OnPowerOn(Section*) {
latched_timerstatus_locked=false;
gate2 = false;
if (IS_PC98_ARCH) {
void TIMER_OnEnterPC98_Phase2(Section*);
TIMER_OnEnterPC98_Phase2(NULL);
}
}
/* NTS: This comes in two phases because we're taking ports 0x71-0x77 which overlap
@ -553,19 +558,6 @@ void TIMER_OnPowerOn(Section*) {
* Phase 2 is where we can then claim the I/O ports without our claim getting
* overwritten by CMOS emulation unregistering the I/O port. */
void TIMER_OnEnterPC98_Phase1(Section*) {
PIC_RemoveEvents(PIT0_Event);
WriteHandler[0].Uninstall();
WriteHandler[1].Uninstall();
WriteHandler[2].Uninstall();
WriteHandler[3].Uninstall();
ReadHandler[0].Uninstall();
ReadHandler[1].Uninstall();
ReadHandler[2].Uninstall();
ReadHandler[3].Uninstall();
}
void TIMER_OnEnterPC98_Phase2(Section*) {
Section_prop * section=static_cast<Section_prop *>(control->GetSection("dosbox"));
assert(section != NULL);
@ -663,7 +655,5 @@ void TIMER_Init() {
AddExitFunction(AddExitFunctionFuncPair(TIMER_Destroy));
AddVMEventFunction(VM_EVENT_POWERON,AddVMEventFunctionFuncPair(TIMER_OnPowerOn));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(TIMER_OnEnterPC98_Phase1));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE_END,AddVMEventFunctionFuncPair(TIMER_OnEnterPC98_Phase2));
}

View File

@ -727,9 +727,13 @@ void VGA_Reset(Section*) {
if (IS_PC98_ARCH) {
void VGA_OnEnterPC98(Section *sec);
void VGA_OnEnterPC98_phase2(Section *sec);
void PC98_FM_OnEnterPC98(Section *sec);
VGA_OnEnterPC98(NULL);
VGA_OnEnterPC98_phase2(NULL);
// TODO: Move to separate file
PC98_FM_OnEnterPC98(NULL);
}
}
@ -860,8 +864,6 @@ void VGA_OnEnterPC98(Section *sec) {
void MEM_ResetPageHandler_Unmapped(Bitu phys_page, Bitu pages);
void PC98_FM_OnEnterPC98(Section *sec);
void VGA_OnEnterPC98_phase2(Section *sec) {
VGA_SetupHandlers();
@ -1020,11 +1022,6 @@ void VGA_Init() {
}
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(VGA_Reset));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(VGA_OnEnterPC98));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE_END,AddVMEventFunctionFuncPair(VGA_OnEnterPC98_phase2));
// TODO: Move to separate file
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE_END,AddVMEventFunctionFuncPair(PC98_FM_OnEnterPC98));
}
void SVGA_Setup_Driver(void) {

View File

@ -4259,14 +4259,6 @@ private:
for (Bit16u i=0x400;i<0x8000;i++) real_writeb(0x0,i,0);
}
/* if we're supposed to run in PC-98 mode, then do it NOW */
if (enable_pc98_jump) {
machine = MCH_PC98;
enable_pc98_jump = false;
DispatchVMEvent(VM_EVENT_ENTER_PC98_MODE); /* IBM PC unregistration/shutdown */
DispatchVMEvent(VM_EVENT_ENTER_PC98_MODE_END); /* PC-98 registration/startup */
}
if (IS_PC98_ARCH) {
for (unsigned int i=0;i < 20;i++) callback[i].Uninstall();

View File

@ -1238,6 +1238,15 @@ Bitu MOUSE_UserInt_CB_Handler(void) {
bool MouseTypeNone();
void MOUSE_OnReset(Section *sec) {
if (IS_PC98_ARCH)
MOUSE_IRQ = 13; // PC-98 standard
else
MOUSE_IRQ = 12; // IBM PC/AT standard
PIC_SetIRQMask(MOUSE_IRQ,true);
}
void MOUSE_ShutDown(Section *sec) {
}
@ -1346,24 +1355,10 @@ void MOUSE_Startup(Section *sec) {
Mouse_SetSensitivity(50,50,50);
}
void MOUSE_OnEnterPC98(Section *sec) {
}
void MOUSE_OnEnterPC98_phase2(Section *sec) {
// PC-98 change mouse to IRQ 13 (same as Neko Project II)
MOUSE_IRQ = 13; // NTS: Based on NKII pic_setirq(0x0D)
PIC_SetIRQMask(MOUSE_IRQ,true);
// FIXME: This doesn't explain why Puyo Puyo sets up an interrupt handler
// that blows up and hangs if IRQ 5 is fired... what's that about? --J.C.
}
void MOUSE_Init() {
LOG(LOG_MISC,LOG_DEBUG)("Initializing mouse interface emulation");
// TODO: We need a DOSBox shutdown callback, and we need a shutdown callback for when the DOS kernel begins to unload and on system reset
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(MOUSE_ShutDown));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE,AddVMEventFunctionFuncPair(MOUSE_OnEnterPC98));
AddVMEventFunction(VM_EVENT_ENTER_PC98_MODE_END,AddVMEventFunctionFuncPair(MOUSE_OnEnterPC98_phase2));
AddVMEventFunction(VM_EVENT_RESET,AddVMEventFunctionFuncPair(MOUSE_OnReset));
}

View File

@ -819,6 +819,9 @@ void DispatchVMEvent(enum vm_event event) {
LOG(LOG_MISC,LOG_DEBUG)("Dispatching VM event %s",GetVMEventName(event));
if (event == __DEAD__VM_EVENT_ENTER_PC98_MODE || event == __DEAD__VM_EVENT_ENTER_PC98_MODE_END)
E_Exit("Obsolete VM event PC-98 switch");
vm_dispatch_state.begin_event(event);
for (std::list<Function_wrapper>::iterator i=vm_event_functions[event].begin();i!=vm_event_functions[event].end();i++) {
LOG(LOG_MISC,LOG_DEBUG)("Calling event %s handler (%p) '%s'",GetVMEventName(event),(void*)((*i).function),(*i).name.c_str());