1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
// license:BSD-3-Clause
// copyright-holders: F. Ulivi
/*********************************************************************
isbc202.h
Intel iSBC-202 SSDD 8" floppy disk controller
*********************************************************************/
#ifndef MAME_BUS_MULTIBUS_ISBC202_H
#define MAME_BUS_MULTIBUS_ISBC202_H
#pragma once
#include "multibus.h"
#include "machine/i3001.h"
#include "machine/i3002.h"
#include "machine/fdc_pll.h"
#include "imagedev/floppy.h"
class isbc202_device : public cpu_device,
public device_multibus_interface
{
public:
// Construction/destruction
isbc202_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual ~isbc202_device();
// device_multibus_interface overrides
virtual void install_io_rw(address_space& space) override;
virtual void install_mem_rw(address_space& space) override;
// Access to I/O space by CPU
DECLARE_READ8_MEMBER(io_r);
DECLARE_WRITE8_MEMBER(io_w);
DECLARE_WRITE_LINE_MEMBER(co_w);
uint8_t px_r();
protected:
// device_t overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
// device_execute_interface overrides
virtual uint32_t execute_min_cycles() const noexcept override { return 1; }
virtual void execute_run() override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
// device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry) override;
virtual void state_export(const device_state_entry &entry) override;
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
private:
required_device<i3001_device> m_mcu;
required_device_array<i3002_device , 4> m_cpes;
required_device_array<floppy_connector , 4> m_drives;
address_space_config m_program_config;
memory_access<9, 2 , -2 , ENDIANNESS_BIG>::cache m_cache;
address_space *m_mem_space;
int m_icount;
uint8_t m_flags;
uint8_t m_regs[ i3002_device::REG_COUNT ];
uint16_t m_microcode_addr;
uint32_t m_code_word;
uint8_t m_ac;
uint8_t m_fc;
bool m_fc32;
bool m_fc10;
enum { // m_in_sel Input on AC[0]
IN_SEL_AC0, // 0 AC[0]
IN_SEL_CO, // 1 CO
IN_SEL_START, // 2 START
IN_SEL_F, // 3 F
IN_SEL_AZ, // 4 AZ
IN_SEL_INDEX, // 5 INDEX
IN_SEL_XFERQ, // 6 XFERREQ
IN_SEL_TIMEOUT,//7 TIMEOUT
IN_SEL_COUNT
};
uint8_t m_in_sel;
uint8_t m_out_sel;
uint8_t m_slk;
uint8_t m_mask;
uint8_t m_kbus;
bool m_inputs[ IN_SEL_COUNT ];
// IC identifiers have this form: x-Ayy
// where x is either C (for channel board) or I (for interface board)
// and yy is the numeric IC ID.
uint8_t m_op_us; // C-A44
floppy_image_device *m_current_drive;
uint8_t m_px_s1s0; // C-A16-11 & C-A16-13
uint8_t m_cmd; // C-A8
cpu_device *m_cpu; // When != nullptr: CPU is suspended in wait state
bool m_cpu_rd;
uint8_t m_ready_in;
uint8_t m_ready_ff; // I-A44 & I-A43
bool m_gate_lower; // I-A58-9
bool m_irq; // C-A37-9
uint8_t m_data_low_out; // C-A43
uint8_t m_data_low_in; // C-A25
uint8_t m_cpu_data;
uint8_t m_addr_low_out; // C-A41
bool m_mem_wrt; // I-A58-4
bool m_wrt_inh; // I-A46-13
bool m_direction; // I-A58-11
bool m_ibus_cached;
uint8_t m_ibus;
uint16_t m_crc; // I-A62
bool m_crc_enabled; // I-A58-13
bool m_crc_out; // C-A16-2
bool m_reading; // I-A46-9
bool m_writing; // C-A16-4
uint16_t m_data_sr; // C-A36 & C-A29 (MSB), next byte in LSB
bool m_last_data_bit; // I-A48-6
uint16_t m_clock_sr; // C-A34 & C-A27 (MSB), next byte in LSB
attotime m_last_f_time;
bool m_clock_gate; // I-A10-8
bool m_amwrt; // I-A58-6
bool m_dlyd_amwrt;
// PLL
fdc_pll_t m_pll;
// Timers
emu_timer *m_timeout_timer;
emu_timer *m_byte_timer;
emu_timer *m_f_timer;
void set_output();
unsigned selected_drive() const;
unsigned drive_idx(floppy_image_device *drive);
void floppy_ready_cb(floppy_image_device *floppy , int state);
void floppy_index_cb(floppy_image_device *floppy , int state);
uint8_t dbus_r() const;
uint8_t mbus_r() const;
uint8_t abus_r() const;
uint8_t ibus_r();
void set_start(uint8_t off , bool read);
void set_rd_wr(bool new_rd , bool new_wr);
uint8_t aligned_rd_data(uint16_t sr);
void rd_bits(unsigned n);
void write_byte();
bool update_crc(bool bit);
};
// device type declaration
DECLARE_DEVICE_TYPE(ISBC202, isbc202_device)
#endif /* MAME_BUS_MULTIBUS_ISBC202_H */
|