trunk/src/mame/drivers/dreambal.c
| r0 | r21648 | |
| 1 | /* Dream Ball |
| 2 | |
| 3 | PCB DE-0386-2 |
| 4 | (also has DEC-22V0 like many Data East PCBS) |
| 5 | |
| 6 | Customs |
| 7 | 104 (I/O, Protection) |
| 8 | 59 (68000 CPU) |
| 9 | 141 (Tilemap GFX) |
| 10 | 71 (usually sprites? or mixer?) |
| 11 | |
| 12 | */ |
| 13 | |
| 14 | #include "emu.h" |
| 15 | #include "cpu/z80/z80.h" |
| 16 | #include "cpu/m68000/m68000.h" |
| 17 | #include "includes/decocrpt.h" |
| 18 | #include "sound/okim6295.h" |
| 19 | #include "video/deco16ic.h" |
| 20 | #include "video/decospr.h" |
| 21 | |
| 22 | class dreambal_state : public driver_device |
| 23 | { |
| 24 | public: |
| 25 | dreambal_state(const machine_config &mconfig, device_type type, const char *tag) |
| 26 | : driver_device(mconfig, type, tag)/* , |
| 27 | |
| 28 | m_pf1_rowscroll(*this, "pf1_rowscroll"), |
| 29 | m_pf2_rowscroll(*this, "pf2_rowscroll"), |
| 30 | m_spriteram(*this, "spriteram"), |
| 31 | m_sprgen(*this, "spritegen") |
| 32 | */ |
| 33 | { } |
| 34 | |
| 35 | /* memory pointers */ |
| 36 | /* |
| 37 | required_shared_ptr<UINT16> m_pf1_rowscroll; |
| 38 | required_shared_ptr<UINT16> m_pf2_rowscroll; |
| 39 | required_shared_ptr<UINT16> m_spriteram; |
| 40 | optional_device<decospr_device> m_sprgen; |
| 41 | */ |
| 42 | |
| 43 | /* devices */ |
| 44 | cpu_device *m_maincpu; |
| 45 | device_t *m_deco_tilegen1; |
| 46 | |
| 47 | DECLARE_DRIVER_INIT(dreambal); |
| 48 | virtual void machine_start(); |
| 49 | virtual void machine_reset(); |
| 50 | UINT32 screen_update_dreambal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 51 | }; |
| 52 | |
| 53 | #if 0 |
| 54 | UINT16 dreambal_pri_callback(UINT16 x) |
| 55 | { |
| 56 | UINT16 pri = (x & 0xc000); // 2 bits or 1? |
| 57 | switch (pri & 0xc000) |
| 58 | { |
| 59 | case 0x0000: pri = 0; break; |
| 60 | case 0x4000: pri = 0xf0; break; |
| 61 | case 0x8000: pri = 0xf0 | 0xcc; break; |
| 62 | case 0xc000: pri = 0xf0 | 0xcc; break; /* or 0xf0|0xcc|0xaa ? */ |
| 63 | } |
| 64 | |
| 65 | return pri; |
| 66 | } |
| 67 | #endif |
| 68 | |
| 69 | |
| 70 | UINT32 dreambal_state::screen_update_dreambal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 71 | { |
| 72 | #if 0 |
| 73 | address_space &space = generic_space(); |
| 74 | UINT16 flip = deco16ic_pf_control_r(m_deco_tilegen1, space, 0, 0xffff); |
| 75 | |
| 76 | flip_screen_set(BIT(flip, 7)); |
| 77 | deco16ic_pf_update(m_deco_tilegen1, m_pf1_rowscroll, m_pf2_rowscroll); |
| 78 | |
| 79 | bitmap.fill(0, cliprect); /* not Confirmed */ |
| 80 | machine().priority_bitmap.fill(0); |
| 81 | |
| 82 | deco16ic_tilemap_2_draw(m_deco_tilegen1, bitmap, cliprect, 0, 2); |
| 83 | deco16ic_tilemap_1_draw(m_deco_tilegen1, bitmap, cliprect, 0, 4); |
| 84 | m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram, 0x400); |
| 85 | #endif |
| 86 | return 0; |
| 87 | } |
| 88 | |
| 89 | |
| 90 | static ADDRESS_MAP_START( dreambal_map, AS_PROGRAM, 16, dreambal_state ) |
| 91 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 92 | ADDRESS_MAP_END |
| 93 | |
| 94 | |
| 95 | static const gfx_layout tile_8x8_layout = |
| 96 | { |
| 97 | 8,8, |
| 98 | RGN_FRAC(1,2), |
| 99 | 4, |
| 100 | { RGN_FRAC(1,2)+8,RGN_FRAC(1,2)+0,RGN_FRAC(0,2)+8,RGN_FRAC(0,2)+0 }, |
| 101 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 102 | { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, |
| 103 | 8*16 |
| 104 | }; |
| 105 | |
| 106 | static const gfx_layout tile_16x16_layout = |
| 107 | { |
| 108 | 16,16, |
| 109 | RGN_FRAC(1,2), |
| 110 | 4, |
| 111 | { RGN_FRAC(1,2)+8,RGN_FRAC(1,2)+0,RGN_FRAC(0,2)+8,RGN_FRAC(0,2)+0 }, |
| 112 | { 256,257,258,259,260,261,262,263,0, 1, 2, 3, 4, 5, 6, 7 }, |
| 113 | { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16,9*16,10*16,11*16,12*16,13*16,14*16,15*16 }, |
| 114 | 32*16 |
| 115 | }; |
| 116 | |
| 117 | /* |
| 118 | static const gfx_layout spritelayout = |
| 119 | { |
| 120 | 16,16, |
| 121 | RGN_FRAC(1,1), |
| 122 | 4, |
| 123 | { 24,8,16,0 }, |
| 124 | { 512,513,514,515,516,517,518,519, 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 125 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, |
| 126 | 8*32, 9*32,10*32,11*32,12*32,13*32,14*32,15*32}, |
| 127 | 32*32 |
| 128 | }; |
| 129 | */ |
| 130 | |
| 131 | static GFXDECODE_START( dreambal ) |
| 132 | GFXDECODE_ENTRY( "gfx1", 0, tile_8x8_layout, 0x000, 32 ) /* Tiles (8x8) */ |
| 133 | GFXDECODE_ENTRY( "gfx1", 0, tile_16x16_layout, 0x000, 32 ) /* Tiles (16x16) */ |
| 134 | // GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0x200, 32 ) /* Sprites (16x16) */ |
| 135 | GFXDECODE_END |
| 136 | |
| 137 | static INPUT_PORTS_START( dreambal ) |
| 138 | PORT_START("UNK") |
| 139 | PORT_DIPNAME( 0x0001, 0x0001, "2" ) |
| 140 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| 141 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 142 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) |
| 143 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) |
| 144 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 145 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) |
| 146 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) |
| 147 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 148 | PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( Unknown ) ) |
| 149 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) |
| 150 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 151 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) |
| 152 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) |
| 153 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 154 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) |
| 155 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) |
| 156 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 157 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) |
| 158 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) |
| 159 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 160 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) |
| 161 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 162 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 163 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) |
| 164 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) |
| 165 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 166 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) |
| 167 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) |
| 168 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 169 | PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) |
| 170 | PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) |
| 171 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 172 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) |
| 173 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) |
| 174 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 175 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) |
| 176 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) |
| 177 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 178 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) |
| 179 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) |
| 180 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 181 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) |
| 182 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) |
| 183 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 184 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) |
| 185 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 186 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 187 | INPUT_PORTS_END |
| 188 | |
| 189 | static int dreambal_bank_callback( const int bank ) |
| 190 | { |
| 191 | return ((bank >> 4) & 0x7) * 0x1000; |
| 192 | } |
| 193 | |
| 194 | static const deco16ic_interface dreambal_deco16ic_tilegen1_intf = |
| 195 | { |
| 196 | "screen", |
| 197 | 0, 1, |
| 198 | 0x0f, 0x0f, /* trans masks (default values) */ |
| 199 | 0, 16, /* color base (default values) */ |
| 200 | 0x0f, 0x0f, /* color masks (default values) */ |
| 201 | dreambal_bank_callback, |
| 202 | dreambal_bank_callback, |
| 203 | 0,1, |
| 204 | }; |
| 205 | |
| 206 | void dreambal_state::machine_start() |
| 207 | { |
| 208 | m_maincpu = machine().device<cpu_device>("maincpu"); |
| 209 | m_deco_tilegen1 = machine().device("tilegen1"); |
| 210 | |
| 211 | |
| 212 | } |
| 213 | |
| 214 | void dreambal_state::machine_reset() |
| 215 | { |
| 216 | |
| 217 | } |
| 218 | |
| 219 | // xtals = 28.000, 9.8304 |
| 220 | static MACHINE_CONFIG_START( dreambal, dreambal_state ) |
| 221 | |
| 222 | /* basic machine hardware */ |
| 223 | MCFG_CPU_ADD("maincpu", M68000, 28000000/2) |
| 224 | MCFG_CPU_PROGRAM_MAP(dreambal_map) |
| 225 | // MCFG_CPU_VBLANK_INT_DRIVER("screen", dreambal_state, irq6_line_hold) |
| 226 | |
| 227 | /* video hardware */ |
| 228 | MCFG_SCREEN_ADD("screen", RASTER) |
| 229 | MCFG_SCREEN_REFRESH_RATE(58) |
| 230 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
| 231 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 232 | MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) |
| 233 | MCFG_SCREEN_UPDATE_DRIVER(dreambal_state, screen_update_dreambal) |
| 234 | |
| 235 | MCFG_PALETTE_LENGTH(4096) |
| 236 | MCFG_GFXDECODE(dreambal) |
| 237 | |
| 238 | MCFG_DECO16IC_ADD("tilegen1", dreambal_deco16ic_tilegen1_intf) |
| 239 | /* |
| 240 | MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) |
| 241 | decospr_device::set_gfx_region(*device, 2); |
| 242 | decospr_device::set_pri_callback(*device, dreambal_pri_callback); |
| 243 | */ |
| 244 | /* sound hardware */ |
| 245 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 246 | |
| 247 | MCFG_OKIM6295_ADD("oki", 9830400/8, OKIM6295_PIN7_HIGH) |
| 248 | |
| 249 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 250 | MACHINE_CONFIG_END |
| 251 | |
| 252 | |
| 253 | |
| 254 | ROM_START( dreambal ) |
| 255 | ROM_REGION( 0x80000, "maincpu", 0 ) |
| 256 | ROM_LOAD16_WORD_SWAP( "mm_00-2.1c", 0x000001, 0x020000, CRC(257f6ad1) SHA1(7b232ce2d503e6f21286176974f6b74052f76d07) ) |
| 257 | |
| 258 | ROM_REGION( 0x80000, "gfx1", 0 ) |
| 259 | ROM_LOAD( "mm_01-1.12b", 0x00000, 0x80000, CRC(dc9cc708) SHA1(03b8e6aa37e0107514a2498849208d2bd51a4163) ) |
| 260 | |
| 261 | ROM_REGION( 0x80000, "oki", 0 ) /* Oki samples */ |
| 262 | ROM_LOAD( "mm_01-1.12f", 0x00000, 0x20000, CRC(4f134be7) SHA1(b83230cc62bde55be736fd604af23f927706a770) ) |
| 263 | |
| 264 | ROM_REGION( 0x80000, "eeprom", 0 ) /* EEPROM */ |
| 265 | ROM_LOAD( "93lc46b.8f", 0x00000, 0x80, CRC(5ba5403f) SHA1(cad63d704d81db5c45826d485c5e3a0679fba152) ) |
| 266 | |
| 267 | ROM_END |
| 268 | |
| 269 | DRIVER_INIT_MEMBER(dreambal_state,dreambal) |
| 270 | { |
| 271 | deco56_decrypt_gfx(machine(), "gfx1"); |
| 272 | } |
| 273 | |
| 274 | |
| 275 | GAME( 199?, dreambal, 0, dreambal, dreambal, dreambal_state, dreambal, ROT0, "Data East", "Dream Ball", GAME_NOT_WORKING ) |