src/mess/machine/cbmiec.c
| r11256 | r11257 | |
| 190 | 190 | 5) Tei minimum must be 80us for external device to be a listener. |
| 191 | 191 | */ |
| 192 | 192 | |
| 193 | | #include "emu.h" |
| 194 | 193 | #include "cbmiec.h" |
| 194 | #include "machine/devhelpr.h" |
| 195 | 195 | |
| 196 | | /*************************************************************************** |
| 197 | | PARAMETERS |
| 198 | | ***************************************************************************/ |
| 199 | 196 | |
| 200 | | #define LOG 0 |
| 201 | 197 | |
| 202 | | enum |
| 203 | | { |
| 204 | | SRQ = 0, |
| 205 | | ATN, |
| 206 | | CLK, |
| 207 | | DATA, |
| 208 | | RESET, |
| 209 | | SIGNAL_COUNT |
| 210 | | }; |
| 198 | //************************************************************************** |
| 199 | // MACROS / CONSTANTS |
| 200 | //************************************************************************** |
| 211 | 201 | |
| 202 | #define LOG 1 |
| 203 | |
| 204 | |
| 212 | 205 | static const char *const SIGNAL_NAME[] = { "SRQ", "ATN", "CLK", "DATA", "RESET" }; |
| 213 | 206 | |
| 214 | | /*************************************************************************** |
| 215 | | TYPE DEFINITIONS |
| 216 | | ***************************************************************************/ |
| 217 | 207 | |
| 218 | | typedef struct _cbm_iec_daisy_state cbm_iec_daisy_state; |
| 219 | | struct _cbm_iec_daisy_state |
| 208 | |
| 209 | //************************************************************************** |
| 210 | // DEVICE DEFINITIONS |
| 211 | //************************************************************************** |
| 212 | |
| 213 | const device_type CBM_IEC = cbm_iec_device_config::static_alloc_device_config; |
| 214 | |
| 215 | |
| 216 | |
| 217 | //************************************************************************** |
| 218 | // DEVICE CONFIGURATION INTERFACE |
| 219 | //************************************************************************** |
| 220 | |
| 221 | //------------------------------------------------- |
| 222 | // device_config_cbm_iec_interface - constructor |
| 223 | //------------------------------------------------- |
| 224 | |
| 225 | device_config_cbm_iec_interface::device_config_cbm_iec_interface(const machine_config &mconfig, device_config &devconfig) |
| 226 | : device_config_interface(mconfig, devconfig) |
| 220 | 227 | { |
| 221 | | cbm_iec_daisy_state *next; /* next device */ |
| 222 | | device_t *device; /* associated device */ |
| 228 | } |
| 223 | 229 | |
| 224 | | int line[SIGNAL_COUNT]; /* serial signal states */ |
| 225 | 230 | |
| 226 | | devcb_resolved_write_line out_line_func[SIGNAL_COUNT]; |
| 227 | | }; |
| 231 | //------------------------------------------------- |
| 232 | // ~device_config_cbm_iec_interface - destructor |
| 233 | //------------------------------------------------- |
| 228 | 234 | |
| 229 | | typedef struct _cbm_iec_t cbm_iec_t; |
| 230 | | struct _cbm_iec_t |
| 235 | device_config_cbm_iec_interface::~device_config_cbm_iec_interface() |
| 231 | 236 | { |
| 232 | | cbm_iec_daisy_state *daisy_state; |
| 233 | | }; |
| 237 | } |
| 234 | 238 | |
| 235 | | /*************************************************************************** |
| 236 | | INLINE FUNCTIONS |
| 237 | | ***************************************************************************/ |
| 238 | 239 | |
| 239 | | INLINE cbm_iec_t *get_safe_token(device_t *device) |
| 240 | |
| 241 | //************************************************************************** |
| 242 | // DEVICE INTERFACE |
| 243 | //************************************************************************** |
| 244 | |
| 245 | //------------------------------------------------- |
| 246 | // device_cbm_iec_interface - constructor |
| 247 | //------------------------------------------------- |
| 248 | |
| 249 | device_cbm_iec_interface::device_cbm_iec_interface(running_machine &machine, const device_config &config, device_t &device) |
| 250 | : device_interface(machine, config, device), |
| 251 | m_cbm_iec_config(dynamic_cast<const device_config_cbm_iec_interface &>(config)) |
| 240 | 252 | { |
| 241 | | assert(device != NULL); |
| 242 | | assert(device->type() == CBM_IEC); |
| 243 | | return (cbm_iec_t *)downcast<legacy_device_base *>(device)->token(); |
| 244 | 253 | } |
| 245 | 254 | |
| 246 | | INLINE const cbm_iec_daisy_chain *get_interface(device_t *device) |
| 255 | |
| 256 | //------------------------------------------------- |
| 257 | // ~device_cbm_iec_interface - destructor |
| 258 | //------------------------------------------------- |
| 259 | |
| 260 | device_cbm_iec_interface::~device_cbm_iec_interface() |
| 247 | 261 | { |
| 248 | | assert(device != NULL); |
| 249 | | assert(device->type() == CBM_IEC); |
| 250 | | return (const cbm_iec_daisy_chain *) device->baseconfig().static_config(); |
| 251 | 262 | } |
| 252 | 263 | |
| 253 | | INLINE int get_signal(device_t *device, int line) |
| 264 | |
| 265 | |
| 266 | //************************************************************************** |
| 267 | // DEVICE CONFIGURATION |
| 268 | //************************************************************************** |
| 269 | |
| 270 | GENERIC_DEVICE_CONFIG_SETUP(cbm_iec, "CBM IEC") |
| 271 | |
| 272 | |
| 273 | //------------------------------------------------- |
| 274 | // device_config_complete - perform any |
| 275 | // operations now that the configuration is |
| 276 | // complete |
| 277 | //------------------------------------------------- |
| 278 | |
| 279 | void cbm_iec_device_config::device_config_complete() |
| 254 | 280 | { |
| 255 | | cbm_iec_t *cbm_iec = get_safe_token(device); |
| 256 | | cbm_iec_daisy_state *daisy = cbm_iec->daisy_state; |
| 257 | | int state = 1; |
| 281 | // inherit a copy of the static data |
| 282 | const cbm_iec_config *intf = reinterpret_cast<const cbm_iec_config *>(static_config()); |
| 283 | if (intf != NULL) |
| 284 | *static_cast<cbm_iec_config *>(this) = *intf; |
| 258 | 285 | |
| 259 | | for ( ; daisy != NULL; daisy = daisy->next) |
| 286 | // or initialize to defaults if none provided |
| 287 | else |
| 260 | 288 | { |
| 261 | | if (!daisy->line[line]) |
| 289 | fatalerror("Daisy chain not provided!"); |
| 290 | } |
| 291 | |
| 292 | m_daisy = intf; |
| 293 | } |
| 294 | |
| 295 | |
| 296 | |
| 297 | //************************************************************************** |
| 298 | // INLINE HELPERS |
| 299 | //************************************************************************** |
| 300 | |
| 301 | //------------------------------------------------- |
| 302 | // set_signal - |
| 303 | //------------------------------------------------- |
| 304 | |
| 305 | inline void cbm_iec_device::set_signal(device_t *device, int signal, int state) |
| 306 | { |
| 307 | bool changed = false; |
| 308 | |
| 309 | for (daisy_entry *daisy = m_daisy_list; daisy != NULL; daisy = daisy->m_next) |
| 310 | { |
| 311 | if (!strcmp(daisy->m_device->tag(), device->tag())) |
| 262 | 312 | { |
| 263 | | state = 0; |
| 264 | | break; |
| 313 | if (daisy->m_line[signal] != state) |
| 314 | { |
| 315 | if (LOG) logerror("CBM IEC: '%s' %s %u\n", device->tag(), SIGNAL_NAME[signal], state); |
| 316 | daisy->m_line[signal] = state; |
| 317 | changed = true; |
| 318 | } |
| 265 | 319 | } |
| 266 | 320 | } |
| 267 | 321 | |
| 268 | | return state; |
| 322 | if (changed) |
| 323 | { |
| 324 | for (daisy_entry *daisy = m_daisy_list; daisy != NULL; daisy = daisy->m_next) |
| 325 | { |
| 326 | switch (signal) |
| 327 | { |
| 328 | case SRQ: |
| 329 | daisy->m_interface->cbm_iec_srq(state); |
| 330 | break; |
| 331 | |
| 332 | case ATN: |
| 333 | daisy->m_interface->cbm_iec_atn(state); |
| 334 | break; |
| 335 | |
| 336 | case CLK: |
| 337 | daisy->m_interface->cbm_iec_clk(state); |
| 338 | break; |
| 339 | |
| 340 | case DATA: |
| 341 | daisy->m_interface->cbm_iec_data(state); |
| 342 | break; |
| 343 | |
| 344 | case RESET: |
| 345 | daisy->m_interface->cbm_iec_reset(state); |
| 346 | break; |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | if (LOG) logerror("CBM IEC: SRQ %u ATN %u CLK %u DATA %u RESET %u\n", get_signal(SRQ),get_signal(ATN),get_signal(CLK),get_signal(DATA),get_signal(RESET)); |
| 351 | } |
| 269 | 352 | } |
| 270 | 353 | |
| 271 | | INLINE void set_signal(device_t *iec, device_t *device, int line, int state) |
| 354 | |
| 355 | //------------------------------------------------- |
| 356 | // get_signal - |
| 357 | //------------------------------------------------- |
| 358 | |
| 359 | inline int cbm_iec_device::get_signal(int signal) |
| 272 | 360 | { |
| 273 | | cbm_iec_t *cbm_iec = get_safe_token(iec); |
| 274 | | cbm_iec_daisy_state *daisy = cbm_iec->daisy_state; |
| 275 | | int data = 1; |
| 361 | int state = 1; |
| 276 | 362 | |
| 277 | | for ( ; daisy != NULL; daisy = daisy->next) |
| 363 | for (daisy_entry *daisy = m_daisy_list; daisy != NULL; daisy = daisy->m_next) |
| 278 | 364 | { |
| 279 | | if (!strcmp(daisy->device->tag(), device->tag())) |
| 365 | if (!daisy->m_line[signal]) |
| 280 | 366 | { |
| 281 | | if (daisy->line[line] != state) |
| 282 | | { |
| 283 | | if (LOG) logerror("CBM IEC: '%s' %s %u\n", device->tag(), SIGNAL_NAME[line], state); |
| 284 | | daisy->line[line] = state; |
| 285 | | } |
| 367 | state = 0; |
| 286 | 368 | break; |
| 287 | 369 | } |
| 288 | 370 | } |
| 289 | 371 | |
| 290 | | data = get_signal(iec, line); |
| 291 | | daisy = cbm_iec->daisy_state; |
| 372 | return state; |
| 373 | } |
| 292 | 374 | |
| 293 | | for ( ; daisy != NULL; daisy = daisy->next) |
| 375 | |
| 376 | |
| 377 | //************************************************************************** |
| 378 | // LIVE DEVICE |
| 379 | //************************************************************************** |
| 380 | |
| 381 | //------------------------------------------------- |
| 382 | // cbm_iec_device - constructor |
| 383 | //------------------------------------------------- |
| 384 | |
| 385 | cbm_iec_device::cbm_iec_device(running_machine &_machine, const cbm_iec_device_config &_config) |
| 386 | : device_t(_machine, _config), |
| 387 | m_stub(*this->owner(), CBM_IEC_STUB_TAG), |
| 388 | m_config(_config) |
| 389 | { |
| 390 | } |
| 391 | |
| 392 | |
| 393 | //------------------------------------------------- |
| 394 | // device_start - device-specific startup |
| 395 | //------------------------------------------------- |
| 396 | |
| 397 | void cbm_iec_device::device_start() |
| 398 | { |
| 399 | const cbm_iec_config *daisy = m_config.m_daisy; |
| 400 | |
| 401 | // create a linked list of devices |
| 402 | daisy_entry **tailptr = &m_daisy_list; |
| 403 | for ( ; daisy->m_tag != NULL; daisy++) |
| 294 | 404 | { |
| 295 | | devcb_call_write_line(&daisy->out_line_func[line], data); |
| 405 | // find the device |
| 406 | device_t *target = machine().device(daisy->m_tag); |
| 407 | if (target == NULL) |
| 408 | fatalerror("Unable to locate device '%s'", daisy->m_tag); |
| 409 | |
| 410 | // make sure it has an interface |
| 411 | device_cbm_iec_interface *intf; |
| 412 | if (!target->interface(intf)) |
| 413 | fatalerror("Device '%s' does not implement the CBM IEC interface!", daisy->m_tag); |
| 414 | |
| 415 | // append to the end |
| 416 | *tailptr = auto_alloc(machine(), daisy_entry(target)); |
| 417 | tailptr = &(*tailptr)->m_next; |
| 296 | 418 | } |
| 297 | 419 | |
| 298 | | if (LOG) logerror("CBM IEC: SRQ %u ATN %u CLK %u DATA %u RESET %u\n", get_signal(iec, SRQ),get_signal(iec, ATN),get_signal(iec, CLK),get_signal(iec, DATA),get_signal(iec, RESET)); |
| 420 | // append driver stub to the end |
| 421 | device_t *target = machine().device(CBM_IEC_STUB_TAG); |
| 422 | *tailptr = auto_alloc(machine(), daisy_entry(target)); |
| 423 | tailptr = &(*tailptr)->m_next; |
| 299 | 424 | } |
| 300 | 425 | |
| 301 | | /*************************************************************************** |
| 302 | | IMPLEMENTATION |
| 303 | | ***************************************************************************/ |
| 304 | 426 | |
| 305 | | void cbm_iec_srq_w(device_t *iec, device_t *device, int state) |
| 427 | //------------------------------------------------- |
| 428 | // daisy_entry - constructor |
| 429 | //------------------------------------------------- |
| 430 | |
| 431 | cbm_iec_device::daisy_entry::daisy_entry(device_t *device) |
| 432 | : m_next(NULL), |
| 433 | m_device(device), |
| 434 | m_interface(NULL) |
| 306 | 435 | { |
| 307 | | set_signal(iec, device, SRQ, state); |
| 436 | for (int i = 0; i < SIGNAL_COUNT; i++) |
| 437 | { |
| 438 | m_line[i] = 1; |
| 439 | } |
| 440 | |
| 441 | device->interface(m_interface); |
| 308 | 442 | } |
| 309 | 443 | |
| 310 | | READ_LINE_DEVICE_HANDLER( cbm_iec_srq_r ) |
| 444 | |
| 445 | //------------------------------------------------- |
| 446 | // srq_r - |
| 447 | //------------------------------------------------- |
| 448 | |
| 449 | READ_LINE_MEMBER( cbm_iec_device::srq_r ) |
| 311 | 450 | { |
| 312 | | return get_signal(device, SRQ); |
| 451 | return get_signal(SRQ); |
| 313 | 452 | } |
| 314 | 453 | |
| 315 | | void cbm_iec_atn_w(device_t *iec, device_t *device, int state) |
| 454 | |
| 455 | //------------------------------------------------- |
| 456 | // atn_r - |
| 457 | //------------------------------------------------- |
| 458 | |
| 459 | READ_LINE_MEMBER( cbm_iec_device::atn_r ) |
| 316 | 460 | { |
| 317 | | set_signal(iec, device, ATN, state); |
| 461 | return get_signal(ATN); |
| 318 | 462 | } |
| 319 | 463 | |
| 320 | | READ_LINE_DEVICE_HANDLER( cbm_iec_atn_r ) |
| 464 | |
| 465 | //------------------------------------------------- |
| 466 | // clk_r - |
| 467 | //------------------------------------------------- |
| 468 | |
| 469 | READ_LINE_MEMBER( cbm_iec_device::clk_r ) |
| 321 | 470 | { |
| 322 | | return get_signal(device, ATN); |
| 471 | return get_signal(CLK); |
| 323 | 472 | } |
| 324 | 473 | |
| 325 | | void cbm_iec_clk_w(device_t *iec, device_t *device, int state) |
| 474 | |
| 475 | //------------------------------------------------- |
| 476 | // data_r - |
| 477 | //------------------------------------------------- |
| 478 | |
| 479 | READ_LINE_MEMBER( cbm_iec_device::data_r ) |
| 326 | 480 | { |
| 327 | | set_signal(iec, device, CLK, state); |
| 481 | return get_signal(DATA); |
| 328 | 482 | } |
| 329 | 483 | |
| 330 | | READ_LINE_DEVICE_HANDLER( cbm_iec_clk_r ) |
| 484 | |
| 485 | //------------------------------------------------- |
| 486 | // reset_r - |
| 487 | //------------------------------------------------- |
| 488 | |
| 489 | READ_LINE_MEMBER( cbm_iec_device::reset_r ) |
| 331 | 490 | { |
| 332 | | return get_signal(device, CLK); |
| 491 | return get_signal(RESET); |
| 333 | 492 | } |
| 334 | 493 | |
| 335 | | void cbm_iec_data_w(device_t *iec, device_t *device, int state) |
| 494 | |
| 495 | //------------------------------------------------- |
| 496 | // srq_w - |
| 497 | //------------------------------------------------- |
| 498 | |
| 499 | WRITE_LINE_MEMBER( cbm_iec_device::srq_w ) |
| 336 | 500 | { |
| 337 | | set_signal(iec, device, DATA, state); |
| 501 | set_signal(m_stub, SRQ, state); |
| 338 | 502 | } |
| 339 | 503 | |
| 340 | | READ_LINE_DEVICE_HANDLER( cbm_iec_data_r ) |
| 504 | |
| 505 | //------------------------------------------------- |
| 506 | // atn_w - |
| 507 | //------------------------------------------------- |
| 508 | |
| 509 | WRITE_LINE_MEMBER( cbm_iec_device::atn_w ) |
| 341 | 510 | { |
| 342 | | return get_signal(device, DATA); |
| 511 | set_signal(m_stub, ATN, state); |
| 343 | 512 | } |
| 344 | 513 | |
| 345 | | void cbm_iec_reset_w(device_t *iec, device_t *device, int state) |
| 514 | |
| 515 | //------------------------------------------------- |
| 516 | // clk_w - |
| 517 | //------------------------------------------------- |
| 518 | |
| 519 | WRITE_LINE_MEMBER( cbm_iec_device::clk_w ) |
| 346 | 520 | { |
| 347 | | set_signal(iec, device, RESET, state); |
| 521 | set_signal(m_stub, CLK, state); |
| 348 | 522 | } |
| 349 | 523 | |
| 350 | | READ_LINE_DEVICE_HANDLER( cbm_iec_reset_r ) |
| 524 | |
| 525 | //------------------------------------------------- |
| 526 | // data_w - |
| 527 | //------------------------------------------------- |
| 528 | |
| 529 | WRITE_LINE_MEMBER( cbm_iec_device::data_w ) |
| 351 | 530 | { |
| 352 | | return get_signal(device, RESET); |
| 531 | set_signal(m_stub, DATA, state); |
| 353 | 532 | } |
| 354 | 533 | |
| 355 | | /*------------------------------------------------- |
| 356 | | DEVICE_START( cbm_iec ) |
| 357 | | -------------------------------------------------*/ |
| 358 | 534 | |
| 359 | | static DEVICE_START( cbm_iec ) |
| 535 | //------------------------------------------------- |
| 536 | // reset_w - |
| 537 | //------------------------------------------------- |
| 538 | |
| 539 | WRITE_LINE_MEMBER( cbm_iec_device::reset_w ) |
| 360 | 540 | { |
| 361 | | cbm_iec_t *cbm_iec = get_safe_token(device); |
| 362 | | const cbm_iec_daisy_chain *daisy = get_interface(device); |
| 363 | | int i; |
| 541 | set_signal(m_stub, RESET, state); |
| 542 | } |
| 364 | 543 | |
| 365 | | cbm_iec_daisy_state *head = NULL; |
| 366 | | cbm_iec_daisy_state **tailptr = &head; |
| 367 | 544 | |
| 368 | | /* create a linked list of devices */ |
| 369 | | for ( ; daisy->tag != NULL; daisy++) |
| 370 | | { |
| 371 | | *tailptr = auto_alloc(device->machine(), cbm_iec_daisy_state); |
| 545 | //------------------------------------------------- |
| 546 | // srq_w - |
| 547 | //------------------------------------------------- |
| 372 | 548 | |
| 373 | | (*tailptr)->next = NULL; |
| 374 | | (*tailptr)->device = device->machine().device(daisy->tag); |
| 549 | void cbm_iec_device::srq_w(device_t *device, int state) |
| 550 | { |
| 551 | set_signal(device, SRQ, state); |
| 552 | } |
| 375 | 553 | |
| 376 | | if ((*tailptr)->device == NULL) |
| 377 | | { |
| 378 | | fatalerror("Unable to locate device '%s'", daisy->tag); |
| 379 | | } |
| 380 | 554 | |
| 381 | | for (i = SRQ; i < SIGNAL_COUNT; i++) |
| 382 | | { |
| 383 | | (*tailptr)->line[i] = 1; |
| 384 | | } |
| 555 | //------------------------------------------------- |
| 556 | // atn_w - |
| 557 | //------------------------------------------------- |
| 385 | 558 | |
| 386 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[SRQ], &daisy->out_srq_func, device); |
| 387 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[ATN], &daisy->out_atn_func, device); |
| 388 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[CLK], &daisy->out_clk_func, device); |
| 389 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[DATA], &daisy->out_data_func, device); |
| 390 | | devcb_resolve_write_line(&(*tailptr)->out_line_func[RESET], &daisy->out_reset_func, device); |
| 559 | void cbm_iec_device::atn_w(device_t *device, int state) |
| 560 | { |
| 561 | set_signal(device, ATN, state); |
| 562 | } |
| 391 | 563 | |
| 392 | | tailptr = &(*tailptr)->next; |
| 393 | | } |
| 394 | 564 | |
| 395 | | cbm_iec->daisy_state = head; |
| 565 | //------------------------------------------------- |
| 566 | // clk_w - |
| 567 | //------------------------------------------------- |
| 396 | 568 | |
| 397 | | /* register for state saving */ |
| 398 | | // device->save_item(NAME(cbm_iec->)); |
| 569 | void cbm_iec_device::clk_w(device_t *device, int state) |
| 570 | { |
| 571 | set_signal(device, CLK, state); |
| 399 | 572 | } |
| 400 | 573 | |
| 401 | | /*------------------------------------------------- |
| 402 | | DEVICE_GET_INFO( cbm_iec ) |
| 403 | | -------------------------------------------------*/ |
| 404 | 574 | |
| 405 | | DEVICE_GET_INFO( cbm_iec ) |
| 575 | //------------------------------------------------- |
| 576 | // data_w - |
| 577 | //------------------------------------------------- |
| 578 | |
| 579 | void cbm_iec_device::data_w(device_t *device, int state) |
| 406 | 580 | { |
| 407 | | switch (state) |
| 408 | | { |
| 409 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 410 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cbm_iec_t); break; |
| 411 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 581 | set_signal(device, DATA, state); |
| 582 | } |
| 412 | 583 | |
| 413 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 414 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cbm_iec); break; |
| 415 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 416 | | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 417 | 584 | |
| 418 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 419 | | case DEVINFO_STR_NAME: strcpy(info->s, "Commodore Serial Bus"); break; |
| 420 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "IEEE-488"); break; |
| 421 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 422 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 423 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 424 | | } |
| 585 | //------------------------------------------------- |
| 586 | // reset_w - |
| 587 | //------------------------------------------------- |
| 588 | |
| 589 | void cbm_iec_device::reset_w(device_t *device, int state) |
| 590 | { |
| 591 | set_signal(device, RESET, state); |
| 425 | 592 | } |
| 426 | | |
| 427 | | DEFINE_LEGACY_DEVICE(CBM_IEC, cbm_iec); |
src/mess/machine/cbmiec.h
| r11256 | r11257 | |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | #pragma once |
| 11 | |
| 10 | 12 | #ifndef __CBM_IEC__ |
| 11 | 13 | #define __CBM_IEC__ |
| 12 | 14 | |
| 13 | 15 | #include "emu.h" |
| 14 | 16 | |
| 15 | | /*************************************************************************** |
| 16 | | MACROS / CONSTANTS |
| 17 | | ***************************************************************************/ |
| 18 | 17 | |
| 19 | | DECLARE_LEGACY_DEVICE(CBM_IEC, cbm_iec); |
| 20 | 18 | |
| 21 | | #define MCFG_CBM_IEC_ADD(_tag, _daisy_chain) \ |
| 22 | | MCFG_DEVICE_ADD(_tag, CBM_IEC, 0) \ |
| 23 | | MCFG_DEVICE_CONFIG(_daisy_chain) |
| 19 | //************************************************************************** |
| 20 | // MACROS / CONSTANTS |
| 21 | //************************************************************************** |
| 24 | 22 | |
| 23 | #define CBM_IEC_TAG "iec_bus" |
| 24 | #define CBM_IEC_STUB_TAG "iec_stub" |
| 25 | |
| 26 | |
| 27 | |
| 28 | //************************************************************************** |
| 29 | // INTERFACE CONFIGURATION MACROS |
| 30 | //************************************************************************** |
| 31 | |
| 32 | #define MCFG_CBM_IEC_ADD(_daisy) \ |
| 33 | MCFG_DEVICE_ADD(CBM_IEC_STUB_TAG, CBM_IEC_STUB, 0) \ |
| 34 | MCFG_DEVICE_CONFIG(default_cbm_iec_stub_interface) \ |
| 35 | MCFG_DEVICE_ADD(CBM_IEC_TAG, CBM_IEC, 0) \ |
| 36 | MCFG_DEVICE_CONFIG(_daisy) |
| 37 | |
| 38 | |
| 39 | #define MCFG_CBM_IEC_CONFIG_ADD(_daisy, _config) \ |
| 40 | MCFG_DEVICE_ADD(CBM_IEC_STUB_TAG, CBM_IEC_STUB, 0) \ |
| 41 | MCFG_DEVICE_CONFIG(_config) \ |
| 42 | MCFG_DEVICE_ADD(CBM_IEC_TAG, CBM_IEC, 0) \ |
| 43 | MCFG_DEVICE_CONFIG(_daisy) |
| 44 | |
| 45 | |
| 46 | #define MCFG_CBM_IEC_REMOVE() \ |
| 47 | MCFG_DEVICE_REMOVE(CBM_IEC_STUB_TAG) \ |
| 48 | MCFG_DEVICE_REMOVE(CBM_IEC_TAG) |
| 49 | |
| 50 | |
| 25 | 51 | #define CBM_IEC_DAISY(_name) \ |
| 26 | | const cbm_iec_daisy_chain (_name)[] = |
| 52 | const cbm_iec_config (_name)[] = |
| 27 | 53 | |
| 28 | | /*************************************************************************** |
| 29 | | TYPE DEFINITIONS |
| 30 | | ***************************************************************************/ |
| 31 | 54 | |
| 32 | | typedef struct _cbm_iec_daisy_chain cbm_iec_daisy_chain; |
| 33 | | struct _cbm_iec_daisy_chain |
| 55 | #define CBM_IEC_INTERFACE(_name) \ |
| 56 | const cbm_iec_stub_interface (_name) = |
| 57 | |
| 58 | |
| 59 | |
| 60 | //************************************************************************** |
| 61 | // TYPE DEFINITIONS |
| 62 | //************************************************************************** |
| 63 | |
| 64 | // ======================> cbm_iec_config |
| 65 | |
| 66 | struct cbm_iec_config |
| 34 | 67 | { |
| 35 | | const char *tag; /* device tag */ |
| 68 | const char *m_tag; |
| 69 | }; |
| 36 | 70 | |
| 37 | | devcb_write_line out_srq_func; |
| 38 | | devcb_write_line out_atn_func; |
| 39 | | devcb_write_line out_clk_func; |
| 40 | | devcb_write_line out_data_func; |
| 41 | | devcb_write_line out_reset_func; |
| 71 | |
| 72 | // ======================> device_config_cbm_iec_interface |
| 73 | |
| 74 | // device_config_cbm_iec_interface represents configuration information for a cbm_iec device |
| 75 | class device_config_cbm_iec_interface : public device_config_interface |
| 76 | { |
| 77 | public: |
| 78 | // construction/destruction |
| 79 | device_config_cbm_iec_interface(const machine_config &mconfig, device_config &devconfig); |
| 80 | virtual ~device_config_cbm_iec_interface(); |
| 42 | 81 | }; |
| 43 | 82 | |
| 44 | | /*************************************************************************** |
| 45 | | PROTOTYPES |
| 46 | | ***************************************************************************/ |
| 47 | | /* service request */ |
| 48 | | void cbm_iec_srq_w(device_t *iec, device_t *device, int state); |
| 49 | | READ_LINE_DEVICE_HANDLER( cbm_iec_srq_r ); |
| 50 | 83 | |
| 51 | | /* attention */ |
| 52 | | void cbm_iec_atn_w(device_t *iec, device_t *device, int state); |
| 53 | | READ_LINE_DEVICE_HANDLER( cbm_iec_atn_r ); |
| 84 | // ======================> device_cbm_iec_interface |
| 54 | 85 | |
| 55 | | /* clock */ |
| 56 | | void cbm_iec_clk_w(device_t *iec, device_t *device, int state); |
| 57 | | READ_LINE_DEVICE_HANDLER( cbm_iec_clk_r ); |
| 86 | class device_cbm_iec_interface : public device_interface |
| 87 | { |
| 88 | public: |
| 89 | // construction/destruction |
| 90 | device_cbm_iec_interface(running_machine &machine, const device_config &config, device_t &device); |
| 91 | virtual ~device_cbm_iec_interface(); |
| 58 | 92 | |
| 59 | | /* data */ |
| 60 | | void cbm_iec_data_w(device_t *iec, device_t *device, int state); |
| 61 | | READ_LINE_DEVICE_HANDLER( cbm_iec_data_r ); |
| 93 | // optional operation overrides |
| 94 | virtual void cbm_iec_atn(int state) { }; |
| 95 | virtual void cbm_iec_clk(int state) { }; |
| 96 | virtual void cbm_iec_data(int state) { }; |
| 97 | virtual void cbm_iec_srq(int state) { }; |
| 98 | virtual void cbm_iec_reset(int state) { }; |
| 62 | 99 | |
| 63 | | /* reset */ |
| 64 | | void cbm_iec_reset_w(device_t *iec, device_t *device, int state); |
| 65 | | READ_LINE_DEVICE_HANDLER( cbm_iec_reset_r ); |
| 100 | protected: |
| 101 | const device_config_cbm_iec_interface &m_cbm_iec_config; |
| 102 | }; |
| 66 | 103 | |
| 104 | |
| 105 | // ======================> cbm_iec_device_config |
| 106 | |
| 107 | class cbm_iec_device_config : public device_config, |
| 108 | public cbm_iec_config |
| 109 | { |
| 110 | friend class cbm_iec_device; |
| 111 | |
| 112 | // construction/destruction |
| 113 | cbm_iec_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 114 | |
| 115 | public: |
| 116 | // allocators |
| 117 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 118 | virtual device_t *alloc_device(running_machine &machine) const; |
| 119 | |
| 120 | protected: |
| 121 | // device_config overrides |
| 122 | virtual void device_config_complete(); |
| 123 | |
| 124 | private: |
| 125 | const cbm_iec_config *m_daisy; |
| 126 | }; |
| 127 | |
| 128 | |
| 129 | // ======================> cbm_iec_device |
| 130 | |
| 131 | class cbm_iec_stub_device; |
| 132 | |
| 133 | class cbm_iec_device : public device_t |
| 134 | { |
| 135 | friend class cbm_iec_device_config; |
| 136 | |
| 137 | // construction/destruction |
| 138 | cbm_iec_device(running_machine &_machine, const cbm_iec_device_config &_config); |
| 139 | |
| 140 | public: |
| 141 | // reads for both host and peripherals |
| 142 | DECLARE_READ_LINE_MEMBER( srq_r ); |
| 143 | DECLARE_READ_LINE_MEMBER( atn_r ); |
| 144 | DECLARE_READ_LINE_MEMBER( clk_r ); |
| 145 | DECLARE_READ_LINE_MEMBER( data_r ); |
| 146 | DECLARE_READ_LINE_MEMBER( reset_r ); |
| 147 | |
| 148 | // writes for host (driver_device) |
| 149 | DECLARE_WRITE_LINE_MEMBER( srq_w ); |
| 150 | DECLARE_WRITE_LINE_MEMBER( atn_w ); |
| 151 | DECLARE_WRITE_LINE_MEMBER( clk_w ); |
| 152 | DECLARE_WRITE_LINE_MEMBER( data_w ); |
| 153 | DECLARE_WRITE_LINE_MEMBER( reset_w ); |
| 154 | |
| 155 | // writes for peripherals (device_t) |
| 156 | void srq_w(device_t *device, int state); |
| 157 | void atn_w(device_t *device, int state); |
| 158 | void clk_w(device_t *device, int state); |
| 159 | void data_w(device_t *device, int state); |
| 160 | void reset_w(device_t *device, int state); |
| 161 | |
| 162 | protected: |
| 163 | enum |
| 164 | { |
| 165 | SRQ = 0, |
| 166 | ATN, |
| 167 | CLK, |
| 168 | DATA, |
| 169 | RESET, |
| 170 | SIGNAL_COUNT |
| 171 | }; |
| 172 | |
| 173 | // device-level overrides |
| 174 | virtual void device_start(); |
| 175 | |
| 176 | class daisy_entry |
| 177 | { |
| 178 | public: |
| 179 | daisy_entry(device_t *device); |
| 180 | |
| 181 | daisy_entry * m_next; // next device |
| 182 | device_t * m_device; // associated device |
| 183 | device_cbm_iec_interface * m_interface; // associated device's daisy interface |
| 184 | |
| 185 | int m_line[SIGNAL_COUNT]; |
| 186 | }; |
| 187 | |
| 188 | daisy_entry * m_daisy_list; // head of the daisy chain |
| 189 | |
| 190 | private: |
| 191 | inline void set_signal(device_t *device, int signal, int state); |
| 192 | inline int get_signal(int signal); |
| 193 | |
| 194 | required_device<cbm_iec_stub_device> m_stub; |
| 195 | |
| 196 | const cbm_iec_device_config &m_config; |
| 197 | }; |
| 198 | |
| 199 | |
| 200 | // ======================> cbm_iec_stub_interface |
| 201 | |
| 202 | struct cbm_iec_stub_interface |
| 203 | { |
| 204 | devcb_write_line m_out_srq_func; |
| 205 | devcb_write_line m_out_atn_func; |
| 206 | devcb_write_line m_out_clk_func; |
| 207 | devcb_write_line m_out_data_func; |
| 208 | devcb_write_line m_out_reset_func; |
| 209 | }; |
| 210 | |
| 211 | const cbm_iec_stub_interface default_cbm_iec_stub_interface = { DEVCB_NULL, }; |
| 212 | |
| 213 | |
| 214 | // ======================> cbm_iec_stub_device_config |
| 215 | |
| 216 | class cbm_iec_stub_device_config : public device_config, |
| 217 | public cbm_iec_stub_interface, |
| 218 | public device_config_cbm_iec_interface |
| 219 | { |
| 220 | friend class cbm_iec_stub_device; |
| 221 | |
| 222 | // construction/destruction |
| 223 | cbm_iec_stub_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 224 | |
| 225 | public: |
| 226 | // allocators |
| 227 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 228 | virtual device_t *alloc_device(running_machine &machine) const; |
| 229 | |
| 230 | protected: |
| 231 | // device_config overrides |
| 232 | virtual void device_config_complete(); |
| 233 | }; |
| 234 | |
| 235 | |
| 236 | // ======================> cbm_iec_stub_device |
| 237 | |
| 238 | class cbm_iec_stub_device : public device_t, |
| 239 | public device_cbm_iec_interface |
| 240 | { |
| 241 | friend class cbm_iec_stub_device_config; |
| 242 | |
| 243 | // construction/destruction |
| 244 | cbm_iec_stub_device(running_machine &_machine, const cbm_iec_stub_device_config &_config); |
| 245 | |
| 246 | protected: |
| 247 | // device-level overrides |
| 248 | virtual void device_start(); |
| 249 | |
| 250 | // device_cbm_iec_interface overrides |
| 251 | void cbm_iec_atn(int state); |
| 252 | void cbm_iec_clk(int state); |
| 253 | void cbm_iec_data(int state); |
| 254 | void cbm_iec_srq(int state); |
| 255 | void cbm_iec_reset(int state); |
| 256 | |
| 257 | private: |
| 258 | devcb_resolved_write_line m_out_atn_func; |
| 259 | devcb_resolved_write_line m_out_clk_func; |
| 260 | devcb_resolved_write_line m_out_data_func; |
| 261 | devcb_resolved_write_line m_out_srq_func; |
| 262 | devcb_resolved_write_line m_out_reset_func; |
| 263 | |
| 264 | const cbm_iec_stub_device_config &m_config; |
| 265 | }; |
| 266 | |
| 267 | |
| 268 | // device type definition |
| 269 | extern const device_type CBM_IEC; |
| 270 | extern const device_type CBM_IEC_STUB; |
| 271 | |
| 272 | |
| 67 | 273 | #endif |
src/mess/machine/c1581.c
| r11256 | r11257 | |
| 48 | 48 | // DEVICE CONFIGURATION |
| 49 | 49 | //************************************************************************** |
| 50 | 50 | |
| 51 | | GENERIC_DEVICE_CONFIG_SETUP(c1581, "C1581"); |
| 52 | 51 | |
| 52 | //------------------------------------------------- |
| 53 | // c1581_device_config - constructor |
| 54 | //------------------------------------------------- |
| 53 | 55 | |
| 56 | c1581_device_config::c1581_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 57 | : device_config(mconfig, static_alloc_device_config, "C1581", tag, owner, clock), |
| 58 | device_config_cbm_iec_interface(mconfig, *this) |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | |
| 54 | 63 | //------------------------------------------------- |
| 64 | // static_alloc_device_config - allocate a new |
| 65 | // configuration object |
| 66 | //------------------------------------------------- |
| 67 | |
| 68 | device_config *c1581_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 69 | { |
| 70 | return global_alloc(c1581_device_config(mconfig, tag, owner, clock)); |
| 71 | } |
| 72 | |
| 73 | |
| 74 | //------------------------------------------------- |
| 75 | // alloc_device - allocate a new device object |
| 76 | //------------------------------------------------- |
| 77 | |
| 78 | device_t *c1581_device_config::alloc_device(running_machine &machine) const |
| 79 | { |
| 80 | return auto_alloc(machine, c1581_device(machine, *this)); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | //------------------------------------------------- |
| 55 | 85 | // device_config_complete - perform any |
| 56 | 86 | // operations now that the configuration is |
| 57 | 87 | // complete |
| r11256 | r11257 | |
| 67 | 97 | // static_set_config - configuration helper |
| 68 | 98 | //------------------------------------------------- |
| 69 | 99 | |
| 70 | | void c1581_device_config::static_set_config(device_config *device, const char *bus_tag, int address) |
| 100 | void c1581_device_config::static_set_config(device_config *device, int address) |
| 71 | 101 | { |
| 72 | 102 | c1581_device_config *c1581 = downcast<c1581_device_config *>(device); |
| 73 | 103 | |
| 74 | | assert(bus_tag != NULL); |
| 75 | 104 | assert((address > 7) && (address < 12)); |
| 76 | 105 | |
| 77 | | c1581->m_bus_tag = bus_tag; |
| 78 | 106 | c1581->m_address = address - 8; |
| 79 | 107 | } |
| 80 | 108 | |
| r11256 | r11257 | |
| 224 | 252 | UINT8 data = 0; |
| 225 | 253 | |
| 226 | 254 | // data in |
| 227 | | data = !cbm_iec_data_r(m_bus); |
| 255 | data = !m_bus->data_r(); |
| 228 | 256 | |
| 229 | 257 | // clock in |
| 230 | | data |= !cbm_iec_clk_r(m_bus) << 2; |
| 258 | data |= !m_bus->clk_r() << 2; |
| 231 | 259 | |
| 232 | 260 | // write protect |
| 233 | 261 | data |= !floppy_wpt_r(m_image) << 6; |
| 234 | 262 | |
| 235 | 263 | // attention in |
| 236 | | data |= !cbm_iec_atn_r(m_bus) << 7; |
| 264 | data |= !m_bus->atn_r() << 7; |
| 237 | 265 | |
| 238 | 266 | return data; |
| 239 | 267 | } |
| r11256 | r11257 | |
| 260 | 288 | m_data_out = BIT(data, 1); |
| 261 | 289 | |
| 262 | 290 | // clock out |
| 263 | | cbm_iec_clk_w(m_bus, this, !BIT(data, 3)); |
| 291 | m_bus->clk_w(this, !BIT(data, 3)); |
| 264 | 292 | |
| 265 | 293 | // attention acknowledge |
| 266 | 294 | m_atn_ack = BIT(data, 4); |
| r11256 | r11257 | |
| 363 | 391 | |
| 364 | 392 | inline void c1581_device::set_iec_data() |
| 365 | 393 | { |
| 366 | | int atn = cbm_iec_atn_r(m_bus); |
| 394 | int atn = m_bus->atn_r(); |
| 367 | 395 | int data = !m_data_out & !(m_atn_ack & !atn); |
| 368 | 396 | |
| 369 | 397 | // fast serial data |
| 370 | 398 | if (m_fast_ser_dir) data &= m_sp_out; |
| 371 | 399 | |
| 372 | | cbm_iec_data_w(m_bus, this, data); |
| 400 | m_bus->data_w(this, data); |
| 373 | 401 | } |
| 374 | 402 | |
| 375 | 403 | |
| r11256 | r11257 | |
| 384 | 412 | // fast serial clock |
| 385 | 413 | if (m_fast_ser_dir) srq &= m_cnt_out; |
| 386 | 414 | |
| 387 | | cbm_iec_srq_w(m_bus, this, srq); |
| 415 | m_bus->srq_w(this, srq); |
| 388 | 416 | } |
| 389 | 417 | |
| 390 | 418 | |
| r11256 | r11257 | |
| 399 | 427 | |
| 400 | 428 | c1581_device::c1581_device(running_machine &_machine, const c1581_device_config &_config) |
| 401 | 429 | : device_t(_machine, _config), |
| 430 | device_cbm_iec_interface(_machine, _config, *this), |
| 402 | 431 | m_maincpu(*this, M6502_TAG), |
| 403 | 432 | m_cia(*this, M8520_TAG), |
| 404 | 433 | m_fdc(*this, WD1770_TAG), |
| 405 | 434 | m_image(*this, FLOPPY_0), |
| 406 | | m_bus(machine().device(_config.m_bus_tag)), |
| 435 | m_bus(machine().device<cbm_iec_device>(CBM_IEC_TAG)), |
| 407 | 436 | m_config(_config) |
| 408 | 437 | { |
| 409 | 438 | } |
| r11256 | r11257 | |
| 436 | 465 | |
| 437 | 466 | |
| 438 | 467 | //------------------------------------------------- |
| 439 | | // iec_atn_w - |
| 468 | // cbm_iec_srq - |
| 440 | 469 | //------------------------------------------------- |
| 441 | 470 | |
| 442 | | WRITE_LINE_MEMBER( c1581_device::iec_atn_w ) |
| 471 | void c1581_device::cbm_iec_srq(int state) |
| 443 | 472 | { |
| 444 | | m_cia->flag_w(state); |
| 445 | | |
| 446 | | set_iec_data(); |
| 473 | if (!m_fast_ser_dir) |
| 474 | { |
| 475 | m_cia->cnt_w(state); |
| 476 | } |
| 447 | 477 | } |
| 448 | 478 | |
| 449 | 479 | |
| 450 | 480 | //------------------------------------------------- |
| 451 | | // iec_srq_w - |
| 481 | // cbm_iec_atn - |
| 452 | 482 | //------------------------------------------------- |
| 453 | 483 | |
| 454 | | WRITE_LINE_MEMBER( c1581_device::iec_srq_w ) |
| 484 | void c1581_device::cbm_iec_atn(int state) |
| 455 | 485 | { |
| 456 | | if (!m_fast_ser_dir) |
| 457 | | { |
| 458 | | m_cia->cnt_w(state); |
| 459 | | } |
| 486 | m_cia->flag_w(state); |
| 487 | |
| 488 | set_iec_data(); |
| 460 | 489 | } |
| 461 | 490 | |
| 462 | 491 | |
| 463 | 492 | //------------------------------------------------- |
| 464 | | // iec_data_w - |
| 493 | // cbm_iec_data - |
| 465 | 494 | //------------------------------------------------- |
| 466 | 495 | |
| 467 | | WRITE_LINE_MEMBER( c1581_device::iec_data_w ) |
| 496 | void c1581_device::cbm_iec_data(int state) |
| 468 | 497 | { |
| 469 | 498 | if (!m_fast_ser_dir) |
| 470 | 499 | { |
| r11256 | r11257 | |
| 474 | 503 | |
| 475 | 504 | |
| 476 | 505 | //------------------------------------------------- |
| 477 | | // iec_reset_w - |
| 506 | // cbm_iec_reset - |
| 478 | 507 | //------------------------------------------------- |
| 479 | | WRITE_LINE_MEMBER( c1581_device::iec_reset_w ) |
| 508 | |
| 509 | void c1581_device::cbm_iec_reset(int state) |
| 480 | 510 | { |
| 481 | 511 | if (!state) |
| 482 | 512 | { |
src/mess/machine/c1581.h
| r11256 | r11257 | |
| 21 | 21 | #include "machine/6526cia.h" |
| 22 | 22 | #include "machine/cbmiec.h" |
| 23 | 23 | #include "machine/wd17xx.h" |
| 24 | | #include "machine/devhelpr.h" |
| 25 | 24 | |
| 26 | 25 | |
| 27 | 26 | |
| r11256 | r11257 | |
| 29 | 28 | // INTERFACE CONFIGURATION MACROS |
| 30 | 29 | //************************************************************************** |
| 31 | 30 | |
| 32 | | #define MCFG_C1581_ADD(_tag, _bus_tag, _address) \ |
| 31 | #define MCFG_C1581_ADD(_tag, _address) \ |
| 33 | 32 | MCFG_DEVICE_ADD(_tag, C1581, 0) \ |
| 34 | | c1581_device_config::static_set_config(device, _bus_tag, _address); |
| 33 | c1581_device_config::static_set_config(device, _address); |
| 35 | 34 | |
| 36 | 35 | |
| 37 | | #define C1581_IEC(_tag) \ |
| 38 | | _tag, \ |
| 39 | | DEVCB_DEVICE_LINE_MEMBER(_tag, c1581_device, iec_srq_w), \ |
| 40 | | DEVCB_DEVICE_LINE_MEMBER(_tag, c1581_device, iec_atn_w), \ |
| 41 | | DEVCB_NULL, \ |
| 42 | | DEVCB_DEVICE_LINE_MEMBER(_tag, c1581_device, iec_data_w), \ |
| 43 | | DEVCB_DEVICE_LINE_MEMBER(_tag, c1581_device, iec_reset_w) |
| 44 | 36 | |
| 45 | | |
| 46 | | |
| 47 | 37 | //************************************************************************** |
| 48 | 38 | // TYPE DEFINITIONS |
| 49 | 39 | //************************************************************************** |
| 50 | 40 | |
| 51 | 41 | // ======================> c1581_device_config |
| 52 | 42 | |
| 53 | | class c1581_device_config : public device_config |
| 43 | class c1581_device_config : public device_config, |
| 44 | public device_config_cbm_iec_interface |
| 54 | 45 | { |
| 55 | 46 | friend class c1581_device; |
| 56 | 47 | |
| r11256 | r11257 | |
| 63 | 54 | virtual device_t *alloc_device(running_machine &machine) const; |
| 64 | 55 | |
| 65 | 56 | // inline configuration helpers |
| 66 | | static void static_set_config(device_config *device, const char *bus_tag, int address); |
| 57 | static void static_set_config(device_config *device, int address); |
| 67 | 58 | |
| 68 | 59 | // optional information overrides |
| 69 | 60 | virtual const rom_entry *device_rom_region() const; |
| r11256 | r11257 | |
| 74 | 65 | virtual void device_config_complete(); |
| 75 | 66 | |
| 76 | 67 | private: |
| 77 | | const char *m_bus_tag; |
| 78 | 68 | int m_address; |
| 79 | 69 | }; |
| 80 | 70 | |
| 81 | 71 | |
| 82 | 72 | // ======================> c1581_device |
| 83 | 73 | |
| 84 | | class c1581_device : public device_t |
| 74 | class c1581_device : public device_t, |
| 75 | public device_cbm_iec_interface |
| 85 | 76 | { |
| 86 | 77 | friend class c1581_device_config; |
| 87 | 78 | |
| r11256 | r11257 | |
| 89 | 80 | c1581_device(running_machine &_machine, const c1581_device_config &_config); |
| 90 | 81 | |
| 91 | 82 | public: |
| 92 | | DECLARE_WRITE_LINE_MEMBER( iec_atn_w ); |
| 93 | | DECLARE_WRITE_LINE_MEMBER( iec_srq_w ); |
| 94 | | DECLARE_WRITE_LINE_MEMBER( iec_data_w ); |
| 95 | | DECLARE_WRITE_LINE_MEMBER( iec_reset_w ); |
| 96 | | |
| 97 | 83 | // not really public |
| 98 | 84 | DECLARE_WRITE_LINE_MEMBER( cnt_w ); |
| 99 | 85 | DECLARE_WRITE_LINE_MEMBER( sp_w ); |
| r11256 | r11257 | |
| 107 | 93 | virtual void device_start(); |
| 108 | 94 | virtual void device_reset(); |
| 109 | 95 | |
| 96 | // device_cbm_iec_interface overrides |
| 97 | void cbm_iec_srq(int state); |
| 98 | void cbm_iec_atn(int state); |
| 99 | void cbm_iec_data(int state); |
| 100 | void cbm_iec_reset(int state); |
| 101 | |
| 110 | 102 | private: |
| 111 | 103 | inline void set_iec_data(); |
| 112 | 104 | inline void set_iec_srq(); |
| r11256 | r11257 | |
| 115 | 107 | required_device<mos6526_device> m_cia; |
| 116 | 108 | required_device<device_t> m_fdc; |
| 117 | 109 | required_device<device_t> m_image; |
| 118 | | device_t *m_bus; |
| 110 | cbm_iec_device *m_bus; |
| 119 | 111 | |
| 120 | 112 | int m_data_out; // serial data out |
| 121 | 113 | int m_atn_ack; // attention acknowledge |
src/mess/machine/c1541.c
| r11256 | r11257 | |
| 135 | 135 | */ |
| 136 | 136 | |
| 137 | 137 | #include "c1541.h" |
| 138 | | #include "machine/devhelpr.h" |
| 139 | 138 | |
| 140 | 139 | |
| 141 | 140 | |
| r11256 | r11257 | |
| 175 | 174 | // DEVICE CONFIGURATION |
| 176 | 175 | //************************************************************************** |
| 177 | 176 | |
| 178 | | GENERIC_DEVICE_CONFIG_SETUP(c1541, "C1541"); |
| 177 | //------------------------------------------------- |
| 178 | // c1541_device_config - constructor |
| 179 | //------------------------------------------------- |
| 179 | 180 | |
| 181 | c1541_device_config::c1541_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 182 | : device_config(mconfig, static_alloc_device_config, "C1541", tag, owner, clock), |
| 183 | device_config_cbm_iec_interface(mconfig, *this) |
| 184 | { |
| 185 | } |
| 180 | 186 | |
| 187 | |
| 181 | 188 | //------------------------------------------------- |
| 189 | // static_alloc_device_config - allocate a new |
| 190 | // configuration object |
| 191 | //------------------------------------------------- |
| 192 | |
| 193 | device_config *c1541_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 194 | { |
| 195 | return global_alloc(c1541_device_config(mconfig, tag, owner, clock)); |
| 196 | } |
| 197 | |
| 198 | |
| 199 | //------------------------------------------------- |
| 200 | // alloc_device - allocate a new device object |
| 201 | //------------------------------------------------- |
| 202 | |
| 203 | device_t *c1541_device_config::alloc_device(running_machine &machine) const |
| 204 | { |
| 205 | return auto_alloc(machine, c1541_device(machine, *this)); |
| 206 | } |
| 207 | |
| 208 | |
| 209 | //------------------------------------------------- |
| 182 | 210 | // device_config_complete - perform any |
| 183 | 211 | // operations now that the configuration is |
| 184 | 212 | // complete |
| r11256 | r11257 | |
| 194 | 222 | // static_set_config - configuration helper |
| 195 | 223 | //------------------------------------------------- |
| 196 | 224 | |
| 197 | | void c1541_device_config::static_set_config(device_config *device, const char *bus_tag, int address) |
| 225 | void c1541_device_config::static_set_config(device_config *device, int address) |
| 198 | 226 | { |
| 199 | 227 | c1541_device_config *c1541 = downcast<c1541_device_config *>(device); |
| 200 | 228 | |
| 201 | | assert(bus_tag != NULL); |
| 202 | 229 | assert((address > 7) && (address < 12)); |
| 203 | 230 | |
| 204 | | c1541->m_bus_tag = bus_tag; |
| 205 | 231 | c1541->m_address = address - 8; |
| 206 | 232 | } |
| 207 | 233 | |
| r11256 | r11257 | |
| 311 | 337 | UINT8 data = 0; |
| 312 | 338 | |
| 313 | 339 | // data in |
| 314 | | data = !cbm_iec_data_r(m_bus); |
| 340 | data = !m_bus->data_r(); |
| 315 | 341 | |
| 316 | 342 | // clock in |
| 317 | | data |= !cbm_iec_clk_r(m_bus) << 2; |
| 343 | data |= !m_bus->clk_r() << 2; |
| 318 | 344 | |
| 319 | 345 | // serial bus address |
| 320 | 346 | data |= m_config.m_address << 5; |
| 321 | 347 | |
| 322 | 348 | // attention in |
| 323 | | data |= !cbm_iec_atn_r(m_bus) << 7; |
| 349 | data |= !m_bus->atn_r() << 7; |
| 324 | 350 | |
| 325 | 351 | return data; |
| 326 | 352 | } |
| r11256 | r11257 | |
| 350 | 376 | m_ga->atna_w(BIT(data, 4)); |
| 351 | 377 | |
| 352 | 378 | // clock out |
| 353 | | cbm_iec_clk_w(m_bus, this, !BIT(data, 3)); |
| 379 | m_bus->clk_w(this, !BIT(data, 3)); |
| 354 | 380 | } |
| 355 | 381 | |
| 356 | 382 | |
| 357 | 383 | READ_LINE_MEMBER( c1541_device::atn_in_r ) |
| 358 | 384 | { |
| 359 | | return !cbm_iec_atn_r(m_bus); |
| 385 | return !m_bus->atn_r(); |
| 360 | 386 | } |
| 361 | 387 | |
| 362 | 388 | |
| r11256 | r11257 | |
| 784 | 810 | { |
| 785 | 811 | int data = !m_data_out & !m_ga->atn_r(); |
| 786 | 812 | |
| 787 | | cbm_iec_data_w(m_bus, this, data); |
| 813 | m_bus->data_w(this, data); |
| 788 | 814 | } |
| 789 | 815 | |
| 790 | 816 | |
| r11256 | r11257 | |
| 799 | 825 | |
| 800 | 826 | c1541_device::c1541_device(running_machine &_machine, const c1541_device_config &_config) |
| 801 | 827 | : device_t(_machine, _config), |
| 828 | device_cbm_iec_interface(_machine, _config, *this), |
| 802 | 829 | m_maincpu(*this, M6502_TAG), |
| 803 | 830 | m_via0(*this, M6522_0_TAG), |
| 804 | 831 | m_via1(*this, M6522_1_TAG), |
| 805 | 832 | m_ga(*this, C64H156_TAG), |
| 806 | 833 | m_image(*this, FLOPPY_0), |
| 807 | | m_bus(machine().device(_config.m_bus_tag)), |
| 834 | m_bus(machine().device<cbm_iec_device>(CBM_IEC_TAG)), |
| 808 | 835 | m_data_out(1), |
| 809 | 836 | m_via0_irq(0), |
| 810 | 837 | m_via1_irq(0), |
| r11256 | r11257 | |
| 843 | 870 | // iec_atn_w - |
| 844 | 871 | //------------------------------------------------- |
| 845 | 872 | |
| 846 | | WRITE_LINE_MEMBER( c1541_device::iec_atn_w ) |
| 873 | void c1541_device::cbm_iec_atn(int state) |
| 847 | 874 | { |
| 848 | 875 | m_via0->write_ca1(!state); |
| 849 | 876 | m_ga->atni_w(!state); |
| r11256 | r11257 | |
| 856 | 883 | // iec_reset_w - |
| 857 | 884 | //------------------------------------------------- |
| 858 | 885 | |
| 859 | | WRITE_LINE_MEMBER( c1541_device::iec_reset_w ) |
| 886 | void c1541_device::cbm_iec_reset(int state) |
| 860 | 887 | { |
| 861 | 888 | if (!state) |
| 862 | 889 | { |
src/mess/machine/iecstub.c
| r0 | r11257 | |
| 1 | #include "cbmiec.h" |
| 2 | |
| 3 | |
| 4 | |
| 5 | //************************************************************************** |
| 6 | // DEVICE DEFINITIONS |
| 7 | //************************************************************************** |
| 8 | |
| 9 | const device_type CBM_IEC_STUB = cbm_iec_stub_device_config::static_alloc_device_config; |
| 10 | |
| 11 | |
| 12 | |
| 13 | //************************************************************************** |
| 14 | // DEVICE CONFIGURATION |
| 15 | //************************************************************************** |
| 16 | |
| 17 | //------------------------------------------------- |
| 18 | // cbm_iec_stub_device_config - constructor |
| 19 | //------------------------------------------------- |
| 20 | |
| 21 | cbm_iec_stub_device_config::cbm_iec_stub_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 22 | : device_config(mconfig, static_alloc_device_config, "CBM IEC driver stub", tag, owner, clock), |
| 23 | device_config_cbm_iec_interface(mconfig, *this) |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | |
| 28 | //------------------------------------------------- |
| 29 | // static_alloc_device_config - allocate a new |
| 30 | // configuration object |
| 31 | //------------------------------------------------- |
| 32 | |
| 33 | device_config *cbm_iec_stub_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 34 | { |
| 35 | return global_alloc(cbm_iec_stub_device_config(mconfig, tag, owner, clock)); |
| 36 | } |
| 37 | |
| 38 | |
| 39 | //------------------------------------------------- |
| 40 | // alloc_device - allocate a new device object |
| 41 | //------------------------------------------------- |
| 42 | |
| 43 | device_t *cbm_iec_stub_device_config::alloc_device(running_machine &machine) const |
| 44 | { |
| 45 | return auto_alloc(machine, cbm_iec_stub_device(machine, *this)); |
| 46 | } |
| 47 | |
| 48 | |
| 49 | //------------------------------------------------- |
| 50 | // device_config_complete - perform any |
| 51 | // operations now that the configuration is |
| 52 | // complete |
| 53 | //------------------------------------------------- |
| 54 | |
| 55 | void cbm_iec_stub_device_config::device_config_complete() |
| 56 | { |
| 57 | // inherit a copy of the static data |
| 58 | const cbm_iec_stub_interface *intf = reinterpret_cast<const cbm_iec_stub_interface *>(static_config()); |
| 59 | if (intf != NULL) |
| 60 | *static_cast<cbm_iec_stub_interface *>(this) = *intf; |
| 61 | |
| 62 | // or initialize to defaults if none provided |
| 63 | else |
| 64 | { |
| 65 | memset(&m_out_srq_func, 0, sizeof(m_out_srq_func)); |
| 66 | memset(&m_out_atn_func, 0, sizeof(m_out_atn_func)); |
| 67 | memset(&m_out_clk_func, 0, sizeof(m_out_clk_func)); |
| 68 | memset(&m_out_data_func, 0, sizeof(m_out_data_func)); |
| 69 | memset(&m_out_reset_func, 0, sizeof(m_out_reset_func)); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | |
| 74 | //************************************************************************** |
| 75 | // LIVE DEVICE |
| 76 | //************************************************************************** |
| 77 | |
| 78 | //------------------------------------------------- |
| 79 | // cbm_iec_stub_device - constructor |
| 80 | //------------------------------------------------- |
| 81 | |
| 82 | cbm_iec_stub_device::cbm_iec_stub_device(running_machine &_machine, const cbm_iec_stub_device_config &_config) |
| 83 | : device_t(_machine, _config), |
| 84 | device_cbm_iec_interface(_machine, _config, *this), |
| 85 | m_config(_config) |
| 86 | { |
| 87 | } |
| 88 | |
| 89 | |
| 90 | //------------------------------------------------- |
| 91 | // device_start - device-specific startup |
| 92 | //------------------------------------------------- |
| 93 | |
| 94 | void cbm_iec_stub_device::device_start() |
| 95 | { |
| 96 | // resolve callbacks |
| 97 | devcb_resolve_write_line(&m_out_srq_func, &m_config.m_out_srq_func, this); |
| 98 | devcb_resolve_write_line(&m_out_atn_func, &m_config.m_out_atn_func, this); |
| 99 | devcb_resolve_write_line(&m_out_clk_func, &m_config.m_out_clk_func, this); |
| 100 | devcb_resolve_write_line(&m_out_data_func, &m_config.m_out_data_func, this); |
| 101 | devcb_resolve_write_line(&m_out_reset_func, &m_config.m_out_reset_func, this); |
| 102 | } |
| 103 | |
| 104 | |
| 105 | //------------------------------------------------- |
| 106 | // cbm_iec_srq - |
| 107 | //------------------------------------------------- |
| 108 | |
| 109 | void cbm_iec_stub_device::cbm_iec_srq(int state) |
| 110 | { |
| 111 | devcb_call_write_line(&m_out_srq_func, state); |
| 112 | } |
| 113 | |
| 114 | |
| 115 | //------------------------------------------------- |
| 116 | // cbm_iec_atn - |
| 117 | //------------------------------------------------- |
| 118 | |
| 119 | void cbm_iec_stub_device::cbm_iec_atn(int state) |
| 120 | { |
| 121 | devcb_call_write_line(&m_out_atn_func, state); |
| 122 | } |
| 123 | |
| 124 | |
| 125 | //------------------------------------------------- |
| 126 | // cbm_iec_clk - |
| 127 | //------------------------------------------------- |
| 128 | |
| 129 | void cbm_iec_stub_device::cbm_iec_clk(int state) |
| 130 | { |
| 131 | devcb_call_write_line(&m_out_clk_func, state); |
| 132 | } |
| 133 | |
| 134 | |
| 135 | //------------------------------------------------- |
| 136 | // cbm_iec_data - |
| 137 | //------------------------------------------------- |
| 138 | |
| 139 | void cbm_iec_stub_device::cbm_iec_data(int state) |
| 140 | { |
| 141 | devcb_call_write_line(&m_out_data_func, state); |
| 142 | } |
| 143 | |
| 144 | |
| 145 | //------------------------------------------------- |
| 146 | // cbm_iec_reset - |
| 147 | //------------------------------------------------- |
| 148 | |
| 149 | void cbm_iec_stub_device::cbm_iec_reset(int state) |
| 150 | { |
| 151 | devcb_call_write_line(&m_out_reset_func, state); |
| 152 | } |
src/mess/machine/c1571.c
| r11256 | r11257 | |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | #include "c1571.h" |
| 23 | | #include "machine/devhelpr.h" |
| 24 | 23 | |
| 25 | 24 | |
| 26 | 25 | |
| r11256 | r11257 | |
| 56 | 55 | // DEVICE CONFIGURATION |
| 57 | 56 | //************************************************************************** |
| 58 | 57 | |
| 59 | | GENERIC_DEVICE_CONFIG_SETUP(c1571, "C1571"); |
| 58 | //------------------------------------------------- |
| 59 | // c1571_device_config - constructor |
| 60 | //------------------------------------------------- |
| 60 | 61 | |
| 62 | c1571_device_config::c1571_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 63 | : device_config(mconfig, static_alloc_device_config, "C1571", tag, owner, clock), |
| 64 | device_config_cbm_iec_interface(mconfig, *this) |
| 65 | { |
| 66 | } |
| 61 | 67 | |
| 68 | |
| 62 | 69 | //------------------------------------------------- |
| 70 | // static_alloc_device_config - allocate a new |
| 71 | // configuration object |
| 72 | //------------------------------------------------- |
| 73 | |
| 74 | device_config *c1571_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 75 | { |
| 76 | return global_alloc(c1571_device_config(mconfig, tag, owner, clock)); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | //------------------------------------------------- |
| 81 | // alloc_device - allocate a new device object |
| 82 | //------------------------------------------------- |
| 83 | |
| 84 | device_t *c1571_device_config::alloc_device(running_machine &machine) const |
| 85 | { |
| 86 | return auto_alloc(machine, c1571_device(machine, *this)); |
| 87 | } |
| 88 | |
| 89 | |
| 90 | //------------------------------------------------- |
| 63 | 91 | // device_config_complete - perform any |
| 64 | 92 | // operations now that the configuration is |
| 65 | 93 | // complete |
| r11256 | r11257 | |
| 75 | 103 | // static_set_config - configuration helper |
| 76 | 104 | //------------------------------------------------- |
| 77 | 105 | |
| 78 | | void c1571_device_config::static_set_config(device_config *device, const char *bus_tag, int address) |
| 106 | void c1571_device_config::static_set_config(device_config *device, int address) |
| 79 | 107 | { |
| 80 | 108 | c1571_device_config *c1571 = downcast<c1571_device_config *>(device); |
| 81 | 109 | |
| 82 | | assert(bus_tag != NULL); |
| 83 | 110 | assert((address > 7) && (address < 12)); |
| 84 | 111 | |
| 85 | | c1571->m_bus_tag = bus_tag; |
| 86 | 112 | c1571->m_address = address - 8; |
| 87 | 113 | } |
| 88 | 114 | |
| r11256 | r11257 | |
| 216 | 242 | |
| 217 | 243 | if (!m_ser_dir) |
| 218 | 244 | { |
| 219 | | //m_cia->cnt_w(cbm_iec_srq_r(m_bus)); |
| 220 | | //m_cia->sp_w(cbm_iec_data_r(m_bus)); |
| 245 | //m_cia->cnt_w(m_bus->srq_r()); |
| 246 | //m_cia->sp_w(m_bus->data_r()); |
| 221 | 247 | } |
| 222 | 248 | } |
| 223 | 249 | |
| r11256 | r11257 | |
| 225 | 251 | m_ga->set_side(BIT(data, 2)); |
| 226 | 252 | |
| 227 | 253 | // attention out |
| 228 | | cbm_iec_atn_w(m_bus, this, !BIT(data, 6)); |
| 254 | m_bus->atn_w(this, !BIT(data, 6)); |
| 229 | 255 | } |
| 230 | 256 | |
| 231 | 257 | |
| r11256 | r11257 | |
| 249 | 275 | UINT8 data = 0; |
| 250 | 276 | |
| 251 | 277 | // data in |
| 252 | | data = !cbm_iec_data_r(m_bus); |
| 278 | data = !m_bus->data_r(); |
| 253 | 279 | |
| 254 | 280 | // clock in |
| 255 | | data |= !cbm_iec_clk_r(m_bus) << 2; |
| 281 | data |= !m_bus->clk_r() << 2; |
| 256 | 282 | |
| 257 | 283 | // serial bus address |
| 258 | 284 | data |= m_config.m_address << 5; |
| 259 | 285 | |
| 260 | 286 | // attention in |
| 261 | | data |= !cbm_iec_atn_r(m_bus) << 7; |
| 287 | data |= !m_bus->atn_r() << 7; |
| 262 | 288 | |
| 263 | 289 | return data; |
| 264 | 290 | } |
| r11256 | r11257 | |
| 288 | 314 | m_ga->atna_w(BIT(data, 4)); |
| 289 | 315 | |
| 290 | 316 | // clock out |
| 291 | | cbm_iec_clk_w(m_bus, this, !BIT(data, 3)); |
| 317 | m_bus->clk_w(this, !BIT(data, 3)); |
| 292 | 318 | } |
| 293 | 319 | |
| 294 | 320 | |
| 295 | 321 | READ_LINE_MEMBER( c1571_device::atn_in_r ) |
| 296 | 322 | { |
| 297 | | return !cbm_iec_atn_r(m_bus); |
| 323 | return !m_bus->atn_r(); |
| 298 | 324 | } |
| 299 | 325 | |
| 300 | 326 | |
| r11256 | r11257 | |
| 574 | 600 | // fast serial data |
| 575 | 601 | if (m_ser_dir) data &= m_sp_out; |
| 576 | 602 | |
| 577 | | cbm_iec_data_w(m_bus, this, data); |
| 603 | m_bus->data_w(this, data); |
| 578 | 604 | } |
| 579 | 605 | |
| 580 | 606 | |
| r11256 | r11257 | |
| 589 | 615 | // fast serial clock |
| 590 | 616 | if (m_ser_dir) srq &= m_cnt_out; |
| 591 | 617 | |
| 592 | | cbm_iec_srq_w(m_bus, this, srq); |
| 618 | m_bus->srq_w(this, srq); |
| 593 | 619 | } |
| 594 | 620 | |
| 595 | 621 | |
| r11256 | r11257 | |
| 604 | 630 | |
| 605 | 631 | c1571_device::c1571_device(running_machine &_machine, const c1571_device_config &_config) |
| 606 | 632 | : device_t(_machine, _config), |
| 633 | device_cbm_iec_interface(_machine, _config, *this), |
| 607 | 634 | m_maincpu(*this, M6502_TAG), |
| 608 | 635 | m_via0(*this, M6522_0_TAG), |
| 609 | 636 | m_via1(*this, M6522_1_TAG), |
| r11256 | r11257 | |
| 611 | 638 | m_fdc(*this, WD1770_TAG), |
| 612 | 639 | m_ga(*this, C64H156_TAG), |
| 613 | 640 | m_image(*this, FLOPPY_0), |
| 614 | | m_bus(machine().device(_config.m_bus_tag)), |
| 641 | m_bus(machine().device<cbm_iec_device>(CBM_IEC_TAG)), |
| 615 | 642 | m_1_2mhz(0), |
| 616 | 643 | m_data_out(1), |
| 617 | 644 | m_ser_dir(0), |
| r11256 | r11257 | |
| 662 | 689 | |
| 663 | 690 | |
| 664 | 691 | //------------------------------------------------- |
| 665 | | // iec_atn_w - |
| 692 | // cbm_iec_srq - |
| 666 | 693 | //------------------------------------------------- |
| 667 | 694 | |
| 668 | | WRITE_LINE_MEMBER( c1571_device::iec_atn_w ) |
| 695 | void c1571_device::cbm_iec_srq(int state) |
| 669 | 696 | { |
| 670 | | m_via0->write_ca1(!state); |
| 671 | | m_ga->atni_w(!state); |
| 672 | | |
| 673 | | set_iec_data(); |
| 697 | if (!m_ser_dir) |
| 698 | { |
| 699 | //m_cia->cnt_w(state); |
| 700 | } |
| 674 | 701 | } |
| 675 | 702 | |
| 676 | 703 | |
| 677 | 704 | //------------------------------------------------- |
| 678 | | // iec_srq_w - |
| 705 | // cbm_iec_atn - |
| 679 | 706 | //------------------------------------------------- |
| 680 | 707 | |
| 681 | | WRITE_LINE_MEMBER( c1571_device::iec_srq_w ) |
| 708 | void c1571_device::cbm_iec_atn(int state) |
| 682 | 709 | { |
| 683 | | if (!m_ser_dir) |
| 684 | | { |
| 685 | | //m_cia->cnt_w(state); |
| 686 | | } |
| 710 | m_via0->write_ca1(!state); |
| 711 | m_ga->atni_w(!state); |
| 712 | |
| 713 | set_iec_data(); |
| 687 | 714 | } |
| 688 | 715 | |
| 689 | 716 | |
| 690 | 717 | //------------------------------------------------- |
| 691 | | // iec_data_w - |
| 718 | // cbm_iec_data - |
| 692 | 719 | //------------------------------------------------- |
| 693 | 720 | |
| 694 | | WRITE_LINE_MEMBER( c1571_device::iec_data_w ) |
| 721 | void c1571_device::cbm_iec_data(int state) |
| 695 | 722 | { |
| 696 | 723 | if (!m_ser_dir) |
| 697 | 724 | { |
| r11256 | r11257 | |
| 701 | 728 | |
| 702 | 729 | |
| 703 | 730 | //------------------------------------------------- |
| 704 | | // iec_reset_w - |
| 731 | // cbm_iec_reset - |
| 705 | 732 | //------------------------------------------------- |
| 706 | 733 | |
| 707 | | WRITE_LINE_MEMBER( c1571_device::iec_reset_w ) |
| 734 | void c1571_device::cbm_iec_reset(int state) |
| 708 | 735 | { |
| 709 | 736 | if (!state) |
| 710 | 737 | { |