2 TOSHIBA PASOPIA 7 Emulator 'EmuPIA7'
4 Author : Takeda.Toshiya
12 #include "../../fileio.h"
14 void IOTRAP::initialize()
16 nmi_mask = pasopia = false;
19 void IOTRAP::write_io8(uint32 addr, uint32 data)
27 // trap : 8255-2 Port B, bit 1
28 d_pio2->write_signal(SIG_I8255_PORT_B, 2, 2);
31 d_cpu->write_signal(SIG_CPU_NMI, 1, 1);
38 uint32 IOTRAP::read_io8(uint32 addr)
46 // trap : 8255-2 Port B, bit 1
47 d_pio2->write_signal(SIG_I8255_PORT_B, 2, 2);
50 d_cpu->write_signal(SIG_CPU_NMI, 1, 1);
58 void IOTRAP::write_signal(int id, uint32 data, uint32 mask)
60 if(id == SIG_IOTRAP_I8255_2_A) {
61 // reset nmi : 8255-2 Port B, bit 1+2
63 d_pio2->write_signal(SIG_I8255_PORT_B, 0, 6);
65 } else if(id == SIG_IOTRAP_I8255_2_C) {
66 nmi_mask = ((data & 0x80) != 0);
67 pasopia = ((data & 0x40) != 0);
71 void IOTRAP::do_reset()
73 // reset : 8255-2 Port B, bit 2
74 d_pio2->write_signal(SIG_I8255_PORT_B, 4, 4);
77 d_cpu->write_signal(SIG_CPU_NMI, 1, 1);
81 #define STATE_VERSION 1
83 void IOTRAP::save_state(FILEIO* state_fio)
85 state_fio->FputUint32(STATE_VERSION);
86 state_fio->FputInt32(this_device_id);
88 state_fio->FputBool(nmi_mask);
89 state_fio->FputBool(pasopia);
92 bool IOTRAP::load_state(FILEIO* state_fio)
94 if(state_fio->FgetUint32() != STATE_VERSION) {
97 if(state_fio->FgetInt32() != this_device_id) {
100 nmi_mask = state_fio->FgetBool();
101 pasopia = state_fio->FgetBool();