trunk/src/emu/bus/a7800/rom.c
| r32084 | r32085 | |
| 30 | 30 | const device_type A78_ROM_SG_POKEY = &device_creator<a78_rom_sg_pokey_device>; |
| 31 | 31 | const device_type A78_ROM_SG_RAM = &device_creator<a78_rom_sg_ram_device>; |
| 32 | 32 | const device_type A78_ROM_SG9 = &device_creator<a78_rom_sg9_device>; |
| 33 | | const device_type A78_ROM_SG9_POKEY = &device_creator<a78_rom_sg9_pokey_device>; |
| 34 | 33 | const device_type A78_ROM_ABSOLUTE = &device_creator<a78_rom_abs_device>; |
| 35 | 34 | const device_type A78_ROM_ACTIVISION = &device_creator<a78_rom_act_device>; |
| 36 | 35 | |
| 37 | 36 | |
| 37 | const device_type A78_ROM_P450 = &device_creator<a78_rom_p450_device>; |
| 38 | const device_type A78_ROM_P450_POKEY = &device_creator<a78_rom_p450_pokey_device>; |
| 39 | const device_type A78_ROM_P450_SG_RAM = &device_creator<a78_rom_p450_sg_ram_device>; |
| 40 | const device_type A78_ROM_P450_SG9 = &device_creator<a78_rom_p450_sg9_device>; |
| 41 | |
| 42 | |
| 38 | 43 | a78_rom_device::a78_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 39 | 44 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 40 | 45 | device_a78_cart_interface( mconfig, *this ) |
| r32084 | r32085 | |
| 47 | 52 | { |
| 48 | 53 | } |
| 49 | 54 | |
| 55 | a78_rom_pokey_device::a78_rom_pokey_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 56 | : a78_rom_device(mconfig, type, name, tag, owner, clock, shortname, source), |
| 57 | m_pokey(*this, "pokey") |
| 58 | { |
| 59 | } |
| 60 | |
| 50 | 61 | a78_rom_pokey_device::a78_rom_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 51 | 62 | : a78_rom_device(mconfig, A78_ROM_POKEY, "Atari 7800 ROM Carts w/no Bankswitch + POKEY", tag, owner, clock, "a78_rom_pok", __FILE__), |
| 52 | 63 | m_pokey(*this, "pokey") |
| r32084 | r32085 | |
| 71 | 82 | } |
| 72 | 83 | |
| 73 | 84 | |
| 85 | a78_rom_sg_ram_device::a78_rom_sg_ram_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 86 | : a78_rom_sg_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 87 | { |
| 88 | } |
| 89 | |
| 74 | 90 | a78_rom_sg_ram_device::a78_rom_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 75 | 91 | : a78_rom_sg_device(mconfig, A78_ROM_SG_RAM, "Atari 7800 ROM Carts w/SuperGame Bankswitch + RAM", tag, owner, clock, "a78_rom_sgr", __FILE__) |
| 76 | 92 | { |
| r32084 | r32085 | |
| 88 | 104 | } |
| 89 | 105 | |
| 90 | 106 | |
| 91 | | a78_rom_sg9_pokey_device::a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 92 | | : a78_rom_sg9_device(mconfig, A78_ROM_SG9_POKEY, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY", tag, owner, clock, "a78_rom_sg9p", __FILE__), |
| 93 | | m_pokey(*this, "pokey") |
| 94 | | { |
| 95 | | } |
| 96 | | |
| 97 | | |
| 98 | 107 | a78_rom_abs_device::a78_rom_abs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 99 | 108 | : a78_rom_device(mconfig, A78_ROM_ABSOLUTE, "Atari 7800 ROM Carts w/Absolute Bankswitch", tag, owner, clock, "a78_rom_abs", __FILE__) |
| 100 | 109 | { |
| r32084 | r32085 | |
| 108 | 117 | |
| 109 | 118 | |
| 110 | 119 | |
| 120 | a78_rom_p450_device::a78_rom_p450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 121 | : a78_rom_device(mconfig, A78_ROM_P450, "Atari 7800 ROM Carts w/POKEY @ 0x0450", tag, owner, clock, "a78_p450_t0", __FILE__), |
| 122 | m_pokey450(*this, "pokey450") |
| 123 | { |
| 124 | } |
| 125 | |
| 126 | a78_rom_p450_pokey_device::a78_rom_p450_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 127 | : a78_rom_pokey_device(mconfig, A78_ROM_P450_POKEY, "Atari 7800 ROM Carts w/no Bankswitch + POKEY + POKEY @ 0x0450", tag, owner, clock, "a78_p450_t1", __FILE__), |
| 128 | m_pokey450(*this, "pokey450") |
| 129 | { |
| 130 | } |
| 131 | |
| 132 | a78_rom_p450_sg_ram_device::a78_rom_p450_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 133 | : a78_rom_sg_ram_device(mconfig, A78_ROM_P450_SG_RAM, "Atari 7800 ROM Carts w/SuperGame Bankswitch + RAM + POKEY @ 0x0450", tag, owner, clock, "a78_p450_t6", __FILE__), |
| 134 | m_pokey450(*this, "pokey450") |
| 135 | { |
| 136 | } |
| 137 | |
| 138 | a78_rom_p450_sg9_device::a78_rom_p450_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 139 | : a78_rom_sg9_device(mconfig, A78_ROM_P450_SG9, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY @ 0x0450", tag, owner, clock, "a78_p450_ta", __FILE__), |
| 140 | m_pokey450(*this, "pokey450") |
| 141 | { |
| 142 | } |
| 143 | |
| 144 | |
| 145 | |
| 111 | 146 | void a78_rom_device::device_start() |
| 112 | 147 | { |
| 113 | 148 | } |
| r32084 | r32085 | |
| 154 | 189 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00) |
| 155 | 190 | MACHINE_CONFIG_END |
| 156 | 191 | |
| 192 | static MACHINE_CONFIG_FRAGMENT( a78_pokey450 ) |
| 193 | MCFG_SPEAKER_STANDARD_MONO("pokey_450") |
| 157 | 194 | |
| 195 | MCFG_SOUND_ADD("pokey450", POKEY, XTAL_14_31818MHz/8) |
| 196 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "pokey_450", 1.00) |
| 197 | MACHINE_CONFIG_END |
| 198 | |
| 199 | static MACHINE_CONFIG_FRAGMENT( a78_2pokeys ) |
| 200 | MCFG_SPEAKER_STANDARD_MONO("addon") |
| 201 | |
| 202 | MCFG_SOUND_ADD("pokey", POKEY, XTAL_14_31818MHz/8) |
| 203 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00) |
| 204 | |
| 205 | MCFG_SOUND_ADD("pokey450", POKEY, XTAL_14_31818MHz/8) |
| 206 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00) |
| 207 | MACHINE_CONFIG_END |
| 208 | |
| 209 | |
| 158 | 210 | /*------------------------------------------------- |
| 159 | 211 | mapper specific handlers |
| 160 | 212 | -------------------------------------------------*/ |
| r32084 | r32085 | |
| 311 | 363 | 9 x 16K banks mappable in 0x8000-0xbfff |
| 312 | 364 | bank 7 is always mapped in 0xc000-0xffff |
| 313 | 365 | |
| 314 | | GAMES: Alien Brigade & Crossbow |
| 366 | GAMES: Alien Brigade & Crossbow + some homebrew |
| 367 | like Donkey Kong XM demo, Bentley Bear's Crystal |
| 368 | Quest |
| 315 | 369 | |
| 316 | 370 | -------------------------------------------------*/ |
| 317 | 371 | |
| r32084 | r32085 | |
| 333 | 387 | |
| 334 | 388 | /*------------------------------------------------- |
| 335 | 389 | |
| 336 | | Carts with SuperGame bankswitch 9banks + POKEY: |
| 337 | | This was not used in any commercial game released |
| 338 | | during A7800 lifespan, but it is used by Donkey |
| 339 | | Kong XM demo and by Bentley Bear's Crystal Quest |
| 340 | | for use with XM expansion module or XBoarD expansion |
| 341 | | |
| 342 | | GAMES: Donkey Kong XM demo, Bentley Bear's Crystal |
| 343 | | Quest |
| 344 | | |
| 345 | | -------------------------------------------------*/ |
| 346 | | |
| 347 | | WRITE8_MEMBER(a78_rom_sg9_pokey_device::write_40xx) |
| 348 | | { |
| 349 | | if (offset < 0x4000) |
| 350 | | m_pokey->write(space, offset & 0x0f, data); |
| 351 | | else if (offset < 0x8000) |
| 352 | | m_bank = (data & m_bank_mask) + 1; |
| 353 | | } |
| 354 | | |
| 355 | | machine_config_constructor a78_rom_sg9_pokey_device::device_mconfig_additions() const |
| 356 | | { |
| 357 | | return MACHINE_CONFIG_NAME( a78_pokey ); |
| 358 | | } |
| 359 | | |
| 360 | | /*------------------------------------------------- |
| 361 | | |
| 362 | 390 | Carts with Absolute bankswitch: |
| 363 | 391 | 64K games. Lower 32K are 2 banks of 16K to be mapped |
| 364 | 392 | in 0x4000-0x7fff, depending on the value written |
| r32084 | r32085 | |
| 442 | 470 | if (offset >= 0xbf80 && offset <= 0xbf87) |
| 443 | 471 | m_bank = offset & 7; |
| 444 | 472 | } |
| 473 | |
| 474 | |
| 475 | // Machine configs for PCB variants with a POKEY at $0450 |
| 476 | |
| 477 | machine_config_constructor a78_rom_p450_device::device_mconfig_additions() const |
| 478 | { |
| 479 | return MACHINE_CONFIG_NAME( a78_pokey450 ); |
| 480 | } |
| 481 | |
| 482 | machine_config_constructor a78_rom_p450_pokey_device::device_mconfig_additions() const |
| 483 | { |
| 484 | return MACHINE_CONFIG_NAME( a78_2pokeys ); |
| 485 | } |
| 486 | |
| 487 | machine_config_constructor a78_rom_p450_sg_ram_device::device_mconfig_additions() const |
| 488 | { |
| 489 | return MACHINE_CONFIG_NAME( a78_pokey450 ); |
| 490 | } |
| 491 | |
| 492 | machine_config_constructor a78_rom_p450_sg9_device::device_mconfig_additions() const |
| 493 | { |
| 494 | return MACHINE_CONFIG_NAME( a78_pokey450 ); |
| 495 | } |
| 496 | |
trunk/src/emu/bus/a7800/a78_slot.c
| r32084 | r32085 | |
| 157 | 157 | call load |
| 158 | 158 | -------------------------------------------------*/ |
| 159 | 159 | |
| 160 | int a78_cart_slot_device::validate_header(int head, bool log) |
| 161 | { |
| 162 | switch (head & 0x3d) |
| 163 | { |
| 164 | case 0x05: |
| 165 | if (log) |
| 166 | { |
| 167 | printf("POKEY + RAM at $4000 (Header 0x05)\n"); |
| 168 | printf("Disabling POKEY\n"); |
| 169 | } |
| 170 | head &= ~0x01; |
| 171 | break; |
| 172 | case 0x09: |
| 173 | if (log) |
| 174 | { |
| 175 | printf("POKEY + Bank 0 of 144K ROM at $4000 (Header 0x09)\n"); |
| 176 | printf("Disabling POKEY\n"); |
| 177 | } |
| 178 | head &= ~0x01; |
| 179 | break; |
| 180 | case 0x11: |
| 181 | if (log) |
| 182 | { |
| 183 | printf("POKEY + Bank 6 ROM at $4000 (Header 0x11)\n"); |
| 184 | printf("Disabling POKEY\n"); |
| 185 | } |
| 186 | head &= ~0x01; |
| 187 | break; |
| 188 | case 0x21: |
| 189 | if (log) |
| 190 | { |
| 191 | printf("POKEY + banked RAM at $4000 (Header 0x21)\n"); |
| 192 | printf("Disabling POKEY\n"); |
| 193 | } |
| 194 | head &= ~0x01; |
| 195 | break; |
| 196 | case 0x0c: |
| 197 | if (log) |
| 198 | { |
| 199 | printf("RAM + Bank 0 of 144K ROM at $4000 (Header 0x0c)\n"); |
| 200 | printf("Disabling RAM\n"); |
| 201 | } |
| 202 | head &= ~0x04; |
| 203 | break; |
| 204 | case 0x14: |
| 205 | if (log) |
| 206 | { |
| 207 | printf("RAM + Bank 6 ROM at $4000 (Header 0x14)\n"); |
| 208 | printf("Disabling RAM\n"); |
| 209 | } |
| 210 | head &= ~0x04; |
| 211 | break; |
| 212 | case 0x24: |
| 213 | if (log) |
| 214 | { |
| 215 | printf("RAM + Banked RAM at $4000 (Header 0x24)\n"); |
| 216 | printf("Disabling RAM\n"); |
| 217 | } |
| 218 | head &= ~0x04; |
| 219 | break; |
| 220 | case 0x18: |
| 221 | if (log) |
| 222 | { |
| 223 | printf("Bank 0 of 144K ROM + Bank 6 ROM at $4000 (Header 0x18)\n"); |
| 224 | printf("Disabling Bank 0 ROM\n"); |
| 225 | } |
| 226 | head &= ~0x08; |
| 227 | break; |
| 228 | case 0x28: |
| 229 | if (log) |
| 230 | { |
| 231 | printf("Bank 0 of 144K ROM + Banked RAM at $4000 (Header 0x28)\n"); |
| 232 | printf("Disabling Bank 0 ROM\n"); |
| 233 | } |
| 234 | head &= ~0x08; |
| 235 | break; |
| 236 | case 0x30: |
| 237 | if (log) |
| 238 | { |
| 239 | printf("Bank 6 ROM + banked RAM at $4000 (Header 0x30)\n"); |
| 240 | printf("Disabling Bank 6 ROM\n"); |
| 241 | } |
| 242 | head &= ~0x10; |
| 243 | break; |
| 244 | } |
| 245 | |
| 246 | if ((head & 0x3c) && !(head & 0x02)) |
| 247 | { |
| 248 | if (log) |
| 249 | { |
| 250 | printf("SuperCart bankswitch detected at $4000, with no SuperCart bit (Header 0x%X)\n", head); |
| 251 | printf("Enablig SuperCart bankswitch\n"); |
| 252 | } |
| 253 | head |= 0x02; |
| 254 | } |
| 255 | |
| 256 | if ((head & 0xff00) == 0x100 && (head & 0xff)) |
| 257 | { |
| 258 | if (log) |
| 259 | { |
| 260 | printf("Bankswitch detected for an Activision cart (Header 0x%X)\n", head); |
| 261 | printf("Disabling bankswitch\n"); |
| 262 | } |
| 263 | head &= 0xff00; |
| 264 | } |
| 265 | |
| 266 | if ((head & 0xff00) == 0x200 && (head & 0xff)) |
| 267 | { |
| 268 | if (log) |
| 269 | { |
| 270 | printf("Bankswitch detected for an Absolute cart (Header 0x%X)\n", head); |
| 271 | printf("Disabling bankswitch\n"); |
| 272 | } |
| 273 | head &= 0xff00; |
| 274 | } |
| 275 | |
| 276 | if ((head & 0xff00) > 0x300) |
| 277 | { |
| 278 | if (log) |
| 279 | { |
| 280 | printf("Unsupported mapper, please contact MESSdevs (Header 0x%X)\n", head); |
| 281 | printf("Disabling special bits\n"); |
| 282 | } |
| 283 | head &= 0x00ff; |
| 284 | } |
| 285 | |
| 286 | return head; |
| 287 | } |
| 288 | |
| 289 | |
| 160 | 290 | //------------------------------------------------- |
| 161 | 291 | // A78 PCBs |
| 162 | 292 | //------------------------------------------------- |
| r32084 | r32085 | |
| 167 | 297 | const char *slot_option; |
| 168 | 298 | }; |
| 169 | 299 | |
| 300 | #define A78_POKEY0450 0x20 |
| 301 | |
| 170 | 302 | // Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it |
| 171 | 303 | static const a78_slot slot_list[] = |
| 172 | 304 | { |
| r32084 | r32085 | |
| 176 | 308 | { A78_TYPE3, "a78_sg_pokey" }, |
| 177 | 309 | { A78_TYPE6, "a78_sg_ram" }, |
| 178 | 310 | { A78_TYPEA, "a78_sg9" }, |
| 179 | | { A78_TYPEB, "a78_sg9_pokey" }, |
| 180 | 311 | { A78_ABSOLUTE, "a78_abs" }, |
| 181 | 312 | { A78_ACTIVISION, "a78_act" }, |
| 182 | 313 | { A78_HSC, "a78_hsc" }, |
| r32084 | r32085 | |
| 184 | 315 | { A78_XM_BOARD, "a78_xm" }, |
| 185 | 316 | { A78_MEGACART, "a78_megacart" }, |
| 186 | 317 | { A78_VERSABOARD, "a78_versa" }, |
| 187 | | { A78_VERSAPOKEY, "a78_versap" }, |
| 318 | { A78_TYPE0_POK450, "a78_p450_t0" }, |
| 319 | { A78_TYPE1_POK450, "a78_p450_t1" }, |
| 320 | { A78_TYPE6_POK450, "a78_p450_t6" }, |
| 321 | { A78_TYPEA_POK450, "a78_p450_ta" }, |
| 322 | { A78_VERSA_POK450, "a78_p450_vb" }, |
| 188 | 323 | { A78_NOCART, "empty" }, // the code should never get here, of course... |
| 189 | 324 | }; |
| 190 | 325 | |
| r32084 | r32085 | |
| 195 | 330 | if (!core_stricmp(slot_list[i].slot_option, slot)) |
| 196 | 331 | return slot_list[i].pcb_id; |
| 197 | 332 | } |
| 198 | | |
| 333 | |
| 199 | 334 | return 0; |
| 200 | 335 | } |
| 201 | 336 | |
| r32084 | r32085 | |
| 206 | 341 | if (slot_list[i].pcb_id == type) |
| 207 | 342 | return slot_list[i].slot_option; |
| 208 | 343 | } |
| 209 | | |
| 344 | |
| 210 | 345 | return "a78_rom"; |
| 211 | 346 | } |
| 212 | 347 | |
| r32084 | r32085 | |
| 234 | 369 | else |
| 235 | 370 | { |
| 236 | 371 | // Load and check the header |
| 372 | int mapper; |
| 237 | 373 | char head[128]; |
| 238 | 374 | fread(head, 128); |
| 239 | 375 | |
| r32084 | r32085 | |
| 247 | 383 | len = length() - 128; |
| 248 | 384 | } |
| 249 | 385 | |
| 250 | | switch ((head[53] << 8) | head[54]) |
| 386 | // let's try to auto-fix some common errors in the header |
| 387 | mapper = validate_header((head[53] << 8) | head[54], TRUE); |
| 388 | |
| 389 | switch (mapper & 0xfe) |
| 251 | 390 | { |
| 252 | 391 | case 0x0000: |
| 253 | | m_type = A78_TYPE0; |
| 392 | m_type = BIT(mapper, 0) ? A78_TYPE1 : A78_TYPE0; |
| 254 | 393 | break; |
| 255 | | case 0x0001: |
| 256 | | m_type = A78_TYPE1; |
| 257 | | break; |
| 258 | 394 | case 0x0002: |
| 259 | | m_type = A78_TYPE2; |
| 395 | m_type = BIT(mapper, 0) ? A78_TYPE3 : A78_TYPE2; |
| 260 | 396 | break; |
| 261 | | case 0x0003: |
| 262 | | m_type = A78_TYPE3; |
| 263 | | break; |
| 264 | 397 | case 0x0006: |
| 265 | 398 | m_type = A78_TYPE6; |
| 266 | 399 | break; |
| 267 | 400 | case 0x000a: |
| 268 | 401 | m_type = A78_TYPEA; |
| 269 | 402 | break; |
| 270 | | case 0x000b: |
| 271 | | m_type = A78_TYPEB; |
| 272 | | break; |
| 273 | | case 0x0020: |
| 403 | case 0x0022: |
| 404 | case 0x0026: |
| 274 | 405 | if (len > 0x40000) |
| 275 | 406 | m_type = A78_MEGACART; |
| 276 | 407 | else |
| 277 | 408 | m_type = A78_VERSABOARD; |
| 278 | 409 | break; |
| 279 | | case 0x0021: |
| 280 | | m_type = A78_VERSAPOKEY; |
| 281 | | break; |
| 282 | | case 0x0100: |
| 283 | | m_type = A78_ACTIVISION; |
| 284 | | break; |
| 285 | | case 0x0200: |
| 286 | | m_type = A78_ABSOLUTE; |
| 287 | | break; |
| 288 | 410 | } |
| 411 | |
| 412 | // check special bits, which override the previous |
| 413 | if ((mapper & 0xff00) == 0x0100) |
| 414 | m_type = A78_ACTIVISION; |
| 415 | else if ((mapper & 0xff00) == 0x0200) |
| 416 | m_type = A78_ABSOLUTE; |
| 417 | else if ((mapper & 0xff00) == 0x0300) |
| 418 | { |
| 419 | // the cart has a POKEY at $0450 (typically a VersaBoard variant)! |
| 420 | if (m_type != A78_TYPE2) |
| 421 | { |
| 422 | m_type &= ~0x02; |
| 423 | m_type += A78_POKEY0450; |
| 424 | } |
| 425 | } |
| 426 | |
| 289 | 427 | logerror("Cart type: %x\n", m_type); |
| 290 | 428 | |
| 291 | 429 | internal_header_logging((UINT8 *)head, length()); |
| r32084 | r32085 | |
| 299 | 437 | |
| 300 | 438 | if (m_type == A78_TYPE6) |
| 301 | 439 | m_cart->ram_alloc(0x4000); |
| 302 | | if (m_type == A78_MEGACART || m_type == A78_VERSABOARD || m_type == A78_VERSAPOKEY) |
| 440 | if (m_type == A78_MEGACART || (m_type >= A78_VERSABOARD && m_type <= A78_VERSA_POK450)) |
| 303 | 441 | m_cart->ram_alloc(0x8000); |
| 304 | 442 | if (m_type == A78_XB_BOARD || m_type == A78_XM_BOARD) |
| 305 | 443 | m_cart->ram_alloc(0x20000); |
| r32084 | r32085 | |
| 374 | 512 | { |
| 375 | 513 | const char *slot_string = "a78_rom"; |
| 376 | 514 | dynamic_buffer head(128); |
| 377 | | int type = A78_TYPE0; |
| 515 | int type = A78_TYPE0, mapper; |
| 378 | 516 | |
| 379 | 517 | // Load and check the header |
| 380 | 518 | core_fread(m_file, head, 128); |
| 381 | | switch ((head[53] << 8) | head[54]) |
| 519 | |
| 520 | // let's try to auto-fix some common errors in the header |
| 521 | mapper = validate_header((head[53] << 8) | head[54], FALSE); |
| 522 | |
| 523 | switch (mapper & 0xfe) |
| 382 | 524 | { |
| 383 | 525 | case 0x0000: |
| 384 | | type = A78_TYPE0; |
| 526 | type = BIT(mapper, 0) ? A78_TYPE1 : A78_TYPE0; |
| 385 | 527 | break; |
| 386 | | case 0x0001: |
| 387 | | type = A78_TYPE1; |
| 388 | | break; |
| 389 | 528 | case 0x0002: |
| 390 | | type = A78_TYPE2; |
| 529 | type = BIT(mapper, 0) ? A78_TYPE3 : A78_TYPE2; |
| 391 | 530 | break; |
| 392 | | case 0x0003: |
| 393 | | type = A78_TYPE3; |
| 394 | | break; |
| 395 | 531 | case 0x0006: |
| 396 | 532 | type = A78_TYPE6; |
| 397 | 533 | break; |
| 398 | 534 | case 0x000a: |
| 399 | 535 | type = A78_TYPEA; |
| 400 | 536 | break; |
| 401 | | case 0x000b: |
| 402 | | type = A78_TYPEB; |
| 403 | | break; |
| 404 | | case 0x0020: |
| 537 | case 0x0022: |
| 538 | case 0x0026: |
| 405 | 539 | if (core_fsize(m_file) > 0x40000) |
| 406 | 540 | type = A78_MEGACART; |
| 407 | 541 | else |
| 408 | 542 | type = A78_VERSABOARD; |
| 409 | 543 | break; |
| 410 | | case 0x0021: |
| 411 | | type = A78_VERSAPOKEY; |
| 412 | | break; |
| 413 | | case 0x0100: |
| 414 | | type = A78_ACTIVISION; |
| 415 | | break; |
| 416 | | case 0x0200: |
| 417 | | type = A78_ABSOLUTE; |
| 418 | | break; |
| 419 | 544 | } |
| 545 | |
| 546 | // check special bits, which override the previous |
| 547 | if ((mapper & 0xff00) == 0x0100) |
| 548 | type = A78_ACTIVISION; |
| 549 | else if ((mapper & 0xff00) == 0x0200) |
| 550 | type = A78_ABSOLUTE; |
| 551 | else if ((mapper & 0xff00) == 0x0300) |
| 552 | { |
| 553 | // the cart has a POKEY at $0450 (typically a VersaBoard variant)! |
| 554 | if (type != A78_TYPE2) |
| 555 | { |
| 556 | type &= ~0x02; |
| 557 | type += A78_POKEY0450; |
| 558 | } |
| 559 | } |
| 560 | |
| 420 | 561 | logerror("Cart type: %x\n", type); |
| 421 | 562 | slot_string = a78_get_slot(type); |
| 422 | 563 | |
| r32084 | r32085 | |
| 497 | 638 | |
| 498 | 639 | /*------------------------------------------------- |
| 499 | 640 | A78 header logging |
| 641 | |
| 642 | A78 HEADER FORMAT |
| 643 | |
| 644 | Bytes | Content | Length |
| 645 | ======================================== |
| 646 | 0 | Header version | 1 byte |
| 647 | -------|-------------------|------------ |
| 648 | 1..16 | "ATARI7800 " | 16 bytes |
| 649 | -------|-------------------|------------ |
| 650 | 17..48 | Cart title | 32 bytes |
| 651 | -------|-------------------|------------ |
| 652 | 49..52 | Data length | 4 bytes |
| 653 | -------|-------------------|------------ |
| 654 | 53..54 | Cart type [*] | 2 bytes |
| 655 | -------|-------------------|------------ |
| 656 | 55 | Controller 1 type | 1 byte |
| 657 | | | |
| 658 | | 0 = None | |
| 659 | | 1 = Joystick | |
| 660 | | 2 = Light Gun | |
| 661 | -------|-------------------|------------ |
| 662 | 56 | Controller 2 type | 1 byte |
| 663 | | | |
| 664 | | As above | |
| 665 | -------|-------------------|------------ |
| 666 | 57 | TV System | 1 byte |
| 667 | | | |
| 668 | | 0 = NTSC/1 = PAL | |
| 669 | -------|-------------------|------------ |
| 670 | 58 | Save data | 1 byte |
| 671 | | | (only v2) |
| 672 | | 0 = None / Unk | |
| 673 | | 1 = High Score | |
| 674 | | 2 = Savekey | |
| 675 | -------|-------------------|----------- |
| 676 | 63 | Expansion module | 1 byte |
| 677 | | | |
| 678 | | 0 = No expansion | |
| 679 | | module | |
| 680 | | 1 = Expansion | |
| 681 | | required | |
| 682 | -------|-------------------|----------- |
| 683 | |
| 684 | |
| 685 | [*] Cart type: |
| 686 | |
| 687 | bit 0-7 - Hardware "flags" |
| 688 | bit 0 [0x01] - POKEY at $4000 |
| 689 | bit 1 [0x02] - SuperCart bank switched |
| 690 | bit 2 [0x04] - SuperCart RAM at $4000 |
| 691 | bit 3 [0x08] - bank 0 of 144K ROM at $4000 |
| 692 | bit 4 [0x10] - bank 6 at $4000 |
| 693 | bit 5 [0x20] - banked RAM at $4000 |
| 694 | |
| 695 | bit 8-15 - Special values |
| 696 | 0 = Normal cart |
| 697 | 1 = Absolute (F18 Hornet) |
| 698 | 2 = Activision (Double Dragon & Rampage) |
| 699 | 3 = POKEY at $0450 |
| 700 | |
| 500 | 701 | -------------------------------------------------*/ |
| 501 | 702 | |
| 502 | 703 | void a78_cart_slot_device::internal_header_logging(UINT8 *header, UINT32 len) |
trunk/src/emu/bus/a7800/cpuwiz.c
| r32084 | r32085 | |
| 33 | 33 | //------------------------------------------------- |
| 34 | 34 | |
| 35 | 35 | const device_type A78_ROM_VERSABOARD = &device_creator<a78_versaboard_device>; |
| 36 | | const device_type A78_ROM_VERSAPOKEY = &device_creator<a78_versapokey_device>; |
| 37 | 36 | const device_type A78_ROM_MEGACART = &device_creator<a78_megacart_device>; |
| 38 | 37 | |
| 38 | const device_type A78_ROM_P450_VB = &device_creator<a78_rom_p450_vb_device>; |
| 39 | 39 | |
| 40 | |
| 40 | 41 | a78_versaboard_device::a78_versaboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 41 | 42 | : a78_rom_sg_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 42 | 43 | { |
| r32084 | r32085 | |
| 47 | 48 | { |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | | a78_versapokey_device::a78_versapokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 51 | | : a78_versaboard_device(mconfig, A78_ROM_VERSAPOKEY, "Atari 7800 VersaBoard + POKEY @ 0x0450 Cart", tag, owner, clock, "a78_versapokey", __FILE__), |
| 52 | | m_pokey(*this, "pokey") |
| 53 | | { |
| 54 | | } |
| 55 | 51 | |
| 56 | 52 | a78_megacart_device::a78_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 57 | 53 | : a78_versaboard_device(mconfig, A78_ROM_MEGACART, "Atari 7800 MegaCart+", tag, owner, clock, "a78_megacart", __FILE__) |
| r32084 | r32085 | |
| 59 | 55 | } |
| 60 | 56 | |
| 61 | 57 | |
| 58 | a78_rom_p450_vb_device::a78_rom_p450_vb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 59 | : a78_versaboard_device(mconfig, A78_ROM_P450_VB, "Atari 7800 VersaBoard + POKEY @ 0x0450 Cart", tag, owner, clock, "a78_versapokey", __FILE__), |
| 60 | m_pokey450(*this, "pokey450") |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | |
| 62 | 65 | void a78_versaboard_device::device_start() |
| 63 | 66 | { |
| 64 | 67 | save_item(NAME(m_bank)); |
| r32084 | r32085 | |
| 97 | 100 | } |
| 98 | 101 | |
| 99 | 102 | |
| 100 | | // VersaBoard + POKEY @ 0x0450 |
| 101 | | |
| 102 | | static MACHINE_CONFIG_FRAGMENT( a78_pokey ) |
| 103 | | MCFG_SPEAKER_STANDARD_MONO("addon") |
| 104 | | |
| 105 | | MCFG_SOUND_ADD("pokey", POKEY, XTAL_14_31818MHz/8) |
| 106 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00) |
| 107 | | MACHINE_CONFIG_END |
| 108 | | |
| 109 | | machine_config_constructor a78_versapokey_device::device_mconfig_additions() const |
| 110 | | { |
| 111 | | return MACHINE_CONFIG_NAME( a78_pokey ); |
| 112 | | } |
| 113 | | |
| 114 | | READ8_MEMBER(a78_versapokey_device::read_04xx) |
| 115 | | { |
| 116 | | if (offset >= 0x50 && offset < 0x60) |
| 117 | | return m_pokey->read(space, offset & 0x0f); |
| 118 | | else |
| 119 | | return 0xff; |
| 120 | | } |
| 121 | | |
| 122 | | WRITE8_MEMBER(a78_versapokey_device::write_04xx) |
| 123 | | { |
| 124 | | if (offset >= 0x50 && offset < 0x60) |
| 125 | | m_pokey->write(space, offset & 0x0f, data); |
| 126 | | } |
| 127 | | |
| 128 | | READ8_MEMBER(a78_versapokey_device::read_40xx) |
| 129 | | { |
| 130 | | if (offset < 0x4000) |
| 131 | | return m_rom[(offset & 0x3fff)]; |
| 132 | | else if (offset < 0x8000) |
| 133 | | return m_rom[(offset & 0x3fff) + (m_bank * 0x4000)]; |
| 134 | | else |
| 135 | | return m_rom[(offset & 0x3fff) + ((m_bank_mask + 1) * 0x4000)]; // last bank |
| 136 | | } |
| 137 | | |
| 138 | | WRITE8_MEMBER(a78_versapokey_device::write_40xx) |
| 139 | | { |
| 140 | | if (offset >= 0x4000 && offset < 0x8000) |
| 141 | | m_bank = (data & m_bank_mask) + 1; |
| 142 | | } |
| 143 | | |
| 144 | | |
| 145 | 103 | // MegaCart+ |
| 146 | 104 | |
| 147 | 105 | WRITE8_MEMBER(a78_megacart_device::write_40xx) |
| r32084 | r32085 | |
| 156 | 114 | } |
| 157 | 115 | } |
| 158 | 116 | |
| 117 | |
| 118 | // VersaBoard + POKEY @ 0x0450 |
| 119 | |
| 120 | static MACHINE_CONFIG_FRAGMENT( a78_pokeyvb ) |
| 121 | MCFG_SPEAKER_STANDARD_MONO("addon") |
| 122 | |
| 123 | MCFG_SOUND_ADD("pokey450", POKEY, XTAL_14_31818MHz/8) |
| 124 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00) |
| 125 | MACHINE_CONFIG_END |
| 126 | |
| 127 | machine_config_constructor a78_rom_p450_vb_device::device_mconfig_additions() const |
| 128 | { |
| 129 | return MACHINE_CONFIG_NAME( a78_pokeyvb ); |
| 130 | } |
| 131 | |
| 132 | |
trunk/src/emu/bus/a7800/rom.h
| r32084 | r32085 | |
| 30 | 30 | { |
| 31 | 31 | public: |
| 32 | 32 | // construction/destruction |
| 33 | a78_rom_pokey_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 33 | 34 | a78_rom_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 34 | 35 | |
| 35 | 36 | // device-level overrides |
| r32084 | r32085 | |
| 92 | 93 | { |
| 93 | 94 | public: |
| 94 | 95 | // construction/destruction |
| 96 | a78_rom_sg_ram_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 95 | 97 | a78_rom_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 96 | 98 | |
| 97 | 99 | // reading and writing |
| r32084 | r32085 | |
| 115 | 117 | }; |
| 116 | 118 | |
| 117 | 119 | |
| 118 | | // ======================> a78_rom_sg9_pokey_device |
| 120 | // ======================> a78_rom_abs_device |
| 119 | 121 | |
| 120 | | class a78_rom_sg9_pokey_device : public a78_rom_sg9_device |
| 122 | class a78_rom_abs_device : public a78_rom_device |
| 121 | 123 | { |
| 122 | 124 | public: |
| 123 | 125 | // construction/destruction |
| 124 | | a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 126 | a78_rom_abs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 125 | 127 | |
| 126 | 128 | // device-level overrides |
| 127 | | virtual machine_config_constructor device_mconfig_additions() const; |
| 129 | virtual void device_start(); |
| 130 | virtual void device_reset(); |
| 128 | 131 | |
| 129 | 132 | // reading and writing |
| 133 | virtual DECLARE_READ8_MEMBER(read_40xx); |
| 130 | 134 | virtual DECLARE_WRITE8_MEMBER(write_40xx); |
| 131 | 135 | |
| 132 | 136 | protected: |
| 133 | | required_device<pokey_device> m_pokey; |
| 137 | int m_bank; |
| 134 | 138 | }; |
| 135 | 139 | |
| 136 | 140 | |
| 137 | | // ======================> a78_rom_abs_device |
| 141 | // ======================> a78_rom_act_device |
| 138 | 142 | |
| 139 | | class a78_rom_abs_device : public a78_rom_device |
| 143 | class a78_rom_act_device : public a78_rom_device |
| 140 | 144 | { |
| 141 | 145 | public: |
| 142 | 146 | // construction/destruction |
| 143 | | a78_rom_abs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 147 | a78_rom_act_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 144 | 148 | |
| 145 | 149 | // device-level overrides |
| 146 | 150 | virtual void device_start(); |
| r32084 | r32085 | |
| 155 | 159 | }; |
| 156 | 160 | |
| 157 | 161 | |
| 158 | | // ======================> a78_rom_act_device |
| 162 | // PCB variants with a POKEY at $0450 |
| 159 | 163 | |
| 160 | | class a78_rom_act_device : public a78_rom_device |
| 164 | // ======================> a78_rom_p450_device |
| 165 | |
| 166 | class a78_rom_p450_device : public a78_rom_device |
| 161 | 167 | { |
| 162 | 168 | public: |
| 163 | 169 | // construction/destruction |
| 164 | | a78_rom_act_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 170 | a78_rom_p450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 165 | 171 | |
| 166 | | // device-level overrides |
| 167 | | virtual void device_start(); |
| 168 | | virtual void device_reset(); |
| 172 | virtual machine_config_constructor device_mconfig_additions() const; |
| 169 | 173 | |
| 170 | 174 | // reading and writing |
| 171 | | virtual DECLARE_READ8_MEMBER(read_40xx); |
| 172 | | virtual DECLARE_WRITE8_MEMBER(write_40xx); |
| 175 | virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; } |
| 176 | virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); } |
| 173 | 177 | |
| 174 | 178 | protected: |
| 175 | | int m_bank; |
| 179 | required_device<pokey_device> m_pokey450; |
| 176 | 180 | }; |
| 177 | 181 | |
| 178 | 182 | |
| 183 | // ======================> a78_rom_p450_pokey_device |
| 184 | |
| 185 | class a78_rom_p450_pokey_device : public a78_rom_pokey_device |
| 186 | { |
| 187 | public: |
| 188 | // construction/destruction |
| 189 | a78_rom_p450_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 190 | |
| 191 | virtual machine_config_constructor device_mconfig_additions() const; |
| 192 | |
| 193 | // reading and writing |
| 194 | virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; } |
| 195 | virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); } |
| 196 | |
| 197 | protected: |
| 198 | required_device<pokey_device> m_pokey450; |
| 199 | }; |
| 200 | |
| 201 | |
| 202 | // ======================> a78_rom_p450_sg_ram_device |
| 203 | |
| 204 | class a78_rom_p450_sg_ram_device : public a78_rom_sg_ram_device |
| 205 | { |
| 206 | public: |
| 207 | // construction/destruction |
| 208 | a78_rom_p450_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 209 | |
| 210 | virtual machine_config_constructor device_mconfig_additions() const; |
| 211 | |
| 212 | // reading and writing |
| 213 | virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; } |
| 214 | virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); } |
| 215 | |
| 216 | protected: |
| 217 | required_device<pokey_device> m_pokey450; |
| 218 | }; |
| 219 | |
| 220 | |
| 221 | // ======================> a78_rom_p450_sg9_device |
| 222 | |
| 223 | class a78_rom_p450_sg9_device : public a78_rom_sg9_device |
| 224 | { |
| 225 | public: |
| 226 | // construction/destruction |
| 227 | a78_rom_p450_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 228 | |
| 229 | virtual machine_config_constructor device_mconfig_additions() const; |
| 230 | |
| 231 | // reading and writing |
| 232 | virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; } |
| 233 | virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); } |
| 234 | |
| 235 | protected: |
| 236 | required_device<pokey_device> m_pokey450; |
| 237 | }; |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 179 | 243 | // device type definition |
| 180 | 244 | extern const device_type A78_ROM; |
| 181 | 245 | extern const device_type A78_ROM_SG; |
| r32084 | r32085 | |
| 183 | 247 | extern const device_type A78_ROM_SG_POKEY; |
| 184 | 248 | extern const device_type A78_ROM_SG_RAM; |
| 185 | 249 | extern const device_type A78_ROM_SG9; |
| 186 | | extern const device_type A78_ROM_SG9_POKEY; |
| 187 | 250 | extern const device_type A78_ROM_ABSOLUTE; |
| 188 | 251 | extern const device_type A78_ROM_ACTIVISION; |
| 189 | 252 | |
| 253 | // PCB variants with a POKEY at $0450 |
| 254 | extern const device_type A78_ROM_P450; |
| 255 | extern const device_type A78_ROM_P450_POKEY; |
| 256 | extern const device_type A78_ROM_P450_SG_RAM; |
| 257 | extern const device_type A78_ROM_P450_SG9; |
| 190 | 258 | |
| 191 | 259 | #endif |
trunk/src/emu/bus/a7800/cpuwiz.h
| r32084 | r32085 | |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | 29 | |
| 30 | | // ======================> a78_versapokey_device |
| 30 | // ======================> a78_megacart_device |
| 31 | 31 | |
| 32 | | class a78_versapokey_device : public a78_versaboard_device |
| 32 | class a78_megacart_device : public a78_versaboard_device |
| 33 | 33 | { |
| 34 | 34 | public: |
| 35 | 35 | // construction/destruction |
| 36 | | a78_versapokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 36 | a78_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 37 | 37 | |
| 38 | | // device-level overrides |
| 39 | | virtual machine_config_constructor device_mconfig_additions() const; |
| 40 | | |
| 41 | 38 | // reading and writing |
| 42 | | virtual DECLARE_READ8_MEMBER(read_04xx); |
| 43 | | virtual DECLARE_WRITE8_MEMBER(write_04xx); |
| 44 | | virtual DECLARE_READ8_MEMBER(read_40xx); |
| 45 | 39 | virtual DECLARE_WRITE8_MEMBER(write_40xx); |
| 46 | | |
| 47 | | protected: |
| 48 | | required_device<pokey_device> m_pokey; |
| 49 | 40 | }; |
| 50 | 41 | |
| 51 | 42 | |
| 52 | | // ======================> a78_megacart_device |
| 43 | // VersaBoard variants of the standard carts + POKEY at 0x0450! |
| 53 | 44 | |
| 54 | | class a78_megacart_device : public a78_versaboard_device |
| 45 | // ======================> a78_rom_p450_vb_device |
| 46 | |
| 47 | class a78_rom_p450_vb_device : public a78_versaboard_device |
| 55 | 48 | { |
| 56 | 49 | public: |
| 57 | 50 | // construction/destruction |
| 58 | | a78_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 51 | a78_rom_p450_vb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 59 | 52 | |
| 53 | // device-level overrides |
| 54 | virtual machine_config_constructor device_mconfig_additions() const; |
| 55 | |
| 60 | 56 | // reading and writing |
| 61 | | virtual DECLARE_WRITE8_MEMBER(write_40xx); |
| 57 | virtual DECLARE_READ8_MEMBER(read_04xx) { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; } |
| 58 | virtual DECLARE_WRITE8_MEMBER(write_04xx) { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); } |
| 59 | |
| 60 | protected: |
| 61 | required_device<pokey_device> m_pokey450; |
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | // device type definition |
| 67 | 67 | extern const device_type A78_ROM_VERSABOARD; |
| 68 | | extern const device_type A78_ROM_VERSAPOKEY; |
| 69 | 68 | extern const device_type A78_ROM_MEGACART; |
| 70 | 69 | |
| 70 | extern const device_type A78_ROM_P450_VB; |
| 71 | 71 | |
| 72 | 72 | #endif |