trunk/src/mame/drivers/gstriker.c
| r30960 | r30961 | |
| 28 | 28 | Tilemap scrolling/rotation/zooming or whatever effect it needs |
| 29 | 29 | Priorities are wrong. I suspect they need sprite orthogonality |
| 30 | 30 | Missing mixer registers (mainly layer enable/disable) |
| 31 | | Merge with other Video System games ? |
| 32 | 31 | |
| 33 | 32 | ******************************************************************************/ |
| 34 | 33 | |
| r30960 | r30961 | |
| 273 | 272 | |
| 274 | 273 | static ADDRESS_MAP_START( gstriker_map, AS_PROGRAM, 16, gstriker_state ) |
| 275 | 274 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 276 | | AM_RANGE(0x100000, 0x103fff) AM_RAM_WRITE(MB60553_0_vram_w) AM_SHARE("mb60553_vram") |
| 277 | | AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_vram") |
| 278 | | AM_RANGE(0x180000, 0x180fff) AM_RAM_WRITE(VS920A_0_vram_w) AM_SHARE("vs920a_vram") |
| 279 | | AM_RANGE(0x181000, 0x181fff) AM_RAM AM_SHARE("lineram") |
| 275 | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device, vram_r, vram_w ) |
| 276 | AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_m_vram") |
| 277 | AM_RANGE(0x180000, 0x180fff) AM_DEVREADWRITE("texttilemap", vs920a_text_tilemap_device, vram_r, vram_w ) |
| 278 | AM_RANGE(0x181000, 0x181fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device, line_r, line_w ) |
| 280 | 279 | AM_RANGE(0x1c0000, 0x1c0fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 281 | 280 | |
| 282 | | AM_RANGE(0x200000, 0x20000f) AM_RAM_WRITE(MB60553_0_regs_w) |
| 281 | AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device, regs_r, regs_w ) |
| 283 | 282 | AM_RANGE(0x200040, 0x20005f) AM_RAM |
| 284 | 283 | AM_RANGE(0x200060, 0x20007f) AM_RAM |
| 285 | 284 | AM_RANGE(0x200080, 0x200081) AM_READ_PORT("P1") |
| r30960 | r30961 | |
| 310 | 309 | |
| 311 | 310 | static ADDRESS_MAP_START( vgoal_map, AS_PROGRAM, 16, gstriker_state ) |
| 312 | 311 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 313 | | AM_RANGE(0x100000, 0x103fff) AM_RAM_WRITE(MB60553_0_vram_w) AM_SHARE("mb60553_vram") |
| 314 | | AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_vram") |
| 315 | | AM_RANGE(0x180000, 0x180fff) AM_RAM_WRITE(VS920A_0_vram_w) AM_SHARE("vs920a_vram") |
| 316 | | AM_RANGE(0x181000, 0x181fff) AM_RAM AM_SHARE("lineram") |
| 312 | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device, vram_r, vram_w ) |
| 313 | AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_m_vram") |
| 314 | AM_RANGE(0x180000, 0x180fff) AM_DEVREADWRITE("texttilemap", vs920a_text_tilemap_device, vram_r, vram_w ) |
| 315 | AM_RANGE(0x181000, 0x181fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device, line_r, line_w ) |
| 317 | 316 | AM_RANGE(0x1c0000, 0x1c4fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 318 | | AM_RANGE(0x200000, 0x20000f) AM_RAM_WRITE(MB60553_0_regs_w) |
| 317 | AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device, regs_r, regs_w ) |
| 319 | 318 | AM_RANGE(0x200040, 0x20005f) AM_RAM |
| 320 | 319 | |
| 321 | 320 | AM_RANGE(0x200080, 0x200081) AM_READ_PORT("P1") |
| r30960 | r30961 | |
| 556 | 555 | MCFG_PALETTE_ADD("palette", 0x800) |
| 557 | 556 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 558 | 557 | |
| 558 | |
| 559 | MCFG_DEVICE_ADD("zoomtilemap", MB60553, 0) |
| 560 | MCFG_MB60553_GFXDECODE("gfxdecode") |
| 561 | |
| 562 | MCFG_DEVICE_ADD("texttilemap", VS920A, 0) |
| 563 | MCFG_VS920A_GFXDECODE("gfxdecode") |
| 564 | |
| 565 | |
| 559 | 566 | MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0) |
| 560 | 567 | MCFG_VSYSTEM_SPR_SET_GFXREGION(2) |
| 561 | 568 | MCFG_VSYSTEM_SPR_SET_PALBASE(0x10) |
| r30960 | r30961 | |
| 607 | 614 | MCFG_PALETTE_ADD("palette", 0x2000) |
| 608 | 615 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 609 | 616 | |
| 617 | MCFG_DEVICE_ADD("zoomtilemap", MB60553, 0) |
| 618 | MCFG_MB60553_GFXDECODE("gfxdecode") |
| 619 | |
| 620 | MCFG_DEVICE_ADD("texttilemap", VS920A, 0) |
| 621 | MCFG_VS920A_GFXDECODE("gfxdecode") |
| 622 | |
| 610 | 623 | MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0) |
| 611 | 624 | MCFG_VSYSTEM_SPR_SET_GFXREGION(2) |
| 612 | 625 | MCFG_VSYSTEM_SPR_SET_PALBASE(0x00) |
| r30960 | r30961 | |
| 783 | 796 | ROM_LOAD( "vgoalc16.u17", 0x000000, 0x200000, CRC(2b211fb2) SHA1(4e04e099a1dae7abdb0732808a5d74fdc7afcf45) ) // same content, dif pos on board |
| 784 | 797 | |
| 785 | 798 | ROM_REGION( 0x400000, "gfx3", 0 ) |
| 786 | | ROM_LOAD( "vgoalc16.u11", 0x000000, 0x200000, CRC(5bc3146c) SHA1(ede4def1ddc4390fed8fd89643900967faff3640) ) |
| 799 | //ROM_LOAD( "vgoalc16.u11", 0x000000, 0x200000, CRC(5bc3146c) SHA1(ede4def1ddc4390fed8fd89643900967faff3640) ) // this is just a bad dump, are the above roms too? |
| 800 | ROM_LOAD( "c13_u11.u11", 0x000000, 0x200000, CRC(76d09f27) SHA1(ffef83954426f9e56bbe2d98b32cea675c063fab) ) |
| 787 | 801 | ROM_LOAD( "c13_u12.u12", 0x200000, 0x200000, CRC(a3874419) SHA1(c9fa283106ada3419e311f400fcf4251b32318c4) ) |
| 788 | 802 | |
| 789 | 803 | ROM_REGION( 0x40000, "ymsnd.deltat", 0 ) |
trunk/src/mame/includes/gstriker.h
| r30960 | r30961 | |
| 2 | 2 | #define __GSTRIKER_H |
| 3 | 3 | |
| 4 | 4 | #include "video/vsystem_spr.h" |
| 5 | #include "video/mb60553.h" |
| 6 | #include "video/vs920a.h" |
| 5 | 7 | |
| 6 | | /*** VS920A **********************************************/ |
| 7 | 8 | |
| 8 | | #define MAX_VS920A 2 |
| 9 | 9 | |
| 10 | | struct sVS920A |
| 11 | | { |
| 12 | | tilemap_t* tmap; |
| 13 | | UINT16* vram; |
| 14 | | UINT16 pal_base; |
| 15 | | UINT8 gfx_region; |
| 16 | | |
| 17 | | }; |
| 18 | | |
| 19 | | /*** MB60553 **********************************************/ |
| 20 | | |
| 21 | | #define MAX_MB60553 2 |
| 22 | | |
| 23 | | struct tMB60553 |
| 24 | | { |
| 25 | | tilemap_t* tmap; |
| 26 | | UINT16* vram; |
| 27 | | UINT16 regs[8]; |
| 28 | | UINT8 bank[8]; |
| 29 | | UINT16 pal_base; |
| 30 | | UINT8 gfx_region; |
| 31 | | |
| 32 | | }; |
| 33 | | |
| 34 | | |
| 35 | | |
| 36 | 10 | class gstriker_state : public driver_device |
| 37 | 11 | { |
| 38 | 12 | public: |
| 39 | 13 | gstriker_state(const machine_config &mconfig, device_type type, const char *tag) |
| 40 | 14 | : driver_device(mconfig, type, tag), |
| 41 | | m_MB60553_vram(*this, "mb60553_vram"), |
| 42 | | m_CG10103_vram(*this, "cg10103_vram"), |
| 43 | | m_VS920A_vram(*this, "vs920a_vram"), |
| 15 | m_CG10103_m_vram(*this, "cg10103_m_vram"), |
| 44 | 16 | m_work_ram(*this, "work_ram"), |
| 45 | | m_lineram(*this, "lineram"), |
| 46 | 17 | m_spr(*this, "vsystem_spr"), |
| 18 | m_bg(*this, "zoomtilemap"), |
| 19 | m_tx(*this, "texttilemap"), |
| 47 | 20 | m_maincpu(*this, "maincpu"), |
| 48 | 21 | m_audiocpu(*this, "audiocpu"), |
| 49 | 22 | m_gfxdecode(*this, "gfxdecode"), |
| r30960 | r30961 | |
| 52 | 25 | |
| 53 | 26 | virtual void machine_start() |
| 54 | 27 | { |
| 55 | | m_MB60553[0].vram = m_MB60553_vram; |
| 56 | | m_VS920A[0].vram = m_VS920A_vram; |
| 57 | 28 | } |
| 58 | 29 | |
| 59 | | required_shared_ptr<UINT16> m_MB60553_vram; |
| 60 | | required_shared_ptr<UINT16> m_CG10103_vram; |
| 61 | | required_shared_ptr<UINT16> m_VS920A_vram; |
| 30 | required_shared_ptr<UINT16> m_CG10103_m_vram; |
| 62 | 31 | required_shared_ptr<UINT16> m_work_ram; |
| 63 | | required_shared_ptr<UINT16> m_lineram; |
| 64 | 32 | required_device<vsystem_spr_device> m_spr; |
| 33 | required_device<mb60553_zooming_tilemap_device> m_bg; |
| 34 | required_device<vs920a_text_tilemap_device> m_tx; |
| 65 | 35 | |
| 66 | 36 | UINT16 m_dmmy_8f_ret; |
| 67 | 37 | int m_pending_command; |
| r30960 | r30961 | |
| 70 | 40 | UINT16 m_mcu_data; |
| 71 | 41 | UINT16 m_prot_reg[2]; |
| 72 | 42 | |
| 73 | | sVS920A m_VS920A[MAX_VS920A]; |
| 74 | | tMB60553 m_MB60553[MAX_MB60553]; |
| 75 | | sVS920A* m_VS920A_cur_chip; |
| 76 | | tMB60553 *m_MB60553_cur_chip; |
| 43 | |
| 77 | 44 | DECLARE_READ16_MEMBER(dmmy_8f); |
| 78 | 45 | DECLARE_WRITE16_MEMBER(sound_command_w); |
| 79 | 46 | DECLARE_READ16_MEMBER(pending_command_r); |
| r30960 | r30961 | |
| 85 | 52 | DECLARE_READ16_MEMBER(twrldc94_prot_reg_r); |
| 86 | 53 | DECLARE_READ16_MEMBER(vbl_toggle_r); |
| 87 | 54 | DECLARE_WRITE16_MEMBER(vbl_toggle_w); |
| 88 | | DECLARE_WRITE16_MEMBER(VS920A_0_vram_w); |
| 89 | | DECLARE_WRITE16_MEMBER(VS920A_1_vram_w); |
| 90 | | DECLARE_WRITE16_MEMBER(MB60553_0_regs_w); |
| 91 | | DECLARE_WRITE16_MEMBER(MB60553_1_regs_w); |
| 92 | | DECLARE_WRITE16_MEMBER(MB60553_0_vram_w); |
| 93 | | DECLARE_WRITE16_MEMBER(MB60553_1_vram_w); |
| 94 | | DECLARE_WRITE16_MEMBER(gsx_videoram3_w); |
| 95 | | void MB60553_reg_written(int numchip, int num_reg); |
| 55 | |
| 56 | |
| 96 | 57 | DECLARE_DRIVER_INIT(twrldc94a); |
| 97 | 58 | DECLARE_DRIVER_INIT(vgoalsoc); |
| 98 | 59 | DECLARE_DRIVER_INIT(twrldc94); |
| 99 | | TILE_GET_INFO_MEMBER(VS920A_get_tile_info); |
| 100 | | TILE_GET_INFO_MEMBER(MB60553_get_tile_info); |
| 101 | | TILEMAP_MAPPER_MEMBER(twc94_scan); |
| 102 | 60 | DECLARE_VIDEO_START(gstriker); |
| 103 | 61 | DECLARE_VIDEO_START(vgoalsoc); |
| 104 | 62 | DECLARE_VIDEO_START(twrldc94); |
| 105 | 63 | UINT32 screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 106 | | void VS920A_init(int numchips); |
| 107 | | tilemap_t* VS920A_get_tilemap(int numchip); |
| 108 | | void VS920A_set_pal_base(int numchip, int pal_base); |
| 109 | | void VS920A_set_gfx_region(int numchip, int gfx_region); |
| 110 | | void VS920A_draw(int numchip, screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority); |
| 111 | | void MB60553_init(int numchips); |
| 112 | | void MB60553_set_pal_base(int numchip, int pal_base); |
| 113 | | void MB60553_set_gfx_region(int numchip, int gfx_region); |
| 114 | | void MB60553_draw(int numchip, screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority); |
| 115 | | tilemap_t* MB60553_get_tilemap(int numchip); |
| 64 | |
| 65 | |
| 116 | 66 | void mcu_init( ); |
| 117 | 67 | DECLARE_WRITE_LINE_MEMBER(gs_ym2610_irq); |
| 118 | 68 | required_device<cpu_device> m_maincpu; |
trunk/src/mame/video/gstriker.c
| r30960 | r30961 | |
| 2 | 2 | #include "includes/gstriker.h" |
| 3 | 3 | |
| 4 | 4 | |
| 5 | | /*** VS920A (score tilemap) **********************************************/ |
| 6 | 5 | |
| 7 | | /* |
| 8 | | |
| 9 | | VS920A - (Very) Simple tilemap chip |
| 10 | | ----------------------------------- |
| 11 | | |
| 12 | | - 1 Plane |
| 13 | | - Tiles 8x8, 4bpp |
| 14 | | - Map 64x64 |
| 15 | | - No scrolling or other effects (at least in gstriker) |
| 16 | | |
| 17 | | |
| 18 | | Videoram format: |
| 19 | | ---------------- |
| 20 | | |
| 21 | | pppp tttt tttt tttt |
| 22 | | |
| 23 | | t=tile, p=palette |
| 24 | | |
| 25 | | */ |
| 26 | | |
| 27 | | |
| 28 | | TILE_GET_INFO_MEMBER(gstriker_state::VS920A_get_tile_info) |
| 29 | | { |
| 30 | | int data; |
| 31 | | int tileno, pal; |
| 32 | | |
| 33 | | data = m_VS920A_cur_chip->vram[tile_index]; |
| 34 | | |
| 35 | | tileno = data & 0xFFF; |
| 36 | | pal = (data >> 12) & 0xF; |
| 37 | | |
| 38 | | SET_TILE_INFO_MEMBER(m_VS920A_cur_chip->gfx_region, tileno, m_VS920A_cur_chip->pal_base + pal, 0); |
| 39 | | } |
| 40 | | |
| 41 | | WRITE16_MEMBER(gstriker_state::VS920A_0_vram_w) |
| 42 | | { |
| 43 | | COMBINE_DATA(&m_VS920A[0].vram[offset]); |
| 44 | | m_VS920A[0].tmap->mark_tile_dirty(offset); |
| 45 | | } |
| 46 | | |
| 47 | | WRITE16_MEMBER(gstriker_state::VS920A_1_vram_w) |
| 48 | | { |
| 49 | | COMBINE_DATA(&m_VS920A[1].vram[offset]); |
| 50 | | m_VS920A[1].tmap->mark_tile_dirty(offset); |
| 51 | | } |
| 52 | | |
| 53 | | void gstriker_state::VS920A_init(int numchips) |
| 54 | | { |
| 55 | | int i; |
| 56 | | |
| 57 | | if (numchips > MAX_VS920A) |
| 58 | | numchips = MAX_VS920A; |
| 59 | | |
| 60 | | for (i=0;i<numchips;i++) |
| 61 | | { |
| 62 | | m_VS920A[i].tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); |
| 63 | | |
| 64 | | m_VS920A[i].tmap->set_transparent_pen(0); |
| 65 | | } |
| 66 | | } |
| 67 | | |
| 68 | | tilemap_t* gstriker_state::VS920A_get_tilemap(int numchip) |
| 69 | | { |
| 70 | | return m_VS920A[numchip].tmap; |
| 71 | | } |
| 72 | | |
| 73 | | void gstriker_state::VS920A_set_pal_base(int numchip, int pal_base) |
| 74 | | { |
| 75 | | m_VS920A[numchip].pal_base = pal_base; |
| 76 | | } |
| 77 | | |
| 78 | | void gstriker_state::VS920A_set_gfx_region(int numchip, int gfx_region) |
| 79 | | { |
| 80 | | m_VS920A[numchip].gfx_region = gfx_region; |
| 81 | | } |
| 82 | | |
| 83 | | void gstriker_state::VS920A_draw(int numchip, screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority) |
| 84 | | { |
| 85 | | m_VS920A_cur_chip = &m_VS920A[numchip]; |
| 86 | | |
| 87 | | m_VS920A_cur_chip->tmap->draw(screen, bitmap, cliprect, 0, priority); |
| 88 | | } |
| 89 | | |
| 90 | | |
| 91 | | |
| 92 | | /*** Fujitsu MB60553 (screen tilemap) **********************************************/ |
| 93 | | |
| 94 | | /* |
| 95 | | |
| 96 | | Fujitsu MB60553 - Tilemap chip |
| 97 | | ------------------------------ |
| 98 | | |
| 99 | | - 1 Plane |
| 100 | | - Tiles 16x16, 4bpp |
| 101 | | - Map 64x64 |
| 102 | | - Scrolling |
| 103 | | - Indexed banking (8 banks) |
| 104 | | - Surely another effect like roz/tilezoom, yet to be implemented |
| 105 | | |
| 106 | | |
| 107 | | Videoram format |
| 108 | | --------------- |
| 109 | | |
| 110 | | pppp bbbt tttt tttt |
| 111 | | |
| 112 | | t=tile, b=bank, p=palette |
| 113 | | |
| 114 | | |
| 115 | | Registers |
| 116 | | --------- |
| 117 | | |
| 118 | | 0 - Scroll X |
| 119 | | Fixed point 12.4 (seems wrong) |
| 120 | | |
| 121 | | 1 - Scroll Y |
| 122 | | Fixed point 12.4 (seems wrong) |
| 123 | | |
| 124 | | 2 - ???? |
| 125 | | |
| 126 | | 3 - ???? |
| 127 | | |
| 128 | | 4 - Tilebank #0/#1 ---a aaaa ---b bbbb |
| 129 | | 5 - Tilebank #2/#3 ---a aaaa ---b bbbb |
| 130 | | 6 - Tilebank #4/#5 ---a aaaa ---b bbbb |
| 131 | | 7 - Tilebank #6/#7 ---a aaaa ---b bbbb |
| 132 | | |
| 133 | | Indexed tilebank. Each bank is 0x200 tiles wide. Notice that within each register, the bank with the lower |
| 134 | | index is in the MSB. gstriker uses 5 bits for banking, but the chips could be able to do more. |
| 135 | | |
| 136 | | */ |
| 137 | | |
| 138 | | |
| 139 | | |
| 140 | | TILE_GET_INFO_MEMBER(gstriker_state::MB60553_get_tile_info) |
| 141 | | { |
| 142 | | int data, bankno; |
| 143 | | int tileno, pal; |
| 144 | | |
| 145 | | data = m_MB60553_cur_chip->vram[tile_index]; |
| 146 | | |
| 147 | | tileno = data & 0x1FF; |
| 148 | | pal = (data >> 12) & 0xF; |
| 149 | | bankno = (data >> 9) & 0x7; |
| 150 | | |
| 151 | | SET_TILE_INFO_MEMBER(m_MB60553->gfx_region, tileno + m_MB60553_cur_chip->bank[bankno] * 0x200, pal + m_MB60553->pal_base, 0); |
| 152 | | } |
| 153 | | |
| 154 | | void gstriker_state::MB60553_reg_written(int numchip, int num_reg) |
| 155 | | { |
| 156 | | tMB60553* cur = &m_MB60553[numchip]; |
| 157 | | |
| 158 | | switch (num_reg) |
| 159 | | { |
| 160 | | case 0: |
| 161 | | cur->tmap->set_scrollx(0, cur->regs[0]>>4); |
| 162 | | break; |
| 163 | | |
| 164 | | case 1: |
| 165 | | cur->tmap->set_scrolly(0, cur->regs[1]>>4); |
| 166 | | break; |
| 167 | | |
| 168 | | case 2: |
| 169 | | osd_printf_debug("MB60553_reg chip %d, reg 2 %04x\n",numchip, cur->regs[2]); |
| 170 | | break; |
| 171 | | |
| 172 | | case 3: |
| 173 | | osd_printf_debug("MB60553_reg chip %d, reg 3 %04x\n",numchip, cur->regs[3]); |
| 174 | | break; |
| 175 | | |
| 176 | | case 4: |
| 177 | | cur->bank[0] = (cur->regs[4] >> 8) & 0x1F; |
| 178 | | cur->bank[1] = (cur->regs[4] >> 0) & 0x1F; |
| 179 | | cur->tmap->mark_all_dirty(); |
| 180 | | break; |
| 181 | | |
| 182 | | case 5: |
| 183 | | cur->bank[2] = (cur->regs[5] >> 8) & 0x1F; |
| 184 | | cur->bank[3] = (cur->regs[5] >> 0) & 0x1F; |
| 185 | | cur->tmap->mark_all_dirty(); |
| 186 | | break; |
| 187 | | |
| 188 | | case 6: |
| 189 | | cur->bank[4] = (cur->regs[6] >> 8) & 0x1F; |
| 190 | | cur->bank[5] = (cur->regs[6] >> 0) & 0x1F; |
| 191 | | cur->tmap->mark_all_dirty(); |
| 192 | | break; |
| 193 | | |
| 194 | | case 7: |
| 195 | | cur->bank[6] = (cur->regs[7] >> 8) & 0x1F; |
| 196 | | cur->bank[7] = (cur->regs[7] >> 0) & 0x1F; |
| 197 | | cur->tmap->mark_all_dirty(); |
| 198 | | break; |
| 199 | | } |
| 200 | | } |
| 201 | | |
| 202 | | /* twc94 has the tilemap made of 2 pages .. it needs this */ |
| 203 | | TILEMAP_MAPPER_MEMBER(gstriker_state::twc94_scan) |
| 204 | | { |
| 205 | | /* logical (col,row) -> memory offset */ |
| 206 | | return (row*64) + (col&63) + ((col&64)<<6); |
| 207 | | } |
| 208 | | |
| 209 | | void gstriker_state::MB60553_init(int numchips) |
| 210 | | { |
| 211 | | int i; |
| 212 | | |
| 213 | | if (numchips > MAX_MB60553) |
| 214 | | numchips = MAX_MB60553; |
| 215 | | |
| 216 | | for (i=0;i<numchips;i++) |
| 217 | | { |
| 218 | | m_MB60553[i].tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),this),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),this), 16,16,128,64); |
| 219 | | |
| 220 | | m_MB60553[i].tmap->set_transparent_pen(0); |
| 221 | | } |
| 222 | | } |
| 223 | | |
| 224 | | void gstriker_state::MB60553_set_pal_base(int numchip, int pal_base) |
| 225 | | { |
| 226 | | m_MB60553[numchip].pal_base = pal_base; |
| 227 | | } |
| 228 | | |
| 229 | | void gstriker_state::MB60553_set_gfx_region(int numchip, int gfx_region) |
| 230 | | { |
| 231 | | m_MB60553[numchip].gfx_region = gfx_region; |
| 232 | | } |
| 233 | | |
| 234 | | /* THIS IS STILL WRONG! */ |
| 235 | | void gstriker_state::MB60553_draw(int numchip, screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority) |
| 236 | | { |
| 237 | | int line; |
| 238 | | rectangle clip; |
| 239 | | m_MB60553_cur_chip = &m_MB60553[numchip]; |
| 240 | | |
| 241 | | clip.min_x = m_screen->visible_area().min_x; |
| 242 | | clip.max_x = m_screen->visible_area().max_x; |
| 243 | | |
| 244 | | for (line = 0; line < 224;line++) |
| 245 | | { |
| 246 | | // int scrollx; |
| 247 | | // int scrolly; |
| 248 | | |
| 249 | | UINT32 startx,starty; |
| 250 | | |
| 251 | | UINT32 incxx,incyy; |
| 252 | | |
| 253 | | startx = m_MB60553_cur_chip->regs[0]; |
| 254 | | starty = m_MB60553_cur_chip->regs[1]; |
| 255 | | |
| 256 | | startx += (24<<4); // maybe not.. |
| 257 | | |
| 258 | | startx -= m_lineram[(line)*8+7]/2; |
| 259 | | |
| 260 | | incxx = m_lineram[(line)*8+0]<<4; |
| 261 | | incyy = m_lineram[(line)*8+3]<<4; |
| 262 | | |
| 263 | | clip.min_y = clip.max_y = line; |
| 264 | | |
| 265 | | m_MB60553_cur_chip->tmap->draw_roz(screen, bitmap, clip, startx<<12,starty<<12, |
| 266 | | incxx,0,0,incyy, |
| 267 | | 1, |
| 268 | | 0,priority); |
| 269 | | |
| 270 | | } |
| 271 | | |
| 272 | | |
| 273 | | |
| 274 | | } |
| 275 | | |
| 276 | | tilemap_t* gstriker_state::MB60553_get_tilemap(int numchip) |
| 277 | | { |
| 278 | | return m_MB60553[numchip].tmap; |
| 279 | | } |
| 280 | | |
| 281 | | |
| 282 | | WRITE16_MEMBER(gstriker_state::MB60553_0_regs_w) |
| 283 | | { |
| 284 | | UINT16 oldreg = m_MB60553[0].regs[offset]; |
| 285 | | |
| 286 | | COMBINE_DATA(&m_MB60553[0].regs[offset]); |
| 287 | | |
| 288 | | if (m_MB60553[0].regs[offset] != oldreg) |
| 289 | | MB60553_reg_written(0, offset); |
| 290 | | } |
| 291 | | |
| 292 | | WRITE16_MEMBER(gstriker_state::MB60553_1_regs_w) |
| 293 | | { |
| 294 | | UINT16 oldreg = m_MB60553[1].regs[offset]; |
| 295 | | |
| 296 | | COMBINE_DATA(&m_MB60553[1].regs[offset]); |
| 297 | | |
| 298 | | if (m_MB60553[1].regs[offset] != oldreg) |
| 299 | | MB60553_reg_written(1, offset); |
| 300 | | } |
| 301 | | |
| 302 | | WRITE16_MEMBER(gstriker_state::MB60553_0_vram_w) |
| 303 | | { |
| 304 | | COMBINE_DATA(&m_MB60553[0].vram[offset]); |
| 305 | | |
| 306 | | m_MB60553[0].tmap->mark_tile_dirty(offset); |
| 307 | | } |
| 308 | | |
| 309 | | WRITE16_MEMBER(gstriker_state::MB60553_1_vram_w) |
| 310 | | { |
| 311 | | COMBINE_DATA(&m_MB60553[1].vram[offset]); |
| 312 | | |
| 313 | | m_MB60553[1].tmap->mark_tile_dirty(offset); |
| 314 | | } |
| 315 | | |
| 316 | | |
| 317 | | |
| 318 | | |
| 319 | | |
| 320 | 6 | /*** VIDEO UPDATE/START **********************************************/ |
| 321 | 7 | |
| 322 | 8 | |
| 323 | | #ifdef UNUSED_FUNCTION |
| 324 | | WRITE16_MEMBER(gstriker_state::gsx_videoram3_w) |
| 325 | | { |
| 326 | | // This memory appears to be empty in gstriker |
| 327 | | gs_videoram3[offset] = data; |
| 328 | | } |
| 329 | | #endif |
| 330 | 9 | |
| 331 | | |
| 332 | 10 | UINT32 gstriker_state::screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 333 | 11 | { |
| 334 | 12 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 335 | | |
| 13 | |
| 336 | 14 | // Sandwitched screen/sprite0/score/sprite1. Surely wrong, probably |
| 337 | 15 | // needs sprite orthogonality |
| 338 | | MB60553_draw(0, screen, bitmap,cliprect, 0); |
| 16 | m_bg->draw( screen, bitmap,cliprect, 0); |
| 339 | 17 | |
| 340 | | m_spr->draw_sprites(m_CG10103_vram, 0x2000, screen, bitmap, cliprect, 0x2, 0x0); |
| 18 | m_spr->draw_sprites(m_CG10103_m_vram, 0x2000, screen, bitmap, cliprect, 0x2, 0x0); |
| 341 | 19 | |
| 342 | | VS920A_draw(0, screen, bitmap, cliprect, 0); |
| 20 | m_tx->draw( screen, bitmap, cliprect, 0); |
| 343 | 21 | |
| 344 | | m_spr->draw_sprites(m_CG10103_vram, 0x2000, screen, bitmap, cliprect, 0x2, 0x2); |
| 22 | m_spr->draw_sprites(m_CG10103_m_vram, 0x2000, screen, bitmap, cliprect, 0x2, 0x2); |
| 345 | 23 | |
| 346 | | #if 0 |
| 347 | | popmessage("%04x %04x %04x %04x %04x %04x %04x %04x", |
| 348 | | (UINT16)m_MB60553[0].regs[0], (UINT16)m_MB60553[0].regs[1], (UINT16)m_MB60553[0].regs[2], (UINT16)m_MB60553[0].regs[3], |
| 349 | | (UINT16)m_MB60553[0].regs[4], (UINT16)m_MB60553[0].regs[5], (UINT16)m_MB60553[0].regs[6], (UINT16)m_MB60553[0].regs[7] |
| 350 | | ); |
| 351 | | #endif |
| 352 | | |
| 353 | | #if 0 |
| 354 | | popmessage("%04x %04x %04x %04x %04x %04x %04x %04x", |
| 355 | | (UINT16)gs_mixer_regs[8], (UINT16)gs_mixer_regs[9], (UINT16)gs_mixer_regs[10], (UINT16)gs_mixer_regs[11], |
| 356 | | (UINT16)gs_mixer_regs[12], (UINT16)gs_mixer_regs[13], (UINT16)gs_mixer_regs[14], (UINT16)gs_mixer_regs[15] |
| 357 | | ); |
| 358 | | #endif |
| 359 | 24 | return 0; |
| 360 | 25 | } |
| 361 | 26 | |
| r30960 | r30961 | |
| 364 | 29 | // Palette bases are hardcoded, but should be probably extracted from the mixer registers |
| 365 | 30 | |
| 366 | 31 | // Initalize the chip for the score plane |
| 367 | | VS920A_init(1); |
| 368 | | VS920A_set_gfx_region(0, 0); |
| 369 | | VS920A_set_pal_base(0, 0x30); |
| 370 | | VS920A_get_tilemap(0)->set_transparent_pen(0xf); |
| 32 | m_tx->set_gfx_region(0); |
| 33 | m_tx->set_pal_base(0x30); |
| 34 | m_tx->get_tilemap()->set_transparent_pen(0xf); |
| 371 | 35 | |
| 372 | 36 | // Initalize the chip for the screen plane |
| 373 | | MB60553_init(1); |
| 374 | | MB60553_set_gfx_region(0, 1); |
| 375 | | MB60553_set_pal_base(0, 0); |
| 376 | | MB60553_get_tilemap(0)->set_transparent_pen(0xf); |
| 37 | m_bg->set_gfx_region( 1); |
| 38 | m_bg->set_pal_base( 0); |
| 39 | m_bg->get_tilemap()->set_transparent_pen(0xf); |
| 377 | 40 | } |
| 378 | 41 | |
| 379 | 42 | VIDEO_START_MEMBER(gstriker_state,twrldc94) |
| r30960 | r30961 | |
| 381 | 44 | // Palette bases are hardcoded, but should be probably extracted from the mixer registers |
| 382 | 45 | |
| 383 | 46 | // Initalize the chip for the score plane |
| 384 | | VS920A_init(1); |
| 385 | | VS920A_set_gfx_region(0, 0); |
| 386 | | VS920A_set_pal_base(0, 0x40); |
| 387 | | VS920A_get_tilemap(0)->set_transparent_pen(0xf); |
| 47 | m_tx->set_gfx_region(0); |
| 48 | m_tx->set_pal_base(0x40); |
| 49 | m_tx->get_tilemap()->set_transparent_pen(0xf); |
| 388 | 50 | |
| 389 | 51 | // Initalize the chip for the screen plane |
| 390 | | MB60553_init(1); |
| 391 | | MB60553_set_gfx_region(0, 1); |
| 392 | | MB60553_set_pal_base(0, 0x50); |
| 393 | | MB60553_get_tilemap(0)->set_transparent_pen(0xf); |
| 52 | m_bg->set_gfx_region( 1); |
| 53 | m_bg->set_pal_base( 0x50); |
| 54 | m_bg->get_tilemap()->set_transparent_pen(0xf); |
| 394 | 55 | } |
| 395 | 56 | |
| 396 | 57 | VIDEO_START_MEMBER(gstriker_state,vgoalsoc) |
| r30960 | r30961 | |
| 398 | 59 | // Palette bases are hardcoded, but should be probably extracted from the mixer registers |
| 399 | 60 | |
| 400 | 61 | // Initalize the chip for the score plane |
| 401 | | VS920A_init(1); |
| 402 | | VS920A_set_gfx_region(0, 0); |
| 403 | | VS920A_set_pal_base(0, 0x30); |
| 404 | | VS920A_get_tilemap(0)->set_transparent_pen(0xf); |
| 62 | m_tx->set_gfx_region(0); |
| 63 | m_tx->set_pal_base(0x30); |
| 64 | m_tx->get_tilemap()->set_transparent_pen(0xf); |
| 405 | 65 | |
| 406 | 66 | // Initalize the chip for the screen plane |
| 407 | | MB60553_init(1); |
| 408 | | MB60553_set_gfx_region(0, 1); |
| 409 | | MB60553_set_pal_base(0, 0x20); |
| 410 | | MB60553_get_tilemap(0)->set_transparent_pen(0xf); |
| 67 | m_bg->set_gfx_region( 1); |
| 68 | m_bg->set_pal_base( 0x20); |
| 69 | m_bg->get_tilemap()->set_transparent_pen(0xf); |
| 411 | 70 | } |
trunk/src/mame/video/mb60553.c
| r0 | r30961 | |
| 1 | /* This is the tilemap chip used by Grand Striker, Tecmo World Cup '94 and V Goal Soccer for the backgrounds |
| 2 | |
| 3 | the actual line scroll / zoom is not properly understood |
| 4 | |
| 5 | interestingly the chip seems to require doubled up ROMs (2 copies of each ROM) to draw just the single layer. |
| 6 | |
| 7 | */ |
| 8 | |
| 9 | #include "emu.h" |
| 10 | #include "mb60553.h" |
| 11 | |
| 12 | |
| 13 | const device_type MB60553 = &device_creator<mb60553_zooming_tilemap_device>; |
| 14 | |
| 15 | mb60553_zooming_tilemap_device::mb60553_zooming_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 16 | : device_t(mconfig, MB60553, "MB60553 Zooming Tilemap", tag, owner, clock, "mb60553", __FILE__), |
| 17 | m_m_gfx_region(0), |
| 18 | m_gfxdecode(*this) |
| 19 | { |
| 20 | } |
| 21 | |
| 22 | |
| 23 | void mb60553_zooming_tilemap_device::device_start() |
| 24 | { |
| 25 | if(!m_gfxdecode->started()) |
| 26 | throw device_missing_dependencies(); |
| 27 | |
| 28 | m_lineram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2); |
| 29 | m_vram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x4000/2); |
| 30 | |
| 31 | save_pointer(NAME(m_lineram), 0x1000/2); |
| 32 | save_pointer(NAME(m_vram), 0x4000/2); |
| 33 | |
| 34 | |
| 35 | m_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(mb60553_zooming_tilemap_device::get_tile_info),this),tilemap_mapper_delegate(FUNC(mb60553_zooming_tilemap_device::twc94_scan),this), 16,16,128,64); |
| 36 | m_tmap->set_transparent_pen(0); |
| 37 | } |
| 38 | |
| 39 | void mb60553_zooming_tilemap_device::device_reset() |
| 40 | { |
| 41 | |
| 42 | } |
| 43 | |
| 44 | |
| 45 | void mb60553_zooming_tilemap_device::set_gfx_region(device_t &device, int gfxregion) |
| 46 | { |
| 47 | mb60553_zooming_tilemap_device &dev = downcast<mb60553_zooming_tilemap_device &>(device); |
| 48 | dev.m_m_gfx_region = gfxregion; |
| 49 | } |
| 50 | |
| 51 | void mb60553_zooming_tilemap_device::static_set_gfxdecode_tag(device_t &device, const char *tag) |
| 52 | { |
| 53 | downcast<mb60553_zooming_tilemap_device &>(device).m_gfxdecode.set_tag(tag); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | |
| 58 | /*** Fujitsu MB60553 (screen tilemap) **********************************************/ |
| 59 | |
| 60 | /* |
| 61 | |
| 62 | Fujitsu MB60553 - Tilemap chip |
| 63 | ------------------------------ |
| 64 | |
| 65 | - 1 Plane |
| 66 | - Tiles 16x16, 4bpp |
| 67 | - Map 64x64 |
| 68 | - Scrolling |
| 69 | - Indexed banking (8 banks) |
| 70 | - Surely another effect like roz/tilezoom, yet to be implemented |
| 71 | |
| 72 | |
| 73 | Videoram format |
| 74 | --------------- |
| 75 | |
| 76 | pppp bbbt tttt tttt |
| 77 | |
| 78 | t=tile, b=bank, p=palette |
| 79 | |
| 80 | |
| 81 | Registers |
| 82 | --------- |
| 83 | |
| 84 | 0 - Scroll X |
| 85 | Fixed point 12.4 (seems wrong) |
| 86 | |
| 87 | 1 - Scroll Y |
| 88 | Fixed point 12.4 (seems wrong) |
| 89 | |
| 90 | 2 - ???? |
| 91 | |
| 92 | 3 - ???? |
| 93 | |
| 94 | 4 - Tilebank #0/#1 ---a aaaa ---b bbbb |
| 95 | 5 - Tilebank #2/#3 ---a aaaa ---b bbbb |
| 96 | 6 - Tilebank #4/#5 ---a aaaa ---b bbbb |
| 97 | 7 - Tilebank #6/#7 ---a aaaa ---b bbbb |
| 98 | |
| 99 | Indexed tilebank. Each bank is 0x200 tiles wide. Notice that within each register, the bank with the lower |
| 100 | index is in the MSB. gstriker uses 5 bits for banking, but the chips could be able to do more. |
| 101 | |
| 102 | */ |
| 103 | |
| 104 | |
| 105 | |
| 106 | TILE_GET_INFO_MEMBER(mb60553_zooming_tilemap_device::get_tile_info) |
| 107 | { |
| 108 | int data, bankno; |
| 109 | int tileno, pal; |
| 110 | |
| 111 | data = m_vram[tile_index]; |
| 112 | |
| 113 | tileno = data & 0x1FF; |
| 114 | pal = (data >> 12) & 0xF; |
| 115 | bankno = (data >> 9) & 0x7; |
| 116 | |
| 117 | SET_TILE_INFO_MEMBER(m_m_gfx_region, tileno + m_bank[bankno] * 0x200, pal + m_pal_base, 0); |
| 118 | } |
| 119 | |
| 120 | void mb60553_zooming_tilemap_device::reg_written( int num_reg) |
| 121 | { |
| 122 | |
| 123 | switch (num_reg) |
| 124 | { |
| 125 | case 0: |
| 126 | m_tmap->set_scrollx(0, m_regs[0]>>4); |
| 127 | break; |
| 128 | |
| 129 | case 1: |
| 130 | m_tmap->set_scrolly(0, m_regs[1]>>4); |
| 131 | break; |
| 132 | |
| 133 | case 2: |
| 134 | osd_printf_debug("reg , reg 2 %04x\n", m_regs[2]); |
| 135 | break; |
| 136 | |
| 137 | case 3: |
| 138 | osd_printf_debug("reg , reg 3 %04x\n", m_regs[3]); |
| 139 | break; |
| 140 | |
| 141 | case 4: |
| 142 | m_bank[0] = (m_regs[4] >> 8) & 0x1F; |
| 143 | m_bank[1] = (m_regs[4] >> 0) & 0x1F; |
| 144 | m_tmap->mark_all_dirty(); |
| 145 | break; |
| 146 | |
| 147 | case 5: |
| 148 | m_bank[2] = (m_regs[5] >> 8) & 0x1F; |
| 149 | m_bank[3] = (m_regs[5] >> 0) & 0x1F; |
| 150 | m_tmap->mark_all_dirty(); |
| 151 | break; |
| 152 | |
| 153 | case 6: |
| 154 | m_bank[4] = (m_regs[6] >> 8) & 0x1F; |
| 155 | m_bank[5] = (m_regs[6] >> 0) & 0x1F; |
| 156 | m_tmap->mark_all_dirty(); |
| 157 | break; |
| 158 | |
| 159 | case 7: |
| 160 | m_bank[6] = (m_regs[7] >> 8) & 0x1F; |
| 161 | m_bank[7] = (m_regs[7] >> 0) & 0x1F; |
| 162 | m_tmap->mark_all_dirty(); |
| 163 | break; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | /* twc94 has the tilemap made of 2 pages .. it needs this */ |
| 168 | TILEMAP_MAPPER_MEMBER(mb60553_zooming_tilemap_device::twc94_scan) |
| 169 | { |
| 170 | /* logical (col,row) -> memory offset */ |
| 171 | return (row*64) + (col&63) + ((col&64)<<6); |
| 172 | } |
| 173 | |
| 174 | void mb60553_zooming_tilemap_device::set_pal_base( int pal_base) |
| 175 | { |
| 176 | m_pal_base = pal_base; |
| 177 | } |
| 178 | |
| 179 | void mb60553_zooming_tilemap_device::set_gfx_region( int gfx_region) |
| 180 | { |
| 181 | m_m_gfx_region = gfx_region; |
| 182 | } |
| 183 | |
| 184 | /* THIS IS STILL WRONG! */ |
| 185 | void mb60553_zooming_tilemap_device::draw( screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority) |
| 186 | { |
| 187 | int line; |
| 188 | rectangle clip; |
| 189 | |
| 190 | clip.min_x = screen.visible_area().min_x; |
| 191 | clip.max_x = screen.visible_area().max_x; |
| 192 | |
| 193 | for (line = 0; line < 224;line++) |
| 194 | { |
| 195 | // int scrollx; |
| 196 | // int scrolly; |
| 197 | |
| 198 | UINT32 startx,starty; |
| 199 | |
| 200 | UINT32 incxx,incyy; |
| 201 | |
| 202 | startx = m_regs[0]; |
| 203 | starty = m_regs[1]; |
| 204 | |
| 205 | startx += (24<<4); // maybe not.. |
| 206 | |
| 207 | startx -= m_lineram[(line)*8+7]/2; |
| 208 | |
| 209 | incxx = m_lineram[(line)*8+0]<<4; |
| 210 | incyy = m_lineram[(line)*8+3]<<4; |
| 211 | |
| 212 | clip.min_y = clip.max_y = line; |
| 213 | |
| 214 | m_tmap->draw_roz(screen, bitmap, clip, startx<<12,starty<<12, |
| 215 | incxx,0,0,incyy, |
| 216 | 1, |
| 217 | 0,priority); |
| 218 | |
| 219 | } |
| 220 | |
| 221 | |
| 222 | |
| 223 | } |
| 224 | |
| 225 | tilemap_t* mb60553_zooming_tilemap_device::get_tilemap() |
| 226 | { |
| 227 | return m_tmap; |
| 228 | } |
| 229 | |
| 230 | |
| 231 | WRITE16_MEMBER(mb60553_zooming_tilemap_device::regs_w) |
| 232 | { |
| 233 | UINT16 oldreg = m_regs[offset]; |
| 234 | |
| 235 | COMBINE_DATA(&m_regs[offset]); |
| 236 | |
| 237 | if (m_regs[offset] != oldreg) |
| 238 | reg_written(offset); |
| 239 | } |
| 240 | |
| 241 | WRITE16_MEMBER(mb60553_zooming_tilemap_device::vram_w) |
| 242 | { |
| 243 | COMBINE_DATA(&m_vram[offset]); |
| 244 | |
| 245 | m_tmap->mark_tile_dirty(offset); |
| 246 | } |
| 247 | |
| 248 | WRITE16_MEMBER(mb60553_zooming_tilemap_device::line_w) |
| 249 | { |
| 250 | COMBINE_DATA(&m_lineram[offset]); |
| 251 | } |
| 252 | |
| 253 | |
| 254 | READ16_MEMBER(mb60553_zooming_tilemap_device::regs_r) |
| 255 | { |
| 256 | return m_regs[offset]; |
| 257 | } |
| 258 | |
| 259 | READ16_MEMBER(mb60553_zooming_tilemap_device::vram_r) |
| 260 | { |
| 261 | return m_vram[offset]; |
| 262 | } |
| 263 | |
| 264 | READ16_MEMBER(mb60553_zooming_tilemap_device::line_r) |
| 265 | { |
| 266 | return m_lineram[offset]; |
| 267 | } |
| 268 | |
| 269 | |
| 270 | |
trunk/src/mame/video/vs920a.c
| r0 | r30961 | |
| 1 | |
| 2 | // currently used by gstriker.c, apparently inufuku uses the same chip |
| 3 | |
| 4 | /*** VS920A (score tilemap) **********************************************/ |
| 5 | |
| 6 | /* |
| 7 | |
| 8 | VS920A - (Very) Simple tilemap chip |
| 9 | ----------------------------------- |
| 10 | |
| 11 | - 1 Plane |
| 12 | - Tiles 8x8, 4bpp |
| 13 | - Map 64x64 |
| 14 | - No scrolling or other effects (at least in gstriker) |
| 15 | |
| 16 | |
| 17 | Videoram format: |
| 18 | ---------------- |
| 19 | |
| 20 | pppp tttt tttt tttt |
| 21 | |
| 22 | t=tile, p=palette |
| 23 | |
| 24 | */ |
| 25 | |
| 26 | |
| 27 | #include "emu.h" |
| 28 | #include "vs920a.h" |
| 29 | |
| 30 | |
| 31 | const device_type VS920A = &device_creator<vs920a_text_tilemap_device>; |
| 32 | |
| 33 | vs920a_text_tilemap_device::vs920a_text_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 34 | : device_t(mconfig, VS920A, "VS920A Text Tilemap", tag, owner, clock, "vs920a", __FILE__), |
| 35 | m_gfx_region(0), |
| 36 | m_gfxdecode(*this) |
| 37 | |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | |
| 42 | void vs920a_text_tilemap_device::device_start() |
| 43 | { |
| 44 | if(!m_gfxdecode->started()) |
| 45 | throw device_missing_dependencies(); |
| 46 | |
| 47 | m_vram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2); |
| 48 | save_pointer(NAME(m_vram), 0x1000/2); |
| 49 | |
| 50 | |
| 51 | m_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(vs920a_text_tilemap_device::get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); |
| 52 | m_tmap->set_transparent_pen(0); |
| 53 | } |
| 54 | |
| 55 | void vs920a_text_tilemap_device::device_reset() |
| 56 | { |
| 57 | } |
| 58 | |
| 59 | |
| 60 | void vs920a_text_tilemap_device::set_gfx_region(device_t &device, int gfxregion) |
| 61 | { |
| 62 | vs920a_text_tilemap_device &dev = downcast<vs920a_text_tilemap_device &>(device); |
| 63 | dev.m_gfx_region = gfxregion; |
| 64 | } |
| 65 | |
| 66 | void vs920a_text_tilemap_device::static_set_gfxdecode_tag(device_t &device, const char *tag) |
| 67 | { |
| 68 | downcast<vs920a_text_tilemap_device &>(device).m_gfxdecode.set_tag(tag); |
| 69 | } |
| 70 | |
| 71 | |
| 72 | |
| 73 | TILE_GET_INFO_MEMBER(vs920a_text_tilemap_device::get_tile_info) |
| 74 | { |
| 75 | int data; |
| 76 | int tileno, pal; |
| 77 | |
| 78 | data = m_vram[tile_index]; |
| 79 | |
| 80 | tileno = data & 0xFFF; |
| 81 | pal = (data >> 12) & 0xF; |
| 82 | |
| 83 | SET_TILE_INFO_MEMBER(m_gfx_region, tileno, m_pal_base + pal, 0); |
| 84 | } |
| 85 | |
| 86 | WRITE16_MEMBER(vs920a_text_tilemap_device::vram_w) |
| 87 | { |
| 88 | COMBINE_DATA(&m_vram[offset]); |
| 89 | m_tmap->mark_tile_dirty(offset); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | READ16_MEMBER(vs920a_text_tilemap_device::vram_r) |
| 94 | { |
| 95 | return m_vram[offset]; |
| 96 | } |
| 97 | |
| 98 | |
| 99 | tilemap_t* vs920a_text_tilemap_device::get_tilemap() |
| 100 | { |
| 101 | return m_tmap; |
| 102 | } |
| 103 | |
| 104 | void vs920a_text_tilemap_device::set_pal_base(int pal_base) |
| 105 | { |
| 106 | m_pal_base = pal_base; |
| 107 | } |
| 108 | |
| 109 | void vs920a_text_tilemap_device::set_gfx_region(int gfx_region) |
| 110 | { |
| 111 | m_gfx_region = gfx_region; |
| 112 | } |
| 113 | |
| 114 | void vs920a_text_tilemap_device::draw(screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority) |
| 115 | { |
| 116 | m_tmap->draw(screen, bitmap, cliprect, 0, priority); |
| 117 | } |