trunk/src/mame/drivers/skyarmy.c
| r243646 | r243647 | |
| 34 | 34 | public: |
| 35 | 35 | skyarmy_state(const machine_config &mconfig, device_type type, const char *tag) |
| 36 | 36 | : driver_device(mconfig, type, tag), |
| 37 | m_maincpu(*this, "maincpu"), |
| 38 | m_gfxdecode(*this, "gfxdecode"), |
| 39 | m_palette(*this, "palette"), |
| 37 | 40 | m_videoram(*this, "videoram"), |
| 38 | 41 | m_colorram(*this, "colorram"), |
| 39 | 42 | m_spriteram(*this, "spriteram"), |
| 40 | | m_scrollram(*this, "scrollram"), |
| 41 | | m_maincpu(*this, "maincpu"), |
| 42 | | m_gfxdecode(*this, "gfxdecode"), |
| 43 | | m_palette(*this, "palette") { } |
| 43 | m_scrollram(*this, "scrollram") { } |
| 44 | 44 | |
| 45 | required_device<cpu_device> m_maincpu; |
| 46 | required_device<gfxdecode_device> m_gfxdecode; |
| 47 | required_device<palette_device> m_palette; |
| 48 | |
| 45 | 49 | required_shared_ptr<UINT8> m_videoram; |
| 46 | 50 | required_shared_ptr<UINT8> m_colorram; |
| 47 | 51 | required_shared_ptr<UINT8> m_spriteram; |
| 48 | 52 | required_shared_ptr<UINT8> m_scrollram; |
| 53 | |
| 49 | 54 | tilemap_t* m_tilemap; |
| 50 | 55 | int m_nmi; |
| 51 | | DECLARE_WRITE8_MEMBER(skyarmy_flip_screen_x_w); |
| 52 | | DECLARE_WRITE8_MEMBER(skyarmy_flip_screen_y_w); |
| 53 | | DECLARE_WRITE8_MEMBER(skyarmy_videoram_w); |
| 54 | | DECLARE_WRITE8_MEMBER(skyarmy_colorram_w); |
| 56 | |
| 57 | DECLARE_WRITE8_MEMBER(flip_screen_x_w); |
| 58 | DECLARE_WRITE8_MEMBER(flip_screen_y_w); |
| 59 | DECLARE_WRITE8_MEMBER(videoram_w); |
| 60 | DECLARE_WRITE8_MEMBER(colorram_w); |
| 55 | 61 | DECLARE_WRITE8_MEMBER(nmi_enable_w); |
| 56 | | TILE_GET_INFO_MEMBER(get_skyarmy_tile_info); |
| 62 | |
| 63 | TILE_GET_INFO_MEMBER(get_tile_info); |
| 64 | |
| 65 | virtual void machine_start(); |
| 57 | 66 | virtual void video_start(); |
| 58 | 67 | DECLARE_PALETTE_INIT(skyarmy); |
| 59 | | UINT32 screen_update_skyarmy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 60 | | INTERRUPT_GEN_MEMBER(skyarmy_nmi_source); |
| 61 | | required_device<cpu_device> m_maincpu; |
| 62 | | required_device<gfxdecode_device> m_gfxdecode; |
| 63 | | required_device<palette_device> m_palette; |
| 68 | |
| 69 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 70 | |
| 71 | INTERRUPT_GEN_MEMBER(nmi_source); |
| 64 | 72 | }; |
| 65 | 73 | |
| 66 | | WRITE8_MEMBER(skyarmy_state::skyarmy_flip_screen_x_w) |
| 74 | void skyarmy_state::machine_start() |
| 67 | 75 | { |
| 76 | save_item(NAME(m_nmi)); |
| 77 | } |
| 78 | |
| 79 | WRITE8_MEMBER(skyarmy_state::flip_screen_x_w) |
| 80 | { |
| 68 | 81 | flip_screen_x_set(data & 0x01); |
| 69 | 82 | } |
| 70 | 83 | |
| 71 | | WRITE8_MEMBER(skyarmy_state::skyarmy_flip_screen_y_w) |
| 84 | WRITE8_MEMBER(skyarmy_state::flip_screen_y_w) |
| 72 | 85 | { |
| 73 | 86 | flip_screen_y_set(data & 0x01); |
| 74 | 87 | } |
| 75 | 88 | |
| 76 | | TILE_GET_INFO_MEMBER(skyarmy_state::get_skyarmy_tile_info) |
| 89 | TILE_GET_INFO_MEMBER(skyarmy_state::get_tile_info) |
| 77 | 90 | { |
| 78 | 91 | int code = m_videoram[tile_index]; |
| 79 | 92 | int attr = BITSWAP8(m_colorram[tile_index], 7, 6, 5, 4, 3, 0, 1, 2) & 7; |
| r243646 | r243647 | |
| 81 | 94 | SET_TILE_INFO_MEMBER(0, code, attr, 0); |
| 82 | 95 | } |
| 83 | 96 | |
| 84 | | WRITE8_MEMBER(skyarmy_state::skyarmy_videoram_w) |
| 97 | WRITE8_MEMBER(skyarmy_state::videoram_w) |
| 85 | 98 | { |
| 86 | 99 | m_videoram[offset] = data; |
| 87 | 100 | m_tilemap->mark_tile_dirty(offset); |
| 88 | 101 | } |
| 89 | 102 | |
| 90 | | WRITE8_MEMBER(skyarmy_state::skyarmy_colorram_w) |
| 103 | WRITE8_MEMBER(skyarmy_state::colorram_w) |
| 91 | 104 | { |
| 92 | 105 | m_colorram[offset] = data; |
| 93 | 106 | m_tilemap->mark_tile_dirty(offset); |
| r243646 | r243647 | |
| 124 | 137 | |
| 125 | 138 | void skyarmy_state::video_start() |
| 126 | 139 | { |
| 127 | | m_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(skyarmy_state::get_skyarmy_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); |
| 140 | m_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(skyarmy_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); |
| 128 | 141 | m_tilemap->set_scroll_cols(32); |
| 129 | 142 | } |
| 130 | 143 | |
| 131 | 144 | |
| 132 | | UINT32 skyarmy_state::screen_update_skyarmy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 145 | UINT32 skyarmy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 133 | 146 | { |
| 134 | | UINT8 *spriteram = m_spriteram; |
| 135 | 147 | int sx, sy, flipx, flipy, offs,pal; |
| 136 | 148 | int i; |
| 137 | 149 | |
| r243646 | r243647 | |
| 142 | 154 | |
| 143 | 155 | for (offs = 0 ; offs < 0x40; offs+=4) |
| 144 | 156 | { |
| 145 | | pal = BITSWAP8(spriteram[offs+2], 7, 6, 5, 4, 3, 0, 1, 2) & 7; |
| 157 | pal = BITSWAP8(m_spriteram[offs+2], 7, 6, 5, 4, 3, 0, 1, 2) & 7; |
| 146 | 158 | |
| 147 | | sx = spriteram[offs+3]; |
| 148 | | sy = 240-(spriteram[offs]+1); |
| 149 | | flipy = (spriteram[offs+1]&0x80)>>7; |
| 150 | | flipx = (spriteram[offs+1]&0x40)>>6; |
| 159 | sx = m_spriteram[offs+3]; |
| 160 | sy = 240-(m_spriteram[offs]+1); |
| 161 | flipy = (m_spriteram[offs+1]&0x80)>>7; |
| 162 | flipx = (m_spriteram[offs+1]&0x40)>>6; |
| 151 | 163 | |
| 152 | 164 | m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, |
| 153 | | spriteram[offs+1]&0x3f, |
| 165 | m_spriteram[offs+1]&0x3f, |
| 154 | 166 | pal, |
| 155 | 167 | flipx,flipy, |
| 156 | 168 | sx,sy,0); |
| r243646 | r243647 | |
| 159 | 171 | return 0; |
| 160 | 172 | } |
| 161 | 173 | |
| 162 | | INTERRUPT_GEN_MEMBER(skyarmy_state::skyarmy_nmi_source) |
| 174 | INTERRUPT_GEN_MEMBER(skyarmy_state::nmi_source) |
| 163 | 175 | { |
| 164 | 176 | if(m_nmi) device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 165 | 177 | } |
| r243646 | r243647 | |
| 174 | 186 | static ADDRESS_MAP_START( skyarmy_map, AS_PROGRAM, 8, skyarmy_state ) |
| 175 | 187 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 176 | 188 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 177 | | AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(skyarmy_videoram_w) AM_SHARE("videoram") /* Video RAM */ |
| 178 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(skyarmy_colorram_w) AM_SHARE("colorram") /* Color RAM */ |
| 189 | AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") /* Video RAM */ |
| 190 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram") /* Color RAM */ |
| 179 | 191 | AM_RANGE(0x9800, 0x983f) AM_RAM AM_SHARE("spriteram") /* Sprites */ |
| 180 | 192 | AM_RANGE(0x9840, 0x985f) AM_RAM AM_SHARE("scrollram") /* Scroll RAM */ |
| 181 | 193 | AM_RANGE(0xa000, 0xa000) AM_READ_PORT("DSW") |
| r243646 | r243647 | |
| 183 | 195 | AM_RANGE(0xa002, 0xa002) AM_READ_PORT("P2") |
| 184 | 196 | AM_RANGE(0xa003, 0xa003) AM_READ_PORT("SYSTEM") |
| 185 | 197 | AM_RANGE(0xa004, 0xa004) AM_WRITE(nmi_enable_w) // ??? |
| 186 | | AM_RANGE(0xa005, 0xa005) AM_WRITE(skyarmy_flip_screen_x_w) |
| 187 | | AM_RANGE(0xa006, 0xa006) AM_WRITE(skyarmy_flip_screen_y_w) |
| 198 | AM_RANGE(0xa005, 0xa005) AM_WRITE(flip_screen_x_w) |
| 199 | AM_RANGE(0xa006, 0xa006) AM_WRITE(flip_screen_y_w) |
| 188 | 200 | AM_RANGE(0xa007, 0xa007) AM_WRITENOP |
| 189 | 201 | ADDRESS_MAP_END |
| 190 | 202 | |
| r243646 | r243647 | |
| 286 | 298 | MCFG_CPU_PROGRAM_MAP(skyarmy_map) |
| 287 | 299 | MCFG_CPU_IO_MAP(skyarmy_io_map) |
| 288 | 300 | MCFG_CPU_VBLANK_INT_DRIVER("screen", skyarmy_state, irq0_line_hold) |
| 289 | | MCFG_CPU_PERIODIC_INT_DRIVER(skyarmy_state, skyarmy_nmi_source, 650) /* Hz */ |
| 301 | MCFG_CPU_PERIODIC_INT_DRIVER(skyarmy_state, nmi_source, 650) /* Hz */ |
| 290 | 302 | |
| 291 | 303 | /* video hardware */ |
| 292 | 304 | MCFG_SCREEN_ADD("screen", RASTER) |
| r243646 | r243647 | |
| 294 | 306 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 295 | 307 | MCFG_SCREEN_SIZE(32*8,32*8) |
| 296 | 308 | MCFG_SCREEN_VISIBLE_AREA(0*8,32*8-1,1*8,31*8-1) |
| 297 | | MCFG_SCREEN_UPDATE_DRIVER(skyarmy_state, screen_update_skyarmy) |
| 309 | MCFG_SCREEN_UPDATE_DRIVER(skyarmy_state, screen_update) |
| 298 | 310 | MCFG_SCREEN_PALETTE("palette") |
| 299 | 311 | |
| 300 | 312 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", skyarmy) |
| r243646 | r243647 | |
| 327 | 339 | ROM_LOAD( "a6.bin", 0x0000, 0x0020, CRC(c721220b) SHA1(61b3320fb616c0600d56840cb6438616c7e0c6eb) ) |
| 328 | 340 | ROM_END |
| 329 | 341 | |
| 330 | | GAME( 1982, skyarmy, 0, skyarmy, skyarmy, driver_device, 0, ROT90, "Shoei", "Sky Army", GAME_NO_COCKTAIL ) |
| 342 | GAME( 1982, skyarmy, 0, skyarmy, skyarmy, driver_device, 0, ROT90, "Shoei", "Sky Army", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
trunk/src/mame/drivers/skydiver.c
| r243646 | r243647 | |
| 11 | 11 | * There is a problem with coin input not starting when in demo mode. |
| 12 | 12 | * The NMI interrupt needs to be more accurate, to do 32V, adjusted |
| 13 | 13 | to VBLANK. This also affects sound. |
| 14 | | * The cuurent value of 5 interrupts per frame, works pretty good, |
| 14 | * The current value of 5 interrupts per frame, works pretty good, |
| 15 | 15 | but is not 100% accurate timing wise. |
| 16 | 16 | |
| 17 | 17 | **************************************************************************** |
| r243646 | r243647 | |
| 139 | 139 | * |
| 140 | 140 | *************************************/ |
| 141 | 141 | |
| 142 | | WRITE8_MEMBER(skydiver_state::skydiver_nmion_w) |
| 142 | WRITE8_MEMBER(skydiver_state::nmion_w) |
| 143 | 143 | { |
| 144 | 144 | m_nmion = offset; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | |
| 148 | | INTERRUPT_GEN_MEMBER(skydiver_state::skydiver_interrupt) |
| 148 | INTERRUPT_GEN_MEMBER(skydiver_state::interrupt) |
| 149 | 149 | { |
| 150 | 150 | /* Convert range data to divide value and write to sound */ |
| 151 | 151 | address_space &space = m_maincpu->space(AS_PROGRAM); |
| r243646 | r243647 | |
| 167 | 167 | * |
| 168 | 168 | *************************************/ |
| 169 | 169 | |
| 170 | | WRITE8_MEMBER(skydiver_state::skydiver_sound_enable_w) |
| 170 | WRITE8_MEMBER(skydiver_state::sound_enable_w) |
| 171 | 171 | { |
| 172 | 172 | m_discrete->write(space, SKYDIVER_SOUND_EN, offset); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | | WRITE8_MEMBER(skydiver_state::skydiver_whistle_w) |
| 175 | WRITE8_MEMBER(skydiver_state::whistle_w) |
| 176 | 176 | { |
| 177 | 177 | m_discrete->write(space, NODE_RELATIVE(SKYDIVER_WHISTLE1_EN, (offset >> 1)), offset & 0x01); |
| 178 | 178 | } |
| r243646 | r243647 | |
| 187 | 187 | |
| 188 | 188 | static ADDRESS_MAP_START( skydiver_map, AS_PROGRAM, 8, skydiver_state ) |
| 189 | 189 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 190 | | AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x4300) AM_READWRITE(skydiver_wram_r, skydiver_wram_w) |
| 190 | AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x4300) AM_READWRITE(wram_r, wram_w) |
| 191 | 191 | AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x4000) AM_RAM /* RAM B1 */ |
| 192 | | AM_RANGE(0x0400, 0x07ff) AM_MIRROR(0x4000) AM_RAM_WRITE(skydiver_videoram_w) AM_SHARE("videoram") /* RAMs K1,M1,P1,J1,N1,K/L1,L1,H/J1 */ |
| 193 | | AM_RANGE(0x0800, 0x0801) AM_MIRROR(0x47f0) AM_WRITE(skydiver_lamp_s_w) |
| 194 | | AM_RANGE(0x0802, 0x0803) AM_MIRROR(0x47f0) AM_WRITE(skydiver_lamp_k_w) |
| 195 | | AM_RANGE(0x0804, 0x0805) AM_MIRROR(0x47f0) AM_WRITE(skydiver_start_lamp_1_w) |
| 196 | | AM_RANGE(0x0806, 0x0807) AM_MIRROR(0x47f0) AM_WRITE(skydiver_start_lamp_2_w) |
| 197 | | AM_RANGE(0x0808, 0x0809) AM_MIRROR(0x47f0) AM_WRITE(skydiver_lamp_y_w) |
| 198 | | AM_RANGE(0x080a, 0x080b) AM_MIRROR(0x47f0) AM_WRITE(skydiver_lamp_d_w) |
| 199 | | AM_RANGE(0x080c, 0x080d) AM_MIRROR(0x47f0) AM_WRITE(skydiver_sound_enable_w) |
| 200 | | // AM_RANGE(0x1000, 0x1001) AM_MIRROR(0x47f0) AM_WRITE(skydiver_jump1_lamps_w) |
| 201 | | AM_RANGE(0x1002, 0x1003) AM_MIRROR(0x47f0) AM_WRITE(skydiver_coin_lockout_w) |
| 202 | | // AM_RANGE(0x1006, 0x1007) AM_MIRROR(0x47f0) AM_WRITE(skydiver_jump2_lamps_w) |
| 203 | | AM_RANGE(0x1008, 0x100b) AM_MIRROR(0x47f0) AM_WRITE(skydiver_whistle_w) |
| 204 | | AM_RANGE(0x100c, 0x100d) AM_MIRROR(0x47f0) AM_WRITE(skydiver_nmion_w) |
| 205 | | AM_RANGE(0x100e, 0x100f) AM_MIRROR(0x47f0) AM_WRITE(skydiver_width_w) |
| 192 | AM_RANGE(0x0400, 0x07ff) AM_MIRROR(0x4000) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") /* RAMs K1,M1,P1,J1,N1,K/L1,L1,H/J1 */ |
| 193 | AM_RANGE(0x0800, 0x0801) AM_MIRROR(0x47f0) AM_WRITE(lamp_s_w) |
| 194 | AM_RANGE(0x0802, 0x0803) AM_MIRROR(0x47f0) AM_WRITE(lamp_k_w) |
| 195 | AM_RANGE(0x0804, 0x0805) AM_MIRROR(0x47f0) AM_WRITE(start_lamp_1_w) |
| 196 | AM_RANGE(0x0806, 0x0807) AM_MIRROR(0x47f0) AM_WRITE(start_lamp_2_w) |
| 197 | AM_RANGE(0x0808, 0x0809) AM_MIRROR(0x47f0) AM_WRITE(lamp_y_w) |
| 198 | AM_RANGE(0x080a, 0x080b) AM_MIRROR(0x47f0) AM_WRITE(lamp_d_w) |
| 199 | AM_RANGE(0x080c, 0x080d) AM_MIRROR(0x47f0) AM_WRITE(sound_enable_w) |
| 200 | // AM_RANGE(0x1000, 0x1001) AM_MIRROR(0x47f0) AM_WRITE(jump1_lamps_w) |
| 201 | AM_RANGE(0x1002, 0x1003) AM_MIRROR(0x47f0) AM_WRITE(coin_lockout_w) |
| 202 | // AM_RANGE(0x1006, 0x1007) AM_MIRROR(0x47f0) AM_WRITE(jump2_lamps_w) |
| 203 | AM_RANGE(0x1008, 0x100b) AM_MIRROR(0x47f0) AM_WRITE(whistle_w) |
| 204 | AM_RANGE(0x100c, 0x100d) AM_MIRROR(0x47f0) AM_WRITE(nmion_w) |
| 205 | AM_RANGE(0x100e, 0x100f) AM_MIRROR(0x47f0) AM_WRITE(width_w) |
| 206 | 206 | AM_RANGE(0x1800, 0x1800) AM_MIRROR(0x47e0) AM_READ_PORT("IN0") |
| 207 | 207 | AM_RANGE(0x1801, 0x1801) AM_MIRROR(0x47e0) AM_READ_PORT("IN1") |
| 208 | 208 | AM_RANGE(0x1802, 0x1802) AM_MIRROR(0x47e0) AM_READ_PORT("IN2") |
| r243646 | r243647 | |
| 217 | 217 | AM_RANGE(0x180b, 0x180b) AM_MIRROR(0x47e4) AM_READ_PORT("IN11") |
| 218 | 218 | AM_RANGE(0x1810, 0x1810) AM_MIRROR(0x47e4) AM_READ_PORT("IN12") |
| 219 | 219 | AM_RANGE(0x1811, 0x1811) AM_MIRROR(0x47e4) AM_READ_PORT("IN13") |
| 220 | | AM_RANGE(0x2000, 0x201f) AM_MIRROR(0x47e0) AM_READ(watchdog_reset_r) AM_WRITE(skydiver_2000_201F_w) |
| 220 | AM_RANGE(0x2000, 0x201f) AM_MIRROR(0x47e0) AM_READ(watchdog_reset_r) AM_WRITE(_2000_201F_w) |
| 221 | 221 | AM_RANGE(0x2800, 0x2fff) AM_MIRROR(0x4000) AM_ROM |
| 222 | 222 | AM_RANGE(0x3000, 0x37ff) AM_MIRROR(0x4000) AM_ROM |
| 223 | 223 | AM_RANGE(0x3800, 0x3fff) AM_ROM |
| r243646 | r243647 | |
| 375 | 375 | /* basic machine hardware */ |
| 376 | 376 | MCFG_CPU_ADD("maincpu", M6800,MASTER_CLOCK/16) /* ???? */ |
| 377 | 377 | MCFG_CPU_PROGRAM_MAP(skydiver_map) |
| 378 | | MCFG_CPU_PERIODIC_INT_DRIVER(skydiver_state, skydiver_interrupt, 5*60) |
| 378 | MCFG_CPU_PERIODIC_INT_DRIVER(skydiver_state, interrupt, 5*60) |
| 379 | 379 | MCFG_WATCHDOG_VBLANK_INIT(8) // 128V clocks the same as VBLANK |
| 380 | 380 | |
| 381 | 381 | |
| r243646 | r243647 | |
| 385 | 385 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
| 386 | 386 | MCFG_SCREEN_SIZE(32*8, 32*8) |
| 387 | 387 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) |
| 388 | | MCFG_SCREEN_UPDATE_DRIVER(skydiver_state, screen_update_skydiver) |
| 388 | MCFG_SCREEN_UPDATE_DRIVER(skydiver_state, screen_update) |
| 389 | 389 | MCFG_SCREEN_PALETTE("palette") |
| 390 | 390 | |
| 391 | 391 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", skydiver) |
| r243646 | r243647 | |
| 432 | 432 | * |
| 433 | 433 | *************************************/ |
| 434 | 434 | |
| 435 | | GAMEL(1978, skydiver, 0, skydiver, skydiver, driver_device, 0, ROT0, "Atari", "Sky Diver", 0, layout_skydiver ) |
| 435 | GAMEL(1978, skydiver, 0, skydiver, skydiver, driver_device, 0, ROT0, "Atari", "Sky Diver", GAME_SUPPORTS_SAVE, layout_skydiver ) |
trunk/src/mame/includes/skydiver.h
| r243646 | r243647 | |
| 24 | 24 | public: |
| 25 | 25 | skydiver_state(const machine_config &mconfig, device_type type, const char *tag) |
| 26 | 26 | : driver_device(mconfig, type, tag), |
| 27 | | m_videoram(*this, "videoram") , |
| 28 | 27 | m_maincpu(*this, "maincpu"), |
| 29 | 28 | m_discrete(*this, "discrete"), |
| 30 | 29 | m_gfxdecode(*this, "gfxdecode"), |
| 31 | | m_palette(*this, "palette") { } |
| 30 | m_palette(*this, "palette"), |
| 31 | m_videoram(*this, "videoram") { } |
| 32 | 32 | |
| 33 | required_device<cpu_device> m_maincpu; |
| 34 | required_device<discrete_device> m_discrete; |
| 35 | required_device<gfxdecode_device> m_gfxdecode; |
| 36 | required_device<palette_device> m_palette; |
| 37 | |
| 33 | 38 | required_shared_ptr<UINT8> m_videoram; |
| 39 | |
| 34 | 40 | int m_nmion; |
| 35 | 41 | tilemap_t *m_bg_tilemap; |
| 36 | 42 | int m_width; |
| 37 | 43 | |
| 38 | | DECLARE_WRITE8_MEMBER(skydiver_nmion_w); |
| 39 | | DECLARE_WRITE8_MEMBER(skydiver_videoram_w); |
| 40 | | DECLARE_READ8_MEMBER(skydiver_wram_r); |
| 41 | | DECLARE_WRITE8_MEMBER(skydiver_wram_w); |
| 42 | | DECLARE_WRITE8_MEMBER(skydiver_width_w); |
| 43 | | DECLARE_WRITE8_MEMBER(skydiver_coin_lockout_w); |
| 44 | | DECLARE_WRITE8_MEMBER(skydiver_start_lamp_1_w); |
| 45 | | DECLARE_WRITE8_MEMBER(skydiver_start_lamp_2_w); |
| 46 | | DECLARE_WRITE8_MEMBER(skydiver_lamp_s_w); |
| 47 | | DECLARE_WRITE8_MEMBER(skydiver_lamp_k_w); |
| 48 | | DECLARE_WRITE8_MEMBER(skydiver_lamp_y_w); |
| 49 | | DECLARE_WRITE8_MEMBER(skydiver_lamp_d_w); |
| 50 | | DECLARE_WRITE8_MEMBER(skydiver_2000_201F_w); |
| 51 | | DECLARE_WRITE8_MEMBER(skydiver_sound_enable_w); |
| 52 | | DECLARE_WRITE8_MEMBER(skydiver_whistle_w); |
| 44 | DECLARE_WRITE8_MEMBER(nmion_w); |
| 45 | DECLARE_WRITE8_MEMBER(videoram_w); |
| 46 | DECLARE_READ8_MEMBER(wram_r); |
| 47 | DECLARE_WRITE8_MEMBER(wram_w); |
| 48 | DECLARE_WRITE8_MEMBER(width_w); |
| 49 | DECLARE_WRITE8_MEMBER(coin_lockout_w); |
| 50 | DECLARE_WRITE8_MEMBER(start_lamp_1_w); |
| 51 | DECLARE_WRITE8_MEMBER(start_lamp_2_w); |
| 52 | DECLARE_WRITE8_MEMBER(lamp_s_w); |
| 53 | DECLARE_WRITE8_MEMBER(lamp_k_w); |
| 54 | DECLARE_WRITE8_MEMBER(lamp_y_w); |
| 55 | DECLARE_WRITE8_MEMBER(lamp_d_w); |
| 56 | DECLARE_WRITE8_MEMBER(_2000_201F_w); |
| 57 | DECLARE_WRITE8_MEMBER(sound_enable_w); |
| 58 | DECLARE_WRITE8_MEMBER(whistle_w); |
| 59 | |
| 53 | 60 | TILE_GET_INFO_MEMBER(get_tile_info); |
| 61 | |
| 54 | 62 | virtual void machine_reset(); |
| 55 | 63 | virtual void video_start(); |
| 56 | 64 | DECLARE_PALETTE_INIT(skydiver); |
| 57 | | UINT32 screen_update_skydiver(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 58 | | INTERRUPT_GEN_MEMBER(skydiver_interrupt); |
| 65 | |
| 66 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 59 | 67 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 60 | | required_device<cpu_device> m_maincpu; |
| 61 | | required_device<discrete_device> m_discrete; |
| 62 | | required_device<gfxdecode_device> m_gfxdecode; |
| 63 | | required_device<palette_device> m_palette; |
| 68 | |
| 69 | INTERRUPT_GEN_MEMBER(interrupt); |
| 64 | 70 | }; |
| 65 | 71 | |
| 66 | 72 | /*----------- defined in audio/skydiver.c -----------*/ |
trunk/src/mame/video/skydiver.c
| r243646 | r243647 | |
| 14 | 14 | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 15 | 15 | |
| 16 | 16 | /* reset all latches */ |
| 17 | | skydiver_start_lamp_1_w(space, 0, 0); |
| 18 | | skydiver_start_lamp_2_w(space, 0, 0); |
| 19 | | skydiver_lamp_s_w(space, 0, 0); |
| 20 | | skydiver_lamp_k_w(space, 0, 0); |
| 21 | | skydiver_lamp_y_w(space, 0, 0); |
| 22 | | skydiver_lamp_d_w(space, 0, 0); |
| 17 | start_lamp_1_w(space, 0, 0); |
| 18 | start_lamp_2_w(space, 0, 0); |
| 19 | lamp_s_w(space, 0, 0); |
| 20 | lamp_k_w(space, 0, 0); |
| 21 | lamp_y_w(space, 0, 0); |
| 22 | lamp_d_w(space, 0, 0); |
| 23 | 23 | output_set_value("lampi", 0); |
| 24 | 24 | output_set_value("lampv", 0); |
| 25 | 25 | output_set_value("lampe", 0); |
| 26 | 26 | output_set_value("lampr", 0); |
| 27 | | skydiver_width_w(space, 0, 0); |
| 28 | | skydiver_coin_lockout_w(space, 0, 0); |
| 27 | width_w(space, 0, 0); |
| 28 | coin_lockout_w(space, 0, 0); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| r243646 | r243647 | |
| 52 | 52 | void skydiver_state::video_start() |
| 53 | 53 | { |
| 54 | 54 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(skydiver_state::get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); |
| 55 | |
| 56 | save_item(NAME(m_nmion)); |
| 57 | save_item(NAME(m_width)); |
| 55 | 58 | } |
| 56 | 59 | |
| 57 | 60 | |
| r243646 | r243647 | |
| 61 | 64 | * |
| 62 | 65 | *************************************/ |
| 63 | 66 | |
| 64 | | WRITE8_MEMBER(skydiver_state::skydiver_videoram_w) |
| 67 | WRITE8_MEMBER(skydiver_state::videoram_w) |
| 65 | 68 | { |
| 66 | 69 | m_videoram[offset] = data; |
| 67 | 70 | m_bg_tilemap->mark_tile_dirty(offset); |
| 68 | 71 | } |
| 69 | 72 | |
| 70 | 73 | |
| 71 | | READ8_MEMBER(skydiver_state::skydiver_wram_r) |
| 74 | READ8_MEMBER(skydiver_state::wram_r) |
| 72 | 75 | { |
| 73 | 76 | return m_videoram[offset | 0x380]; |
| 74 | 77 | } |
| 75 | 78 | |
| 76 | | WRITE8_MEMBER(skydiver_state::skydiver_wram_w) |
| 79 | WRITE8_MEMBER(skydiver_state::wram_w) |
| 77 | 80 | { |
| 78 | 81 | m_videoram[offset | 0x0380] = data; |
| 79 | 82 | } |
| 80 | 83 | |
| 81 | 84 | |
| 82 | | WRITE8_MEMBER(skydiver_state::skydiver_width_w) |
| 85 | WRITE8_MEMBER(skydiver_state::width_w) |
| 83 | 86 | { |
| 84 | 87 | m_width = offset; |
| 85 | 88 | } |
| 86 | 89 | |
| 87 | 90 | |
| 88 | | WRITE8_MEMBER(skydiver_state::skydiver_coin_lockout_w) |
| 91 | WRITE8_MEMBER(skydiver_state::coin_lockout_w) |
| 89 | 92 | { |
| 90 | 93 | coin_lockout_global_w(machine(), !offset); |
| 91 | 94 | } |
| 92 | 95 | |
| 93 | 96 | |
| 94 | | WRITE8_MEMBER(skydiver_state::skydiver_start_lamp_1_w) |
| 97 | WRITE8_MEMBER(skydiver_state::start_lamp_1_w) |
| 95 | 98 | { |
| 96 | 99 | set_led_status(machine(), 0, offset); |
| 97 | 100 | } |
| 98 | 101 | |
| 99 | | WRITE8_MEMBER(skydiver_state::skydiver_start_lamp_2_w) |
| 102 | WRITE8_MEMBER(skydiver_state::start_lamp_2_w) |
| 100 | 103 | { |
| 101 | 104 | set_led_status(machine(), 1, offset); |
| 102 | 105 | } |
| 103 | 106 | |
| 104 | 107 | |
| 105 | | WRITE8_MEMBER(skydiver_state::skydiver_lamp_s_w) |
| 108 | WRITE8_MEMBER(skydiver_state::lamp_s_w) |
| 106 | 109 | { |
| 107 | 110 | output_set_value("lamps", offset); |
| 108 | 111 | } |
| 109 | 112 | |
| 110 | | WRITE8_MEMBER(skydiver_state::skydiver_lamp_k_w) |
| 113 | WRITE8_MEMBER(skydiver_state::lamp_k_w) |
| 111 | 114 | { |
| 112 | 115 | output_set_value("lampk", offset); |
| 113 | 116 | } |
| 114 | 117 | |
| 115 | | WRITE8_MEMBER(skydiver_state::skydiver_lamp_y_w) |
| 118 | WRITE8_MEMBER(skydiver_state::lamp_y_w) |
| 116 | 119 | { |
| 117 | 120 | output_set_value("lampy", offset); |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | | WRITE8_MEMBER(skydiver_state::skydiver_lamp_d_w) |
| 123 | WRITE8_MEMBER(skydiver_state::lamp_d_w) |
| 121 | 124 | { |
| 122 | 125 | output_set_value("lampd", offset); |
| 123 | 126 | } |
| 124 | 127 | |
| 125 | | WRITE8_MEMBER(skydiver_state::skydiver_2000_201F_w) |
| 128 | WRITE8_MEMBER(skydiver_state::_2000_201F_w) |
| 126 | 129 | { |
| 127 | 130 | int bit = offset & 0x01; |
| 128 | 131 | |
| r243646 | r243647 | |
| 198 | 201 | } |
| 199 | 202 | |
| 200 | 203 | |
| 201 | | UINT32 skydiver_state::screen_update_skydiver(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 204 | UINT32 skydiver_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 202 | 205 | { |
| 203 | 206 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); |
| 204 | 207 | |