trunk/src/mame/drivers/senjyo.c
| r242725 | r242726 | |
| 78 | 78 | #include "emu.h" |
| 79 | 79 | #include "cpu/z80/z80.h" |
| 80 | 80 | #include "sound/sn76496.h" |
| 81 | | #include "sound/samples.h" |
| 82 | 81 | #include "machine/segacrpt.h" |
| 83 | 82 | #include "includes/senjyo.h" |
| 84 | 83 | |
| 85 | | void senjyo_state::machine_reset() |
| 84 | void senjyo_state::machine_start() |
| 86 | 85 | { |
| 87 | | // ... |
| 86 | save_item(NAME(m_sound_cmd)); |
| 87 | save_item(NAME(m_single_volume)); |
| 88 | save_item(NAME(m_sound_state)); |
| 89 | save_item(NAME(m_bgstripes)); |
| 88 | 90 | } |
| 89 | 91 | |
| 90 | | INTERRUPT_GEN_MEMBER(senjyo_state::senjyo_interrupt) |
| 92 | void senjyo_state::machine_reset() |
| 91 | 93 | { |
| 92 | | device.execute().set_input_line(0, ASSERT_LINE); |
| 94 | m_sound_cmd = 0; |
| 95 | m_single_volume = 0; |
| 96 | m_sound_state = 0; |
| 97 | m_bgstripes = 0; |
| 93 | 98 | } |
| 94 | 99 | |
| 95 | 100 | WRITE8_MEMBER(senjyo_state::irq_ctrl_w) |
| r242725 | r242726 | |
| 105 | 110 | |
| 106 | 111 | WRITE8_MEMBER(senjyo_state::sound_cmd_w) |
| 107 | 112 | { |
| 108 | | z80pio_device *device = machine().device<z80pio_device>("z80pio"); |
| 109 | | |
| 110 | 113 | m_sound_cmd = data; |
| 111 | 114 | |
| 112 | | device->strobe_a(0); |
| 113 | | device->strobe_a(1); |
| 115 | m_pio->strobe_a(0); |
| 116 | m_pio->strobe_a(1); |
| 114 | 117 | } |
| 115 | 118 | |
| 116 | | WRITE8_MEMBER(senjyo_state::senjyo_paletteram_w) |
| 119 | WRITE8_MEMBER(senjyo_state::paletteram_w) |
| 117 | 120 | { |
| 118 | 121 | int r = (data << 2) & 0xC; |
| 119 | 122 | int g = (data ) & 0xC; |
| r242725 | r242726 | |
| 131 | 134 | static ADDRESS_MAP_START( senjyo_map, AS_PROGRAM, 8, senjyo_state ) |
| 132 | 135 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 133 | 136 | AM_RANGE(0x8000, 0x8fff) AM_RAM |
| 134 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(senjyo_fgvideoram_w) AM_SHARE("fgvideoram") |
| 135 | | AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(senjyo_fgcolorram_w) AM_SHARE("fgcolorram") |
| 137 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(fgvideoram_w) AM_SHARE("fgvideoram") |
| 138 | AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(fgcolorram_w) AM_SHARE("fgcolorram") |
| 136 | 139 | AM_RANGE(0x9800, 0x987f) AM_RAM AM_SHARE("spriteram") |
| 137 | | AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE(senjyo_paletteram_w) AM_SHARE("paletteram") |
| 140 | AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") |
| 138 | 141 | AM_RANGE(0x9e00, 0x9e1f) AM_RAM AM_SHARE("fgscroll") |
| 139 | 142 | AM_RANGE(0x9e20, 0x9e21) AM_RAM AM_SHARE("scrolly3") |
| 140 | 143 | /* AM_RANGE(0x9e22, 0x9e23) height of the layer (Senjyo only, fixed at 0x380) */ |
| 141 | 144 | AM_RANGE(0x9e25, 0x9e25) AM_RAM AM_SHARE("scrollx3") |
| 142 | | AM_RANGE(0x9e27, 0x9e27) AM_RAM_WRITE(senjyo_bgstripes_w) AM_SHARE("bgstripesram") /* controls width of background stripes */ |
| 145 | AM_RANGE(0x9e27, 0x9e27) AM_RAM AM_SHARE("bgstripesram") /* controls width of background stripes */ |
| 143 | 146 | AM_RANGE(0x9e28, 0x9e29) AM_RAM AM_SHARE("scrolly2") |
| 144 | 147 | /* AM_RANGE(0x9e2a, 0x9e2b) height of the layer (Senjyo only, fixed at 0x200) */ |
| 145 | 148 | AM_RANGE(0x9e2d, 0x9e2d) AM_RAM AM_SHARE("scrollx2") |
| r242725 | r242726 | |
| 149 | 152 | /* AM_RANGE(0x9e38, 0x9e38) probably radar y position (Senjyo only, fixed at 0x61) */ |
| 150 | 153 | /* AM_RANGE(0x9e3d, 0x9e3d) probably radar x position (Senjyo only, 0x00/0xc0 depending on screen flip) */ |
| 151 | 154 | AM_RANGE(0x9e00, 0x9e3f) AM_RAM |
| 152 | | AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(senjyo_bg3videoram_w) AM_SHARE("bg3videoram") |
| 153 | | AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(senjyo_bg2videoram_w) AM_SHARE("bg2videoram") |
| 154 | | AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(senjyo_bg1videoram_w) AM_SHARE("bg1videoram") |
| 155 | AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(bg3videoram_w) AM_SHARE("bg3videoram") |
| 156 | AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(bg2videoram_w) AM_SHARE("bg2videoram") |
| 157 | AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(bg1videoram_w) AM_SHARE("bg1videoram") |
| 155 | 158 | AM_RANGE(0xb800, 0xbbff) AM_RAM AM_SHARE("radarram") |
| 156 | 159 | AM_RANGE(0xd000, 0xd000) AM_READ_PORT("P1") AM_WRITE(flip_screen_w) |
| 157 | 160 | AM_RANGE(0xd001, 0xd001) AM_READ_PORT("P2") |
| r242725 | r242726 | |
| 167 | 170 | AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("sn1", sn76496_device, write) |
| 168 | 171 | AM_RANGE(0x9000, 0x9000) AM_DEVWRITE("sn2", sn76496_device, write) |
| 169 | 172 | AM_RANGE(0xa000, 0xa000) AM_DEVWRITE("sn3", sn76496_device, write) |
| 170 | | AM_RANGE(0xd000, 0xd000) AM_WRITE(senjyo_volume_w) |
| 173 | AM_RANGE(0xd000, 0xd000) AM_WRITE(volume_w) |
| 171 | 174 | #if 0 |
| 172 | 175 | AM_RANGE(0xe000, 0xe000) AM_WRITE(unknown) |
| 173 | 176 | AM_RANGE(0xf000, 0xf000) AM_WRITE(unknown) |
| r242725 | r242726 | |
| 198 | 201 | static ADDRESS_MAP_START( starforb_map, AS_PROGRAM, 8, senjyo_state ) |
| 199 | 202 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 200 | 203 | AM_RANGE(0x8000, 0x8fff) AM_RAM |
| 201 | | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(senjyo_fgvideoram_w) AM_SHARE("fgvideoram") |
| 202 | | AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(senjyo_fgcolorram_w) AM_SHARE("fgcolorram") |
| 204 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(fgvideoram_w) AM_SHARE("fgvideoram") |
| 205 | AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(fgcolorram_w) AM_SHARE("fgcolorram") |
| 203 | 206 | AM_RANGE(0x9800, 0x987f) AM_RAM AM_SHARE("spriteram") |
| 204 | | AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE(senjyo_paletteram_w) AM_SHARE("paletteram") |
| 207 | AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") |
| 205 | 208 | /* The format / use of the ram here is different on the bootleg */ |
| 206 | 209 | AM_RANGE(0x9e20, 0x9e21) AM_RAM AM_SHARE("scrolly3") |
| 207 | 210 | AM_RANGE(0x9e25, 0x9e25) AM_RAM AM_SHARE("scrollx3") |
| r242725 | r242726 | |
| 209 | 212 | AM_RANGE(0x9e35, 0x9e35) AM_RAM_WRITE(starforb_scrollx2) AM_SHARE("scrollx2") // ok |
| 210 | 213 | AM_RANGE(0x9e00, 0x9e3f) AM_RAM |
| 211 | 214 | |
| 212 | | AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(senjyo_bg3videoram_w) AM_SHARE("bg3videoram") |
| 213 | | AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(senjyo_bg2videoram_w) AM_SHARE("bg2videoram") |
| 214 | | AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(senjyo_bg1videoram_w) AM_SHARE("bg1videoram") |
| 215 | AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(bg3videoram_w) AM_SHARE("bg3videoram") |
| 216 | AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(bg2videoram_w) AM_SHARE("bg2videoram") |
| 217 | AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(bg1videoram_w) AM_SHARE("bg1videoram") |
| 215 | 218 | AM_RANGE(0xb800, 0xbbff) AM_RAM AM_SHARE("radarram") |
| 216 | 219 | AM_RANGE(0xd000, 0xd000) AM_READ_PORT("P1") AM_WRITE(flip_screen_w) |
| 217 | 220 | AM_RANGE(0xd001, 0xd001) AM_READ_PORT("P2") |
| r242725 | r242726 | |
| 221 | 224 | |
| 222 | 225 | /* these aren't used / written, left here to make sure memory is allocated */ |
| 223 | 226 | AM_RANGE(0xfe00, 0xfe1f) AM_RAM AM_SHARE("fgscroll") |
| 224 | | AM_RANGE(0xfe27, 0xfe27) AM_RAM_WRITE(senjyo_bgstripes_w) AM_SHARE("bgstripesram") /* controls width of background stripes */ |
| 227 | AM_RANGE(0xfe27, 0xfe27) AM_RAM AM_SHARE("bgstripesram") /* controls width of background stripes */ |
| 225 | 228 | AM_RANGE(0xfe28, 0xfe29) AM_RAM AM_SHARE("scrolly1") |
| 226 | 229 | AM_RANGE(0xfe2d, 0xfe2d) AM_RAM AM_SHARE("scrollx1") |
| 227 | 230 | ADDRESS_MAP_END |
| r242725 | r242726 | |
| 233 | 236 | AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("sn1", sn76496_device, write) |
| 234 | 237 | AM_RANGE(0x9000, 0x9000) AM_DEVWRITE("sn2", sn76496_device, write) |
| 235 | 238 | AM_RANGE(0xa000, 0xa000) AM_DEVWRITE("sn3", sn76496_device, write) |
| 236 | | AM_RANGE(0xd000, 0xd000) AM_WRITE(senjyo_volume_w) |
| 239 | AM_RANGE(0xd000, 0xd000) AM_WRITE(volume_w) |
| 237 | 240 | #if 0 |
| 238 | 241 | AM_RANGE(0xe000, 0xe000) AM_WRITE(unknown) |
| 239 | 242 | AM_RANGE(0xf000, 0xf000) AM_WRITE(unknown) |
| r242725 | r242726 | |
| 556 | 559 | /* basic machine hardware */ |
| 557 | 560 | MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz? */ |
| 558 | 561 | MCFG_CPU_PROGRAM_MAP(senjyo_map) |
| 559 | | MCFG_CPU_VBLANK_INT_DRIVER("screen", senjyo_state, senjyo_interrupt) |
| 562 | MCFG_CPU_VBLANK_INT_DRIVER("screen", senjyo_state, irq0_line_assert) |
| 560 | 563 | |
| 561 | 564 | MCFG_CPU_ADD("sub", Z80, 2000000) /* 2 MHz? */ |
| 562 | 565 | MCFG_CPU_CONFIG(senjyo_daisy_chain) |
| r242725 | r242726 | |
| 578 | 581 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 579 | 582 | MCFG_SCREEN_SIZE(32*8, 32*8) |
| 580 | 583 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 581 | | MCFG_SCREEN_UPDATE_DRIVER(senjyo_state, screen_update_senjyo) |
| 584 | MCFG_SCREEN_UPDATE_DRIVER(senjyo_state, screen_update) |
| 582 | 585 | MCFG_SCREEN_PALETTE("palette") |
| 583 | 586 | |
| 584 | 587 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", senjyo) |
| r242725 | r242726 | |
| 925 | 928 | } |
| 926 | 929 | |
| 927 | 930 | |
| 928 | | GAME( 1983, senjyo, 0, senjyo, senjyo, senjyo_state, senjyo, ROT90, "Tehkan", "Senjyo", 0 ) |
| 929 | | GAME( 1984, starforc, 0, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan", "Star Force", 0 ) |
| 930 | | GAME( 1984, starforce,starforc, senjyo, starforc, senjyo_state, starfore, ROT90, "Tehkan", "Star Force (encrypted, set 1)", 0 ) |
| 931 | | GAME( 1984, starforcb,starforc, starforb,starforc, senjyo_state, starfore, ROT90, "bootleg", "Star Force (encrypted, bootleg)", 0 ) |
| 932 | | GAME( 1984, starforca,starforc, senjyo, starforc, senjyo_state, starfora, ROT90, "Tehkan", "Star Force (encrypted, set 2)", 0 ) |
| 933 | | GAME( 1985, megaforc, starforc, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan (Video Ware license)", "Mega Force", 0 ) |
| 934 | | GAME( 1986, baluba, 0, senjyo, baluba, senjyo_state, starforc, ROT90, "Able Corp, Ltd.", "Baluba-louk no Densetsu (Japan)", 0 ) |
| 931 | GAME( 1983, senjyo, 0, senjyo, senjyo, senjyo_state, senjyo, ROT90, "Tehkan", "Senjyo", GAME_SUPPORTS_SAVE ) |
| 932 | GAME( 1984, starforc, 0, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan", "Star Force", GAME_SUPPORTS_SAVE ) |
| 933 | GAME( 1984, starforce,starforc, senjyo, starforc, senjyo_state, starfore, ROT90, "Tehkan", "Star Force (encrypted, set 1)", GAME_SUPPORTS_SAVE ) |
| 934 | GAME( 1984, starforcb,starforc, starforb,starforc, senjyo_state, starfore, ROT90, "bootleg", "Star Force (encrypted, bootleg)", GAME_SUPPORTS_SAVE ) |
| 935 | GAME( 1984, starforca,starforc, senjyo, starforc, senjyo_state, starfora, ROT90, "Tehkan", "Star Force (encrypted, set 2)", GAME_SUPPORTS_SAVE ) |
| 936 | GAME( 1985, megaforc, starforc, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan (Video Ware license)", "Mega Force", GAME_SUPPORTS_SAVE ) |
| 937 | GAME( 1986, baluba, 0, senjyo, baluba, senjyo_state, starforc, ROT90, "Able Corp, Ltd.", "Baluba-louk no Densetsu (Japan)", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/senjyo.h
| r242725 | r242726 | |
| 8 | 8 | public: |
| 9 | 9 | senjyo_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_pio(*this, "z80pio"), |
| 11 | 13 | m_dac(*this, "dac"), |
| 14 | m_gfxdecode(*this, "gfxdecode"), |
| 15 | m_palette(*this, "palette"), |
| 12 | 16 | m_spriteram(*this, "spriteram"), |
| 13 | 17 | m_fgscroll(*this, "fgscroll"), |
| 14 | 18 | m_scrollx1(*this, "scrollx1"), |
| r242725 | r242726 | |
| 24 | 28 | m_bg3videoram(*this, "bg3videoram"), |
| 25 | 29 | m_radarram(*this, "radarram"), |
| 26 | 30 | m_bgstripesram(*this, "bgstripesram"), |
| 27 | | m_maincpu(*this, "maincpu"), |
| 28 | | m_gfxdecode(*this, "gfxdecode"), |
| 29 | | m_palette(*this, "palette"), |
| 30 | 31 | m_generic_paletteram_8(*this, "paletteram") { } |
| 31 | 32 | |
| 32 | | UINT8 m_sound_cmd; |
| 33 | | INT16 *m_single_data; |
| 34 | | int m_single_rate; |
| 35 | | int m_single_volume; |
| 36 | | int m_sound_state; |
| 37 | | |
| 33 | /* devices */ |
| 34 | required_device<cpu_device> m_maincpu; |
| 35 | required_device<z80pio_device> m_pio; |
| 38 | 36 | required_device<dac_device> m_dac; |
| 39 | | |
| 37 | required_device<gfxdecode_device> m_gfxdecode; |
| 38 | required_device<palette_device> m_palette; |
| 39 | |
| 40 | /* memory pointers */ |
| 40 | 41 | required_shared_ptr<UINT8> m_spriteram; |
| 41 | 42 | required_shared_ptr<UINT8> m_fgscroll; |
| 42 | 43 | required_shared_ptr<UINT8> m_scrollx1; |
| r242725 | r242726 | |
| 52 | 53 | required_shared_ptr<UINT8> m_bg3videoram; |
| 53 | 54 | required_shared_ptr<UINT8> m_radarram; |
| 54 | 55 | required_shared_ptr<UINT8> m_bgstripesram; |
| 56 | required_shared_ptr<UINT8> m_generic_paletteram_8; |
| 57 | |
| 58 | // game specific initialization |
| 55 | 59 | int m_is_senjyo; |
| 56 | 60 | int m_scrollhack; |
| 61 | |
| 62 | UINT8 m_sound_cmd; |
| 63 | int m_single_volume; |
| 64 | int m_sound_state; |
| 65 | int m_bgstripes; |
| 57 | 66 | tilemap_t *m_fg_tilemap; |
| 58 | 67 | tilemap_t *m_bg1_tilemap; |
| 59 | 68 | tilemap_t *m_bg2_tilemap; |
| 60 | 69 | tilemap_t *m_bg3_tilemap; |
| 61 | | |
| 62 | | int m_bgstripes; |
| 70 | |
| 63 | 71 | DECLARE_WRITE8_MEMBER(flip_screen_w); |
| 64 | | DECLARE_WRITE8_MEMBER(senjyo_paletteram_w); |
| 72 | DECLARE_WRITE8_MEMBER(paletteram_w); |
| 65 | 73 | DECLARE_WRITE8_MEMBER(starforb_scrolly2); |
| 66 | 74 | DECLARE_WRITE8_MEMBER(starforb_scrollx2); |
| 67 | | DECLARE_WRITE8_MEMBER(senjyo_fgvideoram_w); |
| 68 | | DECLARE_WRITE8_MEMBER(senjyo_fgcolorram_w); |
| 69 | | DECLARE_WRITE8_MEMBER(senjyo_bg1videoram_w); |
| 70 | | DECLARE_WRITE8_MEMBER(senjyo_bg2videoram_w); |
| 71 | | DECLARE_WRITE8_MEMBER(senjyo_bg3videoram_w); |
| 72 | | DECLARE_WRITE8_MEMBER(senjyo_bgstripes_w); |
| 73 | | DECLARE_WRITE8_MEMBER(senjyo_volume_w); |
| 75 | DECLARE_WRITE8_MEMBER(fgvideoram_w); |
| 76 | DECLARE_WRITE8_MEMBER(fgcolorram_w); |
| 77 | DECLARE_WRITE8_MEMBER(bg1videoram_w); |
| 78 | DECLARE_WRITE8_MEMBER(bg2videoram_w); |
| 79 | DECLARE_WRITE8_MEMBER(bg3videoram_w); |
| 80 | DECLARE_WRITE8_MEMBER(volume_w); |
| 74 | 81 | DECLARE_WRITE_LINE_MEMBER(sound_line_clock); |
| 75 | 82 | DECLARE_WRITE8_MEMBER(sound_cmd_w); |
| 76 | | DECLARE_WRITE8_MEMBER(irq_ack_w); |
| 83 | DECLARE_WRITE8_MEMBER(irq_ctrl_w); |
| 84 | DECLARE_READ8_MEMBER(pio_pa_r); |
| 85 | |
| 77 | 86 | DECLARE_DRIVER_INIT(starfora); |
| 78 | 87 | DECLARE_DRIVER_INIT(senjyo); |
| 79 | 88 | DECLARE_DRIVER_INIT(starfore); |
| 80 | 89 | DECLARE_DRIVER_INIT(starforc); |
| 90 | |
| 81 | 91 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 82 | 92 | TILE_GET_INFO_MEMBER(senjyo_bg1_tile_info); |
| 83 | 93 | TILE_GET_INFO_MEMBER(starforc_bg1_tile_info); |
| 84 | 94 | TILE_GET_INFO_MEMBER(get_bg2_tile_info); |
| 85 | 95 | TILE_GET_INFO_MEMBER(get_bg3_tile_info); |
| 96 | |
| 97 | virtual void machine_start(); |
| 86 | 98 | virtual void machine_reset(); |
| 87 | 99 | virtual void video_start(); |
| 88 | | UINT32 screen_update_senjyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 89 | | INTERRUPT_GEN_MEMBER(senjyo_interrupt); |
| 90 | | DECLARE_WRITE8_MEMBER(irq_ctrl_w); |
| 91 | | DECLARE_READ8_MEMBER(pio_pa_r); |
| 100 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 92 | 101 | void draw_bgbitmap(bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 93 | 102 | void draw_radar(bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 94 | 103 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int priority); |
| 95 | | required_device<cpu_device> m_maincpu; |
| 96 | | required_device<gfxdecode_device> m_gfxdecode; |
| 97 | | required_device<palette_device> m_palette; |
| 98 | | required_shared_ptr<UINT8> m_generic_paletteram_8; |
| 99 | 104 | }; |
| 100 | 105 | |
| 101 | 106 | /*----------- defined in audio/senjyo.c -----------*/ |
trunk/src/mame/video/senjyo.c
| r242725 | r242726 | |
| 114 | 114 | |
| 115 | 115 | ***************************************************************************/ |
| 116 | 116 | |
| 117 | | WRITE8_MEMBER(senjyo_state::senjyo_fgvideoram_w) |
| 117 | WRITE8_MEMBER(senjyo_state::fgvideoram_w) |
| 118 | 118 | { |
| 119 | 119 | m_fgvideoram[offset] = data; |
| 120 | 120 | m_fg_tilemap->mark_tile_dirty(offset); |
| 121 | 121 | } |
| 122 | | WRITE8_MEMBER(senjyo_state::senjyo_fgcolorram_w) |
| 122 | WRITE8_MEMBER(senjyo_state::fgcolorram_w) |
| 123 | 123 | { |
| 124 | 124 | m_fgcolorram[offset] = data; |
| 125 | 125 | m_fg_tilemap->mark_tile_dirty(offset); |
| 126 | 126 | } |
| 127 | | WRITE8_MEMBER(senjyo_state::senjyo_bg1videoram_w) |
| 127 | WRITE8_MEMBER(senjyo_state::bg1videoram_w) |
| 128 | 128 | { |
| 129 | 129 | m_bg1videoram[offset] = data; |
| 130 | 130 | m_bg1_tilemap->mark_tile_dirty(offset); |
| 131 | 131 | } |
| 132 | | WRITE8_MEMBER(senjyo_state::senjyo_bg2videoram_w) |
| 132 | WRITE8_MEMBER(senjyo_state::bg2videoram_w) |
| 133 | 133 | { |
| 134 | 134 | m_bg2videoram[offset] = data; |
| 135 | 135 | m_bg2_tilemap->mark_tile_dirty(offset); |
| 136 | 136 | } |
| 137 | | WRITE8_MEMBER(senjyo_state::senjyo_bg3videoram_w) |
| 137 | WRITE8_MEMBER(senjyo_state::bg3videoram_w) |
| 138 | 138 | { |
| 139 | 139 | m_bg3videoram[offset] = data; |
| 140 | 140 | m_bg3_tilemap->mark_tile_dirty(offset); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | | WRITE8_MEMBER(senjyo_state::senjyo_bgstripes_w) |
| 144 | | { |
| 145 | | *m_bgstripesram = data; |
| 146 | | } |
| 147 | | |
| 148 | 143 | /*************************************************************************** |
| 149 | 144 | |
| 150 | 145 | Display refresh |
| r242725 | r242726 | |
| 153 | 148 | |
| 154 | 149 | void senjyo_state::draw_bgbitmap(bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 155 | 150 | { |
| 156 | | int x,y,pen,strwid,count; |
| 157 | | |
| 158 | | |
| 159 | 151 | if (m_bgstripes == 0xff) /* off */ |
| 160 | 152 | bitmap.fill(0, cliprect); |
| 161 | 153 | else |
| 162 | 154 | { |
| 163 | 155 | int flip = flip_screen(); |
| 164 | 156 | |
| 165 | | pen = 0; |
| 166 | | count = 0; |
| 167 | | strwid = m_bgstripes; |
| 157 | int pen = 0; |
| 158 | int count = 0; |
| 159 | int strwid = m_bgstripes; |
| 168 | 160 | if (strwid == 0) strwid = 0x100; |
| 169 | 161 | if (flip) strwid ^= 0xff; |
| 170 | 162 | |
| 171 | | for (x = 0;x < 256;x++) |
| 163 | for (int x = 0;x < 256;x++) |
| 172 | 164 | { |
| 173 | 165 | if (flip) |
| 174 | | for (y = 0;y < 256;y++) |
| 166 | for (int y = 0;y < 256;y++) |
| 175 | 167 | bitmap.pix16(y, 255 - x) = 384 + pen; |
| 176 | 168 | else |
| 177 | | for (y = 0;y < 256;y++) |
| 169 | for (int y = 0;y < 256;y++) |
| 178 | 170 | bitmap.pix16(y, x) = 384 + pen; |
| 179 | 171 | |
| 180 | 172 | count += 0x10; |
| r242725 | r242726 | |
| 189 | 181 | |
| 190 | 182 | void senjyo_state::draw_radar(bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 191 | 183 | { |
| 192 | | int offs,x; |
| 193 | | |
| 194 | | for (offs = 0;offs < 0x400;offs++) |
| 195 | | for (x = 0;x < 8;x++) |
| 184 | for (int offs = 0;offs < 0x400;offs++) |
| 185 | for (int x = 0;x < 8;x++) |
| 196 | 186 | if (m_radarram[offs] & (1 << x)) |
| 197 | 187 | { |
| 198 | 188 | int sx, sy; |
| r242725 | r242726 | |
| 213 | 203 | |
| 214 | 204 | void senjyo_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int priority) |
| 215 | 205 | { |
| 216 | | UINT8 *spriteram = m_spriteram; |
| 217 | | int offs; |
| 218 | | |
| 219 | | for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) |
| 206 | for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) |
| 220 | 207 | { |
| 221 | 208 | int big,sx,sy,flipx,flipy; |
| 222 | 209 | |
| 223 | | if (((spriteram[offs+1] & 0x30) >> 4) == priority) |
| 210 | if (((m_spriteram[offs+1] & 0x30) >> 4) == priority) |
| 224 | 211 | { |
| 225 | 212 | if (m_is_senjyo) /* Senjyo */ |
| 226 | | big = (spriteram[offs] & 0x80); |
| 213 | big = (m_spriteram[offs] & 0x80); |
| 227 | 214 | else /* Star Force */ |
| 228 | | big = ((spriteram[offs] & 0xc0) == 0xc0); |
| 229 | | sx = spriteram[offs+3]; |
| 215 | big = ((m_spriteram[offs] & 0xc0) == 0xc0); |
| 216 | sx = m_spriteram[offs+3]; |
| 230 | 217 | if (big) |
| 231 | | sy = 224-spriteram[offs+2]; |
| 218 | sy = 224-m_spriteram[offs+2]; |
| 232 | 219 | else |
| 233 | | sy = 240-spriteram[offs+2]; |
| 234 | | flipx = spriteram[offs+1] & 0x40; |
| 235 | | flipy = spriteram[offs+1] & 0x80; |
| 220 | sy = 240-m_spriteram[offs+2]; |
| 221 | flipx = m_spriteram[offs+1] & 0x40; |
| 222 | flipy = m_spriteram[offs+1] & 0x80; |
| 236 | 223 | |
| 237 | 224 | if (flip_screen()) |
| 238 | 225 | { |
| r242725 | r242726 | |
| 253 | 240 | |
| 254 | 241 | |
| 255 | 242 | m_gfxdecode->gfx(big ? 5 : 4)->transpen(bitmap,cliprect, |
| 256 | | spriteram[offs], |
| 257 | | spriteram[offs + 1] & 0x07, |
| 243 | m_spriteram[offs], |
| 244 | m_spriteram[offs + 1] & 0x07, |
| 258 | 245 | flipx,flipy, |
| 259 | 246 | sx,sy,0); |
| 260 | 247 | } |
| 261 | 248 | } |
| 262 | 249 | } |
| 263 | 250 | |
| 264 | | UINT32 senjyo_state::screen_update_senjyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 251 | UINT32 senjyo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 265 | 252 | { |
| 266 | | int i; |
| 267 | | |
| 268 | | |
| 269 | 253 | /* two colors for the radar dots (verified on the real board) */ |
| 270 | 254 | m_palette->set_pen_color(512,rgb_t(0xff,0x00,0x00)); /* red for enemies */ |
| 271 | 255 | m_palette->set_pen_color(513,rgb_t(0xff,0xff,0x00)); /* yellow for player */ |
| 272 | 256 | |
| 273 | 257 | { |
| 274 | 258 | int flip = flip_screen(); |
| 275 | | int scrollx,scrolly; |
| 276 | 259 | |
| 277 | | for (i = 0;i < 32;i++) |
| 260 | for (int i = 0;i < 32;i++) |
| 278 | 261 | m_fg_tilemap->set_scrolly(i, m_fgscroll[i]); |
| 279 | 262 | |
| 280 | | scrollx = m_scrollx1[0]; |
| 281 | | scrolly = m_scrolly1[0] + 256 * m_scrolly1[1]; |
| 263 | int scrollx = m_scrollx1[0]; |
| 264 | int scrolly = m_scrolly1[0] + 256 * m_scrolly1[1]; |
| 282 | 265 | if (flip) |
| 283 | 266 | scrollx = -scrollx; |
| 284 | 267 | m_bg1_tilemap->set_scrollx(0, scrollx); |