DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/hardware/pc98.cpp
00001 
00002 #include "dosbox.h"
00003 #include "setup.h"
00004 #include "video.h"
00005 #include "pic.h"
00006 #include "vga.h"
00007 #include "programs.h"
00008 #include "support.h"
00009 #include "setup.h"
00010 #include "timer.h"
00011 #include "mem.h"
00012 #include "util_units.h"
00013 #include "control.h"
00014 #include "mixer.h"
00015 
00016 #include <string.h>
00017 #include <stdlib.h>
00018 #include <string>
00019 #include <stdio.h>
00020 
00021 using namespace std;
00022 
00023 extern bool gdc_5mhz_mode;
00024 extern bool enable_pc98_egc;
00025 extern bool enable_pc98_grcg;
00026 
00027 void gdc_5mhz_mode_update_vars(void);
00028 void gdc_egc_enable_update_vars(void);
00029 void gdc_grcg_enable_update_vars(void);
00030 
00031 /* ====================== PC98UTIL.COM ====================== */
00032 class PC98UTIL : public Program {
00033 public:
00034         void Run(void) {
00035         string arg;
00036                 bool got_opt=false;
00037                 
00038         cmd->BeginOpt();
00039         while (cmd->GetOpt(/*&*/arg)) {
00040                         got_opt=true;
00041             if (arg == "?" || arg == "help") {
00042                 doHelp();
00043                 break;
00044             }
00045             else if (arg == "egc") {
00046                 enable_pc98_egc = true;
00047                 WriteOut("EGC graphics functions enabled\n");
00048                 gdc_egc_enable_update_vars();
00049                                 if (!enable_pc98_grcg) { //Enable GRCG if not enabled
00050                                         enable_pc98_grcg = true;
00051                                         gdc_grcg_enable_update_vars();
00052                                 }
00053 #if defined(WIN32) && !defined(C_SDL2)
00054                                 int Reflect_Menu(void);
00055                                 Reflect_Menu();
00056 #endif
00057             }
00058             else if (arg == "noegc") {
00059                 enable_pc98_egc = false;
00060                 WriteOut("EGC graphics functions disabled\n");
00061                 gdc_egc_enable_update_vars();
00062 #if defined(WIN32) && !defined(C_SDL2)
00063                                 int Reflect_Menu(void);
00064                                 Reflect_Menu();
00065 #endif
00066             }
00067             else if (arg == "gdc25") {
00068                 gdc_5mhz_mode = false;
00069                 gdc_5mhz_mode_update_vars();
00070                 LOG_MSG("PC-98: GDC is running at %.1fMHz.",gdc_5mhz_mode ? 5.0 : 2.5);
00071                 WriteOut("GDC is now running at 2.5MHz\n");
00072 #if defined(WIN32) && !defined(C_SDL2)
00073                                 int Reflect_Menu(void);
00074                                 Reflect_Menu();
00075 #endif
00076             }
00077             else if (arg == "gdc50") {
00078                 gdc_5mhz_mode = true;
00079                 gdc_5mhz_mode_update_vars();
00080                 LOG_MSG("PC-98: GDC is running at %.1fMHz.",gdc_5mhz_mode ? 5.0 : 2.5);
00081                 WriteOut("GDC is now running at 5MHz\n");
00082 #if defined(WIN32) && !defined(C_SDL2)
00083                                 int Reflect_Menu(void);
00084                                 Reflect_Menu();
00085 #endif
00086             }
00087             else {
00088                 WriteOut("Unknown switch %s",arg.c_str());
00089                 break;
00090             }
00091         }
00092         cmd->EndOpt();
00093                 if(!got_opt) doHelp();
00094         }
00095     void doHelp(void) {
00096         WriteOut("PC98UTIL PC-98 emulation utility\n");
00097         WriteOut("  /gdc25     Set GDC to 2.5MHz\n");
00098         WriteOut("  /gdc50     Set GDC to 5.0MHz\n");
00099         WriteOut("  /egc       Enable EGC\n");
00100         WriteOut("  /noegc     Disable EGC\n");
00101     }
00102 };
00103 
00104 void PC98UTIL_ProgramStart(Program * * make) {
00105         *make=new PC98UTIL;
00106 }
00107 /*==============================================*/
00108 
00109 /* wait-delay I/O port of some kind */
00110 void pc98_wait_write(Bitu port,Bitu val,Bitu iolen) {
00111     (void)iolen;//UNUSED
00112     (void)port;//UNUSED
00113     (void)val;//UNUSED
00114     unsigned int wait_cycles = (unsigned int)(CPU_CycleMax * 0.0006); /* 0.6us = 0.0006ms */
00115 
00116     CPU_Cycles -= wait_cycles;
00117 }
00118