6
6
#include " bus/midi/midiinport.h"
7
7
#include " bus/midi/midioutport.h"
8
8
#include " cpu/sh/sh7042.h"
9
+ #include " imagedev/floppy.h"
9
10
#include " machine/nvram.h"
11
+ #include " machine/upd765.h"
10
12
#include " sound/swx00.h"
11
13
#include " video/hd44780.h"
12
14
@@ -21,6 +23,8 @@ class psr540_state : public driver_device {
21
23
m_maincpu (*this , " maincpu" ),
22
24
m_swx00(*this , " swx00" ),
23
25
m_lcdc(*this , " ks0066" ),
26
+ m_floppy(*this , " fdc:0" ),
27
+ m_fdc(*this , " fdc" ),
24
28
m_nvram(*this , " ram" ),
25
29
m_inputs(*this , " B%u" , 1U ),
26
30
m_outputs(*this , " %02d.%x.%x" , 0U , 0U , 0U ),
@@ -34,6 +38,8 @@ class psr540_state : public driver_device {
34
38
required_device<sh7042_device> m_maincpu;
35
39
required_device<swx00_sound_device> m_swx00;
36
40
required_device<hd44780_device> m_lcdc;
41
+ required_device<floppy_connector> m_floppy;
42
+ required_device<hd63266f_device> m_fdc;
37
43
required_device<nvram_device> m_nvram;
38
44
required_ioport_array<8 > m_inputs;
39
45
output_finder<80 , 8 , 5 > m_outputs;
@@ -83,6 +89,8 @@ void psr540_state::machine_start()
83
89
m_pe = 0 ;
84
90
m_led = 0 ;
85
91
m_scan = 0 ;
92
+
93
+ m_fdc->set_floppy (m_floppy->get_device ());
86
94
}
87
95
88
96
u16 psr540_state::adc_sustain_r ()
@@ -100,6 +108,11 @@ u16 psr540_state::adc_battery_r()
100
108
return 0x3ff ;
101
109
}
102
110
111
+ static void psr540_floppies (device_slot_interface &device)
112
+ {
113
+ device.option_add (" 35hd" , FLOPPY_35_HD);
114
+ }
115
+
103
116
void psr540_state::psr540 (machine_config &config)
104
117
{
105
118
SH7042A (config, m_maincpu, 7_MHz_XTAL*4 ); // // md=a, on-chip rom, 32-bit space, pll 4x -- XW25610 6437042F14F 9M1 A
@@ -122,6 +135,15 @@ void psr540_state::psr540(machine_config &config)
122
135
m_lcdc->set_default_bios_tag (" f00" );
123
136
m_lcdc->set_lcd_size (2 , 40 );
124
137
138
+ HD63266F (config, m_fdc, 16_MHz_XTAL);
139
+ // m_fdc->drq_wr_callback().set([this](int state){ fdc_drq = state; maincpu->set_input_line(Z180_INPUT_LINE_DREQ0, state); });
140
+ m_fdc->set_ready_line_connected (false );
141
+ m_fdc->set_select_lines_connected (false );
142
+ m_fdc->inp_rd_callback ().set ([this ](){ return m_floppy->get_device ()->dskchg_r (); });
143
+ m_fdc->intrq_wr_callback ().set_inputline (m_maincpu, 0 );
144
+
145
+ FLOPPY_CONNECTOR (config, m_floppy, psr540_floppies, " 35hd" , floppy_image_device::default_pc_floppy_formats, true );
146
+
125
147
NVRAM (config, m_nvram, nvram_device::DEFAULT_NONE);
126
148
127
149
/* video hardware */
@@ -172,9 +194,10 @@ u8 psr540_state::pf_r()
172
194
void psr540_state::pe_w (u16 data)
173
195
{
174
196
m_pe = data;
175
- logerror (" pe lcd_rs=%x lcd_en=%x ldcic=%d fdcic=%d (%s)\n " , BIT (m_pe, 11 ), BIT (m_pe, 9 ), BIT (m_pe, 4 ), BIT (m_pe, 3 ), machine ().describe_context ());
197
+ // logerror("pe lcd_rs=%x lcd_en=%x rdens=%d ldcic=%d fdcic=%d (%s)\n", BIT(m_pe, 11), BIT(m_pe, 9), BIT(m_pe, 8 ), BIT(m_pe, 4), BIT(m_pe, 3), machine().describe_context());
176
198
m_lcdc->rs_w (BIT (m_pe, 11 ));
177
199
m_lcdc->e_w (BIT (m_pe, 9 ));
200
+ m_fdc->rate_w (!BIT (m_pe, 8 ));
178
201
179
202
if (BIT (m_pe, 4 ))
180
203
m_scan = m_led & 7 ;
@@ -198,7 +221,7 @@ void psr540_state::map(address_map &map)
198
221
199
222
// 200000-3fffff: cs0 space, 8bits, 1 cycle between accesses, cs assert extension, 6 wait states
200
223
// 200000 fdc
201
- map (0x00200000 , 0x00200000 ). lr8 ( NAME ([]() -> u8 { return 0x80 ; } ));
224
+ map (0x00200000 , 0x00200003 ). m (m_fdc, FUNC (hd63266f_device::map ));
202
225
// 280000 sram (battery-backed)
203
226
map (0x00280000 , 0x0029ffff ).ram ().share (" ram" );
204
227
// 2c0000 leds/scanning
0 commit comments