src/mess/machine/c64_super_explode.h
| r0 | r14396 | |
| 1 | /**********************************************************************
|
| 2 | |
| 3 | Super Explode! cartridge emulation
|
| 4 | |
| 5 | Copyright MESS Team.
|
| 6 | Visit http://mamedev.org for licensing and usage restrictions.
|
| 7 | |
| 8 | **********************************************************************/
|
| 9 | |
| 10 | #pragma once
|
| 11 | |
| 12 | #ifndef __SUPER_EXPLODE__
|
| 13 | #define __SUPER_EXPLODE__
|
| 14 | |
| 15 | #define ADDRESS_MAP_MODERN
|
| 16 | |
| 17 | #include "emu.h"
|
| 18 | #include "machine/c64exp.h"
|
| 19 | |
| 20 | |
| 21 | |
| 22 | //**************************************************************************
|
| 23 | // TYPE DEFINITIONS
|
| 24 | //**************************************************************************
|
| 25 | |
| 26 | // ======================> c64_super_explode_cartridge_device
|
| 27 | |
| 28 | class c64_super_explode_cartridge_device : public device_t,
|
| 29 | public device_c64_expansion_card_interface
|
| 30 | {
|
| 31 | public:
|
| 32 | // construction/destruction
|
| 33 | c64_super_explode_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
| 34 | |
| 35 | protected:
|
| 36 | // device-level overrides
|
| 37 | virtual void device_start();
|
| 38 | virtual void device_reset();
|
| 39 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
| 40 | |
| 41 | // device_c64_expansion_card_interface overrides
|
| 42 | virtual UINT8 c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2);
|
| 43 | virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2);
|
| 44 | |
| 45 | private:
|
| 46 | UINT8 m_bank;
|
| 47 | |
| 48 | emu_timer *m_exrom_timer;
|
| 49 | };
|
| 50 | |
| 51 | |
| 52 | // device type definition
|
| 53 | extern const device_type C64_SUPER_EXPLODE;
|
| 54 | |
| 55 | |
| 56 | #endif
|
src/mess/machine/c64_vw64.c
| r14395 | r14396 | |
| 45 | 45 | #define UNSCRAMBLE_DATA(_data) \
|
| 46 | 46 | BITSWAP8(_data,7,6,0,5,1,4,2,3)
|
| 47 | 47 | |
| 48 |
|
| 49 | // 74LS122 tW=0.45*R*C = 1.1844s
|
| 50 | #define TIMER_PERIOD 1184
|
| 48 | 51 | |
| 49 | 52 | |
| 53 | |
| 50 | 54 | //**************************************************************************
|
| 51 | 55 | // DEVICE DEFINITIONS
|
| 52 | 56 | //**************************************************************************
|
| r14395 | r14396 | |
| 76 | 80 | |
| 77 | 81 | void c64_vizawrite_cartridge_device::device_start()
|
| 78 | 82 | {
|
| 83 | // allocate timer
|
| 79 | 84 | m_game_timer = timer_alloc();
|
| 80 | 85 | }
|
| 81 | 86 | |
| r14395 | r14396 | |
| 88 | 93 | {
|
| 89 | 94 | m_game = 0;
|
| 90 | 95 |
|
| 91 | | // 74LS122 tW=0.45*R*C = 1.1844s
|
| 92 | | m_game_timer->adjust(attotime::from_msec(1184), 0);
|
| 96 | |
| 97 | m_game_timer->adjust(attotime::from_msec(TIMER_PERIOD), 0);
|
| 93 | 98 | }
|
| 94 | 99 | |
| 95 | 100 | |
src/mess/machine/c64_super_explode.c
| r0 | r14396 | |
| 1 | /**********************************************************************
|
| 2 | |
| 3 | Super Explode! cartridge emulation
|
| 4 | |
| 5 | Copyright MESS Team.
|
| 6 | Visit http://mamedev.org for licensing and usage restrictions.
|
| 7 | |
| 8 | **********************************************************************/
|
| 9 | |
| 10 | #include "c64_super_explode.h"
|
| 11 | |
| 12 | |
| 13 | |
| 14 | //**************************************************************************
|
| 15 | // MACROS/CONSTANTS
|
| 16 | //**************************************************************************
|
| 17 | |
| 18 | // t = R*C = 3.3K * 0.47uF * 40% Vtr = 792.2905424610516 usec
|
| 19 | // (3.3K pull-up on the EXROM line inside the C64, PLA Vih min = 2.0V = 40% of 5.0V)
|
| 20 | #define TIMER_PERIOD 792
|
| 21 | |
| 22 | |
| 23 | |
| 24 | //**************************************************************************
|
| 25 | // DEVICE DEFINITIONS
|
| 26 | //**************************************************************************
|
| 27 | |
| 28 | const device_type C64_SUPER_EXPLODE = &device_creator<c64_super_explode_cartridge_device>;
|
| 29 | |
| 30 | |
| 31 | |
| 32 | //**************************************************************************
|
| 33 | // LIVE DEVICE
|
| 34 | //**************************************************************************
|
| 35 | |
| 36 | //-------------------------------------------------
|
| 37 | // c64_super_explode_cartridge_device - constructor
|
| 38 | //-------------------------------------------------
|
| 39 | |
| 40 | c64_super_explode_cartridge_device::c64_super_explode_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
| 41 | device_t(mconfig, C64_SUPER_EXPLODE, "C64 Super Explode! cartridge", tag, owner, clock),
|
| 42 | device_c64_expansion_card_interface(mconfig, *this)
|
| 43 | {
|
| 44 | }
|
| 45 | |
| 46 | |
| 47 | //-------------------------------------------------
|
| 48 | // device_start - device-specific startup
|
| 49 | //-------------------------------------------------
|
| 50 | |
| 51 | void c64_super_explode_cartridge_device::device_start()
|
| 52 | {
|
| 53 | // allocate timer
|
| 54 | m_exrom_timer = timer_alloc();
|
| 55 | |
| 56 | // state saving
|
| 57 | save_item(NAME(m_bank));
|
| 58 | }
|
| 59 | |
| 60 | |
| 61 | //-------------------------------------------------
|
| 62 | // device_reset - device-specific reset
|
| 63 | //-------------------------------------------------
|
| 64 | |
| 65 | void c64_super_explode_cartridge_device::device_reset()
|
| 66 | {
|
| 67 | m_bank = 0;
|
| 68 | |
| 69 | m_exrom = 0;
|
| 70 | m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
|
| 71 | }
|
| 72 | |
| 73 | |
| 74 | //-------------------------------------------------
|
| 75 | // device_timer - handler timer events
|
| 76 | //-------------------------------------------------
|
| 77 | |
| 78 | void c64_super_explode_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
| 79 | {
|
| 80 | m_exrom = 1;
|
| 81 | }
|
| 82 | |
| 83 | |
| 84 | //-------------------------------------------------
|
| 85 | // c64_cd_r - cartridge data read
|
| 86 | //-------------------------------------------------
|
| 87 | |
| 88 | UINT8 c64_super_explode_cartridge_device::c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2)
|
| 89 | {
|
| 90 | UINT8 data = 0;
|
| 91 |
|
| 92 | if (!roml)
|
| 93 | {
|
| 94 | m_exrom = 0;
|
| 95 | m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
|
| 96 | |
| 97 | data = m_roml[(m_bank << 13) | (offset & 0x1fff)];
|
| 98 | }
|
| 99 | else if (!io1)
|
| 100 | {
|
| 101 | m_exrom = 0;
|
| 102 | m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
|
| 103 | }
|
| 104 | else if (!io2)
|
| 105 | {
|
| 106 | data = m_roml[offset & 0x1fff];
|
| 107 | }
|
| 108 | |
| 109 | return data;
|
| 110 | }
|
| 111 | |
| 112 | |
| 113 | //-------------------------------------------------
|
| 114 | // c64_cd_w - cartridge data write
|
| 115 | //-------------------------------------------------
|
| 116 | |
| 117 | void c64_super_explode_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2)
|
| 118 | {
|
| 119 | if (!io1)
|
| 120 | {
|
| 121 | m_exrom = 0;
|
| 122 | m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
|
| 123 | }
|
| 124 | else if (!io2)
|
| 125 | {
|
| 126 | m_bank = BIT(data, 7);
|
| 127 | }
|
| 128 | }
|