trunk/src/emu/devcb.c
| r18367 | r18368 | |
| 208 | 208 | m_object.constant = desc.index; |
| 209 | 209 | *static_cast<devcb_read_line_delegate *>(this) = devcb_read_line_delegate(&devcb_resolved_read_line::from_constant, "constant", this); |
| 210 | 210 | break; |
| 211 | |
| 212 | case DEVCB_TYPE_UNMAP: |
| 213 | m_helper.null_indicator = &s_null; |
| 214 | m_object.device = &device; |
| 215 | *static_cast<devcb_read_line_delegate *>(this) = devcb_read_line_delegate(&devcb_resolved_read_line::from_unmap, "unmap", this); |
| 216 | break; |
| 211 | 217 | } |
| 212 | 218 | } |
| 213 | 219 | |
| r18367 | r18368 | |
| 244 | 250 | return (m_object.constant & 1) ? ASSERT_LINE : CLEAR_LINE; |
| 245 | 251 | } |
| 246 | 252 | |
| 253 | //------------------------------------------------- |
| 254 | // from_constant - helper to convert from a |
| 255 | // unmap value to a line value |
| 256 | //------------------------------------------------- |
| 247 | 257 | |
| 258 | int devcb_resolved_read_line::from_unmap() |
| 259 | { |
| 260 | logerror("%s: unmapped devcb read\n", |
| 261 | m_object.device->tag()); |
| 262 | return CLEAR_LINE; |
| 263 | } |
| 248 | 264 | |
| 265 | |
| 249 | 266 | //************************************************************************** |
| 250 | 267 | // DEVCB RESOLVED WRITE LINE |
| 251 | 268 | //************************************************************************** |
| r18367 | r18368 | |
| 303 | 320 | m_helper.input_line = desc.index; |
| 304 | 321 | *static_cast<devcb_write_line_delegate *>(this) = devcb_write_line_delegate(&devcb_resolved_write_line::to_input, desc.tag, this); |
| 305 | 322 | break; |
| 323 | |
| 324 | case DEVCB_TYPE_UNMAP: |
| 325 | m_helper.null_indicator = &s_null; |
| 326 | m_object.device = &device; |
| 327 | *static_cast<devcb_write_line_delegate *>(this) = devcb_write_line_delegate(&devcb_resolved_write_line::to_unmap, "unmap", this); |
| 328 | break; |
| 306 | 329 | } |
| 307 | 330 | } |
| 308 | 331 | |
| r18367 | r18368 | |
| 315 | 338 | { |
| 316 | 339 | } |
| 317 | 340 | |
| 341 | //------------------------------------------------- |
| 342 | // to_unmap - helper to handle a unmap write |
| 343 | //------------------------------------------------- |
| 318 | 344 | |
| 345 | void devcb_resolved_write_line::to_unmap(int state) |
| 346 | { |
| 347 | logerror("%s: unmapped devcb write %s\n", |
| 348 | m_object.device->tag(), |
| 349 | core_i64_format(state, 2 * sizeof(UINT8),false)); |
| 350 | } |
| 351 | |
| 319 | 352 | //------------------------------------------------- |
| 320 | 353 | // to_port - helper to convert to an I/O port |
| 321 | 354 | // value from a line value |
| r18367 | r18368 | |
| 410 | 443 | m_object.constant = desc.index; |
| 411 | 444 | *static_cast<devcb_read8_delegate *>(this) = devcb_read8_delegate(&devcb_resolved_read8::from_constant, "constant", this); |
| 412 | 445 | break; |
| 446 | |
| 447 | case DEVCB_TYPE_UNMAP: |
| 448 | m_helper.null_indicator = &s_null; |
| 449 | m_object.device = &device; |
| 450 | *static_cast<devcb_read8_delegate *>(this) = devcb_read8_delegate(&devcb_resolved_read8::from_unmap, "unmap", this); |
| 451 | break; |
| 413 | 452 | } |
| 414 | 453 | } |
| 415 | 454 | |
| r18367 | r18368 | |
| 468 | 507 | return m_object.constant; |
| 469 | 508 | } |
| 470 | 509 | |
| 510 | //------------------------------------------------- |
| 511 | // from_constant - helper to convert from a |
| 512 | // unmap value to an 8-bit value |
| 513 | //------------------------------------------------- |
| 471 | 514 | |
| 515 | UINT8 devcb_resolved_read8::from_unmap(offs_t offset, UINT8 mem_mask) |
| 516 | { |
| 517 | logerror("%s: unmapped devcb read\n", |
| 518 | m_object.device->tag()); |
| 519 | return 0; |
| 520 | } |
| 472 | 521 | |
| 473 | 522 | //************************************************************************** |
| 474 | 523 | // DEVCB RESOLVED WRITE8 |
| r18367 | r18368 | |
| 530 | 579 | m_helper.input_line = desc.index; |
| 531 | 580 | *static_cast<devcb_write8_delegate *>(this) = devcb_write8_delegate(&devcb_resolved_write8::to_input, desc.tag, this); |
| 532 | 581 | break; |
| 582 | |
| 583 | case DEVCB_TYPE_UNMAP: |
| 584 | m_helper.null_indicator = &s_null; |
| 585 | m_object.device = &device; |
| 586 | *static_cast<devcb_write8_delegate *>(this) = devcb_write8_delegate(&devcb_resolved_write8::to_unmap, "unmap", this); |
| 587 | break; |
| 533 | 588 | } |
| 534 | 589 | } |
| 535 | 590 | |
| r18367 | r18368 | |
| 542 | 597 | { |
| 543 | 598 | } |
| 544 | 599 | |
| 600 | //------------------------------------------------- |
| 601 | // to_unmap - helper to handle a unmap write |
| 602 | //------------------------------------------------- |
| 545 | 603 | |
| 604 | void devcb_resolved_write8::to_unmap(offs_t offset, UINT8 data, UINT8 mem_mask) |
| 605 | { |
| 606 | logerror("%s: unmapped devcb write %s & %s\n", |
| 607 | m_object.device->tag(), |
| 608 | core_i64_format(data, 2 * sizeof(UINT8),false), |
| 609 | core_i64_format(mem_mask, 2 * sizeof(UINT8),false)); |
| 610 | } |
| 611 | |
| 546 | 612 | //------------------------------------------------- |
| 547 | 613 | // to_port - helper to convert to an I/O port |
| 548 | 614 | // value from a line value |
| r18367 | r18368 | |
| 658 | 724 | m_object.constant = desc.index; |
| 659 | 725 | *static_cast<devcb_read16_delegate *>(this) = devcb_read16_delegate(&devcb_resolved_read16::from_constant, "constant", this); |
| 660 | 726 | break; |
| 727 | |
| 728 | case DEVCB_TYPE_UNMAP: |
| 729 | m_helper.null_indicator = &s_null; |
| 730 | m_object.device = &device; |
| 731 | *static_cast<devcb_read16_delegate *>(this) = devcb_read16_delegate(&devcb_resolved_read16::from_unmap, "unmap", this); |
| 732 | break; |
| 661 | 733 | } |
| 662 | 734 | } |
| 663 | 735 | |
| r18367 | r18368 | |
| 705 | 777 | return m_object.constant; |
| 706 | 778 | } |
| 707 | 779 | |
| 780 | //------------------------------------------------- |
| 781 | // from_constant - helper to convert from a |
| 782 | // unmap value to a 16-bit value |
| 783 | //------------------------------------------------- |
| 708 | 784 | |
| 785 | UINT16 devcb_resolved_read16::from_unmap(offs_t offset, UINT16 mem_mask) |
| 786 | { |
| 787 | logerror("%s: unmapped devcb read\n", |
| 788 | m_object.device->tag()); |
| 789 | return 0; |
| 790 | } |
| 709 | 791 | |
| 710 | 792 | //************************************************************************** |
| 711 | 793 | // DEVCB RESOLVED WRITE16 |
| r18367 | r18368 | |
| 766 | 848 | m_helper.input_line = desc.index; |
| 767 | 849 | *static_cast<devcb_write16_delegate *>(this) = devcb_write16_delegate(&devcb_resolved_write16::to_input, desc.tag, this); |
| 768 | 850 | break; |
| 851 | |
| 852 | case DEVCB_TYPE_UNMAP: |
| 853 | m_helper.null_indicator = &s_null; |
| 854 | m_object.device = &device; |
| 855 | *static_cast<devcb_write16_delegate *>(this) = devcb_write16_delegate(&devcb_resolved_write16::to_unmap, "unmap", this); |
| 856 | break; |
| 769 | 857 | } |
| 770 | 858 | } |
| 771 | 859 | |
| r18367 | r18368 | |
| 780 | 868 | |
| 781 | 869 | |
| 782 | 870 | //------------------------------------------------- |
| 871 | // to_unmap - helper to handle a unmap write |
| 872 | //------------------------------------------------- |
| 873 | |
| 874 | void devcb_resolved_write16::to_unmap(offs_t offset, UINT16 data, UINT16 mask) |
| 875 | { |
| 876 | logerror("%s: unmapped devcb write %s & %s\n", |
| 877 | m_object.device->tag(), |
| 878 | core_i64_format(data, 2 * sizeof(UINT16),false), |
| 879 | core_i64_format(mask, 2 * sizeof(UINT16),false)); |
| 880 | } |
| 881 | |
| 882 | //------------------------------------------------- |
| 783 | 883 | // to_port - helper to convert to an I/O port |
| 784 | 884 | // value from a line value |
| 785 | 885 | //------------------------------------------------- |
trunk/src/emu/devcb.h
| r18367 | r18368 | |
| 90 | 90 | DEVCB_TYPE_DEVICE, // device read/write |
| 91 | 91 | DEVCB_TYPE_LEGACY_SPACE, // legacy address space read/write |
| 92 | 92 | DEVCB_TYPE_INPUT_LINE, // device input line write |
| 93 | | DEVCB_TYPE_CONSTANT // constant value read |
| 93 | DEVCB_TYPE_CONSTANT, // constant value read |
| 94 | DEVCB_TYPE_UNMAP // unmapped line |
| 94 | 95 | }; |
| 95 | 96 | |
| 96 | 97 | |
| r18367 | r18368 | |
| 176 | 177 | #define DEVCB_LINE_GND DEVCB_CONSTANT(0) |
| 177 | 178 | #define DEVCB_LINE_VCC DEVCB_CONSTANT(1) |
| 178 | 179 | |
| 180 | #define DEVCB_UNMAPPED { DEVCB_TYPE_UNMAP, 0, NULL, NULL, NULL, NULL } |
| 181 | |
| 179 | 182 | // read/write handlers for a given CPU's address space |
| 180 | 183 | #define DEVCB_MEMORY_HANDLER(cpu,space,func) { DEVCB_TYPE_LEGACY_SPACE, AS_##space, (cpu), #func, NULL, NULL, func } |
| 181 | 184 | |
| r18367 | r18368 | |
| 280 | 283 | int from_port(); |
| 281 | 284 | int from_read8(); |
| 282 | 285 | int from_constant(); |
| 286 | int from_unmap(); |
| 283 | 287 | |
| 284 | 288 | // internal state |
| 285 | 289 | devcb_resolved_objects m_object; |
| r18367 | r18368 | |
| 330 | 334 | void to_port(int state); |
| 331 | 335 | void to_write8(int state); |
| 332 | 336 | void to_input(int state); |
| 337 | void to_unmap(int state); |
| 333 | 338 | |
| 334 | 339 | // internal state |
| 335 | 340 | devcb_resolved_objects m_object; |
| r18367 | r18368 | |
| 384 | 389 | UINT8 from_read8device(offs_t offset, UINT8 mem_mask); |
| 385 | 390 | UINT8 from_readline(offs_t offset, UINT8 mem_mask); |
| 386 | 391 | UINT8 from_constant(offs_t offset, UINT8 mem_mask); |
| 392 | UINT8 from_unmap(offs_t offset, UINT8 mem_mask); |
| 387 | 393 | |
| 388 | 394 | // internal state |
| 389 | 395 | devcb_resolved_objects m_object; |
| r18367 | r18368 | |
| 439 | 445 | void to_write8device(offs_t offset, UINT8 data, UINT8 mem_mask); |
| 440 | 446 | void to_writeline(offs_t offset, UINT8 data, UINT8 mem_mask); |
| 441 | 447 | void to_input(offs_t offset, UINT8 data, UINT8 mem_mask); |
| 448 | void to_unmap(offs_t offset, UINT8 data, UINT8 mem_mask); |
| 442 | 449 | |
| 443 | 450 | // internal state |
| 444 | 451 | devcb_resolved_objects m_object; |
| r18367 | r18368 | |
| 492 | 499 | UINT16 from_read16(offs_t offset, UINT16 mask); |
| 493 | 500 | UINT16 from_readline(offs_t offset, UINT16 mask); |
| 494 | 501 | UINT16 from_constant(offs_t offset, UINT16 mask); |
| 502 | UINT16 from_unmap(offs_t offset, UINT16 mask); |
| 495 | 503 | |
| 496 | 504 | // internal state |
| 497 | 505 | devcb_resolved_objects m_object; |
| r18367 | r18368 | |
| 546 | 554 | void to_write16(offs_t offset, UINT16 data, UINT16 mask); |
| 547 | 555 | void to_writeline(offs_t offset, UINT16 data, UINT16 mask); |
| 548 | 556 | void to_input(offs_t offset, UINT16 data, UINT16 mask); |
| 557 | void to_unmap(offs_t offset, UINT16 data, UINT16 mask); |
| 549 | 558 | |
| 550 | 559 | // internal state |
| 551 | 560 | devcb_resolved_objects m_object; |