src/mess/machine/cmdhd.c
| r0 | r14819 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | CMD HD hard drive emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "cmdhd.h" |
| 11 | |
| 12 | |
| 13 | |
| 14 | //************************************************************************** |
| 15 | // MACROS / CONSTANTS |
| 16 | //************************************************************************** |
| 17 | |
| 18 | #define M6502_TAG "m6502" |
| 19 | #define M6522_1_TAG "m6522_1" |
| 20 | #define M6522_2_TAG "m6522_2" |
| 21 | #define I8255A_TAG "i8255a" |
| 22 | |
| 23 | |
| 24 | |
| 25 | //************************************************************************** |
| 26 | // DEVICE DEFINITIONS |
| 27 | //************************************************************************** |
| 28 | |
| 29 | const device_type CMD_HD = &device_creator<cmd_hd_device>; |
| 30 | |
| 31 | |
| 32 | //------------------------------------------------- |
| 33 | // ROM( cmd_hd ) |
| 34 | //------------------------------------------------- |
| 35 | |
| 36 | ROM_START( cmd_hd ) |
| 37 | ROM_REGION( 0x8000, M6502_TAG, 0 ) |
| 38 | ROM_LOAD( "cmd_hd_bootrom_v280.bin", 0x0000, 0x8000, CRC(da68435d) SHA1(defd8bc04a52904b8a3560f11c82126619513a10) ) |
| 39 | ROM_END |
| 40 | |
| 41 | |
| 42 | //------------------------------------------------- |
| 43 | // rom_region - device-specific ROM region |
| 44 | //------------------------------------------------- |
| 45 | |
| 46 | const rom_entry *cmd_hd_device::device_rom_region() const |
| 47 | { |
| 48 | return ROM_NAME( cmd_hd ); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | //------------------------------------------------- |
| 53 | // ADDRESS_MAP( cmd_hd_mem ) |
| 54 | //------------------------------------------------- |
| 55 | |
| 56 | static ADDRESS_MAP_START( cmd_hd_mem, AS_PROGRAM, 8, cmd_hd_device ) |
| 57 | AM_RANGE(0x0000, 0x7fff) AM_RAM |
| 58 | AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0) |
| 59 | //AM_RANGE() AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write) |
| 60 | //AM_RANGE() AM_DEVREADWRITE(M6522_2_TAG, via6522_device, read, write) |
| 61 | ADDRESS_MAP_END |
| 62 | |
| 63 | |
| 64 | //------------------------------------------------- |
| 65 | // via6522_interface via1_intf |
| 66 | //------------------------------------------------- |
| 67 | |
| 68 | static const via6522_interface via1_intf = |
| 69 | { |
| 70 | DEVCB_NULL, |
| 71 | DEVCB_NULL, |
| 72 | DEVCB_NULL, |
| 73 | DEVCB_NULL, |
| 74 | DEVCB_NULL, |
| 75 | DEVCB_NULL, |
| 76 | |
| 77 | DEVCB_NULL, |
| 78 | DEVCB_NULL, |
| 79 | DEVCB_NULL, |
| 80 | DEVCB_NULL, |
| 81 | DEVCB_NULL, |
| 82 | DEVCB_NULL, |
| 83 | |
| 84 | DEVCB_NULL |
| 85 | }; |
| 86 | |
| 87 | |
| 88 | //------------------------------------------------- |
| 89 | // via6522_interface via2_intf |
| 90 | //------------------------------------------------- |
| 91 | |
| 92 | static const via6522_interface via2_intf = |
| 93 | { |
| 94 | DEVCB_NULL, |
| 95 | DEVCB_NULL, |
| 96 | DEVCB_NULL, |
| 97 | DEVCB_NULL, |
| 98 | DEVCB_NULL, |
| 99 | DEVCB_NULL, |
| 100 | |
| 101 | DEVCB_NULL, |
| 102 | DEVCB_NULL, |
| 103 | DEVCB_NULL, |
| 104 | DEVCB_NULL, |
| 105 | DEVCB_NULL, |
| 106 | DEVCB_NULL, |
| 107 | |
| 108 | DEVCB_NULL |
| 109 | }; |
| 110 | |
| 111 | |
| 112 | //------------------------------------------------- |
| 113 | // I8255A_INTERFACE( ppi_intf ) |
| 114 | //------------------------------------------------- |
| 115 | |
| 116 | static I8255A_INTERFACE( ppi_intf ) |
| 117 | { |
| 118 | DEVCB_NULL, |
| 119 | DEVCB_NULL, |
| 120 | DEVCB_NULL, |
| 121 | DEVCB_NULL, |
| 122 | DEVCB_NULL, |
| 123 | DEVCB_NULL |
| 124 | }; |
| 125 | |
| 126 | |
| 127 | //------------------------------------------------- |
| 128 | // MACHINE_DRIVER( cmd_hd ) |
| 129 | //------------------------------------------------- |
| 130 | |
| 131 | static MACHINE_CONFIG_FRAGMENT( cmd_hd ) |
| 132 | MCFG_CPU_ADD(M6502_TAG, M6502, 2000000) |
| 133 | MCFG_CPU_PROGRAM_MAP(cmd_hd_mem) |
| 134 | |
| 135 | MCFG_VIA6522_ADD(M6522_1_TAG, 2000000, via1_intf) |
| 136 | MCFG_VIA6522_ADD(M6522_2_TAG, 2000000, via2_intf) |
| 137 | MCFG_I8255A_ADD(I8255A_TAG, ppi_intf) |
| 138 | |
| 139 | MCFG_HARDDISK_ADD("harddisk0") |
| 140 | MACHINE_CONFIG_END |
| 141 | |
| 142 | |
| 143 | //------------------------------------------------- |
| 144 | // machine_config_additions - device-specific |
| 145 | // machine configurations |
| 146 | //------------------------------------------------- |
| 147 | |
| 148 | machine_config_constructor cmd_hd_device::device_mconfig_additions() const |
| 149 | { |
| 150 | return MACHINE_CONFIG_NAME( cmd_hd ); |
| 151 | } |
| 152 | |
| 153 | |
| 154 | |
| 155 | //************************************************************************** |
| 156 | // LIVE DEVICE |
| 157 | //************************************************************************** |
| 158 | |
| 159 | //------------------------------------------------- |
| 160 | // cmd_hd_device - constructor |
| 161 | //------------------------------------------------- |
| 162 | |
| 163 | cmd_hd_device::cmd_hd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 164 | : device_t(mconfig, CMD_HD, "HD", tag, owner, clock), |
| 165 | device_cbm_iec_interface(mconfig, *this), |
| 166 | m_maincpu(*this, M6502_TAG) |
| 167 | { |
| 168 | } |
| 169 | |
| 170 | |
| 171 | //------------------------------------------------- |
| 172 | // device_start - device-specific startup |
| 173 | //------------------------------------------------- |
| 174 | |
| 175 | void cmd_hd_device::device_start() |
| 176 | { |
| 177 | } |
| 178 | |
| 179 | |
| 180 | //------------------------------------------------- |
| 181 | // device_reset - device-specific reset |
| 182 | //------------------------------------------------- |
| 183 | |
| 184 | void cmd_hd_device::device_reset() |
| 185 | { |
| 186 | } |
| 187 | |
| 188 | |
| 189 | //------------------------------------------------- |
| 190 | // cbm_iec_srq - |
| 191 | //------------------------------------------------- |
| 192 | |
| 193 | void cmd_hd_device::cbm_iec_srq(int state) |
| 194 | { |
| 195 | } |
| 196 | |
| 197 | |
| 198 | //------------------------------------------------- |
| 199 | // cbm_iec_atn - |
| 200 | //------------------------------------------------- |
| 201 | |
| 202 | void cmd_hd_device::cbm_iec_atn(int state) |
| 203 | { |
| 204 | } |
| 205 | |
| 206 | |
| 207 | //------------------------------------------------- |
| 208 | // cbm_iec_data - |
| 209 | //------------------------------------------------- |
| 210 | |
| 211 | void cmd_hd_device::cbm_iec_data(int state) |
| 212 | { |
| 213 | } |
| 214 | |
| 215 | |
| 216 | //------------------------------------------------- |
| 217 | // cbm_iec_reset - |
| 218 | //------------------------------------------------- |
| 219 | |
| 220 | void cmd_hd_device::cbm_iec_reset(int state) |
| 221 | { |
| 222 | if (!state) |
| 223 | { |
| 224 | device_reset(); |
| 225 | } |
| 226 | } |
src/mess/machine/cmdhd.h
| r0 | r14819 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | CMD HD disk drive 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 __CMD_HD__ |
| 13 | #define __CMD_HD__ |
| 14 | |
| 15 | #define ADDRESS_MAP_MODERN |
| 16 | |
| 17 | #include "emu.h" |
| 18 | #include "cpu/m6502/m6502.h" |
| 19 | #include "imagedev/harddriv.h" |
| 20 | #include "machine/6522via.h" |
| 21 | #include "machine/cbmiec.h" |
| 22 | #include "machine/i8255.h" |
| 23 | |
| 24 | |
| 25 | |
| 26 | //************************************************************************** |
| 27 | // MACROS / CONSTANTS |
| 28 | //************************************************************************** |
| 29 | |
| 30 | #define CMD_HD_TAG "cmdhd" |
| 31 | |
| 32 | |
| 33 | |
| 34 | //************************************************************************** |
| 35 | // TYPE DEFINITIONS |
| 36 | //************************************************************************** |
| 37 | |
| 38 | // ======================> cmd_hd_device |
| 39 | |
| 40 | class cmd_hd_device : public device_t, |
| 41 | public device_cbm_iec_interface |
| 42 | { |
| 43 | |
| 44 | public: |
| 45 | // construction/destruction |
| 46 | cmd_hd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 47 | |
| 48 | // optional information overrides |
| 49 | virtual const rom_entry *device_rom_region() const; |
| 50 | virtual machine_config_constructor device_mconfig_additions() const; |
| 51 | |
| 52 | protected: |
| 53 | // device-level overrides |
| 54 | virtual void device_start(); |
| 55 | virtual void device_reset(); |
| 56 | virtual void device_config_complete() { m_shortname = "cmdhd"; } |
| 57 | |
| 58 | // device_cbm_iec_interface overrides |
| 59 | void cbm_iec_srq(int state); |
| 60 | void cbm_iec_atn(int state); |
| 61 | void cbm_iec_data(int state); |
| 62 | void cbm_iec_reset(int state); |
| 63 | |
| 64 | required_device<cpu_device> m_maincpu; |
| 65 | }; |
| 66 | |
| 67 | |
| 68 | // device type definition |
| 69 | extern const device_type CMD_HD; |
| 70 | |
| 71 | |
| 72 | |
| 73 | #endif |
src/mess/machine/fd2000.c
| r0 | r14819 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | CMD FD2000 disk drive emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "fd2000.h" |
| 11 | |
| 12 | |
| 13 | |
| 14 | //************************************************************************** |
| 15 | // MACROS / CONSTANTS |
| 16 | //************************************************************************** |
| 17 | |
| 18 | #define M6502_TAG "m6502" |
| 19 | #define M6522_TAG "m6522" |
| 20 | #define DP8473_TAG "dp8473" |
| 21 | #define PC8477AV1_TAG "pc8477av1" |
| 22 | |
| 23 | |
| 24 | |
| 25 | //************************************************************************** |
| 26 | // DEVICE DEFINITIONS |
| 27 | //************************************************************************** |
| 28 | |
| 29 | const device_type FD2000 = &device_creator<fd2000_device>; |
| 30 | |
| 31 | |
| 32 | //------------------------------------------------- |
| 33 | // ROM( fd2000 ) |
| 34 | //------------------------------------------------- |
| 35 | |
| 36 | ROM_START( fd2000 ) |
| 37 | ROM_REGION( 0x8000, M6502_TAG, 0 ) |
| 38 | ROM_LOAD( "cmd_fd-2000_dos_v1.40_cs_33cc6f.bin", 0x0000, 0x8000, CRC(4e6ca15c) SHA1(0c61ba58269baf2b8aadf3bbc4648c7a5a6d2128) ) |
| 39 | ROM_END |
| 40 | |
| 41 | |
| 42 | //------------------------------------------------- |
| 43 | // rom_region - device-specific ROM region |
| 44 | //------------------------------------------------- |
| 45 | |
| 46 | const rom_entry *fd2000_device::device_rom_region() const |
| 47 | { |
| 48 | return ROM_NAME( fd2000 ); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | //------------------------------------------------- |
| 53 | // ADDRESS_MAP( fd2000_mem ) |
| 54 | //------------------------------------------------- |
| 55 | |
| 56 | static ADDRESS_MAP_START( fd2000_mem, AS_PROGRAM, 8, fd2000_device ) |
| 57 | AM_RANGE(0x0000, 0x7fff) AM_RAM |
| 58 | AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0) |
| 59 | //AM_RANGE() AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write) |
| 60 | //AM_RANGE() AM_DEVREAD_LEGACY(DP8473_TAG, upd765_status_r) |
| 61 | //AM_RANGE() AM_DEVREADWRITE_LEGACY(DP8473_TAG, upd765_data_r, upd765_data_w) |
| 62 | ADDRESS_MAP_END |
| 63 | |
| 64 | |
| 65 | //------------------------------------------------- |
| 66 | // via6522_interface via1_intf |
| 67 | //------------------------------------------------- |
| 68 | |
| 69 | static const via6522_interface via_intf = |
| 70 | { |
| 71 | DEVCB_NULL, |
| 72 | DEVCB_NULL, |
| 73 | DEVCB_NULL, |
| 74 | DEVCB_NULL, |
| 75 | DEVCB_NULL, |
| 76 | DEVCB_NULL, |
| 77 | |
| 78 | DEVCB_NULL, |
| 79 | DEVCB_NULL, |
| 80 | DEVCB_NULL, |
| 81 | DEVCB_NULL, |
| 82 | DEVCB_NULL, |
| 83 | DEVCB_NULL, |
| 84 | |
| 85 | DEVCB_NULL |
| 86 | }; |
| 87 | |
| 88 | |
| 89 | //------------------------------------------------- |
| 90 | // LEGACY_FLOPPY_OPTIONS( fd2000 ) |
| 91 | //------------------------------------------------- |
| 92 | |
| 93 | static LEGACY_FLOPPY_OPTIONS_START( fd2000 ) |
| 94 | LEGACY_FLOPPY_OPTION( fd2000, "d81", "Commodore 1581 Disk Image", d81_dsk_identify, d81_dsk_construct, NULL, NULL ) |
| 95 | //LEGACY_FLOPPY_OPTION( fd2000, "d2m", "CMD FD-2000 Disk Image", d2m_dsk_identify, d2m_dsk_construct, NULL, NULL ) |
| 96 | LEGACY_FLOPPY_OPTIONS_END |
| 97 | |
| 98 | |
| 99 | //------------------------------------------------- |
| 100 | // floppy_interface fd2000_floppy_interface |
| 101 | //------------------------------------------------- |
| 102 | |
| 103 | static const floppy_interface fd2000_floppy_interface = |
| 104 | { |
| 105 | DEVCB_NULL, |
| 106 | DEVCB_NULL, |
| 107 | DEVCB_NULL, |
| 108 | DEVCB_NULL, |
| 109 | DEVCB_NULL, |
| 110 | FLOPPY_STANDARD_3_5_DSDD, |
| 111 | LEGACY_FLOPPY_OPTIONS_NAME(fd2000), |
| 112 | "floppy_3_5", |
| 113 | NULL |
| 114 | }; |
| 115 | |
| 116 | |
| 117 | //------------------------------------------------- |
| 118 | // upd765_interface fdc_intf |
| 119 | //------------------------------------------------- |
| 120 | |
| 121 | static const struct upd765_interface fdc_intf = |
| 122 | { |
| 123 | DEVCB_NULL, |
| 124 | DEVCB_NULL, |
| 125 | NULL, |
| 126 | UPD765_RDY_PIN_CONNECTED, |
| 127 | { FLOPPY_0, NULL, NULL, NULL } |
| 128 | }; |
| 129 | |
| 130 | |
| 131 | //------------------------------------------------- |
| 132 | // MACHINE_DRIVER( fd2000 ) |
| 133 | //------------------------------------------------- |
| 134 | |
| 135 | static MACHINE_CONFIG_FRAGMENT( fd2000 ) |
| 136 | MCFG_CPU_ADD(M6502_TAG, M65C02, 2000000) |
| 137 | MCFG_CPU_PROGRAM_MAP(fd2000_mem) |
| 138 | |
| 139 | MCFG_VIA6522_ADD(M6522_TAG, 2000000, via_intf) |
| 140 | MCFG_UPD765A_ADD(DP8473_TAG, fdc_intf) |
| 141 | |
| 142 | MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, fd2000_floppy_interface) |
| 143 | MACHINE_CONFIG_END |
| 144 | |
| 145 | |
| 146 | //------------------------------------------------- |
| 147 | // machine_config_additions - device-specific |
| 148 | // machine configurations |
| 149 | //------------------------------------------------- |
| 150 | |
| 151 | machine_config_constructor fd2000_device::device_mconfig_additions() const |
| 152 | { |
| 153 | return MACHINE_CONFIG_NAME( fd2000 ); |
| 154 | } |
| 155 | |
| 156 | |
| 157 | |
| 158 | //************************************************************************** |
| 159 | // LIVE DEVICE |
| 160 | //************************************************************************** |
| 161 | |
| 162 | //------------------------------------------------- |
| 163 | // fd2000_device - constructor |
| 164 | //------------------------------------------------- |
| 165 | |
| 166 | fd2000_device::fd2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 167 | : device_t(mconfig, FD2000, "FD-2000", tag, owner, clock), |
| 168 | device_cbm_iec_interface(mconfig, *this), |
| 169 | m_maincpu(*this, M6502_TAG) |
| 170 | { |
| 171 | } |
| 172 | |
| 173 | |
| 174 | //------------------------------------------------- |
| 175 | // device_start - device-specific startup |
| 176 | //------------------------------------------------- |
| 177 | |
| 178 | void fd2000_device::device_start() |
| 179 | { |
| 180 | } |
| 181 | |
| 182 | |
| 183 | //------------------------------------------------- |
| 184 | // device_reset - device-specific reset |
| 185 | //------------------------------------------------- |
| 186 | |
| 187 | void fd2000_device::device_reset() |
| 188 | { |
| 189 | } |
| 190 | |
| 191 | |
| 192 | //------------------------------------------------- |
| 193 | // cbm_iec_srq - |
| 194 | //------------------------------------------------- |
| 195 | |
| 196 | void fd2000_device::cbm_iec_srq(int state) |
| 197 | { |
| 198 | } |
| 199 | |
| 200 | |
| 201 | //------------------------------------------------- |
| 202 | // cbm_iec_atn - |
| 203 | //------------------------------------------------- |
| 204 | |
| 205 | void fd2000_device::cbm_iec_atn(int state) |
| 206 | { |
| 207 | } |
| 208 | |
| 209 | |
| 210 | //------------------------------------------------- |
| 211 | // cbm_iec_data - |
| 212 | //------------------------------------------------- |
| 213 | |
| 214 | void fd2000_device::cbm_iec_data(int state) |
| 215 | { |
| 216 | } |
| 217 | |
| 218 | |
| 219 | //------------------------------------------------- |
| 220 | // cbm_iec_reset - |
| 221 | //------------------------------------------------- |
| 222 | |
| 223 | void fd2000_device::cbm_iec_reset(int state) |
| 224 | { |
| 225 | if (!state) |
| 226 | { |
| 227 | device_reset(); |
| 228 | } |
| 229 | } |
src/mess/machine/fd2000.h
| r0 | r14819 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | CMD FD2000 disk drive 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 __FD2000__ |
| 13 | #define __FD2000__ |
| 14 | |
| 15 | #define ADDRESS_MAP_MODERN |
| 16 | |
| 17 | #include "emu.h" |
| 18 | #include "cpu/m6502/m6502.h" |
| 19 | #include "imagedev/flopdrv.h" |
| 20 | #include "formats/d81_dsk.h" |
| 21 | #include "machine/6522via.h" |
| 22 | #include "machine/cbmiec.h" |
| 23 | #include "machine/upd765.h" |
| 24 | |
| 25 | |
| 26 | |
| 27 | //************************************************************************** |
| 28 | // MACROS / CONSTANTS |
| 29 | //************************************************************************** |
| 30 | |
| 31 | #define FD2000_TAG "fd2000" |
| 32 | |
| 33 | |
| 34 | |
| 35 | //************************************************************************** |
| 36 | // TYPE DEFINITIONS |
| 37 | //************************************************************************** |
| 38 | |
| 39 | // ======================> fd2000_device |
| 40 | |
| 41 | class fd2000_device : public device_t, |
| 42 | public device_cbm_iec_interface |
| 43 | { |
| 44 | |
| 45 | public: |
| 46 | // construction/destruction |
| 47 | fd2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 48 | |
| 49 | // optional information overrides |
| 50 | virtual const rom_entry *device_rom_region() const; |
| 51 | virtual machine_config_constructor device_mconfig_additions() const; |
| 52 | |
| 53 | protected: |
| 54 | // device-level overrides |
| 55 | virtual void device_start(); |
| 56 | virtual void device_reset(); |
| 57 | virtual void device_config_complete() { m_shortname = "fd2000"; } |
| 58 | |
| 59 | // device_cbm_iec_interface overrides |
| 60 | void cbm_iec_srq(int state); |
| 61 | void cbm_iec_atn(int state); |
| 62 | void cbm_iec_data(int state); |
| 63 | void cbm_iec_reset(int state); |
| 64 | |
| 65 | required_device<cpu_device> m_maincpu; |
| 66 | }; |
| 67 | |
| 68 | |
| 69 | // device type definition |
| 70 | extern const device_type FD2000; |
| 71 | |
| 72 | |
| 73 | |
| 74 | #endif |
src/mess/machine/vic10std.c
| r14818 | r14819 | |
| 29 | 29 | |
| 30 | 30 | vic10_standard_cartridge_device::vic10_standard_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
| 31 | 31 | : device_t(mconfig, VIC10_STD, "VIC-10 Standard Cartridge", tag, owner, clock),
|
| 32 | | device_vic10_expansion_card_interface(mconfig, *this),
|
| 33 | | m_exram(NULL),
|
| 34 | | m_lorom(NULL),
|
| 35 | | m_uprom(NULL)
|
| 32 | device_vic10_expansion_card_interface(mconfig, *this)
|
| 36 | 33 | {
|
| 37 | 34 | }
|
| 38 | 35 | |
| r14818 | r14819 | |
| 47 | 44 | |
| 48 | 45 | |
| 49 | 46 | //-------------------------------------------------
|
| 50 | | // vic10_exram_pointer - get expanded RAM pointer
|
| 51 | | //-------------------------------------------------
|
| 52 | | |
| 53 | | UINT8* vic10_standard_cartridge_device::vic10_exram_pointer()
|
| 54 | | {
|
| 55 | | if (m_exram == NULL)
|
| 56 | | {
|
| 57 | | m_exram = auto_alloc_array(machine(), UINT8, 0x800);
|
| 58 | | }
|
| 59 | | |
| 60 | | return m_exram;
|
| 61 | | }
|
| 62 | | |
| 63 | | |
| 64 | | //-------------------------------------------------
|
| 65 | 47 | // vic10_exram_r - expanded RAM read
|
| 66 | 48 | //-------------------------------------------------
|
| 67 | 49 | |
| r14818 | r14819 | |
| 92 | 74 | |
| 93 | 75 | |
| 94 | 76 | //-------------------------------------------------
|
| 95 | | // vic10_lorom_pointer - get lower ROM pointer
|
| 96 | | //-------------------------------------------------
|
| 97 | | |
| 98 | | UINT8* vic10_standard_cartridge_device::vic10_lorom_pointer()
|
| 99 | | {
|
| 100 | | if (m_lorom == NULL)
|
| 101 | | {
|
| 102 | | m_lorom = auto_alloc_array(machine(), UINT8, 0x2000);
|
| 103 | | }
|
| 104 | | |
| 105 | | return m_lorom;
|
| 106 | | }
|
| 107 | | |
| 108 | | |
| 109 | | //-------------------------------------------------
|
| 110 | 77 | // vic10_lorom_r - lower ROM read
|
| 111 | 78 | //-------------------------------------------------
|
| 112 | 79 | |
| r14818 | r14819 | |
| 124 | 91 | |
| 125 | 92 | |
| 126 | 93 | //-------------------------------------------------
|
| 127 | | // vic10_uprom_pointer - get upper ROM pointer
|
| 128 | | //-------------------------------------------------
|
| 129 | | |
| 130 | | UINT8* vic10_standard_cartridge_device::vic10_uprom_pointer()
|
| 131 | | {
|
| 132 | | if (m_uprom == NULL)
|
| 133 | | {
|
| 134 | | m_uprom = auto_alloc_array(machine(), UINT8, 0x2000);
|
| 135 | | }
|
| 136 | | |
| 137 | | return m_uprom;
|
| 138 | | }
|
| 139 | | |
| 140 | | |
| 141 | | //-------------------------------------------------
|
| 142 | 94 | // vic10_uprom_r - upper ROM read
|
| 143 | 95 | //-------------------------------------------------
|
| 144 | 96 | |
src/mess/machine/c64exp.c
| r14818 | r14819 | |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | | #include "emu.h" |
| 11 | 10 | #include "machine/c64exp.h" |
| 12 | | #include "formats/cbm_crt.h" |
| 13 | | #include "formats/imageutl.h" |
| 14 | 11 | |
| 15 | 12 | |
| 16 | 13 | |
| r14818 | r14819 | |
| 21 | 18 | #define LOG 0 |
| 22 | 19 | |
| 23 | 20 | |
| 24 | | // slot names for the C64 cartridge types |
| 25 | | const char *CRT_C64_SLOT_NAMES[_CRT_C64_COUNT] = |
| 26 | | { |
| 27 | | "standard", |
| 28 | | UNSUPPORTED, |
| 29 | | UNSUPPORTED, |
| 30 | | UNSUPPORTED, |
| 31 | | "simons_basic", |
| 32 | | "ocean", |
| 33 | | UNSUPPORTED, |
| 34 | | "fun_play", |
| 35 | | "super_games", |
| 36 | | UNSUPPORTED, |
| 37 | | "epyxfastload", |
| 38 | | "westermann", |
| 39 | | "rex", |
| 40 | | UNSUPPORTED, |
| 41 | | "magic_formel", |
| 42 | | "system3", |
| 43 | | "warp_speed", |
| 44 | | "dinamic", |
| 45 | | "zaxxon", |
| 46 | | "magic desk", |
| 47 | | UNSUPPORTED, |
| 48 | | "comal80", |
| 49 | | "struct_basic", |
| 50 | | "ross", |
| 51 | | "ep64", |
| 52 | | "ep7x8", |
| 53 | | "dela_ep256", |
| 54 | | "rex_ep256", |
| 55 | | "mikroasm", |
| 56 | | UNSUPPORTED, |
| 57 | | UNSUPPORTED, |
| 58 | | "stardos", |
| 59 | | UNSUPPORTED, |
| 60 | | UNSUPPORTED, |
| 61 | | UNSUPPORTED, |
| 62 | | UNSUPPORTED, |
| 63 | | UNSUPPORTED, |
| 64 | | UNSUPPORTED, |
| 65 | | UNSUPPORTED, |
| 66 | | UNSUPPORTED, |
| 67 | | UNSUPPORTED, |
| 68 | | "ieee488", |
| 69 | | UNSUPPORTED, |
| 70 | | UNSUPPORTED, |
| 71 | | "exos", |
| 72 | | UNSUPPORTED, |
| 73 | | UNSUPPORTED, |
| 74 | | UNSUPPORTED, |
| 75 | | "super_explode", |
| 76 | | UNSUPPORTED, |
| 77 | | UNSUPPORTED, |
| 78 | | "mach5", |
| 79 | | UNSUPPORTED, |
| 80 | | "pagefox", |
| 81 | | UNSUPPORTED, |
| 82 | | "silverrock" |
| 83 | | }; |
| 84 | 21 | |
| 85 | | |
| 86 | | |
| 87 | 22 | //************************************************************************** |
| 88 | 23 | // DEVICE DEFINITIONS |
| 89 | 24 | //************************************************************************** |
| r14818 | r14819 | |
| 286 | 221 | } |
| 287 | 222 | else if (!mame_stricmp(filetype(), "crt")) |
| 288 | 223 | { |
| 289 | | // read the header |
| 290 | | cbm_crt_header header; |
| 291 | | fread(&header, CRT_HEADER_LENGTH); |
| 292 | | |
| 293 | | if (memcmp(header.signature, CRT_SIGNATURE, 16) != 0) |
| 294 | | return IMAGE_INIT_FAIL; |
| 295 | | |
| 296 | | UINT16 hardware = pick_integer_be(header.hardware, 0, 2); |
| 297 | | |
| 298 | | if (LOG) |
| 299 | | { |
| 300 | | logerror("Name: %s\n", header.name); |
| 301 | | logerror("Hardware: %04x\n", hardware); |
| 302 | | logerror("Slot device: %s\n", CRT_C64_SLOT_NAMES[hardware]); |
| 303 | | logerror("EXROM: %u\n", header.exrom); |
| 304 | | logerror("GAME: %u\n", header.game); |
| 305 | | } |
| 306 | | |
| 307 | | // determine ROM region lengths |
| 308 | 224 | size_t roml_size = 0; |
| 309 | 225 | size_t romh_size = 0; |
| 226 | int exrom = 1; |
| 227 | int game = 1; |
| 310 | 228 | |
| 311 | | while (!image_feof()) |
| 229 | if (cbm_crt_read_header(m_file, &roml_size, &romh_size, &exrom, &game)) |
| 312 | 230 | { |
| 313 | | cbm_crt_chip chip; |
| 314 | | fread(&chip, CRT_CHIP_LENGTH); |
| 231 | UINT8 *roml = NULL; |
| 232 | UINT8 *romh = NULL; |
| 315 | 233 | |
| 316 | | UINT16 address = pick_integer_be(chip.start_address, 0, 2); |
| 317 | | UINT16 size = pick_integer_be(chip.image_size, 0, 2); |
| 318 | | UINT16 type = pick_integer_be(chip.chip_type, 0, 2); |
| 234 | if (roml_size) roml = m_cart->c64_roml_pointer(machine(), roml_size); |
| 235 | if (romh_size) romh = m_cart->c64_romh_pointer(machine(), romh_size); |
| 319 | 236 | |
| 320 | | if (LOG) |
| 321 | | { |
| 322 | | logerror("CHIP Address: %04x\n", address); |
| 323 | | logerror("CHIP Size: %04x\n", size); |
| 324 | | logerror("CHIP Type: %04x\n", type); |
| 325 | | } |
| 326 | | |
| 327 | | switch (address) |
| 328 | | { |
| 329 | | case 0x8000: roml_size += size; break; |
| 330 | | case 0xa000: romh_size += size; break; |
| 331 | | case 0xe000: romh_size += size; break; |
| 332 | | default: logerror("Invalid CHIP loading address!\n"); break; |
| 333 | | } |
| 334 | | |
| 335 | | fseek(size, SEEK_CUR); |
| 237 | cbm_crt_read_data(m_file, roml, romh); |
| 336 | 238 | } |
| 337 | 239 | |
| 338 | | // allocate cartridge memory |
| 339 | | UINT8 *roml = NULL; |
| 340 | | UINT8 *romh = NULL; |
| 341 | | |
| 342 | | if (roml_size) roml = m_cart->c64_roml_pointer(machine(), roml_size); |
| 343 | | if (romh_size) romh = m_cart->c64_romh_pointer(machine(), romh_size); |
| 344 | | |
| 345 | | // read the data |
| 346 | | offs_t roml_offset = 0; |
| 347 | | offs_t romh_offset = 0; |
| 348 | | |
| 349 | | fseek(CRT_HEADER_LENGTH, SEEK_SET); |
| 350 | | |
| 351 | | while (!image_feof()) |
| 352 | | { |
| 353 | | cbm_crt_chip chip; |
| 354 | | fread(&chip, CRT_CHIP_LENGTH); |
| 355 | | |
| 356 | | UINT16 address = pick_integer_be(chip.start_address, 0, 2); |
| 357 | | UINT16 size = pick_integer_be(chip.image_size, 0, 2); |
| 358 | | |
| 359 | | switch (address) |
| 360 | | { |
| 361 | | case 0x8000: fread(roml + roml_offset, size); roml_offset += size; break; |
| 362 | | case 0xa000: fread(romh + romh_offset, size); romh_offset += size; break; |
| 363 | | case 0xe000: fread(romh + romh_offset, size); romh_offset += size; break; |
| 364 | | } |
| 365 | | } |
| 366 | | |
| 367 | | m_cart->c64_exrom_w(header.exrom); |
| 368 | | m_cart->c64_game_w(header.game); |
| 240 | m_cart->c64_exrom_w(exrom); |
| 241 | m_cart->c64_game_w(game); |
| 369 | 242 | } |
| 370 | 243 | } |
| 371 | 244 | else |
| 372 | 245 | { |
| 373 | | size = get_software_region_length("roml"); |
| 374 | | if (size) memcpy(m_cart->c64_roml_pointer(machine(), size), get_software_region("roml"), size); |
| 246 | size = get_software_region_length("uprom"); |
| 247 | |
| 248 | if (size) |
| 249 | { |
| 250 | // Ultimax (VIC-10) cartridge |
| 251 | memcpy(m_cart->c64_romh_pointer(machine(), size), get_software_region("uprom"), size); |
| 375 | 252 | |
| 376 | | size = get_software_region_length("romh"); |
| 377 | | if (size) memcpy(m_cart->c64_romh_pointer(machine(), size), get_software_region("romh"), size); |
| 253 | size = get_software_region_length("lorom"); |
| 254 | if (size) memcpy(m_cart->c64_roml_pointer(machine(), size), get_software_region("lorom"), size); |
| 378 | 255 | |
| 379 | | size = get_software_region_length("ram"); |
| 380 | | if (size) memset(m_cart->c64_ram_pointer(machine(), size), 0, size); |
| 256 | m_cart->c64_exrom_w(1); |
| 257 | m_cart->c64_game_w(0); |
| 258 | } |
| 259 | else |
| 260 | { |
| 261 | // Commodore 64/128 cartridge |
| 262 | size = get_software_region_length("roml"); |
| 263 | if (size) memcpy(m_cart->c64_roml_pointer(machine(), size), get_software_region("roml"), size); |
| 381 | 264 | |
| 382 | | m_cart->c64_exrom_w(atol(get_feature("exrom"))); |
| 383 | | m_cart->c64_game_w(atol(get_feature("game"))); |
| 265 | size = get_software_region_length("romh"); |
| 266 | if (size) memcpy(m_cart->c64_romh_pointer(machine(), size), get_software_region("romh"), size); |
| 267 | |
| 268 | size = get_software_region_length("ram"); |
| 269 | if (size) memset(m_cart->c64_ram_pointer(machine(), size), 0, size); |
| 270 | |
| 271 | m_cart->c64_exrom_w(atol(get_feature("exrom"))); |
| 272 | m_cart->c64_game_w(atol(get_feature("game"))); |
| 273 | } |
| 384 | 274 | } |
| 385 | 275 | } |
| 386 | 276 | |
| r14818 | r14819 | |
| 410 | 300 | { |
| 411 | 301 | if (!mame_stricmp(filetype(), "crt")) |
| 412 | 302 | { |
| 413 | | // read the header |
| 414 | | cbm_crt_header header; |
| 415 | | fread(&header, CRT_HEADER_LENGTH); |
| 416 | | |
| 417 | | if (memcmp(header.signature, CRT_SIGNATURE, 16) == 0) |
| 418 | | { |
| 419 | | UINT16 hardware = pick_integer_be(header.hardware, 0, 2); |
| 420 | | return CRT_C64_SLOT_NAMES[hardware]; |
| 421 | | } |
| 303 | return cbm_crt_get_card(m_file); |
| 422 | 304 | } |
| 305 | |
| 423 | 306 | clear(); |
| 424 | 307 | } |
| 308 | |
| 425 | 309 | return software_get_default_slot(config, options, this, "standard"); |
| 426 | 310 | } |
| 427 | 311 | |
src/mess/machine/vic10exp.c
| r14818 | r14819 | |
| 10 | 10 | #include "emu.h"
|
| 11 | 11 | #include "emuopts.h"
|
| 12 | 12 | #include "machine/vic10exp.h"
|
| 13 | #include "formats/cbm_crt.h"
|
| 14 | #include "formats/imageutl.h"
|
| 13 | 15 | |
| 14 | 16 | |
| 17 | |
| 15 | 18 | //**************************************************************************
|
| 16 | 19 | // GLOBAL VARIABLES
|
| 17 | 20 | //**************************************************************************
|
| r14818 | r14819 | |
| 19 | 22 | const device_type VIC10_EXPANSION_SLOT = &device_creator<vic10_expansion_slot_device>;
|
| 20 | 23 | |
| 21 | 24 | |
| 25 | |
| 22 | 26 | //**************************************************************************
|
| 23 | 27 | // DEVICE VIC10_EXPANSION CARD INTERFACE
|
| 24 | 28 | //**************************************************************************
|
| r14818 | r14819 | |
| 28 | 32 | //-------------------------------------------------
|
| 29 | 33 | |
| 30 | 34 | device_vic10_expansion_card_interface::device_vic10_expansion_card_interface(const machine_config &mconfig, device_t &device)
|
| 31 | | : device_slot_card_interface(mconfig,device)
|
| 35 | : device_slot_card_interface(mconfig,device),
|
| 36 | m_exram(NULL),
|
| 37 | m_lorom(NULL),
|
| 38 | m_uprom(NULL)
|
| 32 | 39 | {
|
| 33 | 40 | m_slot = dynamic_cast<vic10_expansion_slot_device *>(device.owner());
|
| 34 | 41 | }
|
| r14818 | r14819 | |
| 44 | 51 | |
| 45 | 52 | |
| 46 | 53 | |
| 54 | //-------------------------------------------------
|
| 55 | // vic10_lorom_pointer - get lower ROM pointer
|
| 56 | //-------------------------------------------------
|
| 57 | |
| 58 | UINT8* device_vic10_expansion_card_interface::vic10_lorom_pointer(running_machine &machine, size_t size)
|
| 59 | {
|
| 60 | if (m_lorom == NULL)
|
| 61 | {
|
| 62 | m_lorom = auto_alloc_array(machine, UINT8, size);
|
| 63 | }
|
| 64 | |
| 65 | return m_lorom;
|
| 66 | }
|
| 67 | |
| 68 | |
| 69 | //-------------------------------------------------
|
| 70 | // vic10_uprom_pointer - get upper ROM pointer
|
| 71 | //-------------------------------------------------
|
| 72 | |
| 73 | UINT8* device_vic10_expansion_card_interface::vic10_uprom_pointer(running_machine &machine, size_t size)
|
| 74 | {
|
| 75 | if (m_uprom == NULL)
|
| 76 | {
|
| 77 | m_uprom = auto_alloc_array(machine, UINT8, size);
|
| 78 | }
|
| 79 | |
| 80 | return m_uprom;
|
| 81 | }
|
| 82 | |
| 83 | |
| 84 | //-------------------------------------------------
|
| 85 | // vic10_exram_pointer - get expanded RAM pointer
|
| 86 | //-------------------------------------------------
|
| 87 | |
| 88 | UINT8* device_vic10_expansion_card_interface::vic10_exram_pointer(running_machine &machine, size_t size)
|
| 89 | {
|
| 90 | if (m_exram == NULL)
|
| 91 | {
|
| 92 | m_exram = auto_alloc_array(machine, UINT8, size);
|
| 93 | }
|
| 94 | |
| 95 | return m_exram;
|
| 96 | }
|
| 97 | |
| 98 | |
| 99 | |
| 47 | 100 | //**************************************************************************
|
| 48 | 101 | // LIVE DEVICE
|
| 49 | 102 | //**************************************************************************
|
| r14818 | r14819 | |
| 130 | 183 | |
| 131 | 184 | if (!mame_stricmp(filetype(), "80"))
|
| 132 | 185 | {
|
| 133 | | fread(m_cart->vic10_lorom_pointer(), 0x2000);
|
| 186 | fread(m_cart->vic10_lorom_pointer(machine(), 0x2000), 0x2000);
|
| 134 | 187 | |
| 135 | 188 | if (size == 0x4000)
|
| 136 | 189 | {
|
| 137 | | fread(m_cart->vic10_uprom_pointer(), 0x2000);
|
| 190 | fread(m_cart->vic10_uprom_pointer(machine(), 0x2000), 0x2000);
|
| 138 | 191 | }
|
| 139 | 192 | }
|
| 140 | | else if (!mame_stricmp(filetype(), "e0")) fread(m_cart->vic10_uprom_pointer(), size);
|
| 193 | else if (!mame_stricmp(filetype(), "e0")) fread(m_cart->vic10_uprom_pointer(machine(), size), size);
|
| 194 | else if (!mame_stricmp(filetype(), "crt"))
|
| 195 | {
|
| 196 | size_t roml_size = 0;
|
| 197 | size_t romh_size = 0;
|
| 198 | int exrom = 1;
|
| 199 | int game = 1;
|
| 200 | |
| 201 | if (cbm_crt_read_header(m_file, &roml_size, &romh_size, &exrom, &game))
|
| 202 | {
|
| 203 | UINT8 *roml = NULL;
|
| 204 | UINT8 *romh = NULL;
|
| 205 | |
| 206 | if (roml_size) roml = m_cart->vic10_lorom_pointer(machine(), roml_size);
|
| 207 | if (romh_size) romh = m_cart->vic10_uprom_pointer(machine(), romh_size);
|
| 208 | |
| 209 | cbm_crt_read_data(m_file, roml, romh);
|
| 210 | }
|
| 211 | }
|
| 141 | 212 | }
|
| 142 | 213 | else
|
| 143 | 214 | {
|
| 144 | 215 | size = get_software_region_length("lorom");
|
| 145 | | if (size) memcpy(m_cart->vic10_lorom_pointer(), get_software_region("lorom"), size);
|
| 216 | if (size) memcpy(m_cart->vic10_lorom_pointer(machine(), size), get_software_region("lorom"), size);
|
| 146 | 217 | |
| 147 | 218 | size = get_software_region_length("uprom");
|
| 148 | | if (size) memcpy(m_cart->vic10_uprom_pointer(), get_software_region("uprom"), size);
|
| 219 | if (size) memcpy(m_cart->vic10_uprom_pointer(machine(), size), get_software_region("uprom"), size);
|
| 149 | 220 | |
| 150 | 221 | size = get_software_region_length("exram");
|
| 151 | | if (size) m_cart->vic10_exram_pointer();
|
| 222 | if (size) m_cart->vic10_exram_pointer(machine(), size);
|
| 152 | 223 | }
|
| 153 | 224 | }
|
| 154 | 225 | |
| r14818 | r14819 | |
| 174 | 245 | |
| 175 | 246 | const char * vic10_expansion_slot_device::get_default_card_software(const machine_config &config, emu_options &options)
|
| 176 | 247 | {
|
| 248 | if (open_image_file(options))
|
| 249 | {
|
| 250 | if (!mame_stricmp(filetype(), "crt"))
|
| 251 | {
|
| 252 | return cbm_crt_get_card(m_file);
|
| 253 | }
|
| 254 | |
| 255 | clear();
|
| 256 | }
|
| 257 |
|
| 177 | 258 | return software_get_default_slot(config, options, this, "standard");
|
| 178 | 259 | }
|
| 179 | 260 | |
src/mess/formats/cbm_crt.c
| r14818 | r14819 | |
| 7 | 7 | *********************************************************************/
|
| 8 | 8 | |
| 9 | 9 | #include "formats/cbm_crt.h"
|
| 10 | |
| 11 | |
| 12 | |
| 13 | //**************************************************************************
|
| 14 | // MACROS/CONSTANTS
|
| 15 | //**************************************************************************
|
| 16 | |
| 17 | #define LOG 0
|
| 18 | |
| 19 | |
| 20 | // slot names for the C64 cartridge types
|
| 21 | static const char * CRT_C64_SLOT_NAMES[_CRT_C64_COUNT] =
|
| 22 | {
|
| 23 | "standard",
|
| 24 | UNSUPPORTED,
|
| 25 | UNSUPPORTED,
|
| 26 | UNSUPPORTED,
|
| 27 | "simons_basic",
|
| 28 | "ocean",
|
| 29 | UNSUPPORTED,
|
| 30 | "fun_play",
|
| 31 | "super_games",
|
| 32 | UNSUPPORTED,
|
| 33 | "epyxfastload",
|
| 34 | "westermann",
|
| 35 | "rex",
|
| 36 | UNSUPPORTED,
|
| 37 | "magic_formel",
|
| 38 | "system3",
|
| 39 | "warp_speed",
|
| 40 | "dinamic",
|
| 41 | "zaxxon",
|
| 42 | "magic_desk",
|
| 43 | UNSUPPORTED,
|
| 44 | "comal80",
|
| 45 | "struct_basic",
|
| 46 | "ross",
|
| 47 | "ep64",
|
| 48 | "ep7x8",
|
| 49 | "dela_ep256",
|
| 50 | "rex_ep256",
|
| 51 | "mikroasm",
|
| 52 | UNSUPPORTED,
|
| 53 | UNSUPPORTED,
|
| 54 | "stardos",
|
| 55 | UNSUPPORTED,
|
| 56 | UNSUPPORTED,
|
| 57 | UNSUPPORTED,
|
| 58 | UNSUPPORTED,
|
| 59 | UNSUPPORTED,
|
| 60 | UNSUPPORTED,
|
| 61 | UNSUPPORTED,
|
| 62 | UNSUPPORTED,
|
| 63 | UNSUPPORTED,
|
| 64 | "ieee488",
|
| 65 | UNSUPPORTED,
|
| 66 | UNSUPPORTED,
|
| 67 | "exos",
|
| 68 | UNSUPPORTED,
|
| 69 | UNSUPPORTED,
|
| 70 | UNSUPPORTED,
|
| 71 | "super_explode",
|
| 72 | UNSUPPORTED,
|
| 73 | UNSUPPORTED,
|
| 74 | "mach5",
|
| 75 | UNSUPPORTED,
|
| 76 | "pagefox",
|
| 77 | UNSUPPORTED,
|
| 78 | "silverrock"
|
| 79 | };
|
| 80 | |
| 81 | |
| 82 | |
| 83 | //**************************************************************************
|
| 84 | // IMPLEMENTATION
|
| 85 | //**************************************************************************
|
| 86 | |
| 87 | //-------------------------------------------------
|
| 88 | // cbm_crt_get_card - get slot interface card
|
| 89 | //-------------------------------------------------
|
| 90 | |
| 91 | const char * cbm_crt_get_card(core_file *file)
|
| 92 | {
|
| 93 | // read the header
|
| 94 | cbm_crt_header header;
|
| 95 | core_fread(file, &header, CRT_HEADER_LENGTH);
|
| 96 | |
| 97 | if (memcmp(header.signature, CRT_SIGNATURE, 16) == 0)
|
| 98 | {
|
| 99 | UINT16 hardware = pick_integer_be(header.hardware, 0, 2);
|
| 100 | |
| 101 | return CRT_C64_SLOT_NAMES[hardware];
|
| 102 | }
|
| 103 | |
| 104 | return NULL;
|
| 105 | }
|
| 106 | |
| 107 | |
| 108 | //-------------------------------------------------
|
| 109 | // cbm_crt_read_header - read cartridge header
|
| 110 | //-------------------------------------------------
|
| 111 | |
| 112 | bool cbm_crt_read_header(core_file* file, size_t *roml_size, size_t *romh_size, int *exrom, int *game)
|
| 113 | {
|
| 114 | // read the header
|
| 115 | cbm_crt_header header;
|
| 116 | core_fread(file, &header, CRT_HEADER_LENGTH);
|
| 117 | |
| 118 | if (memcmp(header.signature, CRT_SIGNATURE, 16) != 0)
|
| 119 | return false;
|
| 120 | |
| 121 | UINT16 hardware = pick_integer_be(header.hardware, 0, 2);
|
| 122 | *exrom = header.exrom;
|
| 123 | *game = header.game;
|
| 124 | |
| 125 | if (LOG)
|
| 126 | {
|
| 127 | logerror("Name: %s\n", header.name);
|
| 128 | logerror("Hardware: %04x\n", hardware);
|
| 129 | logerror("Slot device: %s\n", CRT_C64_SLOT_NAMES[hardware]);
|
| 130 | logerror("EXROM: %u\n", header.exrom);
|
| 131 | logerror("GAME: %u\n", header.game);
|
| 132 | }
|
| 133 | |
| 134 | // determine ROM region lengths
|
| 135 | while (!core_feof(file))
|
| 136 | {
|
| 137 | cbm_crt_chip chip;
|
| 138 | core_fread(file, &chip, CRT_CHIP_LENGTH);
|
| 139 | |
| 140 | UINT16 address = pick_integer_be(chip.start_address, 0, 2);
|
| 141 | UINT16 size = pick_integer_be(chip.image_size, 0, 2);
|
| 142 | UINT16 type = pick_integer_be(chip.chip_type, 0, 2);
|
| 143 | |
| 144 | if (LOG)
|
| 145 | {
|
| 146 | logerror("CHIP Address: %04x\n", address);
|
| 147 | logerror("CHIP Size: %04x\n", size);
|
| 148 | logerror("CHIP Type: %04x\n", type);
|
| 149 | }
|
| 150 | |
| 151 | switch (address)
|
| 152 | {
|
| 153 | case 0x8000: *roml_size += size; break;
|
| 154 | case 0xa000: *romh_size += size; break;
|
| 155 | case 0xe000: *romh_size += size; break;
|
| 156 | default: logerror("Invalid CHIP loading address!\n"); break;
|
| 157 | }
|
| 158 | |
| 159 | core_fseek(file, size, SEEK_CUR);
|
| 160 | }
|
| 161 | |
| 162 | return true;
|
| 163 | }
|
| 164 | |
| 165 | |
| 166 | //-------------------------------------------------
|
| 167 | // cbm_crt_read_data - read cartridge data
|
| 168 | //-------------------------------------------------
|
| 169 | |
| 170 | bool cbm_crt_read_data(core_file* file, UINT8 *roml, UINT8 *romh)
|
| 171 | {
|
| 172 | offs_t roml_offset = 0;
|
| 173 | offs_t romh_offset = 0;
|
| 174 | |
| 175 | core_fseek(file, CRT_HEADER_LENGTH, SEEK_SET);
|
| 176 | |
| 177 | while (!core_feof(file))
|
| 178 | {
|
| 179 | cbm_crt_chip chip;
|
| 180 | core_fread(file, &chip, CRT_CHIP_LENGTH);
|
| 181 | |
| 182 | UINT16 address = pick_integer_be(chip.start_address, 0, 2);
|
| 183 | UINT16 size = pick_integer_be(chip.image_size, 0, 2);
|
| 184 | |
| 185 | switch (address)
|
| 186 | {
|
| 187 | case 0x8000: core_fread(file, roml + roml_offset, size); roml_offset += size; break;
|
| 188 | case 0xa000: core_fread(file, romh + romh_offset, size); romh_offset += size; break;
|
| 189 | case 0xe000: core_fread(file, romh + romh_offset, size); romh_offset += size; break;
|
| 190 | }
|
| 191 | }
|
| 192 | |
| 193 | return true;
|
| 194 | }
|