src/mess/drivers/eacc.c
| r15436 | r15437 | |
| 4 | 4 | * by Robbbert, March 2011. |
| 5 | 5 | * |
| 6 | 6 | * Described in Electronics Australia magazine during 1982. |
| 7 | * Construction and usage: http://messui.the-chronicles.org/comp/eacc.pdf |
| 7 | 8 | * |
| 8 | 9 | * The only RAM is the 128 bytes that comes inside the CPU. |
| 9 | 10 | * |
| r15436 | r15437 | |
| 12 | 13 | * may be obtained. |
| 13 | 14 | * |
| 14 | 15 | * Memory Map |
| 15 | | * 0000-00FF internal ram |
| 16 | * 0000-007F internal ram |
| 16 | 17 | * 4000-7FFF ROM |
| 17 | 18 | * 8000-BFFF 6821 |
| 18 | 19 | * C000-FFFF ROM (mirror) |
| r15436 | r15437 | |
| 21 | 22 | * results compared. Only one byte was different, so I can be confident that |
| 22 | 23 | * it has been typed in properly. |
| 23 | 24 | * |
| 24 | | * ToDo: |
| 25 | | * - Proper artwork |
| 26 | | * - Verify operation with the instructions |
| 25 | * Setting up: You need to enter the number of expected pulses from the fuel |
| 26 | * and distance sensors. Paste this: 5 6M123N 7M400N (start, set litres cal to |
| 27 | * 123 pulses. set km cal to 400 pulses). Then paste this: 1950M0N 1845M0N (set |
| 28 | * petrol tank capacity to 50 litres, set current amount of petrol to 45). |
| 29 | * Now enter: 28M100N (the journey is 100km). Press 5 to start the journey. |
| 30 | * All settings are saved in nvram. |
| 27 | 31 | * |
| 32 | * Stats you can see while travelling: |
| 33 | * 0 - time elapsed |
| 34 | * 08 - time remaining |
| 35 | * 1 - fuel used |
| 36 | * 18 - fuel left |
| 37 | * 2 - km travelled |
| 38 | * 28 - km remaining |
| 39 | * 29 - km that could be travelled with the fuel you have left |
| 40 | * 3 - speed now |
| 41 | * 39 - average speed |
| 42 | * 4 - fuel consumption now (litres per 100km) |
| 43 | * 49 - fuel average consumption |
| 44 | * |
| 28 | 45 | ******************************************************************************/ |
| 29 | 46 | |
| 30 | 47 | /* Core includes */ |
| r15436 | r15437 | |
| 32 | 49 | #include "cpu/m6800/m6800.h" |
| 33 | 50 | #include "eacc.lh" |
| 34 | 51 | #include "machine/6821pia.h" |
| 52 | #include "machine/nvram.h" |
| 35 | 53 | |
| 36 | 54 | #define MACHINE_RESET_MEMBER(name) void name::machine_reset() |
| 37 | 55 | |
| r15436 | r15437 | |
| 41 | 59 | eacc_state(const machine_config &mconfig, device_type type, const char *tag) |
| 42 | 60 | : driver_device(mconfig, type, tag), |
| 43 | 61 | m_maincpu(*this, "maincpu"), |
| 44 | | m_pia(*this, "pia") |
| 62 | m_pia(*this, "pia"), |
| 63 | m_p_nvram(*this, "nvram") |
| 45 | 64 | { } |
| 46 | 65 | |
| 47 | | required_device<cpu_device> m_maincpu; |
| 48 | | required_device<device_t> m_pia; |
| 49 | 66 | DECLARE_READ_LINE_MEMBER( eacc_cb1_r ); |
| 50 | 67 | DECLARE_READ_LINE_MEMBER( eacc_distance_r ); |
| 51 | 68 | DECLARE_READ_LINE_MEMBER( eacc_fuel_sensor_r ); |
| r15436 | r15437 | |
| 56 | 73 | bool m_cb1; |
| 57 | 74 | bool m_cb2; |
| 58 | 75 | bool m_nmi; |
| 76 | required_device<cpu_device> m_maincpu; |
| 77 | required_device<device_t> m_pia; |
| 78 | required_shared_ptr<UINT8> m_p_nvram; |
| 59 | 79 | virtual void machine_reset(); |
| 60 | 80 | private: |
| 61 | 81 | UINT8 m_digit; |
| r15436 | r15437 | |
| 73 | 93 | static ADDRESS_MAP_START(eacc_mem, AS_PROGRAM, 8, eacc_state) |
| 74 | 94 | ADDRESS_MAP_UNMAP_HIGH |
| 75 | 95 | ADDRESS_MAP_GLOBAL_MASK(0xc7ff) // A11,A12,A13 not connected |
| 76 | | AM_RANGE(0x0000, 0x007f) AM_RAM // internal |
| 96 | AM_RANGE(0x0000, 0x001f) AM_RAM AM_SHARE("nvram") // inside cpu, battery-backed |
| 97 | AM_RANGE(0x0020, 0x007f) AM_RAM // inside cpu |
| 77 | 98 | AM_RANGE(0x6000, 0x67ff) AM_ROM AM_MIRROR(0x8000) |
| 78 | 99 | AM_RANGE(0x8004, 0x8007) AM_MIRROR(0x7fc) AM_DEVREADWRITE("pia", pia6821_device, read, write) |
| 79 | 100 | ADDRESS_MAP_END |
| r15436 | r15437 | |
| 85 | 106 | |
| 86 | 107 | static INPUT_PORTS_START(eacc) |
| 87 | 108 | PORT_START("X0") |
| 88 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 Fuel Cal") PORT_CODE(KEYCODE_6) |
| 89 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) |
| 90 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 Distance") PORT_CODE(KEYCODE_2) |
| 109 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 Litres Cal") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') |
| 110 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('M') |
| 111 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 km") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') |
| 91 | 112 | PORT_BIT( 0xf8, 0, IPT_UNUSED ) |
| 92 | 113 | |
| 93 | 114 | PORT_START("X1") |
| 94 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 START") PORT_CODE(KEYCODE_5) |
| 95 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("END") PORT_CODE(KEYCODE_END) |
| 96 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 Speed") PORT_CODE(KEYCODE_3) |
| 115 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 START") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') |
| 116 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("END") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('N') |
| 117 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 km/h") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') |
| 97 | 118 | PORT_BIT( 0xf8, 0, IPT_UNUSED ) |
| 98 | 119 | |
| 99 | 120 | PORT_START("X2") |
| 100 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 Distance Cal") PORT_CODE(KEYCODE_7) |
| 101 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 Time") PORT_CODE(KEYCODE_0) |
| 102 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 Consumption") PORT_CODE(KEYCODE_4) |
| 121 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 Km Cal") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') |
| 122 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 hour.min") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') |
| 123 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 l/100km") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') |
| 103 | 124 | PORT_BIT( 0xf8, 0, IPT_UNUSED ) |
| 104 | 125 | |
| 105 | 126 | PORT_START("X3") |
| 106 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 Remaining") PORT_CODE(KEYCODE_8) |
| 107 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 Fuel") PORT_CODE(KEYCODE_1) |
| 108 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 Average") PORT_CODE(KEYCODE_9) |
| 127 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 REM") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') |
| 128 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 litres") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') |
| 129 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 AV") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') |
| 109 | 130 | PORT_BIT( 0xf8, 0, IPT_UNUSED ) |
| 110 | 131 | INPUT_PORTS_END |
| 111 | 132 | |
| r15436 | r15437 | |
| 118 | 139 | { |
| 119 | 140 | eacc_state *state = timer.machine().driver_data<eacc_state>(); |
| 120 | 141 | state->m_cb1 ^= 1; // 15hz |
| 142 | if (state->m_cb2) |
| 143 | device_set_input_line(timer.machine().device("maincpu"), M6800_IRQ_LINE, ASSERT_LINE); |
| 121 | 144 | } |
| 122 | 145 | |
| 123 | 146 | static TIMER_DEVICE_CALLBACK( eacc_nmi ) |
| r15436 | r15437 | |
| 133 | 156 | |
| 134 | 157 | READ_LINE_MEMBER( eacc_state::eacc_cb1_r ) |
| 135 | 158 | { |
| 136 | | return m_cb1; |
| 159 | return (m_cb2) ? m_cb1 : 1; |
| 137 | 160 | } |
| 138 | 161 | |
| 139 | 162 | READ_LINE_MEMBER( eacc_state::eacc_distance_r ) |
| r15436 | r15437 | |
| 143 | 166 | |
| 144 | 167 | READ_LINE_MEMBER( eacc_state::eacc_fuel_sensor_r ) |
| 145 | 168 | { |
| 146 | | return machine().rand() & 1; // needs random pulses to simulate acceleration |
| 169 | return machine().rand() & 1; // needs random pulses to simulate fuel usage |
| 147 | 170 | } |
| 148 | 171 | |
| 149 | 172 | WRITE_LINE_MEMBER( eacc_state::eacc_cb2_w ) |
| r15436 | r15437 | |
| 241 | 264 | MCFG_DEFAULT_LAYOUT(layout_eacc) |
| 242 | 265 | |
| 243 | 266 | MCFG_PIA6821_ADD("pia", eacc_mc6821_intf) |
| 267 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 244 | 268 | MCFG_TIMER_ADD_PERIODIC("eacc_nmi", eacc_nmi, attotime::from_hz(600) ) |
| 245 | 269 | MCFG_TIMER_ADD_PERIODIC("eacc_cb1", eacc_cb1, attotime::from_hz(30) ) |
| 246 | 270 | MACHINE_CONFIG_END |
| r15436 | r15437 | |
| 261 | 285 | Drivers |
| 262 | 286 | ******************************************************************************/ |
| 263 | 287 | |
| 264 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 265 | | COMP( 1982, eacc, 0, 0, eacc, eacc, 0, "Electronics Australia", "EA Car Computer", GAME_NOT_WORKING | GAME_NO_SOUND_HW) |
| 288 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 289 | COMP( 1982, eacc, 0, 0, eacc, eacc, 0, "Electronics Australia", "EA Car Computer", GAME_NO_SOUND_HW) |
| 266 | 290 | |