trunk/src/mess/machine/c64_fcc.c
| r0 | r20111 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Tasc Final ChessCard cartridge emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "c64_fcc.h" |
| 11 | |
| 12 | |
| 13 | |
| 14 | //************************************************************************** |
| 15 | // MACROS/CONSTANTS |
| 16 | //************************************************************************** |
| 17 | |
| 18 | #define G65SC02P4_TAG "g65sc02p4" |
| 19 | |
| 20 | |
| 21 | //************************************************************************** |
| 22 | // DEVICE DEFINITIONS |
| 23 | //************************************************************************** |
| 24 | |
| 25 | const device_type C64_FCC = &device_creator<c64_final_chesscard_device>; |
| 26 | |
| 27 | |
| 28 | //------------------------------------------------- |
| 29 | // ROM( c64_fcc ) |
| 30 | //------------------------------------------------- |
| 31 | |
| 32 | ROM_START( c64_fcc ) |
| 33 | ROM_REGION( 0x8000, G65SC02P4_TAG, 0 ) |
| 34 | ROM_LOAD( "fcc_rom1", 0x0000, 0x8000, CRC(2949836a) SHA1(9e6283095df9e3f4802ed0c654101f8e37168bf6) ) |
| 35 | ROM_END |
| 36 | |
| 37 | |
| 38 | //------------------------------------------------- |
| 39 | // rom_region - device-specific ROM region |
| 40 | //------------------------------------------------- |
| 41 | |
| 42 | const rom_entry *c64_final_chesscard_device::device_rom_region() const |
| 43 | { |
| 44 | return ROM_NAME( c64_fcc ); |
| 45 | } |
| 46 | |
| 47 | |
| 48 | //------------------------------------------------- |
| 49 | // ADDRESS_MAP( c64_fcc_map ) |
| 50 | //------------------------------------------------- |
| 51 | |
| 52 | static ADDRESS_MAP_START( c64_fcc_map, AS_PROGRAM, 8, c64_final_chesscard_device ) |
| 53 | AM_RANGE(0x0000, 0x7fff) AM_RAM |
| 54 | AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(G65SC02P4_TAG, 0) |
| 55 | ADDRESS_MAP_END |
| 56 | |
| 57 | |
| 58 | //------------------------------------------------- |
| 59 | // MACHINE_CONFIG_FRAGMENT( c64_fcc ) |
| 60 | //------------------------------------------------- |
| 61 | |
| 62 | static MACHINE_CONFIG_FRAGMENT( c64_fcc ) |
| 63 | MCFG_CPU_ADD(G65SC02P4_TAG, M65SC02, 5000000) |
| 64 | MCFG_CPU_PROGRAM_MAP(c64_fcc_map) |
| 65 | MACHINE_CONFIG_END |
| 66 | |
| 67 | |
| 68 | //------------------------------------------------- |
| 69 | // machine_config_additions - device-specific |
| 70 | // machine configurations |
| 71 | //------------------------------------------------- |
| 72 | |
| 73 | machine_config_constructor c64_final_chesscard_device::device_mconfig_additions() const |
| 74 | { |
| 75 | return MACHINE_CONFIG_NAME( c64_fcc ); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | //------------------------------------------------- |
| 80 | // INPUT_PORTS( c64_fcc ) |
| 81 | //------------------------------------------------- |
| 82 | |
| 83 | INPUT_CHANGED_MEMBER( c64_final_chesscard_device::reset ) |
| 84 | { |
| 85 | if (!newval) |
| 86 | { |
| 87 | device_reset(); |
| 88 | } |
| 89 | |
| 90 | m_slot->reset_w(newval ? CLEAR_LINE : ASSERT_LINE); |
| 91 | } |
| 92 | |
| 93 | static INPUT_PORTS_START( c64_fcc ) |
| 94 | PORT_START("RESET") |
| 95 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_CHANGED_MEMBER(DEVICE_SELF, c64_final_chesscard_device, reset, 0) |
| 96 | INPUT_PORTS_END |
| 97 | |
| 98 | |
| 99 | //------------------------------------------------- |
| 100 | // input_ports - device-specific input ports |
| 101 | //------------------------------------------------- |
| 102 | |
| 103 | ioport_constructor c64_final_chesscard_device::device_input_ports() const |
| 104 | { |
| 105 | return INPUT_PORTS_NAME( c64_fcc ); |
| 106 | } |
| 107 | |
| 108 | |
| 109 | //************************************************************************** |
| 110 | // LIVE DEVICE |
| 111 | //************************************************************************** |
| 112 | |
| 113 | //------------------------------------------------- |
| 114 | // c64_final_chesscard_device - constructor |
| 115 | //------------------------------------------------- |
| 116 | |
| 117 | c64_final_chesscard_device::c64_final_chesscard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 118 | device_t(mconfig, C64_FCC, "Final ChessCard", tag, owner, clock), |
| 119 | device_c64_expansion_card_interface(mconfig, *this), |
| 120 | m_maincpu(*this, G65SC02P4_TAG) |
| 121 | { |
| 122 | } |
| 123 | |
| 124 | |
| 125 | //------------------------------------------------- |
| 126 | // device_start - device-specific startup |
| 127 | //------------------------------------------------- |
| 128 | |
| 129 | void c64_final_chesscard_device::device_start() |
| 130 | { |
| 131 | } |
| 132 | |
| 133 | |
| 134 | //------------------------------------------------- |
| 135 | // device_reset - device-specific reset |
| 136 | //------------------------------------------------- |
| 137 | |
| 138 | void c64_final_chesscard_device::device_reset() |
| 139 | { |
| 140 | } |
| 141 | |
| 142 | |
| 143 | //------------------------------------------------- |
| 144 | // c64_cd_r - cartridge data read |
| 145 | //------------------------------------------------- |
| 146 | |
| 147 | UINT8 c64_final_chesscard_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) |
| 148 | { |
| 149 | if (!roml) |
| 150 | { |
| 151 | data = m_roml[(m_bank << 13) | (offset & 0x1fff)]; |
| 152 | } |
| 153 | |
| 154 | return data; |
| 155 | } |
| 156 | |
| 157 | |
| 158 | //------------------------------------------------- |
| 159 | // c64_cd_w - cartridge data write |
| 160 | //------------------------------------------------- |
| 161 | |
| 162 | void c64_final_chesscard_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) |
| 163 | { |
| 164 | if (!io1) |
| 165 | { |
| 166 | printf("IO1 %04x %02x\n", offset, data); |
| 167 | m_bank = data; |
| 168 | } |
| 169 | |
| 170 | if (!io2) printf("IO1 %04x %02x\n", offset, data); |
| 171 | } |
trunk/src/mess/machine/c64_fcc.h
| r0 | r20111 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Tasc Final ChessCard 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 __FCC__ |
| 13 | #define __FCC__ |
| 14 | |
| 15 | #include "emu.h" |
| 16 | #include "machine/c64exp.h" |
| 17 | #include "cpu/m6502/m65sc02.h" |
| 18 | |
| 19 | |
| 20 | |
| 21 | //************************************************************************** |
| 22 | // TYPE DEFINITIONS |
| 23 | //************************************************************************** |
| 24 | |
| 25 | // ======================> c64_final_chesscard_device |
| 26 | |
| 27 | class c64_final_chesscard_device : public device_t, |
| 28 | public device_c64_expansion_card_interface |
| 29 | { |
| 30 | public: |
| 31 | // construction/destruction |
| 32 | c64_final_chesscard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 33 | |
| 34 | // optional information overrides |
| 35 | virtual const rom_entry *device_rom_region() const; |
| 36 | virtual machine_config_constructor device_mconfig_additions() const; |
| 37 | virtual ioport_constructor device_input_ports() const; |
| 38 | |
| 39 | DECLARE_INPUT_CHANGED_MEMBER( reset ); |
| 40 | |
| 41 | protected: |
| 42 | // device-level overrides |
| 43 | virtual void device_config_complete() { m_shortname = "c64_fcc"; } |
| 44 | virtual void device_start(); |
| 45 | virtual void device_reset(); |
| 46 | |
| 47 | // device_c64_expansion_card_interface overrides |
| 48 | virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2); |
| 49 | virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2); |
| 50 | |
| 51 | private: |
| 52 | required_device<m65sc02_device> m_maincpu; |
| 53 | |
| 54 | UINT8 m_bank; |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | // device type definition |
| 59 | extern const device_type C64_FCC; |
| 60 | |
| 61 | |
| 62 | |
| 63 | #endif |