2 EPSON QC-10 Emulator 'eQC-10'
4 Author : Takeda.Toshiya
12 #include "../../fifo.h"
18 void MFONT::initialize()
20 memset(mfont, 0xff, sizeof(mfont));
22 // load multifont rom image
23 FILEIO* fio = new FILEIO();
24 if(fio->Fopen(create_local_path(_T("MFONT.ROM")), FILEIO_READ_BINARY)) {
25 fio->Fread(mfont, sizeof(mfont), 1);
44 void MFONT::write_io8(uint32_t addr, uint32_t data)
49 if(cmd->count() == 3) {
50 int mode = cmd->read();
51 int code = cmd->read();
52 code |= cmd->read() << 8;
54 if(0x200 <= code && code < 0xc00) {
55 int ofs = (code - 0x200) * 36;
58 for(int i = 0; i < 36; i++) {
59 res->write(mfont[ofs + i]);
61 status = BIT_IBF | BIT_OBF;
62 d_pic->write_signal(SIG_I8259_IR7 | SIG_I8259_CHIP1, 1, 1);
71 d_pic->write_signal(SIG_I8259_IR7 | SIG_I8259_CHIP1, 1, 1);
76 uint32_t MFONT::read_io8(uint32_t addr)
89 d_pic->write_signal(SIG_I8259_IR7 | SIG_I8259_CHIP1, 0, 1);
95 #define STATE_VERSION 1
97 #include "../../statesub.h"
99 void MFONT::decl_state()
101 enter_decl_state(STATE_VERSION);
103 DECL_STATE_ENTRY_UINT8(status);
104 DECL_STATE_ENTRY_FIFO(cmd);
105 DECL_STATE_ENTRY_FIFO(res);
110 void MFONT::save_state(FILEIO* state_fio)
112 if(state_entry != NULL) {
113 state_entry->save_state(state_fio);
115 // state_fio->FputUint32(STATE_VERSION);
116 // state_fio->FputInt32(this_device_id);
118 // state_fio->FputUint8(status);
119 // cmd->save_state((void *)state_fio);
120 // res->save_state((void *)state_fio);
123 bool MFONT::load_state(FILEIO* state_fio)
126 if(state_entry != NULL) {
127 mb = state_entry->load_state(state_fio);
132 // if(state_fio->FgetUint32() != STATE_VERSION) {
135 // if(state_fio->FgetInt32() != this_device_id) {
138 // status = state_fio->FgetUint8();
139 // if(!cmd->load_state((void *)state_fio)) {
142 // if(!res->load_state((void *)state_fio)) {
148 bool MFONT::process_state(FILEIO* state_fio, bool loading)
150 if(!state_fio->StateCheckUint32(STATE_VERSION)) {
153 if(!state_fio->StateCheckInt32(this_device_id)) {
156 state_fio->StateUint8(status);
157 if(!cmd->process_state((void *)state_fio, loading)) {
160 if(!res->process_state((void *)state_fio, loading)) {