src/mess/machine/c2040.c
| r11262 | r11263 | |
| 12 | 12 | TODO: |
| 13 | 13 | |
| 14 | 14 | - 2040 DOS 1 FDC rom (jumps to 104d while getting block header) |
| 15 | | |
| 15 | |
| 16 | 16 | FE70: jsr $104D |
| 17 | 17 | 104D: m6502_brk#$00 |
| 18 | 18 | |
| 19 | 19 | - Micropolis 8x50 stepper motor is same as 4040, except it takes 4 pulses to step a track instead of 1 |
| 20 | | - error/activity LEDs |
| 20 | - 8250 cannot read d80 images |
| 21 | 21 | |
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | | #include "emu.h" |
| 25 | 24 | #include "c2040.h" |
| 26 | | #include "cpu/m6502/m6502.h" |
| 27 | | #include "imagedev/flopdrv.h" |
| 28 | | #include "formats/d64_dsk.h" |
| 29 | | #include "formats/g64_dsk.h" |
| 30 | | #include "machine/6522via.h" |
| 31 | | #include "machine/6532riot.h" |
| 32 | | #include "machine/mos6530.h" |
| 33 | | #include "machine/ieee488.h" |
| 34 | 25 | |
| 35 | | /*************************************************************************** |
| 36 | | PARAMETERS |
| 37 | | ***************************************************************************/ |
| 38 | 26 | |
| 27 | |
| 28 | //************************************************************************** |
| 29 | // MACROS / CONSTANTS |
| 30 | //************************************************************************** |
| 31 | |
| 39 | 32 | #define M6502_TAG "un1" |
| 40 | 33 | #define M6532_0_TAG "uc1" |
| 41 | 34 | #define M6532_1_TAG "ue1" |
| r11262 | r11263 | |
| 44 | 37 | #define M6522_TAG "um3" |
| 45 | 38 | #define M6530_TAG "uk3" |
| 46 | 39 | |
| 47 | | #define C2040_REGION "c2040" |
| 48 | | #define C4040_REGION "c4040" |
| 49 | | #define C8050_REGION "c8050" |
| 50 | | #define SFD1001_REGION "sfd1001" |
| 51 | 40 | |
| 41 | enum |
| 42 | { |
| 43 | LED_POWER = 0, |
| 44 | LED_ACT0, |
| 45 | LED_ACT1, |
| 46 | LED_ERR |
| 47 | }; |
| 48 | |
| 49 | |
| 52 | 50 | #define SYNC \ |
| 53 | | (!(((c2040->sr & G64_SYNC_MARK) == G64_SYNC_MARK) & c2040->rw)) |
| 51 | (!(((m_sr & G64_SYNC_MARK) == G64_SYNC_MARK) & m_rw)) |
| 54 | 52 | |
| 55 | 53 | #define ERROR \ |
| 56 | | (!(c2040->ready | BIT(c2040->e, 3))) |
| 54 | (!(m_ready | BIT(m_e, 3))) |
| 57 | 55 | |
| 58 | | /*************************************************************************** |
| 59 | | TYPE DEFINITIONS |
| 60 | | ***************************************************************************/ |
| 61 | 56 | |
| 62 | | typedef struct _c2040_unit_t c2040_unit_t; |
| 63 | | struct _c2040_unit_t |
| 64 | | { |
| 65 | | /* motors */ |
| 66 | | int stp; /* stepper motor phase */ |
| 67 | | int mtr; /* spindle motor on */ |
| 68 | 57 | |
| 69 | | /* track */ |
| 70 | | UINT8 track_buffer[G64_BUFFER_SIZE]; /* track data buffer */ |
| 71 | | int track_len; /* track length */ |
| 72 | | int buffer_pos; /* byte position within track buffer */ |
| 73 | | int bit_pos; /* bit position within track buffer byte */ |
| 58 | //************************************************************************** |
| 59 | // DEVICE DEFINITIONS |
| 60 | //************************************************************************** |
| 74 | 61 | |
| 75 | | /* devices */ |
| 76 | | device_t *image; |
| 77 | | }; |
| 62 | const device_type C2040 = c2040_device_config::static_alloc_device_config; |
| 63 | const device_type C3040 = c2040_device_config::static_alloc_device_config; |
| 64 | const device_type C4040 = c2040_device_config::static_alloc_device_config; |
| 65 | const device_type C8050 = c2040_device_config::static_alloc_device_config; |
| 66 | const device_type C8250 = c2040_device_config::static_alloc_device_config; |
| 67 | const device_type SFD1001 = c2040_device_config::static_alloc_device_config; |
| 78 | 68 | |
| 79 | | typedef struct _c2040_t c2040_t; |
| 80 | | struct _c2040_t |
| 81 | | { |
| 82 | | /* hardware */ |
| 83 | | c2040_unit_t unit[2]; /* drive unit */ |
| 84 | | int drive; /* selected drive */ |
| 85 | | int side; /* selected side */ |
| 86 | 69 | |
| 87 | | /* IEEE-488 bus */ |
| 88 | | int address; /* device address - 8 */ |
| 89 | | int rfdo; /* not ready for data output */ |
| 90 | | int daco; /* not data accepted output */ |
| 91 | | int atna; /* attention acknowledge */ |
| 92 | 70 | |
| 93 | | /* track */ |
| 94 | | int ds; /* density select */ |
| 95 | | int bit_count; /* GCR bit counter */ |
| 96 | | UINT16 sr; /* GCR data shift register */ |
| 97 | | UINT8 pi; /* parallel data input */ |
| 98 | | UINT8* gcr; /* GCR encoder/decoder ROM */ |
| 99 | | UINT16 i; /* GCR encoder/decoded ROM address */ |
| 100 | | UINT8 e; /* GCR encoder/decoded ROM data */ |
| 71 | //************************************************************************** |
| 72 | // DEVICE CONFIGURATION |
| 73 | //************************************************************************** |
| 101 | 74 | |
| 102 | | /* signals */ |
| 103 | | int ready; /* byte ready */ |
| 104 | | int mode; /* mode select */ |
| 105 | | int rw; /* read/write select */ |
| 106 | | int miot_irq; /* MIOT interrupt */ |
| 75 | //------------------------------------------------- |
| 76 | // c2040_device_config - constructor |
| 77 | //------------------------------------------------- |
| 107 | 78 | |
| 108 | | /* devices */ |
| 109 | | device_t *cpu_dos; |
| 110 | | device_t *cpu_fdc; |
| 111 | | device_t *riot0; |
| 112 | | device_t *riot1; |
| 113 | | device_t *miot; |
| 114 | | via6522_device *via; |
| 115 | | device_t *bus; |
| 79 | c2040_device_config::c2040_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 80 | : device_config(mconfig, static_alloc_device_config, "C2040", tag, owner, clock), |
| 81 | device_config_ieee488_interface(mconfig, *this) |
| 82 | { |
| 83 | } |
| 116 | 84 | |
| 117 | | /* timers */ |
| 118 | | emu_timer *bit_timer; |
| 119 | | }; |
| 120 | 85 | |
| 121 | | /*************************************************************************** |
| 122 | | INLINE FUNCTIONS |
| 123 | | ***************************************************************************/ |
| 86 | //------------------------------------------------- |
| 87 | // static_alloc_device_config - allocate a new |
| 88 | // configuration object |
| 89 | //------------------------------------------------- |
| 124 | 90 | |
| 125 | | INLINE c2040_t *get_safe_token(device_t *device) |
| 91 | device_config *c2040_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 126 | 92 | { |
| 127 | | assert(device != NULL); |
| 128 | | assert((device->type() == C2040) || (device->type() == C3040) || (device->type() == C4040) || |
| 129 | | (device->type() == C8050) || (device->type() == C8250) || (device->type() == SFD1001)); |
| 130 | | return (c2040_t *)downcast<legacy_device_base *>(device)->token(); |
| 93 | return global_alloc(c2040_device_config(mconfig, tag, owner, clock)); |
| 131 | 94 | } |
| 132 | 95 | |
| 133 | | INLINE c2040_config *get_safe_config(device_t *device) |
| 96 | |
| 97 | //------------------------------------------------- |
| 98 | // alloc_device - allocate a new device object |
| 99 | //------------------------------------------------- |
| 100 | |
| 101 | device_t *c2040_device_config::alloc_device(running_machine &machine) const |
| 134 | 102 | { |
| 135 | | assert(device != NULL); |
| 136 | | assert((device->type() == C2040) || (device->type() == C3040) || (device->type() == C4040) || |
| 137 | | (device->type() == C8050) || (device->type() == C8250) || (device->type() == SFD1001)); |
| 138 | | return (c2040_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); |
| 103 | return auto_alloc(machine, c2040_device(machine, *this)); |
| 139 | 104 | } |
| 140 | 105 | |
| 141 | | INLINE void update_ieee_signals(device_t *device) |
| 142 | | { |
| 143 | | c2040_t *c2040 = get_safe_token(device); |
| 144 | 106 | |
| 145 | | int atn = ieee488_atn_r(c2040->bus); |
| 146 | | int atna = c2040->atna; |
| 147 | | int rfdo = c2040->rfdo; |
| 148 | | int daco = c2040->daco; |
| 107 | //------------------------------------------------- |
| 108 | // device_config_complete - perform any |
| 109 | // operations now that the configuration is |
| 110 | // complete |
| 111 | //------------------------------------------------- |
| 149 | 112 | |
| 150 | | int nrfd = !(!(!(atn&atna)&rfdo)|!(atn|atna)); |
| 151 | | int ndac = !(daco|!(atn|atna)); |
| 152 | | |
| 153 | | ieee488_nrfd_w(c2040->bus, device, nrfd); |
| 154 | | ieee488_ndac_w(c2040->bus, device, ndac); |
| 155 | | } |
| 156 | | |
| 157 | | INLINE void update_gcr_data(c2040_t *c2040) |
| 113 | void c2040_device_config::device_config_complete() |
| 158 | 114 | { |
| 159 | | if (c2040->rw) |
| 115 | switch (m_variant) |
| 160 | 116 | { |
| 161 | | /* |
| 117 | default: |
| 118 | case TYPE_2040: |
| 119 | case TYPE_3040: |
| 120 | m_shortname = "c2040"; |
| 121 | break; |
| 162 | 122 | |
| 163 | | bit description |
| 123 | case TYPE_4040: |
| 124 | m_shortname = "c4040"; |
| 125 | break; |
| 164 | 126 | |
| 165 | | I0 SR0 |
| 166 | | I1 SR1 |
| 167 | | I2 SR2 |
| 168 | | I3 SR3 |
| 169 | | I4 SR4 |
| 170 | | I5 SR5 |
| 171 | | I6 SR6 |
| 172 | | I7 SR7 |
| 173 | | I8 SR8 |
| 174 | | I9 SR9 |
| 175 | | I10 R/_W SEL |
| 127 | case TYPE_8050: |
| 128 | m_shortname = "c8050"; |
| 129 | break; |
| 176 | 130 | |
| 177 | | */ |
| 131 | case TYPE_8250: |
| 132 | m_shortname = "c8250"; |
| 133 | break; |
| 178 | 134 | |
| 179 | | c2040->i = (c2040->rw << 10) | (c2040->sr & 0x3ff); |
| 135 | case TYPE_SFD1001: |
| 136 | m_shortname = "sfd1001"; |
| 137 | break; |
| 180 | 138 | } |
| 181 | | else |
| 182 | | { |
| 183 | | /* |
| 184 | | |
| 185 | | bit description |
| 186 | | |
| 187 | | I0 PI0 |
| 188 | | I1 PI1 |
| 189 | | I2 PI2 |
| 190 | | I3 PI3 |
| 191 | | I4 MODE SEL |
| 192 | | I5 PI4 |
| 193 | | I6 PI5 |
| 194 | | I7 PI6 |
| 195 | | I8 PI7 |
| 196 | | I9 0 |
| 197 | | I10 R/_W SEL |
| 198 | | |
| 199 | | */ |
| 200 | | |
| 201 | | c2040->i = (c2040->rw << 10) | ((c2040->pi & 0xf0) << 1) | (c2040->mode << 4) | (c2040->pi & 0x0f); |
| 202 | | } |
| 203 | | |
| 204 | | c2040->e = c2040->gcr[c2040->i]; |
| 205 | 139 | } |
| 206 | 140 | |
| 207 | | /*************************************************************************** |
| 208 | | IMPLEMENTATION |
| 209 | | ***************************************************************************/ |
| 210 | 141 | |
| 211 | | /*------------------------------------------------- |
| 212 | | TIMER_CALLBACK( bit_tick ) |
| 213 | | -------------------------------------------------*/ |
| 142 | //------------------------------------------------- |
| 143 | // static_set_config - configuration helper |
| 144 | //------------------------------------------------- |
| 214 | 145 | |
| 215 | | static TIMER_CALLBACK( bit_tick ) |
| 146 | void c2040_device_config::static_set_config(device_config *device, int address, int variant) |
| 216 | 147 | { |
| 217 | | device_t *device = (device_t *)ptr; |
| 218 | | c2040_t *c2040 = get_safe_token(device); |
| 219 | | int ready = 1; |
| 148 | c2040_device_config *c2040 = downcast<c2040_device_config *>(device); |
| 220 | 149 | |
| 221 | | /* shift in data from the read head */ |
| 222 | | c2040->sr <<= 1; |
| 223 | | c2040->sr |= BIT(c2040->unit[c2040->drive].track_buffer[c2040->unit[c2040->drive].buffer_pos], c2040->unit[c2040->drive].bit_pos); |
| 150 | assert((address > 7) && (address < 12)); |
| 224 | 151 | |
| 225 | | /* update GCR data */ |
| 226 | | update_gcr_data(c2040); |
| 152 | c2040->m_address = address - 8; |
| 153 | c2040->m_variant = variant; |
| 154 | } |
| 227 | 155 | |
| 228 | | /* update bit counters */ |
| 229 | | c2040->unit[c2040->drive].bit_pos--; |
| 230 | | c2040->bit_count++; |
| 231 | 156 | |
| 232 | | if (c2040->unit[c2040->drive].bit_pos < 0) |
| 233 | | { |
| 234 | | c2040->unit[c2040->drive].bit_pos = 7; |
| 235 | | c2040->unit[c2040->drive].buffer_pos++; |
| 157 | //------------------------------------------------- |
| 158 | // ROM( c2040 ) |
| 159 | //------------------------------------------------- |
| 236 | 160 | |
| 237 | | if (c2040->unit[c2040->drive].buffer_pos >= c2040->unit[c2040->drive].track_len) |
| 238 | | { |
| 239 | | /* loop to the start of the track */ |
| 240 | | c2040->unit[c2040->drive].buffer_pos = 0; |
| 241 | | } |
| 242 | | } |
| 161 | ROM_START( c2040 ) // schematic 320806 |
| 162 | ROM_REGION( 0x3000, M6502_TAG, 0 ) |
| 163 | // DOS 1.0 |
| 164 | ROM_LOAD( "901468-06.ul1", 0x1000, 0x1000, CRC(25b5eed5) SHA1(4d9658f2e6ff3276e5c6e224611a66ce44b16fc7) ) |
| 165 | ROM_LOAD( "901468-07.uh1", 0x2000, 0x1000, CRC(9b09ae83) SHA1(6a51c7954938439ca8342fc295bda050c06e1791) ) |
| 243 | 166 | |
| 244 | | if (!SYNC) |
| 245 | | { |
| 246 | | /* SYNC detected */ |
| 247 | | c2040->bit_count = 0; |
| 248 | | } |
| 167 | ROM_REGION( 0x400, M6504_TAG, 0 ) |
| 168 | // RIOT DOS 1 |
| 169 | ROM_LOAD( "901466-02.uk3", 0x000, 0x400, BAD_DUMP /* parsed in from disassembly */ CRC(e1c86c43) SHA1(d8209c66fde3f2937688ba934ba968678a9d2ebb) ) |
| 249 | 170 | |
| 250 | | if (c2040->bit_count == 10) |
| 251 | | { |
| 252 | | /* byte ready */ |
| 253 | | c2040->bit_count = 0; |
| 254 | | ready = 0; |
| 255 | | } |
| 171 | ROM_REGION( 0x800, "gcr", 0) |
| 172 | ROM_LOAD( "901467.uk6", 0x2400, 0x0800, CRC(a23337eb) SHA1(97df576397608455616331f8e837cb3404363fa2) ) |
| 173 | ROM_END |
| 256 | 174 | |
| 257 | | if (c2040->ready != ready) |
| 258 | | { |
| 259 | | /* set byte ready flag */ |
| 260 | | c2040->ready = ready; |
| 261 | 175 | |
| 262 | | c2040->via->write_ca1(ready); |
| 263 | | c2040->via->write_cb1(ERROR); |
| 176 | //------------------------------------------------- |
| 177 | // ROM( c4040 ) |
| 178 | //------------------------------------------------- |
| 264 | 179 | |
| 265 | | if ((device->type() == C8050) || (device->type() == C8250) || (device->type() == SFD1001)) |
| 266 | | { |
| 267 | | device_set_input_line(c2040->cpu_fdc, M6502_SET_OVERFLOW, ready ? CLEAR_LINE : ASSERT_LINE); |
| 268 | | } |
| 269 | | } |
| 270 | | } |
| 180 | ROM_START( c4040 ) // schematic ? |
| 181 | ROM_REGION( 0x3000, M6502_TAG, 0 ) |
| 182 | // DOS 2.1 |
| 183 | ROM_LOAD_OPTIONAL( "901468-11.uj1", 0x0000, 0x1000, CRC(b7157458) SHA1(8415f3159dea73161e0cef7960afa6c76953b6f8) ) |
| 184 | ROM_LOAD_OPTIONAL( "901468-12.ul1", 0x1000, 0x1000, CRC(02c44ff9) SHA1(e8a94f239082d45f64f01b2d8e488d18fe659cbb) ) |
| 185 | ROM_LOAD_OPTIONAL( "901468-13.uh1", 0x2000, 0x1000, CRC(cbd785b3) SHA1(6ada7904ac9d13c3f1c0a8715f9c4be1aa6eb0bb) ) |
| 186 | // DOS 2 rev |
| 187 | ROM_LOAD( "901468-14.uj1", 0x0000, 0x1000, CRC(bc4d4872) SHA1(ffb992b82ec913ddff7be964d7527aca3e21580c) ) |
| 188 | ROM_LOAD( "901468-15.ul1", 0x1000, 0x1000, CRC(b6970533) SHA1(f702d6917fe8a798740ba4d467b500944ae7b70a) ) |
| 189 | ROM_LOAD( "901468-16.uh1", 0x2000, 0x1000, CRC(1f5eefb7) SHA1(04b918cf4adeee8015b43383d3cea7288a7d0aa8) ) |
| 271 | 190 | |
| 272 | | /*------------------------------------------------- |
| 273 | | read_current_track - read track from disk |
| 274 | | -------------------------------------------------*/ |
| 191 | ROM_REGION( 0x400, M6504_TAG, 0 ) |
| 192 | // RIOT DOS 2 |
| 193 | ROM_LOAD( "901466-04.uk3", 0x000, 0x400, CRC(0ab338dc) SHA1(6645fa40b81be1ff7d1384e9b52df06a26ab0bfb) ) |
| 275 | 194 | |
| 276 | | static void read_current_track(c2040_t *c2040, int unit) |
| 277 | | { |
| 278 | | c2040->unit[unit].track_len = G64_BUFFER_SIZE; |
| 279 | | c2040->unit[unit].buffer_pos = 0; |
| 280 | | c2040->unit[unit].bit_pos = 7; |
| 281 | | c2040->bit_count = 0; |
| 195 | ROM_REGION( 0x800, "gcr", 0) |
| 196 | ROM_LOAD( "901467.uk6", 0x000, 0x800, CRC(a23337eb) SHA1(97df576397608455616331f8e837cb3404363fa2) ) |
| 197 | ROM_END |
| 282 | 198 | |
| 283 | | /* read track data */ |
| 284 | | floppy_drive_read_track_data_info_buffer(c2040->unit[unit].image, c2040->side, c2040->unit[unit].track_buffer, &c2040->unit[unit].track_len); |
| 285 | 199 | |
| 286 | | /* extract track length */ |
| 287 | | c2040->unit[unit].track_len = floppy_drive_get_current_track_size(c2040->unit[unit].image, c2040->side); |
| 288 | | } |
| 200 | //------------------------------------------------- |
| 201 | // ROM( c8050 ) |
| 202 | //------------------------------------------------- |
| 289 | 203 | |
| 290 | | /*------------------------------------------------- |
| 291 | | on_disk_0_change - disk 0 change handler |
| 292 | | -------------------------------------------------*/ |
| 204 | /* |
| 293 | 205 | |
| 294 | | static void on_disk_0_change(device_image_interface &image) |
| 295 | | { |
| 296 | | c2040_t *c2040 = get_safe_token(image.device().owner()); |
| 206 | DOS/CONTROLLER ROMS FOR DIGITAL PCB #8050002 |
| 297 | 207 | |
| 298 | | read_current_track(c2040, 0); |
| 299 | | } |
| 208 | DESCRIPTION PCB PART NO. UL1 UH1 UK3 |
| 300 | 209 | |
| 301 | | /*------------------------------------------------- |
| 302 | | on_disk_1_change - disk 1 change handler |
| 303 | | -------------------------------------------------*/ |
| 210 | 2.5 Micropolis 8050002-01 901482-07 901482-06 901483-03 |
| 211 | 2.5 Tandon 8050002-02 901482-07 901482-06 901483-04 |
| 212 | 2.7 Tandon 8050002-03 901887-01 901888-01 901884-01 |
| 213 | 2.7 Micropolis 8050002-04 901887-01 901888-01 901885-04 |
| 214 | 2.7 MPI 8050 8050002-05 901887-01 901888-01 901869-01 |
| 215 | 2.7 MPI 8250 8050002-06 901887-01 901888-01 901869-01 |
| 304 | 216 | |
| 305 | | static void on_disk_1_change(device_image_interface &image) |
| 306 | | { |
| 307 | | c2040_t *c2040 = get_safe_token(image.device().owner()); |
| 217 | */ |
| 308 | 218 | |
| 309 | | read_current_track(c2040, 1); |
| 310 | | } |
| 219 | ROM_START( c8050 ) // schematic 8050001 |
| 220 | ROM_REGION( 0x4000, M6502_TAG, 0 ) |
| 221 | // 2364 ROM DOS 2.5 |
| 222 | ROM_LOAD_OPTIONAL( "901482-03.ul1", 0x0000, 0x2000, CRC(09a609b9) SHA1(166d8bfaaa9c4767f9b17ad63fc7ae77c199a64e) ) |
| 223 | ROM_LOAD_OPTIONAL( "901482-04.uh1", 0x2000, 0x2000, CRC(1bcf9df9) SHA1(217f4a8b348658bb365f4a1de21ecbaa6402b1c0) ) |
| 224 | // 2364-091 ROM DOS 2.5 rev |
| 225 | ROM_LOAD_OPTIONAL( "901482-06.ul1", 0x0000, 0x2000, CRC(3cbd2756) SHA1(7f5fbed0cddb95138dd99b8fe84fddab900e3650) ) |
| 226 | ROM_LOAD_OPTIONAL( "901482-07.uh1", 0x2000, 0x2000, CRC(c7532d90) SHA1(0b6d1e55afea612516df5f07f4a6dccd3bd73963) ) |
| 227 | // 2364 ROM DOS 2.7 |
| 228 | ROM_LOAD( "901887-01.ul1", 0x0000, 0x2000, CRC(0073b8b2) SHA1(b10603195f240118fe5fb6c6dfe5c5097463d890) ) |
| 229 | ROM_LOAD( "901888-01.uh1", 0x2000, 0x2000, CRC(de9b6132) SHA1(2e6c2d7ca934e5c550ad14bd5e9e7749686b7af4) ) |
| 311 | 230 | |
| 312 | | /*------------------------------------------------- |
| 313 | | spindle_motor - spindle motor control |
| 314 | | -------------------------------------------------*/ |
| 231 | ROM_REGION( 0x400, M6504_TAG, 0 ) |
| 232 | ROM_LOAD_OPTIONAL( "901483-03.uk3", 0x000, 0x400, CRC(9e83fa70) SHA1(e367ea8a5ddbd47f13570088427293138a10784b) ) |
| 233 | ROM_LOAD_OPTIONAL( "901483-04.uk3", 0x000, 0x400, NO_DUMP ) |
| 234 | ROM_LOAD_OPTIONAL( "901884-01.uk3", 0x000, 0x400, NO_DUMP ) |
| 235 | ROM_LOAD_OPTIONAL( "901885-04.uk3", 0x000, 0x400, CRC(bab998c9) SHA1(0dc9a3b60f1b866c63eebd882403532fc59fe57f) ) |
| 236 | ROM_LOAD( "901869-01.uk3", 0x000, 0x400, CRC(2915327a) SHA1(3a9a80f72ce76e5f5c72513f8ef7553212912ae3) ) |
| 315 | 237 | |
| 316 | | static void spindle_motor(c2040_t *c2040, int unit, int mtr) |
| 317 | | { |
| 318 | | if (c2040->unit[unit].mtr != mtr) |
| 319 | | { |
| 320 | | if (!mtr) |
| 321 | | { |
| 322 | | /* read track data */ |
| 323 | | read_current_track(c2040, unit); |
| 324 | | } |
| 238 | ROM_REGION( 0x800, "gcr", 0) |
| 239 | ROM_LOAD( "901467.uk6", 0x000, 0x800, CRC(a23337eb) SHA1(97df576397608455616331f8e837cb3404363fa2) ) |
| 240 | ROM_END |
| 325 | 241 | |
| 326 | | floppy_mon_w(c2040->unit[unit].image, mtr); |
| 327 | 242 | |
| 328 | | c2040->unit[unit].mtr = mtr; |
| 329 | | } |
| 330 | | } |
| 243 | //------------------------------------------------- |
| 244 | // ROM( sfd1001 ) |
| 245 | //------------------------------------------------- |
| 331 | 246 | |
| 332 | | /*------------------------------------------------- |
| 333 | | micropolis_step_motor - Micropolis stepper |
| 334 | | motor control |
| 335 | | -------------------------------------------------*/ |
| 247 | ROM_START( sfd1001 ) // schematic 251406 |
| 248 | ROM_REGION( 0x4000, M6502_TAG, 0 ) |
| 249 | ROM_LOAD( "901887-01.1j", 0x0000, 0x2000, CRC(0073b8b2) SHA1(b10603195f240118fe5fb6c6dfe5c5097463d890) ) |
| 250 | ROM_LOAD( "901888-01.3j", 0x2000, 0x2000, CRC(de9b6132) SHA1(2e6c2d7ca934e5c550ad14bd5e9e7749686b7af4) ) |
| 336 | 251 | |
| 337 | | static void micropolis_step_motor(c2040_t *c2040, int unit, int mtr, int stp) |
| 338 | | { |
| 339 | | if (!mtr && (c2040->unit[unit].stp != stp)) |
| 340 | | { |
| 341 | | int tracks = 0; |
| 252 | ROM_REGION( 0x800, M6504_TAG, 0 ) |
| 253 | ROM_LOAD( "251257-02a.u2", 0x000, 0x800, CRC(b51150de) SHA1(3b954eb34f7ea088eed1d33ebc6d6e83a3e9be15) ) |
| 342 | 254 | |
| 343 | | switch (c2040->unit[unit].stp) |
| 344 | | { |
| 345 | | case 0: if (stp == 1) tracks++; else if (stp == 3) tracks--; break; |
| 346 | | case 1: if (stp == 2) tracks++; else if (stp == 0) tracks--; break; |
| 347 | | case 2: if (stp == 3) tracks++; else if (stp == 1) tracks--; break; |
| 348 | | case 3: if (stp == 0) tracks++; else if (stp == 2) tracks--; break; |
| 349 | | } |
| 255 | ROM_REGION( 0x800, "gcr", 0) |
| 256 | ROM_LOAD( "901467.5c", 0x000, 0x800, CRC(a23337eb) SHA1(97df576397608455616331f8e837cb3404363fa2) ) |
| 257 | ROM_END |
| 350 | 258 | |
| 351 | | if (tracks != 0) |
| 352 | | { |
| 353 | | /* step read/write head */ |
| 354 | | floppy_drive_seek(c2040->unit[unit].image, tracks); |
| 355 | 259 | |
| 356 | | /* read new track data */ |
| 357 | | read_current_track(c2040, unit); |
| 358 | | } |
| 260 | //------------------------------------------------- |
| 261 | // rom_region - device-specific ROM region |
| 262 | //------------------------------------------------- |
| 359 | 263 | |
| 360 | | c2040->unit[unit].stp = stp; |
| 361 | | } |
| 362 | | } |
| 363 | | |
| 364 | | /*------------------------------------------------- |
| 365 | | mpi_step_motor - MPI stepper motor control |
| 366 | | -------------------------------------------------*/ |
| 367 | | |
| 368 | | static void mpi_step_motor(c2040_t *c2040, int unit, int mtr, int stp) |
| 264 | const rom_entry *c2040_device_config::device_rom_region() const |
| 369 | 265 | { |
| 370 | | if (!mtr && (c2040->unit[unit].stp != stp)) |
| 266 | switch (m_variant) |
| 371 | 267 | { |
| 372 | | int tracks = 0; |
| 268 | default: |
| 269 | case TYPE_2040: |
| 270 | case TYPE_3040: |
| 271 | return ROM_NAME( c2040 ); |
| 373 | 272 | |
| 374 | | switch (c2040->unit[unit].stp) |
| 375 | | { |
| 376 | | case 0: if (stp == 1) tracks++; else if (stp == 2) tracks--; break; |
| 377 | | case 1: if (stp == 3) tracks++; else if (stp == 0) tracks--; break; |
| 378 | | case 2: if (stp == 0) tracks++; else if (stp == 3) tracks--; break; |
| 379 | | case 3: if (stp == 2) tracks++; else if (stp == 1) tracks--; break; |
| 380 | | } |
| 273 | case TYPE_4040: |
| 274 | return ROM_NAME( c4040 ); |
| 381 | 275 | |
| 382 | | if (tracks != 0) |
| 383 | | { |
| 384 | | /* step read/write head */ |
| 385 | | floppy_drive_seek(c2040->unit[unit].image, tracks); |
| 276 | case TYPE_8050: |
| 277 | case TYPE_8250: |
| 278 | return ROM_NAME( c8050 ); |
| 386 | 279 | |
| 387 | | /* read new track data */ |
| 388 | | read_current_track(c2040, unit); |
| 389 | | } |
| 390 | | |
| 391 | | c2040->unit[unit].stp = stp; |
| 280 | case TYPE_SFD1001: |
| 281 | return ROM_NAME( sfd1001 ); |
| 392 | 282 | } |
| 393 | 283 | } |
| 394 | 284 | |
| 395 | | /*------------------------------------------------- |
| 396 | | c2040_ieee488_atn_w - IEEE-488 bus attention |
| 397 | | -------------------------------------------------*/ |
| 398 | 285 | |
| 399 | | WRITE_LINE_DEVICE_HANDLER( c2040_ieee488_atn_w ) |
| 400 | | { |
| 401 | | c2040_t *c2040 = get_safe_token(device); |
| 286 | //------------------------------------------------- |
| 287 | // ADDRESS_MAP( c2040_main_mem ) |
| 288 | //------------------------------------------------- |
| 402 | 289 | |
| 403 | | update_ieee_signals(device); |
| 404 | | |
| 405 | | /* set RIOT PA7 */ |
| 406 | | riot6532_porta_in_set(c2040->riot1, !state << 7, 0x80); |
| 407 | | } |
| 408 | | |
| 409 | | /*------------------------------------------------- |
| 410 | | c2040_ieee488_ifc_w - IEEE-488 bus reset |
| 411 | | -------------------------------------------------*/ |
| 412 | | |
| 413 | | WRITE_LINE_DEVICE_HANDLER( c2040_ieee488_ifc_w ) |
| 414 | | { |
| 415 | | if (!state) |
| 416 | | { |
| 417 | | device->reset(); |
| 418 | | } |
| 419 | | } |
| 420 | | |
| 421 | | /*------------------------------------------------- |
| 422 | | ADDRESS_MAP( c2040_dos_map ) |
| 423 | | -------------------------------------------------*/ |
| 424 | | |
| 425 | | static ADDRESS_MAP_START( c2040_dos_map, AS_PROGRAM, 8 ) |
| 290 | static ADDRESS_MAP_START( c2040_main_mem, AS_PROGRAM, 8, c2040_device ) |
| 426 | 291 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 427 | 292 | AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1 |
| 428 | 293 | AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2 |
| 429 | | AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w) |
| 430 | | AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w) |
| 294 | AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_0_TAG, riot6532_r, riot6532_w) |
| 295 | AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_1_TAG, riot6532_r, riot6532_w) |
| 431 | 296 | AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1") |
| 432 | 297 | AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2") |
| 433 | 298 | AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3") |
| 434 | 299 | AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share4") |
| 435 | | AM_RANGE(0x6000, 0x7fff) AM_MIRROR(0x0000) AM_ROM AM_REGION("drive:c2040", 0x0000) |
| 300 | AM_RANGE(0x5000, 0x7fff) // AM_ROM |
| 436 | 301 | ADDRESS_MAP_END |
| 437 | 302 | |
| 438 | | /*------------------------------------------------- |
| 439 | | ADDRESS_MAP( c2040_fdc_map ) |
| 440 | | -------------------------------------------------*/ |
| 441 | 303 | |
| 442 | | static ADDRESS_MAP_START( c2040_fdc_map, AS_PROGRAM, 8 ) |
| 443 | | ADDRESS_MAP_GLOBAL_MASK(0x1fff) |
| 444 | | AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530 |
| 445 | | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE_MODERN(M6522_TAG, via6522_device, read, write) |
| 446 | | AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, mos6530_r, mos6530_w) |
| 447 | | AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1") |
| 448 | | AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2") |
| 449 | | AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3") |
| 450 | | AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("share4") |
| 451 | | AM_RANGE(0x1c00, 0x1fff) AM_ROM AM_REGION("drive:c2040", 0x2000) // 6530 |
| 452 | | ADDRESS_MAP_END |
| 304 | //------------------------------------------------- |
| 305 | // ADDRESS_MAP( c2040_fdc_mem ) |
| 306 | //------------------------------------------------- |
| 453 | 307 | |
| 454 | | /*------------------------------------------------- |
| 455 | | ADDRESS_MAP( c4040_dos_map ) |
| 456 | | -------------------------------------------------*/ |
| 457 | | |
| 458 | | static ADDRESS_MAP_START( c4040_dos_map, AS_PROGRAM, 8 ) |
| 459 | | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 460 | | AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1 |
| 461 | | AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2 |
| 462 | | AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w) |
| 463 | | AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w) |
| 464 | | AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1") |
| 465 | | AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2") |
| 466 | | AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3") |
| 467 | | AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share4") |
| 468 | | AM_RANGE(0x5000, 0x7fff) AM_ROM AM_REGION("drive:c4040", 0x0000) |
| 469 | | ADDRESS_MAP_END |
| 470 | | |
| 471 | | /*------------------------------------------------- |
| 472 | | ADDRESS_MAP( c4040_fdc_map ) |
| 473 | | -------------------------------------------------*/ |
| 474 | | |
| 475 | | static ADDRESS_MAP_START( c4040_fdc_map, AS_PROGRAM, 8 ) |
| 308 | static ADDRESS_MAP_START( c2040_fdc_mem, AS_PROGRAM, 8, c2040_device ) |
| 476 | 309 | ADDRESS_MAP_GLOBAL_MASK(0x1fff) |
| 477 | 310 | AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530 |
| 478 | | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE_MODERN(M6522_TAG, via6522_device, read, write) |
| 479 | | AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, mos6530_r, mos6530_w) |
| 311 | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write) |
| 312 | AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE_LEGACY(M6530_TAG, mos6530_r, mos6530_w) |
| 480 | 313 | AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1") |
| 481 | 314 | AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2") |
| 482 | 315 | AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3") |
| 483 | 316 | AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("share4") |
| 484 | | AM_RANGE(0x1c00, 0x1fff) AM_ROM AM_REGION("drive:c4040", 0x3000) // 6530 |
| 317 | AM_RANGE(0x1c00, 0x1fff) // AM_ROM 6530 |
| 485 | 318 | ADDRESS_MAP_END |
| 486 | 319 | |
| 487 | | /*------------------------------------------------- |
| 488 | | ADDRESS_MAP( c8050_dos_map ) |
| 489 | | -------------------------------------------------*/ |
| 490 | 320 | |
| 491 | | static ADDRESS_MAP_START( c8050_dos_map, AS_PROGRAM, 8 ) |
| 321 | //------------------------------------------------- |
| 322 | // ADDRESS_MAP( c8050_main_mem ) |
| 323 | //------------------------------------------------- |
| 324 | |
| 325 | static ADDRESS_MAP_START( c8050_main_mem, AS_PROGRAM, 8, c2040_device ) |
| 492 | 326 | AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1 |
| 493 | 327 | AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2 |
| 494 | | AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w) |
| 495 | | AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w) |
| 328 | AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_0_TAG, riot6532_r, riot6532_w) |
| 329 | AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_1_TAG, riot6532_r, riot6532_w) |
| 496 | 330 | AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1") |
| 497 | 331 | AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2") |
| 498 | 332 | AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3") |
| 499 | 333 | AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share4") |
| 500 | | AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("drive:c8050", 0x0000) |
| 334 | AM_RANGE(0xc000, 0xffff) // AM_ROM |
| 501 | 335 | ADDRESS_MAP_END |
| 502 | 336 | |
| 503 | | /*------------------------------------------------- |
| 504 | | ADDRESS_MAP( c8050_fdc_map ) |
| 505 | | -------------------------------------------------*/ |
| 506 | 337 | |
| 507 | | static ADDRESS_MAP_START( c8050_fdc_map, AS_PROGRAM, 8 ) |
| 338 | //------------------------------------------------- |
| 339 | // ADDRESS_MAP( c8050_fdc_mem ) |
| 340 | //------------------------------------------------- |
| 341 | |
| 342 | static ADDRESS_MAP_START( c8050_fdc_mem, AS_PROGRAM, 8, c2040_device ) |
| 508 | 343 | ADDRESS_MAP_GLOBAL_MASK(0x1fff) |
| 509 | 344 | AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530 |
| 510 | | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE_MODERN(M6522_TAG, via6522_device, read, write) |
| 511 | | AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, mos6530_r, mos6530_w) |
| 345 | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write) |
| 346 | AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE_LEGACY(M6530_TAG, mos6530_r, mos6530_w) |
| 512 | 347 | AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1") |
| 513 | 348 | AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2") |
| 514 | 349 | AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3") |
| 515 | 350 | AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("share4") |
| 516 | | AM_RANGE(0x1c00, 0x1fff) AM_ROM AM_REGION("drive:c8050", 0x4000) // 6530 |
| 351 | AM_RANGE(0x1c00, 0x1fff) // AM_ROM 6530 |
| 517 | 352 | ADDRESS_MAP_END |
| 518 | 353 | |
| 519 | | /*------------------------------------------------- |
| 520 | | ADDRESS_MAP( sfd1001_dos_map ) |
| 521 | | -------------------------------------------------*/ |
| 522 | 354 | |
| 523 | | static ADDRESS_MAP_START( sfd1001_dos_map, AS_PROGRAM, 8 ) |
| 524 | | AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1 |
| 525 | | AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2 |
| 526 | | AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w) |
| 527 | | AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w) |
| 528 | | AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1") |
| 529 | | AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2") |
| 530 | | AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3") |
| 531 | | AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share4") |
| 532 | | AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("drive:sfd1001", 0x0000) |
| 533 | | ADDRESS_MAP_END |
| 355 | //------------------------------------------------- |
| 356 | // ADDRESS_MAP( sfd1001_fdc_mem ) |
| 357 | //------------------------------------------------- |
| 534 | 358 | |
| 535 | | /*------------------------------------------------- |
| 536 | | ADDRESS_MAP( sfd1001_fdc_map ) |
| 537 | | -------------------------------------------------*/ |
| 538 | | |
| 539 | | static ADDRESS_MAP_START( sfd1001_fdc_map, AS_PROGRAM, 8 ) |
| 359 | static ADDRESS_MAP_START( sfd1001_fdc_mem, AS_PROGRAM, 8, c2040_device ) |
| 540 | 360 | ADDRESS_MAP_GLOBAL_MASK(0x1fff) |
| 541 | 361 | AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530 |
| 542 | | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE_MODERN(M6522_TAG, via6522_device, read, write) |
| 543 | | AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6530_TAG, mos6530_r, mos6530_w) |
| 362 | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write) |
| 363 | AM_RANGE(0x0080, 0x008f) AM_MIRROR(0x0330) AM_DEVREADWRITE_LEGACY(M6530_TAG, mos6530_r, mos6530_w) |
| 544 | 364 | AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1") |
| 545 | 365 | AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2") |
| 546 | 366 | AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3") |
| 547 | 367 | AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("share4") |
| 548 | | AM_RANGE(0x1800, 0x1fff) AM_ROM AM_REGION("drive:sfd1001", 0x4000) |
| 368 | AM_RANGE(0x1800, 0x1fff) // AM_ROM |
| 549 | 369 | ADDRESS_MAP_END |
| 550 | 370 | |
| 551 | | /*------------------------------------------------- |
| 552 | | riot6532_interface riot0_intf uc1 |
| 553 | | -------------------------------------------------*/ |
| 554 | 371 | |
| 555 | | static READ8_DEVICE_HANDLER( dio_r ) |
| 372 | //------------------------------------------------- |
| 373 | // riot6532_interface riot0_intf uc1 |
| 374 | //------------------------------------------------- |
| 375 | |
| 376 | READ8_MEMBER( c2040_device::dio_r ) |
| 556 | 377 | { |
| 557 | 378 | /* |
| 558 | 379 | |
| r11262 | r11263 | |
| 569 | 390 | |
| 570 | 391 | */ |
| 571 | 392 | |
| 572 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 573 | | |
| 574 | | return ieee488_dio_r(c2040->bus, 0); |
| 393 | return m_bus->dio_r(); |
| 575 | 394 | } |
| 576 | 395 | |
| 577 | | static WRITE8_DEVICE_HANDLER( dio_w ) |
| 396 | |
| 397 | WRITE8_MEMBER( c2040_device::dio_w ) |
| 578 | 398 | { |
| 579 | 399 | /* |
| 580 | 400 | |
| r11262 | r11263 | |
| 591 | 411 | |
| 592 | 412 | */ |
| 593 | 413 | |
| 594 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 595 | | |
| 596 | | ieee488_dio_w(c2040->bus, device->owner(), data); |
| 414 | m_bus->dio_w(this, data); |
| 597 | 415 | } |
| 598 | 416 | |
| 417 | |
| 599 | 418 | static const riot6532_interface riot0_intf = |
| 600 | 419 | { |
| 601 | | DEVCB_HANDLER(dio_r), |
| 420 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, dio_r), |
| 602 | 421 | DEVCB_NULL, |
| 603 | 422 | DEVCB_NULL, |
| 604 | | DEVCB_HANDLER(dio_w), |
| 423 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, dio_w), |
| 605 | 424 | DEVCB_NULL |
| 606 | 425 | }; |
| 607 | 426 | |
| 608 | | /*------------------------------------------------- |
| 609 | | riot6532_interface riot1_intf ue1 |
| 610 | | -------------------------------------------------*/ |
| 611 | 427 | |
| 612 | | static READ8_DEVICE_HANDLER( riot1_pa_r ) |
| 428 | //------------------------------------------------- |
| 429 | // riot6532_interface riot1_intf ue1 |
| 430 | //------------------------------------------------- |
| 431 | |
| 432 | READ8_MEMBER( c2040_device::riot1_pa_r ) |
| 613 | 433 | { |
| 614 | 434 | /* |
| 615 | 435 | |
| r11262 | r11263 | |
| 626 | 446 | |
| 627 | 447 | */ |
| 628 | 448 | |
| 629 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 630 | | |
| 631 | 449 | UINT8 data = 0; |
| 632 | 450 | |
| 633 | | /* end or identify in */ |
| 634 | | data |= ieee488_eoi_r(c2040->bus) << 5; |
| 451 | // end or identify in |
| 452 | data |= m_bus->eoi_r() << 5; |
| 635 | 453 | |
| 636 | | /* data valid in */ |
| 637 | | data |= ieee488_dav_r(c2040->bus) << 6; |
| 454 | // data valid in |
| 455 | data |= m_bus->dav_r() << 6; |
| 638 | 456 | |
| 639 | | /* attention */ |
| 640 | | data |= !ieee488_atn_r(c2040->bus) << 7; |
| 457 | // attention |
| 458 | data |= !m_bus->atn_r() << 7; |
| 641 | 459 | |
| 642 | 460 | return data; |
| 643 | 461 | } |
| 644 | 462 | |
| 645 | | static WRITE8_DEVICE_HANDLER( riot1_pa_w ) |
| 463 | |
| 464 | WRITE8_MEMBER( c2040_device::riot1_pa_w ) |
| 646 | 465 | { |
| 647 | 466 | /* |
| 648 | 467 | |
| r11262 | r11263 | |
| 659 | 478 | |
| 660 | 479 | */ |
| 661 | 480 | |
| 662 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 481 | // attention acknowledge |
| 482 | m_atna = BIT(data, 0); |
| 663 | 483 | |
| 664 | | /* attention acknowledge */ |
| 665 | | c2040->atna = BIT(data, 0); |
| 484 | // data accepted out |
| 485 | m_daco = BIT(data, 1); |
| 666 | 486 | |
| 667 | | /* data accepted out */ |
| 668 | | c2040->daco = BIT(data, 1); |
| 487 | // not ready for data out |
| 488 | m_rfdo = BIT(data, 2); |
| 669 | 489 | |
| 670 | | /* not ready for data out */ |
| 671 | | c2040->rfdo = BIT(data, 2); |
| 490 | // end or identify out |
| 491 | m_bus->eoi_w(this, BIT(data, 3)); |
| 672 | 492 | |
| 673 | | /* end or identify out */ |
| 674 | | ieee488_eoi_w(c2040->bus, device->owner(), BIT(data, 3)); |
| 493 | // data valid out |
| 494 | m_bus->dav_w(this, BIT(data, 4)); |
| 675 | 495 | |
| 676 | | /* data valid out */ |
| 677 | | ieee488_dav_w(c2040->bus, device->owner(), BIT(data, 4)); |
| 678 | | |
| 679 | | update_ieee_signals(device->owner()); |
| 496 | update_ieee_signals(); |
| 680 | 497 | } |
| 681 | 498 | |
| 682 | | static READ8_DEVICE_HANDLER( riot1_pb_r ) |
| 499 | |
| 500 | READ8_MEMBER( c2040_device::riot1_pb_r ) |
| 683 | 501 | { |
| 684 | 502 | /* |
| 685 | 503 | |
| r11262 | r11263 | |
| 696 | 514 | |
| 697 | 515 | */ |
| 698 | 516 | |
| 699 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 700 | | |
| 701 | 517 | UINT8 data = 0; |
| 702 | 518 | |
| 703 | | /* device number selection */ |
| 704 | | data |= c2040->address; |
| 519 | // device number selection |
| 520 | data |= m_config.m_address; |
| 705 | 521 | |
| 706 | | /* data accepted in */ |
| 707 | | data |= ieee488_ndac_r(c2040->bus) << 6; |
| 522 | // data accepted in |
| 523 | data |= m_bus->ndac_r() << 6; |
| 708 | 524 | |
| 709 | | /* ready for data in */ |
| 710 | | data |= ieee488_nrfd_r(c2040->bus) << 7; |
| 525 | // ready for data in |
| 526 | data |= m_bus->nrfd_r() << 7; |
| 711 | 527 | |
| 712 | 528 | return data; |
| 713 | 529 | } |
| 714 | 530 | |
| 715 | | static WRITE8_DEVICE_HANDLER( riot1_pb_w ) |
| 531 | |
| 532 | WRITE8_MEMBER( c2040_device::riot1_pb_w ) |
| 716 | 533 | { |
| 717 | 534 | /* |
| 718 | 535 | |
| r11262 | r11263 | |
| 729 | 546 | |
| 730 | 547 | */ |
| 731 | 548 | |
| 732 | | /* TODO activity led 1 */ |
| 549 | // activity led 1 |
| 550 | output_set_led_value(LED_ACT1, BIT(data, 3)); |
| 733 | 551 | |
| 734 | | /* TODO activity led 0 */ |
| 552 | // activity led 0 |
| 553 | output_set_led_value(LED_ACT0, BIT(data, 4)); |
| 735 | 554 | |
| 736 | | /* TODO error led */ |
| 555 | // error led |
| 556 | output_set_led_value(LED_ERR, BIT(data, 5)); |
| 737 | 557 | } |
| 738 | 558 | |
| 739 | | static WRITE_LINE_DEVICE_HANDLER( riot1_irq_w ) |
| 740 | | { |
| 741 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 742 | 559 | |
| 743 | | device_set_input_line(c2040->cpu_dos, M6502_IRQ_LINE, state); |
| 744 | | } |
| 745 | | |
| 746 | 560 | static const riot6532_interface riot1_intf = |
| 747 | 561 | { |
| 748 | | DEVCB_HANDLER(riot1_pa_r), |
| 749 | | DEVCB_HANDLER(riot1_pb_r), |
| 750 | | DEVCB_HANDLER(riot1_pa_w), |
| 751 | | DEVCB_HANDLER(riot1_pb_w), |
| 752 | | DEVCB_LINE(riot1_irq_w) |
| 562 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, riot1_pa_r), |
| 563 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, riot1_pb_r), |
| 564 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, riot1_pa_w), |
| 565 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, riot1_pb_w), |
| 566 | DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0) |
| 753 | 567 | }; |
| 754 | 568 | |
| 755 | | /*------------------------------------------------- |
| 756 | | via6522_interface via_intf um3 |
| 757 | | -------------------------------------------------*/ |
| 758 | 569 | |
| 759 | | static READ8_DEVICE_HANDLER( via_pa_r ) |
| 570 | //------------------------------------------------- |
| 571 | // via6522_interface via_intf um3 |
| 572 | //------------------------------------------------- |
| 573 | |
| 574 | READ8_MEMBER( c2040_device::via_pa_r ) |
| 760 | 575 | { |
| 761 | 576 | /* |
| 762 | 577 | |
| r11262 | r11263 | |
| 773 | 588 | |
| 774 | 589 | */ |
| 775 | 590 | |
| 776 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 777 | | |
| 778 | | UINT16 i = c2040->i; |
| 779 | | UINT8 e = c2040->e; |
| 591 | UINT16 i = m_i; |
| 592 | UINT8 e = m_e; |
| 780 | 593 | UINT8 data = (BIT(e, 6) << 7) | (BIT(i, 7) << 6) | (e & 0x33) | (BIT(e, 2) << 3) | (i & 0x04); |
| 781 | 594 | |
| 782 | 595 | return data; |
| 783 | 596 | } |
| 784 | 597 | |
| 785 | | static WRITE8_DEVICE_HANDLER( via_pb_w ) |
| 598 | |
| 599 | WRITE8_MEMBER( c2040_device::via_pb_w ) |
| 786 | 600 | { |
| 787 | 601 | /* |
| 788 | 602 | |
| r11262 | r11263 | |
| 799 | 613 | |
| 800 | 614 | */ |
| 801 | 615 | |
| 802 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 803 | | |
| 804 | | /* spindle motor 1 */ |
| 616 | // spindle motor 1 |
| 805 | 617 | int mtr1 = BIT(data, 4); |
| 806 | | spindle_motor(c2040, 1, mtr1); |
| 618 | spindle_motor(1, mtr1); |
| 807 | 619 | |
| 808 | | /* spindle motor 0 */ |
| 620 | // spindle motor 0 |
| 809 | 621 | int mtr0 = BIT(data, 5); |
| 810 | | spindle_motor(c2040, 0, mtr0); |
| 622 | spindle_motor(0, mtr0); |
| 811 | 623 | |
| 812 | | /* stepper motor 1 */ |
| 624 | // stepper motor 1 |
| 813 | 625 | int s1 = data & 0x03; |
| 814 | | micropolis_step_motor(c2040, 1, mtr1, s1); |
| 626 | micropolis_step_motor(1, s1); |
| 815 | 627 | |
| 816 | | /* stepper motor 0 */ |
| 628 | // stepper motor 0 |
| 817 | 629 | int s0 = (data >> 2) & 0x03; |
| 818 | | micropolis_step_motor(c2040, 0, mtr0, s0); |
| 630 | micropolis_step_motor(0, s0); |
| 819 | 631 | |
| 820 | | c2040->bit_timer->enable(!mtr1 | !mtr0); |
| 632 | m_bit_timer->enable(!mtr1 | !mtr0); |
| 821 | 633 | } |
| 822 | 634 | |
| 823 | | static READ_LINE_DEVICE_HANDLER( ready_r ) |
| 824 | | { |
| 825 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 826 | 635 | |
| 827 | | return c2040->ready; |
| 636 | READ_LINE_MEMBER( c2040_device::ready_r ) |
| 637 | { |
| 638 | return m_ready; |
| 828 | 639 | } |
| 829 | 640 | |
| 830 | | static READ_LINE_DEVICE_HANDLER( err_r ) |
| 831 | | { |
| 832 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 833 | 641 | |
| 642 | READ_LINE_MEMBER( c2040_device::err_r ) |
| 643 | { |
| 834 | 644 | return ERROR; |
| 835 | 645 | } |
| 836 | 646 | |
| 837 | | static WRITE_LINE_DEVICE_HANDLER( mode_sel_w ) |
| 647 | |
| 648 | WRITE_LINE_MEMBER( c2040_device::mode_sel_w ) |
| 838 | 649 | { |
| 839 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 650 | // mode select |
| 651 | m_mode = state; |
| 840 | 652 | |
| 841 | | /* mode select */ |
| 842 | | c2040->mode = state; |
| 843 | | |
| 844 | | update_gcr_data(c2040); |
| 845 | | c2040->via->write_cb1(ERROR); |
| 653 | update_gcr_data(); |
| 654 | m_via->write_cb1(ERROR); |
| 846 | 655 | } |
| 847 | 656 | |
| 848 | | static WRITE_LINE_DEVICE_HANDLER( rw_sel_w ) |
| 657 | WRITE_LINE_MEMBER( c2040_device::rw_sel_w ) |
| 849 | 658 | { |
| 850 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 659 | // read/write select |
| 660 | m_rw = state; |
| 851 | 661 | |
| 852 | | /* read/write select */ |
| 853 | | c2040->rw = state; |
| 854 | | |
| 855 | | update_gcr_data(c2040); |
| 856 | | c2040->via->write_cb1(ERROR); |
| 662 | update_gcr_data(); |
| 663 | m_via->write_cb1(ERROR); |
| 857 | 664 | } |
| 858 | 665 | |
| 666 | |
| 859 | 667 | static const via6522_interface via_intf = |
| 860 | 668 | { |
| 861 | | DEVCB_HANDLER(via_pa_r), |
| 669 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, via_pa_r), |
| 862 | 670 | DEVCB_NULL, |
| 863 | | DEVCB_LINE(ready_r), |
| 864 | | DEVCB_LINE(err_r), |
| 671 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, ready_r), |
| 672 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, err_r), |
| 865 | 673 | DEVCB_NULL, |
| 866 | 674 | DEVCB_NULL, |
| 867 | 675 | |
| 868 | 676 | DEVCB_NULL, |
| 869 | | DEVCB_HANDLER(via_pb_w), |
| 677 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, via_pb_w), |
| 870 | 678 | DEVCB_NULL, |
| 871 | 679 | DEVCB_NULL, |
| 872 | | DEVCB_LINE(mode_sel_w), |
| 873 | | DEVCB_LINE(rw_sel_w), |
| 680 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, mode_sel_w), |
| 681 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, rw_sel_w), |
| 874 | 682 | |
| 875 | 683 | DEVCB_NULL |
| 876 | 684 | }; |
| 877 | 685 | |
| 878 | | /*------------------------------------------------- |
| 879 | | via6522_interface c8050_via_intf um3 |
| 880 | | -------------------------------------------------*/ |
| 881 | 686 | |
| 882 | | static READ8_DEVICE_HANDLER( c8050_via_pb_r ) |
| 687 | //------------------------------------------------- |
| 688 | // via6522_interface c8050_via_intf um3 |
| 689 | //------------------------------------------------- |
| 690 | |
| 691 | READ8_MEMBER( c2040_device::c8050_via_pb_r ) |
| 883 | 692 | { |
| 884 | 693 | /* |
| 885 | 694 | |
| r11262 | r11263 | |
| 896 | 705 | |
| 897 | 706 | */ |
| 898 | 707 | |
| 899 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 900 | | |
| 901 | 708 | UINT8 data = 0; |
| 902 | 709 | |
| 903 | | /* SYNC detected */ |
| 710 | // SYNC detected |
| 904 | 711 | data |= SYNC << 7; |
| 905 | 712 | |
| 906 | 713 | return data; |
| 907 | 714 | } |
| 908 | 715 | |
| 909 | | static WRITE8_DEVICE_HANDLER( c8050_via_pb_w ) |
| 716 | |
| 717 | WRITE8_MEMBER( c2040_device::c8050_via_pb_w ) |
| 910 | 718 | { |
| 911 | 719 | /* |
| 912 | 720 | |
| r11262 | r11263 | |
| 923 | 731 | |
| 924 | 732 | */ |
| 925 | 733 | |
| 926 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 927 | | |
| 928 | | /* spindle motor 1 */ |
| 734 | // spindle motor 1 |
| 929 | 735 | int mtr1 = BIT(data, 4); |
| 930 | | spindle_motor(c2040, 1, mtr1); |
| 736 | spindle_motor(1, mtr1); |
| 931 | 737 | |
| 932 | | /* spindle motor 0 */ |
| 738 | // spindle motor 0 |
| 933 | 739 | int mtr0 = BIT(data, 5); |
| 934 | | spindle_motor(c2040, 0, mtr0); |
| 740 | spindle_motor(0, mtr0); |
| 935 | 741 | |
| 936 | | /* stepper motor 1 */ |
| 742 | // stepper motor 1 |
| 937 | 743 | int s1 = data & 0x03; |
| 938 | | mpi_step_motor(c2040, 1, mtr1, s1); |
| 744 | mpi_step_motor(1, s1); |
| 939 | 745 | |
| 940 | | /* stepper motor 0 */ |
| 746 | // stepper motor 0 |
| 941 | 747 | int s0 = (data >> 2) & 0x03; |
| 942 | | mpi_step_motor(c2040, 0, mtr0, s0); |
| 748 | mpi_step_motor(0, s0); |
| 943 | 749 | |
| 944 | | c2040->bit_timer->enable(!mtr1 | !mtr0); |
| 750 | m_bit_timer->enable(!mtr1 | !mtr0); |
| 945 | 751 | } |
| 946 | 752 | |
| 753 | |
| 947 | 754 | static const via6522_interface c8050_via_intf = |
| 948 | 755 | { |
| 949 | | DEVCB_HANDLER(via_pa_r), |
| 950 | | DEVCB_HANDLER(c8050_via_pb_r), |
| 951 | | DEVCB_LINE(ready_r), |
| 952 | | DEVCB_LINE(err_r), |
| 756 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, via_pa_r), |
| 757 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, c8050_via_pb_r), |
| 758 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, ready_r), |
| 759 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, err_r), |
| 953 | 760 | DEVCB_NULL, |
| 954 | 761 | DEVCB_NULL, |
| 955 | 762 | |
| 956 | 763 | DEVCB_NULL, |
| 957 | | DEVCB_HANDLER(c8050_via_pb_w), |
| 764 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, c8050_via_pb_w), |
| 958 | 765 | DEVCB_NULL, |
| 959 | 766 | DEVCB_NULL, |
| 960 | | DEVCB_LINE(mode_sel_w), |
| 961 | | DEVCB_LINE(rw_sel_w), |
| 767 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, mode_sel_w), |
| 768 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c2040_device, rw_sel_w), |
| 962 | 769 | |
| 963 | 770 | DEVCB_NULL |
| 964 | 771 | }; |
| 965 | 772 | |
| 966 | | /*------------------------------------------------- |
| 967 | | mos6530_interface miot_intf uk3 |
| 968 | | -------------------------------------------------*/ |
| 969 | 773 | |
| 970 | | static READ8_DEVICE_HANDLER( pi_r ) |
| 774 | //------------------------------------------------- |
| 775 | // mos6530_interface miot_intf uk3 |
| 776 | //------------------------------------------------- |
| 777 | |
| 778 | READ8_MEMBER( c2040_device::pi_r ) |
| 971 | 779 | { |
| 972 | 780 | /* |
| 973 | 781 | |
| r11262 | r11263 | |
| 984 | 792 | |
| 985 | 793 | */ |
| 986 | 794 | |
| 987 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 988 | | |
| 989 | | return c2040->pi; |
| 795 | return m_pi; |
| 990 | 796 | } |
| 991 | 797 | |
| 992 | | static WRITE8_DEVICE_HANDLER( pi_w ) |
| 798 | WRITE8_MEMBER( c2040_device::pi_w ) |
| 993 | 799 | { |
| 994 | 800 | /* |
| 995 | 801 | |
| r11262 | r11263 | |
| 1006 | 812 | |
| 1007 | 813 | */ |
| 1008 | 814 | |
| 1009 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 1010 | | |
| 1011 | | c2040->pi = data; |
| 815 | m_pi = data; |
| 1012 | 816 | } |
| 1013 | 817 | |
| 1014 | | static READ8_DEVICE_HANDLER( miot_pb_r ) |
| 818 | READ8_MEMBER( c2040_device::miot_pb_r ) |
| 1015 | 819 | { |
| 1016 | 820 | /* |
| 1017 | 821 | |
| r11262 | r11263 | |
| 1028 | 832 | |
| 1029 | 833 | */ |
| 1030 | 834 | |
| 1031 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 1032 | | |
| 1033 | 835 | UINT8 data = 0; |
| 1034 | 836 | |
| 1035 | | /* write protect sense */ |
| 1036 | | data |= floppy_wpt_r(c2040->unit[c2040->drive].image) << 3; |
| 837 | // write protect sense |
| 838 | data |= floppy_wpt_r(m_unit[m_drive].m_image) << 3; |
| 1037 | 839 | |
| 1038 | | /* SYNC detected */ |
| 840 | // SYNC detected |
| 1039 | 841 | data |= SYNC << 6; |
| 1040 | 842 | |
| 1041 | 843 | return data; |
| 1042 | 844 | } |
| 1043 | 845 | |
| 1044 | | static WRITE8_DEVICE_HANDLER( miot_pb_w ) |
| 846 | WRITE8_MEMBER( c2040_device::miot_pb_w ) |
| 1045 | 847 | { |
| 1046 | 848 | /* |
| 1047 | 849 | |
| r11262 | r11263 | |
| 1058 | 860 | |
| 1059 | 861 | */ |
| 1060 | 862 | |
| 1061 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 863 | // drive select |
| 864 | m_drive = BIT(data, 0); |
| 1062 | 865 | |
| 1063 | | /* drive select */ |
| 1064 | | c2040->drive = BIT(data, 0); |
| 1065 | | |
| 1066 | | /* density select */ |
| 866 | // density select |
| 1067 | 867 | int ds = (data >> 1) & 0x03; |
| 1068 | 868 | |
| 1069 | | if (c2040->ds != ds) |
| 869 | if (m_ds != ds) |
| 1070 | 870 | { |
| 1071 | | c2040->bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4)); |
| 1072 | | c2040->ds = ds; |
| 871 | m_bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C2040_BITRATE[ds]/4)); |
| 872 | m_ds = ds; |
| 1073 | 873 | } |
| 1074 | 874 | |
| 1075 | | /* interrupt */ |
| 1076 | | if (c2040->miot_irq != BIT(data, 7)) |
| 875 | // interrupt |
| 876 | if (m_miot_irq != BIT(data, 7)) |
| 1077 | 877 | { |
| 1078 | | device_set_input_line(c2040->cpu_fdc, M6502_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); |
| 1079 | | c2040->miot_irq = BIT(data, 7); |
| 878 | m_fdccpu->set_input_line(M6502_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); |
| 879 | m_miot_irq = BIT(data, 7); |
| 1080 | 880 | } |
| 1081 | 881 | } |
| 1082 | 882 | |
| 1083 | 883 | static MOS6530_INTERFACE( miot_intf ) |
| 1084 | 884 | { |
| 1085 | | DEVCB_HANDLER(pi_r), |
| 1086 | | DEVCB_HANDLER(pi_w), |
| 1087 | | DEVCB_HANDLER(miot_pb_r), |
| 1088 | | DEVCB_HANDLER(miot_pb_w) |
| 885 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, pi_r), |
| 886 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, pi_w), |
| 887 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, miot_pb_r), |
| 888 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, miot_pb_w) |
| 1089 | 889 | }; |
| 1090 | 890 | |
| 1091 | | /*------------------------------------------------- |
| 1092 | | mos6530_interface c8050_miot_intf uk3 |
| 1093 | | -------------------------------------------------*/ |
| 1094 | 891 | |
| 1095 | | static READ8_DEVICE_HANDLER( c8050_miot_pb_r ) |
| 892 | //------------------------------------------------- |
| 893 | // mos6530_interface c8050_miot_intf uk3 |
| 894 | //------------------------------------------------- |
| 895 | |
| 896 | READ8_MEMBER( c2040_device::c8050_miot_pb_r ) |
| 1096 | 897 | { |
| 1097 | 898 | /* |
| 1098 | 899 | |
| r11262 | r11263 | |
| 1109 | 910 | |
| 1110 | 911 | */ |
| 1111 | 912 | |
| 1112 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 1113 | | |
| 1114 | 913 | UINT8 data = 0; |
| 1115 | 914 | |
| 1116 | | /* write protect sense */ |
| 1117 | | data |= floppy_wpt_r(c2040->unit[c2040->drive].image) << 3; |
| 915 | // write protect sense |
| 916 | data |= floppy_wpt_r(m_unit[m_drive].m_image) << 3; |
| 1118 | 917 | |
| 1119 | | /* drive type */ |
| 918 | // drive type |
| 1120 | 919 | data |= 0x10; |
| 1121 | 920 | |
| 1122 | | /* single/dual sided */ |
| 1123 | | if (device->owner()->type() == C8050) |
| 921 | // single/dual sided |
| 922 | if (m_config.m_variant == c2040_device_config::TYPE_8050) |
| 1124 | 923 | { |
| 1125 | 924 | data |= 0x40; |
| 1126 | 925 | } |
| r11262 | r11263 | |
| 1128 | 927 | return data; |
| 1129 | 928 | } |
| 1130 | 929 | |
| 1131 | | static WRITE8_DEVICE_HANDLER( c8050_miot_pb_w ) |
| 930 | WRITE8_MEMBER( c2040_device::c8050_miot_pb_w ) |
| 1132 | 931 | { |
| 1133 | 932 | /* |
| 1134 | 933 | |
| r11262 | r11263 | |
| 1145 | 944 | |
| 1146 | 945 | */ |
| 1147 | 946 | |
| 1148 | | c2040_t *c2040 = get_safe_token(device->owner()); |
| 1149 | | |
| 1150 | | /* drive select */ |
| 1151 | | if ((device->owner()->type() == C8050) || (device->owner()->type() == C8250)) |
| 947 | // drive select |
| 948 | if ((m_config.m_variant == c2040_device_config::TYPE_8050) || |
| 949 | (m_config.m_variant == c2040_device_config::TYPE_8250)) |
| 1152 | 950 | { |
| 1153 | | c2040->drive = BIT(data, 0); |
| 951 | m_drive = BIT(data, 0); |
| 1154 | 952 | } |
| 1155 | 953 | |
| 1156 | | /* density select */ |
| 954 | // density select |
| 1157 | 955 | int ds = (data >> 1) & 0x03; |
| 1158 | 956 | |
| 1159 | | if (c2040->ds != ds) |
| 957 | if (m_ds != ds) |
| 1160 | 958 | { |
| 1161 | | c2040->bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C8050_BITRATE[ds])); |
| 1162 | | c2040->ds = ds; |
| 959 | m_bit_timer->adjust(attotime::zero, 0, attotime::from_hz(C8050_BITRATE[ds])); |
| 960 | m_ds = ds; |
| 1163 | 961 | } |
| 1164 | 962 | |
| 1165 | | /* side select */ |
| 1166 | | if ((device->owner()->type() == C8250) || (device->owner()->type() == SFD1001)) |
| 963 | // side select |
| 964 | if ((m_config.m_variant == c2040_device_config::TYPE_8250) || |
| 965 | (m_config.m_variant == c2040_device_config::TYPE_SFD1001)) |
| 1167 | 966 | { |
| 1168 | | c2040->side = !BIT(data, 4); |
| 967 | m_side = !BIT(data, 4); |
| 1169 | 968 | } |
| 1170 | 969 | |
| 1171 | | /* interrupt */ |
| 1172 | | if (c2040->miot_irq != BIT(data, 7)) |
| 970 | // interrupt |
| 971 | if (m_miot_irq != BIT(data, 7)) |
| 1173 | 972 | { |
| 1174 | | device_set_input_line(c2040->cpu_fdc, M6502_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); |
| 1175 | | c2040->miot_irq = BIT(data, 7); |
| 973 | m_fdccpu->set_input_line(M6502_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); |
| 974 | m_miot_irq = BIT(data, 7); |
| 1176 | 975 | } |
| 1177 | 976 | } |
| 1178 | 977 | |
| 1179 | 978 | static MOS6530_INTERFACE( c8050_miot_intf ) |
| 1180 | 979 | { |
| 1181 | | DEVCB_HANDLER(pi_r), |
| 1182 | | DEVCB_HANDLER(pi_w), |
| 1183 | | DEVCB_HANDLER(c8050_miot_pb_r), |
| 1184 | | DEVCB_HANDLER(c8050_miot_pb_w) |
| 980 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, pi_r), |
| 981 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, pi_w), |
| 982 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, c8050_miot_pb_r), |
| 983 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c2040_device, c8050_miot_pb_w) |
| 1185 | 984 | }; |
| 1186 | 985 | |
| 1187 | | /*------------------------------------------------- |
| 1188 | | FLOPPY_OPTIONS( c2040 ) |
| 1189 | | -------------------------------------------------*/ |
| 1190 | 986 | |
| 987 | //------------------------------------------------- |
| 988 | // FLOPPY_OPTIONS( c2040 ) |
| 989 | //------------------------------------------------- |
| 990 | |
| 1191 | 991 | static FLOPPY_OPTIONS_START( c2040 ) |
| 1192 | 992 | FLOPPY_OPTION( c2040, "d67", "Commodore 2040/3040 Disk Image", d67_dsk_identify, d64_dsk_construct, NULL ) |
| 1193 | 993 | FLOPPY_OPTION( c2040, "g64", "Commodore 2040/3040 GCR Disk Image", g64_dsk_identify, g64_dsk_construct, NULL ) |
| 1194 | 994 | FLOPPY_OPTIONS_END |
| 1195 | 995 | |
| 1196 | | /*------------------------------------------------- |
| 1197 | | FLOPPY_OPTIONS( c4040 ) |
| 1198 | | -------------------------------------------------*/ |
| 1199 | 996 | |
| 997 | //------------------------------------------------- |
| 998 | // FLOPPY_OPTIONS( c4040 ) |
| 999 | //------------------------------------------------- |
| 1000 | |
| 1200 | 1001 | static FLOPPY_OPTIONS_START( c4040 ) |
| 1201 | 1002 | FLOPPY_OPTION( c4040, "d64", "Commodore 4040 Disk Image", d64_dsk_identify, d64_dsk_construct, NULL ) |
| 1202 | 1003 | FLOPPY_OPTION( c4040, "g64", "Commodore 4040 GCR Disk Image", g64_dsk_identify, g64_dsk_construct, NULL ) |
| 1203 | 1004 | FLOPPY_OPTIONS_END |
| 1204 | 1005 | |
| 1205 | | /*------------------------------------------------- |
| 1206 | | FLOPPY_OPTIONS( c8050 ) |
| 1207 | | -------------------------------------------------*/ |
| 1208 | 1006 | |
| 1007 | //------------------------------------------------- |
| 1008 | // FLOPPY_OPTIONS( c8050 ) |
| 1009 | //------------------------------------------------- |
| 1010 | |
| 1209 | 1011 | static FLOPPY_OPTIONS_START( c8050 ) |
| 1210 | 1012 | FLOPPY_OPTION( c8050, "d80", "Commodore 8050 Disk Image", d80_dsk_identify, d64_dsk_construct, NULL ) |
| 1211 | 1013 | FLOPPY_OPTIONS_END |
| 1212 | 1014 | |
| 1213 | | /*------------------------------------------------- |
| 1214 | | FLOPPY_OPTIONS( c8050 ) |
| 1215 | | -------------------------------------------------*/ |
| 1216 | 1015 | |
| 1016 | //------------------------------------------------- |
| 1017 | // FLOPPY_OPTIONS( c8250 ) |
| 1018 | //------------------------------------------------- |
| 1019 | |
| 1217 | 1020 | static FLOPPY_OPTIONS_START( c8250 ) |
| 1218 | 1021 | FLOPPY_OPTION( c8250, "d80", "Commodore 8050 Disk Image", d80_dsk_identify, d64_dsk_construct, NULL ) |
| 1219 | 1022 | FLOPPY_OPTION( c8250, "d82", "Commodore 8250/SFD1001 Disk Image", d82_dsk_identify, d64_dsk_construct, NULL ) |
| 1220 | 1023 | FLOPPY_OPTIONS_END |
| 1221 | 1024 | |
| 1222 | | /*------------------------------------------------- |
| 1223 | | floppy_config c2040_floppy_config |
| 1224 | | -------------------------------------------------*/ |
| 1225 | 1025 | |
| 1026 | //------------------------------------------------- |
| 1027 | // floppy_config c2040_floppy_config |
| 1028 | //------------------------------------------------- |
| 1029 | |
| 1226 | 1030 | static const floppy_config c2040_floppy_config = |
| 1227 | 1031 | { |
| 1228 | 1032 | DEVCB_NULL, |
| r11262 | r11263 | |
| 1232 | 1036 | DEVCB_NULL, |
| 1233 | 1037 | FLOPPY_STANDARD_5_25_SSDD, |
| 1234 | 1038 | FLOPPY_OPTIONS_NAME(c2040), |
| 1235 | | NULL |
| 1039 | "floppy_5_25" |
| 1236 | 1040 | }; |
| 1237 | 1041 | |
| 1238 | | /*------------------------------------------------- |
| 1239 | | floppy_config c4040_floppy_config |
| 1240 | | -------------------------------------------------*/ |
| 1241 | 1042 | |
| 1043 | //------------------------------------------------- |
| 1044 | // floppy_config c4040_floppy_config |
| 1045 | //------------------------------------------------- |
| 1046 | |
| 1242 | 1047 | static const floppy_config c4040_floppy_config = |
| 1243 | 1048 | { |
| 1244 | 1049 | DEVCB_NULL, |
| r11262 | r11263 | |
| 1248 | 1053 | DEVCB_NULL, |
| 1249 | 1054 | FLOPPY_STANDARD_5_25_SSDD, |
| 1250 | 1055 | FLOPPY_OPTIONS_NAME(c4040), |
| 1251 | | NULL |
| 1056 | "floppy_5_25" |
| 1252 | 1057 | }; |
| 1253 | 1058 | |
| 1254 | | /*------------------------------------------------- |
| 1255 | | floppy_config c8050_floppy_config |
| 1256 | | -------------------------------------------------*/ |
| 1257 | 1059 | |
| 1060 | //------------------------------------------------- |
| 1061 | // floppy_config c8050_floppy_config |
| 1062 | //------------------------------------------------- |
| 1063 | |
| 1258 | 1064 | static const floppy_config c8050_floppy_config = |
| 1259 | 1065 | { |
| 1260 | 1066 | DEVCB_NULL, |
| r11262 | r11263 | |
| 1264 | 1070 | DEVCB_NULL, |
| 1265 | 1071 | FLOPPY_STANDARD_5_25_SSDD, |
| 1266 | 1072 | FLOPPY_OPTIONS_NAME(c8050), |
| 1267 | | NULL |
| 1073 | "floppy_5_25" |
| 1268 | 1074 | }; |
| 1269 | 1075 | |
| 1270 | | /*------------------------------------------------- |
| 1271 | | floppy_config c8250_floppy_config |
| 1272 | | -------------------------------------------------*/ |
| 1273 | 1076 | |
| 1077 | //------------------------------------------------- |
| 1078 | // floppy_config c8250_floppy_config |
| 1079 | //------------------------------------------------- |
| 1080 | |
| 1274 | 1081 | static const floppy_config c8250_floppy_config = |
| 1275 | 1082 | { |
| 1276 | 1083 | DEVCB_NULL, |
| r11262 | r11263 | |
| 1278 | 1085 | DEVCB_NULL, |
| 1279 | 1086 | DEVCB_NULL, |
| 1280 | 1087 | DEVCB_NULL, |
| 1281 | | FLOPPY_STANDARD_5_25_DSHD, |
| 1088 | FLOPPY_STANDARD_5_25_DSQD, |
| 1282 | 1089 | FLOPPY_OPTIONS_NAME(c8250), |
| 1283 | | NULL |
| 1090 | "floppy_5_25" |
| 1284 | 1091 | }; |
| 1285 | 1092 | |
| 1286 | | /*------------------------------------------------- |
| 1287 | | MACHINE_DRIVER( c2040 ) |
| 1288 | | -------------------------------------------------*/ |
| 1289 | 1093 | |
| 1094 | //------------------------------------------------- |
| 1095 | // MACHINE_CONFIG_FRAGMENT( c2040 ) |
| 1096 | //------------------------------------------------- |
| 1097 | |
| 1290 | 1098 | static MACHINE_CONFIG_FRAGMENT( c2040 ) |
| 1291 | | /* DOS */ |
| 1099 | // DOS |
| 1292 | 1100 | MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16) |
| 1293 | | MCFG_CPU_PROGRAM_MAP(c2040_dos_map) |
| 1101 | MCFG_CPU_PROGRAM_MAP(c2040_main_mem) |
| 1294 | 1102 | |
| 1295 | 1103 | MCFG_RIOT6532_ADD(M6532_0_TAG, XTAL_16MHz/16, riot0_intf) |
| 1296 | 1104 | MCFG_RIOT6532_ADD(M6532_1_TAG, XTAL_16MHz/16, riot1_intf) |
| 1297 | 1105 | |
| 1298 | | /* controller */ |
| 1106 | // controller |
| 1299 | 1107 | MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_16MHz/16) |
| 1300 | | MCFG_CPU_PROGRAM_MAP(c2040_fdc_map) |
| 1108 | MCFG_CPU_PROGRAM_MAP(c2040_fdc_mem) |
| 1301 | 1109 | |
| 1302 | 1110 | MCFG_VIA6522_ADD(M6522_TAG, XTAL_16MHz/16, via_intf) |
| 1303 | 1111 | MCFG_MOS6530_ADD(M6530_TAG, XTAL_16MHz/16, miot_intf) |
| r11262 | r11263 | |
| 1305 | 1113 | MCFG_FLOPPY_2_DRIVES_ADD(c2040_floppy_config) |
| 1306 | 1114 | MACHINE_CONFIG_END |
| 1307 | 1115 | |
| 1308 | | /*------------------------------------------------- |
| 1309 | | MACHINE_DRIVER( c4040 ) |
| 1310 | | -------------------------------------------------*/ |
| 1311 | 1116 | |
| 1117 | //------------------------------------------------- |
| 1118 | // MACHINE_CONFIG_FRAGMENT( c4040 ) |
| 1119 | //------------------------------------------------- |
| 1120 | |
| 1312 | 1121 | static MACHINE_CONFIG_FRAGMENT( c4040 ) |
| 1313 | | /* DOS */ |
| 1122 | // DOS |
| 1314 | 1123 | MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16) |
| 1315 | | MCFG_CPU_PROGRAM_MAP(c4040_dos_map) |
| 1124 | MCFG_CPU_PROGRAM_MAP(c2040_main_mem) |
| 1316 | 1125 | |
| 1317 | 1126 | MCFG_RIOT6532_ADD(M6532_0_TAG, XTAL_16MHz/16, riot0_intf) |
| 1318 | 1127 | MCFG_RIOT6532_ADD(M6532_1_TAG, XTAL_16MHz/16, riot1_intf) |
| 1319 | 1128 | |
| 1320 | | /* controller */ |
| 1129 | // controller |
| 1321 | 1130 | MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_16MHz/16) |
| 1322 | | MCFG_CPU_PROGRAM_MAP(c4040_fdc_map) |
| 1131 | MCFG_CPU_PROGRAM_MAP(c2040_fdc_mem) |
| 1323 | 1132 | |
| 1324 | 1133 | MCFG_VIA6522_ADD(M6522_TAG, XTAL_16MHz/16, via_intf) |
| 1325 | 1134 | MCFG_MOS6530_ADD(M6530_TAG, XTAL_16MHz/16, miot_intf) |
| r11262 | r11263 | |
| 1327 | 1136 | MCFG_FLOPPY_2_DRIVES_ADD(c4040_floppy_config) |
| 1328 | 1137 | MACHINE_CONFIG_END |
| 1329 | 1138 | |
| 1330 | | /*------------------------------------------------- |
| 1331 | | MACHINE_DRIVER( c8050 ) |
| 1332 | | -------------------------------------------------*/ |
| 1333 | 1139 | |
| 1140 | //------------------------------------------------- |
| 1141 | // MACHINE_CONFIG_FRAGMENT( c8050 ) |
| 1142 | //------------------------------------------------- |
| 1143 | |
| 1334 | 1144 | static MACHINE_CONFIG_FRAGMENT( c8050 ) |
| 1335 | | /* DOS */ |
| 1145 | // DOS |
| 1336 | 1146 | MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_12MHz/12) |
| 1337 | | MCFG_CPU_PROGRAM_MAP(c8050_dos_map) |
| 1147 | MCFG_CPU_PROGRAM_MAP(c8050_main_mem) |
| 1338 | 1148 | |
| 1339 | 1149 | MCFG_RIOT6532_ADD(M6532_0_TAG, XTAL_12MHz/12, riot0_intf) |
| 1340 | 1150 | MCFG_RIOT6532_ADD(M6532_1_TAG, XTAL_12MHz/12, riot1_intf) |
| 1341 | 1151 | |
| 1342 | | /* controller */ |
| 1152 | // controller |
| 1343 | 1153 | MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_12MHz/12) |
| 1344 | | MCFG_CPU_PROGRAM_MAP(c8050_fdc_map) |
| 1154 | MCFG_CPU_PROGRAM_MAP(c8050_fdc_mem) |
| 1345 | 1155 | |
| 1346 | 1156 | MCFG_VIA6522_ADD(M6522_TAG, XTAL_12MHz/12, c8050_via_intf) |
| 1347 | 1157 | MCFG_MOS6530_ADD(M6530_TAG, XTAL_12MHz/12, c8050_miot_intf) |
| r11262 | r11263 | |
| 1349 | 1159 | MCFG_FLOPPY_2_DRIVES_ADD(c8050_floppy_config) |
| 1350 | 1160 | MACHINE_CONFIG_END |
| 1351 | 1161 | |
| 1352 | | /*------------------------------------------------- |
| 1353 | | MACHINE_DRIVER( c8250 ) |
| 1354 | | -------------------------------------------------*/ |
| 1355 | 1162 | |
| 1163 | //------------------------------------------------- |
| 1164 | // MACHINE_CONFIG_FRAGMENT( c8250 ) |
| 1165 | //------------------------------------------------- |
| 1166 | |
| 1356 | 1167 | static MACHINE_CONFIG_FRAGMENT( c8250 ) |
| 1357 | | /* DOS */ |
| 1168 | // DOS |
| 1358 | 1169 | MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_12MHz/12) |
| 1359 | | MCFG_CPU_PROGRAM_MAP(c8050_dos_map) |
| 1170 | MCFG_CPU_PROGRAM_MAP(c8050_main_mem) |
| 1360 | 1171 | |
| 1361 | 1172 | MCFG_RIOT6532_ADD(M6532_0_TAG, XTAL_12MHz/12, riot0_intf) |
| 1362 | 1173 | MCFG_RIOT6532_ADD(M6532_1_TAG, XTAL_12MHz/12, riot1_intf) |
| 1363 | 1174 | |
| 1364 | | /* controller */ |
| 1175 | // controller |
| 1365 | 1176 | MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_12MHz/12) |
| 1366 | | MCFG_CPU_PROGRAM_MAP(c8050_fdc_map) |
| 1177 | MCFG_CPU_PROGRAM_MAP(c8050_fdc_mem) |
| 1367 | 1178 | |
| 1368 | 1179 | MCFG_VIA6522_ADD(M6522_TAG, XTAL_12MHz/12, c8050_via_intf) |
| 1369 | 1180 | MCFG_MOS6530_ADD(M6530_TAG, XTAL_12MHz/12, c8050_miot_intf) |
| r11262 | r11263 | |
| 1371 | 1182 | MCFG_FLOPPY_2_DRIVES_ADD(c8250_floppy_config) |
| 1372 | 1183 | MACHINE_CONFIG_END |
| 1373 | 1184 | |
| 1374 | | /*------------------------------------------------- |
| 1375 | | MACHINE_DRIVER( sfd1001 ) |
| 1376 | | -------------------------------------------------*/ |
| 1377 | 1185 | |
| 1186 | //------------------------------------------------- |
| 1187 | // MACHINE_CONFIG_FRAGMENT( sfd1001 ) |
| 1188 | //------------------------------------------------- |
| 1189 | |
| 1378 | 1190 | static MACHINE_CONFIG_FRAGMENT( sfd1001 ) |
| 1379 | | /* DOS */ |
| 1191 | // DOS |
| 1380 | 1192 | MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_12MHz/12) |
| 1381 | | MCFG_CPU_PROGRAM_MAP(sfd1001_dos_map) |
| 1193 | MCFG_CPU_PROGRAM_MAP(c8050_main_mem) |
| 1382 | 1194 | |
| 1383 | 1195 | MCFG_RIOT6532_ADD(M6532_0_TAG, XTAL_12MHz/12, riot0_intf) |
| 1384 | 1196 | MCFG_RIOT6532_ADD(M6532_1_TAG, XTAL_12MHz/12, riot1_intf) |
| 1385 | 1197 | |
| 1386 | | /* controller */ |
| 1198 | // controller |
| 1387 | 1199 | MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_12MHz/12) |
| 1388 | | MCFG_CPU_PROGRAM_MAP(sfd1001_fdc_map) |
| 1200 | MCFG_CPU_PROGRAM_MAP(sfd1001_fdc_mem) |
| 1389 | 1201 | |
| 1390 | 1202 | MCFG_VIA6522_ADD(M6522_TAG, XTAL_12MHz/12, c8050_via_intf) |
| 1391 | 1203 | MCFG_MOS6530_ADD(M6530_TAG, XTAL_12MHz/12, c8050_miot_intf) |
| r11262 | r11263 | |
| 1393 | 1205 | MCFG_FLOPPY_DRIVE_ADD(FLOPPY_0, c8250_floppy_config) |
| 1394 | 1206 | MACHINE_CONFIG_END |
| 1395 | 1207 | |
| 1396 | | /*------------------------------------------------- |
| 1397 | | ROM( c2040 ) |
| 1398 | | -------------------------------------------------*/ |
| 1399 | 1208 | |
| 1400 | | ROM_START( c2040 ) // schematic 320806 |
| 1401 | | ROM_REGION( 0x2c00, C2040_REGION, ROMREGION_LOADBYNAME ) |
| 1402 | | /* DOS 1.0 */ |
| 1403 | | ROM_LOAD( "901468-06.ul1", 0x0000, 0x1000, CRC(25b5eed5) SHA1(4d9658f2e6ff3276e5c6e224611a66ce44b16fc7) ) |
| 1404 | | ROM_LOAD( "901468-07.uh1", 0x1000, 0x1000, CRC(9b09ae83) SHA1(6a51c7954938439ca8342fc295bda050c06e1791) ) |
| 1209 | //------------------------------------------------- |
| 1210 | // machine_config_additions - device-specific |
| 1211 | // machine configurations |
| 1212 | //------------------------------------------------- |
| 1405 | 1213 | |
| 1406 | | /* RIOT DOS 1 */ |
| 1407 | | ROM_LOAD( "901466-02.uk3", 0x2000, 0x0400, BAD_DUMP /* parsed in from disassembly */ CRC(e1c86c43) SHA1(d8209c66fde3f2937688ba934ba968678a9d2ebb) ) |
| 1214 | machine_config_constructor c2040_device_config::device_mconfig_additions() const |
| 1215 | { |
| 1216 | switch (m_variant) |
| 1217 | { |
| 1218 | default: |
| 1219 | case TYPE_2040: |
| 1220 | case TYPE_3040: |
| 1221 | return MACHINE_CONFIG_NAME( c2040 ); |
| 1408 | 1222 | |
| 1409 | | /* ROM GCR */ |
| 1410 | | ROM_LOAD( "901467.uk6", 0x2400, 0x0800, CRC(a23337eb) SHA1(97df576397608455616331f8e837cb3404363fa2) ) |
| 1411 | | ROM_END |
| 1223 | case TYPE_4040: |
| 1224 | return MACHINE_CONFIG_NAME( c4040 ); |
| 1412 | 1225 | |
| 1413 | | /*------------------------------------------------- |
| 1414 | | ROM( c4040 ) |
| 1415 | | -------------------------------------------------*/ |
| 1226 | case TYPE_8050: |
| 1227 | return MACHINE_CONFIG_NAME( c8050 ); |
| 1416 | 1228 | |
| 1417 | | ROM_START( c4040 ) // schematic ? |
| 1418 | | ROM_REGION( 0x3c00, C4040_REGION, ROMREGION_LOADBYNAME ) |
| 1419 | | /* DOS 2.1 */ |
| 1420 | | ROM_LOAD_OPTIONAL( "901468-11.uj1", 0x0000, 0x1000, CRC(b7157458) SHA1(8415f3159dea73161e0cef7960afa6c76953b6f8) ) |
| 1421 | | ROM_LOAD_OPTIONAL( "901468-12.ul1", 0x1000, 0x1000, CRC(02c44ff9) SHA1(e8a94f239082d45f64f01b2d8e488d18fe659cbb) ) |
| 1422 | | ROM_LOAD_OPTIONAL( "901468-13.uh1", 0x2000, 0x1000, CRC(cbd785b3) SHA1(6ada7904ac9d13c3f1c0a8715f9c4be1aa6eb0bb) ) |
| 1423 | | /* DOS 2 rev */ |
| 1424 | | ROM_LOAD( "901468-14.uj1", 0x0000, 0x1000, CRC(bc4d4872) SHA1(ffb992b82ec913ddff7be964d7527aca3e21580c) ) |
| 1425 | | ROM_LOAD( "901468-15.ul1", 0x1000, 0x1000, CRC(b6970533) SHA1(f702d6917fe8a798740ba4d467b500944ae7b70a) ) |
| 1426 | | ROM_LOAD( "901468-16.uh1", 0x2000, 0x1000, CRC(1f5eefb7) SHA1(04b918cf4adeee8015b43383d3cea7288a7d0aa8) ) |
| 1229 | case TYPE_8250: |
| 1230 | return MACHINE_CONFIG_NAME( c8250 ); |
| 1427 | 1231 | |
| 1428 | | /* RIOT DOS 2 */ |
| 1429 | | ROM_LOAD( "901466-04.uk3", 0x3000, 0x0400, CRC(0ab338dc) SHA1(6645fa40b81be1ff7d1384e9b52df06a26ab0bfb) ) |
| 1232 | case TYPE_SFD1001: |
| 1233 | return MACHINE_CONFIG_NAME( sfd1001 ); |
| 1234 | } |
| 1235 | } |
| 1430 | 1236 | |
| 1431 | | /* ROM GCR */ |
| 1432 | | ROM_LOAD( "901467.uk6", 0x3400, 0x0800, CRC(a23337eb) SHA1(97df576397608455616331f8e837cb3404363fa2) ) |
| 1433 | | ROM_END |
| 1434 | 1237 | |
| 1435 | | /*------------------------------------------------- |
| 1436 | | ROM( c8050 ) |
| 1437 | | -------------------------------------------------*/ |
| 1438 | 1238 | |
| 1439 | | /* |
| 1239 | //************************************************************************** |
| 1240 | // INLINE HELPERS |
| 1241 | //************************************************************************** |
| 1440 | 1242 | |
| 1441 | | DOS/CONTROLLER ROMS FOR DIGITAL PCB #8050002 |
| 1243 | //------------------------------------------------- |
| 1244 | // update_ieee_signals - |
| 1245 | //------------------------------------------------- |
| 1442 | 1246 | |
| 1443 | | DESCRIPTION PCB PART NO. UL1 UH1 UK3 |
| 1247 | inline void c2040_device::update_ieee_signals() |
| 1248 | { |
| 1249 | int atn = m_bus->atn_r(); |
| 1250 | int nrfd = !(!(!(atn & m_atna) & m_rfdo) | !(atn | m_atna)); |
| 1251 | int ndac = !(m_daco | !(atn | m_atna)); |
| 1444 | 1252 | |
| 1445 | | 2.5 Micropolis 8050002-01 901482-07 901482-06 901483-03 |
| 1446 | | 2.5 Tandon 8050002-02 901482-07 901482-06 901483-04 |
| 1447 | | 2.7 Tandon 8050002-03 901887-01 901888-01 901884-01 |
| 1448 | | 2.7 Micropolis 8050002-04 901887-01 901888-01 901885-04 |
| 1449 | | 2.7 MPI 8050 8050002-05 901887-01 901888-01 901869-01 |
| 1450 | | 2.7 MPI 8250 8050002-06 901887-01 901888-01 901869-01 |
| 1253 | m_bus->nrfd_w(this, nrfd); |
| 1254 | m_bus->ndac_w(this, ndac); |
| 1255 | } |
| 1451 | 1256 | |
| 1452 | | */ |
| 1453 | 1257 | |
| 1454 | | ROM_START( c8050 ) // schematic 8050001 |
| 1455 | | ROM_REGION( 0x4c00, C8050_REGION, ROMREGION_LOADBYNAME ) |
| 1456 | | /* 2364 ROM DOS 2.5 */ |
| 1457 | | ROM_LOAD_OPTIONAL( "901482-03.ul1", 0x0000, 0x2000, CRC(09a609b9) SHA1(166d8bfaaa9c4767f9b17ad63fc7ae77c199a64e) ) |
| 1458 | | ROM_LOAD_OPTIONAL( "901482-04.uh1", 0x2000, 0x2000, CRC(1bcf9df9) SHA1(217f4a8b348658bb365f4a1de21ecbaa6402b1c0) ) |
| 1459 | | /* 2364-091 ROM DOS 2.5 rev */ |
| 1460 | | ROM_LOAD_OPTIONAL( "901482-06.ul1", 0x0000, 0x2000, CRC(3cbd2756) SHA1(7f5fbed0cddb95138dd99b8fe84fddab900e3650) ) |
| 1461 | | ROM_LOAD_OPTIONAL( "901482-07.uh1", 0x2000, 0x2000, CRC(c7532d90) SHA1(0b6d1e55afea612516df5f07f4a6dccd3bd73963) ) |
| 1462 | | /* 2364 ROM DOS 2.7 */ |
| 1463 | | ROM_LOAD( "901887-01.ul1", 0x0000, 0x2000, CRC(0073b8b2) SHA1(b10603195f240118fe5fb6c6dfe5c5097463d890) ) |
| 1464 | | ROM_LOAD( "901888-01.uh1", 0x2000, 0x2000, CRC(de9b6132) SHA1(2e6c2d7ca934e5c550ad14bd5e9e7749686b7af4) ) |
| 1258 | //------------------------------------------------- |
| 1259 | // update_gcr_data - |
| 1260 | //------------------------------------------------- |
| 1465 | 1261 | |
| 1466 | | /* controller */ |
| 1467 | | ROM_LOAD_OPTIONAL( "901483-03.uk3", 0x4000, 0x0400, CRC(9e83fa70) SHA1(e367ea8a5ddbd47f13570088427293138a10784b) ) |
| 1468 | | ROM_LOAD_OPTIONAL( "901483-04.uk3", 0x4000, 0x0400, NO_DUMP ) |
| 1469 | | ROM_LOAD_OPTIONAL( "901884-01.uk3", 0x4000, 0x0400, NO_DUMP ) |
| 1470 | | ROM_LOAD_OPTIONAL( "901885-04.uk3", 0x4000, 0x0400, CRC(bab998c9) SHA1(0dc9a3b60f1b866c63eebd882403532fc59fe57f) ) |
| 1471 | | ROM_LOAD( "901869-01.uk3", 0x4000, 0x0400, CRC(2915327a) SHA1(3a9a80f72ce76e5f5c72513f8ef7553212912ae3) ) |
| 1262 | inline void c2040_device::update_gcr_data() |
| 1263 | { |
| 1264 | if (m_rw) |
| 1265 | { |
| 1266 | /* |
| 1472 | 1267 | |
| 1473 | | /* GCR decoder */ |
| 1474 | | ROM_LOAD( "901467.uk6", 0x4400, 0x0800, CRC(a23337eb) SHA1(97df576397608455616331f8e837cb3404363fa2) ) |
| 1475 | | ROM_END |
| 1268 | bit description |
| 1476 | 1269 | |
| 1477 | | /*------------------------------------------------- |
| 1478 | | ROM( sfd1001 ) |
| 1479 | | -------------------------------------------------*/ |
| 1270 | I0 SR0 |
| 1271 | I1 SR1 |
| 1272 | I2 SR2 |
| 1273 | I3 SR3 |
| 1274 | I4 SR4 |
| 1275 | I5 SR5 |
| 1276 | I6 SR6 |
| 1277 | I7 SR7 |
| 1278 | I8 SR8 |
| 1279 | I9 SR9 |
| 1280 | I10 R/_W SEL |
| 1480 | 1281 | |
| 1481 | | ROM_START( sfd1001 ) // schematic 251406 |
| 1482 | | ROM_REGION( 0x5000, SFD1001_REGION, ROMREGION_LOADBYNAME ) |
| 1483 | | ROM_LOAD( "901887-01.1j", 0x0000, 0x2000, CRC(0073b8b2) SHA1(b10603195f240118fe5fb6c6dfe5c5097463d890) ) |
| 1484 | | ROM_LOAD( "901888-01.3j", 0x2000, 0x2000, CRC(de9b6132) SHA1(2e6c2d7ca934e5c550ad14bd5e9e7749686b7af4) ) |
| 1282 | */ |
| 1485 | 1283 | |
| 1486 | | /* controller */ |
| 1487 | | ROM_LOAD( "251257-02a.u2", 0x4000, 0x0800, CRC(b51150de) SHA1(3b954eb34f7ea088eed1d33ebc6d6e83a3e9be15) ) |
| 1284 | m_i = (m_rw << 10) | (m_sr & 0x3ff); |
| 1285 | } |
| 1286 | else |
| 1287 | { |
| 1288 | /* |
| 1488 | 1289 | |
| 1489 | | /* GCR decoder */ |
| 1490 | | ROM_LOAD( "901467.5c", 0x4800, 0x0800, CRC(a23337eb) SHA1(97df576397608455616331f8e837cb3404363fa2) ) |
| 1491 | | ROM_END |
| 1290 | bit description |
| 1492 | 1291 | |
| 1493 | | /*------------------------------------------------- |
| 1494 | | DEVICE_START( c2040 ) |
| 1495 | | -------------------------------------------------*/ |
| 1292 | I0 PI0 |
| 1293 | I1 PI1 |
| 1294 | I2 PI2 |
| 1295 | I3 PI3 |
| 1296 | I4 MODE SEL |
| 1297 | I5 PI4 |
| 1298 | I6 PI5 |
| 1299 | I7 PI6 |
| 1300 | I8 PI7 |
| 1301 | I9 0 |
| 1302 | I10 R/_W SEL |
| 1496 | 1303 | |
| 1497 | | static DEVICE_START( c2040 ) |
| 1498 | | { |
| 1499 | | c2040_t *c2040 = get_safe_token(device); |
| 1500 | | const c2040_config *config = get_safe_config(device); |
| 1304 | */ |
| 1501 | 1305 | |
| 1502 | | /* set serial address */ |
| 1503 | | assert((config->address > 7) && (config->address < 16)); |
| 1504 | | c2040->address = config->address - 8; |
| 1306 | m_i = (m_rw << 10) | ((m_pi & 0xf0) << 1) | (m_mode << 4) | (m_pi & 0x0f); |
| 1307 | } |
| 1505 | 1308 | |
| 1506 | | /* find our CPU */ |
| 1507 | | c2040->cpu_dos = device->subdevice(M6502_TAG); |
| 1508 | | c2040->cpu_fdc = device->subdevice(M6504_TAG); |
| 1309 | m_e = m_gcr[m_i]; |
| 1310 | } |
| 1509 | 1311 | |
| 1510 | | /* find devices */ |
| 1511 | | c2040->riot0 = device->subdevice(M6532_0_TAG); |
| 1512 | | c2040->riot1 = device->subdevice(M6532_1_TAG); |
| 1513 | | c2040->miot = device->subdevice(M6530_TAG); |
| 1514 | | c2040->via = device->subdevice<via6522_device>(M6522_TAG); |
| 1515 | | c2040->bus = device->machine().device(config->bus_tag); |
| 1516 | | c2040->unit[0].image = device->subdevice(FLOPPY_0); |
| 1517 | | c2040->unit[1].image = device->subdevice(FLOPPY_1); |
| 1518 | 1312 | |
| 1519 | | /* install image callbacks */ |
| 1520 | | floppy_install_unload_proc(c2040->unit[0].image, on_disk_0_change); |
| 1521 | | floppy_install_load_proc(c2040->unit[0].image, on_disk_0_change); |
| 1522 | | floppy_install_unload_proc(c2040->unit[1].image, on_disk_1_change); |
| 1523 | | floppy_install_load_proc(c2040->unit[1].image, on_disk_1_change); |
| 1313 | //------------------------------------------------- |
| 1314 | // update_ieee_signals - |
| 1315 | //------------------------------------------------- |
| 1524 | 1316 | |
| 1525 | | /* find GCR ROM */ |
| 1526 | | const memory_region *region = device->subregion(C4040_REGION); |
| 1317 | inline void c2040_device::read_current_track(int unit) |
| 1318 | { |
| 1319 | m_unit[unit].m_track_len = G64_BUFFER_SIZE; |
| 1320 | m_unit[unit].m_buffer_pos = 0; |
| 1321 | m_unit[unit].m_bit_pos = 7; |
| 1322 | m_bit_count = 0; |
| 1527 | 1323 | |
| 1528 | | if ((device->type() == C2040) || (device->type() == C3040)) |
| 1324 | // read track data |
| 1325 | floppy_drive_read_track_data_info_buffer(m_unit[unit].m_image, m_side, m_unit[unit].m_track_buffer, &m_unit[unit].m_track_len); |
| 1326 | |
| 1327 | // extract track length |
| 1328 | m_unit[unit].m_track_len = floppy_drive_get_current_track_size(m_unit[unit].m_image, m_side); |
| 1329 | } |
| 1330 | |
| 1331 | |
| 1332 | //------------------------------------------------- |
| 1333 | // spindle_motor - |
| 1334 | //------------------------------------------------- |
| 1335 | |
| 1336 | inline void c2040_device::spindle_motor(int unit, int mtr) |
| 1337 | { |
| 1338 | if (m_unit[unit].m_mtr != mtr) |
| 1529 | 1339 | { |
| 1530 | | region = device->subregion(C2040_REGION); |
| 1340 | if (!mtr) |
| 1341 | { |
| 1342 | // read track data |
| 1343 | read_current_track(unit); |
| 1344 | } |
| 1345 | |
| 1346 | floppy_mon_w(m_unit[unit].m_image, mtr); |
| 1347 | |
| 1348 | m_unit[unit].m_mtr = mtr; |
| 1531 | 1349 | } |
| 1532 | | else if (device->type() == C4040) |
| 1350 | } |
| 1351 | |
| 1352 | |
| 1353 | //------------------------------------------------- |
| 1354 | // micropolis_step_motor - |
| 1355 | //------------------------------------------------- |
| 1356 | |
| 1357 | inline void c2040_device::micropolis_step_motor(int unit, int stp) |
| 1358 | { |
| 1359 | if (!m_unit[unit].m_mtr && (m_unit[unit].m_stp != stp)) |
| 1533 | 1360 | { |
| 1534 | | region = device->subregion(C4040_REGION); |
| 1535 | | } |
| 1536 | | else if ((device->type() == C8050) || (device->type() == C8250)) |
| 1537 | | { |
| 1538 | | region = device->subregion(C8050_REGION); |
| 1539 | | } |
| 1540 | | else if (device->type() == SFD1001) |
| 1541 | | { |
| 1542 | | region = device->subregion(SFD1001_REGION); |
| 1543 | | } |
| 1361 | int tracks = 0; |
| 1544 | 1362 | |
| 1545 | | c2040->gcr = region->base() + region->bytes() - 0x800; |
| 1363 | switch (m_unit[unit].m_stp) |
| 1364 | { |
| 1365 | case 0: if (stp == 1) tracks++; else if (stp == 3) tracks--; break; |
| 1366 | case 1: if (stp == 2) tracks++; else if (stp == 0) tracks--; break; |
| 1367 | case 2: if (stp == 3) tracks++; else if (stp == 1) tracks--; break; |
| 1368 | case 3: if (stp == 0) tracks++; else if (stp == 2) tracks--; break; |
| 1369 | } |
| 1546 | 1370 | |
| 1547 | | /* allocate data timer */ |
| 1548 | | c2040->bit_timer = device->machine().scheduler().timer_alloc(FUNC(bit_tick), (void *)device); |
| 1371 | if (tracks != 0) |
| 1372 | { |
| 1373 | // step read/write head |
| 1374 | floppy_drive_seek(m_unit[unit].m_image, tracks); |
| 1549 | 1375 | |
| 1550 | | /* register for state saving */ |
| 1551 | | device->save_item(NAME(c2040->drive)); |
| 1552 | | device->save_item(NAME(c2040->side)); |
| 1553 | | device->save_item(NAME(c2040->address)); |
| 1554 | | device->save_item(NAME(c2040->rfdo)); |
| 1555 | | device->save_item(NAME(c2040->daco)); |
| 1556 | | device->save_item(NAME(c2040->atna)); |
| 1557 | | device->save_item(NAME(c2040->ds)); |
| 1558 | | device->save_item(NAME(c2040->bit_count)); |
| 1559 | | device->save_item(NAME(c2040->sr)); |
| 1560 | | device->save_item(NAME(c2040->pi)); |
| 1561 | | device->save_item(NAME(c2040->i)); |
| 1562 | | device->save_item(NAME(c2040->e)); |
| 1563 | | device->save_item(NAME(c2040->ready)); |
| 1564 | | device->save_item(NAME(c2040->mode)); |
| 1565 | | device->save_item(NAME(c2040->rw)); |
| 1566 | | device->save_item(NAME(c2040->miot_irq)); |
| 1567 | | device->save_item(NAME(c2040->unit[0].stp)); |
| 1568 | | device->save_item(NAME(c2040->unit[0].mtr)); |
| 1569 | | device->save_item(NAME(c2040->unit[0].track_len)); |
| 1570 | | device->save_item(NAME(c2040->unit[0].buffer_pos)); |
| 1571 | | device->save_item(NAME(c2040->unit[0].bit_pos)); |
| 1572 | | device->save_item(NAME(c2040->unit[1].stp)); |
| 1573 | | device->save_item(NAME(c2040->unit[1].mtr)); |
| 1574 | | device->save_item(NAME(c2040->unit[1].track_len)); |
| 1575 | | device->save_item(NAME(c2040->unit[1].buffer_pos)); |
| 1576 | | device->save_item(NAME(c2040->unit[1].bit_pos)); |
| 1376 | // read new track data |
| 1377 | read_current_track(unit); |
| 1378 | } |
| 1379 | |
| 1380 | m_unit[unit].m_stp = stp; |
| 1381 | } |
| 1577 | 1382 | } |
| 1578 | 1383 | |
| 1579 | | /*------------------------------------------------- |
| 1580 | | DEVICE_RESET( c2040 ) |
| 1581 | | -------------------------------------------------*/ |
| 1582 | 1384 | |
| 1583 | | static DEVICE_RESET( c2040 ) |
| 1385 | //------------------------------------------------- |
| 1386 | // mpi_step_motor - |
| 1387 | //------------------------------------------------- |
| 1388 | |
| 1389 | inline void c2040_device::mpi_step_motor(int unit, int stp) |
| 1584 | 1390 | { |
| 1585 | | c2040_t *c2040 = get_safe_token(device); |
| 1391 | if (!m_unit[unit].m_mtr && (m_unit[unit].m_stp != stp)) |
| 1392 | { |
| 1393 | int tracks = 0; |
| 1586 | 1394 | |
| 1587 | | /* reset devices */ |
| 1588 | | c2040->cpu_dos->reset(); |
| 1589 | | c2040->cpu_fdc->reset(); |
| 1590 | | c2040->riot0->reset(); |
| 1591 | | c2040->riot1->reset(); |
| 1592 | | c2040->miot->reset(); |
| 1593 | | c2040->via->reset(); |
| 1395 | switch (m_unit[unit].m_stp) |
| 1396 | { |
| 1397 | case 0: if (stp == 1) tracks++; else if (stp == 2) tracks--; break; |
| 1398 | case 1: if (stp == 3) tracks++; else if (stp == 0) tracks--; break; |
| 1399 | case 2: if (stp == 0) tracks++; else if (stp == 3) tracks--; break; |
| 1400 | case 3: if (stp == 2) tracks++; else if (stp == 1) tracks--; break; |
| 1401 | } |
| 1594 | 1402 | |
| 1595 | | /* toggle M6502 SO */ |
| 1596 | | device_set_input_line(c2040->cpu_dos, M6502_SET_OVERFLOW, ASSERT_LINE); |
| 1597 | | device_set_input_line(c2040->cpu_dos, M6502_SET_OVERFLOW, CLEAR_LINE); |
| 1403 | if (tracks != 0) |
| 1404 | { |
| 1405 | // step read/write head |
| 1406 | floppy_drive_seek(m_unit[unit].m_image, tracks); |
| 1598 | 1407 | |
| 1599 | | /* turn off spindle motors */ |
| 1600 | | c2040->unit[0].mtr = c2040->unit[1].mtr = 1; |
| 1408 | // read new track data |
| 1409 | read_current_track(unit); |
| 1410 | } |
| 1411 | |
| 1412 | m_unit[unit].m_stp = stp; |
| 1413 | } |
| 1601 | 1414 | } |
| 1602 | 1415 | |
| 1603 | | /*------------------------------------------------- |
| 1604 | | DEVICE_GET_INFO( c2040 ) |
| 1605 | | -------------------------------------------------*/ |
| 1606 | 1416 | |
| 1607 | | DEVICE_GET_INFO( c2040 ) |
| 1417 | //------------------------------------------------- |
| 1418 | // initialize - |
| 1419 | //------------------------------------------------- |
| 1420 | |
| 1421 | inline void c2040_device::initialize(int drives) |
| 1608 | 1422 | { |
| 1609 | | switch (state) |
| 1423 | // find GCR ROM |
| 1424 | m_gcr = subregion("gcr")->base(); |
| 1425 | |
| 1426 | // install image callbacks |
| 1427 | m_unit[0].m_image = m_image0; |
| 1428 | |
| 1429 | floppy_install_unload_proc(m_image0, c2040_device::on_disk0_change); |
| 1430 | floppy_install_load_proc(m_image0, c2040_device::on_disk0_change); |
| 1431 | |
| 1432 | if (drives == 2) |
| 1610 | 1433 | { |
| 1611 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 1612 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(c2040_t); break; |
| 1613 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(c2040_config); break; |
| 1434 | m_unit[1].m_image = m_image1; |
| 1614 | 1435 | |
| 1615 | | /* --- the following bits of info are returned as pointers --- */ |
| 1616 | | case DEVINFO_PTR_ROM_REGION: info->romregion = ROM_NAME(c2040); break; |
| 1617 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(c2040); break; |
| 1436 | floppy_install_unload_proc(m_image1, c2040_device::on_disk1_change); |
| 1437 | floppy_install_load_proc(m_image1, c2040_device::on_disk1_change); |
| 1438 | } |
| 1618 | 1439 | |
| 1619 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 1620 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(c2040); break; |
| 1621 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 1622 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(c2040); break; |
| 1440 | // register for state saving |
| 1441 | save_item(NAME(m_drive)); |
| 1442 | save_item(NAME(m_side)); |
| 1443 | save_item(NAME(m_rfdo)); |
| 1444 | save_item(NAME(m_daco)); |
| 1445 | save_item(NAME(m_atna)); |
| 1446 | save_item(NAME(m_ds)); |
| 1447 | save_item(NAME(m_bit_count)); |
| 1448 | save_item(NAME(m_sr)); |
| 1449 | save_item(NAME(m_pi)); |
| 1450 | save_item(NAME(m_i)); |
| 1451 | save_item(NAME(m_e)); |
| 1452 | save_item(NAME(m_ready)); |
| 1453 | save_item(NAME(m_mode)); |
| 1454 | save_item(NAME(m_rw)); |
| 1455 | save_item(NAME(m_miot_irq)); |
| 1456 | save_item(NAME(m_unit[0].m_stp)); |
| 1457 | save_item(NAME(m_unit[0].m_mtr)); |
| 1458 | save_item(NAME(m_unit[0].m_track_len)); |
| 1459 | save_item(NAME(m_unit[0].m_buffer_pos)); |
| 1460 | save_item(NAME(m_unit[0].m_bit_pos)); |
| 1623 | 1461 | |
| 1624 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1625 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore 2040"); break; |
| 1626 | | case DEVINFO_STR_SHORTNAME: strcpy(info->s, "c2040"); break; |
| 1627 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Commodore PET"); break; |
| 1628 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 1629 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 1630 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 1462 | if (drives == 2) |
| 1463 | { |
| 1464 | save_item(NAME(m_unit[1].m_stp)); |
| 1465 | save_item(NAME(m_unit[1].m_mtr)); |
| 1466 | save_item(NAME(m_unit[1].m_track_len)); |
| 1467 | save_item(NAME(m_unit[1].m_buffer_pos)); |
| 1468 | save_item(NAME(m_unit[1].m_bit_pos)); |
| 1631 | 1469 | } |
| 1632 | 1470 | } |
| 1633 | 1471 | |
| 1634 | | /*------------------------------------------------- |
| 1635 | | DEVICE_GET_INFO( c3040 ) |
| 1636 | | -------------------------------------------------*/ |
| 1637 | 1472 | |
| 1638 | | DEVICE_GET_INFO( c3040 ) |
| 1639 | | { |
| 1640 | | switch (state) |
| 1641 | | { |
| 1642 | | /* --- the following bits of info are returned as pointers --- */ |
| 1643 | | case DEVINFO_PTR_ROM_REGION: info->romregion = ROM_NAME(c2040); break; |
| 1644 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(c2040); break; |
| 1645 | 1473 | |
| 1646 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1647 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore 3040"); break; |
| 1648 | | case DEVINFO_STR_SHORTNAME: strcpy(info->s, "c3040"); break; |
| 1474 | //************************************************************************** |
| 1475 | // LIVE DEVICE |
| 1476 | //************************************************************************** |
| 1649 | 1477 | |
| 1650 | | default: DEVICE_GET_INFO_CALL(c2040); break; |
| 1478 | //------------------------------------------------- |
| 1479 | // c2040_device - constructor |
| 1480 | //------------------------------------------------- |
| 1481 | |
| 1482 | c2040_device::c2040_device(running_machine &_machine, const c2040_device_config &_config) |
| 1483 | : device_t(_machine, _config), |
| 1484 | device_ieee488_interface(_machine, _config, *this), |
| 1485 | m_maincpu(*this, M6502_TAG), |
| 1486 | m_fdccpu(*this, M6504_TAG), |
| 1487 | m_riot0(*this, M6532_0_TAG), |
| 1488 | m_riot1(*this, M6532_1_TAG), |
| 1489 | m_miot(*this, M6530_TAG), |
| 1490 | m_via(*this, M6522_TAG), |
| 1491 | m_image0(*this, FLOPPY_0), |
| 1492 | m_image1(*this, FLOPPY_1), |
| 1493 | m_bus(*this->owner(), IEEE488_TAG), |
| 1494 | m_drive(0), |
| 1495 | m_side(0), |
| 1496 | m_rfdo(1), |
| 1497 | m_daco(1), |
| 1498 | m_atna(1), |
| 1499 | m_ds(-1), |
| 1500 | m_bit_count(0), |
| 1501 | m_ready(0), |
| 1502 | m_mode(0), |
| 1503 | m_rw(0), |
| 1504 | m_miot_irq(CLEAR_LINE), |
| 1505 | m_bit_timer(timer_alloc()), |
| 1506 | m_config(_config) |
| 1507 | { |
| 1508 | for (int i = 0; i < 2; i++) |
| 1509 | { |
| 1510 | m_unit[i].m_stp = 0; |
| 1511 | m_unit[i].m_mtr = 1; |
| 1512 | m_unit[i].m_track_len = 0; |
| 1513 | m_unit[i].m_buffer_pos = 0; |
| 1514 | m_unit[i].m_bit_pos = 0; |
| 1651 | 1515 | } |
| 1652 | 1516 | } |
| 1653 | 1517 | |
| 1654 | | /*------------------------------------------------- |
| 1655 | | DEVICE_GET_INFO( c4040 ) |
| 1656 | | -------------------------------------------------*/ |
| 1657 | 1518 | |
| 1658 | | DEVICE_GET_INFO( c4040 ) |
| 1519 | //------------------------------------------------- |
| 1520 | // device_start - device-specific startup |
| 1521 | //------------------------------------------------- |
| 1522 | |
| 1523 | void c2040_device::device_start() |
| 1659 | 1524 | { |
| 1660 | | switch (state) |
| 1525 | address_space *main = m_maincpu->memory().space(AS_PROGRAM); |
| 1526 | address_space *fdc = m_fdccpu->memory().space(AS_PROGRAM); |
| 1527 | |
| 1528 | switch (m_config.m_variant) |
| 1661 | 1529 | { |
| 1662 | | /* --- the following bits of info are returned as pointers --- */ |
| 1663 | | case DEVINFO_PTR_ROM_REGION: info->romregion = ROM_NAME(c4040); break; |
| 1664 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(c4040); break; |
| 1530 | default: |
| 1531 | main->install_rom(0x5000, 0x7fff, subregion(M6502_TAG)->base()); |
| 1532 | fdc->install_rom(0x1c00, 0x1fff, subregion(M6504_TAG)->base()); |
| 1665 | 1533 | |
| 1666 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1667 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore 4040"); break; |
| 1668 | | case DEVINFO_STR_SHORTNAME: strcpy(info->s, "c4040"); break; |
| 1534 | initialize(2); |
| 1535 | break; |
| 1669 | 1536 | |
| 1670 | | default: DEVICE_GET_INFO_CALL(c3040); break; |
| 1537 | case c2040_device_config::TYPE_8050: |
| 1538 | case c2040_device_config::TYPE_8250: |
| 1539 | main->install_rom(0xc000, 0xffff, subregion(M6502_TAG)->base()); |
| 1540 | fdc->install_rom(0x1c00, 0x1fff, subregion(M6504_TAG)->base()); |
| 1541 | |
| 1542 | initialize(2); |
| 1543 | break; |
| 1544 | |
| 1545 | case c2040_device_config::TYPE_SFD1001: |
| 1546 | main->install_rom(0xc000, 0xffff, subregion(M6502_TAG)->base()); |
| 1547 | fdc->install_rom(0x1800, 0x1fff, subregion(M6504_TAG)->base()); |
| 1548 | |
| 1549 | initialize(1); |
| 1550 | break; |
| 1671 | 1551 | } |
| 1672 | 1552 | } |
| 1673 | 1553 | |
| 1674 | | /*------------------------------------------------- |
| 1675 | | DEVICE_GET_INFO( c8050 ) |
| 1676 | | -------------------------------------------------*/ |
| 1677 | 1554 | |
| 1678 | | DEVICE_GET_INFO( c8050 ) |
| 1555 | //------------------------------------------------- |
| 1556 | // device_reset - device-specific reset |
| 1557 | //------------------------------------------------- |
| 1558 | |
| 1559 | void c2040_device::device_reset() |
| 1679 | 1560 | { |
| 1680 | | switch (state) |
| 1561 | // toggle M6502 SO |
| 1562 | m_fdccpu->set_input_line(M6502_SET_OVERFLOW, ASSERT_LINE); |
| 1563 | m_fdccpu->set_input_line(M6502_SET_OVERFLOW, CLEAR_LINE); |
| 1564 | |
| 1565 | // turn off spindle motors |
| 1566 | m_unit[0].m_mtr = m_unit[1].m_mtr = 1; |
| 1567 | } |
| 1568 | |
| 1569 | |
| 1570 | //------------------------------------------------- |
| 1571 | // device_timer - handler timer events |
| 1572 | //------------------------------------------------- |
| 1573 | |
| 1574 | void c2040_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 1575 | { |
| 1576 | int ready = 1; |
| 1577 | |
| 1578 | // shift in data from the read head |
| 1579 | m_sr <<= 1; |
| 1580 | m_sr |= BIT(m_unit[m_drive].m_track_buffer[m_unit[m_drive].m_buffer_pos], m_unit[m_drive].m_bit_pos); |
| 1581 | |
| 1582 | // update GCR data |
| 1583 | update_gcr_data(); |
| 1584 | |
| 1585 | // update bit counters |
| 1586 | m_unit[m_drive].m_bit_pos--; |
| 1587 | m_bit_count++; |
| 1588 | |
| 1589 | if (m_unit[m_drive].m_bit_pos < 0) |
| 1681 | 1590 | { |
| 1682 | | /* --- the following bits of info are returned as pointers --- */ |
| 1683 | | case DEVINFO_PTR_ROM_REGION: info->romregion = ROM_NAME(c8050); break; |
| 1684 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(c8050); break; |
| 1591 | m_unit[m_drive].m_bit_pos = 7; |
| 1592 | m_unit[m_drive].m_buffer_pos++; |
| 1685 | 1593 | |
| 1686 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1687 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore 8050"); break; |
| 1688 | | case DEVINFO_STR_SHORTNAME: strcpy(info->s, "c8050"); break; |
| 1594 | if (m_unit[m_drive].m_buffer_pos >= m_unit[m_drive].m_track_len) |
| 1595 | { |
| 1596 | // loop to the start of the track |
| 1597 | m_unit[m_drive].m_buffer_pos = 0; |
| 1598 | } |
| 1599 | } |
| 1689 | 1600 | |
| 1690 | | default: DEVICE_GET_INFO_CALL(c2040); break; |
| 1601 | if (!SYNC) |
| 1602 | { |
| 1603 | // SYNC detected |
| 1604 | m_bit_count = 0; |
| 1691 | 1605 | } |
| 1692 | | } |
| 1693 | 1606 | |
| 1694 | | /*------------------------------------------------- |
| 1695 | | DEVICE_GET_INFO( c8250 ) |
| 1696 | | -------------------------------------------------*/ |
| 1607 | if (m_bit_count == 10) |
| 1608 | { |
| 1609 | // byte ready |
| 1610 | m_bit_count = 0; |
| 1611 | ready = 0; |
| 1612 | } |
| 1697 | 1613 | |
| 1698 | | DEVICE_GET_INFO( c8250 ) |
| 1699 | | { |
| 1700 | | switch (state) |
| 1614 | if (m_ready != ready) |
| 1701 | 1615 | { |
| 1702 | | /* --- the following bits of info are returned as pointers --- */ |
| 1703 | | case DEVINFO_PTR_ROM_REGION: info->romregion = ROM_NAME(c8050); break; |
| 1704 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(c8250); break; |
| 1616 | // set byte ready flag |
| 1617 | m_ready = ready; |
| 1705 | 1618 | |
| 1706 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1707 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore 8250"); break; |
| 1708 | | case DEVINFO_STR_SHORTNAME: strcpy(info->s, "c8250"); break; |
| 1619 | m_via->write_ca1(ready); |
| 1620 | m_via->write_cb1(ERROR); |
| 1709 | 1621 | |
| 1710 | | default: DEVICE_GET_INFO_CALL(c2040); break; |
| 1622 | if ((m_config.m_variant == c2040_device_config::TYPE_8050) || |
| 1623 | (m_config.m_variant == c2040_device_config::TYPE_8250) || |
| 1624 | (m_config.m_variant == c2040_device_config::TYPE_SFD1001)) |
| 1625 | { |
| 1626 | m_fdccpu->set_input_line(M6502_SET_OVERFLOW, ready ? CLEAR_LINE : ASSERT_LINE); |
| 1627 | } |
| 1711 | 1628 | } |
| 1712 | 1629 | } |
| 1713 | 1630 | |
| 1714 | | /*------------------------------------------------- |
| 1715 | | DEVICE_GET_INFO( sfd1001 ) |
| 1716 | | -------------------------------------------------*/ |
| 1717 | 1631 | |
| 1718 | | DEVICE_GET_INFO( sfd1001 ) |
| 1632 | //------------------------------------------------- |
| 1633 | // ieee488_atn - |
| 1634 | //------------------------------------------------- |
| 1635 | |
| 1636 | void c2040_device::ieee488_atn(int state) |
| 1719 | 1637 | { |
| 1720 | | switch (state) |
| 1721 | | { |
| 1722 | | /* --- the following bits of info are returned as pointers --- */ |
| 1723 | | case DEVINFO_PTR_ROM_REGION: info->romregion = ROM_NAME(sfd1001); break; |
| 1724 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(sfd1001); break; |
| 1638 | update_ieee_signals(); |
| 1725 | 1639 | |
| 1726 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1727 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore SFD-1001"); break; |
| 1728 | | case DEVINFO_STR_SHORTNAME: strcpy(info->s, "sfd1001"); break; |
| 1640 | // set RIOT PA7 |
| 1641 | riot6532_porta_in_set(m_riot1, !state << 7, 0x80); |
| 1642 | } |
| 1729 | 1643 | |
| 1730 | | default: DEVICE_GET_INFO_CALL(c2040); break; |
| 1644 | |
| 1645 | //------------------------------------------------- |
| 1646 | // ieee488_ifc - |
| 1647 | //------------------------------------------------- |
| 1648 | |
| 1649 | void c2040_device::ieee488_ifc(int state) |
| 1650 | { |
| 1651 | if (!state) |
| 1652 | { |
| 1653 | device_reset(); |
| 1731 | 1654 | } |
| 1732 | 1655 | } |
| 1733 | 1656 | |
| 1734 | | DEFINE_LEGACY_DEVICE(C2040, c2040); |
| 1735 | | DEFINE_LEGACY_DEVICE(C3040, c3040); |
| 1736 | | DEFINE_LEGACY_DEVICE(C4040, c4040); |
| 1737 | | DEFINE_LEGACY_DEVICE(C8050, c8050); |
| 1738 | | DEFINE_LEGACY_DEVICE(C8250, c8250); |
| 1739 | | DEFINE_LEGACY_DEVICE(SFD1001, sfd1001); |
| 1657 | |
| 1658 | //------------------------------------------------- |
| 1659 | // on_disk0_change - |
| 1660 | //------------------------------------------------- |
| 1661 | |
| 1662 | void c2040_device::on_disk0_change(device_image_interface &image) |
| 1663 | { |
| 1664 | c2040_device *c2040 = static_cast<c2040_device *>(image.device().owner()); |
| 1665 | |
| 1666 | c2040->read_current_track(0); |
| 1667 | } |
| 1668 | |
| 1669 | |
| 1670 | //------------------------------------------------- |
| 1671 | // on_disk_change - |
| 1672 | //------------------------------------------------- |
| 1673 | |
| 1674 | void c2040_device::on_disk1_change(device_image_interface &image) |
| 1675 | { |
| 1676 | c2040_device *c2040 = static_cast<c2040_device *>(image.device().owner()); |
| 1677 | |
| 1678 | c2040->read_current_track(1); |
| 1679 | } |
src/mess/machine/ieee488.c
| r11262 | r11263 | |
| 8 | 8 | |
| 9 | 9 | **********************************************************************/ |
| 10 | 10 | |
| 11 | | #include "emu.h" |
| 12 | 11 | #include "ieee488.h" |
| 12 | #include "machine/devhelpr.h" |
| 13 | 13 | |
| 14 | | /*************************************************************************** |
| 15 | | PARAMETERS |
| 16 | | ***************************************************************************/ |
| 17 | 14 | |
| 18 | | #define LOG 0 |
| 19 | 15 | |
| 20 | | enum |
| 21 | | { |
| 22 | | EOI = 0, |
| 23 | | DAV, |
| 24 | | NRFD, |
| 25 | | NDAC, |
| 26 | | IFC, |
| 27 | | SRQ, |
| 28 | | ATN, |
| 29 | | REN, |
| 30 | | SIGNAL_COUNT |
| 31 | | }; |
| 16 | //************************************************************************** |
| 17 | // MACROS / CONSTANTS |
| 18 | //************************************************************************** |
| 32 | 19 | |
| 20 | #define LOG 1 |
| 21 | |
| 22 | |
| 33 | 23 | static const char *const SIGNAL_NAME[] = { "EOI", "DAV", "NRFD", "NDAC", "IFC", "SRQ", "ATN", "REN" }; |
| 34 | 24 | |
| 35 | | /*************************************************************************** |
| 36 | | TYPE DEFINITIONS |
| 37 | | ***************************************************************************/ |
| 38 | 25 | |
| 39 | | typedef struct _ieee488_daisy_state ieee488_daisy_state; |
| 40 | | struct _ieee488_daisy_state |
| 26 | |
| 27 | //************************************************************************** |
| 28 | // DEVICE DEFINITIONS |
| 29 | //************************************************************************** |
| 30 | |
| 31 | const device_type IEEE488 = ieee488_device_config::static_alloc_device_config; |
| 32 | |
| 33 | |
| 34 | |
| 35 | //************************************************************************** |
| 36 | // DEVICE CONFIGURATION INTERFACE |
| 37 | //************************************************************************** |
| 38 | |
| 39 | //------------------------------------------------- |
| 40 | // device_config_ieee488_interface - constructor |
| 41 | //------------------------------------------------- |
| 42 | |
| 43 | device_config_ieee488_interface::device_config_ieee488_interface(const machine_config &mconfig, device_config &devconfig) |
| 44 | : device_config_interface(mconfig, devconfig) |
| 41 | 45 | { |
| 42 | | ieee488_daisy_state *next; /* next device */ |
| 43 | | device_t *device; /* associated device */ |
| 46 | } |
| 44 | 47 | |
| 45 | | int line[SIGNAL_COUNT]; /* control lines' state */ |
| 46 | | UINT8 dio; /* data lines' state */ |
| 47 | 48 | |
| 48 | | devcb_resolved_write_line out_line_func[SIGNAL_COUNT]; |
| 49 | | }; |
| 49 | //------------------------------------------------- |
| 50 | // ~device_config_ieee488_interface - destructor |
| 51 | //------------------------------------------------- |
| 50 | 52 | |
| 51 | | typedef struct _ieee488_t ieee488_t; |
| 52 | | struct _ieee488_t |
| 53 | device_config_ieee488_interface::~device_config_ieee488_interface() |
| 53 | 54 | { |
| 54 | | ieee488_daisy_state *daisy_state; |
| 55 | | }; |
| 55 | } |
| 56 | 56 | |
| 57 | | /*************************************************************************** |
| 58 | | INLINE FUNCTIONS |
| 59 | | ***************************************************************************/ |
| 60 | 57 | |
| 61 | | INLINE ieee488_t *get_safe_token(device_t *device) |
| 58 | |
| 59 | //************************************************************************** |
| 60 | // DEVICE INTERFACE |
| 61 | //************************************************************************** |
| 62 | |
| 63 | //------------------------------------------------- |
| 64 | // device_ieee488_interface - constructor |
| 65 | //------------------------------------------------- |
| 66 | |
| 67 | device_ieee488_interface::device_ieee488_interface(running_machine &machine, const device_config &config, device_t &device) |
| 68 | : device_interface(machine, config, device), |
| 69 | m_ieee488_config(dynamic_cast<const device_config_ieee488_interface &>(config)) |
| 62 | 70 | { |
| 63 | | assert(device != NULL); |
| 64 | | assert(device->type() == IEEE488); |
| 65 | | return (ieee488_t *)downcast<legacy_device_base *>(device)->token(); |
| 66 | 71 | } |
| 67 | 72 | |
| 68 | | INLINE const ieee488_daisy_chain *get_interface(device_t *device) |
| 73 | |
| 74 | //------------------------------------------------- |
| 75 | // ~device_ieee488_interface - destructor |
| 76 | //------------------------------------------------- |
| 77 | |
| 78 | device_ieee488_interface::~device_ieee488_interface() |
| 69 | 79 | { |
| 70 | | assert(device != NULL); |
| 71 | | assert(device->type() == IEEE488); |
| 72 | | return (const ieee488_daisy_chain *) device->baseconfig().static_config(); |
| 73 | 80 | } |
| 74 | 81 | |
| 75 | | INLINE int get_signal(device_t *bus, int line) |
| 82 | |
| 83 | |
| 84 | //************************************************************************** |
| 85 | // DEVICE CONFIGURATION |
| 86 | //************************************************************************** |
| 87 | |
| 88 | GENERIC_DEVICE_CONFIG_SETUP(ieee488, "IEEE488") |
| 89 | |
| 90 | |
| 91 | //------------------------------------------------- |
| 92 | // device_config_complete - perform any |
| 93 | // operations now that the configuration is |
| 94 | // complete |
| 95 | //------------------------------------------------- |
| 96 | |
| 97 | void ieee488_device_config::device_config_complete() |
| 76 | 98 | { |
| 77 | | ieee488_t *ieee488 = get_safe_token(bus); |
| 78 | | ieee488_daisy_state *daisy = ieee488->daisy_state; |
| 79 | | int state = 1; |
| 99 | // inherit a copy of the static data |
| 100 | const ieee488_config *intf = reinterpret_cast<const ieee488_config *>(static_config()); |
| 101 | if (intf != NULL) |
| 102 | *static_cast<ieee488_config *>(this) = *intf; |
| 80 | 103 | |
| 81 | | for ( ; daisy != NULL; daisy = daisy->next) |
| 104 | // or initialize to defaults if none provided |
| 105 | else |
| 82 | 106 | { |
| 83 | | state &= daisy->line[line]; |
| 107 | fatalerror("Daisy chain not provided!"); |
| 84 | 108 | } |
| 85 | 109 | |
| 86 | | return state; |
| 110 | m_daisy = intf; |
| 87 | 111 | } |
| 88 | 112 | |
| 89 | | INLINE int get_data(device_t *bus) |
| 113 | |
| 114 | |
| 115 | //************************************************************************** |
| 116 | // INLINE HELPERS |
| 117 | //************************************************************************** |
| 118 | |
| 119 | //------------------------------------------------- |
| 120 | // set_signal - |
| 121 | //------------------------------------------------- |
| 122 | |
| 123 | inline void ieee488_device::set_signal(device_t *device, int signal, int state) |
| 90 | 124 | { |
| 91 | | ieee488_t *ieee488 = get_safe_token(bus); |
| 92 | | ieee488_daisy_state *daisy = ieee488->daisy_state; |
| 93 | | UINT8 data = 0xff; |
| 125 | bool changed = false; |
| 94 | 126 | |
| 95 | | for ( ; daisy != NULL; daisy = daisy->next) |
| 127 | for (daisy_entry *daisy = m_daisy_list; daisy != NULL; daisy = daisy->m_next) |
| 96 | 128 | { |
| 97 | | data &= daisy->dio; |
| 129 | if (!strcmp(daisy->m_device->tag(), device->tag())) |
| 130 | { |
| 131 | if (daisy->m_line[signal] != state) |
| 132 | { |
| 133 | if (LOG) logerror("IEEE488: '%s' %s %u\n", device->tag(), SIGNAL_NAME[signal], state); |
| 134 | daisy->m_line[signal] = state; |
| 135 | changed = true; |
| 136 | } |
| 137 | } |
| 98 | 138 | } |
| 99 | 139 | |
| 100 | | return data; |
| 140 | if (changed) |
| 141 | { |
| 142 | for (daisy_entry *daisy = m_daisy_list; daisy != NULL; daisy = daisy->m_next) |
| 143 | { |
| 144 | switch (signal) |
| 145 | { |
| 146 | case EOI: |
| 147 | daisy->m_interface->ieee488_eoi(state); |
| 148 | break; |
| 149 | |
| 150 | case DAV: |
| 151 | daisy->m_interface->ieee488_dav(state); |
| 152 | break; |
| 153 | |
| 154 | case NRFD: |
| 155 | daisy->m_interface->ieee488_nrfd(state); |
| 156 | break; |
| 157 | |
| 158 | case NDAC: |
| 159 | daisy->m_interface->ieee488_ndac(state); |
| 160 | break; |
| 161 | |
| 162 | case IFC: |
| 163 | daisy->m_interface->ieee488_ifc(state); |
| 164 | break; |
| 165 | |
| 166 | case SRQ: |
| 167 | daisy->m_interface->ieee488_srq(state); |
| 168 | break; |
| 169 | |
| 170 | case ATN: |
| 171 | daisy->m_interface->ieee488_atn(state); |
| 172 | break; |
| 173 | |
| 174 | case REN: |
| 175 | daisy->m_interface->ieee488_ren(state); |
| 176 | break; |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | if (LOG) logerror("IEEE-488: EOI %u DAV %u NRFD %u NDAC %u IFC %u SRQ %u ATN %u REN %u DIO %02x\n", |
| 181 | get_signal(EOI), get_signal(DAV), get_signal(NRFD), get_signal(NDAC), |
| 182 | get_signal(IFC), get_signal(SRQ), get_signal(ATN), get_signal(REN), get_data()); |
| 183 | } |
| 101 | 184 | } |
| 102 | 185 | |
| 103 | | INLINE void set_signal(device_t *bus, device_t *device, int line, int state) |
| 186 | |
| 187 | //------------------------------------------------- |
| 188 | // get_signal - |
| 189 | //------------------------------------------------- |
| 190 | |
| 191 | inline int ieee488_device::get_signal(int signal) |
| 104 | 192 | { |
| 105 | | ieee488_t *ieee488 = get_safe_token(bus); |
| 106 | | ieee488_daisy_state *daisy = ieee488->daisy_state; |
| 107 | | int new_state = 1; |
| 193 | int state = 1; |
| 108 | 194 | |
| 109 | | for ( ; daisy != NULL; daisy = daisy->next) |
| 195 | for (daisy_entry *daisy = m_daisy_list; daisy != NULL; daisy = daisy->m_next) |
| 110 | 196 | { |
| 111 | | if (!strcmp(daisy->device->tag(), device->tag())) |
| 197 | if (!daisy->m_line[signal]) |
| 112 | 198 | { |
| 113 | | if (daisy->line[line] != state) |
| 199 | state = 0; |
| 200 | break; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | return state; |
| 205 | } |
| 206 | |
| 207 | |
| 208 | //------------------------------------------------- |
| 209 | // set_data - |
| 210 | //------------------------------------------------- |
| 211 | |
| 212 | inline void ieee488_device::set_data(device_t *device, UINT8 data) |
| 213 | { |
| 214 | for (daisy_entry *daisy = m_daisy_list; daisy != NULL; daisy = daisy->m_next) |
| 215 | { |
| 216 | if (!strcmp(daisy->m_device->tag(), device->tag())) |
| 217 | { |
| 218 | if (daisy->m_dio != data) |
| 114 | 219 | { |
| 115 | | if (LOG) logerror("IEEE-488: '%s' %s %u\n", device->tag(), SIGNAL_NAME[line], state); |
| 116 | | daisy->line[line] = state; |
| 220 | if (LOG) logerror("IEEE488: '%s' DIO %02x\n", device->tag(), data); |
| 221 | daisy->m_dio = data; |
| 117 | 222 | } |
| 118 | | break; |
| 119 | 223 | } |
| 120 | 224 | } |
| 225 | } |
| 121 | 226 | |
| 122 | | new_state = get_signal(bus, line); |
| 123 | | daisy = ieee488->daisy_state; |
| 124 | 227 | |
| 125 | | for ( ; daisy != NULL; daisy = daisy->next) |
| 228 | //------------------------------------------------- |
| 229 | // get_data - |
| 230 | //------------------------------------------------- |
| 231 | |
| 232 | inline UINT8 ieee488_device::get_data() |
| 233 | { |
| 234 | UINT8 data = 0xff; |
| 235 | |
| 236 | for (daisy_entry *daisy = m_daisy_list; daisy != NULL; daisy = daisy->m_next) |
| 126 | 237 | { |
| 127 | | devcb_call_write_line(&daisy->out_line_func[line], new_state); |
| 238 | data &= daisy->m_dio; |
| 128 | 239 | } |
| 129 | 240 | |
| 130 | | if (LOG) logerror("IEEE-488: EOI %u DAV %u NRFD %u NDAC %u IFC %u SRQ %u ATN %u REN %u DIO %02x\n", |
| 131 | | get_signal(bus, EOI), get_signal(bus, DAV), get_signal(bus, NRFD), get_signal(bus, NDAC), |
| 132 | | get_signal(bus, IFC), get_signal(bus, SRQ), get_signal(bus, ATN), get_signal(bus, REN), get_data(bus)); |
| 241 | return data; |
| 133 | 242 | } |
| 134 | 243 | |
| 135 | | INLINE void set_data(device_t *bus, device_t *device, UINT8 data) |
| 244 | |
| 245 | |
| 246 | //************************************************************************** |
| 247 | // LIVE DEVICE |
| 248 | //************************************************************************** |
| 249 | |
| 250 | //------------------------------------------------- |
| 251 | // ieee488_device - constructor |
| 252 | //------------------------------------------------- |
| 253 | |
| 254 | ieee488_device::ieee488_device(running_machine &_machine, const ieee488_device_config &_config) |
| 255 | : device_t(_machine, _config), |
| 256 | m_stub(*this->owner(), IEEE488_STUB_TAG), |
| 257 | m_config(_config) |
| 136 | 258 | { |
| 137 | | ieee488_t *ieee488 = get_safe_token(bus); |
| 138 | | ieee488_daisy_state *daisy = ieee488->daisy_state; |
| 259 | } |
| 139 | 260 | |
| 140 | | for ( ; daisy != NULL; daisy = daisy->next) |
| 261 | |
| 262 | //------------------------------------------------- |
| 263 | // device_start - device-specific startup |
| 264 | //------------------------------------------------- |
| 265 | |
| 266 | void ieee488_device::device_start() |
| 267 | { |
| 268 | const ieee488_config *daisy = m_config.m_daisy; |
| 269 | |
| 270 | // create a linked list of devices |
| 271 | daisy_entry **tailptr = &m_daisy_list; |
| 272 | for ( ; daisy->m_tag != NULL; daisy++) |
| 141 | 273 | { |
| 142 | | if (!strcmp(daisy->device->tag(), device->tag())) |
| 143 | | { |
| 144 | | if (LOG) logerror("IEEE-488: '%s' DIO %02x\n", device->tag(), data); |
| 145 | | daisy->dio = data; |
| 146 | | break; |
| 147 | | } |
| 274 | // find the device |
| 275 | device_t *target = machine().device(daisy->m_tag); |
| 276 | if (target == NULL) |
| 277 | fatalerror("Unable to locate device '%s'", daisy->m_tag); |
| 278 | |
| 279 | // make sure it has an interface |
| 280 | device_ieee488_interface *intf; |
| 281 | if (!target->interface(intf)) |
| 282 | fatalerror("Device '%s' does not implement the CBM IEC interface!", daisy->m_tag); |
| 283 | |
| 284 | // append to the end |
| 285 | *tailptr = auto_alloc(machine(), daisy_entry(target)); |
| 286 | tailptr = &(*tailptr)->m_next; |
| 148 | 287 | } |
| 149 | 288 | |
| 150 | | if (LOG) logerror("IEEE-488: EOI %u DAV %u NRFD %u NDAC %u IFC %u SRQ %u ATN %u REN %u DIO %02x\n", |
| 151 | | get_signal(bus, EOI), get_signal(bus, DAV), get_signal(bus, NRFD), get_signal(bus, NDAC), |
| 152 | | get_signal(bus, IFC), get_signal(bus, SRQ), get_signal(bus, ATN), get_signal(bus, REN), get_data(bus)); |
| 289 | // append driver stub to the end |
| 290 | device_t *target = machine().device(IEEE488_STUB_TAG); |
| 291 | *tailptr = auto_alloc(machine(), daisy_entry(target)); |
| 292 | tailptr = &(*tailptr)->m_next; |
| 153 | 293 | } |
| 154 | 294 | |
| 155 | | /*************************************************************************** |
| 156 | | IMPLEMENTATION |
| 157 | | ***************************************************************************/ |
| 158 | 295 | |
| 159 | | void ieee488_eoi_w(device_t *bus, device_t *device, int state) |
| 296 | //------------------------------------------------- |
| 297 | // daisy_entry - constructor |
| 298 | //------------------------------------------------- |
| 299 | |
| 300 | ieee488_device::daisy_entry::daisy_entry(device_t *device) |
| 301 | : m_next(NULL), |
| 302 | m_device(device), |
| 303 | m_interface(NULL), |
| 304 | m_dio(0xff) |
| 160 | 305 | { |
| 161 | | set_signal(bus, device, EOI, state); |
| 306 | for (int i = 0; i < SIGNAL_COUNT; i++) |
| 307 | { |
| 308 | m_line[i] = 1; |
| 309 | } |
| 310 | |
| 311 | device->interface(m_interface); |
| 162 | 312 | } |
| 163 | 313 | |
| 164 | | READ_LINE_DEVICE_HANDLER( ieee488_eoi_r ) |
| 314 | |
| 315 | //------------------------------------------------- |
| 316 | // dio_r - |
| 317 | //------------------------------------------------- |
| 318 | |
| 319 | UINT8 ieee488_device::dio_r() |
| 165 | 320 | { |
| 166 | | return get_signal(device, EOI); |
| 321 | return get_data(); |
| 167 | 322 | } |
| 168 | 323 | |
| 169 | | void ieee488_dav_w(device_t *bus, device_t *device, int state) |
| 324 | |
| 325 | //------------------------------------------------- |
| 326 | // dio_r - |
| 327 | //------------------------------------------------- |
| 328 | |
| 329 | READ8_MEMBER( ieee488_device::dio_r ) |
| 170 | 330 | { |
| 171 | | set_signal(bus, device, DAV, state); |
| 331 | return get_data(); |
| 172 | 332 | } |
| 173 | 333 | |
| 174 | | READ_LINE_DEVICE_HANDLER( ieee488_dav_r ) |
| 334 | |
| 335 | //------------------------------------------------- |
| 336 | // eoi_r - |
| 337 | //------------------------------------------------- |
| 338 | |
| 339 | READ_LINE_MEMBER( ieee488_device::eoi_r ) |
| 175 | 340 | { |
| 176 | | return get_signal(device, DAV); |
| 341 | return get_signal(EOI); |
| 177 | 342 | } |
| 178 | 343 | |
| 179 | | void ieee488_nrfd_w(device_t *bus, device_t *device, int state) |
| 344 | |
| 345 | //------------------------------------------------- |
| 346 | // dav_r - |
| 347 | //------------------------------------------------- |
| 348 | |
| 349 | READ_LINE_MEMBER( ieee488_device::dav_r ) |
| 180 | 350 | { |
| 181 | | set_signal(bus, device, NRFD, state); |
| 351 | return get_signal(DAV); |
| 182 | 352 | } |
| 183 | 353 | |
| 184 | | READ_LINE_DEVICE_HANDLER( ieee488_nrfd_r ) |
| 354 | |
| 355 | //------------------------------------------------- |
| 356 | // nrfd_r - |
| 357 | //------------------------------------------------- |
| 358 | |
| 359 | READ_LINE_MEMBER( ieee488_device::nrfd_r ) |
| 185 | 360 | { |
| 186 | | return get_signal(device, NRFD); |
| 361 | return get_signal(NRFD); |
| 187 | 362 | } |
| 188 | 363 | |
| 189 | | void ieee488_ndac_w(device_t *bus, device_t *device, int state) |
| 364 | |
| 365 | //------------------------------------------------- |
| 366 | // ndac_r - |
| 367 | //------------------------------------------------- |
| 368 | |
| 369 | READ_LINE_MEMBER( ieee488_device::ndac_r ) |
| 190 | 370 | { |
| 191 | | set_signal(bus, device, NDAC, state); |
| 371 | return get_signal(NDAC); |
| 192 | 372 | } |
| 193 | 373 | |
| 194 | | READ_LINE_DEVICE_HANDLER( ieee488_ndac_r ) |
| 374 | |
| 375 | //------------------------------------------------- |
| 376 | // ifc_r - |
| 377 | //------------------------------------------------- |
| 378 | |
| 379 | READ_LINE_MEMBER( ieee488_device::ifc_r ) |
| 195 | 380 | { |
| 196 | | return get_signal(device, NDAC); |
| 381 | return get_signal(IFC); |
| 197 | 382 | } |
| 198 | 383 | |
| 199 | | void ieee488_ifc_w(device_t *bus, device_t *device, int state) |
| 384 | |
| 385 | //------------------------------------------------- |
| 386 | // srq_r - |
| 387 | //------------------------------------------------- |
| 388 | |
| 389 | READ_LINE_MEMBER( ieee488_device::srq_r ) |
| 200 | 390 | { |
| 201 | | set_signal(bus, device, IFC, state); |
| 391 | return get_signal(SRQ); |
| 202 | 392 | } |
| 203 | 393 | |
| 204 | | READ_LINE_DEVICE_HANDLER( ieee488_ifc_r ) |
| 394 | |
| 395 | //------------------------------------------------- |
| 396 | // atn_r - |
| 397 | //------------------------------------------------- |
| 398 | |
| 399 | READ_LINE_MEMBER( ieee488_device::atn_r ) |
| 205 | 400 | { |
| 206 | | return get_signal(device, IFC); |
| 401 | return get_signal(ATN); |
| 207 | 402 | } |
| 208 | 403 | |
| 209 | | void ieee488_srq_w(device_t *bus, device_t *device, int state) |
| 404 | |
| 405 | //------------------------------------------------- |
| 406 | // ren_r - |
| 407 | //------------------------------------------------- |
| 408 | |
| 409 | READ_LINE_MEMBER( ieee488_device::ren_r ) |
| 210 | 410 | { |
| 211 | | set_signal(bus, device, SRQ, state); |
| 411 | return get_signal(REN); |
| 212 | 412 | } |
| 213 | 413 | |
| 214 | | READ_LINE_DEVICE_HANDLER( ieee488_srq_r ) |
| 414 | |
| 415 | //------------------------------------------------- |
| 416 | // dio_w - |
| 417 | //------------------------------------------------- |
| 418 | |
| 419 | void ieee488_device::dio_w(UINT8 data) |
| 215 | 420 | { |
| 216 | | return get_signal(device, SRQ); |
| 421 | return set_data(m_stub, data); |
| 217 | 422 | } |
| 218 | 423 | |
| 219 | | void ieee488_atn_w(device_t *bus, device_t *device, int state) |
| 424 | |
| 425 | //------------------------------------------------- |
| 426 | // dio_w - |
| 427 | //------------------------------------------------- |
| 428 | |
| 429 | WRITE8_MEMBER( ieee488_device::dio_w ) |
| 220 | 430 | { |
| 221 | | set_signal(bus, device, ATN, state); |
| 431 | return set_data(m_stub, data); |
| 222 | 432 | } |
| 223 | 433 | |
| 224 | | READ_LINE_DEVICE_HANDLER( ieee488_atn_r ) |
| 434 | |
| 435 | //------------------------------------------------- |
| 436 | // eoi_w - |
| 437 | //------------------------------------------------- |
| 438 | |
| 439 | WRITE_LINE_MEMBER( ieee488_device::eoi_w ) |
| 225 | 440 | { |
| 226 | | return get_signal(device, ATN); |
| 441 | set_signal(m_stub, EOI, state); |
| 227 | 442 | } |
| 228 | 443 | |
| 229 | | void ieee488_ren_w(device_t *bus, device_t *device, int state) |
| 444 | |
| 445 | //------------------------------------------------- |
| 446 | // dav_w - |
| 447 | //------------------------------------------------- |
| 448 | |
| 449 | WRITE_LINE_MEMBER( ieee488_device::dav_w ) |
| 230 | 450 | { |
| 231 | | set_signal(bus, device, REN, state); |
| 451 | set_signal(m_stub, DAV, state); |
| 232 | 452 | } |
| 233 | 453 | |
| 234 | | READ_LINE_DEVICE_HANDLER( ieee488_ren_r ) |
| 454 | |
| 455 | //------------------------------------------------- |
| 456 | // nrfd_w - |
| 457 | //------------------------------------------------- |
| 458 | |
| 459 | WRITE_LINE_MEMBER( ieee488_device::nrfd_w ) |
| 235 | 460 | { |
| 236 | | return get_signal(device, REN); |
| 461 | set_signal(m_stub, NRFD, state); |
| 237 | 462 | } |
| 238 | 463 | |
| 239 | | READ8_DEVICE_HANDLER( ieee488_dio_r ) |
| 464 | |
| 465 | //------------------------------------------------- |
| 466 | // ndac_w - |
| 467 | //------------------------------------------------- |
| 468 | |
| 469 | WRITE_LINE_MEMBER( ieee488_device::ndac_w ) |
| 240 | 470 | { |
| 241 | | return get_data(device); |
| 471 | set_signal(m_stub, NDAC, state); |
| 242 | 472 | } |
| 243 | 473 | |
| 244 | | void ieee488_dio_w(device_t *bus, device_t *device, UINT8 data) |
| 474 | |
| 475 | //------------------------------------------------- |
| 476 | // ifc_w - |
| 477 | //------------------------------------------------- |
| 478 | |
| 479 | WRITE_LINE_MEMBER( ieee488_device::ifc_w ) |
| 245 | 480 | { |
| 246 | | set_data(bus, device, data); |
| 481 | set_signal(m_stub, IFC, state); |
| 247 | 482 | } |
| 248 | 483 | |
| 249 | | /*------------------------------------------------- |
| 250 | | DEVICE_START( ieee488 ) |
| 251 | | -------------------------------------------------*/ |
| 252 | 484 | |
| 253 | | static DEVICE_START( ieee488 ) |
| 485 | //------------------------------------------------- |
| 486 | // srq_w - |
| 487 | //------------------------------------------------- |
| 488 | |
| 489 | WRITE_LINE_MEMBER( ieee488_device::srq_w ) |
| 254 | 490 | { |
| 255 | | ieee488_t *ieee488 = get_safe_token(device); |
| 256 | | const ieee488_daisy_chain *daisy = get_interface(device); |
| 257 | | int i; |
| 491 | set_signal(m_stub, SRQ, state); |
| 492 | } |
| 258 | 493 | |
| 259 | | ieee488_daisy_state *head = NULL; |
| 260 | | ieee488_daisy_state **tailptr = &head; |
| 261 | 494 | |
| 262 | | /* create a linked list of devices */ |
| 263 | | for ( ; daisy->tag != NULL; daisy++) |
| 264 | | { |
| 265 | | *tailptr = auto_alloc(device->machine(), ieee488_daisy_state); |
| 495 | //------------------------------------------------- |
| 496 | // atn_w - |
| 497 | //------------------------------------------------- |
| 266 | 498 | |
| 267 | | /* find device */ |
| 268 | | (*tailptr)->next = NULL; |
| 269 | | (*tailptr)->device = device->machine().device(daisy->tag); |
| 499 | WRITE_LINE_MEMBER( ieee488_device::atn_w ) |
| 500 | { |
| 501 | set_signal(m_stub, ATN, state); |
| 502 | } |
| 270 | 503 | |
| 271 | | if ((*tailptr)->device == NULL) |
| 272 | | { |
| 273 | | fatalerror("Unable to locate device '%s'", daisy->tag); |
| 274 | | } |
| 275 | 504 | |
| 276 | | /* set control lines to 'false' state */ |
| 277 | | for (i = EOI; i < SIGNAL_COUNT; i++) |
| 278 | | { |
| 279 | | (*tailptr)->line[i] = 1; |
| 280 | | } |
| 505 | //------------------------------------------------- |
| 506 | // ren_w - |
| 507 | //------------------------------------------------- |
| 281 | 508 | |
| 282 | | /* set data lines to 'false' state */ |
| 283 | | (*tailptr)->dio = 0xff; |
| 509 | WRITE_LINE_MEMBER( ieee488_device::ren_w ) |
| 510 | { |
| 511 | set_signal(m_stub, REN, state); |
| 512 | } |
| 284 | 513 | |
| 285 | | /* resolve callbacks */ |
| 286 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[EOI], &daisy->out_eoi_func, device); |
| 287 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[DAV], &daisy->out_dav_func, device); |
| 288 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[NRFD], &daisy->out_nrfd_func, device); |
| 289 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[NDAC], &daisy->out_ndac_func, device); |
| 290 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[IFC], &daisy->out_ifc_func, device); |
| 291 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[SRQ], &daisy->out_srq_func, device); |
| 292 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[ATN], &daisy->out_atn_func, device); |
| 293 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[REN], &daisy->out_ren_func, device); |
| 294 | 514 | |
| 295 | | tailptr = &(*tailptr)->next; |
| 296 | | } |
| 515 | //------------------------------------------------- |
| 516 | // dio_w - |
| 517 | //------------------------------------------------- |
| 297 | 518 | |
| 298 | | ieee488->daisy_state = head; |
| 519 | void ieee488_device::dio_w(device_t *device, UINT8 data) |
| 520 | { |
| 521 | return set_data(device, data); |
| 522 | } |
| 299 | 523 | |
| 300 | | /* register for state saving */ |
| 301 | | // device->save_item(NAME(ieee488->)); |
| 524 | |
| 525 | //------------------------------------------------- |
| 526 | // eoi_w - |
| 527 | //------------------------------------------------- |
| 528 | |
| 529 | void ieee488_device::eoi_w(device_t *device, int state) |
| 530 | { |
| 531 | set_signal(device, EOI, state); |
| 302 | 532 | } |
| 303 | 533 | |
| 304 | | /*------------------------------------------------- |
| 305 | | DEVICE_GET_INFO( ieee488 ) |
| 306 | | -------------------------------------------------*/ |
| 307 | 534 | |
| 308 | | DEVICE_GET_INFO( ieee488 ) |
| 535 | //------------------------------------------------- |
| 536 | // dav_w - |
| 537 | //------------------------------------------------- |
| 538 | |
| 539 | void ieee488_device::dav_w(device_t *device, int state) |
| 309 | 540 | { |
| 310 | | switch (state) |
| 311 | | { |
| 312 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 313 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ieee488_t); break; |
| 314 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 541 | set_signal(device, DAV, state); |
| 542 | } |
| 315 | 543 | |
| 316 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 317 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(ieee488); break; |
| 318 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 319 | | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 320 | 544 | |
| 321 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 322 | | case DEVINFO_STR_NAME: strcpy(info->s, "IEEE-488.1 Bus"); break; |
| 323 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "IEEE-488"); break; |
| 324 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 325 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 326 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 327 | | } |
| 545 | //------------------------------------------------- |
| 546 | // nrfd_w - |
| 547 | //------------------------------------------------- |
| 548 | |
| 549 | void ieee488_device::nrfd_w(device_t *device, int state) |
| 550 | { |
| 551 | set_signal(device, NRFD, state); |
| 328 | 552 | } |
| 329 | 553 | |
| 330 | | DEFINE_LEGACY_DEVICE(IEEE488, ieee488); |
| 554 | |
| 555 | //------------------------------------------------- |
| 556 | // ndac_w - |
| 557 | //------------------------------------------------- |
| 558 | |
| 559 | void ieee488_device::ndac_w(device_t *device, int state) |
| 560 | { |
| 561 | set_signal(device, NDAC, state); |
| 562 | } |
| 563 | |
| 564 | |
| 565 | //------------------------------------------------- |
| 566 | // ifc_w - |
| 567 | //------------------------------------------------- |
| 568 | |
| 569 | void ieee488_device::ifc_w(device_t *device, int state) |
| 570 | { |
| 571 | set_signal(device, IFC, state); |
| 572 | } |
| 573 | |
| 574 | |
| 575 | //------------------------------------------------- |
| 576 | // srq_w - |
| 577 | //------------------------------------------------- |
| 578 | |
| 579 | void ieee488_device::srq_w(device_t *device, int state) |
| 580 | { |
| 581 | set_signal(device, SRQ, state); |
| 582 | } |
| 583 | |
| 584 | |
| 585 | //------------------------------------------------- |
| 586 | // atn_w - |
| 587 | //------------------------------------------------- |
| 588 | |
| 589 | void ieee488_device::atn_w(device_t *device, int state) |
| 590 | { |
| 591 | set_signal(device, ATN, state); |
| 592 | } |
| 593 | |
| 594 | |
| 595 | //------------------------------------------------- |
| 596 | // ren_w - |
| 597 | //------------------------------------------------- |
| 598 | |
| 599 | void ieee488_device::ren_w(device_t *device, int state) |
| 600 | { |
| 601 | set_signal(device, REN, state); |
| 602 | } |