src/mess/drivers/eacc.c
| r11048 | r11049 | |
| 17 | 17 | * 8000-BFFF 6821 |
| 18 | 18 | * C000-FFFF ROM (mirror) |
| 19 | 19 | * |
| 20 | | * The ROM was typed in from the dump in the magazine article, therefore |
| 21 | | * it is marked as BAD_DUMP. |
| 20 | * The ROM was typed in twice from the dump in the magazine article, and the |
| 21 | * results compared. Only one byte was different, so I can be confident that |
| 22 | * it has been typed in properly. |
| 22 | 23 | * |
| 23 | 24 | * ToDo: |
| 24 | 25 | * - Proper artwork |
| 25 | | * - There are various problems probably due to typos when making the rom. |
| 26 | * - There are various problems, seems to be another victim of inadequate |
| 27 | * 6821 emulation. |
| 26 | 28 | * |
| 27 | 29 | ******************************************************************************/ |
| 28 | 30 | #define ADDRESS_MAP_MODERN |
| r11048 | r11049 | |
| 33 | 35 | #include "eacc.lh" |
| 34 | 36 | #include "machine/6821pia.h" |
| 35 | 37 | |
| 38 | #define MACHINE_RESET_MEMBER(name) void name::machine_reset() |
| 36 | 39 | |
| 37 | 40 | class eacc_state : public driver_device |
| 38 | 41 | { |
| r11048 | r11049 | |
| 50 | 53 | DECLARE_READ_LINE_MEMBER( eacc_fuel_sensor_r ); |
| 51 | 54 | DECLARE_READ8_MEMBER( eacc_keyboard_r ); |
| 52 | 55 | DECLARE_WRITE_LINE_MEMBER( eacc_cb2_w ); |
| 53 | | DECLARE_WRITE8_MEMBER( eacc_multiplex_w ); |
| 56 | DECLARE_WRITE8_MEMBER( eacc_digit_w ); |
| 54 | 57 | DECLARE_WRITE8_MEMBER( eacc_segment_w ); |
| 55 | | UINT8 m_cb1; |
| 56 | | UINT8 m_cb2; |
| 57 | | UINT8 m_multiplex; |
| 58 | bool m_cb1; |
| 59 | bool m_cb2; |
| 60 | UINT8 m_digit; |
| 58 | 61 | UINT8 m_segment; |
| 59 | 62 | void eacc_display(); |
| 60 | 63 | virtual void machine_reset(); |
| r11048 | r11049 | |
| 106 | 109 | PORT_BIT( 0xf8, 0, IPT_UNUSED ) |
| 107 | 110 | INPUT_PORTS_END |
| 108 | 111 | |
| 109 | | void eacc_state::machine_reset() |
| 112 | MACHINE_RESET_MEMBER(eacc_state) |
| 110 | 113 | { |
| 111 | 114 | m_cb2 = 0; |
| 112 | 115 | } |
| r11048 | r11049 | |
| 120 | 123 | static TIMER_DEVICE_CALLBACK( eacc_nmi ) |
| 121 | 124 | { |
| 122 | 125 | eacc_state *state = timer.machine().driver_data<eacc_state>(); |
| 126 | |
| 123 | 127 | if (state->m_cb2) |
| 124 | 128 | device_set_input_line(timer.machine().device("maincpu"), INPUT_LINE_NMI, ASSERT_LINE); |
| 125 | 129 | } |
| r11048 | r11049 | |
| 146 | 150 | |
| 147 | 151 | READ8_MEMBER( eacc_state::eacc_keyboard_r ) |
| 148 | 152 | { |
| 149 | | UINT8 data = m_multiplex; |
| 153 | UINT8 data = m_digit; |
| 150 | 154 | |
| 151 | | if (BIT(m_multiplex, 3)) |
| 155 | if (BIT(m_digit, 3)) |
| 152 | 156 | data |= input_port_read(m_machine, "X0"); |
| 153 | | if (BIT(m_multiplex, 4)) |
| 157 | if (BIT(m_digit, 4)) |
| 154 | 158 | data |= input_port_read(m_machine, "X1"); |
| 155 | | if (BIT(m_multiplex, 5)) |
| 159 | if (BIT(m_digit, 5)) |
| 156 | 160 | data |= input_port_read(m_machine, "X2"); |
| 157 | | if (BIT(m_multiplex, 6)) |
| 161 | if (BIT(m_digit, 6)) |
| 158 | 162 | data |= input_port_read(m_machine, "X3"); |
| 159 | 163 | |
| 160 | 164 | return data; |
| r11048 | r11049 | |
| 166 | 170 | char lednum[6]; |
| 167 | 171 | |
| 168 | 172 | for (i = 3; i < 7; i++) |
| 169 | | if (BIT(m_multiplex, i)) |
| 173 | if (BIT(m_digit, i)) |
| 170 | 174 | output_set_digit_value(i, m_segment); |
| 171 | 175 | |
| 172 | | if (BIT(m_multiplex, 7)) |
| 176 | if (BIT(m_digit, 7)) |
| 173 | 177 | for (i = 0; i < 8; i++) |
| 174 | 178 | { |
| 175 | 179 | sprintf(lednum,"led%d",i); |
| r11048 | r11049 | |
| 192 | 196 | eacc_display(); |
| 193 | 197 | } |
| 194 | 198 | |
| 195 | | WRITE8_MEMBER( eacc_state::eacc_multiplex_w ) |
| 199 | WRITE8_MEMBER( eacc_state::eacc_digit_w ) |
| 196 | 200 | { |
| 197 | 201 | device_set_input_line(m_machine.device("maincpu"), INPUT_LINE_NMI, CLEAR_LINE); |
| 198 | | m_multiplex = data & 0xf8; |
| 202 | m_digit = data & 0xf8; |
| 199 | 203 | eacc_display(); |
| 200 | 204 | } |
| 201 | 205 | |
| r11048 | r11049 | |
| 208 | 212 | DEVCB_DRIVER_LINE_MEMBER(eacc_state, eacc_fuel_sensor_r), /* CA2 input - pulses as fuel consumed */ |
| 209 | 213 | DEVCB_NULL, /* CB2 input */ |
| 210 | 214 | DEVCB_DRIVER_MEMBER(eacc_state, eacc_segment_w), /* port A output */ |
| 211 | | DEVCB_DRIVER_MEMBER(eacc_state, eacc_multiplex_w), /* port B output */ |
| 215 | DEVCB_DRIVER_MEMBER(eacc_state, eacc_digit_w), /* port B output */ |
| 212 | 216 | DEVCB_NULL, /* CA2 output */ |
| 213 | 217 | DEVCB_DRIVER_LINE_MEMBER(eacc_state, eacc_cb2_w), /* CB2 output - high after boot complete */ |
| 214 | 218 | DEVCB_CPU_INPUT_LINE("maincpu", M6800_IRQ_LINE), /* IRQA output */ |