trunk/src/emu/bus/a7800/a78_carts.h
| r31942 | r31943 | |
| 1 | 1 | #ifndef __A78_CARTS_H |
| 2 | 2 | #define __A78_CARTS_H |
| 3 | 3 | |
| 4 | | |
| 5 | 4 | #include "emu.h" |
| 6 | 5 | |
| 7 | 6 | #include "rom.h" |
| 8 | 7 | #include "xboard.h" |
| 9 | 8 | #include "hiscore.h" |
| 9 | #include "cpuwiz.h" |
| 10 | 10 | |
| 11 | 11 | static SLOT_INTERFACE_START(a7800_cart) |
| 12 | 12 | SLOT_INTERFACE_INTERNAL("a78_rom", A78_ROM) |
| r31942 | r31943 | |
| 14 | 14 | SLOT_INTERFACE_INTERNAL("a78_sg", A78_ROM_SG) |
| 15 | 15 | SLOT_INTERFACE_INTERNAL("a78_sg_pokey", A78_ROM_SG_POKEY) |
| 16 | 16 | SLOT_INTERFACE_INTERNAL("a78_sg_ram", A78_ROM_SG_RAM) |
| 17 | | // not sure which dev cart support banked ram, nor whether there shall be a 9banks or a non-sg version of this... |
| 18 | | SLOT_INTERFACE_INTERNAL("a78_bankram", A78_ROM_BANKRAM) |
| 19 | | SLOT_INTERFACE_INTERNAL("a78_sg9", A78_ROM_SG_9BANKS) |
| 20 | | SLOT_INTERFACE_INTERNAL("a78_xmc", A78_ROM_XM) // carts compatible with the expansions below (basically a 9Banks+POKEY) |
| 17 | SLOT_INTERFACE_INTERNAL("a78_sg9", A78_ROM_SG9) |
| 18 | SLOT_INTERFACE_INTERNAL("a78_sg9_pokey",A78_ROM_SG9_POKEY) // carts compatible with the expansions below (basically a 9Banks+POKEY) |
| 21 | 19 | SLOT_INTERFACE_INTERNAL("a78_abs", A78_ROM_ABSOLUTE) |
| 22 | 20 | SLOT_INTERFACE_INTERNAL("a78_act", A78_ROM_ACTIVISION) |
| 23 | 21 | SLOT_INTERFACE_INTERNAL("a78_hsc", A78_HISCORE) |
| 24 | 22 | SLOT_INTERFACE_INTERNAL("a78_xboard", A78_XBOARD) // the actual XBoarD expansion (as passthru) |
| 25 | 23 | SLOT_INTERFACE_INTERNAL("a78_xm", A78_XM) // the actual XM expansion (as passthru) |
| 24 | SLOT_INTERFACE_INTERNAL("a78_megacart", A78_ROM_MEGACART) |
| 25 | SLOT_INTERFACE_INTERNAL("a78_versa", A78_ROM_VERSABOARD) |
| 26 | SLOT_INTERFACE_INTERNAL("a78_versap", A78_ROM_VERSAPOKEY) // For debugging purposes |
| 26 | 27 | SLOT_INTERFACE_END |
| 27 | 28 | |
| 28 | 29 | |
trunk/src/emu/bus/a7800/a78_slot.c
| r31942 | r31943 | |
| 170 | 170 | // Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it |
| 171 | 171 | static const a78_slot slot_list[] = |
| 172 | 172 | { |
| 173 | | { A78_TYPE0, "a78_rom" }, |
| 174 | | { A78_TYPE1, "a78_pokey" }, |
| 175 | | { A78_TYPE2, "a78_sg" }, |
| 176 | | { A78_TYPE3, "a78_sg_pokey" }, |
| 177 | | { A78_TYPE6, "a78_sg_ram" }, |
| 178 | | { A78_TYPEA, "a78_sg9" }, |
| 179 | | { A78_TYPEB, "a78_xmc" }, |
| 180 | | { A78_ABSOLUTE, "a78_abs" }, |
| 173 | { A78_TYPE0, "a78_rom" }, |
| 174 | { A78_TYPE1, "a78_pokey" }, |
| 175 | { A78_TYPE2, "a78_sg" }, |
| 176 | { A78_TYPE3, "a78_sg_pokey" }, |
| 177 | { A78_TYPE6, "a78_sg_ram" }, |
| 178 | { A78_TYPEA, "a78_sg9" }, |
| 179 | { A78_TYPEB, "a78_sg9_pokey" }, |
| 180 | { A78_ABSOLUTE, "a78_abs" }, |
| 181 | 181 | { A78_ACTIVISION, "a78_act" }, |
| 182 | | { A78_HSC, "a78_hsc" }, |
| 183 | | { A78_BANKRAM, "a78_bankram" }, |
| 184 | | { A78_XB_BOARD, "a78_xboard" }, |
| 185 | | { A78_XM_BOARD, "a78_xm" }, |
| 186 | | { A78_NOCART, "empty" }, |
| 182 | { A78_HSC, "a78_hsc" }, |
| 183 | { A78_XB_BOARD, "a78_xboard" }, |
| 184 | { A78_XM_BOARD, "a78_xm" }, |
| 185 | { A78_MEGACART, "a78_megacart" }, |
| 186 | { A78_VERSABOARD, "a78_versa" }, |
| 187 | { A78_VERSAPOKEY, "a78_versap" }, |
| 188 | { A78_NOCART, "empty" }, // the code should never get here, of course... |
| 187 | 189 | }; |
| 188 | 190 | |
| 189 | 191 | static int a78_get_pcb_id(const char *slot) |
| r31942 | r31943 | |
| 269 | 271 | m_type = A78_TYPEB; |
| 270 | 272 | break; |
| 271 | 273 | case 0x0020: |
| 272 | | m_type = A78_BANKRAM; |
| 274 | if (len > 0x40000) |
| 275 | m_type = A78_MEGACART; |
| 276 | else |
| 277 | m_type = A78_VERSABOARD; |
| 273 | 278 | break; |
| 279 | case 0x0021: |
| 280 | m_type = A78_VERSAPOKEY; |
| 281 | break; |
| 274 | 282 | case 0x0100: |
| 275 | 283 | m_type = A78_ACTIVISION; |
| 276 | 284 | break; |
| r31942 | r31943 | |
| 291 | 299 | |
| 292 | 300 | if (m_type == A78_TYPE6) |
| 293 | 301 | m_cart->ram_alloc(0x4000); |
| 294 | | if (m_type == A78_BANKRAM) |
| 302 | if (m_type == A78_MEGACART || m_type == A78_VERSABOARD || m_type == A78_VERSAPOKEY) |
| 295 | 303 | m_cart->ram_alloc(0x8000); |
| 296 | 304 | if (m_type == A78_XB_BOARD || m_type == A78_XM_BOARD) |
| 297 | 305 | m_cart->ram_alloc(0x20000); |
| r31942 | r31943 | |
| 394 | 402 | type = A78_TYPEB; |
| 395 | 403 | break; |
| 396 | 404 | case 0x0020: |
| 397 | | m_type = A78_BANKRAM; |
| 405 | if (core_fsize(m_file) > 0x40000) |
| 406 | type = A78_MEGACART; |
| 407 | else |
| 408 | type = A78_VERSABOARD; |
| 398 | 409 | break; |
| 410 | case 0x0021: |
| 411 | type = A78_VERSAPOKEY; |
| 412 | break; |
| 399 | 413 | case 0x0100: |
| 400 | 414 | type = A78_ACTIVISION; |
| 401 | 415 | break; |
trunk/src/emu/bus/a7800/rom.h
| r31942 | r31943 | |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | 100 | |
| 101 | | // ======================> a78_rom_bankram_device |
| 101 | // ======================> a78_rom_sg9_device |
| 102 | 102 | |
| 103 | | class a78_rom_bankram_device : public a78_rom_sg_device |
| 103 | class a78_rom_sg9_device : public a78_rom_sg_device |
| 104 | 104 | { |
| 105 | 105 | public: |
| 106 | 106 | // construction/destruction |
| 107 | | a78_rom_bankram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 107 | a78_rom_sg9_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); |
| 108 | a78_rom_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 108 | 109 | |
| 109 | | // device-level overrides |
| 110 | | virtual void device_start(); |
| 111 | | virtual void device_reset(); |
| 112 | | |
| 113 | 110 | // reading and writing |
| 114 | 111 | virtual DECLARE_READ8_MEMBER(read_40xx); |
| 115 | 112 | virtual DECLARE_WRITE8_MEMBER(write_40xx); |
| 116 | | |
| 117 | | protected: |
| 118 | | int m_ram_bank; |
| 119 | 113 | }; |
| 120 | 114 | |
| 121 | 115 | |
| 122 | | // ======================> a78_rom_sg_9banks_device |
| 116 | // ======================> a78_rom_sg9_pokey_device |
| 123 | 117 | |
| 124 | | class a78_rom_sg_9banks_device : public a78_rom_sg_device |
| 118 | class a78_rom_sg9_pokey_device : public a78_rom_sg9_device |
| 125 | 119 | { |
| 126 | 120 | public: |
| 127 | 121 | // construction/destruction |
| 128 | | a78_rom_sg_9banks_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); |
| 129 | | a78_rom_sg_9banks_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 122 | a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 130 | 123 | |
| 131 | | // reading and writing |
| 132 | | virtual DECLARE_READ8_MEMBER(read_40xx); |
| 133 | | virtual DECLARE_WRITE8_MEMBER(write_40xx); |
| 134 | | }; |
| 135 | | |
| 136 | | |
| 137 | | // ======================> a78_rom_xm_device |
| 138 | | |
| 139 | | class a78_rom_xm_device : public a78_rom_sg_9banks_device |
| 140 | | { |
| 141 | | public: |
| 142 | | // construction/destruction |
| 143 | | a78_rom_xm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 144 | | |
| 145 | 124 | // device-level overrides |
| 146 | 125 | virtual machine_config_constructor device_mconfig_additions() const; |
| 147 | 126 | |
| r31942 | r31943 | |
| 201 | 180 | extern const device_type A78_ROM_POKEY; |
| 202 | 181 | extern const device_type A78_ROM_SG_POKEY; |
| 203 | 182 | extern const device_type A78_ROM_SG_RAM; |
| 204 | | extern const device_type A78_ROM_BANKRAM; |
| 205 | | extern const device_type A78_ROM_SG_9BANKS; |
| 206 | | extern const device_type A78_ROM_XM; |
| 183 | extern const device_type A78_ROM_SG9; |
| 184 | extern const device_type A78_ROM_SG9_POKEY; |
| 207 | 185 | extern const device_type A78_ROM_ABSOLUTE; |
| 208 | 186 | extern const device_type A78_ROM_ACTIVISION; |
| 209 | 187 | |
trunk/src/emu/bus/a7800/a78_slot.h
| r31942 | r31943 | |
| 16 | 16 | A78_TYPE3, // as TYPE1 + POKEY chip on the PCB |
| 17 | 17 | A78_TYPE6, // as TYPE1 + RAM IC on the PCB |
| 18 | 18 | A78_TYPEA, // Alien Brigade, Crossbow (9x16K banks with diff bankswitch) |
| 19 | A78_TYPEB, // Cart exploiting the XB board, but possibly also compatible with non-expanded A7800 |
| 19 | 20 | A78_ABSOLUTE, // F18 Hornet |
| 20 | 21 | A78_ACTIVISION, // Double Dragon, Rampage |
| 21 | 22 | A78_HSC, // Atari HighScore cart |
| 22 | | A78_BANKRAM, // SuperGame + 32K RAM banked (untested) |
| 23 | 23 | A78_XB_BOARD, // A7800 Expansion Board (it shall more or less apply to the Expansion Module too, but this is not officially released yet) |
| 24 | 24 | A78_XM_BOARD, // A7800 XM Expansion Module (theoretical specs only, since this is not officially released yet) |
| 25 | | A78_TYPEB, // Cart exploiting the XB board, but possibly also compatible with non-expanded A7800 |
| 25 | A78_MEGACART, // Homebrew by CPUWIZ, consists of SuperGame bank up to 512K + 32K RAM banked |
| 26 | A78_VERSABOARD, // Homebrew by CPUWIZ, consists of SuperGame bank up to 256K + 32K RAM banked |
| 27 | A78_VERSAPOKEY, // For debugging purpose, same as VersaBoard + SG 9 Banks + POKEY at 0x0450 |
| 26 | 28 | A78_NOCART |
| 27 | 29 | }; |
| 28 | 30 | |
trunk/src/emu/bus/a7800/rom.c
| r31942 | r31943 | |
| 26 | 26 | const device_type A78_ROM_POKEY = &device_creator<a78_rom_pokey_device>; |
| 27 | 27 | const device_type A78_ROM_SG_POKEY = &device_creator<a78_rom_sg_pokey_device>; |
| 28 | 28 | const device_type A78_ROM_SG_RAM = &device_creator<a78_rom_sg_ram_device>; |
| 29 | | const device_type A78_ROM_BANKRAM = &device_creator<a78_rom_bankram_device>; |
| 30 | | const device_type A78_ROM_SG_9BANKS = &device_creator<a78_rom_sg_9banks_device>; |
| 31 | | const device_type A78_ROM_XM = &device_creator<a78_rom_xm_device>; |
| 29 | const device_type A78_ROM_SG9 = &device_creator<a78_rom_sg9_device>; |
| 30 | const device_type A78_ROM_SG9_POKEY = &device_creator<a78_rom_sg9_pokey_device>; |
| 32 | 31 | const device_type A78_ROM_ABSOLUTE = &device_creator<a78_rom_abs_device>; |
| 33 | 32 | const device_type A78_ROM_ACTIVISION = &device_creator<a78_rom_act_device>; |
| 34 | 33 | |
| r31942 | r31943 | |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | |
| 78 | | a78_rom_bankram_device::a78_rom_bankram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 79 | | : a78_rom_sg_device(mconfig, A78_ROM_BANKRAM, "Atari 7800 ROM Carts w/SuperGame Bankswitch + Banked RAM", tag, owner, clock, "a78_rom_bankram", __FILE__) |
| 80 | | { |
| 81 | | } |
| 82 | | |
| 83 | | |
| 84 | | a78_rom_sg_9banks_device::a78_rom_sg_9banks_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) |
| 77 | a78_rom_sg9_device::a78_rom_sg9_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) |
| 85 | 78 | : a78_rom_sg_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 86 | 79 | { |
| 87 | 80 | } |
| 88 | 81 | |
| 89 | | a78_rom_sg_9banks_device::a78_rom_sg_9banks_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 90 | | : a78_rom_sg_device(mconfig, A78_ROM_SG_9BANKS, "Atari 7800 ROM Carts w/SuperGame 9Banks", tag, owner, clock, "a78_rom_sg9", __FILE__) |
| 82 | a78_rom_sg9_device::a78_rom_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 83 | : a78_rom_sg_device(mconfig, A78_ROM_SG9, "Atari 7800 ROM Carts w/SuperGame 9Banks", tag, owner, clock, "a78_rom_sg9", __FILE__) |
| 91 | 84 | { |
| 92 | 85 | } |
| 93 | 86 | |
| 94 | 87 | |
| 95 | | a78_rom_xm_device::a78_rom_xm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 96 | | : a78_rom_sg_9banks_device(mconfig, A78_ROM_XM, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY (XM demo)", tag, owner, clock, "a78_rom_xm", __FILE__), |
| 88 | a78_rom_sg9_pokey_device::a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 89 | : a78_rom_sg9_device(mconfig, A78_ROM_SG9_POKEY, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY", tag, owner, clock, "a78_rom_sg9p", __FILE__), |
| 97 | 90 | m_pokey(*this, "pokey") |
| 98 | 91 | { |
| 99 | 92 | } |
| r31942 | r31943 | |
| 130 | 123 | m_bank = 0; |
| 131 | 124 | } |
| 132 | 125 | |
| 133 | | void a78_rom_bankram_device::device_start() |
| 134 | | { |
| 135 | | save_item(NAME(m_bank)); |
| 136 | | save_item(NAME(m_ram_bank)); |
| 137 | | } |
| 138 | | |
| 139 | | void a78_rom_bankram_device::device_reset() |
| 140 | | { |
| 141 | | m_bank = 0; |
| 142 | | m_ram_bank = 0; |
| 143 | | } |
| 144 | | |
| 145 | 126 | void a78_rom_abs_device::device_start() |
| 146 | 127 | { |
| 147 | 128 | save_item(NAME(m_bank)); |
| r31942 | r31943 | |
| 301 | 282 | |
| 302 | 283 | |
| 303 | 284 | /*------------------------------------------------- |
| 304 | | |
| 305 | | Carts with SuperGame bankswitch + 32K RAM: |
| 306 | | RAM bank is selected by writing with bit5 enabled |
| 307 | | in 0x4000-0x7fff range (bit0-bit4 give the ROM bank) |
| 308 | | |
| 309 | | GAMES: |
| 310 | | |
| 311 | | -------------------------------------------------*/ |
| 312 | 285 | |
| 313 | | READ8_MEMBER(a78_rom_bankram_device::read_40xx) |
| 314 | | { |
| 315 | | if (offset < 0x4000) |
| 316 | | return m_ram[offset + (m_ram_bank * 0x4000)]; |
| 317 | | else if (offset < 0x8000) |
| 318 | | return m_rom[(offset & 0x3fff) + (m_bank * 0x4000)]; |
| 319 | | else |
| 320 | | return m_rom[(offset & 0x3fff) + (m_bank_mask * 0x4000)]; // last bank |
| 321 | | } |
| 322 | | |
| 323 | | WRITE8_MEMBER(a78_rom_bankram_device::write_40xx) |
| 324 | | { |
| 325 | | if (offset < 0x4000) |
| 326 | | m_ram[offset] = data; |
| 327 | | else if (offset < 0x8000) |
| 328 | | { |
| 329 | | m_bank = data & m_bank_mask; |
| 330 | | m_ram_bank = BIT(data, 5); |
| 331 | | } |
| 332 | | } |
| 333 | | |
| 334 | | |
| 335 | | /*------------------------------------------------- |
| 336 | | |
| 337 | 286 | Carts with SuperGame bankswitch 9banks: |
| 338 | 287 | 9 x 16K banks mappable in 0x8000-0xbfff |
| 339 | 288 | bank 7 is always mapped in 0xc000-0xffff |
| r31942 | r31943 | |
| 342 | 291 | |
| 343 | 292 | -------------------------------------------------*/ |
| 344 | 293 | |
| 345 | | READ8_MEMBER(a78_rom_sg_9banks_device::read_40xx) |
| 294 | READ8_MEMBER(a78_rom_sg9_device::read_40xx) |
| 346 | 295 | { |
| 347 | 296 | if (offset < 0x4000) |
| 348 | 297 | return m_rom[(offset & 0x3fff)]; |
| r31942 | r31943 | |
| 352 | 301 | return m_rom[(offset & 0x3fff) + ((m_bank_mask + 1) * 0x4000)]; // last bank |
| 353 | 302 | } |
| 354 | 303 | |
| 355 | | WRITE8_MEMBER(a78_rom_sg_9banks_device::write_40xx) |
| 304 | WRITE8_MEMBER(a78_rom_sg9_device::write_40xx) |
| 356 | 305 | { |
| 357 | 306 | if (offset >= 0x4000 && offset < 0x8000) |
| 358 | 307 | m_bank = (data & m_bank_mask) + 1; |
| r31942 | r31943 | |
| 360 | 309 | |
| 361 | 310 | /*------------------------------------------------- |
| 362 | 311 | |
| 363 | | Carts using XM expansion module or XBoarD expansion |
| 364 | | The only game using this (Donkey Kong XM demo) is |
| 365 | | 144K + POKEY, so that it's like the above with the |
| 366 | | addition of the POKEY. |
| 312 | Carts with SuperGame bankswitch 9banks + POKEY: |
| 313 | This was not used in any commercial game released |
| 314 | during A7800 lifespan, but it is used by Donkey |
| 315 | Kong XM demo and by Bentley Bear's Crystal Quest |
| 316 | for use with XM expansion module or XBoarD expansion |
| 367 | 317 | |
| 368 | | GAMES: Donkey Kong XM demo |
| 318 | GAMES: Donkey Kong XM demo, Bentley Bear's Crystal |
| 319 | Quest |
| 369 | 320 | |
| 370 | 321 | -------------------------------------------------*/ |
| 371 | 322 | |
| 372 | | WRITE8_MEMBER(a78_rom_xm_device::write_40xx) |
| 323 | WRITE8_MEMBER(a78_rom_sg9_pokey_device::write_40xx) |
| 373 | 324 | { |
| 374 | 325 | if (offset < 0x4000) |
| 326 | { |
| 327 | printf("write offs 0x%X data 0x%X\n", offset, data); |
| 375 | 328 | m_pokey->write(space, offset & 0x0f, data); |
| 329 | } |
| 376 | 330 | else if (offset < 0x8000) |
| 377 | 331 | m_bank = (data & m_bank_mask) + 1; |
| 378 | 332 | } |
| 379 | 333 | |
| 380 | | machine_config_constructor a78_rom_xm_device::device_mconfig_additions() const |
| 334 | machine_config_constructor a78_rom_sg9_pokey_device::device_mconfig_additions() const |
| 381 | 335 | { |
| 382 | 336 | return MACHINE_CONFIG_NAME( a78_pokey ); |
| 383 | 337 | } |