trunk/src/mame/drivers/quizdna.c
| r245603 | r245604 | |
| 16 | 16 | |
| 17 | 17 | #define MCLK 16000000 |
| 18 | 18 | |
| 19 | | WRITE8_MEMBER(quizdna_state::quizdna_rombank_w) |
| 19 | WRITE8_MEMBER(quizdna_state::rombank_w) |
| 20 | 20 | { |
| 21 | | UINT8 *ROM = memregion("maincpu")->base(); |
| 22 | | membank("bank1")->set_base(&ROM[0x10000+0x4000*(data & 0x3f)]); |
| 21 | membank("mainbank")->set_entry(data & 0x3f); |
| 23 | 22 | } |
| 24 | 23 | |
| 25 | 24 | WRITE8_MEMBER(quizdna_state::gekiretu_rombank_w) |
| 26 | 25 | { |
| 27 | | UINT8 *ROM = memregion("maincpu")->base(); |
| 28 | | membank("bank1")->set_base(&ROM[0x10000+0x4000*((data & 0x3f) ^ 0x0a)]); |
| 26 | membank("mainbank")->set_entry((data & 0x3f) ^ 0x0a); |
| 29 | 27 | } |
| 30 | 28 | |
| 31 | 29 | /****************************************************************************/ |
| 32 | 30 | |
| 33 | 31 | static ADDRESS_MAP_START( quizdna_map, AS_PROGRAM, 8, quizdna_state ) |
| 34 | 32 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 35 | | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 36 | | AM_RANGE(0x8000, 0x9fff) AM_WRITE(quizdna_fg_ram_w) |
| 37 | | AM_RANGE(0xa000, 0xbfff) AM_WRITE(quizdna_bg_ram_w) |
| 33 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("mainbank") |
| 34 | AM_RANGE(0x8000, 0x9fff) AM_WRITE(fg_ram_w) |
| 35 | AM_RANGE(0xa000, 0xbfff) AM_WRITE(bg_ram_w) |
| 38 | 36 | AM_RANGE(0xc000, 0xdfff) AM_RAM |
| 39 | 37 | AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_SHARE("spriteram") |
| 40 | 38 | AM_RANGE(0xe200, 0xefff) AM_RAM |
| r245603 | r245604 | |
| 43 | 41 | |
| 44 | 42 | static ADDRESS_MAP_START( gekiretu_map, AS_PROGRAM, 8, quizdna_state ) |
| 45 | 43 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 46 | | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 47 | | AM_RANGE(0x8000, 0x9fff) AM_WRITE(quizdna_fg_ram_w) |
| 48 | | AM_RANGE(0xa000, 0xbfff) AM_WRITE(quizdna_bg_ram_w) |
| 44 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("mainbank") |
| 45 | AM_RANGE(0x8000, 0x9fff) AM_WRITE(fg_ram_w) |
| 46 | AM_RANGE(0xa000, 0xbfff) AM_WRITE(bg_ram_w) |
| 49 | 47 | AM_RANGE(0xc000, 0xdfff) AM_RAM |
| 50 | 48 | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(paletteram_xBGR_RRRR_GGGG_BBBB_w) AM_SHARE("paletteram") |
| 51 | 49 | AM_RANGE(0xf000, 0xf1ff) AM_RAM AM_SHARE("spriteram") |
| r245603 | r245604 | |
| 54 | 52 | |
| 55 | 53 | static ADDRESS_MAP_START( quizdna_io_map, AS_IO, 8, quizdna_state ) |
| 56 | 54 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 57 | | AM_RANGE(0x02, 0x03) AM_WRITE(quizdna_bg_xscroll_w) |
| 58 | | AM_RANGE(0x04, 0x04) AM_WRITE(quizdna_bg_yscroll_w) |
| 55 | AM_RANGE(0x02, 0x03) AM_WRITE(bg_xscroll_w) |
| 56 | AM_RANGE(0x04, 0x04) AM_WRITE(bg_yscroll_w) |
| 59 | 57 | AM_RANGE(0x05, 0x06) AM_WRITENOP /* unknown */ |
| 60 | 58 | AM_RANGE(0x80, 0x80) AM_READ_PORT("P1") |
| 61 | 59 | AM_RANGE(0x81, 0x81) AM_READ_PORT("P2") |
| 62 | 60 | AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM") |
| 63 | 61 | AM_RANGE(0x91, 0x91) AM_READ_PORT("SERVICE") |
| 64 | | AM_RANGE(0xc0, 0xc0) AM_WRITE(quizdna_rombank_w) |
| 65 | | AM_RANGE(0xd0, 0xd0) AM_WRITE(quizdna_screen_ctrl_w) |
| 62 | AM_RANGE(0xc0, 0xc0) AM_WRITE(rombank_w) |
| 63 | AM_RANGE(0xd0, 0xd0) AM_WRITE(screen_ctrl_w) |
| 66 | 64 | AM_RANGE(0xe0, 0xe1) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) |
| 67 | 65 | AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 68 | 66 | ADDRESS_MAP_END |
| 69 | 67 | |
| 70 | 68 | static ADDRESS_MAP_START( gakupara_io_map, AS_IO, 8, quizdna_state ) |
| 71 | 69 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 72 | | AM_RANGE(0x00, 0x01) AM_WRITE(quizdna_bg_xscroll_w) |
| 73 | | AM_RANGE(0x02, 0x02) AM_WRITE(quizdna_bg_yscroll_w) |
| 70 | AM_RANGE(0x00, 0x01) AM_WRITE(bg_xscroll_w) |
| 71 | AM_RANGE(0x02, 0x02) AM_WRITE(bg_yscroll_w) |
| 74 | 72 | AM_RANGE(0x03, 0x04) AM_WRITENOP /* unknown */ |
| 75 | 73 | AM_RANGE(0x80, 0x80) AM_READ_PORT("P1") |
| 76 | 74 | AM_RANGE(0x81, 0x81) AM_READ_PORT("P2") |
| 77 | 75 | AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM") |
| 78 | 76 | AM_RANGE(0x91, 0x91) AM_READ_PORT("SERVICE") |
| 79 | | AM_RANGE(0xc0, 0xc0) AM_WRITE(quizdna_rombank_w) |
| 80 | | AM_RANGE(0xd0, 0xd0) AM_WRITE(quizdna_screen_ctrl_w) |
| 77 | AM_RANGE(0xc0, 0xc0) AM_WRITE(rombank_w) |
| 78 | AM_RANGE(0xd0, 0xd0) AM_WRITE(screen_ctrl_w) |
| 81 | 79 | AM_RANGE(0xe0, 0xe1) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) |
| 82 | 80 | AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 83 | 81 | ADDRESS_MAP_END |
| 84 | 82 | |
| 85 | 83 | static ADDRESS_MAP_START( gekiretu_io_map, AS_IO, 8, quizdna_state ) |
| 86 | 84 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 87 | | AM_RANGE(0x02, 0x03) AM_WRITE(quizdna_bg_xscroll_w) |
| 88 | | AM_RANGE(0x04, 0x04) AM_WRITE(quizdna_bg_yscroll_w) |
| 85 | AM_RANGE(0x02, 0x03) AM_WRITE(bg_xscroll_w) |
| 86 | AM_RANGE(0x04, 0x04) AM_WRITE(bg_yscroll_w) |
| 89 | 87 | AM_RANGE(0x05, 0x06) AM_WRITENOP /* unknown */ |
| 90 | 88 | AM_RANGE(0x80, 0x80) AM_READ_PORT("P1") |
| 91 | 89 | AM_RANGE(0x81, 0x81) AM_READ_PORT("P2") |
| 92 | 90 | AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM") |
| 93 | 91 | AM_RANGE(0x91, 0x91) AM_READ_PORT("SERVICE") |
| 94 | 92 | AM_RANGE(0xc0, 0xc0) AM_WRITE(gekiretu_rombank_w) |
| 95 | | AM_RANGE(0xd0, 0xd0) AM_WRITE(quizdna_screen_ctrl_w) |
| 93 | AM_RANGE(0xd0, 0xd0) AM_WRITE(screen_ctrl_w) |
| 96 | 94 | AM_RANGE(0xe0, 0xe1) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) |
| 97 | 95 | AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 98 | 96 | ADDRESS_MAP_END |
| r245603 | r245604 | |
| 426 | 424 | GFXDECODE_ENTRY( "gfx3", 0x0000, objlayout, 0x600, 32 ) |
| 427 | 425 | GFXDECODE_END |
| 428 | 426 | |
| 427 | void quizdna_state::machine_start() |
| 428 | { |
| 429 | membank("mainbank")->configure_entries(0, 64, memregion("maincpu")->base() + 0x10000, 0x4000); |
| 430 | } |
| 429 | 431 | |
| 432 | |
| 430 | 433 | static MACHINE_CONFIG_START( quizdna, quizdna_state ) |
| 431 | 434 | |
| 432 | 435 | /* basic machine hardware */ |
| r245603 | r245604 | |
| 441 | 444 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
| 442 | 445 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 443 | 446 | MCFG_SCREEN_VISIBLE_AREA(8*8, 56*8-1, 2*8, 30*8-1) |
| 444 | | MCFG_SCREEN_UPDATE_DRIVER(quizdna_state, screen_update_quizdna) |
| 447 | MCFG_SCREEN_UPDATE_DRIVER(quizdna_state, screen_update) |
| 445 | 448 | MCFG_SCREEN_PALETTE("palette") |
| 446 | 449 | |
| 447 | 450 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", quizdna) |
| r245603 | r245604 | |
| 560 | 563 | ROM_LOAD( "quiz3.148", 0x000000, 0x000020, CRC(91267e8a) SHA1(ae5bd8efea5322c4d9986d06680a781392f9a642) ) |
| 561 | 564 | ROM_END |
| 562 | 565 | |
| 563 | | GAME( 1991, gakupara, 0, gakupara, gakupara, driver_device, 0, ROT0, "NMK", "Quiz Gakuen Paradise (Japan)", 0 ) |
| 564 | | GAME( 1992, quizdna, 0, quizdna, quizdna, driver_device, 0, ROT0, "Face", "Quiz DNA no Hanran (Japan)", 0 ) |
| 565 | | GAME( 1992, gekiretu, 0, gekiretu, gekiretu, driver_device, 0, ROT0, "Face", "Quiz Gekiretsu Scramble (Japan)", 0 ) |
| 566 | GAME( 1991, gakupara, 0, gakupara, gakupara, driver_device, 0, ROT0, "NMK", "Quiz Gakuen Paradise (Japan)", GAME_SUPPORTS_SAVE ) |
| 567 | GAME( 1992, quizdna, 0, quizdna, quizdna, driver_device, 0, ROT0, "Face", "Quiz DNA no Hanran (Japan)", GAME_SUPPORTS_SAVE ) |
| 568 | GAME( 1992, gekiretu, 0, gekiretu, gekiretu, driver_device, 0, ROT0, "Face", "Quiz Gekiretsu Scramble (Japan)", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/quizdna.h
| r245603 | r245604 | |
| 3 | 3 | public: |
| 4 | 4 | quizdna_state(const machine_config &mconfig, device_type type, const char *tag) |
| 5 | 5 | : driver_device(mconfig, type, tag), |
| 6 | | m_spriteram(*this, "spriteram"), |
| 7 | 6 | m_maincpu(*this, "maincpu"), |
| 8 | 7 | m_gfxdecode(*this, "gfxdecode"), |
| 9 | 8 | m_palette(*this, "palette"), |
| 9 | m_spriteram(*this, "spriteram"), |
| 10 | 10 | m_generic_paletteram_8(*this, "paletteram") { } |
| 11 | 11 | |
| 12 | required_device<cpu_device> m_maincpu; |
| 13 | required_device<gfxdecode_device> m_gfxdecode; |
| 14 | required_device<palette_device> m_palette; |
| 15 | |
| 16 | required_shared_ptr<UINT8> m_spriteram; |
| 17 | required_shared_ptr<UINT8> m_generic_paletteram_8; |
| 18 | |
| 12 | 19 | UINT8 *m_bg_ram; |
| 13 | 20 | UINT8 *m_fg_ram; |
| 14 | 21 | tilemap_t *m_bg_tilemap; |
| r245603 | r245604 | |
| 16 | 23 | UINT8 m_bg_xscroll[2]; |
| 17 | 24 | int m_flipscreen; |
| 18 | 25 | int m_video_enable; |
| 19 | | required_shared_ptr<UINT8> m_spriteram; |
| 20 | | DECLARE_WRITE8_MEMBER(quizdna_rombank_w); |
| 26 | |
| 27 | // common |
| 28 | DECLARE_WRITE8_MEMBER(bg_ram_w); |
| 29 | DECLARE_WRITE8_MEMBER(fg_ram_w); |
| 30 | DECLARE_WRITE8_MEMBER(bg_yscroll_w); |
| 31 | DECLARE_WRITE8_MEMBER(bg_xscroll_w); |
| 32 | DECLARE_WRITE8_MEMBER(screen_ctrl_w); |
| 33 | DECLARE_WRITE8_MEMBER(paletteram_xBGR_RRRR_GGGG_BBBB_w); |
| 34 | DECLARE_WRITE8_MEMBER(rombank_w); |
| 35 | |
| 36 | // game specific |
| 21 | 37 | DECLARE_WRITE8_MEMBER(gekiretu_rombank_w); |
| 22 | | DECLARE_WRITE8_MEMBER(quizdna_bg_ram_w); |
| 23 | | DECLARE_WRITE8_MEMBER(quizdna_fg_ram_w); |
| 24 | | DECLARE_WRITE8_MEMBER(quizdna_bg_yscroll_w); |
| 25 | | DECLARE_WRITE8_MEMBER(quizdna_bg_xscroll_w); |
| 26 | | DECLARE_WRITE8_MEMBER(quizdna_screen_ctrl_w); |
| 27 | | DECLARE_WRITE8_MEMBER(paletteram_xBGR_RRRR_GGGG_BBBB_w); |
| 38 | |
| 28 | 39 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 29 | 40 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 41 | |
| 42 | virtual void machine_start(); |
| 30 | 43 | virtual void video_start(); |
| 31 | | UINT32 screen_update_quizdna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 44 | |
| 45 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 32 | 46 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 33 | | required_device<cpu_device> m_maincpu; |
| 34 | | required_device<gfxdecode_device> m_gfxdecode; |
| 35 | | required_device<palette_device> m_palette; |
| 36 | | required_shared_ptr<UINT8> m_generic_paletteram_8; |
| 37 | 47 | }; |
trunk/src/mame/video/quizdna.c
| r245603 | r245604 | |
| 58 | 58 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(quizdna_state::get_fg_tile_info),this),TILEMAP_SCAN_ROWS,16,8,32,32 ); |
| 59 | 59 | |
| 60 | 60 | m_fg_tilemap->set_transparent_pen(0 ); |
| 61 | |
| 62 | save_pointer(NAME(m_bg_ram), 0x2000); |
| 63 | save_pointer(NAME(m_fg_ram), 0x1000); |
| 64 | save_item(NAME(m_bg_xscroll)); |
| 65 | save_item(NAME(m_flipscreen)); |
| 66 | save_item(NAME(m_video_enable)); |
| 61 | 67 | } |
| 62 | 68 | |
| 63 | | WRITE8_MEMBER(quizdna_state::quizdna_bg_ram_w) |
| 69 | WRITE8_MEMBER(quizdna_state::bg_ram_w) |
| 64 | 70 | { |
| 65 | 71 | UINT8 *RAM = memregion("maincpu")->base(); |
| 66 | 72 | m_bg_ram[offset] = data; |
| r245603 | r245604 | |
| 69 | 75 | m_bg_tilemap->mark_tile_dirty((offset & 0xfff) / 2 ); |
| 70 | 76 | } |
| 71 | 77 | |
| 72 | | WRITE8_MEMBER(quizdna_state::quizdna_fg_ram_w) |
| 78 | WRITE8_MEMBER(quizdna_state::fg_ram_w) |
| 73 | 79 | { |
| 74 | 80 | int i; |
| 75 | 81 | int offs = offset & 0xfff; |
| r245603 | r245604 | |
| 83 | 89 | m_fg_tilemap->mark_tile_dirty(((offs/2) & 0x1f) + i*0x20 ); |
| 84 | 90 | } |
| 85 | 91 | |
| 86 | | WRITE8_MEMBER(quizdna_state::quizdna_bg_yscroll_w) |
| 92 | WRITE8_MEMBER(quizdna_state::bg_yscroll_w) |
| 87 | 93 | { |
| 88 | 94 | m_bg_tilemap->set_scrolldy(255-data, 255-data+1 ); |
| 89 | 95 | } |
| 90 | 96 | |
| 91 | | WRITE8_MEMBER(quizdna_state::quizdna_bg_xscroll_w) |
| 97 | WRITE8_MEMBER(quizdna_state::bg_xscroll_w) |
| 92 | 98 | { |
| 93 | 99 | int x; |
| 94 | 100 | m_bg_xscroll[offset] = data; |
| r245603 | r245604 | |
| 97 | 103 | m_bg_tilemap->set_scrolldx(x+64, x-64+10 ); |
| 98 | 104 | } |
| 99 | 105 | |
| 100 | | WRITE8_MEMBER(quizdna_state::quizdna_screen_ctrl_w) |
| 106 | WRITE8_MEMBER(quizdna_state::screen_ctrl_w) |
| 101 | 107 | { |
| 102 | 108 | int tmp = (data & 0x10) >> 4; |
| 103 | 109 | m_video_enable = data & 0x20; |
| r245603 | r245604 | |
| 132 | 138 | |
| 133 | 139 | void quizdna_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 134 | 140 | { |
| 135 | | UINT8 *spriteram = m_spriteram; |
| 136 | | int offs; |
| 137 | | |
| 138 | | for (offs = 0; offs<m_spriteram.bytes(); offs+=8) |
| 141 | for (int offs = 0; offs<m_spriteram.bytes(); offs+=8) |
| 139 | 142 | { |
| 140 | | int i; |
| 141 | | |
| 142 | | int x = spriteram[offs + 3]*0x100 + spriteram[offs + 2] + 64 - 8; |
| 143 | | int y = (spriteram[offs + 1] & 1)*0x100 + spriteram[offs + 0]; |
| 144 | | int code = (spriteram[offs + 5] * 0x100 + spriteram[offs + 4]) & 0x3fff; |
| 145 | | int col = spriteram[offs + 6]; |
| 143 | int x = m_spriteram[offs + 3]*0x100 + m_spriteram[offs + 2] + 64 - 8; |
| 144 | int y = (m_spriteram[offs + 1] & 1)*0x100 + m_spriteram[offs + 0]; |
| 145 | int code = (m_spriteram[offs + 5] * 0x100 + m_spriteram[offs + 4]) & 0x3fff; |
| 146 | int col = m_spriteram[offs + 6]; |
| 146 | 147 | int fx = col & 0x80; |
| 147 | 148 | int fy = col & 0x40; |
| 148 | | int ysize = (spriteram[offs + 1] & 0xc0) >> 6; |
| 149 | int ysize = (m_spriteram[offs + 1] & 0xc0) >> 6; |
| 149 | 150 | int dy = 0x10; |
| 150 | 151 | col &= 0x1f; |
| 151 | 152 | |
| r245603 | r245604 | |
| 168 | 169 | if (code >= 0x2100) |
| 169 | 170 | code &= 0x20ff; |
| 170 | 171 | |
| 171 | | for (i=0; i<ysize+1; i++) |
| 172 | for (int i=0; i<ysize+1; i++) |
| 172 | 173 | { |
| 173 | 174 | y &= 0x1ff; |
| 174 | 175 | |
| r245603 | r245604 | |
| 183 | 184 | } |
| 184 | 185 | } |
| 185 | 186 | |
| 186 | | UINT32 quizdna_state::screen_update_quizdna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 187 | UINT32 quizdna_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 187 | 188 | { |
| 188 | 189 | if (m_video_enable) |
| 189 | 190 | { |