src/mess/machine/c9060.c
| r11287 | r11288 | |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | | /* |
| 10 | #include "c9060.h" |
| 11 | 11 | |
| 12 | | TODO: |
| 13 | 12 | |
| 14 | | - everything |
| 15 | 13 | |
| 16 | | */ |
| 14 | //************************************************************************** |
| 15 | // MACROS / CONSTANTS |
| 16 | //************************************************************************** |
| 17 | 17 | |
| 18 | | #include "emu.h" |
| 19 | | #include "c9060.h" |
| 20 | | #include "cpu/m6502/m6502.h" |
| 21 | | #include "machine/6522via.h" |
| 22 | | #include "machine/6532riot.h" |
| 23 | | #include "machine/ieee488.h" |
| 24 | | |
| 25 | | /*************************************************************************** |
| 26 | | PARAMETERS |
| 27 | | ***************************************************************************/ |
| 28 | | |
| 29 | | #define LOG 0 |
| 30 | | |
| 31 | 18 | #define M6502_TAG "7e" |
| 32 | 19 | #define M6532_0_TAG "7f" |
| 33 | 20 | #define M6532_1_TAG "7g" |
| r11287 | r11288 | |
| 35 | 22 | #define M6504_TAG "4a" |
| 36 | 23 | #define M6522_TAG "4b" |
| 37 | 24 | |
| 38 | | #define C9060_REGION "c9060" |
| 39 | 25 | |
| 40 | | /*************************************************************************** |
| 41 | | TYPE DEFINITIONS |
| 42 | | ***************************************************************************/ |
| 43 | 26 | |
| 44 | | typedef struct _c9060_t c9060_t; |
| 45 | | struct _c9060_t |
| 46 | | { |
| 47 | | /* IEEE-488 bus */ |
| 48 | | int address; /* device address - 8 */ |
| 49 | | int rfdo; /* not ready for data output */ |
| 50 | | int daco; /* not data accepted output */ |
| 51 | | int atna; /* attention acknowledge */ |
| 27 | //************************************************************************** |
| 28 | // DEVICE DEFINITIONS |
| 29 | //************************************************************************** |
| 52 | 30 | |
| 53 | | /* devices */ |
| 54 | | device_t *cpu_dos; |
| 55 | | device_t *cpu_hdc; |
| 56 | | device_t *riot0; |
| 57 | | device_t *riot1; |
| 58 | | device_t *via; |
| 59 | | device_t *bus; |
| 60 | | }; |
| 31 | const device_type C9060 = c9060_device_config::static_alloc_device_config; |
| 32 | const device_type C9090 = c9060_device_config::static_alloc_device_config; |
| 61 | 33 | |
| 62 | | /*************************************************************************** |
| 63 | | INLINE FUNCTIONS |
| 64 | | ***************************************************************************/ |
| 65 | 34 | |
| 66 | | INLINE c9060_t *get_safe_token(device_t *device) |
| 35 | |
| 36 | //************************************************************************** |
| 37 | // DEVICE CONFIGURATION |
| 38 | //************************************************************************** |
| 39 | |
| 40 | //------------------------------------------------- |
| 41 | // c9060_device_config - constructor |
| 42 | //------------------------------------------------- |
| 43 | |
| 44 | c9060_device_config::c9060_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 45 | : device_config(mconfig, static_alloc_device_config, "C9060", tag, owner, clock), |
| 46 | device_config_ieee488_interface(mconfig, *this) |
| 67 | 47 | { |
| 68 | | assert(device != NULL); |
| 69 | | assert((device->type() == C9060) || (device->type() == C9090)); |
| 70 | | return (c9060_t *)downcast<legacy_device_base *>(device)->token(); |
| 71 | 48 | } |
| 72 | 49 | |
| 73 | | INLINE c9060_config *get_safe_config(device_t *device) |
| 50 | |
| 51 | //------------------------------------------------- |
| 52 | // static_alloc_device_config - allocate a new |
| 53 | // configuration object |
| 54 | //------------------------------------------------- |
| 55 | |
| 56 | device_config *c9060_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 74 | 57 | { |
| 75 | | assert(device != NULL); |
| 76 | | assert((device->type() == C9060) || (device->type() == C9090)); |
| 77 | | return (c9060_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); |
| 58 | return global_alloc(c9060_device_config(mconfig, tag, owner, clock)); |
| 78 | 59 | } |
| 79 | 60 | |
| 80 | | INLINE void update_ieee_signals(device_t *device) |
| 61 | |
| 62 | //------------------------------------------------- |
| 63 | // alloc_device - allocate a new device object |
| 64 | //------------------------------------------------- |
| 65 | |
| 66 | device_t *c9060_device_config::alloc_device(running_machine &machine) const |
| 81 | 67 | { |
| 82 | | c9060_t *c9060 = get_safe_token(device); |
| 68 | return auto_alloc(machine, c9060_device(machine, *this)); |
| 69 | } |
| 83 | 70 | |
| 84 | | int atn = ieee488_atn_r(c9060->bus); |
| 85 | | int atna = c9060->atna; |
| 86 | | int rfdo = c9060->rfdo; |
| 87 | | int daco = c9060->daco; |
| 88 | 71 | |
| 89 | | int nrfd = !(!(!(atn&atna)&rfdo)|!(atn|atna)); |
| 90 | | int ndac = !(daco|!(atn|atna)); |
| 72 | //------------------------------------------------- |
| 73 | // device_config_complete - perform any |
| 74 | // operations now that the configuration is |
| 75 | // complete |
| 76 | //------------------------------------------------- |
| 91 | 77 | |
| 92 | | ieee488_nrfd_w(c9060->bus, device, nrfd); |
| 93 | | ieee488_ndac_w(c9060->bus, device, ndac); |
| 78 | void c9060_device_config::device_config_complete() |
| 79 | { |
| 80 | m_shortname = "c9060"; |
| 94 | 81 | } |
| 95 | 82 | |
| 96 | | /*************************************************************************** |
| 97 | | IMPLEMENTATION |
| 98 | | ***************************************************************************/ |
| 99 | 83 | |
| 100 | | /*------------------------------------------------- |
| 101 | | c9060_ieee488_atn_w - IEEE-488 bus attention |
| 102 | | -------------------------------------------------*/ |
| 84 | //------------------------------------------------- |
| 85 | // static_set_config - configuration helper |
| 86 | //------------------------------------------------- |
| 103 | 87 | |
| 104 | | WRITE_LINE_DEVICE_HANDLER( c9060_ieee488_atn_w ) |
| 88 | void c9060_device_config::static_set_config(device_config *device, int address, int variant) |
| 105 | 89 | { |
| 106 | | c9060_t *c9060 = get_safe_token(device); |
| 90 | c9060_device_config *c9060 = downcast<c9060_device_config *>(device); |
| 107 | 91 | |
| 108 | | update_ieee_signals(device); |
| 92 | assert((address > 7) && (address < 12)); |
| 109 | 93 | |
| 110 | | /* set RIOT PA7 */ |
| 111 | | riot6532_porta_in_set(c9060->riot1, !state << 7, 0x80); |
| 94 | c9060->m_variant = variant; |
| 95 | c9060->m_address = address - 8; |
| 112 | 96 | } |
| 113 | 97 | |
| 114 | | /*------------------------------------------------- |
| 115 | | c9060_ieee488_ifc_w - IEEE-488 bus reset |
| 116 | | -------------------------------------------------*/ |
| 117 | 98 | |
| 118 | | WRITE_LINE_DEVICE_HANDLER( c9060_ieee488_ifc_w ) |
| 99 | //------------------------------------------------- |
| 100 | // ROM( c9060 ) |
| 101 | //------------------------------------------------- |
| 102 | |
| 103 | ROM_START( c9060 ) |
| 104 | ROM_REGION( 0x4000, M6502_TAG, 0 ) |
| 105 | ROM_LOAD_OPTIONAL( "300516-revb.7c", 0x0000, 0x2000, CRC(2d758a14) SHA1(c959cc9dde84fc3d64e95e58a0a096a26d8107fd) ) |
| 106 | ROM_LOAD( "300516-revc.7c", 0x0000, 0x2000, CRC(d6a3e88f) SHA1(bb1ddb5da94a86266012eca54818aa21dc4cef6a) ) |
| 107 | ROM_LOAD_OPTIONAL( "300517-reva.7d", 0x2000, 0x2000, CRC(566df630) SHA1(b1602dfff408b165ee52a6a4ca3e2ec27e689ba9) ) |
| 108 | ROM_LOAD_OPTIONAL( "300517-revb.7d", 0x2000, 0x2000, CRC(f0382bc3) SHA1(0b0a8dc520f5b41ffa832e4a636b3d226ccbb7f1) ) |
| 109 | ROM_LOAD( "300517-revc.7d", 0x2000, 0x2000, CRC(2a9ad4ad) SHA1(4c17d014de48c906871b9b6c7d037d8736b1fd52) ) |
| 110 | |
| 111 | ROM_REGION( 0x800, M6504_TAG, 0 ) |
| 112 | ROM_LOAD_OPTIONAL( "300515-reva.4c", 0x000, 0x800, CRC(99e096f7) SHA1(a3d1deb27bf5918b62b89c27fa3e488eb8f717a4) ) |
| 113 | ROM_LOAD( "300515-revb.4c", 0x000, 0x800, CRC(49adf4fb) SHA1(59dafbd4855083074ba8dc96a04d4daa5b76e0d6) ) |
| 114 | ROM_END |
| 115 | |
| 116 | |
| 117 | //------------------------------------------------- |
| 118 | // rom_region - device-specific ROM region |
| 119 | //------------------------------------------------- |
| 120 | |
| 121 | const rom_entry *c9060_device_config::device_rom_region() const |
| 119 | 122 | { |
| 120 | | if (!state) |
| 121 | | { |
| 122 | | device->reset(); |
| 123 | | } |
| 123 | return ROM_NAME( c9060 ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | | /*------------------------------------------------- |
| 127 | | ADDRESS_MAP( c9060_dos_map ) |
| 128 | | -------------------------------------------------*/ |
| 129 | 126 | |
| 130 | | static ADDRESS_MAP_START( c9060_dos_map, AS_PROGRAM, 8 ) |
| 127 | //------------------------------------------------- |
| 128 | // ADDRESS_MAP( c9060_main_mem ) |
| 129 | //------------------------------------------------- |
| 130 | |
| 131 | static ADDRESS_MAP_START( c9060_main_mem, AS_PROGRAM, 8, c9060_device ) |
| 131 | 132 | AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0100) AM_RAM // 6532 #1 |
| 132 | 133 | AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0100) AM_RAM // 6532 #2 |
| 133 | | AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_0_TAG, riot6532_r, riot6532_w) |
| 134 | | AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE(M6532_1_TAG, riot6532_r, riot6532_w) |
| 134 | AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_0_TAG, riot6532_r, riot6532_w) |
| 135 | AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d60) AM_DEVREADWRITE_LEGACY(M6532_1_TAG, riot6532_r, riot6532_w) |
| 135 | 136 | AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share1") |
| 136 | 137 | AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share2") |
| 137 | 138 | AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share3") |
| 138 | 139 | AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM AM_SHARE("share4") |
| 139 | | AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("c9060:c9060", 0x0000) |
| 140 | AM_RANGE(0xc000, 0xffff) // AM_ROM |
| 140 | 141 | ADDRESS_MAP_END |
| 141 | 142 | |
| 142 | | /*------------------------------------------------- |
| 143 | | ADDRESS_MAP( c9060_fdc_map ) |
| 144 | | -------------------------------------------------*/ |
| 145 | 143 | |
| 146 | | static ADDRESS_MAP_START( c9060_fdc_map, AS_PROGRAM, 8 ) |
| 144 | //------------------------------------------------- |
| 145 | // ADDRESS_MAP( c9060_hdc_mem ) |
| 146 | //------------------------------------------------- |
| 147 | |
| 148 | static ADDRESS_MAP_START( c9060_hdc_mem, AS_PROGRAM, 8, c9060_device ) |
| 147 | 149 | ADDRESS_MAP_GLOBAL_MASK(0x1fff) |
| 148 | 150 | AM_RANGE(0x0000, 0x003f) AM_MIRROR(0x0300) AM_RAM // 6530 |
| 149 | | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE_MODERN(M6522_TAG, via6522_device, read, write) |
| 151 | AM_RANGE(0x0040, 0x004f) AM_MIRROR(0x0330) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write) |
| 150 | 152 | AM_RANGE(0x0400, 0x07ff) AM_RAM AM_SHARE("share1") |
| 151 | 153 | AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("share2") |
| 152 | 154 | AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("share3") |
| 153 | 155 | AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("share4") |
| 154 | | AM_RANGE(0x1800, 0x1fff) AM_ROM AM_REGION("c9060:c9060", 0x2000) // 6530 |
| 156 | AM_RANGE(0x1800, 0x1fff) // AM_ROM 6530 |
| 155 | 157 | ADDRESS_MAP_END |
| 156 | 158 | |
| 157 | | /*------------------------------------------------- |
| 158 | | riot6532_interface riot0_intf 7f |
| 159 | | -------------------------------------------------*/ |
| 160 | 159 | |
| 161 | | static READ8_DEVICE_HANDLER( dio_r ) |
| 160 | //------------------------------------------------- |
| 161 | // riot6532_interface riot0_intf |
| 162 | //------------------------------------------------- |
| 163 | |
| 164 | READ8_MEMBER( c9060_device::dio_r ) |
| 162 | 165 | { |
| 163 | 166 | /* |
| 164 | 167 | |
| r11287 | r11288 | |
| 175 | 178 | |
| 176 | 179 | */ |
| 177 | 180 | |
| 178 | | c9060_t *c9060 = get_safe_token(device->owner()); |
| 179 | | |
| 180 | | return ieee488_dio_r(c9060->bus, 0); |
| 181 | return m_bus->dio_r(); |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | | static WRITE8_DEVICE_HANDLER( dio_w ) |
| 184 | |
| 185 | WRITE8_MEMBER( c9060_device::dio_w ) |
| 184 | 186 | { |
| 185 | 187 | /* |
| 186 | 188 | |
| r11287 | r11288 | |
| 197 | 199 | |
| 198 | 200 | */ |
| 199 | 201 | |
| 200 | | c9060_t *c9060 = get_safe_token(device->owner()); |
| 201 | | |
| 202 | | ieee488_dio_w(c9060->bus, device->owner(), data); |
| 202 | m_bus->dio_w(this, data); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | |
| 205 | 206 | static const riot6532_interface riot0_intf = |
| 206 | 207 | { |
| 207 | | DEVCB_HANDLER(dio_r), |
| 208 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, dio_r), |
| 208 | 209 | DEVCB_NULL, |
| 209 | 210 | DEVCB_NULL, |
| 210 | | DEVCB_HANDLER(dio_w), |
| 211 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, dio_w), |
| 211 | 212 | DEVCB_NULL |
| 212 | 213 | }; |
| 213 | 214 | |
| 214 | | /*------------------------------------------------- |
| 215 | | riot6532_interface riot1_intf ue1 |
| 216 | | -------------------------------------------------*/ |
| 217 | 215 | |
| 218 | | static READ8_DEVICE_HANDLER( riot1_pa_r ) |
| 216 | //------------------------------------------------- |
| 217 | // riot6532_interface riot1_intf |
| 218 | //------------------------------------------------- |
| 219 | |
| 220 | READ8_MEMBER( c9060_device::riot1_pa_r ) |
| 219 | 221 | { |
| 220 | 222 | /* |
| 221 | 223 | |
| r11287 | r11288 | |
| 232 | 234 | |
| 233 | 235 | */ |
| 234 | 236 | |
| 235 | | c9060_t *c9060 = get_safe_token(device->owner()); |
| 236 | | |
| 237 | 237 | UINT8 data = 0; |
| 238 | 238 | |
| 239 | 239 | /* end or identify in */ |
| 240 | | data |= ieee488_eoi_r(c9060->bus) << 5; |
| 240 | data |= m_bus->eoi_r() << 5; |
| 241 | 241 | |
| 242 | 242 | /* data valid in */ |
| 243 | | data |= ieee488_dav_r(c9060->bus) << 6; |
| 243 | data |= m_bus->dav_r() << 6; |
| 244 | 244 | |
| 245 | 245 | /* attention */ |
| 246 | | data |= !ieee488_atn_r(c9060->bus) << 7; |
| 246 | data |= !m_bus->atn_r() << 7; |
| 247 | 247 | |
| 248 | 248 | return data; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | | static WRITE8_DEVICE_HANDLER( riot1_pa_w ) |
| 251 | |
| 252 | WRITE8_MEMBER( c9060_device::riot1_pa_w ) |
| 252 | 253 | { |
| 253 | 254 | /* |
| 254 | 255 | |
| r11287 | r11288 | |
| 265 | 266 | |
| 266 | 267 | */ |
| 267 | 268 | |
| 268 | | c9060_t *c9060 = get_safe_token(device->owner()); |
| 269 | | |
| 270 | 269 | /* attention acknowledge */ |
| 271 | | c9060->atna = BIT(data, 0); |
| 270 | m_atna = BIT(data, 0); |
| 272 | 271 | |
| 273 | 272 | /* data accepted out */ |
| 274 | | c9060->daco = BIT(data, 1); |
| 273 | m_daco = BIT(data, 1); |
| 275 | 274 | |
| 276 | 275 | /* not ready for data out */ |
| 277 | | c9060->rfdo = BIT(data, 2); |
| 276 | m_rfdo = BIT(data, 2); |
| 278 | 277 | |
| 279 | 278 | /* end or identify out */ |
| 280 | | ieee488_eoi_w(c9060->bus, device->owner(), BIT(data, 3)); |
| 279 | m_bus->eoi_w(this, BIT(data, 3)); |
| 281 | 280 | |
| 282 | 281 | /* data valid out */ |
| 283 | | ieee488_dav_w(c9060->bus, device->owner(), BIT(data, 4)); |
| 282 | m_bus->dav_w(this, BIT(data, 4)); |
| 284 | 283 | |
| 285 | | update_ieee_signals(device->owner()); |
| 284 | update_ieee_signals(); |
| 286 | 285 | } |
| 287 | 286 | |
| 288 | | static READ8_DEVICE_HANDLER( riot1_pb_r ) |
| 287 | |
| 288 | READ8_MEMBER( c9060_device::riot1_pb_r ) |
| 289 | 289 | { |
| 290 | 290 | /* |
| 291 | 291 | |
| r11287 | r11288 | |
| 302 | 302 | |
| 303 | 303 | */ |
| 304 | 304 | |
| 305 | | c9060_t *c9060 = get_safe_token(device->owner()); |
| 306 | | |
| 307 | 305 | UINT8 data = 0; |
| 308 | 306 | |
| 309 | 307 | /* data accepted in */ |
| 310 | | data |= ieee488_ndac_r(c9060->bus) << 6; |
| 308 | data |= m_bus->ndac_r() << 6; |
| 311 | 309 | |
| 312 | 310 | /* ready for data in */ |
| 313 | | data |= ieee488_nrfd_r(c9060->bus) << 7; |
| 311 | data |= m_bus->nrfd_r() << 7; |
| 314 | 312 | |
| 315 | 313 | return data; |
| 316 | 314 | } |
| 317 | 315 | |
| 318 | | static WRITE8_DEVICE_HANDLER( riot1_pb_w ) |
| 316 | |
| 317 | WRITE8_MEMBER( c9060_device::riot1_pb_w ) |
| 319 | 318 | { |
| 320 | 319 | /* |
| 321 | 320 | |
| r11287 | r11288 | |
| 333 | 332 | */ |
| 334 | 333 | } |
| 335 | 334 | |
| 336 | | static WRITE_LINE_DEVICE_HANDLER( riot1_irq_w ) |
| 337 | | { |
| 338 | | c9060_t *c9060 = get_safe_token(device->owner()); |
| 339 | 335 | |
| 340 | | device_set_input_line(c9060->cpu_dos, M6502_IRQ_LINE, state); |
| 341 | | } |
| 342 | | |
| 343 | 336 | static const riot6532_interface riot1_intf = |
| 344 | 337 | { |
| 345 | | DEVCB_HANDLER(riot1_pa_r), |
| 346 | | DEVCB_HANDLER(riot1_pb_r), |
| 347 | | DEVCB_HANDLER(riot1_pa_w), |
| 348 | | DEVCB_HANDLER(riot1_pb_w), |
| 349 | | DEVCB_LINE(riot1_irq_w) |
| 338 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pa_r), |
| 339 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pb_r), |
| 340 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pa_w), |
| 341 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, riot1_pb_w), |
| 342 | DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0) |
| 350 | 343 | }; |
| 351 | 344 | |
| 352 | | /*------------------------------------------------- |
| 353 | | via6522_interface via_intf 4b |
| 354 | | -------------------------------------------------*/ |
| 355 | 345 | |
| 356 | | static READ8_DEVICE_HANDLER( via_pa_r ) |
| 346 | //------------------------------------------------- |
| 347 | // via6522_interface via_intf |
| 348 | //------------------------------------------------- |
| 349 | |
| 350 | READ8_MEMBER( c9060_device::via_pa_r ) |
| 357 | 351 | { |
| 358 | 352 | /* |
| 359 | 353 | |
| r11287 | r11288 | |
| 373 | 367 | return 0; |
| 374 | 368 | } |
| 375 | 369 | |
| 376 | | static WRITE8_DEVICE_HANDLER( via_pa_w ) |
| 370 | WRITE8_MEMBER( c9060_device::via_pa_w ) |
| 377 | 371 | { |
| 378 | 372 | /* |
| 379 | 373 | |
| r11287 | r11288 | |
| 391 | 385 | */ |
| 392 | 386 | } |
| 393 | 387 | |
| 394 | | static READ8_DEVICE_HANDLER( via_pb_r ) |
| 388 | READ8_MEMBER( c9060_device::via_pb_r ) |
| 395 | 389 | { |
| 396 | 390 | /* |
| 397 | 391 | |
| r11287 | r11288 | |
| 411 | 405 | return 0; |
| 412 | 406 | } |
| 413 | 407 | |
| 414 | | static WRITE8_DEVICE_HANDLER( via_pb_w ) |
| 408 | WRITE8_MEMBER( c9060_device::via_pb_w ) |
| 415 | 409 | { |
| 416 | 410 | /* |
| 417 | 411 | |
| r11287 | r11288 | |
| 431 | 425 | |
| 432 | 426 | static const via6522_interface via_intf = |
| 433 | 427 | { |
| 434 | | DEVCB_HANDLER(via_pa_r), |
| 435 | | DEVCB_HANDLER(via_pb_r), |
| 428 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pa_r), |
| 429 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pb_r), |
| 436 | 430 | DEVCB_NULL, // ACK |
| 437 | 431 | DEVCB_NULL, |
| 438 | 432 | DEVCB_NULL, // MSG |
| 439 | 433 | DEVCB_NULL, // ? |
| 440 | 434 | |
| 441 | | DEVCB_HANDLER(via_pa_w), |
| 442 | | DEVCB_HANDLER(via_pb_w), |
| 435 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pa_w), |
| 436 | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c9060_device, via_pb_w), |
| 443 | 437 | DEVCB_NULL, |
| 444 | 438 | DEVCB_NULL, |
| 445 | 439 | DEVCB_NULL, |
| r11287 | r11288 | |
| 448 | 442 | DEVCB_NULL |
| 449 | 443 | }; |
| 450 | 444 | |
| 451 | | /*------------------------------------------------- |
| 452 | | MACHINE_DRIVER( c9060 ) |
| 453 | | -------------------------------------------------*/ |
| 454 | 445 | |
| 446 | //------------------------------------------------- |
| 447 | // MACHINE_CONFIG_FRAGMENT( c9060 ) |
| 448 | //------------------------------------------------- |
| 449 | |
| 455 | 450 | static MACHINE_CONFIG_FRAGMENT( c9060 ) |
| 456 | | /* DOS */ |
| 451 | // DOS |
| 457 | 452 | MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16) |
| 458 | | MCFG_CPU_PROGRAM_MAP(c9060_dos_map) |
| 453 | MCFG_CPU_PROGRAM_MAP(c9060_main_mem) |
| 459 | 454 | |
| 460 | 455 | MCFG_RIOT6532_ADD(M6532_0_TAG, XTAL_16MHz/16, riot0_intf) |
| 461 | 456 | MCFG_RIOT6532_ADD(M6532_1_TAG, XTAL_16MHz/16, riot1_intf) |
| 462 | 457 | |
| 463 | | /* controller */ |
| 458 | // controller |
| 464 | 459 | MCFG_CPU_ADD(M6504_TAG, M6504, XTAL_16MHz/16) |
| 465 | | MCFG_CPU_PROGRAM_MAP(c9060_fdc_map) |
| 460 | MCFG_CPU_PROGRAM_MAP(c9060_hdc_mem) |
| 466 | 461 | |
| 467 | 462 | MCFG_VIA6522_ADD(M6522_TAG, XTAL_16MHz/16, via_intf) |
| 468 | 463 | |
| 469 | 464 | // Tandon TM602S |
| 470 | 465 | MACHINE_CONFIG_END |
| 471 | 466 | |
| 472 | | /*------------------------------------------------- |
| 473 | | MACHINE_DRIVER( c9090 ) |
| 474 | | -------------------------------------------------*/ |
| 475 | 467 | |
| 468 | //------------------------------------------------- |
| 469 | // MACHINE_CONFIG_FRAGMENT( c9090 ) |
| 470 | //------------------------------------------------- |
| 471 | |
| 476 | 472 | static MACHINE_CONFIG_FRAGMENT( c9090 ) |
| 477 | 473 | MCFG_FRAGMENT_ADD(c9060) |
| 478 | | |
| 479 | 474 | // Tandon TM603S |
| 480 | 475 | MACHINE_CONFIG_END |
| 481 | 476 | |
| 482 | | /*------------------------------------------------- |
| 483 | | ROM( c9060 ) |
| 484 | | -------------------------------------------------*/ |
| 485 | 477 | |
| 486 | | ROM_START( c9060 ) // schematic 300010 |
| 487 | | ROM_REGION( 0x4800, C9060_REGION, ROMREGION_LOADBYNAME ) |
| 488 | | ROM_LOAD_OPTIONAL( "300516-revb.7c", 0x0000, 0x2000, CRC(2d758a14) SHA1(c959cc9dde84fc3d64e95e58a0a096a26d8107fd) ) |
| 489 | | ROM_LOAD( "300516-revc.7c", 0x0000, 0x2000, CRC(d6a3e88f) SHA1(bb1ddb5da94a86266012eca54818aa21dc4cef6a) ) |
| 490 | | ROM_LOAD_OPTIONAL( "300517-reva.7d", 0x2000, 0x2000, CRC(566df630) SHA1(b1602dfff408b165ee52a6a4ca3e2ec27e689ba9) ) |
| 491 | | ROM_LOAD_OPTIONAL( "300517-revb.7d", 0x2000, 0x2000, CRC(f0382bc3) SHA1(0b0a8dc520f5b41ffa832e4a636b3d226ccbb7f1) ) |
| 492 | | ROM_LOAD( "300517-revc.7d", 0x2000, 0x2000, CRC(2a9ad4ad) SHA1(4c17d014de48c906871b9b6c7d037d8736b1fd52) ) |
| 478 | //------------------------------------------------- |
| 479 | // machine_config_additions - device-specific |
| 480 | // machine configurations |
| 481 | //------------------------------------------------- |
| 493 | 482 | |
| 494 | | ROM_LOAD_OPTIONAL( "300515-reva.4c", 0x4000, 0x0800, CRC(99e096f7) SHA1(a3d1deb27bf5918b62b89c27fa3e488eb8f717a4) ) |
| 495 | | ROM_LOAD( "300515-revb.4c", 0x4000, 0x0800, CRC(49adf4fb) SHA1(59dafbd4855083074ba8dc96a04d4daa5b76e0d6) ) |
| 496 | | ROM_END |
| 483 | machine_config_constructor c9060_device_config::device_mconfig_additions() const |
| 484 | { |
| 485 | switch (m_variant) |
| 486 | { |
| 487 | default: |
| 488 | case TYPE_9060: |
| 489 | return MACHINE_CONFIG_NAME( c9060 ); |
| 497 | 490 | |
| 498 | | /*------------------------------------------------- |
| 499 | | DEVICE_START( c9060 ) |
| 500 | | -------------------------------------------------*/ |
| 491 | case TYPE_9090: |
| 492 | return MACHINE_CONFIG_NAME( c9090 ); |
| 493 | } |
| 494 | } |
| 501 | 495 | |
| 502 | | static DEVICE_START( c9060 ) |
| 496 | |
| 497 | |
| 498 | //************************************************************************** |
| 499 | // INLINE HELPERS |
| 500 | //************************************************************************** |
| 501 | |
| 502 | //------------------------------------------------- |
| 503 | // update_ieee_signals - |
| 504 | //------------------------------------------------- |
| 505 | |
| 506 | inline void c9060_device::update_ieee_signals() |
| 503 | 507 | { |
| 504 | | c9060_t *c9060 = get_safe_token(device); |
| 505 | | const c9060_config *config = get_safe_config(device); |
| 508 | int atn = m_bus->atn_r(); |
| 509 | int nrfd = !(!(!(atn & m_atna) & m_rfdo) | !(atn | m_atna)); |
| 510 | int ndac = !(m_daco | !(atn | m_atna)); |
| 506 | 511 | |
| 507 | | /* find our CPU */ |
| 508 | | c9060->cpu_dos = device->subdevice(M6502_TAG); |
| 509 | | c9060->cpu_hdc = device->subdevice(M6504_TAG); |
| 512 | m_bus->nrfd_w(this, nrfd); |
| 513 | m_bus->ndac_w(this, ndac); |
| 514 | } |
| 510 | 515 | |
| 511 | | /* find devices */ |
| 512 | | c9060->riot0 = device->subdevice(M6532_0_TAG); |
| 513 | | c9060->riot1 = device->subdevice(M6532_1_TAG); |
| 514 | | c9060->via = device->subdevice(M6522_TAG); |
| 515 | | c9060->bus = device->machine().device(config->bus_tag); |
| 516 | 516 | |
| 517 | | /* register for state saving */ |
| 518 | | // device->save_item(NAME(c9060->)); |
| 517 | |
| 518 | //************************************************************************** |
| 519 | // LIVE DEVICE |
| 520 | //************************************************************************** |
| 521 | |
| 522 | //------------------------------------------------- |
| 523 | // c9060_device - constructor |
| 524 | //------------------------------------------------- |
| 525 | |
| 526 | c9060_device::c9060_device(running_machine &_machine, const c9060_device_config &_config) |
| 527 | : device_t(_machine, _config), |
| 528 | device_ieee488_interface(_machine, _config, *this), |
| 529 | m_maincpu(*this, M6502_TAG), |
| 530 | m_hdccpu(*this, M6504_TAG), |
| 531 | m_riot0(*this, M6532_0_TAG), |
| 532 | m_riot1(*this, M6532_1_TAG), |
| 533 | m_via(*this, M6522_TAG), |
| 534 | m_bus(*this->owner(), IEEE488_TAG), |
| 535 | m_config(_config) |
| 536 | { |
| 519 | 537 | } |
| 520 | 538 | |
| 521 | | /*------------------------------------------------- |
| 522 | | DEVICE_RESET( c9060 ) |
| 523 | | -------------------------------------------------*/ |
| 524 | 539 | |
| 525 | | static DEVICE_RESET( c9060 ) |
| 540 | //------------------------------------------------- |
| 541 | // device_start - device-specific startup |
| 542 | //------------------------------------------------- |
| 543 | |
| 544 | void c9060_device::device_start() |
| 526 | 545 | { |
| 527 | | c9060_t *c9060 = get_safe_token(device); |
| 546 | address_space *main = m_maincpu->memory().space(AS_PROGRAM); |
| 547 | address_space *hdc = m_hdccpu->memory().space(AS_PROGRAM); |
| 528 | 548 | |
| 529 | | /* reset devices */ |
| 530 | | c9060->cpu_dos->reset(); |
| 531 | | c9060->cpu_hdc->reset(); |
| 532 | | c9060->riot0->reset(); |
| 533 | | c9060->riot1->reset(); |
| 534 | | c9060->via->reset(); |
| 549 | main->install_rom(0xc000, 0xffff, subregion(M6502_TAG)->base()); |
| 550 | hdc->install_rom(0x1800, 0x1fff, subregion(M6504_TAG)->base()); |
| 535 | 551 | |
| 536 | | /* toggle M6502 SO */ |
| 537 | | device_set_input_line(c9060->cpu_dos, M6502_SET_OVERFLOW, ASSERT_LINE); |
| 538 | | device_set_input_line(c9060->cpu_dos, M6502_SET_OVERFLOW, CLEAR_LINE); |
| 552 | // state saving |
| 553 | save_item(NAME(m_rfdo)); |
| 554 | save_item(NAME(m_daco)); |
| 555 | save_item(NAME(m_atna)); |
| 539 | 556 | } |
| 540 | 557 | |
| 541 | | /*------------------------------------------------- |
| 542 | | DEVICE_GET_INFO( c9060 ) |
| 543 | | -------------------------------------------------*/ |
| 544 | 558 | |
| 545 | | DEVICE_GET_INFO( c9060 ) |
| 559 | //------------------------------------------------- |
| 560 | // device_reset - device-specific reset |
| 561 | //------------------------------------------------- |
| 562 | |
| 563 | void c9060_device::device_reset() |
| 546 | 564 | { |
| 547 | | switch (state) |
| 548 | | { |
| 549 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 550 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(c9060_t); break; |
| 551 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(c9060_config); break; |
| 565 | m_maincpu->set_input_line(M6502_SET_OVERFLOW, ASSERT_LINE); |
| 566 | m_maincpu->set_input_line(M6502_SET_OVERFLOW, CLEAR_LINE); |
| 567 | } |
| 552 | 568 | |
| 553 | | /* --- the following bits of info are returned as pointers --- */ |
| 554 | | case DEVINFO_PTR_ROM_REGION: info->romregion = ROM_NAME(c9060); break; |
| 555 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(c9060); break; |
| 556 | 569 | |
| 557 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 558 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(c9060); break; |
| 559 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 560 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(c9060); break; |
| 570 | //------------------------------------------------- |
| 571 | // device_timer - handler timer events |
| 572 | //------------------------------------------------- |
| 561 | 573 | |
| 562 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 563 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore 9060"); break; |
| 564 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Commodore PET"); break; |
| 565 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 566 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 567 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 568 | | } |
| 574 | void c9060_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 575 | { |
| 569 | 576 | } |
| 570 | 577 | |
| 571 | | /*------------------------------------------------- |
| 572 | | DEVICE_GET_INFO( c9090 ) |
| 573 | | -------------------------------------------------*/ |
| 574 | 578 | |
| 575 | | DEVICE_GET_INFO( c9090 ) |
| 579 | //------------------------------------------------- |
| 580 | // m_bus->atn - |
| 581 | //------------------------------------------------- |
| 582 | |
| 583 | void c9060_device::ieee488_atn(int state) |
| 576 | 584 | { |
| 577 | | switch (state) |
| 578 | | { |
| 579 | | /* --- the following bits of info are returned as pointers --- */ |
| 580 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(c9090); break; |
| 585 | update_ieee_signals(); |
| 581 | 586 | |
| 582 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 583 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore 9090"); break; |
| 587 | // set RIOT PA7 |
| 588 | riot6532_porta_in_set(m_riot1, !state << 7, 0x80); |
| 589 | } |
| 584 | 590 | |
| 585 | | default: DEVICE_GET_INFO_CALL(c9060); break; |
| 591 | |
| 592 | //------------------------------------------------- |
| 593 | // m_bus->ifc - |
| 594 | //------------------------------------------------- |
| 595 | |
| 596 | void c9060_device::ieee488_ifc(int state) |
| 597 | { |
| 598 | if (!state) |
| 599 | { |
| 600 | device_reset(); |
| 586 | 601 | } |
| 587 | 602 | } |
| 588 | | |
| 589 | | DEFINE_LEGACY_DEVICE(C9060, c9060); |
| 590 | | DEFINE_LEGACY_DEVICE(C9090, c9090); |
src/mess/machine/c9060.h
| r11287 | r11288 | |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | #pragma once |
| 11 | |
| 10 | 12 | #ifndef __C9060__ |
| 11 | 13 | #define __C9060__ |
| 12 | 14 | |
| 15 | #define ADDRESS_MAP_MODERN |
| 16 | |
| 13 | 17 | #include "emu.h" |
| 18 | #include "cpu/m6502/m6502.h" |
| 19 | #include "imagedev/flopdrv.h" |
| 20 | #include "machine/6522via.h" |
| 21 | #include "machine/6532riot.h" |
| 22 | #include "machine/ieee488.h" |
| 14 | 23 | |
| 15 | | /*************************************************************************** |
| 16 | | MACROS / CONSTANTS |
| 17 | | ***************************************************************************/ |
| 18 | 24 | |
| 19 | | DECLARE_LEGACY_DEVICE(C9060, c9060); |
| 20 | | DECLARE_LEGACY_DEVICE(C9090, c9090); |
| 21 | 25 | |
| 22 | | #define MCFG_C9060_ADD(_tag, _bus_tag, _address) \ |
| 23 | | MCFG_DEVICE_ADD(_tag, C9060, 0) \ |
| 24 | | MCFG_DEVICE_CONFIG_DATAPTR(c9060_config, bus_tag, _bus_tag) \ |
| 25 | | MCFG_DEVICE_CONFIG_DATA32(c9060_config, address, _address) |
| 26 | //************************************************************************** |
| 27 | // MACROS / CONSTANTS |
| 28 | //************************************************************************** |
| 26 | 29 | |
| 27 | | #define MCFG_C9090_ADD(_tag, _bus_tag, _address) \ |
| 28 | | MCFG_DEVICE_ADD(_tag, C9090, 0) \ |
| 29 | | MCFG_DEVICE_CONFIG_DATAPTR(c9060_config, bus_tag, _bus_tag) \ |
| 30 | | MCFG_DEVICE_CONFIG_DATA32(c9060_config, address, _address) |
| 30 | #define C9060_TAG "c9060" |
| 31 | #define C9090_TAG "c9090" |
| 31 | 32 | |
| 32 | | #define C9060_IEEE488(_tag) \ |
| 33 | | _tag, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c9060_ieee488_ifc_w), DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c9060_ieee488_atn_w), DEVCB_NULL |
| 34 | 33 | |
| 35 | | /*************************************************************************** |
| 36 | | TYPE DEFINITIONS |
| 37 | | ***************************************************************************/ |
| 38 | 34 | |
| 39 | | typedef struct _c9060_config c9060_config; |
| 40 | | struct _c9060_config |
| 35 | //************************************************************************** |
| 36 | // INTERFACE CONFIGURATION MACROS |
| 37 | //************************************************************************** |
| 38 | |
| 39 | #define MCFG_C9060_ADD(_tag, _address) \ |
| 40 | MCFG_DEVICE_ADD(_tag, C9060, 0) \ |
| 41 | c9060_device_config::static_set_config(device, _address, TYPE_9060); |
| 42 | |
| 43 | |
| 44 | #define MCFG_C9090_ADD(_tag, _address) \ |
| 45 | MCFG_DEVICE_ADD(_tag, C9090, 0) \ |
| 46 | c9060_device_config::static_set_config(device, _address, TYPE_9090); |
| 47 | |
| 48 | |
| 49 | |
| 50 | //************************************************************************** |
| 51 | // TYPE DEFINITIONS |
| 52 | //************************************************************************** |
| 53 | |
| 54 | // ======================> c9060_device_config |
| 55 | |
| 56 | class c9060_device_config : public device_config, |
| 57 | public device_config_ieee488_interface |
| 41 | 58 | { |
| 42 | | const char *bus_tag; /* bus device */ |
| 43 | | int address; /* bus address */ |
| 59 | friend class c9060_device; |
| 60 | |
| 61 | // construction/destruction |
| 62 | c9060_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 63 | |
| 64 | public: |
| 65 | enum |
| 66 | { |
| 67 | TYPE_9060 = 0, |
| 68 | TYPE_9090 |
| 69 | }; |
| 70 | |
| 71 | // allocators |
| 72 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 73 | virtual device_t *alloc_device(running_machine &machine) const; |
| 74 | |
| 75 | // inline configuration helpers |
| 76 | static void static_set_config(device_config *device, int address, int variant); |
| 77 | |
| 78 | // optional information overrides |
| 79 | virtual const rom_entry *device_rom_region() const; |
| 80 | virtual machine_config_constructor device_mconfig_additions() const; |
| 81 | |
| 82 | protected: |
| 83 | // device_config overrides |
| 84 | virtual void device_config_complete(); |
| 85 | |
| 86 | int m_address; |
| 87 | int m_variant; |
| 44 | 88 | }; |
| 45 | 89 | |
| 46 | | /*************************************************************************** |
| 47 | | PROTOTYPES |
| 48 | | ***************************************************************************/ |
| 49 | | /* IEEE-488 interface */ |
| 50 | | WRITE_LINE_DEVICE_HANDLER( c9060_ieee488_atn_w ); |
| 51 | | WRITE_LINE_DEVICE_HANDLER( c9060_ieee488_ifc_w ); |
| 52 | 90 | |
| 91 | // ======================> c9060_device |
| 92 | |
| 93 | class c9060_device : public device_t, |
| 94 | public device_ieee488_interface |
| 95 | { |
| 96 | friend class c9060_device_config; |
| 97 | |
| 98 | // construction/destruction |
| 99 | c9060_device(running_machine &_machine, const c9060_device_config &_config); |
| 100 | |
| 101 | public: |
| 102 | // not really public |
| 103 | DECLARE_READ8_MEMBER( dio_r ); |
| 104 | DECLARE_WRITE8_MEMBER( dio_w ); |
| 105 | DECLARE_READ8_MEMBER( riot1_pa_r ); |
| 106 | DECLARE_WRITE8_MEMBER( riot1_pa_w ); |
| 107 | DECLARE_READ8_MEMBER( riot1_pb_r ); |
| 108 | DECLARE_WRITE8_MEMBER( riot1_pb_w ); |
| 109 | DECLARE_READ8_MEMBER( via_pa_r ); |
| 110 | DECLARE_READ8_MEMBER( via_pb_r ); |
| 111 | DECLARE_WRITE8_MEMBER( via_pa_w ); |
| 112 | DECLARE_WRITE8_MEMBER( via_pb_w ); |
| 113 | |
| 114 | protected: |
| 115 | // device-level overrides |
| 116 | virtual void device_start(); |
| 117 | virtual void device_reset(); |
| 118 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 119 | |
| 120 | // device_ieee488_interface overrides |
| 121 | void ieee488_atn(int state); |
| 122 | void ieee488_ifc(int state); |
| 123 | |
| 124 | private: |
| 125 | inline void update_ieee_signals(); |
| 126 | |
| 127 | required_device<cpu_device> m_maincpu; |
| 128 | required_device<cpu_device> m_hdccpu; |
| 129 | required_device<riot6532_device> m_riot0; |
| 130 | required_device<riot6532_device> m_riot1; |
| 131 | required_device<via6522_device> m_via; |
| 132 | required_device<ieee488_device> m_bus; |
| 133 | |
| 134 | // IEEE-488 bus |
| 135 | int m_rfdo; // not ready for data output |
| 136 | int m_daco; // not data accepted output |
| 137 | int m_atna; // attention acknowledge |
| 138 | |
| 139 | const c9060_device_config &m_config; |
| 140 | }; |
| 141 | |
| 142 | |
| 143 | // device type definition |
| 144 | extern const device_type C9060; |
| 145 | extern const device_type C9090; |
| 146 | |
| 147 | |
| 148 | |
| 53 | 149 | #endif |