trunk/src/mame/drivers/chaknpop.c
| r243501 | r243502 | |
| 143 | 143 | static ADDRESS_MAP_START( chaknpop_map, AS_PROGRAM, 8, chaknpop_state ) |
| 144 | 144 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 145 | 145 | AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("mcu_ram") |
| 146 | | AM_RANGE(0x8800, 0x8800) AM_READWRITE(chaknpop_mcu_port_a_r, chaknpop_mcu_port_a_w) |
| 147 | | AM_RANGE(0x8801, 0x8801) AM_READWRITE(chaknpop_mcu_port_b_r, chaknpop_mcu_port_b_w) |
| 148 | | AM_RANGE(0x8802, 0x8802) AM_READWRITE(chaknpop_mcu_port_c_r, chaknpop_mcu_port_c_w) |
| 146 | AM_RANGE(0x8800, 0x8800) AM_READWRITE(mcu_port_a_r, mcu_port_a_w) |
| 147 | AM_RANGE(0x8801, 0x8801) AM_READWRITE(mcu_port_b_r, mcu_port_b_w) |
| 148 | AM_RANGE(0x8802, 0x8802) AM_READWRITE(mcu_port_c_r, mcu_port_c_w) |
| 149 | 149 | AM_RANGE(0x8804, 0x8805) AM_DEVREADWRITE("ay1", ay8910_device, data_r, address_data_w) |
| 150 | 150 | AM_RANGE(0x8806, 0x8807) AM_DEVREADWRITE("ay2", ay8910_device, data_r, address_data_w) |
| 151 | 151 | AM_RANGE(0x8808, 0x8808) AM_READ_PORT("DSWC") |
| 152 | 152 | AM_RANGE(0x8809, 0x8809) AM_READ_PORT("P1") |
| 153 | 153 | AM_RANGE(0x880a, 0x880a) AM_READ_PORT("SYSTEM") |
| 154 | 154 | AM_RANGE(0x880b, 0x880b) AM_READ_PORT("P2") |
| 155 | | AM_RANGE(0x880c, 0x880c) AM_READWRITE(chaknpop_gfxmode_r, chaknpop_gfxmode_w) |
| 155 | AM_RANGE(0x880c, 0x880c) AM_READWRITE(gfxmode_r, gfxmode_w) |
| 156 | 156 | AM_RANGE(0x880d, 0x880d) AM_WRITE(coinlock_w) // coin lock out |
| 157 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(chaknpop_txram_w) AM_SHARE("tx_ram") // TX tilemap |
| 158 | | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(chaknpop_attrram_w) AM_SHARE("attr_ram") // Color attribute |
| 157 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(txram_w) AM_SHARE("tx_ram") // TX tilemap |
| 158 | AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(attrram_w) AM_SHARE("attr_ram") // Color attribute |
| 159 | 159 | AM_RANGE(0x9840, 0x98ff) AM_RAM AM_SHARE("spr_ram") // sprite |
| 160 | 160 | AM_RANGE(0xa000, 0xbfff) AM_ROM |
| 161 | 161 | AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank1") // bitmap plane 1-4 |
| r243501 | r243502 | |
| 362 | 362 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 363 | 363 | MCFG_SCREEN_SIZE(32*8, 32*8) |
| 364 | 364 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 365 | | MCFG_SCREEN_UPDATE_DRIVER(chaknpop_state, screen_update_chaknpop) |
| 365 | MCFG_SCREEN_UPDATE_DRIVER(chaknpop_state, screen_update) |
| 366 | 366 | MCFG_SCREEN_PALETTE("palette") |
| 367 | 367 | |
| 368 | 368 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", chaknpop) |
| r243501 | r243502 | |
| 416 | 416 | |
| 417 | 417 | |
| 418 | 418 | /* ( YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME ) */ |
| 419 | | GAME( 1983, chaknpop, 0, chaknpop, chaknpop, driver_device, 0, ROT0, "Taito Corporation", "Chack'n Pop", 0 ) |
| 419 | GAME( 1983, chaknpop, 0, chaknpop, chaknpop, driver_device, 0, ROT0, "Taito Corporation", "Chack'n Pop", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/chaknpop.h
| r243501 | r243502 | |
| 8 | 8 | public: |
| 9 | 9 | chaknpop_state(const machine_config &mconfig, device_type type, const char *tag) |
| 10 | 10 | : driver_device(mconfig, type, tag), |
| 11 | m_maincpu(*this, "maincpu"), |
| 12 | m_gfxdecode(*this, "gfxdecode"), |
| 13 | m_palette(*this, "palette"), |
| 11 | 14 | m_mcu_ram(*this, "mcu_ram"), |
| 12 | 15 | m_tx_ram(*this, "tx_ram"), |
| 13 | 16 | m_attr_ram(*this, "attr_ram"), |
| 14 | | m_spr_ram(*this, "spr_ram"), |
| 15 | | m_maincpu(*this, "maincpu"), |
| 16 | | m_gfxdecode(*this, "gfxdecode"), |
| 17 | | m_palette(*this, "palette") { } |
| 17 | m_spr_ram(*this, "spr_ram") { } |
| 18 | 18 | |
| 19 | /* devices */ |
| 20 | required_device<cpu_device> m_maincpu; |
| 21 | required_device<gfxdecode_device> m_gfxdecode; |
| 22 | required_device<palette_device> m_palette; |
| 23 | |
| 19 | 24 | /* memory pointers */ |
| 20 | 25 | required_shared_ptr<UINT8> m_mcu_ram; |
| 21 | 26 | required_shared_ptr<UINT8> m_tx_ram; |
| r243501 | r243502 | |
| 37 | 42 | UINT8 m_gfxmode; |
| 38 | 43 | UINT8 m_flip_x; |
| 39 | 44 | UINT8 m_flip_y; |
| 45 | |
| 40 | 46 | DECLARE_WRITE8_MEMBER(coinlock_w); |
| 41 | | DECLARE_READ8_MEMBER(chaknpop_mcu_port_a_r); |
| 42 | | DECLARE_READ8_MEMBER(chaknpop_mcu_port_b_r); |
| 43 | | DECLARE_READ8_MEMBER(chaknpop_mcu_port_c_r); |
| 44 | | DECLARE_WRITE8_MEMBER(chaknpop_mcu_port_a_w); |
| 45 | | DECLARE_WRITE8_MEMBER(chaknpop_mcu_port_b_w); |
| 46 | | DECLARE_WRITE8_MEMBER(chaknpop_mcu_port_c_w); |
| 47 | | DECLARE_READ8_MEMBER(chaknpop_gfxmode_r); |
| 48 | | DECLARE_WRITE8_MEMBER(chaknpop_gfxmode_w); |
| 49 | | DECLARE_WRITE8_MEMBER(chaknpop_txram_w); |
| 50 | | DECLARE_WRITE8_MEMBER(chaknpop_attrram_w); |
| 47 | DECLARE_READ8_MEMBER(mcu_port_a_r); |
| 48 | DECLARE_READ8_MEMBER(mcu_port_b_r); |
| 49 | DECLARE_READ8_MEMBER(mcu_port_c_r); |
| 50 | DECLARE_WRITE8_MEMBER(mcu_port_a_w); |
| 51 | DECLARE_WRITE8_MEMBER(mcu_port_b_w); |
| 52 | DECLARE_WRITE8_MEMBER(mcu_port_c_w); |
| 53 | DECLARE_READ8_MEMBER(gfxmode_r); |
| 54 | DECLARE_WRITE8_MEMBER(gfxmode_w); |
| 55 | DECLARE_WRITE8_MEMBER(txram_w); |
| 56 | DECLARE_WRITE8_MEMBER(attrram_w); |
| 51 | 57 | DECLARE_WRITE8_MEMBER(unknown_port_1_w); |
| 52 | 58 | DECLARE_WRITE8_MEMBER(unknown_port_2_w); |
| 53 | | TILE_GET_INFO_MEMBER(chaknpop_get_tx_tile_info); |
| 59 | TILE_GET_INFO_MEMBER(get_tx_tile_info); |
| 60 | |
| 54 | 61 | virtual void machine_start(); |
| 55 | 62 | virtual void machine_reset(); |
| 56 | 63 | virtual void video_start(); |
| 57 | 64 | DECLARE_PALETTE_INIT(chaknpop); |
| 58 | | UINT32 screen_update_chaknpop(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 65 | |
| 66 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 59 | 67 | void tx_tilemap_mark_all_dirty(); |
| 60 | | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 61 | | void draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 62 | | void mcu_update_seed( UINT8 data ); |
| 63 | | required_device<cpu_device> m_maincpu; |
| 64 | | required_device<gfxdecode_device> m_gfxdecode; |
| 65 | | required_device<palette_device> m_palette; |
| 68 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 69 | void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 70 | |
| 71 | void mcu_update_seed(UINT8 data); |
| 66 | 72 | }; |
trunk/src/mame/machine/chaknpop.c
| r243501 | r243502 | |
| 63 | 63 | Memory handlers |
| 64 | 64 | ***************************************************************************/ |
| 65 | 65 | |
| 66 | | READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_r) |
| 66 | READ8_MEMBER(chaknpop_state::mcu_port_a_r) |
| 67 | 67 | { |
| 68 | 68 | //logerror("%04x: MCU port_a read\n", space.device().safe_pc()); |
| 69 | 69 | return m_mcu_result; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
| 73 | | READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_b_r) |
| 73 | READ8_MEMBER(chaknpop_state::mcu_port_b_r) |
| 74 | 74 | { |
| 75 | 75 | //logerror("%04x: MCU port_b read\n", space.device().safe_pc()); |
| 76 | 76 | |
| 77 | 77 | return 0xff; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | | READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_c_r) |
| 80 | READ8_MEMBER(chaknpop_state::mcu_port_c_r) |
| 81 | 81 | { |
| 82 | 82 | //logerror("%04x: MCU port_c read\n", space.device().safe_pc()); |
| 83 | 83 | return 0x00; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | | WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_w) |
| 86 | WRITE8_MEMBER(chaknpop_state::mcu_port_a_w) |
| 87 | 87 | { |
| 88 | 88 | UINT8 mcu_command; |
| 89 | 89 | |
| r243501 | r243502 | |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | | WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_b_w) |
| 134 | WRITE8_MEMBER(chaknpop_state::mcu_port_b_w) |
| 135 | 135 | { |
| 136 | 136 | //logerror("%04x: MCU port_b write 0x%02x\n", space.device().safe_pc(), data); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | | WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_c_w) |
| 139 | WRITE8_MEMBER(chaknpop_state::mcu_port_c_w) |
| 140 | 140 | { |
| 141 | 141 | //logerror("%04x: MCU port_c write 0x%02x\n", space.device().safe_pc(), data); |
| 142 | 142 | } |
trunk/src/mame/video/chaknpop.c
| r243501 | r243502 | |
| 25 | 25 | PALETTE_INIT_MEMBER(chaknpop_state, chaknpop) |
| 26 | 26 | { |
| 27 | 27 | const UINT8 *color_prom = memregion("proms")->base(); |
| 28 | | int i; |
| 29 | | |
| 30 | | for (i = 0; i < 1024; i++) |
| 28 | |
| 29 | for (int i = 0; i < 1024; i++) |
| 31 | 30 | { |
| 32 | 31 | int col, r, g, b; |
| 33 | 32 | int bit0, bit1, bit2; |
| r243501 | r243502 | |
| 66 | 65 | m_tx_tilemap->set_flip(m_flip_x | m_flip_y); |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | | READ8_MEMBER(chaknpop_state::chaknpop_gfxmode_r) |
| 68 | READ8_MEMBER(chaknpop_state::gfxmode_r) |
| 70 | 69 | { |
| 71 | 70 | return m_gfxmode; |
| 72 | 71 | } |
| 73 | 72 | |
| 74 | | WRITE8_MEMBER(chaknpop_state::chaknpop_gfxmode_w) |
| 73 | WRITE8_MEMBER(chaknpop_state::gfxmode_w) |
| 75 | 74 | { |
| 76 | 75 | if (m_gfxmode != data) |
| 77 | 76 | { |
| r243501 | r243502 | |
| 97 | 96 | } |
| 98 | 97 | } |
| 99 | 98 | |
| 100 | | WRITE8_MEMBER(chaknpop_state::chaknpop_txram_w) |
| 99 | WRITE8_MEMBER(chaknpop_state::txram_w) |
| 101 | 100 | { |
| 102 | 101 | m_tx_ram[offset] = data; |
| 103 | 102 | m_tx_tilemap->mark_tile_dirty(offset); |
| 104 | 103 | } |
| 105 | 104 | |
| 106 | | WRITE8_MEMBER(chaknpop_state::chaknpop_attrram_w) |
| 105 | WRITE8_MEMBER(chaknpop_state::attrram_w) |
| 107 | 106 | { |
| 108 | 107 | if (m_attr_ram[offset] != data) |
| 109 | 108 | { |
| r243501 | r243502 | |
| 123 | 122 | * I'm not sure how to handle attributes about color |
| 124 | 123 | */ |
| 125 | 124 | |
| 126 | | TILE_GET_INFO_MEMBER(chaknpop_state::chaknpop_get_tx_tile_info) |
| 125 | TILE_GET_INFO_MEMBER(chaknpop_state::get_tx_tile_info) |
| 127 | 126 | { |
| 128 | 127 | int tile = m_tx_ram[tile_index]; |
| 129 | 128 | int tile_h_bank = (m_gfxmode & GFX_TX_BANK2) << 2; /* 0x00-0xff -> 0x200-0x2ff */ |
| r243501 | r243502 | |
| 150 | 149 | UINT8 *RAM = memregion("maincpu")->base(); |
| 151 | 150 | |
| 152 | 151 | /* info offset type w h col row */ |
| 153 | | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(chaknpop_state::chaknpop_get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); |
| 152 | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(chaknpop_state::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); |
| 154 | 153 | |
| 155 | 154 | m_vram1 = &RAM[0x10000]; |
| 156 | 155 | m_vram2 = &RAM[0x12000]; |
| r243501 | r243502 | |
| 175 | 174 | |
| 176 | 175 | void chaknpop_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 177 | 176 | { |
| 178 | | int offs; |
| 179 | | |
| 180 | 177 | /* Draw the sprites */ |
| 181 | | for (offs = 0; offs < m_spr_ram.bytes(); offs += 4) |
| 178 | for (int offs = 0; offs < m_spr_ram.bytes(); offs += 4) |
| 182 | 179 | { |
| 183 | 180 | int sx = m_spr_ram[offs + 3]; |
| 184 | 181 | int sy = 256 - 15 - m_spr_ram[offs]; |
| r243501 | r243502 | |
| 246 | 243 | } |
| 247 | 244 | } |
| 248 | 245 | |
| 249 | | UINT32 chaknpop_state::screen_update_chaknpop(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 246 | UINT32 chaknpop_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 250 | 247 | { |
| 251 | 248 | m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 252 | 249 | draw_sprites(bitmap, cliprect); |