OSDN Git Service

[VM] Add vm_template.h . This class, VM_TEMPLATE:: must be mother of VM:: .See fm7...
[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 class FM7_JCOMMCARD : public DEVICE {
18 private:
19         MC6809 *cpu;
20    
21         uint8_t n_bank;
22         uint8_t rcb_address;
23         pair_t kanji_address;
24         
25         bool diag_dictrom_load;
26         
27         bool halted;
28
29         //bool modified;
30         bool firmware_ok;
31         
32         uint8_t prog_rom[0x4000];
33         uint8_t dict_rom[0x60000]; // Is this right? Is not size 0x80000? 20180216 K.O
34         uint8_t p_ram[0x2000];
35         
36 public:
37         FM7_JCOMMCARD(VM_TEMPLATE* parent_vm, EMU *parent_emu);
38         ~FM7_JCOMMCARD();
39         void initialize(void);
40         void release(void);
41         
42         void reset(void);
43         void write_signal(int id, uint32_t data, uint32_t mask);
44         /* 
45          *  I/O port:
46      * Read:   $FD28 : SYNC Flag (JSUB HALTED = 0x7F)
47      *         $FD29 : RCB Data.
48      *         $FD2A : KANJI ROM UPPER
49      *         $FD2B : KANJI ROM LOWER
50      *
51      * Write : $FD28 : KANJI ROM ADDRESS LOWER
52      *         $FD29 : KANJI ROM ADDRESS UPPER
53      *         $FD2A : Bit7: "0" = HALTREQ. Clear address.
54      *         $FD2B : Write Data to RCB.
55      */
56         uint32_t read_io8(uint32_t address);
57         void write_io8(uint32_t address, uint32_t data);
58         uint32_t read_data8(uint32_t address);
59         void write_data8(uint32_t address, uint32_t data);
60
61         void set_context_cpu(MC6809 *p) {
62                 cpu = p;
63         }
64         void decl_state();
65         void save_state(FILEIO *state_fio);
66         bool load_state(FILEIO *state_fio);
67 };
68
69 #endif  /* ___CSP_FM7_JCOMM_CARD_H  */