Skip to content

Commit

Permalink
PC-98: Okay, so since some games require 2.5MHz GDC and some require
Browse files Browse the repository at this point in the history
5MHz GDC, we'll just offer a PC98UTIL.COM built-in command so you can
switch at runtime before running the game.
  • Loading branch information
joncampbell123 committed Dec 5, 2017
1 parent 0b654ef commit c40b9ca
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/dos/dos_programs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2931,6 +2931,7 @@ static void MORE_ProgramStart(Program * * make) {

void REDOS_ProgramStart(Program * * make);
void A20GATE_ProgramStart(Program * * make);
void PC98UTIL_ProgramStart(Program * * make);

class NMITEST : public Program {
public:
Expand Down Expand Up @@ -3284,4 +3285,8 @@ void DOS_SetupPrograms(void) {
PROGRAMS_MakeFile("SHOWGUI.COM",SHOWGUI_ProgramStart);
PROGRAMS_MakeFile("NMITEST.COM",NMITEST_ProgramStart);
PROGRAMS_MakeFile("RE-DOS.COM",REDOS_ProgramStart);

if (IS_PC98_ARCH) {
PROGRAMS_MakeFile("PC98UTIL.COM",PC98UTIL_ProgramStart);
}
}
48 changes: 46 additions & 2 deletions src/hardware/vga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ bool allow_vesa_tty = true;

bool gdc_5mhz_mode = true;

void gdc_5mhz_mode_update_vars(void) {
mem_writeb(0x54D,(mem_readb(0x54D) & (~0x04)) | (gdc_5mhz_mode ? 0x04 : 0x00));
}

void page_flip_debug_notify() {
if (enable_page_flip_debugging_marker)
vga_page_flip_occurred = true;
Expand Down Expand Up @@ -1832,7 +1836,6 @@ void VGA_OnEnterPC98(Section *sec) {
VGA_UnsetupSEQ();

LOG_MSG("PC-98: GDC is running at %.1fMHz.",gdc_5mhz_mode ? 5.0 : 2.5);
LOG_MSG("Some games require the 5MHz mode, switch the setting accordingly");

pc98_egc_srcmask[0] = 0xFF;
pc98_egc_srcmask[1] = 0xFF;
Expand Down Expand Up @@ -1959,7 +1962,7 @@ void VGA_OnEnterPC98_phase2(Section *sec) {
VGA_SetupHandlers();

/* GDC 2.5/5.0MHz setting is also reflected in BIOS data area and DIP switch registers */
mem_writeb(0x54D,(mem_readb(0x54D) & (~0x04)) | (gdc_5mhz_mode ? 0x04 : 0x00));
gdc_5mhz_mode_update_vars();

/* delay I/O port at 0x5F (0.6us) */
IO_RegisterWriteHandler(0x5F,pc98_wait_write,IO_MB);
Expand Down Expand Up @@ -6186,3 +6189,44 @@ void PC98_FM_OnEnterPC98(Section *sec) {
board86c_bind();
}

class PC98UTIL : public Program {
public:
void Run(void) {
string arg;

cmd->BeginOpt();
while (cmd->GetOpt(/*&*/arg)) {
if (arg == "?" || arg == "help") {
doHelp();
break;
}
else if (arg == "gdc25") {
gdc_5mhz_mode = false;
gdc_5mhz_mode_update_vars();
LOG_MSG("PC-98: GDC is running at %.1fMHz.",gdc_5mhz_mode ? 5.0 : 2.5);
WriteOut("GDC is now running at 2.5MHz\n");
}
else if (arg == "gdc50") {
gdc_5mhz_mode = true;
gdc_5mhz_mode_update_vars();
LOG_MSG("PC-98: GDC is running at %.1fMHz.",gdc_5mhz_mode ? 5.0 : 2.5);
WriteOut("GDC is now running at 5MHz\n");
}
else {
WriteOut("Unknown switch %s",arg.c_str());
break;
}
}
cmd->EndOpt();
}
void doHelp(void) {
WriteOut("PC98UTIL PC-98 emulation utility\n");
WriteOut(" /gdc25 Set GDC to 2.5MHz\n");
WriteOut(" /gdc50 Set GDC to 5.0MHz\n");
}
};

void PC98UTIL_ProgramStart(Program * * make) {
*make=new PC98UTIL;
}

0 comments on commit c40b9ca

Please sign in to comment.