trunk/src/mame/drivers/aquarium.c
| r30659 | r30660 | |
| 105 | 105 | AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(aquarium_mid_videoram_w) AM_SHARE("mid_videoram") |
| 106 | 106 | AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(aquarium_bak_videoram_w) AM_SHARE("bak_videoram") |
| 107 | 107 | AM_RANGE(0xc02000, 0xc03fff) AM_RAM_WRITE(aquarium_txt_videoram_w) AM_SHARE("txt_videoram") |
| 108 | | AM_RANGE(0xc80000, 0xc81fff) AM_RAM AM_SHARE("spriteram") |
| 108 | AM_RANGE(0xc80000, 0xc81fff) AM_DEVREADWRITE8("spritegen", excellent_spr_device, read, write, 0x00ff) |
| 109 | 109 | AM_RANGE(0xd00000, 0xd00fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 110 | 110 | AM_RANGE(0xd80014, 0xd8001f) AM_WRITEONLY AM_SHARE("scroll") |
| 111 | 111 | AM_RANGE(0xd80068, 0xd80069) AM_WRITENOP /* probably not used */ |
| r30659 | r30660 | |
| 320 | 320 | MCFG_PALETTE_ADD("palette", 0x1000/2) |
| 321 | 321 | MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx) |
| 322 | 322 | |
| 323 | MCFG_DEVICE_ADD("spritegen", EXCELLENT_SPRITE, 0) |
| 324 | |
| 323 | 325 | /* sound hardware */ |
| 324 | 326 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 325 | 327 | |
trunk/src/mame/drivers/gcpinbal.c
| r30659 | r30660 | |
| 32 | 32 | |
| 33 | 33 | - Reset the game while pressing START1 to enter the "test mode" |
| 34 | 34 | |
| 35 | | |
| 35 | |
| 36 | 36 | ***************************************************************************/ |
| 37 | 37 | |
| 38 | 38 | #include "emu.h" |
| r30659 | r30660 | |
| 235 | 235 | static ADDRESS_MAP_START( gcpinbal_map, AS_PROGRAM, 16, gcpinbal_state ) |
| 236 | 236 | AM_RANGE(0x000000, 0x1fffff) AM_ROM |
| 237 | 237 | AM_RANGE(0xc00000, 0xc03fff) AM_READWRITE(gcpinbal_tilemaps_word_r, gcpinbal_tilemaps_word_w) AM_SHARE("tilemapram") |
| 238 | | AM_RANGE(0xc80000, 0xc80fff) AM_RAM AM_SHARE("spriteram") /* sprite ram */ |
| 238 | AM_RANGE(0xc80000, 0xc81fff) AM_DEVREADWRITE8("spritegen", excellent_spr_device, read, write, 0x00ff) |
| 239 | 239 | AM_RANGE(0xd00000, 0xd00fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 240 | 240 | AM_RANGE(0xd80000, 0xd800ff) AM_READWRITE(ioc_r, ioc_w) AM_SHARE("ioc_ram") |
| 241 | 241 | AM_RANGE(0xff0000, 0xffffff) AM_RAM /* RAM */ |
| r30659 | r30660 | |
| 442 | 442 | MCFG_PALETTE_ADD("palette", 4096) |
| 443 | 443 | MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx) |
| 444 | 444 | |
| 445 | MCFG_DEVICE_ADD("spritegen", EXCELLENT_SPRITE, 0) |
| 446 | |
| 445 | 447 | /* sound hardware */ |
| 446 | 448 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 447 | 449 | |
trunk/src/mame/includes/aquarium.h
| r30659 | r30660 | |
| 1 | 1 | #include "sound/okim6295.h" |
| 2 | #include "video/excellent_spr.h" |
| 2 | 3 | |
| 3 | | |
| 4 | 4 | class aquarium_state : public driver_device |
| 5 | 5 | { |
| 6 | 6 | public: |
| r30659 | r30660 | |
| 9 | 9 | m_mid_videoram(*this, "mid_videoram"), |
| 10 | 10 | m_bak_videoram(*this, "bak_videoram"), |
| 11 | 11 | m_txt_videoram(*this, "txt_videoram"), |
| 12 | | m_spriteram(*this, "spriteram"), |
| 13 | 12 | m_scroll(*this, "scroll"), |
| 14 | 13 | m_audiocpu(*this, "audiocpu"), |
| 15 | 14 | m_maincpu(*this, "maincpu"), |
| 16 | 15 | m_oki(*this, "oki"), |
| 17 | 16 | m_gfxdecode(*this, "gfxdecode"), |
| 18 | | m_palette(*this, "palette") { } |
| 17 | m_palette(*this, "palette"), |
| 18 | m_sprgen(*this, "spritegen"){ } |
| 19 | 19 | |
| 20 | 20 | /* memory pointers */ |
| 21 | 21 | required_shared_ptr<UINT16> m_mid_videoram; |
| 22 | 22 | required_shared_ptr<UINT16> m_bak_videoram; |
| 23 | 23 | required_shared_ptr<UINT16> m_txt_videoram; |
| 24 | | required_shared_ptr<UINT16> m_spriteram; |
| 25 | 24 | required_shared_ptr<UINT16> m_scroll; |
| 26 | 25 | // UINT16 * m_paletteram; // currently this uses generic palette handling |
| 27 | 26 | |
| r30659 | r30660 | |
| 58 | 57 | required_device<okim6295_device> m_oki; |
| 59 | 58 | required_device<gfxdecode_device> m_gfxdecode; |
| 60 | 59 | required_device<palette_device> m_palette; |
| 60 | required_device<excellent_spr_device> m_sprgen; |
| 61 | |
| 61 | 62 | }; |
trunk/src/mame/includes/gcpinbal.h
| r30659 | r30660 | |
| 1 | 1 | |
| 2 | 2 | #include "sound/okim6295.h" |
| 3 | 3 | #include "sound/msm5205.h" |
| 4 | #include "video/excellent_spr.h" |
| 4 | 5 | |
| 5 | 6 | class gcpinbal_state : public driver_device |
| 6 | 7 | { |
| r30659 | r30660 | |
| 17 | 18 | m_oki(*this, "oki"), |
| 18 | 19 | m_msm(*this, "msm"), |
| 19 | 20 | m_tilemapram(*this, "tilemapram"), |
| 20 | | m_spriteram(*this, "spriteram"), |
| 21 | 21 | m_ioc_ram(*this, "ioc_ram"), |
| 22 | 22 | m_gfxdecode(*this, "gfxdecode"), |
| 23 | | m_palette(*this, "palette") |
| 23 | m_palette(*this, "palette"), |
| 24 | m_sprgen(*this, "spritegen") |
| 24 | 25 | { } |
| 25 | 26 | |
| 26 | 27 | /* devices */ |
| r30659 | r30660 | |
| 30 | 31 | |
| 31 | 32 | /* memory pointers */ |
| 32 | 33 | required_shared_ptr<UINT16> m_tilemapram; |
| 33 | | required_shared_ptr<UINT16> m_spriteram; |
| 34 | 34 | required_shared_ptr<UINT16> m_ioc_ram; |
| 35 | 35 | |
| 36 | 36 | required_device<gfxdecode_device> m_gfxdecode; |
| r30659 | r30660 | |
| 74 | 74 | void gcpinbal_core_vh_start( ); |
| 75 | 75 | void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ); |
| 76 | 76 | DECLARE_WRITE_LINE_MEMBER(gcp_adpcm_int); |
| 77 | required_device<excellent_spr_device> m_sprgen; |
| 77 | 78 | |
| 78 | 79 | protected: |
| 79 | 80 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
trunk/src/mame/video/excellent_spr.c
| r0 | r30660 | |
| 1 | /* |
| 2 | Excellent Systems Sprite chip |
| 3 | |
| 4 | is this original hw or a clone of something? |
| 5 | |
| 6 | possible chips: |
| 7 | ES 9207 & ES 9303 are near the sprite ROM (aquarium) |
| 8 | ES 9208 is near the tilemap ROM so probably not the sprite chip |
| 9 | |
| 10 | |
| 11 | todo: collapse to single draw function instead of one for each game |
| 12 | |
| 13 | */ |
| 14 | |
| 15 | |
| 16 | #include "emu.h" |
| 17 | #include "excellent_spr.h" |
| 18 | |
| 19 | |
| 20 | const device_type EXCELLENT_SPRITE = &device_creator<excellent_spr_device>; |
| 21 | |
| 22 | excellent_spr_device::excellent_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 23 | : device_t(mconfig, EXCELLENT_SPRITE, "Excllent 8-bit Sprite", tag, owner, clock, "excellent_spr", __FILE__), |
| 24 | device_video_interface(mconfig, *this) |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | |
| 29 | void excellent_spr_device::device_start() |
| 30 | { |
| 31 | m_ram = auto_alloc_array_clear(this->machine(), UINT8, 0x1000); |
| 32 | } |
| 33 | |
| 34 | |
| 35 | READ8_MEMBER(excellent_spr_device::read) |
| 36 | { |
| 37 | return m_ram[offset]; |
| 38 | } |
| 39 | |
| 40 | WRITE8_MEMBER(excellent_spr_device::write) |
| 41 | { |
| 42 | m_ram[offset] = data; |
| 43 | } |
| 44 | |
| 45 | void excellent_spr_device::device_reset() |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | |
| 50 | /**************************************************************** |
| 51 | SPRITE DRAW ROUTINE |
| 52 | (8-bit) |
| 53 | |
| 54 | Word | Bit(s) | Use |
| 55 | -----+-----------------+----------------- |
| 56 | 0 | xxxxxxxx| X lo |
| 57 | 1 | xxxxxxxx| X hi |
| 58 | 2 | xxxxxxxx| Y lo |
| 59 | 3 | xxxxxxxx| Y hi |
| 60 | 4 | x.......| Disable |
| 61 | 4 | ...x....| Flip Y |
| 62 | 4 | ....x...| 1 = Y chain, 0 = X chain |
| 63 | 4 | .....xxx| Chain size |
| 64 | 5 | ??xxxxxx| Tile (low) |
| 65 | 6 | xxxxxxxx| Tile (high) |
| 66 | 7 | ....xxxx| Color Bank |
| 67 | |
| 68 | ****************************************************************/ |
| 69 | |
| 70 | |
| 71 | void excellent_spr_device::aquarium_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs ) |
| 72 | { |
| 73 | |
| 74 | int offs, chain_pos; |
| 75 | int x, y, curx, cury; |
| 76 | UINT8 col, flipx, flipy, chain; |
| 77 | UINT16 code; |
| 78 | |
| 79 | for (offs = 0; offs < 0x1000; offs += 8) |
| 80 | { |
| 81 | code = ((m_ram[offs + 5]) & 0xff) + (((m_ram[offs + 6]) & 0xff) << 8); |
| 82 | code &= 0x3fff; |
| 83 | |
| 84 | if (!(m_ram[offs + 4] &0x80)) /* active sprite ? */ |
| 85 | { |
| 86 | x = ((m_ram[offs + 0]) &0xff) + (((m_ram[offs + 1]) & 0xff) << 8); |
| 87 | y = ((m_ram[offs + 2]) &0xff) + (((m_ram[offs + 3]) & 0xff) << 8); |
| 88 | |
| 89 | /* Treat coords as signed */ |
| 90 | if (x & 0x8000) x -= 0x10000; |
| 91 | if (y & 0x8000) y -= 0x10000; |
| 92 | |
| 93 | col = ((m_ram[offs + 7]) & 0x0f); |
| 94 | chain = (m_ram[offs + 4]) & 0x07; |
| 95 | flipy = (m_ram[offs + 4]) & 0x10; |
| 96 | flipx = (m_ram[offs + 4]) & 0x20; |
| 97 | |
| 98 | curx = x; |
| 99 | cury = y; |
| 100 | |
| 101 | if (((m_ram[offs + 4]) & 0x08) && flipy) |
| 102 | cury += (chain * 16); |
| 103 | |
| 104 | if (!(((m_ram[offs + 4]) & 0x08)) && flipx) |
| 105 | curx += (chain * 16); |
| 106 | |
| 107 | |
| 108 | for (chain_pos = chain; chain_pos >= 0; chain_pos--) |
| 109 | { |
| 110 | gfxdecode->gfx(0)->transpen(bitmap,cliprect, |
| 111 | code, |
| 112 | col, |
| 113 | flipx, flipy, |
| 114 | curx,cury,0); |
| 115 | |
| 116 | /* wrap around y */ |
| 117 | gfxdecode->gfx(0)->transpen(bitmap,cliprect, |
| 118 | code, |
| 119 | col, |
| 120 | flipx, flipy, |
| 121 | curx,cury + 256,0); |
| 122 | |
| 123 | code++; |
| 124 | |
| 125 | if ((m_ram[offs + 4]) &0x08) /* Y chain */ |
| 126 | { |
| 127 | if (flipy) |
| 128 | cury -= 16; |
| 129 | else |
| 130 | cury += 16; |
| 131 | } |
| 132 | else /* X chain */ |
| 133 | { |
| 134 | if (flipx) |
| 135 | curx -= 16; |
| 136 | else |
| 137 | curx += 16; |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | #if 0 |
| 144 | if (rotate) |
| 145 | { |
| 146 | char buf[80]; |
| 147 | sprintf(buf, "sprite rotate offs %04x ?", rotate); |
| 148 | popmessage(buf); |
| 149 | } |
| 150 | #endif |
| 151 | } |
| 152 | |
| 153 | void excellent_spr_device::gcpinbal_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs, int priority ) |
| 154 | { |
| 155 | UINT8 *spriteram = m_ram; |
| 156 | int offs, chain_pos; |
| 157 | int x, y, curx, cury; |
| 158 | // int priority = 0; |
| 159 | UINT8 col, flipx, flipy, chain; |
| 160 | UINT16 code; |
| 161 | |
| 162 | |
| 163 | for (offs = 0x1000 - 8; offs >= 0; offs -= 8) |
| 164 | { |
| 165 | code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8); |
| 166 | code &= 0x3fff; |
| 167 | |
| 168 | if (!(spriteram[offs + 4] &0x80)) /* active sprite ? */ |
| 169 | { |
| 170 | x = ((spriteram[offs + 0]) & 0xff) + (((spriteram[offs + 1]) & 0xff) << 8); |
| 171 | y = ((spriteram[offs + 2]) & 0xff) + (((spriteram[offs + 3]) & 0xff) << 8); |
| 172 | |
| 173 | /* Treat coords as signed */ |
| 174 | if (x & 0x8000) x -= 0x10000; |
| 175 | if (y & 0x8000) y -= 0x10000; |
| 176 | |
| 177 | col = ((spriteram[offs + 7]) & 0x0f) | 0x60; |
| 178 | chain = (spriteram[offs + 4]) & 0x07; |
| 179 | flipy = (spriteram[offs + 4]) & 0x10; |
| 180 | flipx = 0; |
| 181 | |
| 182 | curx = x; |
| 183 | cury = y; |
| 184 | |
| 185 | if (((spriteram[offs + 4]) & 0x08) && flipy) |
| 186 | cury += (chain * 16); |
| 187 | |
| 188 | for (chain_pos = chain; chain_pos >= 0; chain_pos--) |
| 189 | { |
| 190 | gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect, |
| 191 | code, |
| 192 | col, |
| 193 | flipx, flipy, |
| 194 | curx,cury, |
| 195 | screen.priority(), |
| 196 | priority ? 0xfc : 0xf0,0); |
| 197 | |
| 198 | code++; |
| 199 | |
| 200 | if ((spriteram[offs + 4]) & 0x08) /* Y chain */ |
| 201 | { |
| 202 | if (flipy) cury -= 16; |
| 203 | else cury += 16; |
| 204 | } |
| 205 | else /* X chain */ |
| 206 | { |
| 207 | curx += 16; |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | #if 0 |
| 213 | if (rotate) |
| 214 | { |
| 215 | char buf[80]; |
| 216 | sprintf(buf, "sprite rotate offs %04x ?", rotate); |
| 217 | popmessage(buf); |
| 218 | } |
| 219 | #endif |
| 220 | } |
| 221 | |
trunk/src/mame/video/excellent_spr.h
| r0 | r30660 | |
| 1 | |
| 2 | class excellent_spr_device : public device_t, |
| 3 | public device_video_interface |
| 4 | { |
| 5 | public: |
| 6 | excellent_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 7 | |
| 8 | void draw_sprites(screen_device &screen, gfxdecode_device *gfxdecode, const rectangle &cliprect); |
| 9 | |
| 10 | DECLARE_READ8_MEMBER(read); |
| 11 | DECLARE_WRITE8_MEMBER(write); |
| 12 | |
| 13 | void aquarium_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs); |
| 14 | void gcpinbal_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs, int priority); |
| 15 | |
| 16 | protected: |
| 17 | UINT8* m_ram; |
| 18 | |
| 19 | virtual void device_start(); |
| 20 | virtual void device_reset(); |
| 21 | private: |
| 22 | }; |
| 23 | |
| 24 | extern const device_type EXCELLENT_SPRITE; |
| 25 | |
| 26 | |
trunk/src/mame/video/aquarium.c
| r30659 | r30660 | |
| 3 | 3 | #include "emu.h" |
| 4 | 4 | #include "includes/aquarium.h" |
| 5 | 5 | |
| 6 | | /* gcpinbal.c modified */ |
| 7 | | void aquarium_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) |
| 8 | | { |
| 9 | | int offs, chain_pos; |
| 10 | | int x, y, curx, cury; |
| 11 | | UINT8 col, flipx, flipy, chain; |
| 12 | | UINT16 code; |
| 13 | 6 | |
| 14 | | for (offs = 0; offs < m_spriteram.bytes() / 2; offs += 8) |
| 15 | | { |
| 16 | | code = ((m_spriteram[offs + 5]) & 0xff) + (((m_spriteram[offs + 6]) & 0xff) << 8); |
| 17 | | code &= 0x3fff; |
| 18 | | |
| 19 | | if (!(m_spriteram[offs + 4] &0x80)) /* active sprite ? */ |
| 20 | | { |
| 21 | | x = ((m_spriteram[offs + 0]) &0xff) + (((m_spriteram[offs + 1]) & 0xff) << 8); |
| 22 | | y = ((m_spriteram[offs + 2]) &0xff) + (((m_spriteram[offs + 3]) & 0xff) << 8); |
| 23 | | |
| 24 | | /* Treat coords as signed */ |
| 25 | | if (x & 0x8000) x -= 0x10000; |
| 26 | | if (y & 0x8000) y -= 0x10000; |
| 27 | | |
| 28 | | col = ((m_spriteram[offs + 7]) & 0x0f); |
| 29 | | chain = (m_spriteram[offs + 4]) & 0x07; |
| 30 | | flipy = (m_spriteram[offs + 4]) & 0x10; |
| 31 | | flipx = (m_spriteram[offs + 4]) & 0x20; |
| 32 | | |
| 33 | | curx = x; |
| 34 | | cury = y; |
| 35 | | |
| 36 | | if (((m_spriteram[offs + 4]) & 0x08) && flipy) |
| 37 | | cury += (chain * 16); |
| 38 | | |
| 39 | | if (!(((m_spriteram[offs + 4]) & 0x08)) && flipx) |
| 40 | | curx += (chain * 16); |
| 41 | | |
| 42 | | |
| 43 | | for (chain_pos = chain; chain_pos >= 0; chain_pos--) |
| 44 | | { |
| 45 | | m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, |
| 46 | | code, |
| 47 | | col, |
| 48 | | flipx, flipy, |
| 49 | | curx,cury,0); |
| 50 | | |
| 51 | | /* wrap around y */ |
| 52 | | m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, |
| 53 | | code, |
| 54 | | col, |
| 55 | | flipx, flipy, |
| 56 | | curx,cury + 256,0); |
| 57 | | |
| 58 | | code++; |
| 59 | | |
| 60 | | if ((m_spriteram[offs + 4]) &0x08) /* Y chain */ |
| 61 | | { |
| 62 | | if (flipy) |
| 63 | | cury -= 16; |
| 64 | | else |
| 65 | | cury += 16; |
| 66 | | } |
| 67 | | else /* X chain */ |
| 68 | | { |
| 69 | | if (flipx) |
| 70 | | curx -= 16; |
| 71 | | else |
| 72 | | curx += 16; |
| 73 | | } |
| 74 | | } |
| 75 | | } |
| 76 | | } |
| 77 | | #if 0 |
| 78 | | if (rotate) |
| 79 | | { |
| 80 | | char buf[80]; |
| 81 | | sprintf(buf, "sprite rotate offs %04x ?", rotate); |
| 82 | | popmessage(buf); |
| 83 | | } |
| 84 | | #endif |
| 85 | | } |
| 86 | | |
| 87 | 7 | /* TXT Layer */ |
| 88 | 8 | TILE_GET_INFO_MEMBER(aquarium_state::get_aquarium_txt_tile_info) |
| 89 | 9 | { |
| r30659 | r30660 | |
| 162 | 82 | m_bak_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 163 | 83 | m_mid_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 164 | 84 | |
| 165 | | draw_sprites(bitmap, cliprect, 16); |
| 85 | m_sprgen->aquarium_draw_sprites(bitmap, cliprect, m_gfxdecode, 16); |
| 166 | 86 | |
| 167 | 87 | m_bak_tilemap->draw(screen, bitmap, cliprect, 1, 0); |
| 168 | 88 | m_mid_tilemap->draw(screen, bitmap, cliprect, 1, 0); |
trunk/src/mame/video/gcpinbal.c
| r30659 | r30660 | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | | #ifdef UNUSED_FUNCTION |
| 91 | 90 | |
| 92 | | READ16_MEMBER(gcpinbal_state::gcpinbal_ctrl_word_r) |
| 93 | | { |
| 94 | | // ***** NOT HOOKED UP ***** |
| 95 | | |
| 96 | | return gcpinbal_piv_ctrlram[offset]; |
| 97 | | } |
| 98 | | |
| 99 | | |
| 100 | | WRITE16_MEMBER(gcpinbal_state::gcpinbal_ctrl_word_w) |
| 101 | | { |
| 102 | | // ***** NOT HOOKED UP ***** |
| 103 | | |
| 104 | | COMBINE_DATA(&gcpinbal_piv_ctrlram[offset]); |
| 105 | | data = gcpinbal_piv_ctrlram[offset]; |
| 106 | | |
| 107 | | switch (offset) |
| 108 | | { |
| 109 | | case 0x00: |
| 110 | | gcpinbal_scrollx[0] = -data; |
| 111 | | break; |
| 112 | | |
| 113 | | case 0x01: |
| 114 | | gcpinbal_scrollx[1] = -data; |
| 115 | | break; |
| 116 | | |
| 117 | | case 0x02: |
| 118 | | gcpinbal_scrollx[2] = -data; |
| 119 | | break; |
| 120 | | |
| 121 | | case 0x03: |
| 122 | | gcpinbal_scrolly[0] = data; |
| 123 | | break; |
| 124 | | |
| 125 | | case 0x04: |
| 126 | | gcpinbal_scrolly[1] = data; |
| 127 | | break; |
| 128 | | |
| 129 | | case 0x05: |
| 130 | | gcpinbal_scrolly[2] = data; |
| 131 | | break; |
| 132 | | |
| 133 | | case 0x06: |
| 134 | | gcpinbal_ctrl_reg = data; |
| 135 | | break; |
| 136 | | } |
| 137 | | } |
| 138 | | |
| 139 | | #endif |
| 140 | | |
| 141 | | |
| 142 | | /**************************************************************** |
| 143 | | SPRITE DRAW ROUTINE |
| 144 | | |
| 145 | | Word | Bit(s) | Use |
| 146 | | -----+-----------------+----------------- |
| 147 | | 0 |........ xxxxxxxx| X lo |
| 148 | | 1 |........ xxxxxxxx| X hi |
| 149 | | 2 |........ xxxxxxxx| Y lo |
| 150 | | 3 |........ xxxxxxxx| Y hi |
| 151 | | 4 |........ x.......| Disable |
| 152 | | 4 |........ ...x....| Flip Y |
| 153 | | 4 |........ ....x...| 1 = Y chain, 0 = X chain |
| 154 | | 4 |........ .....xxx| Chain size |
| 155 | | 5 |........ ??xxxxxx| Tile (low) |
| 156 | | 6 |........ xxxxxxxx| Tile (high) |
| 157 | | 7 |........ ....xxxx| Color Bank |
| 158 | | |
| 159 | | Modified table from Raine |
| 160 | | |
| 161 | | ****************************************************************/ |
| 162 | | |
| 163 | | void gcpinbal_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) |
| 164 | | { |
| 165 | | UINT16 *spriteram = m_spriteram; |
| 166 | | int offs, chain_pos; |
| 167 | | int x, y, curx, cury; |
| 168 | | int priority = 0; |
| 169 | | UINT8 col, flipx, flipy, chain; |
| 170 | | UINT16 code; |
| 171 | | |
| 172 | | /* According to Raine, word in ioc_ram determines sprite/tile priority... */ |
| 173 | | priority = (m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1; |
| 174 | | |
| 175 | | for (offs = m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8) |
| 176 | | { |
| 177 | | code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8); |
| 178 | | code &= 0x3fff; |
| 179 | | |
| 180 | | if (!(spriteram[offs + 4] &0x80)) /* active sprite ? */ |
| 181 | | { |
| 182 | | x = ((spriteram[offs + 0]) & 0xff) + (((spriteram[offs + 1]) & 0xff) << 8); |
| 183 | | y = ((spriteram[offs + 2]) & 0xff) + (((spriteram[offs + 3]) & 0xff) << 8); |
| 184 | | |
| 185 | | /* Treat coords as signed */ |
| 186 | | if (x & 0x8000) x -= 0x10000; |
| 187 | | if (y & 0x8000) y -= 0x10000; |
| 188 | | |
| 189 | | col = ((spriteram[offs + 7]) & 0x0f) | 0x60; |
| 190 | | chain = (spriteram[offs + 4]) & 0x07; |
| 191 | | flipy = (spriteram[offs + 4]) & 0x10; |
| 192 | | flipx = 0; |
| 193 | | |
| 194 | | curx = x; |
| 195 | | cury = y; |
| 196 | | |
| 197 | | if (((spriteram[offs + 4]) & 0x08) && flipy) |
| 198 | | cury += (chain * 16); |
| 199 | | |
| 200 | | for (chain_pos = chain; chain_pos >= 0; chain_pos--) |
| 201 | | { |
| 202 | | m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect, |
| 203 | | code, |
| 204 | | col, |
| 205 | | flipx, flipy, |
| 206 | | curx,cury, |
| 207 | | screen.priority(), |
| 208 | | priority ? 0xfc : 0xf0,0); |
| 209 | | |
| 210 | | code++; |
| 211 | | |
| 212 | | if ((spriteram[offs + 4]) & 0x08) /* Y chain */ |
| 213 | | { |
| 214 | | if (flipy) cury -= 16; |
| 215 | | else cury += 16; |
| 216 | | } |
| 217 | | else /* X chain */ |
| 218 | | { |
| 219 | | curx += 16; |
| 220 | | } |
| 221 | | } |
| 222 | | } |
| 223 | | } |
| 224 | | #if 0 |
| 225 | | if (rotate) |
| 226 | | { |
| 227 | | char buf[80]; |
| 228 | | sprintf(buf, "sprite rotate offs %04x ?", rotate); |
| 229 | | popmessage(buf); |
| 230 | | } |
| 231 | | #endif |
| 232 | | } |
| 233 | | |
| 234 | | |
| 235 | | |
| 236 | | |
| 237 | 91 | /************************************************************** |
| 238 | 92 | SCREEN REFRESH |
| 239 | 93 | **************************************************************/ |
| r30659 | r30660 | |
| 304 | 158 | #endif |
| 305 | 159 | m_tilemap[layer[2]]->draw(screen, bitmap, cliprect, 0, 4); |
| 306 | 160 | |
| 161 | int sprpri = (m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1; |
| 162 | m_sprgen->gcpinbal_draw_sprites(screen, bitmap, cliprect, m_gfxdecode, 16, sprpri); |
| 307 | 163 | |
| 308 | | draw_sprites(screen, bitmap, cliprect, 16); |
| 309 | | |
| 310 | 164 | #if 0 |
| 311 | 165 | { |
| 312 | 166 | // char buf[80]; |