src/mess/video/abc800.c
| r9513 | r9514 | |
| 8 | 8 | |
| 9 | 9 | TODO: |
| 10 | 10 | |
| 11 | - type in SAA5052 Swedish characters |
| 12 | - convert SAA5050 to C++ device and fix its memory interface |
| 11 | 13 | - check compatibility with new MC6845 |
| 12 | 14 | - ABC800C video: http://www.qsl.net/zl1vfo/teletext.htm |
| 13 | 15 | |
| r9513 | r9514 | |
| 58 | 60 | //************************************************************************** |
| 59 | 61 | |
| 60 | 62 | //------------------------------------------------- |
| 61 | | // PALETTE_INIT( abc800c ) |
| 62 | | //------------------------------------------------- |
| 63 | | |
| 64 | | static PALETTE_INIT( abc800c ) |
| 65 | | { |
| 66 | | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black |
| 67 | | palette_set_color_rgb(machine, 1, 0x00, 0x00, 0xff); // blue |
| 68 | | palette_set_color_rgb(machine, 2, 0xff, 0x00, 0x00); // red |
| 69 | | palette_set_color_rgb(machine, 3, 0xff, 0x00, 0xff); // magenta |
| 70 | | palette_set_color_rgb(machine, 4, 0x00, 0xff, 0x00); // green |
| 71 | | palette_set_color_rgb(machine, 5, 0x00, 0xff, 0xff); // cyan |
| 72 | | palette_set_color_rgb(machine, 6, 0xff, 0xff, 0x00); // yellow |
| 73 | | palette_set_color_rgb(machine, 7, 0xff, 0xff, 0xff); // white |
| 74 | | } |
| 75 | | |
| 76 | | |
| 77 | | //------------------------------------------------- |
| 78 | 63 | // abc800m_hr_update - color high resolution |
| 79 | 64 | // screen update |
| 80 | 65 | //------------------------------------------------- |
| 81 | 66 | |
| 82 | | static void abc800c_hr_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 67 | void abc800c_state::hr_update(bitmap_t *bitmap, const rectangle *cliprect) |
| 83 | 68 | { |
| 84 | | abc800_state *state = machine->driver_data<abc800_state>(); |
| 85 | | |
| 86 | 69 | UINT16 addr = 0; |
| 87 | 70 | int sx, y, dot; |
| 88 | 71 | |
| 89 | | for (y = state->m_hrs; y < MIN(cliprect->max_y + 1, state->m_hrs + 240); y++) |
| 72 | for (y = m_hrs; y < MIN(cliprect->max_y + 1, m_hrs + 240); y++) |
| 90 | 73 | { |
| 91 | 74 | int x = 0; |
| 92 | 75 | |
| 93 | 76 | for (sx = 0; sx < 64; sx++) |
| 94 | 77 | { |
| 95 | | UINT8 data = state->m_video_ram[addr++]; |
| 78 | UINT8 data = m_video_ram[addr++]; |
| 96 | 79 | |
| 97 | 80 | for (dot = 0; dot < 4; dot++) |
| 98 | 81 | { |
| 99 | | UINT16 fgctl_addr = ((state->m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); |
| 100 | | int color = state->fgctl_prom[fgctl_addr] & 0x07; |
| 82 | UINT16 fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); |
| 83 | int color = fgctl_prom[fgctl_addr] & 0x07; |
| 101 | 84 | |
| 102 | 85 | *BITMAP_ADDR16(bitmap, y, x++) = color; |
| 103 | 86 | |
| r9513 | r9514 | |
| 112 | 95 | // VIDEO_START( abc800c ) |
| 113 | 96 | //------------------------------------------------- |
| 114 | 97 | |
| 115 | | static VIDEO_START( abc800c ) |
| 98 | void abc800_state::video_start() |
| 116 | 99 | { |
| 117 | | abc800_state *state = machine->driver_data<abc800_state>(); |
| 118 | | |
| 119 | 100 | // find memory regions |
| 120 | | state->m_char_rom = memory_region(machine, MC6845_TAG); |
| 121 | | state->fgctl_prom = memory_region(machine, "hru2"); |
| 101 | m_char_rom = memory_region(machine, MC6845_TAG); |
| 102 | fgctl_prom = memory_region(machine, "hru2"); |
| 122 | 103 | |
| 123 | 104 | // register for state saving |
| 124 | | state_save_register_global(machine, state->m_hrs); |
| 125 | | state_save_register_global(machine, state->m_fgctl); |
| 105 | state_save_register_global(machine, m_hrs); |
| 106 | state_save_register_global(machine, m_fgctl); |
| 126 | 107 | } |
| 127 | 108 | |
| 128 | 109 | |
| r9513 | r9514 | |
| 130 | 111 | // VIDEO_UPDATE( abc800c ) |
| 131 | 112 | //------------------------------------------------- |
| 132 | 113 | |
| 133 | | static VIDEO_UPDATE( abc800c ) |
| 114 | bool abc800c_state::video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect) |
| 134 | 115 | { |
| 135 | | abc800_state *state = screen->machine->driver_data<abc800_state>(); |
| 136 | | |
| 137 | 116 | // clear screen |
| 138 | | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 117 | bitmap_fill(&bitmap, &cliprect, get_black_pen(machine)); |
| 139 | 118 | |
| 140 | 119 | // draw HR graphics |
| 141 | | abc800c_hr_update(screen->machine, bitmap, cliprect); |
| 120 | hr_update(&bitmap, &cliprect); |
| 142 | 121 | |
| 143 | | if (!BIT(state->m_fgctl, 7)) |
| 122 | if (!BIT(m_fgctl, 7)) |
| 144 | 123 | { |
| 145 | 124 | // draw text |
| 146 | | saa5050_update(state->m_trom, bitmap, cliprect); |
| 125 | saa5050_update(m_trom, &bitmap, &cliprect); |
| 147 | 126 | } |
| 148 | 127 | |
| 149 | 128 | return 0; |
| r9513 | r9514 | |
| 158 | 137 | { |
| 159 | 138 | SCREEN_TAG, |
| 160 | 139 | 0, // starting gfxnum |
| 161 | | 40, 24 - 1, 40, // x, y, size |
| 140 | 40, 24 - 1, 0x80, // x, y, size |
| 162 | 141 | 0 // rev y order |
| 163 | 142 | }; |
| 164 | 143 | |
| r9513 | r9514 | |
| 176 | 155 | MDRV_SCREEN_SIZE(640, 400) |
| 177 | 156 | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) |
| 178 | 157 | |
| 179 | | MDRV_PALETTE_LENGTH(8) |
| 180 | | MDRV_PALETTE_INIT(abc800c) |
| 158 | MDRV_PALETTE_LENGTH(128) |
| 159 | MDRV_PALETTE_INIT(saa5050) |
| 181 | 160 | |
| 182 | | MDRV_VIDEO_START(abc800c) |
| 183 | | MDRV_VIDEO_UPDATE(abc800c) |
| 184 | | |
| 185 | 161 | MDRV_GFXDECODE(saa5050) |
| 186 | 162 | |
| 187 | 163 | MDRV_SAA5050_ADD(SAA5052_TAG, trom_intf) |
| r9513 | r9514 | |
| 209 | 185 | // screen update |
| 210 | 186 | //------------------------------------------------- |
| 211 | 187 | |
| 212 | | static void abc800m_hr_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 188 | void abc800m_state::hr_update(bitmap_t *bitmap, const rectangle *cliprect) |
| 213 | 189 | { |
| 214 | | abc800_state *state = machine->driver_data<abc800_state>(); |
| 215 | | |
| 216 | 190 | UINT16 addr = 0; |
| 217 | 191 | int sx, y, dot; |
| 218 | 192 | |
| 219 | | for (y = state->m_hrs + VERTICAL_PORCH_HACK; y < MIN(cliprect->max_y + 1, state->m_hrs + VERTICAL_PORCH_HACK + 240); y++) |
| 193 | for (y = m_hrs + VERTICAL_PORCH_HACK; y < MIN(cliprect->max_y + 1, m_hrs + VERTICAL_PORCH_HACK + 240); y++) |
| 220 | 194 | { |
| 221 | 195 | int x = HORIZONTAL_PORCH_HACK; |
| 222 | 196 | |
| 223 | 197 | for (sx = 0; sx < 64; sx++) |
| 224 | 198 | { |
| 225 | | UINT8 data = state->m_video_ram[addr++]; |
| 199 | UINT8 data = m_video_ram[addr++]; |
| 226 | 200 | |
| 227 | 201 | for (dot = 0; dot < 4; dot++) |
| 228 | 202 | { |
| 229 | | UINT16 fgctl_addr = ((state->m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); |
| 230 | | int color = (state->fgctl_prom[fgctl_addr] & 0x07) ? 1 : 0; |
| 203 | UINT16 fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); |
| 204 | int color = (fgctl_prom[fgctl_addr] & 0x07) ? 1 : 0; |
| 231 | 205 | |
| 232 | 206 | *BITMAP_ADDR16(bitmap, y, x++) = color; |
| 233 | 207 | *BITMAP_ADDR16(bitmap, y, x++) = color; |
| r9513 | r9514 | |
| 245 | 219 | |
| 246 | 220 | static MC6845_UPDATE_ROW( abc800m_update_row ) |
| 247 | 221 | { |
| 248 | | abc800_state *state = device->machine->driver_data<abc800_state>(); |
| 222 | abc800m_state *state = device->machine->driver_data<abc800m_state>(); |
| 249 | 223 | |
| 250 | 224 | int column; |
| 251 | 225 | |
| r9513 | r9514 | |
| 306 | 280 | // VIDEO_UPDATE( abc800m ) |
| 307 | 281 | //------------------------------------------------- |
| 308 | 282 | |
| 309 | | static VIDEO_UPDATE( abc800m ) |
| 283 | bool abc800m_state::video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect) |
| 310 | 284 | { |
| 311 | | abc800_state *state = screen->machine->driver_data<abc800_state>(); |
| 312 | | |
| 313 | 285 | // HACK expand visible area to workaround MC6845 |
| 314 | | screen->set_visible_area(0, 767, 0, 311); |
| 286 | screen.set_visible_area(0, 767, 0, 311); |
| 315 | 287 | |
| 316 | 288 | // clear screen |
| 317 | | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 289 | bitmap_fill(&bitmap, &cliprect, get_black_pen(machine)); |
| 318 | 290 | |
| 319 | 291 | // draw HR graphics |
| 320 | | abc800m_hr_update(screen->machine, bitmap, cliprect); |
| 292 | hr_update(&bitmap, &cliprect); |
| 321 | 293 | |
| 322 | | if (!BIT(state->m_fgctl, 7)) |
| 294 | if (!BIT(m_fgctl, 7)) |
| 323 | 295 | { |
| 324 | 296 | // draw text |
| 325 | | mc6845_update(state->m_crtc, bitmap, cliprect); |
| 297 | mc6845_update(m_crtc, &bitmap, &cliprect); |
| 326 | 298 | } |
| 327 | 299 | |
| 328 | 300 | return 0; |
| r9513 | r9514 | |
| 346 | 318 | |
| 347 | 319 | MDRV_PALETTE_LENGTH(2) |
| 348 | 320 | MDRV_PALETTE_INIT(abc800m) |
| 349 | | |
| 350 | | MDRV_VIDEO_START(abc800c) |
| 351 | | MDRV_VIDEO_UPDATE(abc800m) |
| 352 | 321 | MACHINE_CONFIG_END |
src/mess/includes/abc80x.h
| r9513 | r9514 | |
| 62 | 62 | m_ctc(*this, Z80CTC_TAG), |
| 63 | 63 | m_dart(*this, Z80DART_TAG), |
| 64 | 64 | m_sio(*this, Z80SIO_TAG), |
| 65 | | m_crtc(*this, MC6845_TAG), |
| 66 | | m_trom(*this, SAA5052_TAG), |
| 67 | 65 | m_discrete(*this, "discrete"), |
| 68 | 66 | m_ram(*this, "messram") |
| 69 | 67 | { } |
| r9513 | r9514 | |
| 72 | 70 | required_device<running_device> m_ctc; |
| 73 | 71 | required_device<running_device> m_dart; |
| 74 | 72 | required_device<running_device> m_sio; |
| 75 | | optional_device<running_device> m_crtc; |
| 76 | | optional_device<running_device> m_trom; |
| 77 | 73 | required_device<running_device> m_discrete; |
| 78 | 74 | required_device<running_device> m_ram; |
| 79 | 75 | |
| 80 | 76 | virtual void machine_start(); |
| 81 | 77 | virtual void machine_reset(); |
| 82 | | |
| 78 | |
| 79 | virtual void video_start(); |
| 80 | |
| 83 | 81 | void bankswitch(); |
| 84 | 82 | |
| 85 | 83 | DECLARE_READ8_MEMBER( pling_r ); |
| r9513 | r9514 | |
| 116 | 114 | int m_sio_txcb; |
| 117 | 115 | }; |
| 118 | 116 | |
| 117 | class abc800m_state : public abc800_state |
| 118 | { |
| 119 | public: |
| 120 | abc800m_state(running_machine &machine, const driver_device_config_base &config) |
| 121 | : abc800_state(machine, config), |
| 122 | m_crtc(*this, MC6845_TAG) |
| 123 | { } |
| 119 | 124 | |
| 125 | required_device<running_device> m_crtc; |
| 126 | |
| 127 | virtual bool video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect); |
| 128 | |
| 129 | void hr_update(bitmap_t *bitmap, const rectangle *cliprect); |
| 130 | }; |
| 131 | |
| 132 | class abc800c_state : public abc800_state |
| 133 | { |
| 134 | public: |
| 135 | abc800c_state(running_machine &machine, const driver_device_config_base &config) |
| 136 | : abc800_state(machine, config), |
| 137 | m_trom(*this, SAA5052_TAG) |
| 138 | { } |
| 139 | |
| 140 | required_device<running_device> m_trom; |
| 141 | |
| 142 | virtual bool video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect); |
| 143 | |
| 144 | void hr_update(bitmap_t *bitmap, const rectangle *cliprect); |
| 145 | }; |
| 146 | |
| 120 | 147 | // ======================> abc802_state |
| 121 | 148 | |
| 122 | 149 | class abc802_state : public driver_device |
src/mess/drivers/abc80x.c
| r9513 | r9514 | |
| 1624 | 1624 | //************************************************************************** |
| 1625 | 1625 | |
| 1626 | 1626 | //------------------------------------------------- |
| 1627 | | // MACHINE_CONFIG( abc800 ) |
| 1627 | // MACHINE_CONFIG( abc800c ) |
| 1628 | 1628 | //------------------------------------------------- |
| 1629 | 1629 | |
| 1630 | | static MACHINE_CONFIG_START( abc800, abc800_state ) |
| 1630 | static MACHINE_CONFIG_START( abc800c, abc800c_state ) |
| 1631 | 1631 | // basic machine hardware |
| 1632 | 1632 | MDRV_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) |
| 1633 | 1633 | MDRV_CPU_CONFIG(abc800_daisy_chain) |
| 1634 | | MDRV_CPU_PROGRAM_MAP(abc800m_mem) |
| 1635 | | MDRV_CPU_IO_MAP(abc800m_io) |
| 1634 | MDRV_CPU_PROGRAM_MAP(abc800c_mem) |
| 1635 | MDRV_CPU_IO_MAP(abc800c_io) |
| 1636 | 1636 | |
| 1637 | 1637 | MDRV_CPU_ADD(I8048_TAG, I8048, XTAL_5_9904MHz) |
| 1638 | 1638 | MDRV_CPU_IO_MAP(abc800_keyboard_io) |
| 1639 | 1639 | |
| 1640 | // video hardware |
| 1641 | MDRV_FRAGMENT_ADD(abc800c_video) |
| 1642 | |
| 1640 | 1643 | // sound hardware |
| 1641 | 1644 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1642 | 1645 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) |
| r9513 | r9514 | |
| 1667 | 1670 | // MACHINE_CONFIG( abc800m ) |
| 1668 | 1671 | //------------------------------------------------- |
| 1669 | 1672 | |
| 1670 | | static MACHINE_CONFIG_DERIVED( abc800m, abc800 ) |
| 1673 | static MACHINE_CONFIG_START( abc800m, abc800m_state ) |
| 1674 | // basic machine hardware |
| 1675 | MDRV_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) |
| 1676 | MDRV_CPU_CONFIG(abc800_daisy_chain) |
| 1677 | MDRV_CPU_PROGRAM_MAP(abc800m_mem) |
| 1678 | MDRV_CPU_IO_MAP(abc800m_io) |
| 1679 | |
| 1680 | MDRV_CPU_ADD(I8048_TAG, I8048, XTAL_5_9904MHz) |
| 1681 | MDRV_CPU_IO_MAP(abc800_keyboard_io) |
| 1682 | |
| 1671 | 1683 | // video hardware |
| 1672 | 1684 | MDRV_FRAGMENT_ADD(abc800m_video) |
| 1673 | | MACHINE_CONFIG_END |
| 1674 | 1685 | |
| 1686 | // sound hardware |
| 1687 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1688 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) |
| 1689 | MDRV_SOUND_CONFIG_DISCRETE(abc800) |
| 1690 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 1675 | 1691 | |
| 1676 | | //------------------------------------------------- |
| 1677 | | // MACHINE_CONFIG( abc800c ) |
| 1678 | | //------------------------------------------------- |
| 1692 | // peripheral hardware |
| 1693 | MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf) |
| 1694 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1695 | MDRV_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1696 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf) |
| 1697 | MDRV_PRINTER_ADD("printer") |
| 1698 | MDRV_CASSETTE_ADD(CASSETTE_TAG, abc800_cassette_config) |
| 1699 | MDRV_TIMER_ADD_PERIODIC("keyboard_t1", keyboard_t1_tick, HZ(XTAL_5_9904MHz/(3*5)/20)) // TODO correct frequency? |
| 1679 | 1700 | |
| 1680 | | static MACHINE_CONFIG_DERIVED( abc800c, abc800 ) |
| 1681 | | // basic machine hardware |
| 1682 | | MDRV_CPU_MODIFY(Z80_TAG) |
| 1683 | | MDRV_CPU_PROGRAM_MAP(abc800c_mem) |
| 1684 | | MDRV_CPU_IO_MAP(abc800c_io) |
| 1701 | // ABC bus |
| 1702 | MDRV_ABCBUS_ADD(ABCBUS_TAG, abcbus_daisy, Z80_TAG) |
| 1703 | MDRV_ABC830_ADD("luxor_55_21046", ABCBUS_TAG, DRIVE_BASF_6106_08) |
| 1685 | 1704 | |
| 1686 | | // video hardware |
| 1687 | | MDRV_FRAGMENT_ADD(abc800c_video) |
| 1705 | // internal ram |
| 1706 | MDRV_RAM_ADD("messram") |
| 1707 | MDRV_RAM_DEFAULT_SIZE("16K") |
| 1708 | MDRV_RAM_EXTRA_OPTIONS("32K") |
| 1688 | 1709 | MACHINE_CONFIG_END |
| 1689 | 1710 | |
| 1690 | 1711 | |