trunk/src/mess/drivers/acrnsys1.c
| r23767 | r23768 | |
| 27 | 27 | -0100^11^22^33^44^55^66^77^88^99^-0100^ |
| 28 | 28 | Now press up-arrow to confirm the data has been entered. |
| 29 | 29 | |
| 30 | | ToDo: |
| 31 | | - Artwork |
| 32 | | - Cassette |
| 33 | 30 | |
| 34 | 31 | Example usage: Turn on. Press -. Mode letter will show 'A'. Type in an address |
| 35 | 32 | (example FE00). Press - (or any command key). Contents will show |
| 36 | 33 | on the right. Use Up & Down keys to cycle through addresses. |
| 37 | 34 | |
| 35 | To save a tape, press S then enter start address, press S, enter end address+1, |
| 36 | start recording and press S. The save only takes a few seconds. |
| 37 | |
| 38 | To load a tape, the display must just have dots, (reset if necessary), start |
| 39 | playing tape and immediately press L. The last digit will flicker |
| 40 | as the bytes load. At the end, the dots will show again. There's |
| 41 | no error checking, so if it doesn't work, reset and try again. |
| 42 | |
| 38 | 43 | Note that left-most digit is not wired up, and therefore will always be blank. |
| 39 | 44 | |
| 40 | 45 | ******************************************************************************/ |
| r23767 | r23768 | |
| 43 | 48 | #include "cpu/m6502/m6502.h" |
| 44 | 49 | #include "machine/ins8154.h" |
| 45 | 50 | #include "machine/74145.h" |
| 51 | #include "imagedev/cassette.h" |
| 52 | #include "sound/wave.h" |
| 46 | 53 | #include "acrnsys1.lh" |
| 47 | 54 | |
| 48 | 55 | |
| r23767 | r23768 | |
| 51 | 58 | public: |
| 52 | 59 | acrnsys1_state(const machine_config &mconfig, device_type type, const char *tag) |
| 53 | 60 | : driver_device(mconfig, type, tag), |
| 54 | | m_maincpu(*this, "maincpu"), |
| 55 | | m_ttl74145(*this, "ic8_7445"), |
| 56 | | m_digit(0) |
| 61 | m_maincpu(*this, "maincpu"), |
| 62 | m_ttl74145(*this, "ic8_7445"), |
| 63 | m_cass(*this, "cassette"), |
| 64 | m_digit(0) |
| 57 | 65 | { } |
| 58 | 66 | |
| 59 | | required_device<cpu_device> m_maincpu; |
| 60 | | required_device<ttl74145_device> m_ttl74145; |
| 61 | 67 | DECLARE_READ8_MEMBER(ins8154_b1_port_a_r); |
| 62 | 68 | DECLARE_WRITE8_MEMBER(ins8154_b1_port_a_w); |
| 63 | 69 | DECLARE_WRITE8_MEMBER(acrnsys1_led_segment_w); |
| 70 | TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_c); |
| 71 | TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_p); |
| 72 | private: |
| 73 | required_device<cpu_device> m_maincpu; |
| 74 | required_device<ttl74145_device> m_ttl74145; |
| 75 | required_device<cassette_image_device> m_cass; |
| 64 | 76 | UINT8 m_digit; |
| 77 | UINT8 m_cass_data[4]; |
| 78 | bool m_cass_state; |
| 65 | 79 | }; |
| 66 | 80 | |
| 67 | 81 | |
| r23767 | r23768 | |
| 72 | 86 | // bit 7 is cassin |
| 73 | 87 | READ8_MEMBER( acrnsys1_state::ins8154_b1_port_a_r ) |
| 74 | 88 | { |
| 75 | | UINT8 data = 0xff, i, key_line = m_ttl74145->read(); |
| 89 | UINT8 data = 0x7f, i, key_line = m_ttl74145->read(); |
| 76 | 90 | |
| 77 | 91 | for (i = 0; i < 8; i++) |
| 78 | 92 | { |
| r23767 | r23768 | |
| 84 | 98 | break; |
| 85 | 99 | } |
| 86 | 100 | } |
| 87 | | |
| 101 | data |= m_cass_data[2]; |
| 88 | 102 | return data; |
| 89 | 103 | } |
| 90 | 104 | |
| 91 | 105 | // bit 6 is cassout |
| 92 | 106 | WRITE8_MEMBER( acrnsys1_state::ins8154_b1_port_a_w ) |
| 93 | 107 | { |
| 94 | | m_digit = data & 0xc7; |
| 108 | m_digit = data & 0x47; |
| 95 | 109 | m_ttl74145->write(m_digit & 7); |
| 110 | m_cass_state = BIT(data, 6); |
| 96 | 111 | } |
| 97 | 112 | |
| 113 | TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_c) |
| 114 | { |
| 115 | m_cass_data[3]++; |
| 98 | 116 | |
| 117 | if (m_cass_state) |
| 118 | m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz |
| 119 | else |
| 120 | m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz |
| 121 | } |
| 122 | |
| 123 | TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_p) |
| 124 | { |
| 125 | /* cassette - turn 1200/2400Hz to a bit */ |
| 126 | m_cass_data[1]++; |
| 127 | UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; |
| 128 | |
| 129 | if (cass_ws != m_cass_data[0]) |
| 130 | { |
| 131 | m_cass_data[0] = cass_ws; |
| 132 | m_cass_data[2] = ((m_cass_data[1] < 12) ? 128 : 0); |
| 133 | m_cass_data[1] = 0; |
| 134 | } |
| 135 | } |
| 136 | |
| 99 | 137 | /*************************************************************************** |
| 100 | 138 | LED DISPLAY |
| 101 | 139 | ***************************************************************************/ |
| r23767 | r23768 | |
| 209 | 247 | |
| 210 | 248 | MCFG_DEFAULT_LAYOUT(layout_acrnsys1) |
| 211 | 249 | |
| 250 | /* sound hardware */ |
| 251 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 252 | MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") |
| 253 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 254 | |
| 212 | 255 | /* devices */ |
| 213 | 256 | MCFG_INS8154_ADD("b1", ins8154_b1) |
| 214 | 257 | MCFG_TTL74145_ADD("ic8_7445", default_ttl74145) |
| 258 | MCFG_CASSETTE_ADD( "cassette", default_cassette_interface ) |
| 259 | MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_c", acrnsys1_state, acrnsys1_c, attotime::from_hz(4800)) |
| 260 | MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_p", acrnsys1_state, acrnsys1_p, attotime::from_hz(40000)) |
| 215 | 261 | MACHINE_CONFIG_END |
| 216 | 262 | |
| 217 | 263 | |
| r23767 | r23768 | |
| 230 | 276 | ***************************************************************************/ |
| 231 | 277 | |
| 232 | 278 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 233 | | COMP( 1978, acrnsys1, 0, 0, acrnsys1, acrnsys1, driver_device, 0, "Acorn", "Acorn System 1", GAME_NO_SOUND_HW ) |
| 279 | COMP( 1978, acrnsys1, 0, 0, acrnsys1, acrnsys1, driver_device, 0, "Acorn", "Acorn System 1", 0 ) |