src/mess/drivers/poly.c
| r12932 | r12933 | |
| 9 | 9 | It uses a 6809 for all main functions. There is a Z80 for CP/M, but all |
| 10 | 10 | of the roms are 6809 code. |
| 11 | 11 | |
| 12 | The keyboard controller is one of those custom XR devices. |
| 13 | Will use the terminal keyboard instead. |
| 14 | |
| 12 | 15 | ToDo: |
| 13 | | - Everything! |
| 16 | - Almost Everything! |
| 17 | - Connect up the device ports & lines |
| 18 | - Find out about graphics mode and how it is selected |
| 19 | - There is a beeper or speaker connected to the 6840 - how? |
| 20 | - Fix Keyboard so that the Enter key tells BASIC to do something |
| 21 | - Fix If ^G is pressed, emulation freezes |
| 22 | - Find out how to make 2nd teletext screen to display |
| 14 | 23 | |
| 15 | 24 | ****************************************************************************/ |
| 16 | 25 | #define ADDRESS_MAP_MODERN |
| r12932 | r12933 | |
| 18 | 27 | #include "emu.h" |
| 19 | 28 | #include "cpu/m6809/m6809.h" |
| 20 | 29 | #include "cpu/z80/z80.h" |
| 30 | #include "machine/6821pia.h" |
| 31 | #include "machine/6840ptm.h" |
| 21 | 32 | #include "video/saa5050.h" |
| 22 | 33 | #include "machine/terminal.h" |
| 23 | 34 | |
| r12932 | r12933 | |
| 27 | 38 | public: |
| 28 | 39 | poly_state(const machine_config &mconfig, device_type type, const char *tag) |
| 29 | 40 | : driver_device(mconfig, type, tag), |
| 30 | | m_maincpu(*this, "maincpu") |
| 41 | m_maincpu(*this, "maincpu"), |
| 42 | m_pia0(*this, "pia0"), |
| 43 | m_pia1(*this, "pia1") |
| 31 | 44 | { } |
| 32 | 45 | |
| 33 | 46 | required_device<cpu_device> m_maincpu; |
| 47 | required_device<pia6821_device> m_pia0; |
| 48 | required_device<pia6821_device> m_pia1; |
| 34 | 49 | DECLARE_WRITE8_MEMBER(kbd_put); |
| 50 | DECLARE_READ8_MEMBER(pia1_b_in); |
| 51 | DECLARE_READ_LINE_MEMBER(pia1_cb1_in); |
| 52 | UINT8 m_term_data; |
| 53 | bool m_term_key; |
| 35 | 54 | }; |
| 36 | 55 | |
| 37 | 56 | |
| r12932 | r12933 | |
| 39 | 58 | ADDRESS_MAP_UNMAP_HIGH |
| 40 | 59 | AM_RANGE(0x0000,0x9fff) AM_RAM |
| 41 | 60 | AM_RANGE(0xa000,0xcfff) AM_ROM |
| 42 | | AM_RANGE(0xd000,0xe7ff) AM_RAM |
| 43 | | AM_RANGE(0xe800,0xebff) AM_DEVREADWRITE_LEGACY("saa5050", saa5050_videoram_r, saa5050_videoram_w) |
| 44 | | AM_RANGE(0xec00,0xefff) AM_RAM |
| 61 | AM_RANGE(0xd000,0xdfff) AM_RAM |
| 62 | AM_RANGE(0xe000,0xe003) AM_DEVREADWRITE("pia0", pia6821_device, read, write) //video control PIA 6821 |
| 63 | // AM_RANGE(0xe004,0xe006) optional RS232C interface |
| 64 | AM_RANGE(0xe00c,0xe00f) AM_DEVREADWRITE("pia1", pia6821_device, read, write) //keyboard PIA 6821 |
| 65 | AM_RANGE(0xe020,0xe027) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) //timer 6840 |
| 66 | // AM_RANGE(0xe030,0xe037) Data Link Controller 6854 |
| 67 | AM_RANGE(0xe040,0xe040) AM_NOP //Set protect flip-flop after 1 E-cycle |
| 68 | AM_RANGE(0xe050,0xe05f) AM_RAM //Dynamic Address Translater (arranges memory banks) |
| 69 | // AM_RANGE(0xe060,0xe060) Select Map 1 |
| 70 | // AM_RANGE(0xe070,0xe070) Select Map 2 |
| 71 | AM_RANGE(0xe800,0xebbf) AM_DEVREADWRITE_LEGACY("saa5050", saa5050_videoram_r, saa5050_videoram_w) |
| 72 | AM_RANGE(0xebc0,0xebff) AM_RAM |
| 73 | AM_RANGE(0xec00,0xefbf) AM_RAM // screen 2 AM_DEVREADWRITE_LEGACY("saa5050", saa5050_videoram_r, saa5050_videoram_w) |
| 74 | AM_RANGE(0xefc0,0xefff) AM_RAM |
| 45 | 75 | AM_RANGE(0xf000,0xffff) AM_ROM |
| 46 | 76 | ADDRESS_MAP_END |
| 47 | 77 | |
| r12932 | r12933 | |
| 55 | 85 | { |
| 56 | 86 | } |
| 57 | 87 | |
| 88 | static const pia6821_interface poly_pia0_intf= |
| 89 | { |
| 90 | DEVCB_NULL, /* port A input */ |
| 91 | DEVCB_NULL, /* port B input */ |
| 92 | DEVCB_NULL, /* CA1 input */ |
| 93 | DEVCB_NULL, /* CB1 input */ |
| 94 | DEVCB_NULL, /* CA2 input */ |
| 95 | DEVCB_NULL, /* CB2 input */ |
| 96 | DEVCB_NULL, /* port A output */ |
| 97 | DEVCB_NULL, /* port B output */ |
| 98 | DEVCB_NULL, /* CA2 output */ |
| 99 | DEVCB_NULL, /* CB2 output */ |
| 100 | DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE), /* IRQA output */ |
| 101 | DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE) /* IRQB output */ |
| 102 | }; |
| 103 | |
| 104 | READ8_MEMBER( poly_state::pia1_b_in ) |
| 105 | { |
| 106 | // return ascii key value, bit 7 is the strobe value |
| 107 | return m_term_data; |
| 108 | } |
| 109 | |
| 110 | READ_LINE_MEMBER( poly_state::pia1_cb1_in ) |
| 111 | { |
| 112 | // return kbd strobe value |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | |
| 117 | static const pia6821_interface poly_pia1_intf= |
| 118 | { |
| 119 | DEVCB_NULL, /* port A input */ |
| 120 | DEVCB_DRIVER_MEMBER(poly_state, pia1_b_in), /* port B input */ |
| 121 | DEVCB_NULL, /* CA1 input */ |
| 122 | DEVCB_DRIVER_LINE_MEMBER(poly_state, pia1_cb1_in), /* CB1 input */ |
| 123 | DEVCB_NULL, /* CA2 input */ |
| 124 | DEVCB_NULL, /* CB2 input */ |
| 125 | DEVCB_NULL, /* port A output */ |
| 126 | DEVCB_NULL, /* port B output */ |
| 127 | DEVCB_NULL, /* CA2 output */ |
| 128 | DEVCB_NULL, /* CB2 output */ |
| 129 | DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE), |
| 130 | DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE) |
| 131 | }; |
| 132 | |
| 133 | static const ptm6840_interface poly_ptm_intf = |
| 134 | { |
| 135 | XTAL_10MHz/10, // not correct |
| 136 | { 0, 0, 0 }, |
| 137 | { DEVCB_NULL, |
| 138 | DEVCB_NULL, |
| 139 | DEVCB_NULL }, |
| 140 | DEVCB_NULL |
| 141 | }; |
| 142 | |
| 58 | 143 | static SCREEN_UPDATE( poly ) |
| 59 | 144 | { |
| 60 | 145 | device_t *saa5050 = screen->machine().device("saa5050"); |
| r12932 | r12933 | |
| 68 | 153 | { |
| 69 | 154 | "screen", |
| 70 | 155 | 0, /* starting gfxnum */ |
| 71 | | 40, 25, 40, /* x, y, size */ |
| 156 | 40, 24, 40, /* x, y, size */ |
| 72 | 157 | 0 /* rev y order */ |
| 73 | 158 | }; |
| 74 | 159 | |
| 75 | 160 | // temporary hack |
| 76 | 161 | WRITE8_MEMBER( poly_state::kbd_put ) |
| 77 | 162 | { |
| 163 | m_term_data = data; |
| 164 | //m_term_key = 1; |
| 78 | 165 | address_space *mem = m_maincpu->memory().space(AS_PROGRAM); |
| 79 | 166 | mem->write_byte(0xebec, data); |
| 80 | 167 | mem->write_byte(0xebd0, 1); // any non-zero here |
| r12932 | r12933 | |
| 100 | 187 | MCFG_SCREEN_SIZE(40 * 12, 24 * 20) |
| 101 | 188 | MCFG_SCREEN_VISIBLE_AREA(0, 40 * 12 - 1, 0, 24 * 20 - 1) |
| 102 | 189 | MCFG_SCREEN_UPDATE(poly) |
| 103 | | |
| 104 | 190 | MCFG_GFXDECODE(saa5050) |
| 105 | 191 | MCFG_PALETTE_LENGTH(128) |
| 106 | 192 | MCFG_PALETTE_INIT(saa5050) |
| 107 | 193 | |
| 194 | /* Devices */ |
| 108 | 195 | MCFG_SAA5050_ADD("saa5050", poly_saa5050_intf) |
| 196 | MCFG_PIA6821_ADD( "pia0", poly_pia0_intf ) |
| 197 | MCFG_PIA6821_ADD( "pia1", poly_pia1_intf ) |
| 198 | MCFG_PTM6840_ADD("ptm", poly_ptm_intf) |
| 109 | 199 | |
| 110 | 200 | // temporary hack |
| 111 | 201 | MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf) |