trunk/src/mame/drivers/peyper.c
| r32232 | r32233 | |
| 7 | 7 | |
| 8 | 8 | #include "machine/genpin.h" |
| 9 | 9 | #include "cpu/z80/z80.h" |
| 10 | #include "machine/i8279.h" |
| 10 | 11 | #include "sound/ay8910.h" |
| 11 | 12 | #include "peyper.lh" |
| 12 | 13 | |
| r32232 | r32233 | |
| 24 | 25 | DECLARE_WRITE8_MEMBER(lamp_w); |
| 25 | 26 | DECLARE_WRITE8_MEMBER(lamp7_w); |
| 26 | 27 | DECLARE_WRITE8_MEMBER(sol_w); |
| 28 | DECLARE_WRITE8_MEMBER(p1a_w) { }; // more lamps |
| 29 | DECLARE_WRITE8_MEMBER(p1b_w) { }; // more lamps |
| 30 | DECLARE_WRITE8_MEMBER(p2a_w) { }; // more lamps |
| 31 | DECLARE_WRITE8_MEMBER(p2b_w) { }; // more lamps |
| 27 | 32 | DECLARE_CUSTOM_INPUT_MEMBER(wolfman_replay_hs_r); |
| 28 | 33 | DECLARE_DRIVER_INIT(peyper); |
| 29 | 34 | private: |
| 35 | UINT8 m_digit; |
| 30 | 36 | UINT8 irq_state; |
| 31 | | UINT8 display_block; |
| 32 | | UINT8 display[16]; |
| 33 | 37 | virtual void machine_reset(); |
| 34 | 38 | required_device<cpu_device> m_maincpu; |
| 35 | 39 | }; |
| 36 | 40 | |
| 37 | | |
| 38 | | READ8_MEMBER(peyper_state::sw_r) |
| 41 | WRITE8_MEMBER( peyper_state::col_w ) |
| 39 | 42 | { |
| 40 | | return 0xff; |
| 43 | m_digit = data; |
| 41 | 44 | } |
| 42 | 45 | |
| 43 | | WRITE8_MEMBER(peyper_state::col_w) |
| 46 | READ8_MEMBER( peyper_state::sw_r ) |
| 44 | 47 | { |
| 45 | | if (data==0x90) display_block = 0; |
| 48 | UINT8 data = 0xff; |
| 49 | |
| 50 | if (m_digit < 4) |
| 51 | { |
| 52 | char kbdrow[6]; |
| 53 | sprintf(kbdrow,"X%X",m_digit); |
| 54 | data = ioport(kbdrow)->read(); |
| 55 | } |
| 56 | return data; |
| 46 | 57 | } |
| 47 | 58 | |
| 48 | | static const UINT8 hex_to_7seg[16] = |
| 49 | | {0x3F, 0x06, 0x5B, 0x4F, |
| 50 | | 0x66, 0x6D, 0x7c, 0x07, |
| 51 | | 0x7F, 0x67, 0x00, 0x00, |
| 52 | | 0x00, 0x00, 0x00, 0x00 }; // 4511 |
| 53 | | |
| 54 | 59 | /* seems to only work correctly for 'solarwap', 'poleposn' and 'sonstwar' (look at how high-scores are displayed for example) - or shall layout be changed ? */ |
| 55 | | WRITE8_MEMBER(peyper_state::disp_w) |
| 60 | WRITE8_MEMBER( peyper_state::disp_w ) |
| 56 | 61 | { |
| 57 | | display[display_block] = data; |
| 58 | | |
| 62 | static const UINT8 patterns[16] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0 }; // 7448 |
| 59 | 63 | UINT8 a = data & 0x0f; |
| 60 | 64 | UINT8 b = data >> 4; |
| 61 | | UINT8 hex_a = hex_to_7seg[a]; |
| 62 | | UINT8 hex_b = hex_to_7seg[b]; |
| 65 | UINT8 hex_a = patterns[a]; |
| 66 | UINT8 hex_b = patterns[b]; |
| 63 | 67 | /* |
| 64 | 68 | 0 -> XA0 DPL25,DPL27 |
| 65 | 69 | 1 -> XA1 DPL26,DPL28 |
| r32232 | r32233 | |
| 70 | 74 | 6 -> DPL19,DPL1 |
| 71 | 75 | 7 -> DPL30,DPL33 |
| 72 | 76 | */ |
| 73 | | switch(display_block) { |
| 77 | switch(m_digit) { |
| 74 | 78 | case 0 : |
| 75 | 79 | output_set_indexed_value("dpl_",25,hex_a); |
| 76 | 80 | output_set_indexed_value("dpl_",27,hex_b); |
| r32232 | r32233 | |
| 100 | 104 | output_set_indexed_value("dpl_",1,hex_b); |
| 101 | 105 | break; |
| 102 | 106 | case 7 : |
| 103 | | output_set_indexed_value("dpl_",30,hex_a); |
| 104 | | output_set_indexed_value("dpl_",33,hex_b); |
| 107 | output_set_indexed_value("dpl_",33,hex_a); |
| 108 | output_set_indexed_value("dpl_",30,hex_b); |
| 105 | 109 | break; |
| 106 | 110 | /* |
| 107 | 111 | 8 -> XB0 |
| r32232 | r32233 | |
| 115 | 119 | */ |
| 116 | 120 | case 8 : |
| 117 | 121 | /* |
| 118 | | if (BIT(a,3)) logerror("TILT\n"); |
| 119 | | if (BIT(a,2)) logerror("ONC\n"); |
| 120 | | if (BIT(a,1)) logerror("GAME OVER\n"); |
| 121 | | if (BIT(a,0)) logerror("BALL IN PLAY\n"); |
| 122 | if (BIT(b,3)) logerror("TILT\n"); |
| 123 | if (BIT(b,2)) logerror("ONC\n"); |
| 124 | if (BIT(b,1)) logerror("GAME OVER\n"); |
| 125 | if (BIT(b,0)) logerror("BALL IN PLAY\n"); |
| 122 | 126 | */ |
| 123 | | output_set_indexed_value("led_",1,BIT(b,0)); // PLAYER 1 |
| 124 | | output_set_indexed_value("led_",2,BIT(b,1)); // PLAYER 2 |
| 125 | | output_set_indexed_value("led_",3,BIT(b,2)); // PLAYER 3 |
| 126 | | output_set_indexed_value("led_",4,BIT(b,3)); // PLAYER 4 |
| 127 | output_set_indexed_value("led_",1,BIT(a,0)); // PLAYER 1 |
| 128 | output_set_indexed_value("led_",2,BIT(a,1)); // PLAYER 2 |
| 129 | output_set_indexed_value("led_",3,BIT(a,2)); // PLAYER 3 |
| 130 | output_set_indexed_value("led_",4,BIT(a,3)); // PLAYER 4 |
| 127 | 131 | break; |
| 128 | 132 | case 9 : |
| 129 | | if (!BIT(b,0)) output_set_indexed_value("dpl_",6,hex_to_7seg[0]); |
| 130 | | if (!BIT(b,1)) output_set_indexed_value("dpl_",12,hex_to_7seg[0]); |
| 131 | | if (!BIT(b,2)) output_set_indexed_value("dpl_",24,hex_to_7seg[0]); |
| 132 | | if (!BIT(b,3)) output_set_indexed_value("dpl_",18,hex_to_7seg[0]); |
| 133 | | output_set_indexed_value("dpl_",29,hex_a); |
| 133 | if (!BIT(a,0)) output_set_indexed_value("dpl_",6, 0x3f); |
| 134 | if (!BIT(a,1)) output_set_indexed_value("dpl_",12, 0x3f); |
| 135 | if (!BIT(a,2)) output_set_indexed_value("dpl_",24, 0x3f); |
| 136 | if (!BIT(a,3)) output_set_indexed_value("dpl_",18, 0x3f); |
| 137 | output_set_indexed_value("dpl_",29,hex_b); |
| 134 | 138 | break; |
| 135 | 139 | case 10 : |
| 136 | | output_set_indexed_value("dpl_",11,hex_a); |
| 137 | | output_set_indexed_value("dpl_",17,hex_b); |
| 140 | output_set_indexed_value("dpl_",17,hex_a); |
| 141 | output_set_indexed_value("dpl_",11,hex_b); |
| 138 | 142 | break; |
| 139 | 143 | case 11 : |
| 140 | | output_set_indexed_value("dpl_",10,hex_a); |
| 141 | | output_set_indexed_value("dpl_",16,hex_b); |
| 144 | output_set_indexed_value("dpl_",16,hex_a); |
| 145 | output_set_indexed_value("dpl_",10,hex_b); |
| 142 | 146 | break; |
| 143 | 147 | case 12 : |
| 144 | | output_set_indexed_value("dpl_",9,hex_a); |
| 145 | | output_set_indexed_value("dpl_",15,hex_b); |
| 148 | output_set_indexed_value("dpl_",15,hex_a); |
| 149 | output_set_indexed_value("dpl_",9,hex_b); |
| 146 | 150 | break; |
| 147 | 151 | case 13 : |
| 148 | | output_set_indexed_value("dpl_",8,hex_a); |
| 149 | | output_set_indexed_value("dpl_",14,hex_b); |
| 152 | output_set_indexed_value("dpl_",14,hex_a); |
| 153 | output_set_indexed_value("dpl_",8,hex_b); |
| 150 | 154 | break; |
| 151 | 155 | case 14 : |
| 152 | | output_set_indexed_value("dpl_",7,hex_a); |
| 153 | | output_set_indexed_value("dpl_",13,hex_b); |
| 156 | output_set_indexed_value("dpl_",13,hex_a); |
| 157 | output_set_indexed_value("dpl_",7,hex_b); |
| 154 | 158 | break; |
| 155 | 159 | case 15 : |
| 156 | | output_set_indexed_value("dpl_",31,hex_a); |
| 157 | | output_set_indexed_value("dpl_",32,hex_b); |
| 160 | output_set_indexed_value("dpl_",32,hex_a); |
| 161 | output_set_indexed_value("dpl_",31,hex_b); |
| 158 | 162 | break; |
| 159 | 163 | } |
| 160 | | |
| 161 | | display_block++; |
| 162 | | display_block&=0x0f; |
| 163 | 164 | } |
| 164 | 165 | |
| 165 | 166 | WRITE8_MEMBER(peyper_state::lamp_w) |
| r32232 | r32233 | |
| 205 | 206 | static ADDRESS_MAP_START( peyper_io, AS_IO, 8, peyper_state ) |
| 206 | 207 | ADDRESS_MAP_UNMAP_HIGH |
| 207 | 208 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 208 | | AM_RANGE(0x00, 0x00) AM_READWRITE(sw_r,disp_w) |
| 209 | | AM_RANGE(0x01, 0x01) AM_WRITE(col_w) |
| 209 | AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w ) |
| 210 | AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) |
| 210 | 211 | AM_RANGE(0x04, 0x04) AM_DEVWRITE("ay1", ay8910_device, address_w) |
| 211 | 212 | AM_RANGE(0x06, 0x06) AM_DEVWRITE("ay1", ay8910_device, data_w) |
| 212 | 213 | AM_RANGE(0x08, 0x08) AM_DEVWRITE("ay2", ay8910_device, address_w) |
| r32232 | r32233 | |
| 253 | 254 | PORT_DIPSETTING( 0x01, "0k 0k and 0k / 0k" ) |
| 254 | 255 | PORT_DIPSETTING( 0x02, "0k 0k and 0k / 0k" ) |
| 255 | 256 | PORT_DIPSETTING( 0x03, "0k 0k and 0k / 0k" ) |
| 257 | |
| 258 | PORT_START("X0") |
| 259 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_X) PORT_NAME("Outhole") |
| 260 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W) |
| 261 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_E) |
| 262 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_R) |
| 263 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Y) |
| 264 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_U) |
| 265 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_I) |
| 266 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_O) |
| 267 | |
| 268 | PORT_START("X1") |
| 269 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) |
| 270 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S) |
| 271 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D) |
| 272 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F) |
| 273 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_G) |
| 274 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_H) |
| 275 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_J) |
| 276 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K) |
| 277 | |
| 278 | PORT_START("X2") |
| 279 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z) |
| 280 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_C) |
| 281 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_V) |
| 282 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_B) |
| 283 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_N) |
| 284 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_M) |
| 285 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_COMMA) |
| 286 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_STOP) |
| 287 | |
| 288 | PORT_START("X3") |
| 289 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L) |
| 290 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Q) |
| 291 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_EQUALS) |
| 292 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_BACKSPACE) |
| 293 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_OPENBRACE) |
| 294 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_CLOSEBRACE) |
| 295 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_BACKSLASH) |
| 296 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_COLON) |
| 256 | 297 | INPUT_PORTS_END |
| 257 | 298 | |
| 258 | 299 | |
| r32232 | r32233 | |
| 555 | 596 | MCFG_FRAGMENT_ADD( genpin_audio ) |
| 556 | 597 | MCFG_SPEAKER_STANDARD_MONO("ayvol") |
| 557 | 598 | MCFG_SOUND_ADD("ay1", AY8910, 2500000) |
| 558 | | //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(peyper_state, p1a_w)) |
| 559 | | //MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(peyper_state, p1b_w)) |
| 599 | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(peyper_state, p1a_w)) |
| 600 | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(peyper_state, p1b_w)) |
| 560 | 601 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "ayvol", 1.0) |
| 561 | 602 | MCFG_SOUND_ADD("ay2", AY8910, 2500000) |
| 562 | | //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(peyper_state, p2a_w)) |
| 563 | | //MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(peyper_state, p2b_w)) |
| 603 | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(peyper_state, p2a_w)) |
| 604 | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(peyper_state, p2b_w)) |
| 564 | 605 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "ayvol", 1.0) |
| 606 | |
| 607 | /* Devices */ |
| 608 | MCFG_DEVICE_ADD("i8279", I8279, 2500000) |
| 609 | MCFG_I8279_OUT_SL_CB(WRITE8(peyper_state, col_w)) // scan SL lines |
| 610 | MCFG_I8279_OUT_DISP_CB(WRITE8(peyper_state, disp_w)) // display A&B |
| 611 | MCFG_I8279_IN_RL_CB(READ8(peyper_state, sw_r)) // kbd RL lines |
| 612 | MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key |
| 613 | MCFG_I8279_IN_CTRL_CB(VCC) |
| 565 | 614 | MACHINE_CONFIG_END |
| 566 | 615 | |
| 567 | 616 | |
| r32232 | r32233 | |
| 671 | 720 | ROM_LOAD("memoriac.bin", 0x4000, 0x2000, CRC(468f16f0) SHA1(66ce0464d82331cfc0ac1f6fbd871066e4e57262)) |
| 672 | 721 | ROM_END |
| 673 | 722 | |
| 723 | /*------------------------------------------------------------------- |
| 724 | / Sir Lancelot (1994) |
| 725 | /-------------------------------------------------------------------*/ |
| 674 | 726 | |
| 675 | 727 | GAME( 1985, odin, 0, peyper, odin_dlx, peyper_state, peyper, ROT0, "Sonic", "Odin", GAME_IS_SKELETON_MECHANICAL) |
| 676 | 728 | GAME( 1985, odin_dlx, 0, peyper, odin_dlx, peyper_state, peyper, ROT0, "Sonic", "Odin De Luxe", GAME_IS_SKELETON_MECHANICAL) |