trunk/src/mess/machine/nes.c
| r23704 | r23705 | |
| 80 | 80 | |
| 81 | 81 | void nes_state::machine_start() |
| 82 | 82 | { |
| 83 | | m_maincpu = machine().device<cpu_device>("maincpu"); |
| 84 | | m_ppu = machine().device<ppu2c0x_device>("ppu"); |
| 85 | | m_sound = machine().device("nessound"); |
| 83 | for (int i = 0; i < 9; i++) |
| 84 | { |
| 85 | char str[7]; |
| 86 | sprintf(str, "FCKEY%i", i); |
| 87 | m_io_fckey[i] = ioport(str); |
| 88 | } |
| 89 | for (int i = 0; i < 13; i++) |
| 90 | { |
| 91 | char str[9]; |
| 92 | sprintf(str, "SUBKEY%i", i); |
| 93 | m_io_subkey[i] = ioport(str); |
| 94 | } |
| 95 | for (int i = 0; i < 4; i++) |
| 96 | { |
| 97 | char str[5]; |
| 98 | sprintf(str, "PAD%i", i + 1); |
| 99 | m_io_pad[i] = ioport(str); |
| 100 | sprintf(str, "MAH%i", i); |
| 101 | m_io_mahjong[i] = ioport(str); |
| 102 | } |
| 103 | |
| 86 | 104 | m_io_ctrlsel = ioport("CTRLSEL"); |
| 87 | | m_io_fckey[0] = ioport("FCKEY0"); |
| 88 | | m_io_fckey[1] = ioport("FCKEY1"); |
| 89 | | m_io_fckey[2] = ioport("FCKEY2"); |
| 90 | | m_io_fckey[3] = ioport("FCKEY3"); |
| 91 | | m_io_fckey[4] = ioport("FCKEY4"); |
| 92 | | m_io_fckey[5] = ioport("FCKEY5"); |
| 93 | | m_io_fckey[6] = ioport("FCKEY6"); |
| 94 | | m_io_fckey[7] = ioport("FCKEY7"); |
| 95 | | m_io_fckey[8] = ioport("FCKEY8"); |
| 96 | | m_io_subkey[0 ] = ioport("SUBKEY0"); |
| 97 | | m_io_subkey[1 ] = ioport("SUBKEY1"); |
| 98 | | m_io_subkey[2 ] = ioport("SUBKEY2"); |
| 99 | | m_io_subkey[3 ] = ioport("SUBKEY3"); |
| 100 | | m_io_subkey[4 ] = ioport("SUBKEY4"); |
| 101 | | m_io_subkey[5 ] = ioport("SUBKEY5"); |
| 102 | | m_io_subkey[6 ] = ioport("SUBKEY6"); |
| 103 | | m_io_subkey[7 ] = ioport("SUBKEY7"); |
| 104 | | m_io_subkey[8 ] = ioport("SUBKEY8"); |
| 105 | | m_io_subkey[9 ] = ioport("SUBKEY9"); |
| 106 | | m_io_subkey[10] = ioport("SUBKEY10"); |
| 107 | | m_io_subkey[11] = ioport("SUBKEY11"); |
| 108 | | m_io_subkey[12] = ioport("SUBKEY12"); |
| 109 | | m_io_pad[0] = ioport("PAD1"); |
| 110 | | m_io_pad[1] = ioport("PAD2"); |
| 111 | | m_io_pad[2] = ioport("PAD3"); |
| 112 | | m_io_pad[3] = ioport("PAD4"); |
| 105 | m_io_paddle = ioport("PADDLE"); |
| 113 | 106 | m_io_cc_left = ioport("CC_LEFT"); |
| 114 | 107 | m_io_cc_right = ioport("CC_RIGHT"); |
| 115 | 108 | m_io_zapper1_t = ioport("ZAPPER1_T"); |
| r23704 | r23705 | |
| 118 | 111 | m_io_zapper2_t = ioport("ZAPPER2_T"); |
| 119 | 112 | m_io_zapper2_x = ioport("ZAPPER2_X"); |
| 120 | 113 | m_io_zapper2_y = ioport("ZAPPER2_Y"); |
| 121 | | m_io_paddle = ioport("PADDLE"); |
| 122 | | m_io_mahjong[0] = ioport("MAH0"); |
| 123 | | m_io_mahjong[1] = ioport("MAH1"); |
| 124 | | m_io_mahjong[2] = ioport("MAH2"); |
| 125 | | m_io_mahjong[3] = ioport("MAH3"); |
| 126 | 114 | |
| 127 | 115 | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 128 | 116 | |
trunk/src/mess/includes/nes.h
| r23704 | r23705 | |
| 452 | 452 | |
| 453 | 453 | nes_state(const machine_config &mconfig, device_type type, const char *tag) |
| 454 | 454 | : driver_device(mconfig, type, tag), |
| 455 | | m_cartslot(*this, "nes_slot") |
| 456 | | { } |
| 455 | m_maincpu(*this, "maincpu"), |
| 456 | m_ppu(*this, "ppu"), |
| 457 | m_sound(*this, "nessound"), |
| 458 | m_cartslot(*this, "nes_slot") |
| 459 | { } |
| 457 | 460 | |
| 458 | 461 | /* input_related - this part has to be cleaned up (e.g. in_2 and in_3 are not really necessary here...) */ |
| 459 | 462 | nes_input m_in_0, m_in_1, m_in_2, m_in_3; |
| r23704 | r23705 | |
| 482 | 485 | UINT8 *m_vram; |
| 483 | 486 | UINT8 *m_ciram; //PPU nametable RAM - external to PPU! |
| 484 | 487 | |
| 485 | | optional_device<nes_cart_slot_device> m_cartslot; //mandatory |
| 488 | required_device<cpu_device> m_maincpu; |
| 489 | required_device<ppu2c0x_device> m_ppu; |
| 490 | required_device<device_t> m_sound; |
| 491 | optional_device<nes_cart_slot_device> m_cartslot; |
| 486 | 492 | |
| 487 | 493 | int nes_ppu_vidaccess(int address, int data); |
| 488 | 494 | void ppu_nmi(int *ppu_regs); |
| r23704 | r23705 | |
| 545 | 551 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 546 | 552 | |
| 547 | 553 | private: |
| 548 | | /* devices */ |
| 549 | | cpu_device *m_maincpu; |
| 550 | | ppu2c0x_device *m_ppu; |
| 551 | | device_t *m_sound; |
| 552 | 554 | memory_bank *m_prg_bank_mem[5]; |
| 553 | 555 | }; |
| 554 | 556 | |