2 TOSHIBA PASOPIA Emulator 'EmuPIA'
4 Author : Takeda.Toshiya
13 #include "kanjipac2.h"
16 void PAC2::initialize()
18 rampac2 = new RAMPAC2(static_cast<VM *>(vm), emu);
19 kanji = new KANJIPAC2(static_cast<VM *>(vm), emu);
20 joy = new JOYPAC2(static_cast<VM *>(vm), emu);
21 dummy = new PAC2DEV(static_cast<VM *>(vm), emu);
22 rampac2->initialize(1);
39 device_type = config.device_type;
40 get_device()->reset();
43 void PAC2::write_io8(uint32_t addr, uint32_t data)
50 get_device()->write_io8(addr, data);
55 uint32_t PAC2::read_io8(uint32_t addr)
57 return get_device()->read_io8(addr);
60 PAC2DEV* PAC2::get_device()
65 case DEVICE_KANJI_ROM:
73 void PAC2::open_rampac2(const _TCHAR* file_path)
75 rampac2->open_file(file_path);
78 #define STATE_VERSION 1
80 #include "../../statesub.h"
82 void PAC2::decl_state()
84 enter_decl_state(STATE_VERSION);
86 DECL_STATE_ENTRY_INT32(device_type);
89 rampac2->decl_state();
105 void PAC2::save_state(FILEIO* state_fio)
107 if(state_entry != NULL) {
108 state_entry->save_state(state_fio);
110 // state_fio->FputUint32(STATE_VERSION);
111 // state_fio->FputInt32(this_device_id);
113 // state_fio->FputInt32(device_type);
114 get_device()->save_state(state_fio);
117 bool PAC2::load_state(FILEIO* state_fio)
120 if(state_entry != NULL) {
121 mb = state_entry->load_state(state_fio);
123 if(!mb) return false;
124 // if(state_fio->FgetUint32() != STATE_VERSION) {
127 // if(state_fio->FgetInt32() != this_device_id) {
130 // device_type = state_fio->FgetInt32();
131 if(!get_device()->load_state(state_fio)) {
137 bool PAC2::process_state(FILEIO* state_fio, bool loading)
139 if(!state_fio->StateCheckUint32(STATE_VERSION)) {
142 if(!state_fio->StateCheckInt32(this_device_id)) {
145 state_fio->StateInt32(device_type);
146 return get_device()->process_state(state_fio, loading);