trunk/hash/svmu.xml
| r22615 | r22616 | |
| 7 | 7 | <description>Chao Adventure</description> |
| 8 | 8 | <year>1999</year> |
| 9 | 9 | <publisher>Sega</publisher> |
| 10 | | <info name="source" value="Sonic Adventure" /> |
| 10 | <info name="source" value="Sonic Adventure" /> |
| 11 | 11 | <part name="quik" interface="svmu_quik"> |
| 12 | 12 | <dataarea name="rom" size="65536"> |
| 13 | 13 | <rom name="chao adventure (1999)(sega)[sonic adventure].vms" size="65536" crc="09e93592" sha1="f35738795fd1799bbffb6c3df8d4f208ccf437b5" offset="0" /> |
| r22615 | r22616 | |
| 19 | 19 | <description>Chao Adventure 2</description> |
| 20 | 20 | <year>2001</year> |
| 21 | 21 | <publisher>Sega</publisher> |
| 22 | | <info name="source" value="Sonic Adventure 2" /> |
| 22 | <info name="source" value="Sonic Adventure 2" /> |
| 23 | 23 | <part name="quik" interface="svmu_quik"> |
| 24 | 24 | <dataarea name="rom" size="65536"> |
| 25 | 25 | <rom name="chao adventure 2 (sega)(2001)[sonic adventure 2].vms" size="65536" crc="9c464d76" sha1="4190654ed0cede2d852fbe7c7f612a4c1b4a45b3" offset="0" /> |
| r22615 | r22616 | |
| 31 | 31 | <description>Chao Adventure 2 (Fra)</description> |
| 32 | 32 | <year>2001</year> |
| 33 | 33 | <publisher>Sega</publisher> |
| 34 | | <info name="source" value="Sonic Adventure 2" /> |
| 34 | <info name="source" value="Sonic Adventure 2" /> |
| 35 | 35 | <part name="quik" interface="svmu_quik"> |
| 36 | 36 | <dataarea name="rom" size="65536"> |
| 37 | 37 | <rom name="chao adventure 2 (2001)(sega)(fr)[sonic adventure 2].vms" size="65536" crc="20f25e00" sha1="6e57f9447fdbcf69fddbb3b7a187f7043dcd9de0" offset="0" /> |
| r22615 | r22616 | |
| 43 | 43 | <description>Linear Watch</description> |
| 44 | 44 | <year>2000</year> |
| 45 | 45 | <publisher>ESP Software</publisher> |
| 46 | | <info name="source" value="Evolution 2" /> |
| 46 | <info name="source" value="Evolution 2" /> |
| 47 | 47 | <part name="quik" interface="svmu_quik"> |
| 48 | 48 | <dataarea name="rom" size="15360"> |
| 49 | 49 | <rom name="linear watch (2000)(esp software)[evolution 2].vms" size="15360" crc="16b6f34c" sha1="556b7d4235c08e03e1eec0bb6527f63dc5ec78a4" offset="0" /> |
| r22615 | r22616 | |
| 55 | 55 | <description>Marvel VS. Capcom 2 vs. Com (Jpn)</description> |
| 56 | 56 | <year>2000</year> |
| 57 | 57 | <publisher>Capcom</publisher> |
| 58 | | <info name="source" value="Marvel vs. Capcom 2" /> |
| 58 | <info name="source" value="Marvel vs. Capcom 2" /> |
| 59 | 59 | <part name="quik" interface="svmu_quik"> |
| 60 | 60 | <dataarea name="rom" size="32768"> |
| 61 | 61 | <rom name="marvel vs. capcom 2 vs. com (2000)(capcom)(jp)[marvel vs. capcom 2].vms" size="32768" crc="3f621910" sha1="b52bed579019bec07b818c802b72277be0c4430c" offset="0" /> |
| r22615 | r22616 | |
| 67 | 67 | <description>Pop 'n Music Vol. 1 (Jpn)</description> |
| 68 | 68 | <year>1999</year> |
| 69 | 69 | <publisher>Konami</publisher> |
| 70 | | <info name="source" value="Pop 'n Music" /> |
| 70 | <info name="source" value="Pop 'n Music" /> |
| 71 | 71 | <part name="quik" interface="svmu_quik"> |
| 72 | 72 | <dataarea name="rom" size="28672"> |
| 73 | 73 | <rom name="pop 'n music vol. 1 (1999)(konami)(jp)[pop 'n music].vms" size="28672" crc="7ce75350" sha1="339ebf13c557c14851e171202d3b105dee9fce6b" offset="0" /> |
| r22615 | r22616 | |
| 79 | 79 | <description>Pop 'n Music Vol. 2 (Jpn)</description> |
| 80 | 80 | <year>2000</year> |
| 81 | 81 | <publisher>Konami</publisher> |
| 82 | | <info name="source" value="Pop 'n Music" /> |
| 82 | <info name="source" value="Pop 'n Music" /> |
| 83 | 83 | <part name="quik" interface="svmu_quik"> |
| 84 | 84 | <dataarea name="rom" size="30720"> |
| 85 | 85 | <rom name="pop 'n music vol. 2 (2000)(konami)(jp)[pop 'n music].vms" size="30720" crc="c2a1cd70" sha1="3dfbd8cf625728040676e17409b10914cb9917e7" offset="0" /> |
| r22615 | r22616 | |
| 91 | 91 | <description>Pop 'n Music Vol. 3 (Jpn)</description> |
| 92 | 92 | <year>2000</year> |
| 93 | 93 | <publisher>Konami</publisher> |
| 94 | | <info name="source" value="Pop 'n Music" /> |
| 94 | <info name="source" value="Pop 'n Music" /> |
| 95 | 95 | <part name="quik" interface="svmu_quik"> |
| 96 | 96 | <dataarea name="rom" size="30720"> |
| 97 | 97 | <rom name="pop 'n music vol. 3 (2000)(konami)(jp)[pop 'n music].vms" size="30720" crc="96fef522" sha1="56a46d89187a04d26fe20cc4b697b23eebedb96e" offset="0" /> |
| r22615 | r22616 | |
| 103 | 103 | <description>Powerstone Mini</description> |
| 104 | 104 | <year>1999</year> |
| 105 | 105 | <publisher>Capcom</publisher> |
| 106 | | <info name="source" value="Power Stone" /> |
| 106 | <info name="source" value="Power Stone" /> |
| 107 | 107 | <part name="quik" interface="svmu_quik"> |
| 108 | 108 | <dataarea name="rom" size="65536"> |
| 109 | 109 | <rom name="powerstone mini (1999)(capcom)[power stone].vms" size="65536" crc="04d6a41f" sha1="177781ab7023de28216b33d237d2ee7e57b66205" offset="0" /> |
| r22615 | r22616 | |
| 115 | 115 | <description>Power Stone 2 Mini Store (Jpn)</description> |
| 116 | 116 | <year>2000</year> |
| 117 | 117 | <publisher>Capcom</publisher> |
| 118 | | <info name="source" value="Power Stone 2" /> |
| 118 | <info name="source" value="Power Stone 2" /> |
| 119 | 119 | <part name="quik" interface="svmu_quik"> |
| 120 | 120 | <dataarea name="rom" size="65536"> |
| 121 | 121 | <rom name="power stone 2 mini store (2000)(capcom)(jp)[power stone 2].vms" size="65536" crc="81d456d2" sha1="6ff653848c3dc3205d72363357fc63db4cbf359c" offset="0" /> |
| r22615 | r22616 | |
| 127 | 127 | <description>Sega GT Pocket America</description> |
| 128 | 128 | <year>2000</year> |
| 129 | 129 | <publisher>Sega</publisher> |
| 130 | | <info name="source" value="Sega GT" /> |
| 130 | <info name="source" value="Sega GT" /> |
| 131 | 131 | <part name="quik" interface="svmu_quik"> |
| 132 | 132 | <dataarea name="rom" size="65536"> |
| 133 | 133 | <rom name="sega gt pocket america (2000)(sega - wow-ent)[sega gt].vms" size="65536" crc="20084dc1" sha1="5268f5a02bc21239fd0ea2d25b08cbc00bc83220" offset="0" /> |
| r22615 | r22616 | |
| 139 | 139 | <description>Sega GT (Jpn)</description> |
| 140 | 140 | <year>2000</year> |
| 141 | 141 | <publisher>Sega</publisher> |
| 142 | | <info name="source" value="Sega GT" /> |
| 142 | <info name="source" value="Sega GT" /> |
| 143 | 143 | <part name="quik" interface="svmu_quik"> |
| 144 | 144 | <dataarea name="rom" size="65536"> |
| 145 | 145 | <rom name="sega gt (2000)(sega)(jp)[sega gt].vms" size="65536" crc="9eed83ea" sha1="8ea70e846a9a42877a62a790d8329dd72fe4749f" offset="0" /> |
| r22615 | r22616 | |
| 151 | 151 | <description>Sega GT Pocket Europe</description> |
| 152 | 152 | <year>2000</year> |
| 153 | 153 | <publisher>Sega</publisher> |
| 154 | | <info name="source" value="Sega GT" /> |
| 154 | <info name="source" value="Sega GT" /> |
| 155 | 155 | <part name="quik" interface="svmu_quik"> |
| 156 | 156 | <dataarea name="rom" size="65536"> |
| 157 | 157 | <rom name="sega gt pocket europe (2000)(sega - wow-ent)[sega gt].vms" size="65536" crc="c8490720" sha1="e82dce08ad914ff275f1cfcf64e90d4c8c00d58a" offset="0" /> |
| r22615 | r22616 | |
| 163 | 163 | <description>Sega GT Pocket Japan</description> |
| 164 | 164 | <year>2000</year> |
| 165 | 165 | <publisher>Sega</publisher> |
| 166 | | <info name="source" value="Sega GT" /> |
| 166 | <info name="source" value="Sega GT" /> |
| 167 | 167 | <part name="quik" interface="svmu_quik"> |
| 168 | 168 | <dataarea name="rom" size="65536"> |
| 169 | 169 | <rom name="sega gt pocket japan (2000)(sega - wow-ent)[sega gt].vms" size="65536" crc="7d4b5c34" sha1="32e0dae07dd17de9981c84de9e12b2af6677353d" offset="0" /> |
| r22615 | r22616 | |
| 175 | 175 | <description>Shenmue (Jpn)</description> |
| 176 | 176 | <year>1999</year> |
| 177 | 177 | <publisher>Sega</publisher> |
| 178 | | <info name="source" value="Shenmue" /> |
| 178 | <info name="source" value="Shenmue" /> |
| 179 | 179 | <part name="quik" interface="svmu_quik"> |
| 180 | 180 | <dataarea name="rom" size="25600"> |
| 181 | 181 | <rom name="shenmue (1999)(sega)(jp)[shenmue].vms" size="25600" crc="3fcab726" sha1="ea52613cf39b965266ad32501d8caa6286de4e57" offset="0" /> |
| r22615 | r22616 | |
| 187 | 187 | <description>Soul Calibur 3-1 Mini (Jpn)</description> |
| 188 | 188 | <year>1999</year> |
| 189 | 189 | <publisher>Namco</publisher> |
| 190 | | <info name="source" value="SoulCalibur" /> |
| 190 | <info name="source" value="SoulCalibur" /> |
| 191 | 191 | <part name="quik" interface="svmu_quik"> |
| 192 | 192 | <dataarea name="rom" size="50176"> |
| 193 | 193 | <rom name="soul calibur 3-1 mini (1999)(namco)(jp)[soulcalibur].vms" size="50176" crc="d23dfe42" sha1="bf34e85fb481a3e920dab7517dd170c28f5c4ad5" offset="0" /> |
| r22615 | r22616 | |
| 199 | 199 | <description>SoulCalibur Text Adventure (Jpn)</description> |
| 200 | 200 | <year>1999</year> |
| 201 | 201 | <publisher>Namco</publisher> |
| 202 | | <info name="source" value="SoulCalibur" /> |
| 202 | <info name="source" value="SoulCalibur" /> |
| 203 | 203 | <part name="quik" interface="svmu_quik"> |
| 204 | 204 | <dataarea name="rom" size="50688"> |
| 205 | 205 | <rom name="soulcalibur text adventure (1999)(namco)(jp)[soulcalibur].vms" size="50688" crc="eedc89ee" sha1="3783708b76cdfd2a5f027c39ff45236c1244baa4" offset="0" /> |
| r22615 | r22616 | |
| 211 | 211 | <description>SoulCalibur VMU Game Pack </description> |
| 212 | 212 | <year>1999</year> |
| 213 | 213 | <publisher>Namco</publisher> |
| 214 | | <info name="source" value="SoulCalibur" /> |
| 214 | <info name="source" value="SoulCalibur" /> |
| 215 | 215 | <part name="quik" interface="svmu_quik"> |
| 216 | 216 | <dataarea name="rom" size="50176"> |
| 217 | 217 | <rom name="soulcalibur vmu game pack (1999)(namco)[soulcalibur].vms" size="50176" crc="6068eb49" sha1="b3d87d67b8ca59887e9680b4213239881bb4360c" offset="0" /> |
| r22615 | r22616 | |
| 223 | 223 | <description>TrickStyle Junior</description> |
| 224 | 224 | <year>1999</year> |
| 225 | 225 | <publisher>Acclaim</publisher> |
| 226 | | <info name="source" value="TrickStyle" /> |
| 226 | <info name="source" value="TrickStyle" /> |
| 227 | 227 | <part name="quik" interface="svmu_quik"> |
| 228 | 228 | <dataarea name="rom" size="3584"> |
| 229 | 229 | <rom name="trickstyle junior (1999)(acclaim)[trickstyle].vms" size="3584" crc="966659f9" sha1="5b46e07f30ecf53ebdfc17eb4accaf3e3d4fa92a" offset="0" /> |
| r22615 | r22616 | |
| 247 | 247 | <description>Zombie Revenge Training Game</description> |
| 248 | 248 | <year>1999</year> |
| 249 | 249 | <publisher>Sega</publisher> |
| 250 | | <info name="source" value="Zombie Revenge" /> |
| 250 | <info name="source" value="Zombie Revenge" /> |
| 251 | 251 | <part name="quik" interface="svmu_quik"> |
| 252 | 252 | <dataarea name="rom" size="56320"> |
| 253 | 253 | <rom name="zombie revenge training game (1999)(sega)[zombie revenge].vms" size="56320" crc="7b4ce3c7" sha1="68b584f7c5c7ac119c12641e8b1f01a726c58881" offset="0" /> |
trunk/src/mame/drivers/gluck2.c
| r22615 | r22616 | |
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | #define MASTER_CLOCK XTAL_10MHz |
| 192 | | #define SND_CLOCK XTAL_3_579545MHz |
| 192 | #define SND_CLOCK XTAL_3_579545MHz |
| 193 | 193 | |
| 194 | 194 | #include "emu.h" |
| 195 | 195 | #include "cpu/m6502/m6502.h" |
| r22615 | r22616 | |
| 250 | 250 | */ |
| 251 | 251 | int attr = m_colorram[tile_index]; |
| 252 | 252 | int code = m_videoram[tile_index]; |
| 253 | | int bank = ((attr & 0xc0) >> 5 ) + ((attr & 0x02) >> 1 ); /* bits 1-6-7 handle the gfx banks */ |
| 254 | | int color = (attr & 0x3c) >> 2; /* bits 2-3-4-5 handle the color */ |
| 253 | int bank = ((attr & 0xc0) >> 5 ) + ((attr & 0x02) >> 1 ); /* bits 1-6-7 handle the gfx banks */ |
| 254 | int color = (attr & 0x3c) >> 2; /* bits 2-3-4-5 handle the color */ |
| 255 | 255 | |
| 256 | 256 | SET_TILE_INFO_MEMBER(bank, code, color, 0); |
| 257 | 257 | } |
| r22615 | r22616 | |
| 337 | 337 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") |
| 338 | 338 | AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_device, address_w) |
| 339 | 339 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) |
| 340 | | AM_RANGE(0x0844, 0x084b) AM_NOP /* see below */ |
| 340 | AM_RANGE(0x0844, 0x084b) AM_NOP /* see below */ |
| 341 | 341 | AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(gluck2_videoram_w) AM_SHARE("videoram") /* 6116 #1 (2K x 8) RAM (only 1st half used) */ |
| 342 | 342 | AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(gluck2_colorram_w) AM_SHARE("colorram") /* 6116 #2 (2K x 8) RAM (only 1st half used) */ |
| 343 | 343 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW1") |
| r22615 | r22616 | |
| 367 | 367 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) |
| 368 | 368 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) |
| 369 | 369 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) |
| 370 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_NAME("Note In") |
| 370 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_NAME("Note In") |
| 371 | 371 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) |
| 372 | 372 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 373 | 373 | |
| r22615 | r22616 | |
| 391 | 391 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") |
| 392 | 392 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 393 | 393 | |
| 394 | | PORT_START("SW1") // 2000 |
| 395 | | PORT_DIPNAME( 0x01, 0x01, "Paytable" ) PORT_DIPLOCATION("SW1:1") |
| 394 | PORT_START("SW1") // 2000 |
| 395 | PORT_DIPNAME( 0x01, 0x01, "Paytable" ) PORT_DIPLOCATION("SW1:1") |
| 396 | 396 | PORT_DIPSETTING( 0x01, "Strings and Numbers" ) |
| 397 | 397 | PORT_DIPSETTING( 0x00, "Only Numbers" ) |
| 398 | | PORT_DIPNAME( 0x02, 0x02, "SW1:2" ) PORT_DIPLOCATION("SW1:2") |
| 398 | PORT_DIPNAME( 0x02, 0x02, "SW1:2" ) PORT_DIPLOCATION("SW1:2") |
| 399 | 399 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 400 | 400 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 401 | | PORT_DIPNAME( 0x04, 0x04, "SW1:3" ) PORT_DIPLOCATION("SW1:3") |
| 401 | PORT_DIPNAME( 0x04, 0x04, "SW1:3" ) PORT_DIPLOCATION("SW1:3") |
| 402 | 402 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 403 | 403 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 404 | | PORT_DIPNAME( 0x08, 0x08, "SW1:4" ) PORT_DIPLOCATION("SW1:4") |
| 404 | PORT_DIPNAME( 0x08, 0x08, "SW1:4" ) PORT_DIPLOCATION("SW1:4") |
| 405 | 405 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 406 | 406 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 407 | | PORT_DIPNAME( 0x10, 0x10, "SW1:5" ) PORT_DIPLOCATION("SW1:5") |
| 407 | PORT_DIPNAME( 0x10, 0x10, "SW1:5" ) PORT_DIPLOCATION("SW1:5") |
| 408 | 408 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 409 | 409 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 410 | | PORT_DIPNAME( 0x20, 0x20, "SW1:6" ) PORT_DIPLOCATION("SW1:6") |
| 410 | PORT_DIPNAME( 0x20, 0x20, "SW1:6" ) PORT_DIPLOCATION("SW1:6") |
| 411 | 411 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 412 | 412 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 413 | | PORT_DIPNAME( 0x40, 0x40, "SW1:7" ) PORT_DIPLOCATION("SW1:7") |
| 413 | PORT_DIPNAME( 0x40, 0x40, "SW1:7" ) PORT_DIPLOCATION("SW1:7") |
| 414 | 414 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 415 | 415 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 416 | | PORT_DIPNAME( 0x80, 0x80, "SW1:8" ) PORT_DIPLOCATION("SW1:8") |
| 416 | PORT_DIPNAME( 0x80, 0x80, "SW1:8" ) PORT_DIPLOCATION("SW1:8") |
| 417 | 417 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 418 | 418 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 419 | 419 | |
| 420 | | PORT_START("SW2") // 3D01: AY8910 port B |
| 421 | | PORT_DIPNAME( 0x01, 0x01, "SW2:8" ) PORT_DIPLOCATION("SW2:8") |
| 420 | PORT_START("SW2") // 3D01: AY8910 port B |
| 421 | PORT_DIPNAME( 0x01, 0x01, "SW2:8" ) PORT_DIPLOCATION("SW2:8") |
| 422 | 422 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 423 | 423 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 424 | | PORT_DIPNAME( 0x06, 0x02, "Bet Max" ) PORT_DIPLOCATION("SW2:7, 6") |
| 424 | PORT_DIPNAME( 0x06, 0x02, "Bet Max" ) PORT_DIPLOCATION("SW2:7, 6") |
| 425 | 425 | PORT_DIPSETTING( 0x00, "10" ) |
| 426 | 426 | PORT_DIPSETTING( 0x02, "20" ) |
| 427 | 427 | PORT_DIPSETTING( 0x04, "30" ) |
| 428 | 428 | PORT_DIPSETTING( 0x06, "40" ) |
| 429 | | PORT_DIPNAME( 0x08, 0x08, "SW2:5" ) PORT_DIPLOCATION("SW2:5") |
| 429 | PORT_DIPNAME( 0x08, 0x08, "SW2:5" ) PORT_DIPLOCATION("SW2:5") |
| 430 | 430 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 431 | 431 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 432 | | PORT_DIPNAME( 0x10, 0x10, "SW2:4" ) PORT_DIPLOCATION("SW2:4") |
| 432 | PORT_DIPNAME( 0x10, 0x10, "SW2:4" ) PORT_DIPLOCATION("SW2:4") |
| 433 | 433 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 434 | 434 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 435 | | PORT_DIPNAME( 0x20, 0x20, "SW2:3" ) PORT_DIPLOCATION("SW2:3") |
| 435 | PORT_DIPNAME( 0x20, 0x20, "SW2:3" ) PORT_DIPLOCATION("SW2:3") |
| 436 | 436 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 437 | 437 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 438 | | PORT_DIPNAME( 0xc0, 0xc0, "Note In" ) PORT_DIPLOCATION("SW2:2, 1") |
| 438 | PORT_DIPNAME( 0xc0, 0xc0, "Note In" ) PORT_DIPLOCATION("SW2:2, 1") |
| 439 | 439 | PORT_DIPSETTING( 0x00, "10" ) |
| 440 | 440 | PORT_DIPSETTING( 0x40, "20" ) |
| 441 | 441 | PORT_DIPSETTING( 0x80, "50" ) |
| 442 | 442 | PORT_DIPSETTING( 0xc0, "100" ) |
| 443 | 443 | |
| 444 | | PORT_START("SW3") // 3D01: AY8910 port A |
| 445 | | PORT_DIPNAME( 0x01, 0x01, "SW3:1" ) PORT_DIPLOCATION("SW3:1") |
| 444 | PORT_START("SW3") // 3D01: AY8910 port A |
| 445 | PORT_DIPNAME( 0x01, 0x01, "SW3:1" ) PORT_DIPLOCATION("SW3:1") |
| 446 | 446 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 447 | 447 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 448 | | PORT_DIPNAME( 0x02, 0x02, "SW3:8" ) PORT_DIPLOCATION("SW3:8") |
| 448 | PORT_DIPNAME( 0x02, 0x02, "SW3:8" ) PORT_DIPLOCATION("SW3:8") |
| 449 | 449 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 450 | 450 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 451 | | PORT_DIPNAME( 0x04, 0x04, "Graphics" ) PORT_DIPLOCATION("SW3:7") |
| 451 | PORT_DIPNAME( 0x04, 0x04, "Graphics" ) PORT_DIPLOCATION("SW3:7") |
| 452 | 452 | PORT_DIPSETTING( 0x04, "Turtles" ) |
| 453 | 453 | PORT_DIPSETTING( 0x00, "Cards" ) |
| 454 | | PORT_DIPNAME( 0x18, 0x18, "Coin In" ) PORT_DIPLOCATION("SW3:6, 5") |
| 454 | PORT_DIPNAME( 0x18, 0x18, "Coin In" ) PORT_DIPLOCATION("SW3:6, 5") |
| 455 | 455 | PORT_DIPSETTING( 0x00, "1" ) |
| 456 | 456 | PORT_DIPSETTING( 0x08, "2" ) |
| 457 | 457 | PORT_DIPSETTING( 0x10, "5" ) |
| 458 | 458 | PORT_DIPSETTING( 0x18, "10" ) |
| 459 | | PORT_DIPNAME( 0x20, 0x20, "SW3:4" ) PORT_DIPLOCATION("SW3:4") |
| 459 | PORT_DIPNAME( 0x20, 0x20, "SW3:4" ) PORT_DIPLOCATION("SW3:4") |
| 460 | 460 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 461 | 461 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 462 | | PORT_DIPNAME( 0x40, 0x40, "SW3:3" ) PORT_DIPLOCATION("SW3:3") |
| 462 | PORT_DIPNAME( 0x40, 0x40, "SW3:3" ) PORT_DIPLOCATION("SW3:3") |
| 463 | 463 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 464 | 464 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 465 | | PORT_DIPNAME( 0x80, 0x80, "SW3:2" ) PORT_DIPLOCATION("SW3:2") |
| 465 | PORT_DIPNAME( 0x80, 0x80, "SW3:2" ) PORT_DIPLOCATION("SW3:2") |
| 466 | 466 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 467 | 467 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 468 | 468 | |
| r22615 | r22616 | |
| 476 | 476 | static const gfx_layout tilelayout = |
| 477 | 477 | { |
| 478 | 478 | 8, 8, |
| 479 | | 256, // 0x100 tiles per bank. |
| 479 | 256, // 0x100 tiles per bank. |
| 480 | 480 | 3, |
| 481 | 481 | { 0, RGN_FRAC(1,3), RGN_FRAC(2,3) }, |
| 482 | 482 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| r22615 | r22616 | |
| 535 | 535 | /* Output ports have a minimal activity during init. |
| 536 | 536 | They seems unused (at least for Good Luck II) |
| 537 | 537 | */ |
| 538 | | DEVCB_NULL, |
| 538 | DEVCB_NULL, |
| 539 | 539 | DEVCB_NULL |
| 540 | 540 | }; |
| 541 | 541 | |
| r22615 | r22616 | |
| 574 | 574 | /* sound hardware */ |
| 575 | 575 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 576 | 576 | |
| 577 | | MCFG_SOUND_ADD("ay8910", AY8910, MASTER_CLOCK/8) /* guess */ |
| 577 | MCFG_SOUND_ADD("ay8910", AY8910, MASTER_CLOCK/8) /* guess */ |
| 578 | 578 | MCFG_SOUND_CONFIG(ay8910_intf) |
| 579 | 579 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 580 | 580 | |
| r22615 | r22616 | |
| 597 | 597 | ROM_LOAD( "2.u32", 0x08000, 0x8000, CRC(6a621a98) SHA1(9c83eab9f0858735e0176e5335651dd2dc620229) ) |
| 598 | 598 | ROM_LOAD( "1.u31", 0x10000, 0x8000, CRC(ea33db1a) SHA1(69c67944f5e8bd060335b5e14628c0e0828271a4) ) |
| 599 | 599 | |
| 600 | | ROM_REGION( 0x0300, "proms", 0 ) // RGB |
| 600 | ROM_REGION( 0x0300, "proms", 0 ) // RGB |
| 601 | 601 | ROM_LOAD( "v1.u27", 0x0000, 0x0100, CRC(1aa5479f) SHA1(246cc99e7b351d5546060807b8a0b8acfe2f8e39) ) |
| 602 | 602 | ROM_LOAD( "v2.u26", 0x0100, 0x0100, CRC(8da53489) SHA1(b90f5dd4bc5b64009e8bfad8f79f23d4020e537b) ) |
| 603 | 603 | ROM_LOAD( "v3.u25", 0x0200, 0x0100, CRC(a4d2c9c3) SHA1(a799875b8b92391696419081244da2e56216e024) ) |
trunk/src/mame/drivers/pinball2k.c
| r22615 | r22616 | |
| 1 | | /* |
| 1 | /* |
| 2 | 2 | Pinball 2000 |
| 3 | | |
| 3 | |
| 4 | 4 | Skeleton by R. Belmont, based on mediagx.c by Ville Linde |
| 5 | | |
| 5 | |
| 6 | 6 | TODO: |
| 7 | | - Everything! |
| 8 | | - BIOS hangs waiting for port 0400h to return 0x80. If you make that happy it jumps off into the weeds. |
| 9 | | - MediaGX features should be moved out to machine/ and shared with mediagx.c once we know what these games need |
| 10 | | |
| 7 | - Everything! |
| 8 | - BIOS hangs waiting for port 0400h to return 0x80. If you make that happy it jumps off into the weeds. |
| 9 | - MediaGX features should be moved out to machine/ and shared with mediagx.c once we know what these games need |
| 10 | |
| 11 | 11 | Hardware: |
| 12 | | - Cyrix MediaGX processor/VGA |
| 13 | | - Cyrix CX5520 northbridge? |
| 14 | | - VS9824AG SuperI/O standard PC I/O chip |
| 15 | | - 1 ISA, 2 PCI slots, 2 IDE headers |
| 16 | | - "Prism" PCI card with PLX PCI9052 PCI-to-random stuff bridge |
| 17 | | Card also contains DCS2 Stereo sound system with ADSP-2104 |
| 12 | - Cyrix MediaGX processor/VGA |
| 13 | - Cyrix CX5520 northbridge? |
| 14 | - VS9824AG SuperI/O standard PC I/O chip |
| 15 | - 1 ISA, 2 PCI slots, 2 IDE headers |
| 16 | - "Prism" PCI card with PLX PCI9052 PCI-to-random stuff bridge |
| 17 | Card also contains DCS2 Stereo sound system with ADSP-2104 |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | #include "emu.h" |
| r22615 | r22616 | |
| 919 | 919 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 920 | 920 | MACHINE_CONFIG_END |
| 921 | 921 | |
| 922 | | |
| 922 | |
| 923 | 923 | void pinball2k_state::init_mediagx() |
| 924 | 924 | { |
| 925 | 925 | m_frame_width = m_frame_height = 1; |
| r22615 | r22616 | |
| 934 | 934 | |
| 935 | 935 | ROM_START( swe1pb ) |
| 936 | 936 | ROM_REGION32_LE(0x40000, "bios", 0) |
| 937 | | ROM_LOAD( "awdbios.bin", 0x000000, 0x040000, CRC(854ce8c6) SHA1(7826de74026e052dacce8516382f664004c327ad) ) |
| 937 | ROM_LOAD( "awdbios.bin", 0x000000, 0x040000, CRC(854ce8c6) SHA1(7826de74026e052dacce8516382f664004c327ad) ) |
| 938 | 938 | |
| 939 | 939 | ROM_REGION(0x4800000, "prism", 0) |
| 940 | | ROM_LOAD( "swe1_u100.rom", 0x0000000, 0x800000, CRC(db2c9709) SHA1(14e8db2c0b09c4da6306a4a1f7fe54b2a334c5ed) ) |
| 941 | | ROM_LOAD( "swe1_u101.rom", 0x0800000, 0x800000, CRC(a039e80d) SHA1(8f63e8ab83e043232fc17ed3dff1f251396a178a) ) |
| 942 | | ROM_LOAD( "swe1_u102.rom", 0x1000000, 0x800000, CRC(c9feb7bc) SHA1(a34acd34c3f91f082b67e385b1f4da2e5b6e5087) ) |
| 943 | | ROM_LOAD( "swe1_u103.rom", 0x1800000, 0x800000, CRC(7a692466) SHA1(9adf5ae9c12bd5b6314913f6c01d4566ee453fe1) ) |
| 944 | | ROM_LOAD( "swe1_u104.rom", 0x2000000, 0x800000, CRC(76e2dd7e) SHA1(9bc20a1423b11c46eb2f5a514e985151defb5651) ) |
| 945 | | ROM_LOAD( "swe1_u105.rom", 0x2800000, 0x800000, CRC(87f2460c) SHA1(cdc05e017367f61280e3d5682096e67e4c200150) ) |
| 946 | | ROM_LOAD( "swe1_u106.rom", 0x3000000, 0x800000, CRC(84877e2f) SHA1(6dd8c761b2e26313ae9e159690b3a4a170cb3bd8) ) |
| 947 | | ROM_LOAD( "swe1_u107.rom", 0x3800000, 0x800000, CRC(dc433c89) SHA1(9f1273debc9168c04202078503cfc4f1ca8cb30b) ) |
| 948 | | ROM_LOAD( "swe1_u109.rom", 0x4000000, 0x400000, CRC(cc08936b) SHA1(fc428393e8a0cf37b800dd475fd293a1a98c4bcf) ) |
| 949 | | ROM_LOAD( "swe1_u110.rom", 0x4400000, 0x400000, CRC(6011ecd9) SHA1(8575958c8942a6cbcb2ac18f291fcada6f8cbc09) ) |
| 940 | ROM_LOAD( "swe1_u100.rom", 0x0000000, 0x800000, CRC(db2c9709) SHA1(14e8db2c0b09c4da6306a4a1f7fe54b2a334c5ed) ) |
| 941 | ROM_LOAD( "swe1_u101.rom", 0x0800000, 0x800000, CRC(a039e80d) SHA1(8f63e8ab83e043232fc17ed3dff1f251396a178a) ) |
| 942 | ROM_LOAD( "swe1_u102.rom", 0x1000000, 0x800000, CRC(c9feb7bc) SHA1(a34acd34c3f91f082b67e385b1f4da2e5b6e5087) ) |
| 943 | ROM_LOAD( "swe1_u103.rom", 0x1800000, 0x800000, CRC(7a692466) SHA1(9adf5ae9c12bd5b6314913f6c01d4566ee453fe1) ) |
| 944 | ROM_LOAD( "swe1_u104.rom", 0x2000000, 0x800000, CRC(76e2dd7e) SHA1(9bc20a1423b11c46eb2f5a514e985151defb5651) ) |
| 945 | ROM_LOAD( "swe1_u105.rom", 0x2800000, 0x800000, CRC(87f2460c) SHA1(cdc05e017367f61280e3d5682096e67e4c200150) ) |
| 946 | ROM_LOAD( "swe1_u106.rom", 0x3000000, 0x800000, CRC(84877e2f) SHA1(6dd8c761b2e26313ae9e159690b3a4a170cb3bd8) ) |
| 947 | ROM_LOAD( "swe1_u107.rom", 0x3800000, 0x800000, CRC(dc433c89) SHA1(9f1273debc9168c04202078503cfc4f1ca8cb30b) ) |
| 948 | ROM_LOAD( "swe1_u109.rom", 0x4000000, 0x400000, CRC(cc08936b) SHA1(fc428393e8a0cf37b800dd475fd293a1a98c4bcf) ) |
| 949 | ROM_LOAD( "swe1_u110.rom", 0x4400000, 0x400000, CRC(6011ecd9) SHA1(8575958c8942a6cbcb2ac18f291fcada6f8cbc09) ) |
| 950 | 950 | |
| 951 | 951 | ROM_REGION(0x08100, "gfx1", 0) |
| 952 | 952 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| r22615 | r22616 | |
| 954 | 954 | |
| 955 | 955 | ROM_START( rfmpb ) |
| 956 | 956 | ROM_REGION32_LE(0x40000, "bios", 0) |
| 957 | | ROM_LOAD( "awdbios.bin", 0x000000, 0x040000, CRC(854ce8c6) SHA1(7826de74026e052dacce8516382f664004c327ad) ) |
| 957 | ROM_LOAD( "awdbios.bin", 0x000000, 0x040000, CRC(854ce8c6) SHA1(7826de74026e052dacce8516382f664004c327ad) ) |
| 958 | 958 | |
| 959 | 959 | ROM_REGION(0x4000000, "prism", 0) |
| 960 | | ROM_LOAD( "rfm_u100.rom", 0x0000000, 0x800000, CRC(b3548b1b) SHA1(874a16282bb778886cea2567d68ec7024dc5ed22) ) |
| 961 | | ROM_LOAD( "rfm_u101.rom", 0x0800000, 0x800000, CRC(8bef301d) SHA1(2eade00b1a4cd3f5e98ebe8ed8f549e328188e77) ) |
| 962 | | ROM_LOAD( "rfm_u102.rom", 0x1000000, 0x800000, CRC(749f5c59) SHA1(2d8850e7f8ea3e07e8b444d7dd4dc4195a547ae7) ) |
| 963 | | ROM_LOAD( "rfm_u103.rom", 0x1800000, 0x800000, CRC(a9ec5e97) SHA1(ce7c38dcbf34ce10d6e204a3176cd2c7a83b525a) ) |
| 964 | | ROM_LOAD( "rfm_u104.rom", 0x2000000, 0x800000, CRC(0a1acd70) SHA1(dcca4de92eadeb82ac776953326410a9687838cb) ) |
| 965 | | ROM_LOAD( "rfm_u105.rom", 0x2800000, 0x800000, CRC(1ef31684) SHA1(141900a7426ad483384606cddb018d186952f439) ) |
| 966 | | ROM_LOAD( "rfm_u106.rom", 0x3000000, 0x800000, CRC(daf4e1dc) SHA1(0612495468fb962b833057e50f620c5f69cd5840) ) |
| 967 | | ROM_LOAD( "rfm_u107.rom", 0x3800000, 0x800000, CRC(e737ab39) SHA1(0e978923db19e2893fdb4aae69d6ed3c3f664a31) ) |
| 960 | ROM_LOAD( "rfm_u100.rom", 0x0000000, 0x800000, CRC(b3548b1b) SHA1(874a16282bb778886cea2567d68ec7024dc5ed22) ) |
| 961 | ROM_LOAD( "rfm_u101.rom", 0x0800000, 0x800000, CRC(8bef301d) SHA1(2eade00b1a4cd3f5e98ebe8ed8f549e328188e77) ) |
| 962 | ROM_LOAD( "rfm_u102.rom", 0x1000000, 0x800000, CRC(749f5c59) SHA1(2d8850e7f8ea3e07e8b444d7dd4dc4195a547ae7) ) |
| 963 | ROM_LOAD( "rfm_u103.rom", 0x1800000, 0x800000, CRC(a9ec5e97) SHA1(ce7c38dcbf34ce10d6e204a3176cd2c7a83b525a) ) |
| 964 | ROM_LOAD( "rfm_u104.rom", 0x2000000, 0x800000, CRC(0a1acd70) SHA1(dcca4de92eadeb82ac776953326410a9687838cb) ) |
| 965 | ROM_LOAD( "rfm_u105.rom", 0x2800000, 0x800000, CRC(1ef31684) SHA1(141900a7426ad483384606cddb018d186952f439) ) |
| 966 | ROM_LOAD( "rfm_u106.rom", 0x3000000, 0x800000, CRC(daf4e1dc) SHA1(0612495468fb962b833057e50f620c5f69cd5840) ) |
| 967 | ROM_LOAD( "rfm_u107.rom", 0x3800000, 0x800000, CRC(e737ab39) SHA1(0e978923db19e2893fdb4aae69d6ed3c3f664a31) ) |
| 968 | 968 | |
| 969 | 969 | ROM_REGION(0x08100, "gfx1", 0) |
| 970 | 970 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| r22615 | r22616 | |
| 972 | 972 | |
| 973 | 973 | ROM_START( rfmpbr2 ) |
| 974 | 974 | ROM_REGION32_LE(0x40000, "bios", 0) |
| 975 | | ROM_LOAD( "awdbios.bin", 0x000000, 0x040000, CRC(854ce8c6) SHA1(7826de74026e052dacce8516382f664004c327ad) ) |
| 975 | ROM_LOAD( "awdbios.bin", 0x000000, 0x040000, CRC(854ce8c6) SHA1(7826de74026e052dacce8516382f664004c327ad) ) |
| 976 | 976 | |
| 977 | 977 | ROM_REGION(0x4800000, "prism", 0) |
| 978 | | ROM_LOAD( "rfm_u100r2.rom", 0x0000000, 0x800000, CRC(d4278a9b) SHA1(ec07b97190acb6b34b9ed6cda505ee8fefd66fec) ) |
| 979 | | ROM_LOAD( "rfm_u101r2.rom", 0x0800000, 0x800000, CRC(e5d4c0ed) SHA1(cfc7d9d2324cc02c9eaf53fd674f7db24736699c) ) |
| 980 | | ROM_LOAD( "rfm_u102.rom", 0x1000000, 0x800000, CRC(749f5c59) SHA1(2d8850e7f8ea3e07e8b444d7dd4dc4195a547ae7) ) |
| 981 | | ROM_LOAD( "rfm_u103.rom", 0x1800000, 0x800000, CRC(a9ec5e97) SHA1(ce7c38dcbf34ce10d6e204a3176cd2c7a83b525a) ) |
| 982 | | ROM_LOAD( "rfm_u104.rom", 0x2000000, 0x800000, CRC(0a1acd70) SHA1(dcca4de92eadeb82ac776953326410a9687838cb) ) |
| 983 | | ROM_LOAD( "rfm_u105.rom", 0x2800000, 0x800000, CRC(1ef31684) SHA1(141900a7426ad483384606cddb018d186952f439) ) |
| 984 | | ROM_LOAD( "rfm_u106.rom", 0x3000000, 0x800000, CRC(daf4e1dc) SHA1(0612495468fb962b833057e50f620c5f69cd5840) ) |
| 985 | | ROM_LOAD( "rfm_u107.rom", 0x3800000, 0x800000, CRC(e737ab39) SHA1(0e978923db19e2893fdb4aae69d6ed3c3f664a31) ) |
| 986 | | ROM_LOAD( "rfm_u109.bin", 0x4000000, 0x400000, CRC(a20b2abb) SHA1(0010d7dbf60b03f50cc1d314fdf786721161b064) ) |
| 987 | | ROM_LOAD( "rfm_u110.bin", 0x4400000, 0x400000, CRC(095abec9) SHA1(87ce156bbf673ebd50bbd7dcca4c6924d24fc823) ) |
| 978 | ROM_LOAD( "rfm_u100r2.rom", 0x0000000, 0x800000, CRC(d4278a9b) SHA1(ec07b97190acb6b34b9ed6cda505ee8fefd66fec) ) |
| 979 | ROM_LOAD( "rfm_u101r2.rom", 0x0800000, 0x800000, CRC(e5d4c0ed) SHA1(cfc7d9d2324cc02c9eaf53fd674f7db24736699c) ) |
| 980 | ROM_LOAD( "rfm_u102.rom", 0x1000000, 0x800000, CRC(749f5c59) SHA1(2d8850e7f8ea3e07e8b444d7dd4dc4195a547ae7) ) |
| 981 | ROM_LOAD( "rfm_u103.rom", 0x1800000, 0x800000, CRC(a9ec5e97) SHA1(ce7c38dcbf34ce10d6e204a3176cd2c7a83b525a) ) |
| 982 | ROM_LOAD( "rfm_u104.rom", 0x2000000, 0x800000, CRC(0a1acd70) SHA1(dcca4de92eadeb82ac776953326410a9687838cb) ) |
| 983 | ROM_LOAD( "rfm_u105.rom", 0x2800000, 0x800000, CRC(1ef31684) SHA1(141900a7426ad483384606cddb018d186952f439) ) |
| 984 | ROM_LOAD( "rfm_u106.rom", 0x3000000, 0x800000, CRC(daf4e1dc) SHA1(0612495468fb962b833057e50f620c5f69cd5840) ) |
| 985 | ROM_LOAD( "rfm_u107.rom", 0x3800000, 0x800000, CRC(e737ab39) SHA1(0e978923db19e2893fdb4aae69d6ed3c3f664a31) ) |
| 986 | ROM_LOAD( "rfm_u109.bin", 0x4000000, 0x400000, CRC(a20b2abb) SHA1(0010d7dbf60b03f50cc1d314fdf786721161b064) ) |
| 987 | ROM_LOAD( "rfm_u110.bin", 0x4400000, 0x400000, CRC(095abec9) SHA1(87ce156bbf673ebd50bbd7dcca4c6924d24fc823) ) |
| 988 | 988 | |
| 989 | 989 | ROM_REGION(0x08100, "gfx1", 0) |
| 990 | 990 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| r22615 | r22616 | |
| 995 | 995 | GAME( 1999, swe1pb, 0 , mediagx, mediagx, pinball2k_state, pinball2k, ROT0, "Midway", "Pinball 2000: Star Wars Episode 1", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL ) |
| 996 | 996 | GAME( 1999, rfmpb, 0 , mediagx, mediagx, pinball2k_state, pinball2k, ROT0, "Midway", "Pinball 2000: Revenge From Mars (rev. 1)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL ) |
| 997 | 997 | GAME( 1999, rfmpbr2, rfmpb , mediagx, mediagx, pinball2k_state, pinball2k, ROT0, "Midway", "Pinball 2000: Revenge From Mars (rev. 2)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL ) |
| 998 | | |
trunk/src/mame/drivers/iteagle.c
| r22615 | r22616 | |
| 5 | 5 | skeleton by R. Belmont |
| 6 | 6 | |
| 7 | 7 | Known games on this hardware and their security chip IDs: |
| 8 | | * E2-LED0 (c) 2000 Golden Tee Fore! |
| 9 | | * E2-BBH0 (c) 2000 Big Buck Hunter |
| 10 | | * G42-US-U (c) 2001 Golden Tee Fore! 2002 |
| 11 | | * BB15-US (c) 2002 Big Buck Hunter: Shooter's Challenge (AKA Big Buck Hunter v1.5) |
| 12 | | * BBH2-US (c) 2002 Big Buck Hunter II: Sportsman's Paradise |
| 13 | | * CK1-US (C) 2002 Carnival King |
| 14 | | * G43-US-U (c) 2002 Golden Tee Fore! 2003 |
| 15 | | * G44-US-U (c) 2003 Golden Tee Fore! 2004 |
| 16 | | * G45-US-U (c) 2004 Golden Tee Fore! 2005 |
| 17 | | * CW-US-U (c) 2005 Big Buck Hunter: Call of the Wild |
| 18 | | * G4C-US-U (c) 2006 Golden Tee Complete |
| 19 | | * ???????? (c) ???? Virtual Pool (not on IT's website master list but known to exist) |
| 20 | | |
| 21 | | Valid regions: US = USA, CAN = Canada, ENG = England, EUR = Euro, SWD = Sweden, AUS = Australia, NZ = New Zealand, SA = South Africa |
| 22 | | |
| 8 | * E2-LED0 (c) 2000 Golden Tee Fore! |
| 9 | * E2-BBH0 (c) 2000 Big Buck Hunter |
| 10 | * G42-US-U (c) 2001 Golden Tee Fore! 2002 |
| 11 | * BB15-US (c) 2002 Big Buck Hunter: Shooter's Challenge (AKA Big Buck Hunter v1.5) |
| 12 | * BBH2-US (c) 2002 Big Buck Hunter II: Sportsman's Paradise |
| 13 | * CK1-US (C) 2002 Carnival King |
| 14 | * G43-US-U (c) 2002 Golden Tee Fore! 2003 |
| 15 | * G44-US-U (c) 2003 Golden Tee Fore! 2004 |
| 16 | * G45-US-U (c) 2004 Golden Tee Fore! 2005 |
| 17 | * CW-US-U (c) 2005 Big Buck Hunter: Call of the Wild |
| 18 | * G4C-US-U (c) 2006 Golden Tee Complete |
| 19 | * ???????? (c) ???? Virtual Pool (not on IT's website master list but known to exist) |
| 20 | |
| 21 | Valid regions: US = USA, CAN = Canada, ENG = England, EUR = Euro, SWD = Sweden, AUS = Australia, NZ = New Zealand, SA = South Africa |
| 22 | |
| 23 | 23 | Hardware overview: |
| 24 | 24 | * NEC VR4310 CPU (similar to the N64's VR4300) |
| 25 | 25 | * NEC VR4373 "Nile 3" system controller / PCI bridge |
| 26 | | * 3DFX Voodoo Banshee video |
| 27 | | * Creative/Ensoniq AudioPCI ES1373 audio |
| 28 | | * Atmel 90S2313 AVR-based microcontroller for protection |
| 29 | | * STM48T02 NVRAM |
| 30 | | * Conexant CX88168 modem |
| 31 | | |
| 26 | * 3DFX Voodoo Banshee video |
| 27 | * Creative/Ensoniq AudioPCI ES1373 audio |
| 28 | * Atmel 90S2313 AVR-based microcontroller for protection |
| 29 | * STM48T02 NVRAM |
| 30 | * Conexant CX88168 modem |
| 31 | |
| 32 | 32 | TODO: |
| 33 | | * Everything (need new PCI subsystem to do this right) |
| 34 | | |
| 33 | * Everything (need new PCI subsystem to do this right) |
| 34 | |
| 35 | 35 | ***************************************************************************/ |
| 36 | 36 | |
| 37 | | /* |
| 38 | | |
| 37 | /* |
| 38 | |
| 39 | 39 | Big Buck Hunter II |
| 40 | 40 | Incredible Technologies 2004 |
| 41 | 41 | |
| r22615 | r22616 | |
| 78 | 78 | | | | |VRC 4373 | | |
| 79 | 79 | | |--------| |REV1.0 | CREATIVE | |
| 80 | 80 | |PAL(E2-RE53) |-----------| ES1373 | |
| 81 | | |--------------------------------------------------------------------| |
| 82 | | |
| 81 | |--------------------------------------------------------------------| |
| 82 | |
| 83 | 83 | */ |
| 84 | 84 | |
| 85 | 85 | #include "emu.h" |
| r22615 | r22616 | |
| 101 | 101 | |
| 102 | 102 | DECLARE_DRIVER_INIT(iteagle); |
| 103 | 103 | DECLARE_WRITE_LINE_MEMBER(ide_interrupt); |
| 104 | | DECLARE_WRITE_LINE_MEMBER(vblank_assert); |
| 104 | DECLARE_WRITE_LINE_MEMBER(vblank_assert); |
| 105 | 105 | UINT32 screen_update_iteagle(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 106 | 106 | virtual void machine_start(); |
| 107 | 107 | }; |
| r22615 | r22616 | |
| 151 | 151 | |
| 152 | 152 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, iteagle_state ) |
| 153 | 153 | ADDRESS_MAP_UNMAP_HIGH |
| 154 | | AM_RANGE(0x00000000, 0x01ffffff) AM_RAM |
| 154 | AM_RANGE(0x00000000, 0x01ffffff) AM_RAM |
| 155 | 155 | // Nile 3 northbridge/PCI controller at 0f000000 |
| 156 | 156 | AM_RANGE(0x1fc00000, 0x1fcfffff) AM_ROM AM_REGION("maincpu", 0) AM_SHARE("rombase") |
| 157 | 157 | ADDRESS_MAP_END |
| r22615 | r22616 | |
| 188 | 188 | |
| 189 | 189 | static const mips3_config r4310_config = |
| 190 | 190 | { |
| 191 | | 16384, /* code cache size */ |
| 192 | | 16384 /* data cache size */ |
| 191 | 16384, /* code cache size */ |
| 192 | 16384 /* data cache size */ |
| 193 | 193 | }; |
| 194 | 194 | |
| 195 | 195 | static MACHINE_CONFIG_START( gtfore, iteagle_state ) |
| r22615 | r22616 | |
| 224 | 224 | *************************************/ |
| 225 | 225 | |
| 226 | 226 | #define EAGLE_BIOS \ |
| 227 | | ROM_REGION( 0x100000, "maincpu", 0 ) /* MIPS code */ \ |
| 227 | ROM_REGION( 0x100000, "maincpu", 0 ) /* MIPS code */ \ |
| 228 | 228 | ROM_SYSTEM_BIOS( 0, "209", "bootrom 2.09" ) \ |
| 229 | | ROM_LOAD( "eagle209.u15", 0x000000, 0x100000, CRC(e0fc1a16) SHA1(c9524f7ee6b95bd484a3b75bcbe2243cb273f84c) ) \ |
| 229 | ROM_LOAD( "eagle209.u15", 0x000000, 0x100000, CRC(e0fc1a16) SHA1(c9524f7ee6b95bd484a3b75bcbe2243cb273f84c) ) \ |
| 230 | 230 | ROM_SYSTEM_BIOS( 1, "208", "bootrom 2.08" ) \ |
| 231 | | ROM_LOAD( "eagle208.u15", 0x000000, 0x100000, CRC(772f2864) SHA1(085063a4e34f29ebe3814823cd2c6323a050da36) ) \ |
| 231 | ROM_LOAD( "eagle208.u15", 0x000000, 0x100000, CRC(772f2864) SHA1(085063a4e34f29ebe3814823cd2c6323a050da36) ) \ |
| 232 | 232 | ROM_SYSTEM_BIOS( 2, "204", "bootrom 2.04" ) \ |
| 233 | | ROM_LOAD( "eagle204.u15", 0x000000, 0x100000, CRC(f02e5523) SHA1(b979cf72a6992f1ecad9695a08c8d51e315ab537) ) \ |
| 233 | ROM_LOAD( "eagle204.u15", 0x000000, 0x100000, CRC(f02e5523) SHA1(b979cf72a6992f1ecad9695a08c8d51e315ab537) ) \ |
| 234 | 234 | ROM_SYSTEM_BIOS( 3, "201", "bootrom 2.01" ) \ |
| 235 | | ROM_LOAD( "eagle201.u15", 0x000000, 0x100000, CRC(e180442b) SHA1(4f50821fed5bcd786d989520aa2559d6c416fb1f) ) \ |
| 235 | ROM_LOAD( "eagle201.u15", 0x000000, 0x100000, CRC(e180442b) SHA1(4f50821fed5bcd786d989520aa2559d6c416fb1f) ) \ |
| 236 | 236 | ROM_SYSTEM_BIOS( 4, "107", "bootrom 1.07" ) \ |
| 237 | | ROM_LOAD( "eagle107.u15", 0x000000, 0x100000, CRC(97a01fc9) SHA1(a421dbf4d097b2f50cc005d3cd0d63e562e03df8) ) \ |
| 237 | ROM_LOAD( "eagle107.u15", 0x000000, 0x100000, CRC(97a01fc9) SHA1(a421dbf4d097b2f50cc005d3cd0d63e562e03df8) ) \ |
| 238 | 238 | ROM_SYSTEM_BIOS( 5, "106a", "bootrom 1.06a" ) \ |
| 239 | | ROM_LOAD( "eagle106a.u15", 0x000000, 0x100000, CRC(9c79b7ad) SHA1(ccf1c86e79d65bee30f399e0fa33a7839570d93b) ) \ |
| 239 | ROM_LOAD( "eagle106a.u15", 0x000000, 0x100000, CRC(9c79b7ad) SHA1(ccf1c86e79d65bee30f399e0fa33a7839570d93b) ) \ |
| 240 | 240 | ROM_SYSTEM_BIOS( 6, "106", "bootrom 1.06" ) \ |
| 241 | | ROM_LOAD( "eagle106.u15", 0x000000, 0x100000, CRC(56bc193d) SHA1(e531d208ef27f777d0784414885f390d1be654b9) ) \ |
| 241 | ROM_LOAD( "eagle106.u15", 0x000000, 0x100000, CRC(56bc193d) SHA1(e531d208ef27f777d0784414885f390d1be654b9) ) \ |
| 242 | 242 | ROM_SYSTEM_BIOS( 7, "105", "bootrom 1.05" ) \ |
| 243 | | ROM_LOAD( "eagle105.u15", 0x000000, 0x100000, CRC(3870dbe0) SHA1(09be2d86c7259cd81d945c757044b167a76f30db) ) \ |
| 243 | ROM_LOAD( "eagle105.u15", 0x000000, 0x100000, CRC(3870dbe0) SHA1(09be2d86c7259cd81d945c757044b167a76f30db) ) \ |
| 244 | 244 | ROM_SYSTEM_BIOS( 8, "103", "bootrom 1.03" ) \ |
| 245 | | ROM_LOAD( "eagle103.u15", 0x000000, 0x100000, CRC(c35f4cf2) SHA1(45301c18c7f8f78754c8ad60ea4d2da5a7dc55fb) ) \ |
| 245 | ROM_LOAD( "eagle103.u15", 0x000000, 0x100000, CRC(c35f4cf2) SHA1(45301c18c7f8f78754c8ad60ea4d2da5a7dc55fb) ) \ |
| 246 | 246 | ROM_SYSTEM_BIOS( 9, "102", "bootrom 1.02" ) \ |
| 247 | 247 | ROM_LOAD( "eagle102.u15", 0x000000, 0x100000, CRC(1fd39e73) SHA1(d1ac758f94defc5c55c62594b3999a406dd9ef1f) ) \ |
| 248 | 248 | ROM_SYSTEM_BIOS( 10, "101", "bootrom 1.01" ) \ |
| 249 | | ROM_LOAD( "eagle101.u15", 0x000000, 0x100000, CRC(2600bc2b) SHA1(c4b89e69c51e4a3bb1874407c4d30b6caed4f396) ) \ |
| 249 | ROM_LOAD( "eagle101.u15", 0x000000, 0x100000, CRC(2600bc2b) SHA1(c4b89e69c51e4a3bb1874407c4d30b6caed4f396) ) \ |
| 250 | 250 | ROM_REGION( 0x30000, "fpga", 0 ) \ |
| 251 | 251 | ROM_LOAD( "17s20lpc_sb4.u26", 0x000000, 0x008000, CRC(62c4af8a) SHA1(6eca277b9c66a401990599e98fdca64a9e38cc9a) ) \ |
| 252 | 252 | ROM_LOAD( "17s20lpc_sb5.u26", 0x008000, 0x008000, CRC(c88b9d42) SHA1(b912d0fc50ecdc6a198c626f6e1644e8405fac6e) ) \ |
| 253 | 253 | ROM_LOAD( "17s50a_red1.u26", 0x010000, 0x020000, CRC(f5cf3187) SHA1(83b4a14de9959e5a776d97d424945d43501bda7f) ) \ |
| 254 | 254 | ROM_REGION( 0x2000, "pals", 0 ) \ |
| 255 | 255 | ROM_LOAD( "e2-card1.u22.jed", 0x000000, 0x000bd1, CRC(9d1e1ace) SHA1(287d6a30e9f32137ef4eba54f0effa092c97a6eb) ) \ |
| 256 | | ROM_LOAD( "e2-res3.u117.jed", 0x001000, 0x000bd1, CRC(4f1ff45a) SHA1(213cbdd6cd37ad9b5bfc9545084892a68d29f5ff) ) |
| 256 | ROM_LOAD( "e2-res3.u117.jed", 0x001000, 0x000bd1, CRC(4f1ff45a) SHA1(213cbdd6cd37ad9b5bfc9545084892a68d29f5ff) ) |
| 257 | 257 | |
| 258 | 258 | ROM_START( iteagle ) |
| 259 | | EAGLE_BIOS |
| 259 | EAGLE_BIOS |
| 260 | 260 | |
| 261 | 261 | DISK_REGION( "drive_0" ) |
| 262 | 262 | ROM_END |
| 263 | 263 | |
| 264 | 264 | ROM_START( gtfore04 ) |
| 265 | | EAGLE_BIOS |
| 265 | EAGLE_BIOS |
| 266 | 266 | |
| 267 | 267 | DISK_REGION( "drive_0" ) |
| 268 | 268 | DISK_IMAGE( "gt2004", 0, SHA1(739a52d6ce13bb6ac7a543ee0e8086fb66be19b9) ) |
| 269 | 269 | ROM_END |
| 270 | 270 | |
| 271 | 271 | ROM_START( gtfore05 ) |
| 272 | | EAGLE_BIOS |
| 272 | EAGLE_BIOS |
| 273 | 273 | |
| 274 | 274 | DISK_REGION( "drive_0" ) |
| 275 | 275 | DISK_IMAGE( "gt2005", 0, SHA1(d8de569d8cf97b5aaada10ce896eb3c75f1b37f1) ) |
| r22615 | r22616 | |
| 288 | 288 | GAME( 2000, iteagle, 0, gtfore, gtfore, iteagle_state, iteagle, ROT0, "Incredible Technologies", "Eagle BIOS", GAME_IS_BIOS_ROOT ) |
| 289 | 289 | GAME( 2003, gtfore04, iteagle, gtfore, gtfore, iteagle_state, iteagle, ROT0, "Incredible Technologies", "Golden Tee Fore! 2004", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 290 | 290 | GAME( 2004, gtfore05, iteagle, gtfore, gtfore, iteagle_state, iteagle, ROT0, "Incredible Technologies", "Golden Tee Fore! 2005", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 291 | | |
trunk/src/mame/drivers/taitojc.c
| r22615 | r22616 | |
| 391 | 391 | // lookup tables for densha de go analog controls/meters |
| 392 | 392 | static const int dendego_odometer_table[0x100] = |
| 393 | 393 | { |
| 394 | | 0, 3, 7, 10, 14, 17, 21, 24, 28, 31, 34, 38, 41, 45, 48, 52, |
| 395 | | 55, 59, 62, 66, 69, 72, 76, 79, 83, 86, 90, 93, 97, 100, 105, 111, |
| 396 | | 116, 121, 126, 132, 137, 142, 147, 153, 158, 163, 168, 174, 179, 184, 189, 195, |
| 397 | | 200, 206, 211, 217, 222, 228, 233, 239, 244, 250, 256, 261, 267, 272, 278, 283, |
| 398 | | 289, 294, 300, 306, 311, 317, 322, 328, 333, 339, 344, 350, 356, 361, 367, 372, |
| 399 | | 378, 383, 389, 394, 400, 406, 412, 418, 424, 429, 435, 441, 447, 453, 459, 465, |
| 400 | | 471, 476, 482, 488, 494, 500, 505, 511, 516, 521, 526, 532, 537, 542, 547, 553, |
| 401 | | 558, 563, 568, 574, 579, 584, 589, 595, 600, 607, 613, 620, 627, 633, 640, 647, |
| 402 | | 653, 660, 667, 673, 680, 687, 693, 700, 705, 711, 716, 721, 726, 732, 737, 742, |
| 403 | | 747, 753, 758, 763, 768, 774, 779, 784, 789, 795, 800, 806, 812, 818, 824, 829, |
| 404 | | 835, 841, 847, 853, 859, 865, 871, 876, 882, 888, 894, 900, 906, 911, 917, 922, |
| 405 | | 928, 933, 939, 944, 950, 956, 961, 967, 972, 978, 983, 989, 994, 1000, 1005, 1011, |
| 394 | 0, 3, 7, 10, 14, 17, 21, 24, 28, 31, 34, 38, 41, 45, 48, 52, |
| 395 | 55, 59, 62, 66, 69, 72, 76, 79, 83, 86, 90, 93, 97, 100, 105, 111, |
| 396 | 116, 121, 126, 132, 137, 142, 147, 153, 158, 163, 168, 174, 179, 184, 189, 195, |
| 397 | 200, 206, 211, 217, 222, 228, 233, 239, 244, 250, 256, 261, 267, 272, 278, 283, |
| 398 | 289, 294, 300, 306, 311, 317, 322, 328, 333, 339, 344, 350, 356, 361, 367, 372, |
| 399 | 378, 383, 389, 394, 400, 406, 412, 418, 424, 429, 435, 441, 447, 453, 459, 465, |
| 400 | 471, 476, 482, 488, 494, 500, 505, 511, 516, 521, 526, 532, 537, 542, 547, 553, |
| 401 | 558, 563, 568, 574, 579, 584, 589, 595, 600, 607, 613, 620, 627, 633, 640, 647, |
| 402 | 653, 660, 667, 673, 680, 687, 693, 700, 705, 711, 716, 721, 726, 732, 737, 742, |
| 403 | 747, 753, 758, 763, 768, 774, 779, 784, 789, 795, 800, 806, 812, 818, 824, 829, |
| 404 | 835, 841, 847, 853, 859, 865, 871, 876, 882, 888, 894, 900, 906, 911, 917, 922, |
| 405 | 928, 933, 939, 944, 950, 956, 961, 967, 972, 978, 983, 989, 994, 1000, 1005, 1011, |
| 406 | 406 | 1016, 1021, 1026, 1032, 1037, 1042, 1047, 1053, 1058, 1063, 1068, 1074, 1079, 1084, 1089, 1095, |
| 407 | 407 | 1100, 1107, 1113, 1120, 1127, 1133, 1140, 1147, 1153, 1160, 1167, 1173, 1180, 1187, 1193, 1200, |
| 408 | 408 | 1203, 1206, 1209, 1212, 1216, 1219, 1222, 1225, 1228, 1231, 1234, 1238, 1241, 1244, 1247, 1250, |
| r22615 | r22616 | |
| 411 | 411 | |
| 412 | 412 | static const int dendego_pressure_table[0x100] = |
| 413 | 413 | { |
| 414 | | 0, 0, 0, 0, 5, 10, 14, 19, 24, 29, 33, 38, 43, 48, 52, 57, |
| 415 | | 62, 67, 71, 76, 81, 86, 90, 95, 100, 106, 112, 119, 125, 131, 138, 144, |
| 416 | | 150, 156, 162, 169, 175, 181, 188, 194, 200, 206, 212, 219, 225, 231, 238, 244, |
| 417 | | 250, 256, 262, 269, 275, 281, 288, 294, 300, 306, 312, 318, 324, 329, 335, 341, |
| 418 | | 347, 353, 359, 365, 371, 376, 382, 388, 394, 400, 407, 413, 420, 427, 433, 440, |
| 419 | | 447, 453, 460, 467, 473, 480, 487, 493, 500, 507, 514, 521, 529, 536, 543, 550, |
| 420 | | 557, 564, 571, 579, 586, 593, 600, 607, 614, 621, 629, 636, 643, 650, 657, 664, |
| 421 | | 671, 679, 686, 693, 700, 706, 712, 719, 725, 731, 738, 744, 750, 756, 762, 769, |
| 422 | | 775, 781, 788, 794, 800, 807, 814, 821, 829, 836, 843, 850, 857, 864, 871, 879, |
| 423 | | 886, 893, 900, 907, 914, 921, 929, 936, 943, 950, 957, 964, 971, 979, 986, 993, |
| 414 | 0, 0, 0, 0, 5, 10, 14, 19, 24, 29, 33, 38, 43, 48, 52, 57, |
| 415 | 62, 67, 71, 76, 81, 86, 90, 95, 100, 106, 112, 119, 125, 131, 138, 144, |
| 416 | 150, 156, 162, 169, 175, 181, 188, 194, 200, 206, 212, 219, 225, 231, 238, 244, |
| 417 | 250, 256, 262, 269, 275, 281, 288, 294, 300, 306, 312, 318, 324, 329, 335, 341, |
| 418 | 347, 353, 359, 365, 371, 376, 382, 388, 394, 400, 407, 413, 420, 427, 433, 440, |
| 419 | 447, 453, 460, 467, 473, 480, 487, 493, 500, 507, 514, 521, 529, 536, 543, 550, |
| 420 | 557, 564, 571, 579, 586, 593, 600, 607, 614, 621, 629, 636, 643, 650, 657, 664, |
| 421 | 671, 679, 686, 693, 700, 706, 712, 719, 725, 731, 738, 744, 750, 756, 762, 769, |
| 422 | 775, 781, 788, 794, 800, 807, 814, 821, 829, 836, 843, 850, 857, 864, 871, 879, |
| 423 | 886, 893, 900, 907, 914, 921, 929, 936, 943, 950, 957, 964, 971, 979, 986, 993, |
| 424 | 424 | 1000, 1008, 1015, 1023, 1031, 1038, 1046, 1054, 1062, 1069, 1077, 1085, 1092, 1100, 1108, 1115, |
| 425 | 425 | 1123, 1131, 1138, 1146, 1154, 1162, 1169, 1177, 1185, 1192, 1200, 1207, 1214, 1221, 1229, 1236, |
| 426 | 426 | 1243, 1250, 1257, 1264, 1271, 1279, 1286, 1293, 1300, 1307, 1314, 1321, 1329, 1336, 1343, 1350, |
trunk/src/mame/drivers/suna16.c
| r22615 | r22616 | |
| 446 | 446 | JOY(4) |
| 447 | 447 | |
| 448 | 448 | PORT_START("DSW1") /* $a00008.w */ |
| 449 | | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") |
| 449 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") |
| 450 | 450 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) |
| 451 | 451 | PORT_DIPSETTING( 0x0001, DEF_STR( 3C_1C ) ) |
| 452 | 452 | PORT_DIPSETTING( 0x0002, DEF_STR( 2C_1C ) ) |
| r22615 | r22616 | |
| 455 | 455 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) |
| 456 | 456 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) |
| 457 | 457 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) |
| 458 | | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,5") |
| 458 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,5") |
| 459 | 459 | PORT_DIPSETTING( 0x0010, DEF_STR( Easy ) ) |
| 460 | 460 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) |
| 461 | 461 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) |
| 462 | 462 | PORT_DIPSETTING( 0x0000, "Hardest?" ) // duplicate of "HARD" not shown as supported in manual - but possible to set on PCB |
| 463 | | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:6") |
| 463 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:6") |
| 464 | 464 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) |
| 465 | 465 | PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) |
| 466 | | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") |
| 466 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") |
| 467 | 467 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) |
| 468 | 468 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 469 | 469 | PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "SW1:8" ) |
| 470 | 470 | |
| 471 | | PORT_DIPNAME( 0x0300, 0x0300, "Play Time P1" ) PORT_DIPLOCATION("SW2:1,2") |
| 471 | PORT_DIPNAME( 0x0300, 0x0300, "Play Time P1" ) PORT_DIPLOCATION("SW2:1,2") |
| 472 | 472 | PORT_DIPSETTING( 0x0300, "1:30" ) |
| 473 | 473 | PORT_DIPSETTING( 0x0200, "1:45" ) |
| 474 | 474 | PORT_DIPSETTING( 0x0100, "2:00" ) |
| 475 | 475 | PORT_DIPSETTING( 0x0000, "2:15" ) |
| 476 | | PORT_DIPNAME( 0x0c00, 0x0c00, "Play Time P2" ) PORT_DIPLOCATION("SW2:3,4") |
| 476 | PORT_DIPNAME( 0x0c00, 0x0c00, "Play Time P2" ) PORT_DIPLOCATION("SW2:3,4") |
| 477 | 477 | PORT_DIPSETTING( 0x0c00, "1:30" ) |
| 478 | 478 | PORT_DIPSETTING( 0x0800, "1:45" ) |
| 479 | 479 | PORT_DIPSETTING( 0x0400, "2:00" ) |
| 480 | 480 | PORT_DIPSETTING( 0x0000, "2:15" ) |
| 481 | | PORT_DIPNAME( 0x3000, 0x3000, "Play Time P3" ) PORT_DIPLOCATION("SW2:5,6") |
| 481 | PORT_DIPNAME( 0x3000, 0x3000, "Play Time P3" ) PORT_DIPLOCATION("SW2:5,6") |
| 482 | 482 | PORT_DIPSETTING( 0x3000, "1:30" ) |
| 483 | 483 | PORT_DIPSETTING( 0x2000, "1:45" ) |
| 484 | 484 | PORT_DIPSETTING( 0x1000, "2:00" ) |
| 485 | 485 | PORT_DIPSETTING( 0x0000, "2:15" ) |
| 486 | | PORT_DIPNAME( 0xc000, 0xc000, "Play Time P4" ) PORT_DIPLOCATION("SW2:7,8") |
| 486 | PORT_DIPNAME( 0xc000, 0xc000, "Play Time P4" ) PORT_DIPLOCATION("SW2:7,8") |
| 487 | 487 | PORT_DIPSETTING( 0xc000, "1:30" ) |
| 488 | 488 | PORT_DIPSETTING( 0x8000, "1:45" ) |
| 489 | 489 | PORT_DIPSETTING( 0x4000, "2:00" ) |
| 490 | 490 | PORT_DIPSETTING( 0x0000, "2:15" ) |
| 491 | 491 | |
| 492 | 492 | PORT_START("DSW2") /* $a0000b.b - JP3, JP6 & JP7 and what else?? */ |
| 493 | | PORT_DIPNAME( 0x0001, 0x0001, "Copyright" ) PORT_DIPLOCATION("Jumper:1") // these 4 are shown in test mode |
| 493 | PORT_DIPNAME( 0x0001, 0x0001, "Copyright" ) PORT_DIPLOCATION("Jumper:1") // these 4 are shown in test mode |
| 494 | 494 | PORT_DIPSETTING( 0x0001, "Distributer Unico" ) |
| 495 | 495 | PORT_DIPSETTING( 0x0000, "All Rights Reserved" ) |
| 496 | | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("Jumper:2") // used! |
| 496 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("Jumper:2") // used! |
| 497 | 497 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) |
| 498 | 498 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 499 | | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) PORT_DIPLOCATION("Jumper:3") |
| 499 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) PORT_DIPLOCATION("Jumper:3") |
| 500 | 500 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) |
| 501 | 501 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 502 | | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) PORT_DIPLOCATION("Jumper:4") |
| 502 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) PORT_DIPLOCATION("Jumper:4") |
| 503 | 503 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) |
| 504 | 504 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 505 | 505 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_COIN1 ) |
| r22615 | r22616 | |
| 554 | 554 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 555 | 555 | |
| 556 | 556 | PORT_START("DSW1") /* $600005.b */ |
| 557 | | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") |
| 557 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") |
| 558 | 558 | PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) ) |
| 559 | 559 | PORT_DIPSETTING( 0x0001, DEF_STR( 4C_1C ) ) |
| 560 | 560 | PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) ) |
| r22615 | r22616 | |
| 563 | 563 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) |
| 564 | 564 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) |
| 565 | 565 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) |
| 566 | | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:4,5") |
| 566 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:4,5") |
| 567 | 567 | PORT_DIPSETTING( 0x0010, "2" ) |
| 568 | 568 | PORT_DIPSETTING( 0x0018, "3" ) |
| 569 | 569 | PORT_DIPSETTING( 0x0008, "4" ) |
| 570 | 570 | PORT_DIPSETTING( 0x0000, "5" ) |
| 571 | | PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,7") |
| 571 | PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,7") |
| 572 | 572 | PORT_DIPSETTING( 0x0040, DEF_STR( Easy ) ) |
| 573 | 573 | PORT_DIPSETTING( 0x0060, DEF_STR( Normal ) ) |
| 574 | 574 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) |
| r22615 | r22616 | |
| 576 | 576 | PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "SW1:8" ) |
| 577 | 577 | |
| 578 | 578 | PORT_START("DSW2") /* $600007.b */ |
| 579 | | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1") |
| 579 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1") |
| 580 | 580 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| 581 | 581 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 582 | | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2") |
| 582 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2") |
| 583 | 583 | PORT_DIPSETTING( 0x0002, DEF_STR( Upright ) ) |
| 584 | 584 | PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) |
| 585 | | PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:3,4,5") |
| 585 | PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:3,4,5") |
| 586 | 586 | PORT_DIPSETTING( 0x001c, "200K" ) |
| 587 | 587 | PORT_DIPSETTING( 0x0010, "300K, 1000K" ) |
| 588 | 588 | PORT_DIPSETTING( 0x0018, "400K" ) |
| r22615 | r22616 | |
| 591 | 591 | PORT_DIPSETTING( 0x0004, "500K, 3000K" ) |
| 592 | 592 | PORT_DIPSETTING( 0x0014, "600K" ) |
| 593 | 593 | PORT_DIPSETTING( 0x0000, DEF_STR( None ) ) |
| 594 | | PORT_DIPNAME( 0x0020, 0x0020, "Unknown DSW2-6*" ) PORT_DIPLOCATION("SW2:6") |
| 594 | PORT_DIPNAME( 0x0020, 0x0020, "Unknown DSW2-6*" ) PORT_DIPLOCATION("SW2:6") |
| 595 | 595 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) |
| 596 | 596 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 597 | | PORT_DIPNAME( 0x0040, 0x0040, "Unknown DSW2-7*" ) PORT_DIPLOCATION("SW2:7") |
| 597 | PORT_DIPNAME( 0x0040, 0x0040, "Unknown DSW2-7*" ) PORT_DIPLOCATION("SW2:7") |
| 598 | 598 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) |
| 599 | 599 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 600 | | PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") |
| 600 | PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") |
| 601 | 601 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 602 | 602 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 603 | 603 | INPUT_PORTS_END |
| r22615 | r22616 | |
| 698 | 698 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 699 | 699 | |
| 700 | 700 | PORT_START("DSW") /* 500004.w */ |
| 701 | | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:1,2,3") |
| 701 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:1,2,3") |
| 702 | 702 | PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) ) |
| 703 | 703 | PORT_DIPSETTING( 0x0001, DEF_STR( 4C_1C ) ) |
| 704 | 704 | PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) ) |
| r22615 | r22616 | |
| 707 | 707 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) |
| 708 | 708 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) |
| 709 | 709 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) |
| 710 | | PORT_DIPNAME( 0x0018, 0x0010, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:4,5") |
| 710 | PORT_DIPNAME( 0x0018, 0x0010, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:4,5") |
| 711 | 711 | PORT_DIPSETTING( 0x0018, DEF_STR( Easy ) ) |
| 712 | 712 | PORT_DIPSETTING( 0x0010, DEF_STR( Normal ) ) |
| 713 | 713 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) |
| 714 | 714 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) |
| 715 | | PORT_DIPNAME( 0x0020, 0x0020, "Display Combos" ) PORT_DIPLOCATION("SWA:6") |
| 715 | PORT_DIPNAME( 0x0020, 0x0020, "Display Combos" ) PORT_DIPLOCATION("SWA:6") |
| 716 | 716 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) |
| 717 | 717 | PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) |
| 718 | 718 | PORT_SERVICE_DIPLOC( 0x0040, IP_ACTIVE_LOW, "SWA:7" ) |
| 719 | | PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8") |
| 719 | PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8") |
| 720 | 720 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 721 | 721 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 722 | 722 | |
| 723 | | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWB:1") |
| 723 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWB:1") |
| 724 | 724 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) |
| 725 | 725 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 726 | | PORT_DIPNAME( 0x0600, 0x0400, "Play Time" ) PORT_DIPLOCATION("SWB:2,3") |
| 726 | PORT_DIPNAME( 0x0600, 0x0400, "Play Time" ) PORT_DIPLOCATION("SWB:2,3") |
| 727 | 727 | PORT_DIPSETTING( 0x0600, "1:10" ) |
| 728 | 728 | PORT_DIPSETTING( 0x0400, "1:20" ) |
| 729 | 729 | PORT_DIPSETTING( 0x0200, "1:30" ) |
| r22615 | r22616 | |
| 853 | 853 | static MACHINE_CONFIG_START( uballoon, suna16_state ) |
| 854 | 854 | |
| 855 | 855 | /* basic machine hardware */ |
| 856 | | MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/4) /* 8MHz */ |
| 856 | MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/4) /* 8MHz */ |
| 857 | 857 | MCFG_CPU_PROGRAM_MAP(uballoon_map) |
| 858 | 858 | MCFG_CPU_VBLANK_INT_DRIVER("screen", suna16_state, irq1_line_hold) |
| 859 | 859 | |
| 860 | | MCFG_CPU_ADD("audiocpu", Z80, XTAL_14_31818MHz/4) /* Z80B at 3.579545MHz */ |
| 860 | MCFG_CPU_ADD("audiocpu", Z80, XTAL_14_31818MHz/4) /* Z80B at 3.579545MHz */ |
| 861 | 861 | MCFG_CPU_PROGRAM_MAP(uballoon_sound_map) |
| 862 | 862 | |
| 863 | | MCFG_CPU_ADD("pcm1", Z80, XTAL_32MHz/6) /* Z80B at 5MHz */ |
| 863 | MCFG_CPU_ADD("pcm1", Z80, XTAL_32MHz/6) /* Z80B at 5MHz */ |
| 864 | 864 | MCFG_CPU_PROGRAM_MAP(uballoon_pcm_1_map) |
| 865 | 865 | MCFG_CPU_IO_MAP(uballoon_pcm_1_io_map) |
| 866 | 866 | |
| r22615 | r22616 | |
| 885 | 885 | /* sound hardware */ |
| 886 | 886 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 887 | 887 | |
| 888 | | MCFG_YM2151_ADD("ymsnd", XTAL_14_31818MHz/4) /* 3.579545MHz */ |
| 888 | MCFG_YM2151_ADD("ymsnd", XTAL_14_31818MHz/4) /* 3.579545MHz */ |
| 889 | 889 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) |
| 890 | 890 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) |
| 891 | 891 | |
| r22615 | r22616 | |
| 903 | 903 | static MACHINE_CONFIG_START( sunaq, suna16_state ) |
| 904 | 904 | |
| 905 | 905 | /* basic machine hardware */ |
| 906 | | MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/4) /* 6MHz */ |
| 906 | MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/4) /* 6MHz */ |
| 907 | 907 | MCFG_CPU_PROGRAM_MAP(sunaq_map) |
| 908 | 908 | MCFG_CPU_VBLANK_INT_DRIVER("screen", suna16_state, irq1_line_hold) |
| 909 | 909 | |
| 910 | | MCFG_CPU_ADD("audiocpu", Z80, XTAL_14_31818MHz/4) /* Z80B at 3.579545MHz */ |
| 910 | MCFG_CPU_ADD("audiocpu", Z80, XTAL_14_31818MHz/4) /* Z80B at 3.579545MHz */ |
| 911 | 911 | MCFG_CPU_PROGRAM_MAP(sunaq_sound_map) |
| 912 | 912 | |
| 913 | | MCFG_CPU_ADD("pcm1", Z80, XTAL_24MHz/4) /* Z80B at 6MHz */ |
| 913 | MCFG_CPU_ADD("pcm1", Z80, XTAL_24MHz/4) /* Z80B at 6MHz */ |
| 914 | 914 | MCFG_CPU_PROGRAM_MAP(bssoccer_pcm_1_map) |
| 915 | 915 | MCFG_CPU_IO_MAP(bssoccer_pcm_1_io_map) |
| 916 | 916 | |
| r22615 | r22616 | |
| 933 | 933 | /* sound hardware */ |
| 934 | 934 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 935 | 935 | |
| 936 | | MCFG_YM2151_ADD("ymsnd", XTAL_14_31818MHz/4) /* 3.579545MHz */ |
| 936 | MCFG_YM2151_ADD("ymsnd", XTAL_14_31818MHz/4) /* 3.579545MHz */ |
| 937 | 937 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) |
| 938 | 938 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) |
| 939 | 939 | |
| r22615 | r22616 | |
| 969 | 969 | static MACHINE_CONFIG_START( bestbest, suna16_state ) |
| 970 | 970 | |
| 971 | 971 | /* basic machine hardware */ |
| 972 | | MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/4) /* 6MHz */ |
| 972 | MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/4) /* 6MHz */ |
| 973 | 973 | MCFG_CPU_PROGRAM_MAP(bestbest_map) |
| 974 | 974 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", suna16_state, bssoccer_interrupt, "screen", 0, 1) |
| 975 | 975 | |
| 976 | | MCFG_CPU_ADD("audiocpu", Z80, XTAL_24MHz/4) /* 6MHz */ |
| 976 | MCFG_CPU_ADD("audiocpu", Z80, XTAL_24MHz/4) /* 6MHz */ |
| 977 | 977 | MCFG_CPU_PROGRAM_MAP(bestbest_sound_map) |
| 978 | 978 | |
| 979 | | MCFG_CPU_ADD("pcm1", Z80, XTAL_24MHz/4) /* 6MHz */ |
| 979 | MCFG_CPU_ADD("pcm1", Z80, XTAL_24MHz/4) /* 6MHz */ |
| 980 | 980 | MCFG_CPU_PROGRAM_MAP(bestbest_pcm_1_map) |
| 981 | 981 | MCFG_CPU_IO_MAP(bestbest_pcm_1_iomap) |
| 982 | 982 | |
| r22615 | r22616 | |
| 999 | 999 | /* sound hardware */ |
| 1000 | 1000 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 1001 | 1001 | |
| 1002 | | MCFG_SOUND_ADD("aysnd", AY8910, XTAL_24MHz/16) /* 1.5MHz */ |
| 1002 | MCFG_SOUND_ADD("aysnd", AY8910, XTAL_24MHz/16) /* 1.5MHz */ |
| 1003 | 1003 | MCFG_SOUND_CONFIG(bestbest_ay8910_interface) |
| 1004 | 1004 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| 1005 | 1005 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 1006 | 1006 | |
| 1007 | | MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_24MHz/8) /* 3MHz */ |
| 1007 | MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_24MHz/8) /* 3MHz */ |
| 1008 | 1008 | MCFG_SOUND_CONFIG(bestbest_ym3526_interface) |
| 1009 | 1009 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) |
| 1010 | 1010 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) |
trunk/src/mame/drivers/hikaru.c
| r22615 | r22616 | |
| 665 | 665 | ROM_LOAD32_WORD( "epr-21994.ic29", 0x000000, 0x200000, CRC(31b0a754) SHA1(b49c998a15fbc790b780ed6665a56681d4edd369) ) |
| 666 | 666 | ROM_LOAD32_WORD( "epr-21995.ic30", 0x000002, 0x200000, CRC(bcccb56b) SHA1(6e7a69934e5b47495ae8e90c57759573bc519d24) ) |
| 667 | 667 | ROM_LOAD32_WORD( "epr-21996.ic31", 0x400000, 0x200000, CRC(a8f88e17) SHA1(dbbd2a73335c740bcf2ff9680c575841af29b340) ) |
| 668 | | ROM_LOAD32_WORD( "epr-21997.ic32", 0x400002, 0x200000, CRC(36641a7f) SHA1(37931bde1ddebef61fa6d8caca3cb67328fd0b90) ) |
| 668 | ROM_LOAD32_WORD( "epr-21997.ic32", 0x400002, 0x200000, CRC(36641a7f) SHA1(37931bde1ddebef61fa6d8caca3cb67328fd0b90) ) |
| 669 | 669 | ROM_LOAD32_WORD( "epr-21998.ic33", 0x800000, 0x200000, CRC(bd1df696) SHA1(fd937894763fab5cb50f33c40f8047e0d3adc93b) ) |
| 670 | 670 | ROM_LOAD32_WORD( "epr-21999.ic34", 0x800002, 0x200000, CRC(9425eee0) SHA1(0f6a23163022bbd7ec54dd638094f3e317a87919) ) |
| 671 | 671 | /* ic35 unpopulated */ |
| r22615 | r22616 | |
| 673 | 673 | |
| 674 | 674 | /* ROM board using 64M SOP44 MASKROM */ |
| 675 | 675 | ROM_REGION( 0xc000000, "user2", ROMREGION_ERASE00) |
| 676 | | ROM_LOAD( "mpr-22000.ic37", 0x0000000, 0x800000, CRC(53d641d6) SHA1(f47d7c77d0e36c4ec3b7171fd7a017f9f58ca5a0) ) |
| 677 | | ROM_LOAD( "mpr-22001.ic38", 0x0800000, 0x800000, CRC(234bc48f) SHA1(177c46884de0ba4bac1f9b778f99c905410a9345) ) |
| 678 | | ROM_LOAD( "mpr-22002.ic39", 0x1000000, 0x800000, CRC(d8f3aa9e) SHA1(f73208034fdd51fed086e912cb8580d2270122b6) ) |
| 679 | | ROM_LOAD( "mpr-22003.ic40", 0x1800000, 0x800000, CRC(2560fe98) SHA1(9bb5ffb6212ec6aa3f92e437eb424141f3b15e43) ) |
| 680 | | ROM_LOAD( "mpr-22004.ic41", 0x2000000, 0x800000, CRC(4e24d71d) SHA1(503344dd8cdd8e65ec7c801b0efae83b3f1f9ae2) ) |
| 681 | | ROM_LOAD( "mpr-22005.ic42", 0x2800000, 0x800000, CRC(2b96c97f) SHA1(707070c85f4b044236694daa13970c241b242d4d) ) |
| 682 | | ROM_LOAD( "mpr-22006.ic43", 0x3000000, 0x800000, CRC(f793a3ba) SHA1(80acd1d4f71cafd7328ff9b9ce30e5169b8f4f8c) ) |
| 683 | | ROM_LOAD( "mpr-22007.ic44", 0x3800000, 0x800000, CRC(62616e31) SHA1(dbe0d4b8fc085ed97884c105fd527af5cd8fbe79) ) |
| 684 | | ROM_LOAD( "mpr-22008.ic45", 0x4000000, 0x800000, CRC(e6905de8) SHA1(6bb4e43b1394788add15f0b78ccd5ab14f86516c) ) |
| 685 | | ROM_LOAD( "mpr-22009.ic46", 0x4800000, 0x800000, CRC(c37dfa5c) SHA1(5a3a5f2eb5a13831e36ca215147ec3c9740c50fc) ) |
| 686 | | ROM_LOAD( "mpr-22010.ic47", 0x5000000, 0x800000, CRC(b570b46c) SHA1(6e512fd1a2c8835f6aee307865b42d57ddf90ef5) ) |
| 687 | | ROM_LOAD( "mpr-22011.ic48", 0x5800000, 0x800000, CRC(d1f5fb58) SHA1(08a1282e00bda52d8d938225c65f67d22abfea05) ) |
| 688 | | ROM_LOAD( "mpr-22012.ic49", 0x6000000, 0x800000, CRC(3ab79029) SHA1(d4708446ba700d5f7c89827c80177ad2d1c0b222) ) |
| 689 | | ROM_LOAD( "mpr-22013.ic50", 0x6800000, 0x800000, CRC(42d8d00b) SHA1(ddce3c95258d8cf51792f2115f89ca658ffe97b6) ) |
| 690 | | ROM_LOAD( "mpr-22014.ic51", 0x7000000, 0x800000, CRC(0f49c00f) SHA1(877c654268edc9526ae3e21e21e3ecca706f300b) ) |
| 691 | | ROM_LOAD( "mpr-22015.ic52", 0x7800000, 0x800000, CRC(d3696e61) SHA1(247161c99c7061b8f391543af1812764a82399cb) ) |
| 692 | | ROM_LOAD( "mpr-22016.ic53s", 0x8000000, 0x800000, CRC(c1015e00) SHA1(f2ce2009d4f4f0f3cbfcce7a36fab2c54e738b07) ) |
| 693 | | ROM_LOAD( "mpr-22017.ic54s", 0x8800000, 0x800000, CRC(222a7cb0) SHA1(9f98ae3f13f85fae4596b671ea508b07c2116ab6) ) |
| 694 | | ROM_LOAD( "mpr-22018.ic55s", 0x9000000, 0x800000, CRC(f160e115) SHA1(ecf7f9f58fce6bff220568972ba7763537c9d7d7) ) |
| 695 | | ROM_LOAD( "mpr-22019.ic56s", 0x9800000, 0x800000, CRC(468b2f10) SHA1(f3fc0af7d4dd3f30ba84e684f3d9c217730564bb) ) |
| 696 | | ROM_LOAD( "mpr-22020.ic57s", 0xa000000, 0x800000, CRC(0c018d8a) SHA1(0447d7ad64061cca4c1231733e660ba51de5a216) ) |
| 697 | | ROM_LOAD( "mpr-22021.ic58s", 0xa800000, 0x800000, CRC(43b08604) SHA1(681142d8b95b2f9664d70b23262a64938774d4e3) ) |
| 698 | | ROM_LOAD( "mpr-22022.ic59s", 0xb000000, 0x800000, CRC(abd3d888) SHA1(9654c3a38feab46b4983a602831fb29cccdd0526) ) |
| 699 | | ROM_LOAD( "mpr-22023.ic60s", 0xb800000, 0x800000, CRC(07f00869) SHA1(92282d09d72d3e65a91128e06bb0d4426bb90be5) ) |
| 676 | ROM_LOAD( "mpr-22000.ic37", 0x0000000, 0x800000, CRC(53d641d6) SHA1(f47d7c77d0e36c4ec3b7171fd7a017f9f58ca5a0) ) |
| 677 | ROM_LOAD( "mpr-22001.ic38", 0x0800000, 0x800000, CRC(234bc48f) SHA1(177c46884de0ba4bac1f9b778f99c905410a9345) ) |
| 678 | ROM_LOAD( "mpr-22002.ic39", 0x1000000, 0x800000, CRC(d8f3aa9e) SHA1(f73208034fdd51fed086e912cb8580d2270122b6) ) |
| 679 | ROM_LOAD( "mpr-22003.ic40", 0x1800000, 0x800000, CRC(2560fe98) SHA1(9bb5ffb6212ec6aa3f92e437eb424141f3b15e43) ) |
| 680 | ROM_LOAD( "mpr-22004.ic41", 0x2000000, 0x800000, CRC(4e24d71d) SHA1(503344dd8cdd8e65ec7c801b0efae83b3f1f9ae2) ) |
| 681 | ROM_LOAD( "mpr-22005.ic42", 0x2800000, 0x800000, CRC(2b96c97f) SHA1(707070c85f4b044236694daa13970c241b242d4d) ) |
| 682 | ROM_LOAD( "mpr-22006.ic43", 0x3000000, 0x800000, CRC(f793a3ba) SHA1(80acd1d4f71cafd7328ff9b9ce30e5169b8f4f8c) ) |
| 683 | ROM_LOAD( "mpr-22007.ic44", 0x3800000, 0x800000, CRC(62616e31) SHA1(dbe0d4b8fc085ed97884c105fd527af5cd8fbe79) ) |
| 684 | ROM_LOAD( "mpr-22008.ic45", 0x4000000, 0x800000, CRC(e6905de8) SHA1(6bb4e43b1394788add15f0b78ccd5ab14f86516c) ) |
| 685 | ROM_LOAD( "mpr-22009.ic46", 0x4800000, 0x800000, CRC(c37dfa5c) SHA1(5a3a5f2eb5a13831e36ca215147ec3c9740c50fc) ) |
| 686 | ROM_LOAD( "mpr-22010.ic47", 0x5000000, 0x800000, CRC(b570b46c) SHA1(6e512fd1a2c8835f6aee307865b42d57ddf90ef5) ) |
| 687 | ROM_LOAD( "mpr-22011.ic48", 0x5800000, 0x800000, CRC(d1f5fb58) SHA1(08a1282e00bda52d8d938225c65f67d22abfea05) ) |
| 688 | ROM_LOAD( "mpr-22012.ic49", 0x6000000, 0x800000, CRC(3ab79029) SHA1(d4708446ba700d5f7c89827c80177ad2d1c0b222) ) |
| 689 | ROM_LOAD( "mpr-22013.ic50", 0x6800000, 0x800000, CRC(42d8d00b) SHA1(ddce3c95258d8cf51792f2115f89ca658ffe97b6) ) |
| 690 | ROM_LOAD( "mpr-22014.ic51", 0x7000000, 0x800000, CRC(0f49c00f) SHA1(877c654268edc9526ae3e21e21e3ecca706f300b) ) |
| 691 | ROM_LOAD( "mpr-22015.ic52", 0x7800000, 0x800000, CRC(d3696e61) SHA1(247161c99c7061b8f391543af1812764a82399cb) ) |
| 692 | ROM_LOAD( "mpr-22016.ic53s", 0x8000000, 0x800000, CRC(c1015e00) SHA1(f2ce2009d4f4f0f3cbfcce7a36fab2c54e738b07) ) |
| 693 | ROM_LOAD( "mpr-22017.ic54s", 0x8800000, 0x800000, CRC(222a7cb0) SHA1(9f98ae3f13f85fae4596b671ea508b07c2116ab6) ) |
| 694 | ROM_LOAD( "mpr-22018.ic55s", 0x9000000, 0x800000, CRC(f160e115) SHA1(ecf7f9f58fce6bff220568972ba7763537c9d7d7) ) |
| 695 | ROM_LOAD( "mpr-22019.ic56s", 0x9800000, 0x800000, CRC(468b2f10) SHA1(f3fc0af7d4dd3f30ba84e684f3d9c217730564bb) ) |
| 696 | ROM_LOAD( "mpr-22020.ic57s", 0xa000000, 0x800000, CRC(0c018d8a) SHA1(0447d7ad64061cca4c1231733e660ba51de5a216) ) |
| 697 | ROM_LOAD( "mpr-22021.ic58s", 0xa800000, 0x800000, CRC(43b08604) SHA1(681142d8b95b2f9664d70b23262a64938774d4e3) ) |
| 698 | ROM_LOAD( "mpr-22022.ic59s", 0xb000000, 0x800000, CRC(abd3d888) SHA1(9654c3a38feab46b4983a602831fb29cccdd0526) ) |
| 699 | ROM_LOAD( "mpr-22023.ic60s", 0xb800000, 0x800000, CRC(07f00869) SHA1(92282d09d72d3e65a91128e06bb0d4426bb90be5) ) |
| 700 | 700 | ROM_END |
| 701 | 701 | |
| 702 | 702 | ROM_START( sgnascar ) |
trunk/src/lib/util/simple_set.h
| r22615 | r22616 | |
| 31 | 31 | // PUBLIC OPERATIONS: |
| 32 | 32 | // size, empty, clear, insert, remove, find, contains, merge, & assignment. |
| 33 | 33 | // |
| 34 | | |
| 34 | |
| 35 | 35 | template <class T> |
| 36 | 36 | class simple_set |
| 37 | 37 | { |
| 38 | | friend class simple_set_iterator<T>; |
| 39 | | typedef avl_tree_node<T> tree_node; |
| 38 | friend class simple_set_iterator<T>; |
| 39 | typedef avl_tree_node<T> tree_node; |
| 40 | 40 | |
| 41 | 41 | public: |
| 42 | | // Construction |
| 43 | | simple_set(resource_pool &pool = global_resource_pool()) |
| 44 | | : m_root(NULL), |
| 45 | | m_pool(pool) |
| 46 | | { } |
| 42 | // Construction |
| 43 | simple_set(resource_pool &pool = global_resource_pool()) |
| 44 | : m_root(NULL), |
| 45 | m_pool(pool) |
| 46 | { } |
| 47 | 47 | |
| 48 | | simple_set(const simple_set& rhs) |
| 49 | | : m_root(NULL) |
| 50 | | { |
| 51 | | *this = rhs; |
| 52 | | } |
| 48 | simple_set(const simple_set& rhs) |
| 49 | : m_root(NULL) |
| 50 | { |
| 51 | *this = rhs; |
| 52 | } |
| 53 | 53 | |
| 54 | | ~simple_set() |
| 55 | | { |
| 56 | | clear(); |
| 57 | | } |
| 54 | ~simple_set() |
| 55 | { |
| 56 | clear(); |
| 57 | } |
| 58 | 58 | |
| 59 | 59 | |
| 60 | | // A reference to the resource pool |
| 60 | // A reference to the resource pool |
| 61 | 61 | resource_pool &pool() const { return m_pool; } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | | // Returns number of elements in the tree -- O(n) |
| 65 | | int size() const |
| 66 | | { |
| 67 | | if (empty()) return 0; |
| 64 | // Returns number of elements in the tree -- O(n) |
| 65 | int size() const |
| 66 | { |
| 67 | if (empty()) return 0; |
| 68 | 68 | |
| 69 | | const tree_node* currentNode = m_root; |
| 70 | | const int nodeCount = sizeRecurse(currentNode); |
| 71 | | return nodeCount; |
| 72 | | } |
| 69 | const tree_node* currentNode = m_root; |
| 70 | const int nodeCount = sizeRecurse(currentNode); |
| 71 | return nodeCount; |
| 72 | } |
| 73 | 73 | |
| 74 | 74 | |
| 75 | | // Test for emptiness -- O(1). |
| 76 | | bool empty() const |
| 77 | | { |
| 78 | | return m_root == NULL; |
| 79 | | } |
| 75 | // Test for emptiness -- O(1). |
| 76 | bool empty() const |
| 77 | { |
| 78 | return m_root == NULL; |
| 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | | // Empty the tree -- O(n). |
| 83 | | void clear() |
| 84 | | { |
| 85 | | clearRecurse(m_root); |
| 86 | | } |
| 82 | // Empty the tree -- O(n). |
| 83 | void clear() |
| 84 | { |
| 85 | clearRecurse(m_root); |
| 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | | // Insert x into the avl tree; duplicates are ignored -- O(log n). |
| 90 | | bool insert(const T& x) |
| 91 | | { |
| 92 | | bool retVal = insert(x, m_root); |
| 89 | // Insert x into the avl tree; duplicates are ignored -- O(log n). |
| 90 | bool insert(const T& x) |
| 91 | { |
| 92 | bool retVal = insert(x, m_root); |
| 93 | 93 | |
| 94 | | // Whether the node was successfully inserted or not (i.e. wasn't a duplicate) |
| 95 | | return retVal; |
| 96 | | } |
| 97 | | |
| 98 | | |
| 99 | | // Remove x from the tree. Nothing is done if x is not found -- O(n). |
| 100 | | bool remove(const T& x) |
| 101 | | { |
| 102 | | // First find the node in the tree |
| 103 | | tree_node* currNode = find(x, m_root); |
| 94 | // Whether the node was successfully inserted or not (i.e. wasn't a duplicate) |
| 95 | return retVal; |
| 96 | } |
| 104 | 97 | |
| 105 | | // Only do this when the current node is valid |
| 106 | | if (currNode) |
| 107 | | { |
| 108 | | // See if it's a leaf |
| 109 | | if (currNode->isLeaf()) |
| 110 | | { |
| 111 | | // If we're a leaf and we have no parent, then the tree will be emptied |
| 112 | | if (!currNode->parent) |
| 113 | | { |
| 114 | | m_root = NULL; |
| 115 | | } |
| 116 | 98 | |
| 117 | | // If it's a leaf node, simply remove it |
| 118 | | removeNode(currNode); |
| 119 | | pool_free(m_pool, currNode); |
| 120 | | } |
| 121 | | else |
| 122 | | { |
| 123 | | // Get the parent object |
| 124 | | tree_node* parentNode = currNode->parent; |
| 99 | // Remove x from the tree. Nothing is done if x is not found -- O(n). |
| 100 | bool remove(const T& x) |
| 101 | { |
| 102 | // First find the node in the tree |
| 103 | tree_node* currNode = find(x, m_root); |
| 125 | 104 | |
| 126 | | // Remove the child and reconnect the smallest node in the right sub tree |
| 127 | | // (in order successor) |
| 128 | | tree_node* replaceNode = findMin(currNode->right); |
| 105 | // Only do this when the current node is valid |
| 106 | if (currNode) |
| 107 | { |
| 108 | // See if it's a leaf |
| 109 | if (currNode->isLeaf()) |
| 110 | { |
| 111 | // If we're a leaf and we have no parent, then the tree will be emptied |
| 112 | if (!currNode->parent) |
| 113 | { |
| 114 | m_root = NULL; |
| 115 | } |
| 129 | 116 | |
| 130 | | // See if there's even a right-most node |
| 131 | | if (!replaceNode) |
| 132 | | { |
| 133 | | // Get the largest node on the left (because the right doesn't exist) |
| 134 | | replaceNode = findMax(currNode->left); |
| 135 | | } |
| 117 | // If it's a leaf node, simply remove it |
| 118 | removeNode(currNode); |
| 119 | pool_free(m_pool, currNode); |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | // Get the parent object |
| 124 | tree_node* parentNode = currNode->parent; |
| 136 | 125 | |
| 137 | | // Disconnect the replacement node's branch |
| 138 | | removeNode(replaceNode); |
| 126 | // Remove the child and reconnect the smallest node in the right sub tree |
| 127 | // (in order successor) |
| 128 | tree_node* replaceNode = findMin(currNode->right); |
| 139 | 129 | |
| 140 | | // Disconnect the current node |
| 141 | | removeNode(currNode); |
| 130 | // See if there's even a right-most node |
| 131 | if (!replaceNode) |
| 132 | { |
| 133 | // Get the largest node on the left (because the right doesn't exist) |
| 134 | replaceNode = findMax(currNode->left); |
| 135 | } |
| 142 | 136 | |
| 143 | | // Get the current node's left and right branches |
| 144 | | tree_node* left = currNode->left; |
| 145 | | tree_node* right = currNode->right; |
| 137 | // Disconnect the replacement node's branch |
| 138 | removeNode(replaceNode); |
| 146 | 139 | |
| 147 | | // We no longer need this node |
| 148 | | pool_free(m_pool, currNode); |
| 140 | // Disconnect the current node |
| 141 | removeNode(currNode); |
| 149 | 142 | |
| 150 | | // Check to see if we removed the root node |
| 151 | | if (!parentNode) |
| 152 | | { |
| 153 | | // Merge the branches into the parent node of what we deleted |
| 154 | | merge(replaceNode, parentNode); |
| 155 | | merge(left, parentNode); |
| 156 | | merge(right, parentNode); |
| 143 | // Get the current node's left and right branches |
| 144 | tree_node* left = currNode->left; |
| 145 | tree_node* right = currNode->right; |
| 157 | 146 | |
| 158 | | // Now we're the the root |
| 159 | | m_root = parentNode; |
| 160 | | } |
| 161 | | else |
| 162 | | { |
| 163 | | // Merge the branches into the parent node of what we |
| 164 | | // deleted, we let the merge algorithm decide where to |
| 165 | | // put the branches |
| 166 | | merge(replaceNode, parentNode); |
| 167 | | merge(left, parentNode); |
| 168 | | merge(right, parentNode); |
| 169 | | } |
| 170 | | } |
| 147 | // We no longer need this node |
| 148 | pool_free(m_pool, currNode); |
| 171 | 149 | |
| 172 | | // Balance the tree |
| 173 | | balanceTree(); |
| 150 | // Check to see if we removed the root node |
| 151 | if (!parentNode) |
| 152 | { |
| 153 | // Merge the branches into the parent node of what we deleted |
| 154 | merge(replaceNode, parentNode); |
| 155 | merge(left, parentNode); |
| 156 | merge(right, parentNode); |
| 174 | 157 | |
| 175 | | // The node was found and removed successfully |
| 176 | | return true; |
| 177 | | } |
| 178 | | else |
| 179 | | { |
| 180 | | // The node was not found |
| 181 | | return false; |
| 182 | | } |
| 183 | | } |
| 184 | | |
| 158 | // Now we're the the root |
| 159 | m_root = parentNode; |
| 160 | } |
| 161 | else |
| 162 | { |
| 163 | // Merge the branches into the parent node of what we |
| 164 | // deleted, we let the merge algorithm decide where to |
| 165 | // put the branches |
| 166 | merge(replaceNode, parentNode); |
| 167 | merge(left, parentNode); |
| 168 | merge(right, parentNode); |
| 169 | } |
| 170 | } |
| 185 | 171 | |
| 186 | | // Find item x in the tree. Returns a pointer to the matching item |
| 187 | | // or NULL if not found -- O(log n) |
| 188 | | T* find(const T& x) const |
| 189 | | { |
| 190 | | tree_node* found = find(x, m_root); |
| 191 | | if (found == NULL) return NULL; |
| 192 | | return &found->element; |
| 193 | | } |
| 194 | | |
| 172 | // Balance the tree |
| 173 | balanceTree(); |
| 195 | 174 | |
| 196 | | // Is the data present in the set? -- O(log n) |
| 197 | | bool contains(const T& x) const |
| 198 | | { |
| 199 | | if (find(x) != NULL) |
| 200 | | return true; |
| 201 | | else |
| 202 | | return false; |
| 203 | | } |
| 175 | // The node was found and removed successfully |
| 176 | return true; |
| 177 | } |
| 178 | else |
| 179 | { |
| 180 | // The node was not found |
| 181 | return false; |
| 182 | } |
| 183 | } |
| 204 | 184 | |
| 205 | 185 | |
| 206 | | // Merge a different tree with ours -- O(n). |
| 207 | | bool merge(const simple_set<T>& b) |
| 208 | | { |
| 209 | | tree_node* c = b->clone(); |
| 210 | | bool retVal = merge(c->m_root, m_root); |
| 186 | // Find item x in the tree. Returns a pointer to the matching item |
| 187 | // or NULL if not found -- O(log n) |
| 188 | T* find(const T& x) const |
| 189 | { |
| 190 | tree_node* found = find(x, m_root); |
| 191 | if (found == NULL) return NULL; |
| 192 | return &found->element; |
| 193 | } |
| 211 | 194 | |
| 212 | | // Re-balance the tree if the merge was successful |
| 213 | | if (retVal) |
| 214 | | { |
| 215 | | balanceTree(); |
| 216 | | } |
| 217 | | else |
| 218 | | { |
| 219 | | pool_free(m_pool, c); |
| 220 | | } |
| 221 | 195 | |
| 222 | | return retVal; |
| 223 | | } |
| 196 | // Is the data present in the set? -- O(log n) |
| 197 | bool contains(const T& x) const |
| 198 | { |
| 199 | if (find(x) != NULL) |
| 200 | return true; |
| 201 | else |
| 202 | return false; |
| 203 | } |
| 224 | 204 | |
| 225 | 205 | |
| 226 | | // Replace this set with another -- O(n) |
| 227 | | const simple_set& operator=(const simple_set& rhs) |
| 228 | | { |
| 229 | | // Don't clone if it's the same pointer |
| 230 | | if (this != &rhs) |
| 231 | | { |
| 232 | | clear(); |
| 206 | // Merge a different tree with ours -- O(n). |
| 207 | bool merge(const simple_set<T>& b) |
| 208 | { |
| 209 | tree_node* c = b->clone(); |
| 210 | bool retVal = merge(c->m_root, m_root); |
| 233 | 211 | |
| 234 | | m_root = clone(rhs.m_root); |
| 235 | | } |
| 212 | // Re-balance the tree if the merge was successful |
| 213 | if (retVal) |
| 214 | { |
| 215 | balanceTree(); |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | pool_free(m_pool, c); |
| 220 | } |
| 236 | 221 | |
| 237 | | return *this; |
| 238 | | } |
| 222 | return retVal; |
| 223 | } |
| 239 | 224 | |
| 240 | 225 | |
| 226 | // Replace this set with another -- O(n) |
| 227 | const simple_set& operator=(const simple_set& rhs) |
| 228 | { |
| 229 | // Don't clone if it's the same pointer |
| 230 | if (this != &rhs) |
| 231 | { |
| 232 | clear(); |
| 233 | |
| 234 | m_root = clone(rhs.m_root); |
| 235 | } |
| 236 | |
| 237 | return *this; |
| 238 | } |
| 239 | |
| 240 | |
| 241 | 241 | #ifdef SIMPLE_SET_DEBUG |
| 242 | | // Debug -- O(n log n) |
| 243 | | void printTree(std::ostream& out = std::cout) const |
| 244 | | { |
| 245 | | if(empty()) |
| 246 | | { |
| 247 | | out << "Empty tree" << std::endl; |
| 248 | | } |
| 249 | | else |
| 250 | | { |
| 251 | | printTree(out, m_root); |
| 252 | | } |
| 253 | | } |
| 242 | // Debug -- O(n log n) |
| 243 | void printTree(std::ostream& out = std::cout) const |
| 244 | { |
| 245 | if(empty()) |
| 246 | { |
| 247 | out << "Empty tree" << std::endl; |
| 248 | } |
| 249 | else |
| 250 | { |
| 251 | printTree(out, m_root); |
| 252 | } |
| 253 | } |
| 254 | 254 | #endif |
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | private: |
| 258 | | // The AVL tree's root |
| 259 | | tree_node* m_root; |
| 258 | // The AVL tree's root |
| 259 | tree_node* m_root; |
| 260 | 260 | |
| 261 | | // Resource pool where objects are freed |
| 262 | | resource_pool& m_pool; |
| 261 | // Resource pool where objects are freed |
| 262 | resource_pool& m_pool; |
| 263 | 263 | |
| 264 | 264 | |
| 265 | | // Find a node in the tree |
| 266 | | tree_node* findNode(const T& x) const |
| 267 | | { |
| 268 | | tree_node* node = find(x, m_root); |
| 269 | | if (node) |
| 270 | | { |
| 271 | | return node; |
| 272 | | } |
| 273 | | else |
| 274 | | { |
| 275 | | return NULL; |
| 276 | | } |
| 277 | | } |
| 265 | // Find a node in the tree |
| 266 | tree_node* findNode(const T& x) const |
| 267 | { |
| 268 | tree_node* node = find(x, m_root); |
| 269 | if (node) |
| 270 | { |
| 271 | return node; |
| 272 | } |
| 273 | else |
| 274 | { |
| 275 | return NULL; |
| 276 | } |
| 277 | } |
| 278 | 278 | |
| 279 | 279 | |
| 280 | | // Insert item x into a subtree t (root) -- O(log n) |
| 281 | | bool insert(const T& x, tree_node*& t) |
| 282 | | { |
| 283 | | if (t == NULL) |
| 284 | | { |
| 285 | | t = pool_alloc(m_pool, tree_node(x, NULL, NULL, NULL)); |
| 280 | // Insert item x into a subtree t (root) -- O(log n) |
| 281 | bool insert(const T& x, tree_node*& t) |
| 282 | { |
| 283 | if (t == NULL) |
| 284 | { |
| 285 | t = pool_alloc(m_pool, tree_node(x, NULL, NULL, NULL)); |
| 286 | 286 | |
| 287 | | // An empty sub-tree here, insertion successful |
| 288 | | return true; |
| 289 | | } |
| 290 | | else if (x < t->element) |
| 291 | | { |
| 292 | | // O(log n) |
| 293 | | bool retVal = insert(x, t->left); |
| 287 | // An empty sub-tree here, insertion successful |
| 288 | return true; |
| 289 | } |
| 290 | else if (x < t->element) |
| 291 | { |
| 292 | // O(log n) |
| 293 | bool retVal = insert(x, t->left); |
| 294 | 294 | |
| 295 | | if (retVal) |
| 296 | | { |
| 297 | | t->left->setParent(t); |
| 298 | | if(t->balanceFactor() < -1) |
| 299 | | { |
| 300 | | // See if it went left of the left |
| 301 | | if(x < t->left->element) |
| 302 | | { |
| 303 | | rotateWithLeftChild(t); |
| 304 | | } |
| 305 | | else |
| 306 | | { |
| 307 | | // The element goes on the right of the left |
| 308 | | doubleWithLeftChild(t); |
| 309 | | } |
| 310 | | } |
| 311 | | } |
| 295 | if (retVal) |
| 296 | { |
| 297 | t->left->setParent(t); |
| 298 | if(t->balanceFactor() < -1) |
| 299 | { |
| 300 | // See if it went left of the left |
| 301 | if(x < t->left->element) |
| 302 | { |
| 303 | rotateWithLeftChild(t); |
| 304 | } |
| 305 | else |
| 306 | { |
| 307 | // The element goes on the right of the left |
| 308 | doubleWithLeftChild(t); |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | 312 | |
| 313 | | return retVal; |
| 314 | | } |
| 315 | | else if (t->element < x) |
| 316 | | { |
| 317 | | bool retVal = insert(x, t->right); |
| 313 | return retVal; |
| 314 | } |
| 315 | else if (t->element < x) |
| 316 | { |
| 317 | bool retVal = insert(x, t->right); |
| 318 | 318 | |
| 319 | | // Only do this if the insertion was successful |
| 320 | | if (retVal) |
| 321 | | { |
| 322 | | t->right->setParent(t); |
| 319 | // Only do this if the insertion was successful |
| 320 | if (retVal) |
| 321 | { |
| 322 | t->right->setParent(t); |
| 323 | 323 | |
| 324 | | if (t->balanceFactor() > 1) |
| 325 | | { |
| 326 | | // See if it went right of the right |
| 327 | | if(t->right->element < x) |
| 328 | | { |
| 329 | | rotateWithRightChild(t); |
| 330 | | } |
| 331 | | else |
| 332 | | { |
| 333 | | // The element goes on the left of the right |
| 334 | | doubleWithRightChild(t); |
| 335 | | } |
| 336 | | } |
| 337 | | } |
| 324 | if (t->balanceFactor() > 1) |
| 325 | { |
| 326 | // See if it went right of the right |
| 327 | if(t->right->element < x) |
| 328 | { |
| 329 | rotateWithRightChild(t); |
| 330 | } |
| 331 | else |
| 332 | { |
| 333 | // The element goes on the left of the right |
| 334 | doubleWithRightChild(t); |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | 338 | |
| 339 | | return retVal; |
| 340 | | } |
| 341 | | else |
| 342 | | { |
| 343 | | return false; // Duplicate |
| 344 | | } |
| 345 | | } |
| 339 | return retVal; |
| 340 | } |
| 341 | else |
| 342 | { |
| 343 | return false; // Duplicate |
| 344 | } |
| 345 | } |
| 346 | 346 | |
| 347 | | |
| 348 | | // Recursively free all nodes in the tree -- O(n). |
| 349 | | void clearRecurse(tree_node*& t) const |
| 350 | | { |
| 351 | | if(t != NULL) |
| 352 | | { |
| 353 | | clearRecurse(t->left); |
| 354 | | clearRecurse(t->right); |
| 355 | 347 | |
| 356 | | pool_free(m_pool, t); |
| 357 | | } |
| 358 | | t = NULL; |
| 359 | | } |
| 348 | // Recursively free all nodes in the tree -- O(n). |
| 349 | void clearRecurse(tree_node*& t) const |
| 350 | { |
| 351 | if(t != NULL) |
| 352 | { |
| 353 | clearRecurse(t->left); |
| 354 | clearRecurse(t->right); |
| 360 | 355 | |
| 356 | pool_free(m_pool, t); |
| 357 | } |
| 358 | t = NULL; |
| 359 | } |
| 361 | 360 | |
| 362 | | // Merge a tree with this one. Private because external care is required. |
| 363 | | bool merge(tree_node* b, tree_node*& t) |
| 364 | | { |
| 365 | | if (!b) |
| 366 | | { |
| 367 | | return false; |
| 368 | | } |
| 369 | | else |
| 370 | | { |
| 371 | | bool retVal = false; |
| 372 | 361 | |
| 373 | | if (t == NULL) |
| 374 | | { |
| 375 | | // Set this element to that subtree |
| 376 | | t = b; |
| 362 | // Merge a tree with this one. Private because external care is required. |
| 363 | bool merge(tree_node* b, tree_node*& t) |
| 364 | { |
| 365 | if (!b) |
| 366 | { |
| 367 | return false; |
| 368 | } |
| 369 | else |
| 370 | { |
| 371 | bool retVal = false; |
| 377 | 372 | |
| 378 | | // The parent here should be NULL anyway, but we |
| 379 | | // set it just to be sure. This pointer will be |
| 380 | | // used as a flag to indicate where in the call |
| 381 | | // stack the tree was actually set. |
| 382 | | // |
| 383 | | // The middle layers of this method's call will |
| 384 | | // all have their parent references in tact since |
| 385 | | // no operations took place there. |
| 386 | | // |
| 387 | | //t->parent = NULL; |
| 388 | | t->setParent(NULL); |
| 373 | if (t == NULL) |
| 374 | { |
| 375 | // Set this element to that subtree |
| 376 | t = b; |
| 389 | 377 | |
| 390 | | // We were successful in merging |
| 391 | | retVal = true; |
| 392 | | } |
| 393 | | else if (b->element < t->element) |
| 394 | | { |
| 395 | | retVal = merge(b, t->left); |
| 378 | // The parent here should be NULL anyway, but we |
| 379 | // set it just to be sure. This pointer will be |
| 380 | // used as a flag to indicate where in the call |
| 381 | // stack the tree was actually set. |
| 382 | // |
| 383 | // The middle layers of this method's call will |
| 384 | // all have their parent references in tact since |
| 385 | // no operations took place there. |
| 386 | // |
| 387 | //t->parent = NULL; |
| 388 | t->setParent(NULL); |
| 396 | 389 | |
| 397 | | // Only do this if the insertion actually took place |
| 398 | | if (retVal && !t->left->parent) |
| 399 | | { |
| 400 | | t->left->setParent(t); |
| 401 | | } |
| 402 | | } |
| 403 | | else if (t->element < b->element) |
| 404 | | { |
| 405 | | retVal = merge(b, t->right); |
| 390 | // We were successful in merging |
| 391 | retVal = true; |
| 392 | } |
| 393 | else if (b->element < t->element) |
| 394 | { |
| 395 | retVal = merge(b, t->left); |
| 406 | 396 | |
| 407 | | // Only do this if the insertion was successful |
| 408 | | if (retVal && !t->right->parent) |
| 409 | | { |
| 410 | | t->right->setParent(t); |
| 411 | | } |
| 397 | // Only do this if the insertion actually took place |
| 398 | if (retVal && !t->left->parent) |
| 399 | { |
| 400 | t->left->setParent(t); |
| 401 | } |
| 402 | } |
| 403 | else if (t->element < b->element) |
| 404 | { |
| 405 | retVal = merge(b, t->right); |
| 412 | 406 | |
| 413 | | return retVal; |
| 414 | | } |
| 407 | // Only do this if the insertion was successful |
| 408 | if (retVal && !t->right->parent) |
| 409 | { |
| 410 | t->right->setParent(t); |
| 411 | } |
| 415 | 412 | |
| 416 | | return retVal; |
| 417 | | } |
| 418 | | } |
| 413 | return retVal; |
| 414 | } |
| 419 | 415 | |
| 416 | return retVal; |
| 417 | } |
| 418 | } |
| 420 | 419 | |
| 421 | | // Find the smallest item's node in a subtree t -- O(log n). |
| 422 | | tree_node* findMin(tree_node* t) const |
| 423 | | { |
| 424 | | if(t == NULL) |
| 425 | | { |
| 426 | | return t; |
| 427 | | } |
| 428 | 420 | |
| 429 | | while(t->left != NULL) |
| 430 | | { |
| 431 | | t = t->left; |
| 432 | | } |
| 421 | // Find the smallest item's node in a subtree t -- O(log n). |
| 422 | tree_node* findMin(tree_node* t) const |
| 423 | { |
| 424 | if(t == NULL) |
| 425 | { |
| 426 | return t; |
| 427 | } |
| 433 | 428 | |
| 434 | | return t; |
| 435 | | } |
| 436 | | |
| 437 | | |
| 438 | | // Find the smallest item's node in a subtree t -- O(log n). |
| 439 | | tree_node* findMax(tree_node* t) const |
| 440 | | { |
| 441 | | if(t == NULL) |
| 442 | | { |
| 443 | | return t; |
| 444 | | } |
| 429 | while(t->left != NULL) |
| 430 | { |
| 431 | t = t->left; |
| 432 | } |
| 445 | 433 | |
| 446 | | while(t->right != NULL) |
| 447 | | { |
| 448 | | t = t->right; |
| 449 | | } |
| 434 | return t; |
| 435 | } |
| 450 | 436 | |
| 451 | | return t; |
| 452 | | } |
| 453 | 437 | |
| 438 | // Find the smallest item's node in a subtree t -- O(log n). |
| 439 | tree_node* findMax(tree_node* t) const |
| 440 | { |
| 441 | if(t == NULL) |
| 442 | { |
| 443 | return t; |
| 444 | } |
| 454 | 445 | |
| 455 | | // Find item x's node in subtree t -- O(log n) |
| 456 | | tree_node* find(const T& x, tree_node* t) const |
| 457 | | { |
| 458 | | while(t != NULL) |
| 459 | | { |
| 460 | | if (x < t->element) |
| 461 | | { |
| 462 | | t = t->left; |
| 463 | | } |
| 464 | | else if (t->element < x) |
| 465 | | { |
| 466 | | t = t->right; |
| 467 | | } |
| 468 | | else |
| 469 | | { |
| 470 | | return t; // Match |
| 471 | | } |
| 472 | | } |
| 446 | while(t->right != NULL) |
| 447 | { |
| 448 | t = t->right; |
| 449 | } |
| 473 | 450 | |
| 474 | | return NULL; // No match |
| 475 | | } |
| 451 | return t; |
| 452 | } |
| 476 | 453 | |
| 477 | 454 | |
| 478 | | // Clone a subtree -- O(n) |
| 479 | | tree_node* clone(const tree_node* t) const |
| 480 | | { |
| 481 | | if(t == NULL) |
| 482 | | { |
| 483 | | return NULL; |
| 484 | | } |
| 485 | | else |
| 486 | | { |
| 487 | | // Create a node with the left and right nodes and a parent set to NULL |
| 488 | | tree_node* retVal = pool_alloc(m_pool, tree_node(t->element, NULL, clone(t->left), clone(t->right))); |
| 455 | // Find item x's node in subtree t -- O(log n) |
| 456 | tree_node* find(const T& x, tree_node* t) const |
| 457 | { |
| 458 | while(t != NULL) |
| 459 | { |
| 460 | if (x < t->element) |
| 461 | { |
| 462 | t = t->left; |
| 463 | } |
| 464 | else if (t->element < x) |
| 465 | { |
| 466 | t = t->right; |
| 467 | } |
| 468 | else |
| 469 | { |
| 470 | return t; // Match |
| 471 | } |
| 472 | } |
| 489 | 473 | |
| 490 | | // Now set our children's parent node reference |
| 491 | | if (retVal->left) { retVal->left->setParent(retVal); } |
| 492 | | if (retVal->right) { retVal->right->setParent(retVal); } |
| 474 | return NULL; // No match |
| 475 | } |
| 493 | 476 | |
| 494 | | return retVal; |
| 495 | | } |
| 496 | | } |
| 497 | 477 | |
| 478 | // Clone a subtree -- O(n) |
| 479 | tree_node* clone(const tree_node* t) const |
| 480 | { |
| 481 | if(t == NULL) |
| 482 | { |
| 483 | return NULL; |
| 484 | } |
| 485 | else |
| 486 | { |
| 487 | // Create a node with the left and right nodes and a parent set to NULL |
| 488 | tree_node* retVal = pool_alloc(m_pool, tree_node(t->element, NULL, clone(t->left), clone(t->right))); |
| 498 | 489 | |
| 499 | | // Rotate binary tree node with left child. |
| 500 | | // Single rotation for case 1 -- O(1). |
| 501 | | void rotateWithLeftChild(tree_node*& k2) const |
| 502 | | { |
| 503 | | tree_node* k1 = k2->left; |
| 504 | | tree_node* k2Parent = k2->parent; |
| 490 | // Now set our children's parent node reference |
| 491 | if (retVal->left) { retVal->left->setParent(retVal); } |
| 492 | if (retVal->right) { retVal->right->setParent(retVal); } |
| 505 | 493 | |
| 506 | | k2->setLeft(k1->right); |
| 507 | | if (k2->left) { k2->left->setParent(k2); } |
| 494 | return retVal; |
| 495 | } |
| 496 | } |
| 508 | 497 | |
| 509 | | k1->setRight(k2); |
| 510 | | if (k1->right) { k1->right->setParent(k1); } |
| 511 | 498 | |
| 512 | | k2 = k1; |
| 513 | | k2->setParent(k2Parent); |
| 514 | | } |
| 499 | // Rotate binary tree node with left child. |
| 500 | // Single rotation for case 1 -- O(1). |
| 501 | void rotateWithLeftChild(tree_node*& k2) const |
| 502 | { |
| 503 | tree_node* k1 = k2->left; |
| 504 | tree_node* k2Parent = k2->parent; |
| 515 | 505 | |
| 516 | | |
| 517 | | // Rotate binary tree node with right child. |
| 518 | | // Single rotation for case 4 -- O(1). |
| 519 | | void rotateWithRightChild(tree_node*& k1) const |
| 520 | | { |
| 521 | | tree_node* k2 = k1->right; |
| 522 | | tree_node* k1Parent = k1->parent; |
| 506 | k2->setLeft(k1->right); |
| 507 | if (k2->left) { k2->left->setParent(k2); } |
| 523 | 508 | |
| 524 | | k1->setRight(k2->left); |
| 525 | | if (k1->right) { k1->right->setParent(k1); } |
| 509 | k1->setRight(k2); |
| 510 | if (k1->right) { k1->right->setParent(k1); } |
| 526 | 511 | |
| 527 | | k2->setLeft(k1); |
| 528 | | if (k2->left) { k2->left->setParent(k2); } |
| 512 | k2 = k1; |
| 513 | k2->setParent(k2Parent); |
| 514 | } |
| 529 | 515 | |
| 530 | | k1 = k2; |
| 531 | | k1->setParent(k1Parent); |
| 532 | | } |
| 533 | 516 | |
| 534 | | |
| 535 | | // Double rotate binary tree node: first left child |
| 536 | | // with its right child; then node k3 with new left child. |
| 537 | | // Double rotation for case 2 -- O(1). |
| 538 | | void doubleWithLeftChild(tree_node*& k3) const |
| 539 | | { |
| 540 | | rotateWithRightChild(k3->left); |
| 541 | | rotateWithLeftChild(k3); |
| 542 | | } |
| 517 | // Rotate binary tree node with right child. |
| 518 | // Single rotation for case 4 -- O(1). |
| 519 | void rotateWithRightChild(tree_node*& k1) const |
| 520 | { |
| 521 | tree_node* k2 = k1->right; |
| 522 | tree_node* k1Parent = k1->parent; |
| 543 | 523 | |
| 544 | | |
| 545 | | // Double rotate binary tree node: first right child |
| 546 | | // with its left child; then node k1 with new right child. |
| 547 | | // Double rotation for case 3 -- O(1). |
| 548 | | void doubleWithRightChild(tree_node*& k1) const |
| 549 | | { |
| 550 | | rotateWithLeftChild(k1->right); |
| 551 | | rotateWithRightChild(k1); |
| 552 | | } |
| 524 | k1->setRight(k2->left); |
| 525 | if (k1->right) { k1->right->setParent(k1); } |
| 553 | 526 | |
| 527 | k2->setLeft(k1); |
| 528 | if (k2->left) { k2->left->setParent(k2); } |
| 554 | 529 | |
| 555 | | // Removes a node. Returns true if the node was on the left side of its parent -- O(1). |
| 556 | | void removeNode(tree_node*& node) |
| 557 | | { |
| 558 | | // It is a leaf, simply remove the item and disconnect the parent |
| 559 | | if (node->isLeft()) |
| 560 | | { |
| 561 | | node->parent->setLeft(NULL); |
| 562 | | } |
| 563 | | else // (node == node->parent->right) |
| 564 | | { |
| 565 | | if (node->parent) { node->parent->setRight(NULL); } |
| 566 | | } |
| 530 | k1 = k2; |
| 531 | k1->setParent(k1Parent); |
| 532 | } |
| 567 | 533 | |
| 568 | | node->setParent(NULL); |
| 569 | | } |
| 570 | 534 | |
| 535 | // Double rotate binary tree node: first left child |
| 536 | // with its right child; then node k3 with new left child. |
| 537 | // Double rotation for case 2 -- O(1). |
| 538 | void doubleWithLeftChild(tree_node*& k3) const |
| 539 | { |
| 540 | rotateWithRightChild(k3->left); |
| 541 | rotateWithLeftChild(k3); |
| 542 | } |
| 571 | 543 | |
| 572 | | // Swap one node with another -- O(1). |
| 573 | | void replaceNode(tree_node*& node1, tree_node*& node2) |
| 574 | | { |
| 575 | | // Save both parent references |
| 576 | | simple_set<T>* node1Parent = node1->parent; |
| 577 | | simple_set<T>* node2Parent = node2->parent; |
| 578 | 544 | |
| 579 | | // First move node2 into node1's place |
| 580 | | if (node1Parent) |
| 581 | | { |
| 582 | | if (isLeft(node1)) |
| 583 | | { |
| 584 | | node1Parent->setLeft(node2); |
| 585 | | } |
| 586 | | else // node1 is on the right |
| 587 | | { |
| 588 | | node1Parent->setRight(node2); |
| 589 | | } |
| 590 | | } |
| 591 | | node2->setParent(node1Parent); |
| 545 | // Double rotate binary tree node: first right child |
| 546 | // with its left child; then node k1 with new right child. |
| 547 | // Double rotation for case 3 -- O(1). |
| 548 | void doubleWithRightChild(tree_node*& k1) const |
| 549 | { |
| 550 | rotateWithLeftChild(k1->right); |
| 551 | rotateWithRightChild(k1); |
| 552 | } |
| 592 | 553 | |
| 593 | | // Now move node1 into node2's place |
| 594 | | if (node2Parent) |
| 595 | | { |
| 596 | | if (isLeft(node2)) |
| 597 | | { |
| 598 | | node2Parent->setLeft(node1); |
| 599 | | } |
| 600 | | else // node2 is on the right |
| 601 | | { |
| 602 | | node2Parent->setRight(node1); |
| 603 | | } |
| 604 | | } |
| 605 | | node1->setParent(node2Parent); |
| 606 | | } |
| 607 | 554 | |
| 555 | // Removes a node. Returns true if the node was on the left side of its parent -- O(1). |
| 556 | void removeNode(tree_node*& node) |
| 557 | { |
| 558 | // It is a leaf, simply remove the item and disconnect the parent |
| 559 | if (node->isLeft()) |
| 560 | { |
| 561 | node->parent->setLeft(NULL); |
| 562 | } |
| 563 | else // (node == node->parent->right) |
| 564 | { |
| 565 | if (node->parent) { node->parent->setRight(NULL); } |
| 566 | } |
| 608 | 567 | |
| 609 | | // Balances the tree starting at the root node |
| 610 | | void balanceTree() { balanceTree(m_root); } |
| 568 | node->setParent(NULL); |
| 569 | } |
| 611 | 570 | |
| 612 | 571 | |
| 613 | | // Balance the tree starting at the given node -- O(n). |
| 614 | | void balanceTree(tree_node*& node) |
| 615 | | { |
| 616 | | if (node) |
| 617 | | { |
| 618 | | // First see what the balance factor for this node is |
| 619 | | int balFactor = node->balanceFactor(); |
| 572 | // Swap one node with another -- O(1). |
| 573 | void replaceNode(tree_node*& node1, tree_node*& node2) |
| 574 | { |
| 575 | // Save both parent references |
| 576 | simple_set<T>* node1Parent = node1->parent; |
| 577 | simple_set<T>* node2Parent = node2->parent; |
| 620 | 578 | |
| 621 | | if (balFactor < -1) |
| 622 | | { |
| 623 | | // See if we're heavy left of the left |
| 624 | | if(node->left->balanceFactor() < 0) |
| 625 | | { |
| 626 | | rotateWithLeftChild(node); |
| 627 | | } |
| 628 | | else // if (node->left->balanceFactor() > 0) |
| 629 | | { |
| 630 | | // We're heavy on the right of the left |
| 631 | | doubleWithLeftChild(node); |
| 632 | | } |
| 633 | | } |
| 634 | | else if (balFactor > 1) |
| 635 | | { |
| 636 | | // See if it we're heavy right of the right |
| 637 | | if(node->right->balanceFactor() > 0) |
| 638 | | { |
| 639 | | rotateWithRightChild(node); |
| 640 | | } |
| 641 | | else // if (node->right->balanceFactor() < 0) |
| 642 | | { |
| 643 | | // The element goes on the left of the right |
| 644 | | doubleWithRightChild(node); |
| 645 | | } |
| 646 | | } |
| 647 | | else // if (balFactor >= -1 && balFactor <= 1) |
| 648 | | { |
| 649 | | // We're balanced here, but are our children balanced? |
| 650 | | balanceTree(node->left); |
| 651 | | balanceTree(node->right); |
| 652 | | } |
| 653 | | } |
| 654 | | } |
| 579 | // First move node2 into node1's place |
| 580 | if (node1Parent) |
| 581 | { |
| 582 | if (isLeft(node1)) |
| 583 | { |
| 584 | node1Parent->setLeft(node2); |
| 585 | } |
| 586 | else // node1 is on the right |
| 587 | { |
| 588 | node1Parent->setRight(node2); |
| 589 | } |
| 590 | } |
| 591 | node2->setParent(node1Parent); |
| 655 | 592 | |
| 593 | // Now move node1 into node2's place |
| 594 | if (node2Parent) |
| 595 | { |
| 596 | if (isLeft(node2)) |
| 597 | { |
| 598 | node2Parent->setLeft(node1); |
| 599 | } |
| 600 | else // node2 is on the right |
| 601 | { |
| 602 | node2Parent->setRight(node1); |
| 603 | } |
| 604 | } |
| 605 | node1->setParent(node2Parent); |
| 606 | } |
| 656 | 607 | |
| 657 | | // Recursive helper function for public size() |
| 658 | | int sizeRecurse(const tree_node* currentNode) const |
| 659 | | { |
| 660 | | int nodeCount = 1; |
| 661 | | if (currentNode->left != NULL) |
| 662 | | nodeCount += sizeRecurse(currentNode->left); |
| 663 | | if (currentNode->right != NULL) |
| 664 | | nodeCount += sizeRecurse(currentNode->right); |
| 665 | | return nodeCount; |
| 666 | | } |
| 667 | 608 | |
| 609 | // Balances the tree starting at the root node |
| 610 | void balanceTree() { balanceTree(m_root); } |
| 668 | 611 | |
| 612 | |
| 613 | // Balance the tree starting at the given node -- O(n). |
| 614 | void balanceTree(tree_node*& node) |
| 615 | { |
| 616 | if (node) |
| 617 | { |
| 618 | // First see what the balance factor for this node is |
| 619 | int balFactor = node->balanceFactor(); |
| 620 | |
| 621 | if (balFactor < -1) |
| 622 | { |
| 623 | // See if we're heavy left of the left |
| 624 | if(node->left->balanceFactor() < 0) |
| 625 | { |
| 626 | rotateWithLeftChild(node); |
| 627 | } |
| 628 | else // if (node->left->balanceFactor() > 0) |
| 629 | { |
| 630 | // We're heavy on the right of the left |
| 631 | doubleWithLeftChild(node); |
| 632 | } |
| 633 | } |
| 634 | else if (balFactor > 1) |
| 635 | { |
| 636 | // See if it we're heavy right of the right |
| 637 | if(node->right->balanceFactor() > 0) |
| 638 | { |
| 639 | rotateWithRightChild(node); |
| 640 | } |
| 641 | else // if (node->right->balanceFactor() < 0) |
| 642 | { |
| 643 | // The element goes on the left of the right |
| 644 | doubleWithRightChild(node); |
| 645 | } |
| 646 | } |
| 647 | else // if (balFactor >= -1 && balFactor <= 1) |
| 648 | { |
| 649 | // We're balanced here, but are our children balanced? |
| 650 | balanceTree(node->left); |
| 651 | balanceTree(node->right); |
| 652 | } |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | |
| 657 | // Recursive helper function for public size() |
| 658 | int sizeRecurse(const tree_node* currentNode) const |
| 659 | { |
| 660 | int nodeCount = 1; |
| 661 | if (currentNode->left != NULL) |
| 662 | nodeCount += sizeRecurse(currentNode->left); |
| 663 | if (currentNode->right != NULL) |
| 664 | nodeCount += sizeRecurse(currentNode->right); |
| 665 | return nodeCount; |
| 666 | } |
| 667 | |
| 668 | |
| 669 | 669 | #ifdef SIMPLE_SET_DEBUG |
| 670 | | // Debug. Print from the start node, down -- O(n log n). |
| 671 | | void printTree(std::ostream& out, tree_node* t=NULL, int numTabs=0, char lr='_') const |
| 672 | | { |
| 673 | | if(t != NULL) |
| 674 | | { |
| 675 | | for (int i =0; i < numTabs; i++) { out << " "; } out << "|_" << lr << "__ "; |
| 676 | | out << t->element << " {h = " << t->height() << ", b = " << t->balanceFactor() << "} "; |
| 677 | | // TODO: Reinstate out << std::hex << t << " (p = " << t->parent << ")" << std::dec; |
| 678 | | out << std::endl; |
| 670 | // Debug. Print from the start node, down -- O(n log n). |
| 671 | void printTree(std::ostream& out, tree_node* t=NULL, int numTabs=0, char lr='_') const |
| 672 | { |
| 673 | if(t != NULL) |
| 674 | { |
| 675 | for (int i =0; i < numTabs; i++) { out << " "; } out << "|_" << lr << "__ "; |
| 676 | out << t->element << " {h = " << t->height() << ", b = " << t->balanceFactor() << "} "; |
| 677 | // TODO: Reinstate out << std::hex << t << " (p = " << t->parent << ")" << std::dec; |
| 678 | out << std::endl; |
| 679 | 679 | |
| 680 | | printTree(out, t->left, numTabs + 1, '<'); |
| 681 | | printTree(out, t->right, numTabs + 1, '>'); |
| 682 | | } |
| 683 | | } |
| 680 | printTree(out, t->left, numTabs + 1, '<'); |
| 681 | printTree(out, t->right, numTabs + 1, '>'); |
| 682 | } |
| 683 | } |
| 684 | 684 | #endif |
| 685 | 685 | }; |
| 686 | 686 | |
| r22615 | r22616 | |
| 692 | 692 | |
| 693 | 693 | template <class T> class avl_tree_node |
| 694 | 694 | { |
| 695 | | friend class simple_set<T>; |
| 696 | | friend class simple_set_iterator<T>; |
| 697 | | typedef avl_tree_node<T> tree_node; |
| 695 | friend class simple_set<T>; |
| 696 | friend class simple_set_iterator<T>; |
| 697 | typedef avl_tree_node<T> tree_node; |
| 698 | 698 | |
| 699 | 699 | public: |
| 700 | | // Construction |
| 701 | | avl_tree_node(const T& theElement, avl_tree_node* p, avl_tree_node* lt, avl_tree_node* rt) |
| 702 | | : element(theElement), |
| 703 | | parent(p), |
| 704 | | left(lt), |
| 705 | | right(rt), |
| 706 | | m_height(1), |
| 707 | | m_balanceFactor(0) |
| 708 | | { } |
| 700 | // Construction |
| 701 | avl_tree_node(const T& theElement, avl_tree_node* p, avl_tree_node* lt, avl_tree_node* rt) |
| 702 | : element(theElement), |
| 703 | parent(p), |
| 704 | left(lt), |
| 705 | right(rt), |
| 706 | m_height(1), |
| 707 | m_balanceFactor(0) |
| 708 | { } |
| 709 | 709 | |
| 710 | 710 | |
| 711 | | // Are we to our parent's left? |
| 712 | | bool isLeft() |
| 713 | | { |
| 714 | | if (parent && this == parent->left) |
| 715 | | { |
| 716 | | return true; |
| 717 | | } |
| 718 | | else |
| 719 | | { |
| 720 | | return false; |
| 721 | | } |
| 722 | | } |
| 711 | // Are we to our parent's left? |
| 712 | bool isLeft() |
| 713 | { |
| 714 | if (parent && this == parent->left) |
| 715 | { |
| 716 | return true; |
| 717 | } |
| 718 | else |
| 719 | { |
| 720 | return false; |
| 721 | } |
| 722 | } |
| 723 | 723 | |
| 724 | 724 | |
| 725 | | // Are we a leaf node? |
| 726 | | bool isLeaf() { return !left && !right; } |
| 725 | // Are we a leaf node? |
| 726 | bool isLeaf() { return !left && !right; } |
| 727 | 727 | |
| 728 | 728 | |
| 729 | | // Set the parent pointer |
| 730 | | void setParent(tree_node* p) |
| 731 | | { |
| 732 | | // Set our new parent |
| 733 | | parent = p; |
| 729 | // Set the parent pointer |
| 730 | void setParent(tree_node* p) |
| 731 | { |
| 732 | // Set our new parent |
| 733 | parent = p; |
| 734 | 734 | |
| 735 | | // If we have a valid parent, set its height |
| 736 | | if (parent) |
| 737 | | { |
| 738 | | // Set the parent's height to include this tree. If the parent |
| 739 | | // already has a tree that is taller than the one we're attaching |
| 740 | | // then the parent's height remains unchanged |
| 741 | | int rightHeight = (parent->right ? parent->right->m_height : 0); |
| 742 | | int leftHeight = (parent->left ? parent->left->m_height : 0); |
| 735 | // If we have a valid parent, set its height |
| 736 | if (parent) |
| 737 | { |
| 738 | // Set the parent's height to include this tree. If the parent |
| 739 | // already has a tree that is taller than the one we're attaching |
| 740 | // then the parent's height remains unchanged |
| 741 | int rightHeight = (parent->right ? parent->right->m_height : 0); |
| 742 | int leftHeight = (parent->left ? parent->left->m_height : 0); |
| 743 | 743 | |
| 744 | | // The height of the tallest branch + 1 |
| 745 | | parent->m_height = maxInt(rightHeight, leftHeight) + 1; |
| 744 | // The height of the tallest branch + 1 |
| 745 | parent->m_height = maxInt(rightHeight, leftHeight) + 1; |
| 746 | 746 | |
| 747 | | // Also set the balance factor |
| 748 | | parent->m_balanceFactor = rightHeight - leftHeight; |
| 749 | | } |
| 750 | | } |
| 747 | // Also set the balance factor |
| 748 | parent->m_balanceFactor = rightHeight - leftHeight; |
| 749 | } |
| 750 | } |
| 751 | 751 | |
| 752 | 752 | |
| 753 | | // Set the left child pointer |
| 754 | | void setLeft(tree_node* l) |
| 755 | | { |
| 756 | | // Set our new left node |
| 757 | | left = l; |
| 753 | // Set the left child pointer |
| 754 | void setLeft(tree_node* l) |
| 755 | { |
| 756 | // Set our new left node |
| 757 | left = l; |
| 758 | 758 | |
| 759 | | // Set the height and balance factor |
| 760 | | int rightHeight = (right ? right->m_height : 0); |
| 761 | | int leftHeight = (left ? left->m_height : 0); |
| 759 | // Set the height and balance factor |
| 760 | int rightHeight = (right ? right->m_height : 0); |
| 761 | int leftHeight = (left ? left->m_height : 0); |
| 762 | 762 | |
| 763 | | m_height = maxInt(rightHeight, leftHeight) + 1; |
| 764 | | m_balanceFactor = (right ? right->m_height : 0) - (left ? left->m_height : 0); |
| 765 | | } |
| 766 | | |
| 763 | m_height = maxInt(rightHeight, leftHeight) + 1; |
| 764 | m_balanceFactor = (right ? right->m_height : 0) - (left ? left->m_height : 0); |
| 765 | } |
| 767 | 766 | |
| 768 | | // Set the right child pointer |
| 769 | | void setRight(tree_node* r) |
| 770 | | { |
| 771 | | // Set our new right node |
| 772 | | right = r; |
| 773 | 767 | |
| 774 | | // Set the height and balance factor |
| 775 | | int rightHeight = (right ? right->m_height : 0); |
| 776 | | int leftHeight = (left ? left->m_height : 0); |
| 768 | // Set the right child pointer |
| 769 | void setRight(tree_node* r) |
| 770 | { |
| 771 | // Set our new right node |
| 772 | right = r; |
| 777 | 773 | |
| 778 | | m_height = maxInt(rightHeight, leftHeight) + 1; |
| 779 | | m_balanceFactor = (right ? right->m_height : 0) - (left ? left->m_height : 0); |
| 780 | | } |
| 774 | // Set the height and balance factor |
| 775 | int rightHeight = (right ? right->m_height : 0); |
| 776 | int leftHeight = (left ? left->m_height : 0); |
| 781 | 777 | |
| 778 | m_height = maxInt(rightHeight, leftHeight) + 1; |
| 779 | m_balanceFactor = (right ? right->m_height : 0) - (left ? left->m_height : 0); |
| 780 | } |
| 782 | 781 | |
| 783 | | // Recover the height |
| 784 | | int height() const |
| 785 | | { |
| 786 | | // The height is equal to the maximum of the right or left side's height plus 1 |
| 787 | | // Trading memory for operation time can be done O(n) like this => |
| 788 | | // return max(left ? left->height() : 0, right ? right->height() : 0) + 1; |
| 789 | | return m_height; |
| 790 | | } |
| 791 | 782 | |
| 783 | // Recover the height |
| 784 | int height() const |
| 785 | { |
| 786 | // The height is equal to the maximum of the right or left side's height plus 1 |
| 787 | // Trading memory for operation time can be done O(n) like this => |
| 788 | // return max(left ? left->height() : 0, right ? right->height() : 0) + 1; |
| 789 | return m_height; |
| 790 | } |
| 792 | 791 | |
| 793 | | // Recover the balance factor |
| 794 | | int balanceFactor() const |
| 795 | | { |
| 796 | | // The weight of a node is equal to the difference between |
| 797 | | // the weight of the left subtree and the weight of the |
| 798 | | // right subtree |
| 799 | | // |
| 800 | | // O(n) version => |
| 801 | | // return (right ? right->height() : 0) - (left ? left->height() : 0); |
| 802 | | // |
| 803 | | return m_balanceFactor; |
| 804 | | } |
| 805 | 792 | |
| 793 | // Recover the balance factor |
| 794 | int balanceFactor() const |
| 795 | { |
| 796 | // The weight of a node is equal to the difference between |
| 797 | // the weight of the left subtree and the weight of the |
| 798 | // right subtree |
| 799 | // |
| 800 | // O(n) version => |
| 801 | // return (right ? right->height() : 0) - (left ? left->height() : 0); |
| 802 | // |
| 803 | return m_balanceFactor; |
| 804 | } |
| 806 | 805 | |
| 806 | |
| 807 | 807 | private: |
| 808 | | // Calculates all of the heights for this node and its ancestors -- O(log n). |
| 809 | | void calcHeights() |
| 810 | | { |
| 811 | | // Calculate our own height -- O(1) |
| 812 | | m_height = maxInt(left ? left->m_height : 0, right ? right->m_height : 0) + 1; |
| 808 | // Calculates all of the heights for this node and its ancestors -- O(log n). |
| 809 | void calcHeights() |
| 810 | { |
| 811 | // Calculate our own height -- O(1) |
| 812 | m_height = maxInt(left ? left->m_height : 0, right ? right->m_height : 0) + 1; |
| 813 | 813 | |
| 814 | | // And our parent's height (and recurse) -- O(log n) |
| 815 | | if (parent) |
| 816 | | { |
| 817 | | parent->calcHeights(); |
| 818 | | } |
| 819 | | } |
| 814 | // And our parent's height (and recurse) -- O(log n) |
| 815 | if (parent) |
| 816 | { |
| 817 | parent->calcHeights(); |
| 818 | } |
| 819 | } |
| 820 | 820 | |
| 821 | 821 | |
| 822 | | // Utility function - TODO replace |
| 823 | | int maxInt(const int& lhs, const int& rhs) const |
| 824 | | { |
| 825 | | return lhs > rhs ? lhs : rhs; |
| 826 | | } |
| 822 | // Utility function - TODO replace |
| 823 | int maxInt(const int& lhs, const int& rhs) const |
| 824 | { |
| 825 | return lhs > rhs ? lhs : rhs; |
| 826 | } |
| 827 | 827 | |
| 828 | 828 | |
| 829 | 829 | private: |
| 830 | | T element; |
| 830 | T element; |
| 831 | 831 | |
| 832 | | avl_tree_node* parent; |
| 833 | | avl_tree_node* left; |
| 834 | | avl_tree_node* right; |
| 832 | avl_tree_node* parent; |
| 833 | avl_tree_node* left; |
| 834 | avl_tree_node* right; |
| 835 | 835 | |
| 836 | | int m_height; |
| 837 | | int m_balanceFactor; |
| 836 | int m_height; |
| 837 | int m_balanceFactor; |
| 838 | 838 | }; |
| 839 | 839 | |
| 840 | 840 | |
| r22615 | r22616 | |
| 850 | 850 | template <class T> |
| 851 | 851 | class simple_set_iterator |
| 852 | 852 | { |
| 853 | | typedef avl_tree_node<T> tree_node; |
| 853 | typedef avl_tree_node<T> tree_node; |
| 854 | 854 | |
| 855 | 855 | public: |
| 856 | | enum TraversalType { PRE_ORDER, IN_ORDER, POST_ORDER, LEVEL_ORDER }; |
| 856 | enum TraversalType { PRE_ORDER, IN_ORDER, POST_ORDER, LEVEL_ORDER }; |
| 857 | 857 | |
| 858 | 858 | public: |
| 859 | | // construction |
| 860 | | simple_set_iterator(simple_set<T>& set, const TraversalType& tt=IN_ORDER) |
| 861 | | : m_set(&set), |
| 862 | | m_traversalType(tt), |
| 863 | | m_currentNode(NULL), |
| 864 | | m_endNode(NULL) { } |
| 859 | // construction |
| 860 | simple_set_iterator(simple_set<T>& set, const TraversalType& tt=IN_ORDER) |
| 861 | : m_set(&set), |
| 862 | m_traversalType(tt), |
| 863 | m_currentNode(NULL), |
| 864 | m_endNode(NULL) { } |
| 865 | 865 | |
| 866 | | ~simple_set_iterator() { } |
| 866 | ~simple_set_iterator() { } |
| 867 | 867 | |
| 868 | | |
| 869 | | // getters |
| 870 | | T* current() const { return m_currentNode; } |
| 871 | 868 | |
| 869 | // getters |
| 870 | T* current() const { return m_currentNode; } |
| 872 | 871 | |
| 873 | | // reset and return first item |
| 874 | | T* first() |
| 875 | | { |
| 876 | | m_currentNode = m_set->m_root; |
| 877 | | switch (m_traversalType) |
| 878 | | { |
| 879 | | case IN_ORDER: |
| 880 | | { |
| 881 | | // The current node is the smallest value |
| 882 | | m_currentNode = m_set->findMin(m_set->m_root); |
| 883 | | |
| 884 | | // The end case is the largest value |
| 885 | | m_endNode = m_set->findMax(m_set->m_root); |
| 886 | | |
| 887 | | return &m_currentNode->element; |
| 888 | | } |
| 889 | 872 | |
| 890 | | default: |
| 891 | | { |
| 892 | | // TODO (better error message): |
| 893 | | printf("simple_set_iterator: Traversal type not yet supported.\n"); |
| 894 | | return NULL; |
| 895 | | } |
| 896 | | } |
| 897 | | return NULL; |
| 898 | | } |
| 873 | // reset and return first item |
| 874 | T* first() |
| 875 | { |
| 876 | m_currentNode = m_set->m_root; |
| 877 | switch (m_traversalType) |
| 878 | { |
| 879 | case IN_ORDER: |
| 880 | { |
| 881 | // The current node is the smallest value |
| 882 | m_currentNode = m_set->findMin(m_set->m_root); |
| 899 | 883 | |
| 900 | | |
| 901 | | T* last() |
| 902 | | { |
| 903 | | return NULL; |
| 904 | | } |
| 884 | // The end case is the largest value |
| 885 | m_endNode = m_set->findMax(m_set->m_root); |
| 905 | 886 | |
| 887 | return &m_currentNode->element; |
| 888 | } |
| 906 | 889 | |
| 907 | | // advance according to current state and traversal type |
| 908 | | T* next() |
| 909 | | { |
| 910 | | if (m_currentNode == NULL) return NULL; |
| 911 | | |
| 912 | | switch (m_traversalType) |
| 913 | | { |
| 914 | | case IN_ORDER: |
| 915 | | { |
| 916 | | // You are at the end |
| 917 | | if (m_currentNode == m_endNode) |
| 918 | | return NULL; |
| 919 | | |
| 920 | | if (m_currentNode->right != NULL) |
| 921 | | { |
| 922 | | // Gather the furthest left node of right subtree |
| 923 | | m_currentNode = m_currentNode->right; |
| 924 | | while (m_currentNode->left != NULL) |
| 925 | | { |
| 926 | | m_currentNode = m_currentNode->left; |
| 927 | | } |
| 928 | | } |
| 929 | | else |
| 930 | | { |
| 931 | | // No right subtree? Move up the tree, looking for a left child link. |
| 932 | | tree_node* p = m_currentNode->parent; |
| 933 | | while (p != NULL && m_currentNode == p->right) |
| 934 | | { |
| 935 | | m_currentNode = p; |
| 936 | | p = p->parent; |
| 937 | | } |
| 938 | | m_currentNode = p; |
| 939 | | } |
| 940 | | |
| 941 | | return &m_currentNode->element; |
| 942 | | } |
| 890 | default: |
| 891 | { |
| 892 | // TODO (better error message): |
| 893 | printf("simple_set_iterator: Traversal type not yet supported.\n"); |
| 894 | return NULL; |
| 895 | } |
| 896 | } |
| 897 | return NULL; |
| 898 | } |
| 943 | 899 | |
| 944 | | default: |
| 945 | | { |
| 946 | | // TODO (better error message): |
| 947 | | printf("simple_set_iterator: Traversal type not yet supported.\n"); |
| 948 | | return NULL; |
| 949 | | } |
| 950 | | } |
| 951 | | |
| 952 | | return NULL; |
| 953 | | } |
| 954 | 900 | |
| 901 | T* last() |
| 902 | { |
| 903 | return NULL; |
| 904 | } |
| 955 | 905 | |
| 956 | | // return the number of items available |
| 957 | | int count() |
| 958 | | { |
| 959 | | return m_set->size(); |
| 960 | | } |
| 961 | 906 | |
| 907 | // advance according to current state and traversal type |
| 908 | T* next() |
| 909 | { |
| 910 | if (m_currentNode == NULL) return NULL; |
| 962 | 911 | |
| 963 | | // return the index of a given item in the virtual list |
| 964 | | // note: this function is destructive to any in-progress iterations! |
| 965 | | int indexof(T inData) |
| 966 | | { |
| 967 | | int index = 0; |
| 968 | | for (T* data = first(); data != last(); data = next(), index++) |
| 969 | | if (!(*data < inData) && !(inData < *data)) |
| 970 | | return index; |
| 971 | | return -1; |
| 972 | | } |
| 912 | switch (m_traversalType) |
| 913 | { |
| 914 | case IN_ORDER: |
| 915 | { |
| 916 | // You are at the end |
| 917 | if (m_currentNode == m_endNode) |
| 918 | return NULL; |
| 973 | 919 | |
| 920 | if (m_currentNode->right != NULL) |
| 921 | { |
| 922 | // Gather the furthest left node of right subtree |
| 923 | m_currentNode = m_currentNode->right; |
| 924 | while (m_currentNode->left != NULL) |
| 925 | { |
| 926 | m_currentNode = m_currentNode->left; |
| 927 | } |
| 928 | } |
| 929 | else |
| 930 | { |
| 931 | // No right subtree? Move up the tree, looking for a left child link. |
| 932 | tree_node* p = m_currentNode->parent; |
| 933 | while (p != NULL && m_currentNode == p->right) |
| 934 | { |
| 935 | m_currentNode = p; |
| 936 | p = p->parent; |
| 937 | } |
| 938 | m_currentNode = p; |
| 939 | } |
| 974 | 940 | |
| 975 | | // return the indexed item in the list |
| 976 | | // note: this function is destructive to any in-progress iterations! |
| 977 | | T* byindex(int index) |
| 978 | | { |
| 979 | | int count = 0; |
| 980 | | for (T* data = first(); data != last(); data = next(), count++) |
| 981 | | if (count == index) |
| 982 | | return data; |
| 983 | | return NULL; |
| 984 | | } |
| 941 | return &m_currentNode->element; |
| 942 | } |
| 985 | 943 | |
| 944 | default: |
| 945 | { |
| 946 | // TODO (better error message): |
| 947 | printf("simple_set_iterator: Traversal type not yet supported.\n"); |
| 948 | return NULL; |
| 949 | } |
| 950 | } |
| 986 | 951 | |
| 952 | return NULL; |
| 953 | } |
| 954 | |
| 955 | |
| 956 | // return the number of items available |
| 957 | int count() |
| 958 | { |
| 959 | return m_set->size(); |
| 960 | } |
| 961 | |
| 962 | |
| 963 | // return the index of a given item in the virtual list |
| 964 | // note: this function is destructive to any in-progress iterations! |
| 965 | int indexof(T inData) |
| 966 | { |
| 967 | int index = 0; |
| 968 | for (T* data = first(); data != last(); data = next(), index++) |
| 969 | if (!(*data < inData) && !(inData < *data)) |
| 970 | return index; |
| 971 | return -1; |
| 972 | } |
| 973 | |
| 974 | |
| 975 | // return the indexed item in the list |
| 976 | // note: this function is destructive to any in-progress iterations! |
| 977 | T* byindex(int index) |
| 978 | { |
| 979 | int count = 0; |
| 980 | for (T* data = first(); data != last(); data = next(), count++) |
| 981 | if (count == index) |
| 982 | return data; |
| 983 | return NULL; |
| 984 | } |
| 985 | |
| 986 | |
| 987 | 987 | private: |
| 988 | | simple_set<T>* m_set; |
| 988 | simple_set<T>* m_set; |
| 989 | 989 | |
| 990 | | TraversalType m_traversalType; |
| 991 | | tree_node* m_currentNode; |
| 992 | | tree_node* m_endNode; |
| 990 | TraversalType m_traversalType; |
| 991 | tree_node* m_currentNode; |
| 992 | tree_node* m_endNode; |
| 993 | 993 | }; |
| 994 | 994 | |
| 995 | 995 | #endif |
trunk/src/emu/machine/mcf5206e.c
| r22615 | r22616 | |
| 30 | 30 | |
| 31 | 31 | void mcf5206e_peripheral_device::device_config_complete() |
| 32 | 32 | { |
| 33 | | |
| 34 | 33 | } |
| 35 | 34 | |
| 36 | 35 | |
| r22615 | r22616 | |
| 40 | 39 | |
| 41 | 40 | void mcf5206e_peripheral_device::device_start() |
| 42 | 41 | { |
| 43 | | |
| 44 | 42 | } |
| 45 | 43 | |
| 46 | 44 | |
| r22615 | r22616 | |
| 52 | 50 | |
| 53 | 51 | WRITE32_MEMBER(mcf5206e_peripheral_device::dev_w) |
| 54 | 52 | { |
| 55 | | |
| 56 | 53 | } |
| 57 | 54 | |
| 58 | 55 | |
| r22615 | r22616 | |
| 86 | 83 | |
| 87 | 84 | ADDRESS REG WIDTH NAME/DESCRIPTION INIT VALUE (MR=Master Reset, NR=Normal Reset) Read or Write access |
| 88 | 85 | |
| 89 | | op MOVEC with $C0F MBAR 32 Module Base Address Register uninit (except V=0) W |
| 90 | | $003 SIMR 8 SIM Configuration Register C0 R/W |
| 91 | | $014 ICR1 8 Interrupt Control Register 1 - External IRQ1/IPL1 04 R/W |
| 92 | | $015 ICR2 8 Interrupt Control Register 2 - External IPL2 08 R/W |
| 93 | | $016 ICR3 8 Interrupt Control Register 3 - External IPL3 0C R/W |
| 94 | | $017 ICR4 8 Interrupt Control Register 4 - External IRQ4/IPL4 10 R/W |
| 95 | | $018 ICR5 8 Interrupt Control Register 5 - External IPL5 14 R/W |
| 96 | | $019 ICR6 8 Interrupt Control Register 6 - External IPL6 18 R/W |
| 97 | | $01A ICR7 8 Interrupt Control Register 7 - External IRQ7/IPL7 1C R/W |
| 98 | | $01B ICR8 8 Interrupt Control Register 8 - SWT 1C R/W |
| 99 | | $01C ICR9 8 Interrupt Control Register 9 - Timer 1 Interrupt 80 R/W |
| 100 | | $01D ICR10 8 Interrupt Control Register 10 - Timer 2 Interrupt 80 R/W |
| 101 | | $01E ICR11 8 Interrupt Control Register 11 - MBUS Interrupt 80 R/W |
| 102 | | $01F ICR12 8 Interrupt Control Register 12 - UART 1 Interrupt 00 R/W |
| 103 | | $020 ICR13 8 Interrupt Control Register 13 - UART 2 Interrupt 00 R/W |
| 104 | | $036 IMR 16 Interrupt Mask Register 3FFE R/W |
| 105 | | $03A IPR 16 Interrupt Pending Register 0000 R |
| 106 | | $040 RSR 8 Reset Status Register 80 / 20 R/W |
| 107 | | $041 SYPCR 8 System Protection Control Register 00 R/W |
| 108 | | $042 SWIVR 8 Software Watchdog Interrupt Vector Register 0F R/W |
| 109 | | $043 SWSR 8 Software Watchdog Service Register uninit W |
| 110 | | $046 DCRR 16 DRAM Controller Refresh MR 0000 - NR uninit R/W |
| 111 | | $04A DCTR 16 DRAM Controller Timing Register MR 0000 - NR uninit R/W |
| 112 | | $04C DCAR0 16 DRAM Controller 0 Address Register MR uninit - NR uninit R/W |
| 113 | | $050 DCMR0 32 DRAM Controller 0 Mask Register MR uninit - NR uninit R/W |
| 114 | | $057 DCCR0 8 DRAM Controller 0 Control Register MR 00 - NR 00 R/W |
| 115 | | $058 DCAR1 16 DRAM Controller 1 Address Register MR uninit - NR uninit R/W |
| 116 | | $05C DCMR1 32 DRAM Controller 1 Mask Register MR uninit - NR uninit R/W |
| 117 | | $063 DCCR1 8 DRAM Controller 1 Control Register MR 00 - NR 00 R/W |
| 86 | op MOVEC with $C0F MBAR 32 Module Base Address Register uninit (except V=0) W |
| 87 | $003 SIMR 8 SIM Configuration Register C0 R/W |
| 88 | $014 ICR1 8 Interrupt Control Register 1 - External IRQ1/IPL1 04 R/W |
| 89 | $015 ICR2 8 Interrupt Control Register 2 - External IPL2 08 R/W |
| 90 | $016 ICR3 8 Interrupt Control Register 3 - External IPL3 0C R/W |
| 91 | $017 ICR4 8 Interrupt Control Register 4 - External IRQ4/IPL4 10 R/W |
| 92 | $018 ICR5 8 Interrupt Control Register 5 - External IPL5 14 R/W |
| 93 | $019 ICR6 8 Interrupt Control Register 6 - External IPL6 18 R/W |
| 94 | $01A ICR7 8 Interrupt Control Register 7 - External IRQ7/IPL7 1C R/W |
| 95 | $01B ICR8 8 Interrupt Control Register 8 - SWT 1C R/W |
| 96 | $01C ICR9 8 Interrupt Control Register 9 - Timer 1 Interrupt 80 R/W |
| 97 | $01D ICR10 8 Interrupt Control Register 10 - Timer 2 Interrupt 80 R/W |
| 98 | $01E ICR11 8 Interrupt Control Register 11 - MBUS Interrupt 80 R/W |
| 99 | $01F ICR12 8 Interrupt Control Register 12 - UART 1 Interrupt 00 R/W |
| 100 | $020 ICR13 8 Interrupt Control Register 13 - UART 2 Interrupt 00 R/W |
| 101 | $036 IMR 16 Interrupt Mask Register 3FFE R/W |
| 102 | $03A IPR 16 Interrupt Pending Register 0000 R |
| 103 | $040 RSR 8 Reset Status Register 80 / 20 R/W |
| 104 | $041 SYPCR 8 System Protection Control Register 00 R/W |
| 105 | $042 SWIVR 8 Software Watchdog Interrupt Vector Register 0F R/W |
| 106 | $043 SWSR 8 Software Watchdog Service Register uninit W |
| 107 | $046 DCRR 16 DRAM Controller Refresh MR 0000 - NR uninit R/W |
| 108 | $04A DCTR 16 DRAM Controller Timing Register MR 0000 - NR uninit R/W |
| 109 | $04C DCAR0 16 DRAM Controller 0 Address Register MR uninit - NR uninit R/W |
| 110 | $050 DCMR0 32 DRAM Controller 0 Mask Register MR uninit - NR uninit R/W |
| 111 | $057 DCCR0 8 DRAM Controller 0 Control Register MR 00 - NR 00 R/W |
| 112 | $058 DCAR1 16 DRAM Controller 1 Address Register MR uninit - NR uninit R/W |
| 113 | $05C DCMR1 32 DRAM Controller 1 Mask Register MR uninit - NR uninit R/W |
| 114 | $063 DCCR1 8 DRAM Controller 1 Control Register MR 00 - NR 00 R/W |
| 118 | 115 | --------- CHIP SELECTS ----------- |
| 119 | | $064 CSAR0 16 Chip-Select 0 Address Register 0000 R/W |
| 120 | | $068 CSMR0 32 Chip-Select 0 Mask Register 00000000 R/W |
| 121 | | $06E CSCR0 16 Chip-Select 0 Control Register 3C1F, 3C5F, 3C9F, 3CDF, 3D1F, 3D5F, 3D9F, 3DDF R/W |
| 122 | | AA set by IRQ 7 at reset |
| 123 | | PS1 set by IRQ 4 at reset |
| 124 | | PS0 set by IRQ 1 at reset |
| 125 | | $070 CSAR1 16 Chip-Select 1 Address Register uninit R/W |
| 126 | | $074 CSMR1 32 Chip-Select 1 Mask Register uninit R/W |
| 127 | | $07A CSCR1 16 Chip-Select 1 Control Register uninit *1 R/W |
| 128 | | $07C CSAR2 16 Chip-Select 2 Address Register uninit R/W |
| 129 | | $080 CSMR2 32 Chip-Select 2 Mask Register uninit R/W |
| 130 | | $086 CSCR2 16 Chip-Select 2 Control Register uninit *1 R/W |
| 131 | | $088 CSAR3 16 Chip-Select 3 Address Register uninit R/W |
| 132 | | $08C CSMR3 32 Chip-Select 3 Mask Register uninit R/W |
| 133 | | $092 CSCR3 16 Chip-Select 3 Control Register uninit *1 R/W |
| 134 | | $094 CSAR4 16 Chip-Select 4 Address Register uninit R/W |
| 135 | | $098 CSMR4 32 Chip-Select 4 Mask Register uninit R/W |
| 136 | | $09E CSCR4 16 Chip-Select 4 Control Register uninit *1 R/W |
| 137 | | $0A0 CSAR5 16 Chip-Select 5 Address Register uninit R/W |
| 138 | | $0A4 CSMR5 32 Chip-Select 5 Mask Register uninit R/W |
| 139 | | $0AA CSCR5 16 Chip-Select 5 Control Register uninit *1 R/W |
| 140 | | $0AC CSAR6 16 Chip-Select 6 Address Register uninit R/W |
| 141 | | $0B0 CSMR6 32 Chip-Select 6 Mask Register uninit R/W |
| 142 | | $0B6 CSCR6 16 Chip-Select 6 Control Register uninit *1 R/W |
| 143 | | $0B8 CSAR7 16 Chip-Select 7 Address Register uninit R/W |
| 144 | | $0BC CSMR7 32 Chip-Select 7 Mask Register uninit R/W |
| 145 | | $0C2 CSCR7 16 Chip-Select 7 Control Register uninit *1 R/W |
| 146 | | $0C6 DMCR 16 Default Memory Control Register 0000 R/W |
| 147 | | $0CA PAR 16 Pin Assignment Register 00 R/W |
| 116 | $064 CSAR0 16 Chip-Select 0 Address Register 0000 R/W |
| 117 | $068 CSMR0 32 Chip-Select 0 Mask Register 00000000 R/W |
| 118 | $06E CSCR0 16 Chip-Select 0 Control Register 3C1F, 3C5F, 3C9F, 3CDF, 3D1F, 3D5F, 3D9F, 3DDF R/W |
| 119 | AA set by IRQ 7 at reset |
| 120 | PS1 set by IRQ 4 at reset |
| 121 | PS0 set by IRQ 1 at reset |
| 122 | $070 CSAR1 16 Chip-Select 1 Address Register uninit R/W |
| 123 | $074 CSMR1 32 Chip-Select 1 Mask Register uninit R/W |
| 124 | $07A CSCR1 16 Chip-Select 1 Control Register uninit *1 R/W |
| 125 | $07C CSAR2 16 Chip-Select 2 Address Register uninit R/W |
| 126 | $080 CSMR2 32 Chip-Select 2 Mask Register uninit R/W |
| 127 | $086 CSCR2 16 Chip-Select 2 Control Register uninit *1 R/W |
| 128 | $088 CSAR3 16 Chip-Select 3 Address Register uninit R/W |
| 129 | $08C CSMR3 32 Chip-Select 3 Mask Register uninit R/W |
| 130 | $092 CSCR3 16 Chip-Select 3 Control Register uninit *1 R/W |
| 131 | $094 CSAR4 16 Chip-Select 4 Address Register uninit R/W |
| 132 | $098 CSMR4 32 Chip-Select 4 Mask Register uninit R/W |
| 133 | $09E CSCR4 16 Chip-Select 4 Control Register uninit *1 R/W |
| 134 | $0A0 CSAR5 16 Chip-Select 5 Address Register uninit R/W |
| 135 | $0A4 CSMR5 32 Chip-Select 5 Mask Register uninit R/W |
| 136 | $0AA CSCR5 16 Chip-Select 5 Control Register uninit *1 R/W |
| 137 | $0AC CSAR6 16 Chip-Select 6 Address Register uninit R/W |
| 138 | $0B0 CSMR6 32 Chip-Select 6 Mask Register uninit R/W |
| 139 | $0B6 CSCR6 16 Chip-Select 6 Control Register uninit *1 R/W |
| 140 | $0B8 CSAR7 16 Chip-Select 7 Address Register uninit R/W |
| 141 | $0BC CSMR7 32 Chip-Select 7 Mask Register uninit R/W |
| 142 | $0C2 CSCR7 16 Chip-Select 7 Control Register uninit *1 R/W |
| 143 | $0C6 DMCR 16 Default Memory Control Register 0000 R/W |
| 144 | $0CA PAR 16 Pin Assignment Register 00 R/W |
| 148 | 145 | --------- TIMER MODULE ----------- |
| 149 | | $100 TMR1 16 Timer 1 Mode Register 0000 R/W |
| 150 | | $104 TRR1 16 Timer 1 Reference Register FFFF R/W |
| 151 | | $108 TCR1 16 Timer 1 Capture Register 0000 R |
| 152 | | $10C TCN1 16 Timer 1 Counter 0000 R/W |
| 153 | | $111 TER1 8 Timer 1 Event Register 00 R/W |
| 154 | | $120 TMR2 16 Timer 2 Mode Register 0000 R/W |
| 155 | | $124 TRR2 16 Timer 2 Reference Register FFFF R/W |
| 156 | | $128 TCR2 16 Timer 2 Capture Register 0000 R |
| 157 | | $12C TCN2 16 Timer 2 Counter 0000 R/W |
| 158 | | $131 TER2 8 Timer 2 Event Register 00 R/W |
| 146 | $100 TMR1 16 Timer 1 Mode Register 0000 R/W |
| 147 | $104 TRR1 16 Timer 1 Reference Register FFFF R/W |
| 148 | $108 TCR1 16 Timer 1 Capture Register 0000 R |
| 149 | $10C TCN1 16 Timer 1 Counter 0000 R/W |
| 150 | $111 TER1 8 Timer 1 Event Register 00 R/W |
| 151 | $120 TMR2 16 Timer 2 Mode Register 0000 R/W |
| 152 | $124 TRR2 16 Timer 2 Reference Register FFFF R/W |
| 153 | $128 TCR2 16 Timer 2 Capture Register 0000 R |
| 154 | $12C TCN2 16 Timer 2 Counter 0000 R/W |
| 155 | $131 TER2 8 Timer 2 Event Register 00 R/W |
| 159 | 156 | ------------ UART SERIAL PORTS ----------- |
| 160 | | $140 UMR1,2 8 UART 1 Mode Registers 00 R/W |
| 161 | | $144 USR 8 UART 1 Status Register 00 R |
| 162 | | UCSR 8 UART 1 Clock-Select Register DD W |
| 163 | | $148 UCR 8 UART 1 Command Register 00 W |
| 164 | | $14C URB 8 UART 1 Receive Buffer FF R |
| 165 | | UTB 8 UART 1 Transmit Buffer 00 W |
| 166 | | $150 UIPCR 8 UART Input Port Change Register 0F R |
| 167 | | UACR 8 UART 1 Auxilary Control Register 00 W |
| 168 | | $154 UISR 8 UART 1 Interrupt Status Register 00 R |
| 169 | | UIMR 8 UART 1 Interrupt Mask Register 00 W |
| 170 | | $158 UBG1 8 UART 1 Baud Rate Generator Prescale MSB uninit W |
| 171 | | $15C UBG2 8 UART 1 Baud Rate Generator Prescale LSB uninit W |
| 172 | | $170 UIVR 8 UART 1 Interrupt Vector Register 0F R/W |
| 173 | | $174 UIP 8 UART 1 Input Port Register FF R |
| 174 | | $178 UOP1 8 UART 1 Output Port Bit Set CMD UOP1[7-1]=undef; UOP1=0 W |
| 175 | | $17C UOP0 8 UART 1 Output Port Bit Reset CMD uninit W |
| 157 | $140 UMR1,2 8 UART 1 Mode Registers 00 R/W |
| 158 | $144 USR 8 UART 1 Status Register 00 R |
| 159 | UCSR 8 UART 1 Clock-Select Register DD W |
| 160 | $148 UCR 8 UART 1 Command Register 00 W |
| 161 | $14C URB 8 UART 1 Receive Buffer FF R |
| 162 | UTB 8 UART 1 Transmit Buffer 00 W |
| 163 | $150 UIPCR 8 UART Input Port Change Register 0F R |
| 164 | UACR 8 UART 1 Auxilary Control Register 00 W |
| 165 | $154 UISR 8 UART 1 Interrupt Status Register 00 R |
| 166 | UIMR 8 UART 1 Interrupt Mask Register 00 W |
| 167 | $158 UBG1 8 UART 1 Baud Rate Generator Prescale MSB uninit W |
| 168 | $15C UBG2 8 UART 1 Baud Rate Generator Prescale LSB uninit W |
| 169 | $170 UIVR 8 UART 1 Interrupt Vector Register 0F R/W |
| 170 | $174 UIP 8 UART 1 Input Port Register FF R |
| 171 | $178 UOP1 8 UART 1 Output Port Bit Set CMD UOP1[7-1]=undef; UOP1=0 W |
| 172 | $17C UOP0 8 UART 1 Output Port Bit Reset CMD uninit W |
| 176 | 173 | |
| 177 | | $180 UMR1,2 8 UART 2 Mode Registers 00 R/W |
| 178 | | $184 USR 8 UART 2 Status Register 00 R |
| 179 | | UCSR 8 UART 2 Clock-Select Register DD W |
| 180 | | $188 UCR 8 UART 2 Command Register 00 W |
| 181 | | $18C URB 8 UART 2 Receive Buffer FF R |
| 182 | | UTB 8 UART 2 Transmit Buffer 00 W |
| 183 | | $190 UIPCR 8 UART 2 Input Port Change Register 0F R |
| 184 | | UACR 8 UART 2 Auxilary Control Register 00 W |
| 185 | | $194 UISR 8 UART 2 Interrupt Status Register 00 R |
| 186 | | UIMR 8 UART 2 Interrupt Mask Register 00 W |
| 187 | | $198 UBG1 8 UART 2 Baud Rate Generator Prescale MSB uninit R/W |
| 188 | | $19C UBG2 8 UART 2 Barud Rate Generator Prescale LSB uninit R/W |
| 189 | | $1B0 UIVR 8 UART 2 Interrupt Vector Register 0F R/W |
| 190 | | $1B4 UIP 8 UART 2 Input Port Register FF R |
| 191 | | $1B8 UOP1 8 UART 2 Output Port Bit Set CMD UOP1[7-1]=undef; UOP1=0 W |
| 192 | | $1BC UOP0 8 UART 2 Output Port Bit Reset CMD uninit W |
| 174 | $180 UMR1,2 8 UART 2 Mode Registers 00 R/W |
| 175 | $184 USR 8 UART 2 Status Register 00 R |
| 176 | UCSR 8 UART 2 Clock-Select Register DD W |
| 177 | $188 UCR 8 UART 2 Command Register 00 W |
| 178 | $18C URB 8 UART 2 Receive Buffer FF R |
| 179 | UTB 8 UART 2 Transmit Buffer 00 W |
| 180 | $190 UIPCR 8 UART 2 Input Port Change Register 0F R |
| 181 | UACR 8 UART 2 Auxilary Control Register 00 W |
| 182 | $194 UISR 8 UART 2 Interrupt Status Register 00 R |
| 183 | UIMR 8 UART 2 Interrupt Mask Register 00 W |
| 184 | $198 UBG1 8 UART 2 Baud Rate Generator Prescale MSB uninit R/W |
| 185 | $19C UBG2 8 UART 2 Barud Rate Generator Prescale LSB uninit R/W |
| 186 | $1B0 UIVR 8 UART 2 Interrupt Vector Register 0F R/W |
| 187 | $1B4 UIP 8 UART 2 Input Port Register FF R |
| 188 | $1B8 UOP1 8 UART 2 Output Port Bit Set CMD UOP1[7-1]=undef; UOP1=0 W |
| 189 | $1BC UOP0 8 UART 2 Output Port Bit Reset CMD uninit W |
| 193 | 190 | |
| 194 | | $1C5 PPDDR 8 Port A Data Direction Register 00 R/W |
| 195 | | $1C9 PPDAT 8 Port A Data Register 00 R/W |
| 191 | $1C5 PPDDR 8 Port A Data Direction Register 00 R/W |
| 192 | $1C9 PPDAT 8 Port A Data Register 00 R/W |
| 196 | 193 | ------------ MBUS ----------- |
| 197 | | $1E0 MADR 8 M-Bus Address Register 00 R/W |
| 198 | | $1E4 MFDR 8 M-Bus Frequency Divider Register 00 R/W |
| 199 | | $1E8 MBCR 8 M-Bus Control Register 00 R/W |
| 200 | | $1EC MBSR 8 M-Bus Status Register 00 R/W |
| 201 | | $1F0 MBDR 8 M-Bus Data I/O Register 00 R/W |
| 194 | $1E0 MADR 8 M-Bus Address Register 00 R/W |
| 195 | $1E4 MFDR 8 M-Bus Frequency Divider Register 00 R/W |
| 196 | $1E8 MBCR 8 M-Bus Control Register 00 R/W |
| 197 | $1EC MBSR 8 M-Bus Status Register 00 R/W |
| 198 | $1F0 MBDR 8 M-Bus Data I/O Register 00 R/W |
| 202 | 199 | ------------ DMA Controller ----------- |
| 203 | | $200 DMASAR0 32 Source Address Register 0 00 R/W |
| 204 | | $204 DMADAR0 32 Destination Address Register 0 00 R/W |
| 205 | | $208 DCR0 16 DMA Control Register 0 00 R/W |
| 206 | | $20C BCR0 16 Byte Count Register 0 00 R/W |
| 207 | | $210 DSR0 8 Status Register 0 00 R/W |
| 208 | | $214 DIVR0 8 Interrupt Vector Register 0 0F R/W |
| 209 | | $240 DMASAR1 32 Source Address Register 1 00 R/W |
| 210 | | $244 DMADAR1 32 Destination Address Register 1 00 R/W |
| 211 | | $248 DCR1 16 DMA Control Register 1 00 R/W |
| 212 | | $24C BCR1 16 Byte Count Register 1 00 R/W |
| 213 | | $250 DSR1 8 Status Register 1 00 R/W |
| 214 | | $254 DIVR1 8 Interrupt Vector Register 1 0F R/W |
| 200 | $200 DMASAR0 32 Source Address Register 0 00 R/W |
| 201 | $204 DMADAR0 32 Destination Address Register 0 00 R/W |
| 202 | $208 DCR0 16 DMA Control Register 0 00 R/W |
| 203 | $20C BCR0 16 Byte Count Register 0 00 R/W |
| 204 | $210 DSR0 8 Status Register 0 00 R/W |
| 205 | $214 DIVR0 8 Interrupt Vector Register 0 0F R/W |
| 206 | $240 DMASAR1 32 Source Address Register 1 00 R/W |
| 207 | $244 DMADAR1 32 Destination Address Register 1 00 R/W |
| 208 | $248 DCR1 16 DMA Control Register 1 00 R/W |
| 209 | $24C BCR1 16 Byte Count Register 1 00 R/W |
| 210 | $250 DSR1 8 Status Register 1 00 R/W |
| 211 | $254 DIVR1 8 Interrupt Vector Register 1 0F R/W |
| 215 | 212 | |
| 216 | 213 | *1 - uninit except BRST=ASET=WRAH=RDAH=WR=RD=0 |
| 217 | 214 | |
| 218 | | */ |
| | No newline at end of file |
| 215 | */ |
trunk/src/mess/machine/nes_slot.c
| r22615 | r22616 | |
| 1 | 1 | /*********************************************************************************************************** |
| 2 | | |
| 3 | | |
| 2 | |
| 3 | |
| 4 | 4 | Nintendo NES/FC cart emulation |
| 5 | 5 | (through slot devices) |
| 6 | 6 | |
| r22615 | r22616 | |
| 9 | 9 | 0x6000-0x7fff to read_m/write_m (here are *usually* installed NVRAM & WRAM, if any) |
| 10 | 10 | 0x8000-0xffff to write_h (reads are directed to 4 x 8K PRG banks) |
| 11 | 11 | Default implementations of these handlers are available here, to be rewritten by PCB-specific ones when needed. |
| 12 | | |
| 12 | |
| 13 | 13 | Additional handlers are available, but have to be manually installed at machine_start |
| 14 | 14 | * read_ex/write_ex for address range 0x4020-0x40ff |
| 15 | 15 | * read_h for address range 0x8000-0xffff when a cart does some protection or address scramble before reading ROM |
| r22615 | r22616 | |
| 21 | 21 | |
| 22 | 22 | Plus a few of latch functions are available: ppu_latch (see MMC2), hblank_irq and scanline_irq (see e.g. MMC3), |
| 23 | 23 | but these might be subject to future changes when the PPU is revisited. |
| 24 | | |
| 24 | |
| 25 | 25 | Notes: |
| 26 | | - Differently from later systems (like SNES or MD), it is uncommon to find PRG ROMs of NES games which are not a |
| 26 | - Differently from later systems (like SNES or MD), it is uncommon to find PRG ROMs of NES games which are not a |
| 27 | 27 | power of 2K, so we do not perform any mirroring by default. |
| 28 | | A bunch of pcb types, though, come with 1.5MB of PRG (some Waixing translations) or with multiple PRG chips |
| 29 | | having peculiar size (32K + 16K, 32K + 8K, 32K + 2K). Hence, if such a configuration is detected, we provide |
| 30 | | a m_prg_bank_map array to handle internally PRG mirroring up to the next power of 2K, as long as the size is |
| 31 | | a multiple of 8K (i.e. the unit chunk for standard PRG). |
| 32 | | For the case of PRG chips which are not-multiple of 8K (e.g. UNL-MARIO2-MALEE pcb), the handling has to be |
| 28 | A bunch of pcb types, though, come with 1.5MB of PRG (some Waixing translations) or with multiple PRG chips |
| 29 | having peculiar size (32K + 16K, 32K + 8K, 32K + 2K). Hence, if such a configuration is detected, we provide |
| 30 | a m_prg_bank_map array to handle internally PRG mirroring up to the next power of 2K, as long as the size is |
| 31 | a multiple of 8K (i.e. the unit chunk for standard PRG). |
| 32 | For the case of PRG chips which are not-multiple of 8K (e.g. UNL-MARIO2-MALEE pcb), the handling has to be |
| 33 | 33 | handled in the pcb-specific code! |
| 34 | 34 | - Our open bus emulation is very sketchy, by simply returning the higher 8bits of the accessed address. This seems |
| 35 | 35 | enough for most games (only two sets have issues with this). A slightly better implementation is almost ready |
| 36 | 36 | to fix these two remaining cases, but I plan to revisit the whole implementation in an accurate way at a later |
| 37 | 37 | stage |
| 38 | 38 | - Bus conflict is implemented based on latest tests by Blargg. There is some uncertainty about AxROM behavior |
| 39 | | (some AOROM pcbs suffers from bus conflict, some do not... since no AOROM game is known to glitch due to lack |
| 39 | (some AOROM pcbs suffers from bus conflict, some do not... since no AOROM game is known to glitch due to lack |
| 40 | 40 | of bus conflict it seems safe to emulate the board without bus conflict, but eventually it would be good to |
| 41 | 41 | differentiate the real variants) |
| 42 | 42 | |
| r22615 | r22616 | |
| 44 | 44 | Many information about the mappers/pcbs come from the wonderful doc written by Disch. |
| 45 | 45 | Current info (when used) are based on v0.6.1 of his docs. |
| 46 | 46 | You can find the latest version of the doc at http://www.romhacking.net/docs/362/ |
| 47 | | |
| 48 | | A lot of details have been based on the researches carried on at NesDev forums (by Blargg, Quietust and many more) |
| 47 | |
| 48 | A lot of details have been based on the researches carried on at NesDev forums (by Blargg, Quietust and many more) |
| 49 | 49 | and collected on the NesDev Wiki http://wiki.nesdev.com/ |
| 50 | | |
| 50 | |
| 51 | 51 | Particular thanks go to |
| 52 | 52 | - Martin Freij for his work on NEStopia |
| 53 | 53 | - Cah4e3 for his efforts on FCEUMM and the reverse engineering of pirate boards |
| 54 | 54 | - BootGod, lidnariq and naruko for the PCB tests which made possible |
| 55 | 55 | |
| 56 | | |
| 56 | |
| 57 | 57 | ***********************************************************************************************************/ |
| 58 | 58 | |
| 59 | 59 | /***************************************************************************************** |
| 60 | | |
| 60 | |
| 61 | 61 | A few Mappers suffer of hardware conflict: original dumpers have used the same mapper number for more than |
| 62 | 62 | a kind of boards. In these cases (and only in these cases) we exploit nes.hsi to set up accordingly |
| 63 | 63 | emulation. Games which requires this hack are the following: |
| r22615 | r22616 | |
| 69 | 69 | * 113 - HES 6-in-1 requires mirroring (check Bookyman playfield), while other games break with this (check AV Soccer) |
| 70 | 70 | * 153 - Famicom Jump II uses a different board (or the same in a very different way) |
| 71 | 71 | * 242 - DQ8 has no mirroring (missing graphics is due to other reasons though) |
| 72 | | |
| 72 | |
| 73 | 73 | crc_hacks have been added also to handle a few wiring settings which would require submappers: |
| 74 | 74 | * CHR protection pins for mapper 185 |
| 75 | 75 | * VRC-2, VRC-4 and VRC-6 line wiring |
| 76 | | |
| 76 | |
| 77 | 77 | Remember that the MMC # does not equal the mapper #. In particular, Mapper 4 is |
| 78 | 78 | in fact MMC3, Mapper 9 is MMC2 and Mapper 10 is MMC4. Makes perfect sense, right? |
| 79 | | |
| 79 | |
| 80 | 80 | ****************************************************************************************/ |
| 81 | 81 | |
| 82 | 82 | |
| r22615 | r22616 | |
| 170 | 170 | |
| 171 | 171 | m_prg_mask = ((m_prg_chunks << 1) - 1); |
| 172 | 172 | |
| 173 | | // printf("first mask %x!\n", m_prg_mask); |
| 173 | // printf("first mask %x!\n", m_prg_mask); |
| 174 | 174 | if ((m_prg_chunks << 1) & m_prg_mask) |
| 175 | 175 | { |
| 176 | 176 | int mask_bits = 0, temp = (m_prg_chunks << 1), mapsize; |
| 177 | 177 | // contrary to what happens with later systems, like e.g. SNES or MD, |
| 178 | 178 | // only half a dozen of NES carts have PRG which is not a power of 2 |
| 179 | 179 | // so we use this bank_map only as an exception |
| 180 | | // printf("uneven rom!\n"); |
| 180 | // printf("uneven rom!\n"); |
| 181 | 181 | |
| 182 | 182 | // 1. redefine mask as (next power of 2)-1 |
| 183 | 183 | for (; temp; ) |
| r22615 | r22616 | |
| 186 | 186 | temp >>= 1; |
| 187 | 187 | } |
| 188 | 188 | m_prg_mask = (1 << mask_bits) - 1; |
| 189 | | // printf("new mask %x!\n", m_prg_mask); |
| 189 | // printf("new mask %x!\n", m_prg_mask); |
| 190 | 190 | mapsize = (1 << mask_bits)/2; |
| 191 | 191 | |
| 192 | 192 | // 2. create a bank_map for banks in the range mask/2 -> mask |
| r22615 | r22616 | |
| 196 | 196 | int j; |
| 197 | 197 | for (j = mapsize; j < (m_prg_chunks << 1); j++) |
| 198 | 198 | m_prg_bank_map[j - mapsize] = j; |
| 199 | | |
| 199 | |
| 200 | 200 | while (j % mapsize) |
| 201 | 201 | { |
| 202 | 202 | int k = 0, repeat_banks; |
| r22615 | r22616 | |
| 207 | 207 | m_prg_bank_map[(j - mapsize) + l] = m_prg_bank_map[(j - mapsize) + l - repeat_banks]; |
| 208 | 208 | j += repeat_banks; |
| 209 | 209 | } |
| 210 | | |
| 210 | |
| 211 | 211 | // check bank map! |
| 212 | | // for (int i = 0; i < mapsize; i++) |
| 213 | | // { |
| 214 | | // printf("bank %3d = %3d\t", i, m_prg_bank_map[i]); |
| 215 | | // if ((i%8) == 7) |
| 216 | | // printf("\n"); |
| 217 | | // } |
| 212 | // for (int i = 0; i < mapsize; i++) |
| 213 | // { |
| 214 | // printf("bank %3d = %3d\t", i, m_prg_bank_map[i]); |
| 215 | // if ((i%8) == 7) |
| 216 | // printf("\n"); |
| 217 | // } |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | } |
| r22615 | r22616 | |
| 275 | 275 | return bank_8k; |
| 276 | 276 | |
| 277 | 277 | // case 2: otherwise return a mirror using the bank_map! |
| 278 | | // UINT8 temp = bank_8k; |
| 278 | // UINT8 temp = bank_8k; |
| 279 | 279 | bank_8k &= m_prg_mask; |
| 280 | 280 | bank_8k -= (m_prg_mask/2 + 1); |
| 281 | | // printf("bank: accessed %x (top: %x), returned %x\n", temp, (m_prg_chunks << 1) - 1, m_prg_bank_map[bank_8k]); |
| 281 | // printf("bank: accessed %x (top: %x), returned %x\n", temp, (m_prg_chunks << 1) - 1, m_prg_bank_map[bank_8k]); |
| 282 | 282 | return m_prg_bank_map[bank_8k]; |
| 283 | 283 | } |
| 284 | 284 | |
| r22615 | r22616 | |
| 289 | 289 | assert(prg_bank >= 0); |
| 290 | 290 | assert(prg_bank < ARRAY_LENGTH(m_prg_bank)); |
| 291 | 291 | assert(prg_bank < ARRAY_LENGTH(m_prg_bank_mem)); |
| 292 | | |
| 292 | |
| 293 | 293 | m_prg_bank_mem[prg_bank]->set_entry(m_prg_bank[prg_bank]); |
| 294 | 294 | } |
| 295 | 295 | } |
| r22615 | r22616 | |
| 299 | 299 | /* if there is only 16k PRG, return */ |
| 300 | 300 | if (!(m_prg_chunks >> 1)) |
| 301 | 301 | return; |
| 302 | | |
| 302 | |
| 303 | 303 | /* assumes that bank references a 32k chunk */ |
| 304 | 304 | bank = prg_8k_bank_num(bank * 4); |
| 305 | 305 | |
| r22615 | r22616 | |
| 314 | 314 | { |
| 315 | 315 | /* assumes that bank references a 16k chunk */ |
| 316 | 316 | bank = prg_8k_bank_num(bank * 2); |
| 317 | | |
| 317 | |
| 318 | 318 | m_prg_bank[0] = bank + 0; |
| 319 | 319 | m_prg_bank[1] = bank + 1; |
| 320 | 320 | update_prg_banks(0, 1); |
| r22615 | r22616 | |
| 324 | 324 | { |
| 325 | 325 | /* assumes that bank references a 16k chunk */ |
| 326 | 326 | bank = prg_8k_bank_num(bank * 2); |
| 327 | | |
| 327 | |
| 328 | 328 | m_prg_bank[2] = bank + 0; |
| 329 | 329 | m_prg_bank[3] = bank + 1; |
| 330 | 330 | update_prg_banks(2, 3); |
| r22615 | r22616 | |
| 334 | 334 | { |
| 335 | 335 | /* assumes that bank references an 8k chunk */ |
| 336 | 336 | bank = prg_8k_bank_num(bank); |
| 337 | | |
| 337 | |
| 338 | 338 | m_prg_bank[0] = bank; |
| 339 | 339 | update_prg_banks(0, 0); |
| 340 | 340 | } |
| r22615 | r22616 | |
| 343 | 343 | { |
| 344 | 344 | /* assumes that bank references an 8k chunk */ |
| 345 | 345 | bank = prg_8k_bank_num(bank); |
| 346 | | |
| 346 | |
| 347 | 347 | m_prg_bank[1] = bank; |
| 348 | 348 | update_prg_banks(1, 1); |
| 349 | 349 | } |
| r22615 | r22616 | |
| 352 | 352 | { |
| 353 | 353 | /* assumes that bank references an 8k chunk */ |
| 354 | 354 | bank = prg_8k_bank_num(bank); |
| 355 | | |
| 355 | |
| 356 | 356 | m_prg_bank[2] = bank; |
| 357 | 357 | update_prg_banks(2, 2); |
| 358 | 358 | } |
| r22615 | r22616 | |
| 361 | 361 | { |
| 362 | 362 | /* assumes that bank references an 8k chunk */ |
| 363 | 363 | bank = prg_8k_bank_num(bank); |
| 364 | | |
| 364 | |
| 365 | 365 | m_prg_bank[3] = bank; |
| 366 | 366 | update_prg_banks(3, 3); |
| 367 | 367 | } |
| r22615 | r22616 | |
| 370 | 370 | void device_nes_cart_interface::prg8_x(int start, int bank) |
| 371 | 371 | { |
| 372 | 372 | assert(start < 4); |
| 373 | | |
| 373 | |
| 374 | 374 | /* assumes that bank references an 8k chunk */ |
| 375 | 375 | bank = prg_8k_bank_num(bank); |
| 376 | | |
| 376 | |
| 377 | 377 | m_prg_bank[start] = bank; |
| 378 | 378 | update_prg_banks(start, start); |
| 379 | 379 | } |
| r22615 | r22616 | |
| 386 | 386 | { |
| 387 | 387 | if (source == CHRRAM && m_vram == NULL) |
| 388 | 388 | fatalerror("CHRRAM bankswitch with no VRAM\n"); |
| 389 | | |
| 389 | |
| 390 | 390 | if (source == CHRROM && m_vrom == NULL) |
| 391 | 391 | fatalerror("CHRROM bankswitch with no VROM\n"); |
| 392 | 392 | } |
| r22615 | r22616 | |
| 394 | 394 | void device_nes_cart_interface::chr8(int bank, int source) |
| 395 | 395 | { |
| 396 | 396 | chr_sanity_check(source); |
| 397 | | |
| 397 | |
| 398 | 398 | if (source == CHRRAM) |
| 399 | 399 | { |
| 400 | 400 | bank &= (m_vram_chunks - 1); |
| r22615 | r22616 | |
| 420 | 420 | void device_nes_cart_interface::chr4_x(int start, int bank, int source) |
| 421 | 421 | { |
| 422 | 422 | chr_sanity_check(source); |
| 423 | | |
| 423 | |
| 424 | 424 | if (source == CHRRAM) |
| 425 | 425 | { |
| 426 | 426 | bank &= ((m_vram_chunks << 1) - 1); |
| r22615 | r22616 | |
| 446 | 446 | void device_nes_cart_interface::chr2_x(int start, int bank, int source) |
| 447 | 447 | { |
| 448 | 448 | chr_sanity_check(source); |
| 449 | | |
| 449 | |
| 450 | 450 | if (source == CHRRAM) |
| 451 | 451 | { |
| 452 | 452 | bank &= ((m_vram_chunks << 2) - 1); |
| r22615 | r22616 | |
| 472 | 472 | void device_nes_cart_interface::chr1_x(int start, int bank, int source) |
| 473 | 473 | { |
| 474 | 474 | chr_sanity_check(source); |
| 475 | | |
| 475 | |
| 476 | 476 | if (source == CHRRAM) |
| 477 | 477 | { |
| 478 | 478 | bank &= ((m_vram_chunks << 3) - 1); |
| r22615 | r22616 | |
| 517 | 517 | base_ptr = m_ciram; |
| 518 | 518 | break; |
| 519 | 519 | } |
| 520 | | |
| 520 | |
| 521 | 521 | page &= 3; /* mask down to the 4 logical pages */ |
| 522 | 522 | m_nt_src[page] = source; |
| 523 | | |
| 523 | |
| 524 | 524 | if (base_ptr != NULL) |
| 525 | 525 | { |
| 526 | 526 | m_nt_orig[page] = bank * 0x400; |
| 527 | 527 | m_nt_access[page] = base_ptr + m_nt_orig[page]; |
| 528 | 528 | } |
| 529 | | |
| 529 | |
| 530 | 530 | m_nt_writable[page] = writable; |
| 531 | 531 | } |
| 532 | 532 | |
| r22615 | r22616 | |
| 541 | 541 | set_nt_page(2, CIRAM, 0, 1); |
| 542 | 542 | set_nt_page(3, CIRAM, 1, 1); |
| 543 | 543 | break; |
| 544 | | |
| 544 | |
| 545 | 545 | case PPU_MIRROR_HORZ: |
| 546 | 546 | set_nt_page(0, CIRAM, 0, 1); |
| 547 | 547 | set_nt_page(1, CIRAM, 0, 1); |
| 548 | 548 | set_nt_page(2, CIRAM, 1, 1); |
| 549 | 549 | set_nt_page(3, CIRAM, 1, 1); |
| 550 | 550 | break; |
| 551 | | |
| 551 | |
| 552 | 552 | case PPU_MIRROR_HIGH: |
| 553 | 553 | set_nt_page(0, CIRAM, 1, 1); |
| 554 | 554 | set_nt_page(1, CIRAM, 1, 1); |
| 555 | 555 | set_nt_page(2, CIRAM, 1, 1); |
| 556 | 556 | set_nt_page(3, CIRAM, 1, 1); |
| 557 | 557 | break; |
| 558 | | |
| 558 | |
| 559 | 559 | case PPU_MIRROR_LOW: |
| 560 | 560 | set_nt_page(0, CIRAM, 0, 1); |
| 561 | 561 | set_nt_page(1, CIRAM, 0, 1); |
| r22615 | r22616 | |
| 570 | 570 | set_nt_page(2, CART_NTRAM, 2, 1); |
| 571 | 571 | set_nt_page(3, CART_NTRAM, 3, 1); |
| 572 | 572 | break; |
| 573 | | |
| 573 | |
| 574 | 574 | case PPU_MIRROR_NONE: |
| 575 | 575 | default: |
| 576 | 576 | set_nt_page(0, CIRAM, 0, 1); |
| r22615 | r22616 | |
| 596 | 596 | |
| 597 | 597 | // Helper function for the few mappers subject to bus conflict at write. |
| 598 | 598 | // Tests by blargg showed that in many of the boards suffering of CPU/ROM |
| 599 | | // conflicts the behaviour can be accurately emulated by writing not the |
| 599 | // conflicts the behaviour can be accurately emulated by writing not the |
| 600 | 600 | // original data, but data & rom[offset] |
| 601 | 601 | UINT8 device_nes_cart_interface::account_bus_conflict(UINT32 offset, UINT8 data) |
| 602 | 602 | { |
| r22615 | r22616 | |
| 604 | 604 | // so we allow to set m_bus_conflict to FALSE at loading time when necessary |
| 605 | 605 | if (m_bus_conflict) |
| 606 | 606 | return data & hi_access_rom(offset); |
| 607 | | else |
| 607 | else |
| 608 | 608 | return data; |
| 609 | 609 | } |
| 610 | 610 | |
| r22615 | r22616 | |
| 616 | 616 | WRITE8_MEMBER(device_nes_cart_interface::chr_w) |
| 617 | 617 | { |
| 618 | 618 | int bank = offset >> 10; |
| 619 | | |
| 619 | |
| 620 | 620 | if (m_chr_src[bank] == CHRRAM) |
| 621 | 621 | m_chr_access[bank][offset & 0x3ff] = data; |
| 622 | 622 | } |
| r22615 | r22616 | |
| 631 | 631 | WRITE8_MEMBER(device_nes_cart_interface::nt_w) |
| 632 | 632 | { |
| 633 | 633 | int page = ((offset & 0xc00) >> 10); |
| 634 | | |
| 634 | |
| 635 | 635 | if (!m_nt_writable[page]) |
| 636 | 636 | return; |
| 637 | | |
| 637 | |
| 638 | 638 | m_nt_access[page][offset & 0x3ff] = data; |
| 639 | 639 | } |
| 640 | 640 | |
| r22615 | r22616 | |
| 649 | 649 | // Base memory accessors (emulating open bus |
| 650 | 650 | // behaviour and/or WRAM accesses) |
| 651 | 651 | // Open bus emulation is defective, but it should |
| 652 | | // be enough for the few cases known to rely on |
| 652 | // be enough for the few cases known to rely on |
| 653 | 653 | // this (more in the comments at the top of the |
| 654 | 654 | // source) |
| 655 | 655 | //------------------------------------------------- |
| 656 | 656 | |
| 657 | | READ8_MEMBER(device_nes_cart_interface::read_l) |
| 658 | | { |
| 659 | | return ((offset + 0x4100) & 0xff00) >> 8; // open bus |
| 657 | READ8_MEMBER(device_nes_cart_interface::read_l) |
| 658 | { |
| 659 | return ((offset + 0x4100) & 0xff00) >> 8; // open bus |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | | READ8_MEMBER(device_nes_cart_interface::read_m) |
| 663 | | { |
| 662 | READ8_MEMBER(device_nes_cart_interface::read_m) |
| 663 | { |
| 664 | 664 | if (m_battery) |
| 665 | 665 | return m_battery[offset & (m_battery_size - 1)]; |
| 666 | 666 | if (m_prgram) |
| 667 | 667 | return m_prgram[offset & (m_prgram_size - 1)]; |
| 668 | | |
| 669 | | return ((offset + 0x6000) & 0xff00) >> 8; // open bus |
| 668 | |
| 669 | return ((offset + 0x6000) & 0xff00) >> 8; // open bus |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | | WRITE8_MEMBER(device_nes_cart_interface::write_l) |
| 673 | | { |
| 672 | WRITE8_MEMBER(device_nes_cart_interface::write_l) |
| 673 | { |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | | WRITE8_MEMBER(device_nes_cart_interface::write_m) |
| 677 | | { |
| 676 | WRITE8_MEMBER(device_nes_cart_interface::write_m) |
| 677 | { |
| 678 | 678 | if (m_battery) |
| 679 | 679 | m_battery[offset & (m_battery_size - 1)] = data; |
| 680 | 680 | if (m_prgram) |
| 681 | 681 | m_prgram[offset & (m_prgram_size - 1)] = data; |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | | WRITE8_MEMBER(device_nes_cart_interface::write_h) |
| 685 | | { |
| 684 | WRITE8_MEMBER(device_nes_cart_interface::write_h) |
| 685 | { |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | |
| r22615 | r22616 | |
| 743 | 743 | m_prg_bank_mem[i]->set_entry(i); |
| 744 | 744 | m_prg_bank[i] = i; |
| 745 | 745 | } |
| 746 | | |
| 746 | |
| 747 | 747 | // Setup CHR |
| 748 | 748 | m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; |
| 749 | 749 | chr8(0, m_chr_source); |
| 750 | | |
| 750 | |
| 751 | 751 | // Setup NT |
| 752 | 752 | m_ciram = ciram_ptr; |
| 753 | 753 | |
| r22615 | r22616 | |
| 846 | 846 | |
| 847 | 847 | |
| 848 | 848 | /*------------------------------------------------- |
| 849 | | |
| 849 | |
| 850 | 850 | Load from xml list and identify the required slot device |
| 851 | | |
| 851 | |
| 852 | 852 | -------------------------------------------------*/ |
| 853 | 853 | |
| 854 | 854 | /* Include emulation of NES PCBs for softlist */ |
| r22615 | r22616 | |
| 856 | 856 | |
| 857 | 857 | |
| 858 | 858 | /*------------------------------------------------- |
| 859 | | |
| 859 | |
| 860 | 860 | Load .unf files (UNIF boards) and identify the required slot device |
| 861 | | |
| 861 | |
| 862 | 862 | -------------------------------------------------*/ |
| 863 | 863 | |
| 864 | 864 | /* Include emulation of UNIF Boards for .unf files */ |
| r22615 | r22616 | |
| 866 | 866 | |
| 867 | 867 | |
| 868 | 868 | /*------------------------------------------------- |
| 869 | | |
| 869 | |
| 870 | 870 | Load .nes files (iNES mappers) and identify the required slot devices |
| 871 | | |
| 871 | |
| 872 | 872 | -------------------------------------------------*/ |
| 873 | 873 | |
| 874 | 874 | /* Include emulation of iNES Mappers for .nes files */ |
| r22615 | r22616 | |
| 975 | 975 | |
| 976 | 976 | if ((ROM[0] == 'U') && (ROM[1] == 'N') && (ROM[2] == 'I') && (ROM[3] == 'F')) |
| 977 | 977 | slot_string = get_default_card_unif(ROM, len); |
| 978 | | |
| 978 | |
| 979 | 979 | global_free(ROM); |
| 980 | 980 | clear(); |
| 981 | | |
| 981 | |
| 982 | 982 | return slot_string; |
| 983 | 983 | } |
| 984 | 984 | else |
| r22615 | r22616 | |
| 1058 | 1058 | //------------------------------------------------- |
| 1059 | 1059 | |
| 1060 | 1060 | void nes_partialhash(hash_collection &dest, const unsigned char *data, |
| 1061 | | unsigned long length, const char *functions) |
| 1061 | unsigned long length, const char *functions) |
| 1062 | 1062 | { |
| 1063 | 1063 | if (length <= 16) |
| 1064 | 1064 | return; |
| 1065 | 1065 | dest.compute(&data[16], length - 16, functions); |
| 1066 | 1066 | } |
| 1067 | | |
trunk/src/mess/machine/nes_slot.h
| r22615 | r22616 | |
| 12 | 12 | enum |
| 13 | 13 | { |
| 14 | 14 | STD_NROM = 0, |
| 15 | | STD_AXROM, STD_AMROM, STD_BXROM, |
| 15 | STD_AXROM, STD_AMROM, STD_BXROM, |
| 16 | 16 | STD_CNROM, STD_CPROM, |
| 17 | 17 | STD_EXROM, STD_FXROM, STD_GXROM, |
| 18 | 18 | STD_HKROM, STD_PXROM, |
| 19 | 19 | STD_SXROM, STD_TXROM, STD_TXSROM, |
| 20 | | STD_TKROM, STD_TQROM, |
| 20 | STD_TKROM, STD_TQROM, |
| 21 | 21 | STD_UXROM, STD_UN1ROM, UXROM_CC, |
| 22 | | HVC_FAMBASIC, NES_QJ, PAL_ZZ, STD_EVENT, |
| 22 | HVC_FAMBASIC, NES_QJ, PAL_ZZ, STD_EVENT, |
| 23 | 23 | STD_SXROM_A, STD_SOROM, STD_SOROM_A, |
| 24 | 24 | /* Discrete components boards (by various manufacturer) */ |
| 25 | 25 | DIS_74X161X138, DIS_74X139X74, |
| r22615 | r22616 | |
| 77 | 77 | TXC_22211, TXC_DUMARACING, TXC_MJBLOCK, |
| 78 | 78 | TXC_COMMANDOS, TXC_TW, TXC_STRIKEW, |
| 79 | 79 | /* Multigame Carts */ |
| 80 | | BMC_64IN1NR, BMC_190IN1, BMC_A65AS, |
| 80 | BMC_64IN1NR, BMC_190IN1, BMC_A65AS, |
| 81 | 81 | BMC_HIK8IN1, BMC_NOVEL1, BMC_NOVEL2, BMC_S24IN1SC03, BMC_T262, |
| 82 | 82 | BMC_WS, BMC_SUPERBIG_7IN1, BMC_SUPERHIK_4IN1, BMC_BALLGAMES_11IN1, |
| 83 | 83 | BMC_MARIOPARTY_7IN1, BMC_GOLD_7IN1, BMC_SUPER_700IN1, BMC_FAMILY_4646, |
| r22615 | r22616 | |
| 85 | 85 | BMC_15IN1, BMC_SUPERHIK_300IN1, BMC_SUPERGUN_20IN1, |
| 86 | 86 | BMC_GOLDENCARD_6IN1, BMC_72IN1, BMC_SUPER_42IN1, BMC_76IN1, |
| 87 | 87 | BMC_31IN1, BMC_22GAMES, BMC_20IN1, BMC_110IN1, |
| 88 | | BMC_70IN1, BMC_800IN1, BMC_1200IN1, |
| 88 | BMC_70IN1, BMC_800IN1, BMC_1200IN1, |
| 89 | 89 | BMC_GKA, BMC_GKB, BMC_VT5201, BMC_BENSHIENG, BMC_810544, |
| 90 | 90 | BMC_NTD_03, BMC_G63IN1, BMC_FK23C, BMC_FK23CA, BMC_PJOY84, |
| 91 | | BMC_POWERFUL_255, BMC_11160, BMC_G146, BMC_8157, BMC_830118C, |
| 91 | BMC_POWERFUL_255, BMC_11160, BMC_G146, BMC_8157, BMC_830118C, |
| 92 | 92 | BMC_411120C, BMC_GOLD150, BMC_GOLD260, BMC_CH001, BMC_SUPER22, |
| 93 | 93 | BMC_12IN1, BMC_4IN1RESET, BMC_42IN1RESET, |
| 94 | 94 | /* Unlicensed */ |
| r22615 | r22616 | |
| 97 | 97 | UNL_UXROM, UNL_MK2, UNL_XIAOZY, UNL_KOF96, |
| 98 | 98 | UNL_SF3, UNL_RACERMATE, UNL_EDU2K, UNL_LH32, UNL_LH10, |
| 99 | 99 | UNL_STUDYNGAME, UNL_603_5052, UNL_H2288, UNL_2708, |
| 100 | | UNL_MALISB, UNL_BB, UNL_AC08, UNL_A9746, UNL_WORLDHERO, |
| 100 | UNL_MALISB, UNL_BB, UNL_AC08, UNL_A9746, UNL_WORLDHERO, |
| 101 | 101 | UNL_43272, UNL_TF1201, UNL_CITYFIGHT, |
| 102 | 102 | /* Bootleg boards */ |
| 103 | 103 | BTL_SMB2JA, BTL_MARIOBABY, BTL_AISENSHINICOL, BTL_TOBIDASE, |
| r22615 | r22616 | |
| 108 | 108 | MAGICSERIES_MD, KASING_BOARD, FUTUREMEDIA_BOARD, FUKUTAKE_BOARD, SOMARI_SL12, |
| 109 | 109 | HENGG_SRICH, HENGG_XHZS, HENGG_SHJY3, SUBOR_TYPE0, SUBOR_TYPE1, |
| 110 | 110 | KAISER_KS7058, KAISER_KS7032, KAISER_KS7022, KAISER_KS7017, KAISER_KS7012, KAISER_KS7013B, KAISER_KS202, |
| 111 | | CNE_DECATHLON, CNE_FSB, CNE_SHLZ, CONY_BOARD, YOKO_BOARD, |
| 111 | CNE_DECATHLON, CNE_FSB, CNE_SHLZ, CONY_BOARD, YOKO_BOARD, |
| 112 | 112 | RCM_GS2015, RCM_GS2004, RCM_GS2013, RCM_TF9IN1, RCM_3DBLOCK, |
| 113 | 113 | WAIXING_TYPE_A, WAIXING_TYPE_A1, WAIXING_TYPE_B, WAIXING_TYPE_C, WAIXING_TYPE_D, |
| 114 | 114 | WAIXING_TYPE_E, WAIXING_TYPE_F, WAIXING_TYPE_G, WAIXING_TYPE_H, WAIXING_TYPE_H1, |
| r22615 | r22616 | |
| 164 | 164 | virtual DECLARE_READ8_MEMBER(read_h) { return 0xff; } |
| 165 | 165 | virtual DECLARE_READ8_MEMBER(read_ex) { return 0xff; } |
| 166 | 166 | virtual DECLARE_WRITE8_MEMBER(write_l); |
| 167 | | virtual DECLARE_WRITE8_MEMBER(write_m); |
| 167 | virtual DECLARE_WRITE8_MEMBER(write_m); |
| 168 | 168 | virtual DECLARE_WRITE8_MEMBER(write_h); |
| 169 | 169 | virtual DECLARE_WRITE8_MEMBER(write_ex) { } |
| 170 | 170 | |
| r22615 | r22616 | |
| 188 | 188 | bool get_trainer() { return m_has_trainer; } |
| 189 | 189 | void set_trainer(bool val) { m_has_trainer = val; } |
| 190 | 190 | |
| 191 | | void set_ce(int mask, int state) { m_ce_mask = mask; m_ce_state = state; } |
| 191 | void set_ce(int mask, int state) { m_ce_mask = mask; m_ce_state = state; } |
| 192 | 192 | void set_vrc_lines(int PRG_A, int PRG_B, int CHR) { m_vrc_ls_prg_a = PRG_A; m_vrc_ls_prg_b = PRG_B; m_vrc_ls_chr = CHR; } |
| 193 | 193 | void set_x1_005_alt(bool val) { m_x1_005_alt_mirroring = val; } |
| 194 | 194 | void set_bus_conflict(bool val) { m_bus_conflict = val; } |
| r22615 | r22616 | |
| 211 | 211 | virtual void hblank_irq(int scanline, int vblank, int blanked) {} |
| 212 | 212 | virtual void scanline_irq(int scanline, int vblank, int blanked) {} |
| 213 | 213 | |
| 214 | | virtual void pcb_reset() {} // many pcb expect specific PRG/CHR banking at start |
| 214 | virtual void pcb_reset() {} // many pcb expect specific PRG/CHR banking at start |
| 215 | 215 | void pcb_start(running_machine &machine, UINT8 *ciram_ptr); |
| 216 | 216 | void pcb_reg_postload(running_machine &machine); |
| 217 | 217 | void nes_banks_restore(); |
| 218 | 218 | |
| 219 | | UINT8 hi_access_rom(UINT32 offset); // helper ROM access for a bunch of PCB reading 0x8000-0xffff for protection too |
| 219 | UINT8 hi_access_rom(UINT32 offset); // helper ROM access for a bunch of PCB reading 0x8000-0xffff for protection too |
| 220 | 220 | UINT8 account_bus_conflict(UINT32 offset, UINT8 data); |
| 221 | 221 | |
| 222 | 222 | protected: |
| r22615 | r22616 | |
| 228 | 228 | UINT8 *m_vram; |
| 229 | 229 | UINT8 *m_battery; |
| 230 | 230 | UINT8 *m_ciram; |
| 231 | | |
| 231 | |
| 232 | 232 | UINT32 m_prg_size; |
| 233 | 233 | UINT32 m_prgram_size; |
| 234 | 234 | UINT32 m_vrom_size; |
| 235 | 235 | UINT32 m_vram_size; |
| 236 | 236 | UINT32 m_battery_size; |
| 237 | | |
| 237 | |
| 238 | 238 | // these are specific of some boards but must be accessible from the driver |
| 239 | 239 | // E.g. additional save ram for HKROM, X1-005 & X1-017 boards, or ExRAM for MMC5 |
| 240 | 240 | UINT8 *m_mapper_sram; |
| r22615 | r22616 | |
| 247 | 247 | int m_vrc_ls_prg_a; |
| 248 | 248 | int m_vrc_ls_prg_b; |
| 249 | 249 | int m_vrc_ls_chr; |
| 250 | | |
| 250 | |
| 251 | 251 | int m_mirroring; |
| 252 | 252 | bool m_pcb_ctrl_mirror, m_four_screen_vram, m_has_trainer; |
| 253 | | bool m_x1_005_alt_mirroring; // temp hack for two kind of mirroring in Taito X1-005 boards (to be replaced with pin checking) |
| 253 | bool m_x1_005_alt_mirroring; // temp hack for two kind of mirroring in Taito X1-005 boards (to be replaced with pin checking) |
| 254 | 254 | bool m_bus_conflict; |
| 255 | 255 | |
| 256 | 256 | // PRG |
| r22615 | r22616 | |
| 271 | 271 | void prg8_ef(int bank); |
| 272 | 272 | void prg8_x(int start, int bank); |
| 273 | 273 | |
| 274 | | |
| 274 | |
| 275 | 275 | // CHR |
| 276 | | int m_chr_source; // global source for the 8 VROM banks |
| 276 | int m_chr_source; // global source for the 8 VROM banks |
| 277 | 277 | inline void chr_sanity_check(int source); |
| 278 | 278 | |
| 279 | | //these were previously called chr_map. they are a quick banking structure, |
| 279 | //these were previously called chr_map. they are a quick banking structure, |
| 280 | 280 | //because some of these change multiple times per scanline! |
| 281 | 281 | int m_chr_src[8]; //defines source of base pointer |
| 282 | 282 | int m_chr_orig[8]; //defines offset of 0x400 byte segment at base pointer |
| r22615 | r22616 | |
| 305 | 305 | void chr1_6(int bank, int source) { chr1_x(6, bank, source); }; |
| 306 | 306 | void chr1_7(int bank, int source) { chr1_x(7, bank, source); }; |
| 307 | 307 | |
| 308 | | |
| 308 | |
| 309 | 309 | // NameTable & Mirroring |
| 310 | 310 | //these were previously called nt_page. they are a quick banking structure for a maximum of 4K of RAM/ROM/ExRAM |
| 311 | 311 | int m_nt_src[4]; |
| r22615 | r22616 | |
| 375 | 375 | virtual DECLARE_WRITE8_MEMBER(write_ex); |
| 376 | 376 | |
| 377 | 377 | int get_pcb_id() { return m_pcb_id; }; |
| 378 | | |
| 378 | |
| 379 | 379 | void pcb_start(UINT8 *ciram_ptr); |
| 380 | 380 | void pcb_reset(); |
| 381 | 381 | |