2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
17 #define SIG_Z80PIO_PORT_A 0
18 #define SIG_Z80PIO_PORT_B 1
19 #define SIG_Z80PIO_STROBE_A 2
20 #define SIG_Z80PIO_STROBE_B 3
22 class Z80PIO : public DEVICE
47 outputs_t outputs_data;
48 outputs_t outputs_ready;
52 void check_mode3_intr(int ch);
55 DEVICE *d_cpu, *d_child;
61 Z80PIO(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
63 memset(port, 0, sizeof(port));
64 for(int i = 0; i < 2; i++) {
65 initialize_output_signals(&port[i].outputs_data);
66 initialize_output_signals(&port[i].outputs_ready);
67 port[i].wreg = 0xffffff00;
70 d_cpu = d_child = NULL;
71 set_device_name(_T("Z80 PIO"));
77 void write_io8(uint32_t addr, uint32_t data);
78 uint32_t read_io8(uint32_t addr);
79 void write_signal(int id, uint32_t data, uint32_t mask);
80 void save_state(FILEIO* state_fio);
81 bool load_state(FILEIO* state_fio);
82 // interrupt common functions
83 void set_context_intr(DEVICE* device, uint32_t bit)
88 void set_context_child(DEVICE* device)
92 void set_intr_iei(bool val);
93 uint32_t get_intr_ack();
94 void notify_intr_reti();
97 void set_context_port_a(DEVICE* device, int id, uint32_t mask, int shift)
99 register_output_signal(&port[0].outputs_data, device, id, mask, shift);
101 void set_context_port_b(DEVICE* device, int id, uint32_t mask, int shift)
103 register_output_signal(&port[1].outputs_data, device, id, mask, shift);
105 void set_context_ready_a(DEVICE* device, int id, uint32_t mask)
107 register_output_signal(&port[0].outputs_ready, device, id, mask);
109 void set_context_ready_b(DEVICE* device, int id, uint32_t mask)
111 register_output_signal(&port[1].outputs_ready, device, id, mask);
113 void set_hand_shake(int ch, bool value)
115 port[ch].hand_shake = value;