src/mess/drivers/mephisto.c
| r12982 | r12983 | |
| 2 | 2 | Mephisto 4 + 5 Chess Computer |
| 3 | 3 | 2007 Dirk V. |
| 4 | 4 | |
| 5 | | ******************************************************************************/ |
| 6 | | |
| 7 | | /* |
| 8 | | |
| 9 | | |
| 10 | 5 | CPU 65C02 P4 |
| 11 | 6 | Clock 4.9152 MHz |
| 12 | 7 | NMI CLK 600 Hz |
| r12982 | r12983 | |
| 50 | 45 | $4000-7FFF Opening Modul HG550 |
| 51 | 46 | $8000-$FFF ROM |
| 52 | 47 | |
| 53 | | |
| 54 | | */ |
| 55 | | |
| 56 | | /* Mephisto 4 Turbo Kit 18mhz - (mm4tk) |
| 48 | Mephisto 4 Turbo Kit 18mhz - (mm4tk) |
| 57 | 49 | This is a replacement rom combining the turbo kit initial rom with the original MM IV. |
| 58 | 50 | The Turbo Kit powers up to it's tiny rom, copies itself to ram, banks in normal rom, |
| 59 | 51 | copies that to faster SRAM, then patches the checksum and the LED blink delays. |
| r12982 | r12983 | |
| 64 | 56 | blinks the LEDs a little slower. |
| 65 | 57 | |
| 66 | 58 | -- Cowering (2011) |
| 67 | | */ |
| 68 | 59 | |
| 60 | 'rebel5' driver broke somewhere between 0.141 and 0.142 and is now marked as NOT_WORKING |
| 69 | 61 | |
| 62 | ***********************************************************************************************/ |
| 63 | |
| 64 | #define ADDRESS_MAP_MODERN |
| 65 | |
| 70 | 66 | #include "emu.h" |
| 71 | 67 | #include "cpu/m6502/m6502.h" |
| 72 | 68 | #include "sound/beep.h" |
| r12982 | r12983 | |
| 79 | 75 | { |
| 80 | 76 | public: |
| 81 | 77 | mephisto_state(const machine_config &mconfig, device_type type, const char *tag) |
| 82 | | : driver_device(mconfig, type, tag) { } |
| 78 | : driver_device(mconfig, type, tag), |
| 79 | m_maincpu(*this, "maincpu"), |
| 80 | m_beep(*this, BEEPER_TAG) |
| 81 | { } |
| 83 | 82 | |
| 83 | required_device<cpu_device> m_maincpu; |
| 84 | required_device<device_t> m_beep; |
| 85 | DECLARE_WRITE8_MEMBER(write_lcd); |
| 86 | DECLARE_WRITE8_MEMBER(mephisto_NMI); |
| 87 | DECLARE_READ8_MEMBER(read_keys); |
| 88 | DECLARE_WRITE8_MEMBER(write_led); |
| 89 | DECLARE_WRITE8_MEMBER(write_led_mm2); |
| 84 | 90 | UINT8 m_lcd_shift_counter; |
| 85 | 91 | UINT8 m_led_status; |
| 86 | | UINT8 *m_ram; |
| 92 | //UINT8 *m_p_ram; |
| 87 | 93 | UINT8 m_led7; |
| 88 | 94 | UINT8 m_allowNMI; |
| 89 | 95 | }; |
| 90 | 96 | |
| 91 | 97 | |
| 92 | | static WRITE8_HANDLER ( write_lcd ) |
| 98 | WRITE8_MEMBER( mephisto_state::write_lcd ) |
| 93 | 99 | { |
| 94 | | mephisto_state *state = space->machine().driver_data<mephisto_state>(); |
| 95 | | if (state->m_led7 == 0) output_set_digit_value(state->m_lcd_shift_counter,data); // 0x109 MM IV // 0x040 MM V |
| 100 | if (m_led7 == 0) output_set_digit_value(m_lcd_shift_counter,data); // 0x109 MM IV // 0x040 MM V |
| 96 | 101 | |
| 97 | | //output_set_digit_value(state->m_lcd_shift_counter,data ^ state->m_ram[0x165]); // 0x109 MM IV // 0x040 MM V |
| 98 | | state->m_lcd_shift_counter--; |
| 99 | | state->m_lcd_shift_counter &= 3; |
| 102 | //output_set_digit_value(m_lcd_shift_counter,data ^ m_p_ram[0x165]); // 0x109 MM IV // 0x040 MM V |
| 103 | m_lcd_shift_counter--; |
| 104 | m_lcd_shift_counter &= 3; |
| 100 | 105 | } |
| 101 | 106 | |
| 102 | | static WRITE8_HANDLER ( mephisto_NMI ) |
| 107 | WRITE8_MEMBER( mephisto_state::mephisto_NMI ) |
| 103 | 108 | { |
| 104 | | |
| 105 | | mephisto_state *state = space->machine().driver_data<mephisto_state>(); |
| 106 | | state->m_allowNMI = 1; |
| 109 | m_allowNMI = 1; |
| 107 | 110 | } |
| 108 | 111 | |
| 109 | | static READ8_HANDLER(read_keys) |
| 112 | READ8_MEMBER( mephisto_state::read_keys ) |
| 110 | 113 | { |
| 111 | | mephisto_state *state = space->machine().driver_data<mephisto_state>(); |
| 112 | 114 | UINT8 data; |
| 113 | 115 | static const char *const keynames[2][8] = |
| 114 | 116 | { |
| r12982 | r12983 | |
| 117 | 119 | }; |
| 118 | 120 | |
| 119 | 121 | data = 0xff; |
| 120 | | if (((state->m_led_status & 0x80) == 0x00)) |
| 121 | | data=input_port_read(space->machine(), keynames[0][offset]); |
| 122 | if (((m_led_status & 0x80) == 0x00)) |
| 123 | data=input_port_read(machine(), keynames[0][offset]); |
| 122 | 124 | else |
| 123 | | data=input_port_read(space->machine(), keynames[1][offset]); |
| 125 | data=input_port_read(machine(), keynames[1][offset]); |
| 124 | 126 | |
| 125 | | logerror("Keyboard Port = %s Data = %d\n ", ((state->m_led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data); |
| 127 | logerror("Keyboard Port = %s Data = %d\n ", ((m_led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data); |
| 126 | 128 | return data | 0x7f; |
| 127 | 129 | } |
| 128 | 130 | |
| 129 | | static WRITE8_HANDLER ( write_led ) |
| 131 | WRITE8_MEMBER( mephisto_state::write_led ) |
| 130 | 132 | { |
| 131 | | mephisto_state *state = space->machine().driver_data<mephisto_state>(); |
| 132 | 133 | UINT8 LED_offset=100; |
| 133 | 134 | data &= 0x80; |
| 134 | 135 | |
| 135 | | if (data==0)state->m_led_status &= 255-(1<<offset) ; else state->m_led_status|=1<<offset; |
| 136 | | if (offset<6)output_set_led_value(LED_offset+offset, state->m_led_status&1<<offset?1:0); |
| 137 | | if (offset==7) state->m_led7=data& 0x80 ? 0x00 :0xff; |
| 136 | if (data==0)m_led_status &= 255-(1<<offset) ; else m_led_status|=1<<offset; |
| 137 | if (offset<6)output_set_led_value(LED_offset+offset, m_led_status&1<<offset?1:0); |
| 138 | if (offset==7) m_led7=data& 0x80 ? 0x00 :0xff; |
| 138 | 139 | logerror("LEDs Offset = %d Data = %d\n",offset,data); |
| 139 | 140 | } |
| 140 | 141 | |
| 141 | | static WRITE8_HANDLER ( write_led_mm2 ) |
| 142 | WRITE8_MEMBER( mephisto_state::write_led_mm2 ) |
| 142 | 143 | { |
| 143 | | mephisto_state *state = space->machine().driver_data<mephisto_state>(); |
| 144 | | |
| 145 | 144 | UINT8 LED_offset=100; |
| 146 | 145 | data &= 0x80; |
| 147 | 146 | |
| 148 | 147 | if (data==0) |
| 149 | | state->m_led_status &= 255-(1<<offset); |
| 148 | m_led_status &= 255-(1<<offset); |
| 150 | 149 | else |
| 151 | | state->m_led_status|=1<<offset; |
| 150 | m_led_status|=1<<offset; |
| 152 | 151 | |
| 153 | 152 | if (offset<6) |
| 154 | | output_set_led_value(LED_offset+offset, state->m_led_status&1<<offset?1:0); |
| 153 | output_set_led_value(LED_offset+offset, m_led_status&1<<offset?1:0); |
| 155 | 154 | |
| 156 | 155 | if (offset==7) |
| 157 | | state->m_led7= data & 0x80 ? 0xff :0x00; //MM2 |
| 158 | | |
| 156 | m_led7= BIT(data, 7) ? 0xff :0x00; //MM2 |
| 159 | 157 | } |
| 160 | 158 | |
| 161 | | static ADDRESS_MAP_START(rebel5_mem , AS_PROGRAM, 8) |
| 162 | | AM_RANGE( 0x0000, 0x1fff) AM_RAM // AM_BASE_MEMBER(mephisto_state, m_ram)// |
| 163 | | AM_RANGE( 0x5000, 0x5000) AM_WRITE( write_lcd ) |
| 164 | | AM_RANGE( 0x3000, 0x3007) AM_READ( read_keys ) // Rebel 5.0 |
| 165 | | AM_RANGE( 0x2000, 0x2007) AM_WRITE( write_led ) // Status LEDs+ buzzer |
| 166 | | AM_RANGE( 0x3000, 0x4000) AM_READ( mboard_read_board_8 ) // Chessboard |
| 167 | | AM_RANGE( 0x6000, 0x6000) AM_WRITE ( mboard_write_LED_8) // Chessboard |
| 168 | | AM_RANGE( 0x7000, 0x7000) AM_WRITE ( mboard_write_board_8 ) // Chessboard |
| 159 | static ADDRESS_MAP_START( rebel5_mem, AS_PROGRAM, 8, mephisto_state ) |
| 160 | AM_RANGE( 0x0000, 0x1fff) AM_RAM // AM_BASE(m_p_ram) |
| 161 | AM_RANGE( 0x2000, 0x2007) AM_WRITE(write_led) // Status LEDs+ buzzer |
| 162 | AM_RANGE( 0x3000, 0x3007) AM_READ(read_keys) // Rebel 5.0 |
| 163 | AM_RANGE( 0x3000, 0x4000) AM_READ_LEGACY(mboard_read_board_8) // Chessboard |
| 164 | AM_RANGE( 0x5000, 0x5000) AM_WRITE(write_lcd) |
| 165 | AM_RANGE( 0x6000, 0x6000) AM_WRITE_LEGACY(mboard_write_LED_8) // Chessboard |
| 166 | AM_RANGE( 0x7000, 0x7000) AM_WRITE_LEGACY(mboard_write_board_8) // Chessboard |
| 169 | 167 | AM_RANGE( 0x8000, 0xffff) AM_ROM |
| 170 | 168 | ADDRESS_MAP_END |
| 171 | 169 | |
| 172 | 170 | |
| 173 | | static ADDRESS_MAP_START(mephisto_mem , AS_PROGRAM, 8) |
| 174 | | AM_RANGE( 0x0000, 0x1fff) AM_RAM AM_BASE_MEMBER(mephisto_state, m_ram )// |
| 175 | | AM_RANGE( 0x2000, 0x2000) AM_WRITE( write_lcd ) |
| 176 | | AM_RANGE( 0x2c00, 0x2c07) AM_READ( read_keys ) |
| 177 | | AM_RANGE( 0x3400, 0x3407) AM_WRITE( write_led ) // Status LEDs+ buzzer |
| 178 | | AM_RANGE( 0x2400, 0x2407) AM_WRITE ( mboard_write_LED_8 ) // Chessboard |
| 179 | | AM_RANGE( 0x2800, 0x2800) AM_WRITE ( mboard_write_board_8) // Chessboard |
| 180 | | AM_RANGE( 0x3800, 0x3800) AM_WRITE ( mephisto_NMI ) // NMI enable |
| 181 | | AM_RANGE( 0x3000, 0x3000) AM_READ( mboard_read_board_8 ) // Chessboard |
| 171 | static ADDRESS_MAP_START( mephisto_mem, AS_PROGRAM, 8, mephisto_state ) |
| 172 | AM_RANGE( 0x0000, 0x1fff) AM_RAM //AM_BASE(m_p_ram) |
| 173 | AM_RANGE( 0x2000, 0x2000) AM_WRITE(write_lcd) |
| 174 | AM_RANGE( 0x2400, 0x2407) AM_WRITE_LEGACY(mboard_write_LED_8) // Chessboard |
| 175 | AM_RANGE( 0x2800, 0x2800) AM_WRITE_LEGACY(mboard_write_board_8) // Chessboard |
| 176 | AM_RANGE( 0x2c00, 0x2c07) AM_READ(read_keys) |
| 177 | AM_RANGE( 0x3000, 0x3000) AM_READ_LEGACY(mboard_read_board_8) // Chessboard |
| 178 | AM_RANGE( 0x3400, 0x3407) AM_WRITE(write_led) // Status LEDs+ buzzer |
| 179 | AM_RANGE( 0x3800, 0x3800) AM_WRITE(mephisto_NMI) // NMI enable |
| 182 | 180 | AM_RANGE( 0x4000, 0x7fff) AM_ROM // Opening Library |
| 183 | 181 | AM_RANGE( 0x8000, 0xffff) AM_ROM |
| 184 | 182 | ADDRESS_MAP_END |
| 185 | 183 | |
| 186 | | static ADDRESS_MAP_START(mm2_mem , AS_PROGRAM, 8) |
| 187 | | AM_RANGE( 0x0000, 0x0fff) AM_RAM AM_BASE_MEMBER(mephisto_state, m_ram ) |
| 188 | | AM_RANGE( 0x2800, 0x2800) AM_WRITE( write_lcd ) |
| 189 | | AM_RANGE( 0x1800, 0x1807) AM_READ( read_keys ) |
| 190 | | AM_RANGE( 0x1000, 0x1007) AM_WRITE( write_led_mm2 ) //Status LEDs |
| 191 | | |
| 192 | | AM_RANGE( 0x3000, 0x3000) AM_WRITE ( mboard_write_LED_8 ) //Chessboard |
| 193 | | AM_RANGE( 0x3800, 0x3800) AM_WRITE ( mboard_write_board_8) //Chessboard |
| 194 | | AM_RANGE( 0x2000, 0x2000) AM_READ( mboard_read_board_8 ) //Chessboard |
| 195 | | |
| 184 | static ADDRESS_MAP_START( mm2_mem, AS_PROGRAM, 8, mephisto_state ) |
| 185 | AM_RANGE( 0x0000, 0x0fff) AM_RAM //AM_BASE(m_p_ram) |
| 186 | AM_RANGE( 0x1000, 0x1007) AM_WRITE(write_led_mm2) //Status LEDs |
| 187 | AM_RANGE( 0x1800, 0x1807) AM_READ(read_keys) |
| 188 | AM_RANGE( 0x2000, 0x2000) AM_READ_LEGACY(mboard_read_board_8) //Chessboard |
| 189 | AM_RANGE( 0x2800, 0x2800) AM_WRITE(write_lcd) |
| 190 | AM_RANGE( 0x3000, 0x3000) AM_WRITE_LEGACY(mboard_write_LED_8) //Chessboard |
| 191 | AM_RANGE( 0x3800, 0x3800) AM_WRITE_LEGACY(mboard_write_board_8) //Chessboard |
| 196 | 192 | AM_RANGE( 0x4000, 0x7fff) AM_ROM // Opening Library ? |
| 197 | 193 | AM_RANGE( 0x8000, 0xffff) AM_ROM |
| 198 | 194 | ADDRESS_MAP_END |
| r12982 | r12983 | |
| 293 | 289 | PORT_START("B_BUTTONS") |
| 294 | 290 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) |
| 295 | 291 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) |
| 296 | | |
| 297 | 292 | INPUT_PORTS_END |
| 298 | 293 | |
| 299 | 294 | static INPUT_PORTS_START( mephisto ) |
| r12982 | r12983 | |
| 332 | 327 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D 4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) |
| 333 | 328 | |
| 334 | 329 | PORT_INCLUDE( board ) |
| 335 | | |
| 336 | 330 | INPUT_PORTS_END |
| 337 | 331 | |
| 338 | 332 | |
| 339 | 333 | static TIMER_DEVICE_CALLBACK( update_nmi ) |
| 340 | 334 | { |
| 341 | 335 | mephisto_state *state = timer.machine().driver_data<mephisto_state>(); |
| 342 | | device_t *speaker = timer.machine().device(BEEPER_TAG); |
| 343 | | if (state->m_allowNMI) { |
| 336 | if (state->m_allowNMI) |
| 337 | { |
| 344 | 338 | state->m_allowNMI = 0; |
| 345 | 339 | cputag_set_input_line(timer.machine(), "maincpu", INPUT_LINE_NMI,PULSE_LINE); |
| 346 | 340 | } |
| 347 | | beep_set_state(speaker,state->m_led_status&64?1:0); |
| 341 | beep_set_state(state->m_beep, state->m_led_status&64?1:0); |
| 348 | 342 | } |
| 349 | 343 | |
| 350 | 344 | static TIMER_DEVICE_CALLBACK( update_irq ) //only mm2 |
| 351 | 345 | { |
| 352 | 346 | mephisto_state *state = timer.machine().driver_data<mephisto_state>(); |
| 353 | | device_t *speaker = timer.machine().device(BEEPER_TAG); |
| 354 | | |
| 355 | 347 | cputag_set_input_line(timer.machine(), "maincpu", M6502_IRQ_LINE, ASSERT_LINE); |
| 356 | 348 | cputag_set_input_line(timer.machine(), "maincpu", M6502_IRQ_LINE, CLEAR_LINE); |
| 357 | 349 | |
| 358 | | beep_set_state(speaker,state->m_led_status&64?1:0); |
| 350 | beep_set_state(state->m_beep, state->m_led_status&64?1:0); |
| 359 | 351 | } |
| 352 | |
| 360 | 353 | static MACHINE_START( mephisto ) |
| 361 | 354 | { |
| 362 | 355 | mephisto_state *state = machine.driver_data<mephisto_state>(); |
| r12982 | r12983 | |
| 507 | 500 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 508 | 501 | |
| 509 | 502 | CONS( 1984, mm2, mm4, 0, mm2, mephisto, mephisto, "Hegener & Glaser", "Mephisto MM2 Schachcomputer", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK ) |
| 510 | | CONS( 1986, rebel5, mm4, 0, rebel5, mephisto, mephisto, "Hegener & Glaser", "Mephisto Rebel 5 Schachcomputer", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK ) |
| 503 | CONS( 1986, rebel5, mm4, 0, rebel5, mephisto, mephisto, "Hegener & Glaser", "Mephisto Rebel 5 Schachcomputer", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK|GAME_NOT_WORKING ) |
| 511 | 504 | CONS( 1987, mm4, 0, 0, mephisto, mephisto, mephisto, "Hegener & Glaser", "Mephisto 4 Schachcomputer", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK ) |
| 512 | 505 | CONS( 1987, mm4tk, mm4, 0, mm4tk, mephisto, mephisto, "Hegener & Glaser", "Mephisto 4 Schachcomputer Turbo Kit + HG440", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK ) |
| 513 | 506 | CONS( 1990, mm5, mm4, 0, mephisto, mephisto, mephisto, "Hegener & Glaser", "Mephisto 5.1 Schachcomputer", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK ) |
| 514 | 507 | CONS( 1990, mm50, mm4, 0, mephisto, mephisto, mephisto, "Hegener & Glaser", "Mephisto 5.0 Schachcomputer", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK ) |
| 515 | 508 | CONS( 1990, mm5tk, mm4, 0, mm4tk, mephisto, mephisto, "Hegener & Glaser", "Mephisto 5.1 Schachcomputer Turbo Kit + HG550", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK ) |
| 516 | | |
| 517 | | |