trunk/src/mame/drivers/ltd.c
| r31708 | r31709 | |
| 9 | 9 | |
| 10 | 10 | Used PinMAME as a reference. |
| 11 | 11 | |
| 12 | | System 3: NMI is connected "FICHA" (coin slot). RST is connected to "TILT". |
| 12 | System 3: NMI is connected to "FICHA" (coin slot). RST is connected to "TILT". |
| 13 | 13 | |
| 14 | 14 | The manual mentions these machines: |
| 15 | 15 | Arizona, Atlantis, Galaxia, Hustler, Martian Queen. |
| r31708 | r31709 | |
| 25 | 25 | (unknown year): Viking King |
| 26 | 26 | |
| 27 | 27 | ToDo: |
| 28 | | - System 4, everything |
| 29 | | - System 3, sound |
| 28 | - No mechanical sounds |
| 29 | - System 3, no sound |
| 30 | - System 3, slam tilt to connect to reset line |
| 30 | 31 | - Zephy, no playfield inputs |
| 32 | - System 4, no playfield inputs |
| 33 | - System 4, can randomly freeze MAME for no reason |
| 34 | - Alcapone, display needs fixing |
| 31 | 35 | - Outputs |
| 32 | 36 | - Mechanical |
| 33 | 37 | |
| r31708 | r31709 | |
| 53 | 57 | DECLARE_DRIVER_INIT(ltd); |
| 54 | 58 | DECLARE_READ8_MEMBER(io_r); |
| 55 | 59 | DECLARE_WRITE8_MEMBER(io_w); |
| 60 | DECLARE_READ8_MEMBER(port1_r); |
| 61 | DECLARE_WRITE8_MEMBER(port1_w); |
| 62 | DECLARE_READ8_MEMBER(port2_r); |
| 63 | DECLARE_WRITE8_MEMBER(port2_w); |
| 64 | DECLARE_WRITE8_MEMBER(count_reset_w); |
| 56 | 65 | DECLARE_INPUT_CHANGED_MEMBER(ficha); |
| 57 | 66 | TIMER_DEVICE_CALLBACK_MEMBER(timer_r); |
| 58 | 67 | private: |
| 59 | 68 | bool m_timer_r; |
| 69 | bool m_clear; |
| 70 | UINT8 m_counter; |
| 71 | UINT8 m_digit; |
| 60 | 72 | UINT8 m_game; |
| 61 | 73 | UINT8 m_out_offs; |
| 74 | UINT8 m_port2; |
| 62 | 75 | virtual void machine_reset(); |
| 63 | 76 | required_device<cpu_device> m_maincpu; |
| 64 | 77 | required_shared_ptr<UINT8> m_p_ram; |
| r31708 | r31709 | |
| 76 | 89 | AM_RANGE(0x0000, 0x001f) AM_RAM // internal to the cpu |
| 77 | 90 | AM_RANGE(0x0080, 0x00ff) AM_RAM |
| 78 | 91 | AM_RANGE(0x0100, 0x01ff) AM_RAM AM_SHARE("nvram") |
| 79 | | //AM_RANGE(0x0800, 0x0800) AM_WRITE(cycle_reset_w) |
| 92 | AM_RANGE(0x0800, 0x0800) AM_WRITE(count_reset_w) |
| 80 | 93 | AM_RANGE(0x0c00, 0x0c00) AM_DEVWRITE("aysnd_1", ay8910_device, reset_w) |
| 81 | 94 | AM_RANGE(0x1000, 0x1000) AM_DEVWRITE("aysnd_0", ay8910_device, address_w) |
| 82 | 95 | AM_RANGE(0x1400, 0x1400) AM_DEVWRITE("aysnd_0", ay8910_device, reset_w) |
| r31708 | r31709 | |
| 88 | 101 | ADDRESS_MAP_END |
| 89 | 102 | |
| 90 | 103 | static ADDRESS_MAP_START( ltd4_io, AS_IO, 8, ltd_state ) |
| 91 | | //AM_RANGE(0x0100, 0x0100) AM_READWRITE |
| 92 | | //AM_RANGE(0x0101, 0x0101) AM_WRITE( |
| 104 | AM_RANGE(0x0100, 0x0100) AM_READWRITE(port1_r,port1_w) |
| 105 | AM_RANGE(0x0101, 0x0101) AM_READWRITE(port2_r,port2_w) |
| 93 | 106 | ADDRESS_MAP_END |
| 94 | 107 | |
| 108 | // bits 6,7 not connected to data bus |
| 109 | // 1=does something in Atlantis; 2=does something in Black Hole; note that sometimes pressing G or H will reboot the machine. |
| 95 | 110 | static INPUT_PORTS_START( ltd3 ) |
| 96 | 111 | PORT_START("FICHA") |
| 97 | 112 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, ltd_state, ficha, 0) |
| r31708 | r31709 | |
| 127 | 142 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Q) //2 |
| 128 | 143 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W) //2 |
| 129 | 144 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_E) //2 |
| 145 | PORT_BIT( 0x18, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 146 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START ) |
| 147 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 148 | |
| 149 | PORT_START("X7") |
| 150 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_X) PORT_NAME("Outhole") // 1,2 |
| 151 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 152 | INPUT_PORTS_END |
| 153 | |
| 154 | // this needs to be redone once inputs start to work |
| 155 | static INPUT_PORTS_START( ltd4 ) |
| 156 | PORT_START("X0") |
| 157 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_0_PAD) |
| 158 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1_PAD) |
| 159 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2_PAD) |
| 160 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3_PAD) |
| 161 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4_PAD) |
| 162 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT ) // tilt all |
| 163 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 164 | |
| 165 | PORT_START("X1") |
| 166 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_SLASH) |
| 167 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_COLON) |
| 168 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_QUOTE) // start pecmen |
| 169 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_BACKSLASH) |
| 170 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) //coin all |
| 171 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) //coin cowboy,alcapone; start pecmen |
| 172 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 173 | |
| 174 | PORT_START("X2") |
| 175 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) //start cowboy,alcapone |
| 176 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S) |
| 177 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D) |
| 178 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F) |
| 179 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_G) |
| 180 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_H) |
| 181 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 182 | |
| 183 | PORT_START("X3") |
| 184 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Q) |
| 185 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W) |
| 186 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_E) |
| 130 | 187 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_R) |
| 131 | 188 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Y) |
| 132 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START ) |
| 189 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_BACKSPACE) |
| 133 | 190 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 134 | 191 | |
| 135 | 192 | PORT_START("X4") |
| r31708 | r31709 | |
| 160 | 217 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 161 | 218 | |
| 162 | 219 | PORT_START("X7") |
| 163 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_X) PORT_NAME("Outhole") // 1,2 |
| 220 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_X) |
| 164 | 221 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_ASTERISK) |
| 165 | 222 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_SLASH_PAD) |
| 166 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_MINUS_PAD) |
| 223 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_MINUS_PAD) // credit pecmen |
| 167 | 224 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_PLUS_PAD) |
| 168 | 225 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_ENTER_PAD) |
| 169 | 226 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 170 | 227 | INPUT_PORTS_END |
| 171 | 228 | |
| 172 | | static INPUT_PORTS_START( ltd4 ) |
| 173 | | INPUT_PORTS_END |
| 174 | | |
| 175 | 229 | INPUT_CHANGED_MEMBER( ltd_state::ficha ) |
| 176 | 230 | { |
| 177 | 231 | if(newval) |
| r31708 | r31709 | |
| 181 | 235 | // switches |
| 182 | 236 | READ8_MEMBER( ltd_state::io_r ) |
| 183 | 237 | { |
| 184 | | if (offset==0) return ioport("X0")->read(); |
| 185 | | if (offset==1) return ioport("X1")->read(); |
| 186 | | if (offset==2) return ioport("X2")->read(); |
| 187 | | if (offset==3) return ioport("X3")->read(); |
| 188 | | if (offset==7) return ioport("X7")->read(); |
| 238 | if (offset==0) |
| 239 | return ioport("X0")->read(); |
| 240 | else |
| 241 | if (offset==1) |
| 242 | return ioport("X1")->read(); |
| 243 | else |
| 244 | if (offset==2) |
| 245 | return ioport("X2")->read(); |
| 246 | else |
| 247 | if (offset==3) |
| 248 | return ioport("X3")->read(); |
| 249 | else |
| 250 | if (offset==7) |
| 251 | return ioport("X7")->read(); |
| 252 | |
| 189 | 253 | return 0xff; |
| 190 | 254 | } |
| 191 | 255 | |
| r31708 | r31709 | |
| 195 | 259 | offset >>= 10; // reduces offsets to 1 per bank |
| 196 | 260 | } |
| 197 | 261 | |
| 262 | READ8_MEMBER( ltd_state:: port1_r ) |
| 263 | { |
| 264 | if (~m_port2 & 0x10) |
| 265 | { |
| 266 | UINT8 row = m_digit >> 4; |
| 267 | |
| 268 | if (row==0) |
| 269 | return ioport("X0")->read(); |
| 270 | else |
| 271 | if (row==1) |
| 272 | return ioport("X1")->read(); |
| 273 | else |
| 274 | if (row==2) |
| 275 | return ioport("X2")->read(); |
| 276 | else |
| 277 | if (row==3) |
| 278 | return ioport("X3")->read(); |
| 279 | else |
| 280 | if (row==4) |
| 281 | return ioport("X4")->read(); |
| 282 | else |
| 283 | if (row==5) |
| 284 | return ioport("X5")->read(); |
| 285 | else |
| 286 | if (row==6) |
| 287 | return ioport("X6")->read(); |
| 288 | else |
| 289 | //if (row==7) |
| 290 | return ioport("X7")->read(); |
| 291 | } |
| 292 | return 0xff; |
| 293 | } |
| 294 | |
| 295 | WRITE8_MEMBER( ltd_state::port1_w ) |
| 296 | { |
| 297 | if (m_port2 & 0x10) |
| 298 | { |
| 299 | UINT8 row = m_digit & 15; |
| 300 | UINT8 segment = BITSWAP8(data, 7, 0, 1, 2, 3, 4, 5, 6); |
| 301 | |
| 302 | switch (m_counter) |
| 303 | { |
| 304 | case 0: |
| 305 | m_clear = (data < 0xff); |
| 306 | break; |
| 307 | case 6: |
| 308 | if (m_clear) |
| 309 | m_digit = data; |
| 310 | break; |
| 311 | case 7: |
| 312 | if (m_clear) |
| 313 | { |
| 314 | if (row>7) |
| 315 | output_set_digit_value(row+2, segment); // P2 |
| 316 | else |
| 317 | output_set_digit_value(row, segment); // P1 |
| 318 | } |
| 319 | break; |
| 320 | case 8: |
| 321 | if (m_clear) |
| 322 | { |
| 323 | if (row>13) |
| 324 | output_set_digit_value(row+26, segment); // credits / ball |
| 325 | else |
| 326 | if (row>7) |
| 327 | output_set_digit_value(row+22, segment); // P4 |
| 328 | else |
| 329 | output_set_digit_value(row+20, segment); // P3 |
| 330 | } |
| 331 | break; |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | READ8_MEMBER( ltd_state:: port2_r ) |
| 337 | { |
| 338 | return m_port2; |
| 339 | } |
| 340 | |
| 341 | WRITE8_MEMBER( ltd_state::port2_w ) |
| 342 | { |
| 343 | if (~m_port2 & data & 0x10) |
| 344 | m_counter++; |
| 345 | |
| 346 | m_port2 = data; |
| 347 | } |
| 348 | |
| 349 | WRITE8_MEMBER( ltd_state::count_reset_w ) |
| 350 | { |
| 351 | m_counter = 0; |
| 352 | } |
| 353 | |
| 198 | 354 | void ltd_state::machine_reset() |
| 199 | 355 | { |
| 356 | m_clear = 0; |
| 357 | m_counter = 0; |
| 200 | 358 | m_out_offs = 0; |
| 201 | 359 | m_timer_r = 0; |
| 202 | 360 | } |
| r31708 | r31709 | |
| 347 | 505 | |
| 348 | 506 | } |
| 349 | 507 | } |
| 350 | | // else |
| 351 | | // if (m_out_offs == 0x4a) // outhole |
| 352 | | // { |
| 353 | | // if (BIT(m_p_ram[m_out_offs], 0)) |
| 354 | | // m_samples->start(0, 5); |
| 355 | | // } |
| 356 | | // else |
| 357 | | // if (m_out_offs == 0x4b) // knocker |
| 358 | | // { |
| 359 | | // if (BIT(m_p_ram[m_out_offs], 0)) |
| 360 | | // m_samples->start(0, 6); |
| 361 | | // } |
| 362 | 508 | } |
| 363 | 509 | |
| 364 | 510 | static MACHINE_CONFIG_START( ltd3, ltd_state ) |
| r31708 | r31709 | |
| 379 | 525 | |
| 380 | 526 | static MACHINE_CONFIG_START( ltd4, ltd_state ) |
| 381 | 527 | /* basic machine hardware */ |
| 382 | | MCFG_CPU_ADD("maincpu", M6803, XTAL_3_579545MHz) |
| 528 | MCFG_CPU_ADD("maincpu", M6803, XTAL_3_579545MHz) // guess, no details available |
| 383 | 529 | MCFG_CPU_PROGRAM_MAP(ltd4_map) |
| 384 | 530 | MCFG_CPU_IO_MAP(ltd4_io) |
| 385 | 531 | |
| r31708 | r31709 | |
| 466 | 612 | GAME(1981, zephy, 0, ltd3, ltd3, ltd_state, zephy, ROT0, "LTD", "Zephy", GAME_IS_SKELETON_MECHANICAL) |
| 467 | 613 | |
| 468 | 614 | // system 4 |
| 469 | | GAME(1981, cowboy, 0, ltd4, ltd4, ltd_state, ltd, ROT0, "LTD", "Cowboy Eight Ball", GAME_IS_SKELETON_MECHANICAL) |
| 615 | GAME(1981, cowboy, 0, ltd4, ltd4, ltd_state, ltd, ROT0, "LTD", "Cowboy Eight Ball 2", GAME_IS_SKELETON_MECHANICAL) |
| 470 | 616 | GAME(1981, pecmen, 0, ltd4, ltd4, ltd_state, ltd, ROT0, "LTD", "Mr. & Mrs. Pec-Men", GAME_IS_SKELETON_MECHANICAL) |
| 471 | 617 | GAME(1981, alcapone, 0, ltd4, ltd4, ltd_state, ltd, ROT0, "LTD", "Al Capone", GAME_IS_SKELETON_MECHANICAL) |
| 472 | 618 | GAME(1982, columbia, 0, ltd4, ltd4, ltd_state, ltd, ROT0, "LTD", "Columbia", GAME_IS_SKELETON_MECHANICAL) |