trunk/src/emu/machine/r10788.c
| r0 | r242272 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Rockwell 10788 General Purpose Keyboard and Display circuit |
| 4 | |
| 5 | Copyright Nicola Salmoria and the MAME Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | |
| 9 | REGISTER DESCRIPTION |
| 10 | |
| 11 | |
| 12 | [ Opcodes IOL, I2 ] |
| 13 | NAME W/IO CS I/O CMD I/O Names |
| 14 | -------------------------------------------------------------- |
| 15 | KTR 1 1 x x x 1 1 0 0 Transfer Keyboard Return |
| 16 | KTS 1 1 x x x 1 0 1 0 Transfer Keyboard Strobe |
| 17 | KLA 1 1 x x x 1 1 1 0 Load Display Register A |
| 18 | KLB 1 1 x x x 1 1 0 1 Load Display Register A |
| 19 | KDN 1 1 x x x 0 0 1 1 Turn On Display |
| 20 | KAF 1 1 x x x 1 0 1 1 Turn Off A |
| 21 | KBF 1 1 x x x 0 1 1 1 Turn Off B |
| 22 | KER 1 1 x x x 0 1 1 0 Reset Keyboard Error |
| 23 | |
| 24 | Notes: |
| 25 | 1.) W/IO is generated by the first word of the PPS IOL instruction. |
| 26 | 2.) Polarities of I/O7, I/O6 and I/O5 must be the same as the |
| 27 | polarities of the chip select straps SC7, SC6 and SC5. |
| 28 | 3.) KLA resets DA1-DA4 and DB1 and DB2 to VSS level. KLB resets |
| 29 | DB3 and DB4 to VSS level. |
| 30 | 4.) KAF and KBF is used to blank the display without changing the |
| 31 | contents of display data registers. |
| 32 | 5.) KAF resets output lines DA1, DA2, DA3, DA4, DB1 and DB2 to |
| 33 | VSS level. KBF resets output lines DB3 and DB4 to VSS level. |
| 34 | 6.) KAF stops the circulation of the display register A, and KBF |
| 35 | stops the circulation of the display register B. |
| 36 | 7.) KER takes a maximum of 10-bit times to complete (= 80 clocks) |
| 37 | Therefore, there must be at least 10 bit times between KER |
| 38 | and the next KTS instruction. |
| 39 | **********************************************************************/ |
| 40 | |
| 41 | #include "emu.h" |
| 42 | #include "machine/r10788.h" |
| 43 | |
| 44 | |
| 45 | /************************************* |
| 46 | * |
| 47 | * Device interface |
| 48 | * |
| 49 | *************************************/ |
| 50 | |
| 51 | const device_type R10788 = &device_creator<r10788_device>; |
| 52 | |
| 53 | r10788_device::r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 54 | : device_t(mconfig, R10788, "Rockwell 10788", tag, owner, clock, "r10788", __FILE__), |
| 55 | m_reg(), |
| 56 | m_ktr(0), m_kts(0), m_kla(0), m_klb(0), m_enable(3), m_ker(0), |
| 57 | m_scan_counter(0), |
| 58 | m_display(*this) |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @brief r10788_device::device_start device-specific startup |
| 64 | */ |
| 65 | void r10788_device::device_start() |
| 66 | { |
| 67 | m_display.resolve(); |
| 68 | |
| 69 | save_item(NAME(m_reg)); |
| 70 | save_item(NAME(m_ktr)); |
| 71 | save_item(NAME(m_kts)); |
| 72 | save_item(NAME(m_kla)); |
| 73 | save_item(NAME(m_klb)); |
| 74 | save_item(NAME(m_enable)); |
| 75 | save_item(NAME(m_ker)); |
| 76 | save_item(NAME(m_scan_counter)); |
| 77 | |
| 78 | m_timer = timer_alloc(TIMER_DISPLAY); |
| 79 | /* Default clock is from CPU1 */ |
| 80 | if (clock() == 0) |
| 81 | { |
| 82 | set_unscaled_clock(machine().firstcpu->clock()); |
| 83 | } |
| 84 | m_timer->adjust(clocks_to_attotime(36)); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @brief r10788_device::device_reset device-specific reset |
| 89 | */ |
| 90 | void r10788_device::device_reset() |
| 91 | { |
| 92 | for (int i = 0; i < 16; i++) |
| 93 | m_reg[0][i] = m_reg[1][i] = 0; |
| 94 | m_ktr = 0; |
| 95 | m_kts = 0; |
| 96 | m_kla = 0; |
| 97 | m_klb = 0; |
| 98 | m_enable = 3; |
| 99 | m_ker = 0; |
| 100 | m_scan_counter = 0; |
| 101 | } |
| 102 | |
| 103 | |
| 104 | /** |
| 105 | * @brief r10788_device::device_timer timer event callback |
| 106 | * @param timer emu_timer which fired |
| 107 | * @param id timer identifier |
| 108 | * @param param parameter |
| 109 | * @param ptr pointer parameter |
| 110 | */ |
| 111 | void r10788_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 112 | { |
| 113 | m_scan_counter = (m_scan_counter + 1) % 16; |
| 114 | switch (id) |
| 115 | { |
| 116 | case TIMER_DISPLAY: |
| 117 | m_display(m_scan_counter, m_reg[0][m_scan_counter] << 4 | m_reg[1][m_scan_counter], 0xff); |
| 118 | break; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | /************************************* |
| 123 | * |
| 124 | * Constants |
| 125 | * |
| 126 | *************************************/ |
| 127 | |
| 128 | /************************************* |
| 129 | * |
| 130 | * Command access handlers |
| 131 | * |
| 132 | *************************************/ |
| 133 | |
| 134 | WRITE8_MEMBER( r10788_device::io_w ) |
| 135 | { |
| 136 | assert(offset < 16); |
| 137 | switch (offset) |
| 138 | { |
| 139 | case KTR: // Transfer Keyboard Return |
| 140 | m_ktr = data; |
| 141 | break; |
| 142 | case KTS: // Transfer Keyboard Strobe |
| 143 | m_kts = data; |
| 144 | break; |
| 145 | case KLA: // Load Display Register A |
| 146 | m_kla = data; |
| 147 | break; |
| 148 | case KLB: // Load Display Register B |
| 149 | m_klb = data; |
| 150 | break; |
| 151 | case KDN: // Turn On Display |
| 152 | m_enable = 1 | 2; |
| 153 | break; |
| 154 | case KAF: // Turn Off A |
| 155 | m_enable &= ~1; |
| 156 | break; |
| 157 | case KBF: // Turn Off B |
| 158 | m_enable &= ~1; |
| 159 | break; |
| 160 | case KER: // Reset Keyboard Error |
| 161 | m_ker = 10; |
| 162 | break; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | |
| 167 | READ8_MEMBER( r10788_device::io_r ) |
| 168 | { |
| 169 | assert(offset < 16); |
| 170 | UINT8 data = 0xf; |
| 171 | switch (offset) |
| 172 | { |
| 173 | case KTR: // Transfer Keyboard Return |
| 174 | data = m_ktr; |
| 175 | break; |
| 176 | case KTS: // Transfer Keyboard Strobe |
| 177 | data = m_kts; |
| 178 | break; |
| 179 | case KLA: // Load Display Register A |
| 180 | data = m_kla; |
| 181 | break; |
| 182 | case KLB: // Load Display Register B |
| 183 | data = m_klb; |
| 184 | break; |
| 185 | case KDN: // Turn On Display |
| 186 | break; |
| 187 | case KAF: // Turn Off A |
| 188 | break; |
| 189 | case KBF: // Turn Off B |
| 190 | break; |
| 191 | case KER: // Reset Keyboard Error |
| 192 | break; |
| 193 | } |
| 194 | return data; |
| 195 | } |
trunk/src/emu/machine/r10788.h
| r0 | r242272 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Rockwell 10788 General Purpose Keyboard and Display circuit |
| 4 | |
| 5 | Juergen Buchmueller <pullmoll@t-online.de> |
| 6 | |
| 7 | The device decodes reads/write to a 16 byte I/O range defined |
| 8 | by three wired inputs SC5, SC6 and SC7. The range is one of |
| 9 | 80-8f, 90-9f, ..., f0-ff depending on the wiring. |
| 10 | |
| 11 | **********************************************************************/ |
| 12 | |
| 13 | #ifndef __R10788_H__ |
| 14 | #define __R10788_H__ |
| 15 | |
| 16 | #include "device.h" |
| 17 | |
| 18 | /************************************* |
| 19 | * |
| 20 | * Device configuration macros |
| 21 | * |
| 22 | *************************************/ |
| 23 | |
| 24 | /* Set the writer used to update a display digit */ |
| 25 | #define MCFG_R10788_UPDATE(_devcb) \ |
| 26 | r10788_device::set_update(*device, DEVCB_##_devcb); |
| 27 | |
| 28 | class r10788_device : public device_t |
| 29 | { |
| 30 | public: |
| 31 | r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 32 | ~r10788_device() {} |
| 33 | |
| 34 | enum { |
| 35 | KTR = 0xc, //!< Transfer Keyboard Return |
| 36 | KTS = 0xa, //!< Transfer Keyboard Strobe |
| 37 | KLA = 0xe, //!< Load Display Register A |
| 38 | KLB = 0xd, //!< Load Display Register B |
| 39 | KDN = 0x3, //!< Turn On Display |
| 40 | KAF = 0xb, //!< Turn Off A |
| 41 | KBF = 0x7, //!< Turn Off B |
| 42 | KER = 0x6 //!< Reset Keyboard Error |
| 43 | }; |
| 44 | |
| 45 | DECLARE_READ8_MEMBER ( io_r ); |
| 46 | DECLARE_WRITE8_MEMBER( io_w ); |
| 47 | |
| 48 | template<class _Object> static devcb_base &set_update(device_t &device, _Object object) { return downcast<r10788_device &>(device).m_display.set_callback(object); } |
| 49 | protected: |
| 50 | // device-level overrides |
| 51 | virtual void device_start(); |
| 52 | virtual void device_reset(); |
| 53 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 54 | |
| 55 | private: |
| 56 | static const device_timer_id TIMER_DISPLAY = 0; |
| 57 | |
| 58 | UINT8 m_reg[2][16]; //!< display registers |
| 59 | UINT8 m_ktr; //!< transfer keyboard return value |
| 60 | UINT8 m_kts; //!< transfer keyboard strobe value |
| 61 | UINT8 m_kla; //!< display register A value |
| 62 | UINT8 m_klb; //!< display register B value |
| 63 | UINT8 m_enable; //!< display enable flags for A (1) and B (2) |
| 64 | UINT8 m_ker; //!< keyboard error value |
| 65 | int m_scan_counter; //!< current display scan |
| 66 | devcb_write8 m_display; //!< display updater |
| 67 | emu_timer* m_timer; //!< timer running at clock / 18 / 36 |
| 68 | }; |
| 69 | |
| 70 | extern const device_type R10788; |
| 71 | |
| 72 | #endif /* __R10788_H__ */ |
trunk/src/mame/drivers/gts1.c
| r242271 | r242272 | |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | #include "machine/genpin.h" |
| 70 | #include "machine/r10788.h" |
| 70 | 71 | #include "cpu/pps4/pps4.h" |
| 71 | 72 | #include "gts1.lh" |
| 72 | 73 | |
| r242271 | r242272 | |
| 87 | 88 | { } |
| 88 | 89 | |
| 89 | 90 | DECLARE_DRIVER_INIT(gts1); |
| 91 | |
| 92 | DECLARE_WRITE8_MEMBER(gts1_display_w); |
| 93 | DECLARE_READ8_MEMBER (gts1_io_r); |
| 94 | DECLARE_WRITE8_MEMBER(gts1_io_w); |
| 90 | 95 | DECLARE_READ8_MEMBER (gts1_pa_r); |
| 91 | 96 | DECLARE_WRITE8_MEMBER(gts1_pa_w); |
| 92 | 97 | DECLARE_WRITE8_MEMBER(gts1_pb_w); |
| 93 | 98 | private: |
| 94 | 99 | virtual void machine_reset(); |
| 95 | 100 | required_device<cpu_device> m_maincpu; |
| 101 | // required_device<r10788_device> m_gpkd; // FIXME: doesn't compile |
| 102 | UINT8 m_io[256]; |
| 103 | UINT8 m_counter; |
| 96 | 104 | UINT8 m_6351_addr; |
| 97 | 105 | }; |
| 98 | 106 | |
| r242271 | r242272 | |
| 101 | 109 | ADDRESS_MAP_END |
| 102 | 110 | |
| 103 | 111 | static ADDRESS_MAP_START( gts1_data, AS_DATA, 8, gts1_state ) |
| 104 | | AM_RANGE(0x0000, 0x0fff) AM_RAM // not correct |
| 112 | AM_RANGE(0x0000, 0x00ff) AM_RAM // not correct |
| 105 | 113 | ADDRESS_MAP_END |
| 106 | 114 | |
| 107 | 115 | static ADDRESS_MAP_START( gts1_io, AS_IO, 8, gts1_state ) |
| 108 | | AM_RANGE(0x0000, 0x00ff) AM_RAM // connects to all the other chips |
| 109 | | AM_RANGE(0x0100, 0x0100) AM_READ (gts1_pa_r) AM_WRITE(gts1_pa_w) |
| 116 | AM_RANGE(0x00d0, 0x00df) AM_DEVREADWRITE ( "r10788", r10788_device, io_r, io_w ) |
| 117 | AM_RANGE(0x0000, 0x00ff) AM_READ ( gts1_io_r ) AM_WRITE( gts1_io_w ) // connects to all the other chips |
| 118 | |
| 119 | AM_RANGE(0x0100, 0x0100) AM_READ ( gts1_pa_r ) AM_WRITE( gts1_pa_w ) |
| 110 | 120 | AM_RANGE(0x0101, 0x0101) AM_WRITE(gts1_pb_w) |
| 111 | 121 | ADDRESS_MAP_END |
| 112 | 122 | |
| r242271 | r242272 | |
| 199 | 209 | { |
| 200 | 210 | } |
| 201 | 211 | |
| 212 | /** |
| 213 | * @brief write a 8seg display value |
| 214 | * @param offset digit number 0 .. 19 |
| 215 | * @param data 4-bit value to display |
| 216 | */ |
| 217 | WRITE8_MEMBER(gts1_state::gts1_display_w) |
| 218 | { |
| 219 | output_set_digit_value(offset, data); |
| 220 | } |
| 221 | |
| 222 | READ8_MEMBER (gts1_state::gts1_io_r) |
| 223 | { |
| 224 | UINT8 data = m_io[offset] & 0x0f; |
| 225 | LOG(("%s: io[%02x] -> %x\n", __FUNCTION__, offset, data)); |
| 226 | return data; |
| 227 | } |
| 228 | |
| 229 | WRITE8_MEMBER(gts1_state::gts1_io_w) |
| 230 | { |
| 231 | LOG(("%s: io[%02x] <- %x\n", __FUNCTION__, offset, data)); |
| 232 | m_io[offset] = data; |
| 233 | } |
| 234 | |
| 202 | 235 | READ8_MEMBER (gts1_state::gts1_pa_r) |
| 203 | 236 | { |
| 204 | 237 | // return ROM nibble |
| r242271 | r242272 | |
| 232 | 265 | |
| 233 | 266 | //MCFG_NVRAM_ADD_0FILL("nvram") |
| 234 | 267 | |
| 268 | /* General Purpose Display and Keyboard */ |
| 269 | MCFG_R10788_UPDATE( WRITE8(gts1_state,gts1_display_w) ) |
| 270 | |
| 235 | 271 | /* Video */ |
| 236 | | MCFG_DEFAULT_LAYOUT(layout_gts1) |
| 272 | MCFG_DEFAULT_LAYOUT( layout_gts1 ) |
| 237 | 273 | |
| 238 | 274 | /* Sound */ |
| 239 | 275 | MCFG_FRAGMENT_ADD( genpin_audio ) |