OSDN Git Service

[VM] TRY:Use namespace {VMNAME} to separate around VMs. This feature still apply...
[csp-qt/common_source_project-fm7.git] / source / src / vm / fm7 / jcommcard.h
1 /*
2  * Emulation of Fujitsu Japanese Communication Card.
3  * (C) 2018 K.Ohta.
4  * Note:
5  * Based on XM7 L70 , with permittion from Ryu Takegami. 
6  */
7
8
9 #if !defined(___CSP_FM7_JCOMM_CARD_H)
10 #define ___CSP_FM7_JCOMM_CARD_H
11
12 #include "../device.h"
13 #include "../../common.h"
14
15 class MC6809;
16
17 namespace FM7 {
18
19 class FM7_JCOMMCARD : public DEVICE {
20 private:
21         MC6809 *cpu;
22    
23         uint8_t n_bank;
24         uint8_t rcb_address;
25         pair_t kanji_address;
26         
27         bool diag_dictrom_load;
28         
29         bool halted;
30
31         //bool modified;
32         bool firmware_ok;
33         
34         uint8_t prog_rom[0x4000];
35         uint8_t dict_rom[0x60000]; // Is this right? Is not size 0x80000? 20180216 K.O
36         uint8_t p_ram[0x2000];
37         
38 public:
39         FM7_JCOMMCARD(VM_TEMPLATE* parent_vm, EMU *parent_emu);
40         ~FM7_JCOMMCARD();
41         void initialize(void);
42         void release(void);
43         
44         void reset(void);
45         void write_signal(int id, uint32_t data, uint32_t mask);
46         /* 
47          *  I/O port:
48      * Read:   $FD28 : SYNC Flag (JSUB HALTED = 0x7F)
49      *         $FD29 : RCB Data.
50      *         $FD2A : KANJI ROM UPPER
51      *         $FD2B : KANJI ROM LOWER
52      *
53      * Write : $FD28 : KANJI ROM ADDRESS LOWER
54      *         $FD29 : KANJI ROM ADDRESS UPPER
55      *         $FD2A : Bit7: "0" = HALTREQ. Clear address.
56      *         $FD2B : Write Data to RCB.
57      */
58         uint32_t read_io8(uint32_t address);
59         void write_io8(uint32_t address, uint32_t data);
60         uint32_t read_data8(uint32_t address);
61         void write_data8(uint32_t address, uint32_t data);
62
63         void set_context_cpu(MC6809 *p) {
64                 cpu = p;
65         }
66         bool process_state(FILEIO *state_fio, bool loading);
67 };
68
69 }
70
71 #endif  /* ___CSP_FM7_JCOMM_CARD_H  */