trunk/src/mess/video/mos6566.c
| r17695 | r17696 | |
| 23 | 23 | - cleanup |
| 24 | 24 | - light pen |
| 25 | 25 | - remove RDY hack |
| 26 | | - VIC IIe |
| 27 | 26 | - http://hitmen.c02.at/temp/palstuff/ |
| 28 | 27 | |
| 29 | 28 | */ |
| r17695 | r17696 | |
| 91 | 90 | }; |
| 92 | 91 | |
| 93 | 92 | |
| 94 | | static const UINT8 PALETTE[] = |
| 93 | // VICE palette |
| 94 | static const rgb_t PALETTE[] = |
| 95 | 95 | { |
| 96 | | // black, white, red, cyan |
| 97 | | // purple, green, blue, yellow |
| 98 | | // orange, brown, light red, dark gray, |
| 99 | | // medium gray, light green, light blue, light gray |
| 100 | | // taken from the vice emulator |
| 101 | | 0x00, 0x00, 0x00, 0xfd, 0xfe, 0xfc, 0xbe, 0x1a, 0x24, 0x30, 0xe6, 0xc6, |
| 102 | | 0xb4, 0x1a, 0xe2, 0x1f, 0xd2, 0x1e, 0x21, 0x1b, 0xae, 0xdf, 0xf6, 0x0a, |
| 103 | | 0xb8, 0x41, 0x04, 0x6a, 0x33, 0x04, 0xfe, 0x4a, 0x57, 0x42, 0x45, 0x40, |
| 104 | | 0x70, 0x74, 0x6f, 0x59, 0xfe, 0x59, 0x5f, 0x53, 0xfe, 0xa4, 0xa7, 0xa2 |
| 96 | MAKE_RGB(0x00, 0x00, 0x00), |
| 97 | MAKE_RGB(0xfd, 0xfe, 0xfc), |
| 98 | MAKE_RGB(0xbe, 0x1a, 0x24), |
| 99 | MAKE_RGB(0x30, 0xe6, 0xc6), |
| 100 | MAKE_RGB(0xb4, 0x1a, 0xe2), |
| 101 | MAKE_RGB(0x1f, 0xd2, 0x1e), |
| 102 | MAKE_RGB(0x21, 0x1b, 0xae), |
| 103 | MAKE_RGB(0xdf, 0xf6, 0x0a), |
| 104 | MAKE_RGB(0xb8, 0x41, 0x04), |
| 105 | MAKE_RGB(0x6a, 0x33, 0x04), |
| 106 | MAKE_RGB(0xfe, 0x4a, 0x57), |
| 107 | MAKE_RGB(0x42, 0x45, 0x40), |
| 108 | MAKE_RGB(0x70, 0x74, 0x6f), |
| 109 | MAKE_RGB(0x59, 0xfe, 0x59), |
| 110 | MAKE_RGB(0x5f, 0x53, 0xfe), |
| 111 | MAKE_RGB(0xa4, 0xa7, 0xa2) |
| 105 | 112 | }; |
| 106 | 113 | |
| 107 | 114 | |
| r17695 | r17696 | |
| 209 | 216 | const device_type MOS6566 = &device_creator<mos6566_device>; |
| 210 | 217 | const device_type MOS6567 = &device_creator<mos6567_device>; |
| 211 | 218 | const device_type MOS8562 = &device_creator<mos8562_device>; |
| 219 | const device_type MOS8564 = &device_creator<mos8564_device>; |
| 212 | 220 | const device_type MOS6569 = &device_creator<mos6569_device>; |
| 213 | 221 | const device_type MOS8565 = &device_creator<mos8565_device>; |
| 222 | const device_type MOS8566 = &device_creator<mos8566_device>; |
| 214 | 223 | |
| 215 | 224 | |
| 216 | 225 | // default address maps |
| r17695 | r17696 | |
| 560 | 569 | mos8562_device::mos8562_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 561 | 570 | :mos6567_device(mconfig, MOS8562, "MOS8562", tag, owner, clock) { m_variant = TYPE_8562; } |
| 562 | 571 | |
| 572 | mos8564_device::mos8564_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 573 | :mos6567_device(mconfig, MOS8564, "MOS8564", tag, owner, clock) { m_variant = TYPE_8564; } |
| 574 | |
| 563 | 575 | mos6569_device::mos6569_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 564 | 576 | :mos6566_device(mconfig, MOS6566, "MOS6569", tag, owner, clock) { m_variant = TYPE_6569; } |
| 565 | 577 | |
| r17695 | r17696 | |
| 569 | 581 | mos8565_device::mos8565_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 570 | 582 | :mos6569_device(mconfig, MOS8565, "MOS8565", tag, owner, clock) { m_variant = TYPE_8565; } |
| 571 | 583 | |
| 584 | mos8566_device::mos8566_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 585 | :mos6569_device(mconfig, MOS8566, "MOS8566", tag, owner, clock) { m_variant = TYPE_8566; } |
| 572 | 586 | |
| 587 | |
| 573 | 588 | //------------------------------------------------- |
| 574 | 589 | // device_config_complete - perform any |
| 575 | 590 | // operations now that the configuration is |
| r17695 | r17696 | |
| 617 | 632 | m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); |
| 618 | 633 | |
| 619 | 634 | // initialize palette |
| 620 | | int i; |
| 635 | palette_set_colors(machine(), 0, PALETTE, ARRAY_LENGTH(PALETTE)); |
| 621 | 636 | |
| 622 | | for (i = 0; i < 16; i++) |
| 637 | for (int i = 0; i < 256; i++) |
| 623 | 638 | { |
| 624 | | palette_set_color_rgb(machine(), i, PALETTE[i * 3], PALETTE[i * 3 + 1], PALETTE[i * 3 + 2]); |
| 625 | | } |
| 626 | | |
| 627 | | for (i = 0; i < 256; i++) |
| 628 | | { |
| 629 | 639 | m_expandx[i] = 0; |
| 630 | 640 | if (i & 1) |
| 631 | 641 | m_expandx[i] |= 3; |
| r17695 | r17696 | |
| 645 | 655 | m_expandx[i] |= 0xc000; |
| 646 | 656 | } |
| 647 | 657 | |
| 648 | | for (i = 0; i < 256; i++) |
| 658 | for (int i = 0; i < 256; i++) |
| 649 | 659 | { |
| 650 | 660 | m_expandx_multi[i] = 0; |
| 651 | 661 | if (i & 1) |
| r17695 | r17696 | |
| 717 | 727 | save_item(NAME(m_mc_base)); |
| 718 | 728 | save_item(NAME(m_mc)); |
| 719 | 729 | |
| 720 | | for (i = 0; i < 8; i++) |
| 730 | for (int i = 0; i < 8; i++) |
| 721 | 731 | { |
| 722 | 732 | save_item(NAME(m_spr_data[i]), i); |
| 723 | 733 | save_item(NAME(m_spr_draw_data[i]), i); |
| r17695 | r17696 | |
| 2829 | 2839 | { |
| 2830 | 2840 | return m_last_data; |
| 2831 | 2841 | } |
| 2842 | |
| 2843 | |
| 2844 | READ_LINE_MEMBER( mos8564_device::k0_r ) { return VIC2E_K0_LEVEL; } |
| 2845 | READ_LINE_MEMBER( mos8564_device::k1_r ) { return VIC2E_K1_LEVEL; } |
| 2846 | READ_LINE_MEMBER( mos8564_device::k2_r ) { return VIC2E_K2_LEVEL; } |
| 2847 | |
| 2848 | READ_LINE_MEMBER( mos8566_device::k0_r ) { return VIC2E_K0_LEVEL; } |
| 2849 | READ_LINE_MEMBER( mos8566_device::k1_r ) { return VIC2E_K1_LEVEL; } |
| 2850 | READ_LINE_MEMBER( mos8566_device::k2_r ) { return VIC2E_K2_LEVEL; } |
trunk/src/mess/video/mos6566.h
| r17695 | r17696 | |
| 127 | 127 | MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8562_device, screen_update) \ |
| 128 | 128 | MCFG_PALETTE_LENGTH(16) |
| 129 | 129 | |
| 130 | #define MCFG_MOS8564_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \ |
| 131 | MCFG_DEVICE_ADD(_tag, MOS8564, _clock) \ |
| 132 | MCFG_DEVICE_CONFIG(_config) \ |
| 133 | MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \ |
| 134 | MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \ |
| 135 | MCFG_SCREEN_ADD(_screen_tag, RASTER) \ |
| 136 | MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) \ |
| 137 | MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) \ |
| 138 | MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) \ |
| 139 | MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8562_device, screen_update) \ |
| 140 | MCFG_PALETTE_LENGTH(16+16) // 16 for VIC, 16 for VDC |
| 141 | |
| 130 | 142 | #define MCFG_MOS6569_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \ |
| 131 | 143 | MCFG_DEVICE_ADD(_tag, MOS6569, _clock) \ |
| 132 | 144 | MCFG_DEVICE_CONFIG(_config) \ |
| r17695 | r17696 | |
| 151 | 163 | MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8565_device, screen_update) \ |
| 152 | 164 | MCFG_PALETTE_LENGTH(16) |
| 153 | 165 | |
| 166 | #define MCFG_MOS8566_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \ |
| 167 | MCFG_DEVICE_ADD(_tag, MOS8566, _clock) \ |
| 168 | MCFG_DEVICE_CONFIG(_config) \ |
| 169 | MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \ |
| 170 | MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \ |
| 171 | MCFG_SCREEN_ADD(_screen_tag, RASTER) \ |
| 172 | MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) \ |
| 173 | MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) \ |
| 174 | MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) \ |
| 175 | MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8565_device, screen_update) \ |
| 176 | MCFG_PALETTE_LENGTH(16+16) // 16 for VIC, 16 for VDC |
| 154 | 177 | |
| 178 | |
| 155 | 179 | #define MOS6566_INTERFACE(_name) \ |
| 156 | 180 | const mos6566_interface (_name) = |
| 157 | 181 | |
| 158 | 182 | #define MOS6567_INTERFACE(_name) \ |
| 159 | 183 | const mos6566_interface (_name) = |
| 160 | 184 | |
| 185 | #define MOS8564_INTERFACE(_name) \ |
| 186 | const mos6566_interface (_name) = |
| 187 | |
| 161 | 188 | #define MOS6569_INTERFACE(_name) \ |
| 162 | 189 | const mos6566_interface (_name) = |
| 163 | 190 | |
| 191 | #define MOS8566_INTERFACE(_name) \ |
| 192 | const mos6566_interface (_name) = |
| 164 | 193 | |
| 165 | 194 | |
| 195 | |
| 166 | 196 | //************************************************************************** |
| 167 | 197 | // MACROS / CONSTANTS |
| 168 | 198 | //************************************************************************** |
| r17695 | r17696 | |
| 455 | 485 | }; |
| 456 | 486 | |
| 457 | 487 | |
| 488 | // ======================> mos8564_device |
| 489 | |
| 490 | class mos8564_device : public mos6567_device |
| 491 | { |
| 492 | public: |
| 493 | // construction/destruction |
| 494 | mos8564_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 495 | |
| 496 | DECLARE_READ_LINE_MEMBER( k0_r ); |
| 497 | DECLARE_READ_LINE_MEMBER( k1_r ); |
| 498 | DECLARE_READ_LINE_MEMBER( k2_r ); |
| 499 | }; |
| 500 | |
| 501 | |
| 458 | 502 | // ======================> mos6569_device |
| 459 | 503 | |
| 460 | 504 | class mos6569_device : public mos6566_device |
| r17695 | r17696 | |
| 479 | 523 | }; |
| 480 | 524 | |
| 481 | 525 | |
| 526 | // ======================> mos8566_device |
| 527 | |
| 528 | class mos8566_device : public mos6569_device |
| 529 | { |
| 530 | public: |
| 531 | // construction/destruction |
| 532 | mos8566_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 533 | |
| 534 | DECLARE_READ_LINE_MEMBER( k0_r ); |
| 535 | DECLARE_READ_LINE_MEMBER( k1_r ); |
| 536 | DECLARE_READ_LINE_MEMBER( k2_r ); |
| 537 | }; |
| 538 | |
| 539 | |
| 482 | 540 | // device type definitions |
| 483 | 541 | extern const device_type MOS6566; |
| 484 | 542 | extern const device_type MOS6567; |
| 485 | 543 | extern const device_type MOS8562; |
| 544 | extern const device_type MOS8564; |
| 486 | 545 | extern const device_type MOS6569; |
| 487 | 546 | extern const device_type MOS8565; |
| 547 | extern const device_type MOS8566; |
| 488 | 548 | |
| 489 | 549 | |
| 490 | 550 | |