ym2203.cpp
dummydevice.cpp
+ prnfile.cpp
datarec.cpp
disk.cpp
event.cpp
void set_freq(int);
void set_latency(int);
void set_sound_device(int);
-#if defined(USE_PRINTER)
- void set_printer_device(int);
-#endif
void set_monitor_type(int);
void message_status_bar(QString);
void resize_statusbar(int w, int h);
return true;
}
#endif
+#if defined(USE_PRINTER)
+ void set_printer_device(int);
+#endif
void do_show_about(void);
void do_browse_document(QString);
signals:
this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
actionCapture_Screen->setText(QApplication::translate("MainWindow", "Capture Screen", 0));
-
+#if defined(USE_PRINTER_TYPE)
+ actionPrintDevice[1]->setText(QApplication::translate("MainWindow", "Dempa Joystick with #1", 0));
+ actionPrintDevice[2]->setText(QApplication::translate("MainWindow", "Dempa Joystick with #2", 0));
+#endif
#ifdef USE_DEBUGGER
actionDebugger_1->setText(QApplication::translate("MainWindow", "Debug Main CPU", 0));
actionDebugger_2->setText(QApplication::translate("MainWindow", "Debug Sub CPU", 0));
#include "../device.h"
#include "../event.h"
#include "../memory.h"
+#include "../prnfile.h"
+
#ifdef USE_DEBUGGER
#include "../debugger.h"
#endif
keyboard_beep = new BEEP(this, emu);
#endif
keyboard = new KEYBOARD(this, emu);
- display = new DISPLAY(this, emu);
+ display = new DISPLAY(this, emu);
+ printer = new PRNFILE(this, emu);
mainio = new FM7_MAINIO(this, emu);
mainmem = new FM7_MAINMEM(this, emu);
mainio->set_context_kanjirom_class1(kanjiclass1);
mainio->set_context_mainmem(mainmem);
mainio->set_context_keyboard(keyboard);
+ mainio->set_context_printer(printer);
#if defined(CAPABLE_KANJI_CLASS2)
mainio->set_context_kanjirom_class2(kanjiclass2);
#define USE_MINIMUM_RENDERING 1
#define USE_MOUSE
#define USE_JOYSTICK
+#define USE_PRINTER
+#define USE_PRINTER_TYPE 4
-//#undef HAS_YM2608
-//#define SUPPORT_YM2203_PORT
-//#define HAS_AY_3_8910
// 4:3
#define SCREEN_WIDTH_ASPECT 640
#define SCREEN_HEIGHT_ASPECT 400
#define USE_AUTO_KEY_RELEASE 6
#define USE_CRT_FILTER
#define USE_ACCESS_LAMP
-//#define USE_DISK_WRITE_PROTECT
#define USE_STATE
#define USE_DEBUGGER
-//#define USE_DIG_RESOLUTION 1
-//#define _DEBUG_LOG
-
-//#define _FDC_DEBUG_LOG
#if defined(_FM8)
#define FM7_DIPSW_FRAMESKIP 0x30000000
#define FM7_DIPSW_SYNC_TO_HSYNC 0x80000000
+
#define MAINCLOCK_NORMAL 1798000
#define MAINCLOCK_MMR 1565000
#define MAINCLOCK_FAST_MMR 2016000
// FD02
cmt_indat = false; // bit7
cmt_invert = false; // Invert signal
- lpt_det2 = false;
- lpt_det1 = false;
+ lpt_det2 = true;
+ lpt_det1 = true;
lpt_pe = false;
lpt_ackng_inv = false;
lpt_error_inv = false;
- lpt_busy = false;
+ lpt_busy = true;
// FD04
#if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX) || \
defined(_FM77AV20) || defined(_FM77AV20EX) || defined(_FM77AV20SX)
sub_cancel_bak = sub_cancel; // bit6 : '1' Cancel req.
sub_halt_bak = sub_halt; // bit6 : '1' Cancel req.
//sub_busy = false;
+ // FD02
+ //lpt_det2 = true;
+ //lpt_det1 = true;
+ //lpt_pe = false;
+ //lpt_ackng_inv = false;
+ //lpt_error_inv = false;
+ //lpt_busy = true;
extdet_neg = false;
{
drec->write_signal(SIG_DATAREC_MIC, data, 0x01);
drec->write_signal(SIG_DATAREC_REMOTE, data, 0x02);
+ lpt_slctin = ((data & 0x80) != 0);
+ lpt_strobe = ((data & 0x40) != 0);
+ printer->write_signal(SIG_PRINTER_STROBE, lpt_strobe ? 0xff : 0x00, 0xff);
}
uint8 FM7_MAINIO::get_port_fd02(void)
{
uint8 ret;
// Still unimplemented printer.
- ret = (cmt_indat) ? 0xff : 0x7f; // CMT
+ ret = (cmt_indat) ? 0xff : 0x7f; // CMT
+
+ if(config.printer_device_type == 0) {
+ lpt_busy = (printer->read_signal(SIG_PRINTER_BUSY) != 0);
+ lpt_error_inv = false;
+ lpt_ackng_inv = false;
+ lpt_pe = false;
+ } else if((config.printer_device_type == 1) || (config.printer_device_type == 2)) {
+ lpt_pe = (joystick->read_data8(config.printer_device_type + 1) != 0); // check joy port;
+ lpt_busy = true;
+ lpt_error_inv = false;
+ lpt_ackng_inv = false;
+ } else {
+ lpt_busy = true;
+ lpt_error_inv = false;
+ lpt_ackng_inv = false;
+ lpt_pe = true;
+ }
+ ret &= (lpt_busy) ? 0xff : ~0x01;
+ ret &= (lpt_error_inv) ? ~0x02 : 0xff;
+ ret &= (lpt_ackng_inv) ? ~0x04 : 0xff;
+ ret &= (lpt_pe) ? 0xff : ~0x08;
+ ret &= (lpt_det1) ? 0xff : ~0x10;
+ ret &= (lpt_det2) ? 0xff : ~0x20;
return ret;
}
irqstat_reg0 |= 0x02;
irqstat_printer = false;
}
- if(backup != irqstat_reg0) do_irq();
+ do_irq();
}
void FM7_MAINIO::set_irq_keyboard(bool flag)
return;
break;
case 0x01: // FD01
- // set_lptdata_fd01((uint8)data);
+ switch(config.printer_device_type) {
+ case 0: // Write to file
+ printer->write_signal(SIG_PRINTER_DATA, data, 0xff);
+ set_irq_printer(lpt_strobe & lpt_slctin);
+ break;
+ case 1:
+ case 2:
+ joystick->write_data8(0x01, data);
+ //set_irq_printer(lpt_strobe & lpt_slctin);
+ break;
+ }
break;
case 0x02: // FD02
set_port_fd02((uint8)data);
YM2203* opn[4]; // 0=OPN 1=WHG 2=THG 3=PSG
DEVICE* drec;
- DEVICE* pcm1bit;
+ DEVICE* pcm1bit;
DEVICE* joystick;
//DEVICE* beep;
#if defined(HAS_DMA)
HD6844* dmac;
#endif
- //FM7_PRINTER *printer;
+ DEVICE *printer;
//FM7_RS232C *rs232c;
/* */
DEVICE *kanjiclass1;
return _T("FM7_MAIN_IO");
}
+ void set_context_printer(DEVICE *p)
+ {
+ printer = p;
+ }
void set_context_kanjirom_class1(DEVICE *p)
{
kanjiclass1 = p;
mouse_timeout_event = -1;
port_a_val = 0;
port_b_val = 0;
+ lpmask = 0x00;
}
void JOYSTICK::reset()
{
+ int i;
joydata[0] = joydata[1] = 0xff;
dx = dy = 0;
lx = ly = 0;
mouse_phase = 0;
mouse_strobe = false;
mouse_type = config.device_type;
- if(mouse_type == 1) emulate_mouse[0] = true;
- if(mouse_type == 2) emulate_mouse[1] = true;
+ for(i = 0; i < 2; i++) {
+ if(mouse_type == (i + 1)) {
+ emulate_mouse[i] = true;
+ } else {
+ emulate_mouse[i] = false;
+ }
+ }
mouse_state = p_emu->mouse_buffer();
}
retval |= 0xc0;
joydata[ch] = retval;
} else { // MOUSE
-
}
}
}
//if(opn == NULL) return 0xff;
switch(addr) {
- case 0:
+ case 0: // OPN
//opn->write_io8(0, 0x0f);
//opnval = opn->read_io8(1);
opnval = port_b_val;
return update_mouse((opnval & 0x0c) << 2);
}
}
-
switch(opnval & 0xf0) {
case 0x20:
- val = joydata[0];
+ if(config.printer_device_type != 1) val = joydata[0];
break;
case 0x50:
- val = joydata[1];
+ if(config.printer_device_type != 2) val = joydata[1];
break;
}
break;
+ case 2: // Get Printer Joystick (CH0)
+ case 3: // Get Printer Joystick (CH1)
+ int ch = addr - 1;
+ if(config.printer_device_type == ch) {
+ uint8 raw = rawdata[ch - 1];
+ bool f = false;
+ f |= ((raw & 0x08) && !(lpmask & 0x01));
+ f |= ((raw & 0x04) && !(lpmask & 0x02));
+ f |= ((raw & 0x01) && !(lpmask & 0x04));
+ f |= ((raw & 0x02) && !(lpmask & 0x08));
+ f |= ((raw & 0x20) && !(lpmask & 0x10));
+ f |= ((raw & 0x10) && !(lpmask & 0x20));
+ if(f) val = 0x00;
+ }
}
return val;
}
void JOYSTICK::write_data8(uint32 addr, uint32 data)
{
+ switch(addr & 0x00ff) {
+ case 1: // JOYSTICK PRINTER(ch1)
+ if((config.printer_device_type == 1) || (config.printer_device_type == 2)) {
+ lpmask = data & 0x3f;
+ }
+ break;
+ }
}
void JOYSTICK::write_signal(int id, uint32 data, uint32 mask)
update_strobe(((data & 0x20) != 0));
}
break;
-
}
}
void JOYSTICK::update_config(void)
{
+ int i;
if(mouse_type == config.device_type) return;
mouse_type = config.device_type;
- switch(config.device_type){
+ switch(mouse_type & 0x03){
case 1:
emulate_mouse[0] = true;
emulate_mouse[1] = false;
break;
}
}
-#define STATE_VERSION 2
+#define STATE_VERSION 3
void JOYSTICK::save_state(FILEIO *state_fio)
{
int ch;
state_fio->FputUint32_BE(mouse_data);
//state_fio->FputInt32(mouse_timeout_event);
// Version 3
+ state_fio->FputUint8(lpmask);
}
bool JOYSTICK::load_state(FILEIO *state_fio)
mouse_phase = state_fio->FgetUint32_BE();
mouse_data = state_fio->FgetUint32_BE();
//mouse_timeout_event = state_fio->FgetInt32();
- if(version == 2) stat = true;
+ lpmask = state_fio->FgetUint8();
+ if(version == 3) stat = true;
return stat;
}
int mouse_timeout_event;
uint32 port_a_val;
uint32 port_b_val;
+ uint8 lpmask;
protected:
VM* p_vm;
EMU* p_emu;