trunk/src/mess/machine/c64_sfx_sound_expander.c
| r21071 | r21072 | |
| 30 | 30 | // ym3526_interface ym3526_config |
| 31 | 31 | //------------------------------------------------- |
| 32 | 32 | |
| 33 | | static const ym3526_interface ym3526_config = |
| 33 | WRITE_LINE_MEMBER( c64_sfx_sound_expander_cartridge_device::opl_irq_w ) |
| 34 | 34 | { |
| 35 | | DEVCB_LINE_MEMBER(c64_sfx_sound_expander_cartridge_device, irq_w) |
| 36 | | }; |
| 37 | | |
| 38 | | |
| 39 | | //------------------------------------------------- |
| 40 | | // C64_EXPANSION_INTERFACE( expansion_intf ) |
| 41 | | //------------------------------------------------- |
| 42 | | |
| 43 | | READ8_MEMBER( c64_sfx_sound_expander_cartridge_device::dma_cd_r ) |
| 44 | | { |
| 45 | | return m_slot->dma_cd_r(offset); |
| 46 | | } |
| 47 | | |
| 48 | | WRITE8_MEMBER( c64_sfx_sound_expander_cartridge_device::dma_cd_w ) |
| 49 | | { |
| 50 | | m_slot->dma_cd_w(offset, data); |
| 51 | | } |
| 52 | | |
| 53 | | WRITE_LINE_MEMBER( c64_sfx_sound_expander_cartridge_device::irq_w ) |
| 54 | | { |
| 55 | 35 | m_slot->irq_w(state); |
| 56 | 36 | } |
| 57 | 37 | |
| 58 | | WRITE_LINE_MEMBER( c64_sfx_sound_expander_cartridge_device::nmi_w ) |
| 38 | static const ym3526_interface ym3526_config = |
| 59 | 39 | { |
| 60 | | m_slot->nmi_w(state); |
| 61 | | } |
| 62 | | |
| 63 | | WRITE_LINE_MEMBER( c64_sfx_sound_expander_cartridge_device::dma_w ) |
| 64 | | { |
| 65 | | m_slot->dma_w(state); |
| 66 | | } |
| 67 | | |
| 68 | | WRITE_LINE_MEMBER( c64_sfx_sound_expander_cartridge_device::reset_w ) |
| 69 | | { |
| 70 | | m_slot->reset_w(state); |
| 71 | | } |
| 72 | | |
| 73 | | static C64_EXPANSION_INTERFACE( expansion_intf ) |
| 74 | | { |
| 75 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_sfx_sound_expander_cartridge_device, dma_cd_r), |
| 76 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_sfx_sound_expander_cartridge_device, dma_cd_w), |
| 77 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sfx_sound_expander_cartridge_device, irq_w), |
| 78 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sfx_sound_expander_cartridge_device, nmi_w), |
| 79 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sfx_sound_expander_cartridge_device, dma_w), |
| 80 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sfx_sound_expander_cartridge_device, reset_w) |
| 40 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sfx_sound_expander_cartridge_device, opl_irq_w) |
| 81 | 41 | }; |
| 82 | 42 | |
| 83 | 43 | |
| r21071 | r21072 | |
| 91 | 51 | MCFG_SOUND_CONFIG(ym3526_config) |
| 92 | 52 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70) |
| 93 | 53 | |
| 94 | | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, 0, expansion_intf, c64_expansion_cards, NULL, NULL) |
| 54 | MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD() |
| 95 | 55 | MACHINE_CONFIG_END |
| 96 | 56 | |
| 97 | 57 | |
trunk/src/mess/machine/c64user.c
| r21071 | r21072 | |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | //------------------------------------------------- |
| 63 | | // c64_user_port_device - destructor |
| 64 | | //------------------------------------------------- |
| 65 | | |
| 66 | | c64_user_port_device::~c64_user_port_device() |
| 67 | | { |
| 68 | | } |
| 69 | | |
| 70 | | |
| 71 | | //------------------------------------------------- |
| 72 | 63 | // device_config_complete - perform any |
| 73 | 64 | // operations now that the configuration is |
| 74 | 65 | // complete |
| r21071 | r21072 | |
| 102 | 93 | |
| 103 | 94 | void c64_user_port_device::device_start() |
| 104 | 95 | { |
| 105 | | m_cart = dynamic_cast<device_c64_user_port_interface *>(get_card_device()); |
| 96 | m_card = dynamic_cast<device_c64_user_port_interface *>(get_card_device()); |
| 106 | 97 | |
| 107 | 98 | // resolve callbacks |
| 108 | 99 | m_out_cnt1_func.resolve(m_out_cnt1_cb, *this); |
| r21071 | r21072 | |
| 120 | 111 | |
| 121 | 112 | void c64_user_port_device::device_reset() |
| 122 | 113 | { |
| 123 | | port_reset_w(ASSERT_LINE); |
| 124 | | port_reset_w(CLEAR_LINE); |
| 114 | if (get_card_device()) |
| 115 | { |
| 116 | get_card_device()->reset(); |
| 117 | } |
| 125 | 118 | } |
| 126 | 119 | |
| 127 | 120 | |
| 128 | | READ8_MEMBER( c64_user_port_device::pb_r ) { UINT8 data = 0xff; if (m_cart != NULL) data = m_cart->c64_pb_r(space, offset); return data; } |
| 129 | | WRITE8_MEMBER( c64_user_port_device::pb_w ) { if (m_cart != NULL) m_cart->c64_pb_w(space, offset, data); } |
| 130 | | READ_LINE_MEMBER( c64_user_port_device::pa2_r ) { int state = 1; if (m_cart != NULL) state = m_cart->c64_pa2_r(); return state; } |
| 131 | | WRITE_LINE_MEMBER( c64_user_port_device::pa2_w ) { if (m_cart != NULL) m_cart->c64_pa2_w(state); } |
| 132 | | WRITE_LINE_MEMBER( c64_user_port_device::pc2_w ) { if (m_cart != NULL) m_cart->c64_pc2_w(state); } |
| 133 | | WRITE_LINE_MEMBER( c64_user_port_device::atn_w ) { if (m_cart != NULL) m_cart->c64_atn_w(state); } |
| 134 | | WRITE_LINE_MEMBER( c64_user_port_device::port_reset_w ) { if (m_cart != NULL) m_cart->c64_reset_w(state); } |
| 135 | | |
| 136 | | WRITE_LINE_MEMBER( c64_user_port_device::cnt1_w ) { m_out_cnt1_func(state); } |
| 137 | | WRITE_LINE_MEMBER( c64_user_port_device::sp1_w ) { m_out_sp1_func(state); } |
| 138 | | WRITE_LINE_MEMBER( c64_user_port_device::cnt2_w ) { m_out_cnt2_func(state); } |
| 139 | | WRITE_LINE_MEMBER( c64_user_port_device::sp2_w ) { m_out_sp2_func(state); } |
| 140 | | WRITE_LINE_MEMBER( c64_user_port_device::flag2_w ) { m_out_flag2_func(state); } |
| 141 | | WRITE_LINE_MEMBER( c64_user_port_device::reset_w ) { m_out_reset_func(state); } |
| 121 | READ8_MEMBER( c64_user_port_device::pb_r ) { UINT8 data = 0xff; if (m_card != NULL) data = m_card->c64_pb_r(space, offset); return data; } |
| 122 | WRITE8_MEMBER( c64_user_port_device::pb_w ) { if (m_card != NULL) m_card->c64_pb_w(space, offset, data); } |
| 123 | READ_LINE_MEMBER( c64_user_port_device::pa2_r ) { int state = 1; if (m_card != NULL) state = m_card->c64_pa2_r(); return state; } |
| 124 | WRITE_LINE_MEMBER( c64_user_port_device::pa2_w ) { if (m_card != NULL) m_card->c64_pa2_w(state); } |
| 125 | WRITE_LINE_MEMBER( c64_user_port_device::pc2_w ) { if (m_card != NULL) m_card->c64_pc2_w(state); } |
| 126 | WRITE_LINE_MEMBER( c64_user_port_device::atn_w ) { if (m_card != NULL) m_card->c64_atn_w(state); } |
trunk/src/mess/machine/c64exp.c
| r21071 | r21072 | |
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | //************************************************************************** |
| 15 | | // MACROS/CONSTANTS |
| 16 | | //************************************************************************** |
| 17 | | |
| 18 | | #define LOG 0 |
| 19 | | |
| 20 | | |
| 21 | | |
| 22 | | //************************************************************************** |
| 23 | 15 | // DEVICE DEFINITIONS |
| 24 | 16 | //************************************************************************** |
| 25 | 17 | |
| r21071 | r21072 | |
| 142 | 134 | c64_expansion_slot_device::c64_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 143 | 135 | device_t(mconfig, C64_EXPANSION_SLOT, "C64 expansion port", tag, owner, clock), |
| 144 | 136 | device_slot_interface(mconfig, *this), |
| 145 | | device_image_interface(mconfig, *this) |
| 137 | device_image_interface(mconfig, *this), |
| 138 | m_read_dma_cd(*this), |
| 139 | m_write_dma_cd(*this), |
| 140 | m_write_irq(*this), |
| 141 | m_write_nmi(*this), |
| 142 | m_write_dma(*this), |
| 143 | m_write_reset(*this) |
| 146 | 144 | { |
| 147 | 145 | } |
| 148 | 146 | |
| 149 | 147 | |
| 150 | 148 | //------------------------------------------------- |
| 151 | | // c64_expansion_slot_device - destructor |
| 152 | | //------------------------------------------------- |
| 153 | | |
| 154 | | c64_expansion_slot_device::~c64_expansion_slot_device() |
| 155 | | { |
| 156 | | } |
| 157 | | |
| 158 | | |
| 159 | | //------------------------------------------------- |
| 160 | | // device_config_complete - perform any |
| 161 | | // operations now that the configuration is |
| 162 | | // complete |
| 163 | | //------------------------------------------------- |
| 164 | | |
| 165 | | void c64_expansion_slot_device::device_config_complete() |
| 166 | | { |
| 167 | | // inherit a copy of the static data |
| 168 | | const c64_expansion_slot_interface *intf = reinterpret_cast<const c64_expansion_slot_interface *>(static_config()); |
| 169 | | if (intf != NULL) |
| 170 | | { |
| 171 | | *static_cast<c64_expansion_slot_interface *>(this) = *intf; |
| 172 | | } |
| 173 | | |
| 174 | | // or initialize to defaults if none provided |
| 175 | | else |
| 176 | | { |
| 177 | | memset(&m_in_dma_cd_cb, 0, sizeof(m_in_dma_cd_cb)); |
| 178 | | memset(&m_out_dma_cd_cb, 0, sizeof(m_out_dma_cd_cb)); |
| 179 | | memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb)); |
| 180 | | memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb)); |
| 181 | | memset(&m_out_dma_cb, 0, sizeof(m_out_dma_cb)); |
| 182 | | memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb)); |
| 183 | | } |
| 184 | | |
| 185 | | // set brief and instance name |
| 186 | | update_names(); |
| 187 | | } |
| 188 | | |
| 189 | | |
| 190 | | //------------------------------------------------- |
| 191 | 149 | // device_start - device-specific startup |
| 192 | 150 | //------------------------------------------------- |
| 193 | 151 | |
| 194 | 152 | void c64_expansion_slot_device::device_start() |
| 195 | 153 | { |
| 196 | | m_cart = dynamic_cast<device_c64_expansion_card_interface *>(get_card_device()); |
| 154 | m_card = dynamic_cast<device_c64_expansion_card_interface *>(get_card_device()); |
| 197 | 155 | |
| 198 | 156 | // resolve callbacks |
| 199 | | m_in_dma_cd_func.resolve(m_in_dma_cd_cb, *this); |
| 200 | | m_out_dma_cd_func.resolve(m_out_dma_cd_cb, *this); |
| 201 | | m_out_irq_func.resolve(m_out_irq_cb, *this); |
| 202 | | m_out_nmi_func.resolve(m_out_nmi_cb, *this); |
| 203 | | m_out_dma_func.resolve(m_out_dma_cb, *this); |
| 204 | | m_out_reset_func.resolve(m_out_reset_cb, *this); |
| 157 | m_read_dma_cd.resolve_safe(0); |
| 158 | m_write_dma_cd.resolve_safe(); |
| 159 | m_write_irq.resolve_safe(); |
| 160 | m_write_nmi.resolve_safe(); |
| 161 | m_write_dma.resolve_safe(); |
| 162 | m_write_reset.resolve_safe(); |
| 205 | 163 | |
| 206 | 164 | // inherit bus clock |
| 207 | 165 | if (clock() == 0) |
| r21071 | r21072 | |
| 219 | 177 | |
| 220 | 178 | void c64_expansion_slot_device::device_reset() |
| 221 | 179 | { |
| 222 | | port_reset_w(ASSERT_LINE); |
| 223 | | port_reset_w(CLEAR_LINE); |
| 180 | if (get_card_device()) |
| 181 | { |
| 182 | get_card_device()->reset(); |
| 183 | } |
| 224 | 184 | } |
| 225 | 185 | |
| 226 | 186 | |
| r21071 | r21072 | |
| 230 | 190 | |
| 231 | 191 | bool c64_expansion_slot_device::call_load() |
| 232 | 192 | { |
| 233 | | if (m_cart) |
| 193 | if (m_card) |
| 234 | 194 | { |
| 235 | 195 | size_t size = 0; |
| 236 | 196 | |
| r21071 | r21072 | |
| 240 | 200 | |
| 241 | 201 | if (!mame_stricmp(filetype(), "80")) |
| 242 | 202 | { |
| 243 | | fread(m_cart->c64_roml_pointer(machine(), size), size); |
| 244 | | m_cart->m_exrom = (0); |
| 203 | fread(m_card->c64_roml_pointer(machine(), size), size); |
| 204 | m_card->m_exrom = (0); |
| 245 | 205 | |
| 246 | 206 | if (size == 0x4000) |
| 247 | 207 | { |
| 248 | | m_cart->m_game = 0; |
| 208 | m_card->m_game = 0; |
| 249 | 209 | } |
| 250 | 210 | } |
| 251 | 211 | else if (!mame_stricmp(filetype(), "a0")) |
| 252 | 212 | { |
| 253 | | fread(m_cart->c64_romh_pointer(machine(), 0x2000), 0x2000); |
| 213 | fread(m_card->c64_romh_pointer(machine(), 0x2000), 0x2000); |
| 254 | 214 | |
| 255 | | m_cart->m_exrom = 0; |
| 256 | | m_cart->m_game = 0; |
| 215 | m_card->m_exrom = 0; |
| 216 | m_card->m_game = 0; |
| 257 | 217 | } |
| 258 | 218 | else if (!mame_stricmp(filetype(), "e0")) |
| 259 | 219 | { |
| 260 | | fread(m_cart->c64_romh_pointer(machine(), 0x2000), 0x2000); |
| 220 | fread(m_card->c64_romh_pointer(machine(), 0x2000), 0x2000); |
| 261 | 221 | |
| 262 | | m_cart->m_game = 0; |
| 222 | m_card->m_game = 0; |
| 263 | 223 | } |
| 264 | 224 | else if (!mame_stricmp(filetype(), "crt")) |
| 265 | 225 | { |
| r21071 | r21072 | |
| 273 | 233 | UINT8 *roml = NULL; |
| 274 | 234 | UINT8 *romh = NULL; |
| 275 | 235 | |
| 276 | | if (roml_size) roml = m_cart->c64_roml_pointer(machine(), roml_size); |
| 277 | | if (romh_size) romh = m_cart->c64_romh_pointer(machine(), romh_size); |
| 236 | if (roml_size) roml = m_card->c64_roml_pointer(machine(), roml_size); |
| 237 | if (romh_size) romh = m_card->c64_romh_pointer(machine(), romh_size); |
| 278 | 238 | |
| 279 | 239 | cbm_crt_read_data(m_file, roml, romh); |
| 280 | 240 | } |
| 281 | 241 | |
| 282 | | m_cart->m_exrom = exrom; |
| 283 | | m_cart->m_game = game; |
| 242 | m_card->m_exrom = exrom; |
| 243 | m_card->m_game = game; |
| 284 | 244 | } |
| 285 | 245 | } |
| 286 | 246 | else |
| r21071 | r21072 | |
| 290 | 250 | if (size) |
| 291 | 251 | { |
| 292 | 252 | // Ultimax (VIC-10) cartridge |
| 293 | | memcpy(m_cart->c64_romh_pointer(machine(), size), get_software_region("uprom"), size); |
| 253 | memcpy(m_card->c64_romh_pointer(machine(), size), get_software_region("uprom"), size); |
| 294 | 254 | |
| 295 | 255 | size = get_software_region_length("lorom"); |
| 296 | | if (size) memcpy(m_cart->c64_roml_pointer(machine(), size), get_software_region("lorom"), size); |
| 256 | if (size) memcpy(m_card->c64_roml_pointer(machine(), size), get_software_region("lorom"), size); |
| 297 | 257 | |
| 298 | | m_cart->m_exrom = 1; |
| 299 | | m_cart->m_game = 0; |
| 258 | m_card->m_exrom = 1; |
| 259 | m_card->m_game = 0; |
| 300 | 260 | } |
| 301 | 261 | else |
| 302 | 262 | { |
| 303 | 263 | // Commodore 64/128 cartridge |
| 304 | 264 | size = get_software_region_length("roml"); |
| 305 | | if (size) memcpy(m_cart->c64_roml_pointer(machine(), size), get_software_region("roml"), size); |
| 265 | if (size) memcpy(m_card->c64_roml_pointer(machine(), size), get_software_region("roml"), size); |
| 306 | 266 | |
| 307 | 267 | size = get_software_region_length("romh"); |
| 308 | | if (size) memcpy(m_cart->c64_romh_pointer(machine(), size), get_software_region("romh"), size); |
| 268 | if (size) memcpy(m_card->c64_romh_pointer(machine(), size), get_software_region("romh"), size); |
| 309 | 269 | |
| 310 | 270 | size = get_software_region_length("ram"); |
| 311 | | if (size) memset(m_cart->c64_ram_pointer(machine(), size), 0, size); |
| 271 | if (size) memset(m_card->c64_ram_pointer(machine(), size), 0, size); |
| 312 | 272 | |
| 313 | 273 | size = get_software_region_length("nvram"); |
| 314 | | if (size) memset(m_cart->c64_nvram_pointer(machine(), size), 0, size); |
| 274 | if (size) memset(m_card->c64_nvram_pointer(machine(), size), 0, size); |
| 315 | 275 | |
| 316 | | if (get_feature("exrom") != NULL) m_cart->m_exrom = atol(get_feature("exrom")); |
| 317 | | if (get_feature("game") != NULL) m_cart->m_game = atol(get_feature("game")); |
| 276 | if (get_feature("exrom") != NULL) m_card->m_exrom = atol(get_feature("exrom")); |
| 277 | if (get_feature("game") != NULL) m_card->m_game = atol(get_feature("game")); |
| 318 | 278 | } |
| 319 | 279 | } |
| 320 | 280 | } |
| r21071 | r21072 | |
| 361 | 321 | |
| 362 | 322 | UINT8 c64_expansion_slot_device::cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) |
| 363 | 323 | { |
| 364 | | if (m_cart != NULL) |
| 324 | if (m_card != NULL) |
| 365 | 325 | { |
| 366 | | data = m_cart->c64_cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2); |
| 326 | data = m_card->c64_cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2); |
| 367 | 327 | } |
| 368 | 328 | |
| 369 | 329 | return data; |
| r21071 | r21072 | |
| 376 | 336 | |
| 377 | 337 | void c64_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) |
| 378 | 338 | { |
| 379 | | if (m_cart != NULL) |
| 339 | if (m_card != NULL) |
| 380 | 340 | { |
| 381 | | m_cart->c64_cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2); |
| 341 | m_card->c64_cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2); |
| 382 | 342 | } |
| 383 | 343 | } |
| 384 | 344 | |
| r21071 | r21072 | |
| 391 | 351 | { |
| 392 | 352 | int state = 1; |
| 393 | 353 | |
| 394 | | if (m_cart != NULL) |
| 354 | if (m_card != NULL) |
| 395 | 355 | { |
| 396 | | state = m_cart->c64_game_r(offset, sphi2, ba, rw, hiram); |
| 356 | state = m_card->c64_game_r(offset, sphi2, ba, rw, hiram); |
| 397 | 357 | } |
| 398 | 358 | |
| 399 | 359 | return state; |
| r21071 | r21072 | |
| 408 | 368 | { |
| 409 | 369 | int state = 1; |
| 410 | 370 | |
| 411 | | if (m_cart != NULL) |
| 371 | if (m_card != NULL) |
| 412 | 372 | { |
| 413 | | state = m_cart->c64_exrom_r(offset, sphi2, ba, rw, hiram); |
| 373 | state = m_card->c64_exrom_r(offset, sphi2, ba, rw, hiram); |
| 414 | 374 | } |
| 415 | 375 | |
| 416 | 376 | return state; |
| 417 | 377 | } |
| 418 | | |
| 419 | | |
| 420 | | WRITE_LINE_MEMBER( c64_expansion_slot_device::port_reset_w ) { if (m_cart != NULL) m_cart->c64_reset_w(state); } |
| 421 | | |
| 422 | | |
| 423 | | //------------------------------------------------- |
| 424 | | // dma_cd_r - DMA read |
| 425 | | //------------------------------------------------- |
| 426 | | |
| 427 | | UINT8 c64_expansion_slot_device::dma_cd_r(offs_t offset) |
| 428 | | { |
| 429 | | return m_in_dma_cd_func(offset); |
| 430 | | } |
| 431 | | |
| 432 | | |
| 433 | | //------------------------------------------------- |
| 434 | | // dma_cd_w - DMA write |
| 435 | | //------------------------------------------------- |
| 436 | | |
| 437 | | void c64_expansion_slot_device::dma_cd_w(offs_t offset, UINT8 data) |
| 438 | | { |
| 439 | | m_out_dma_cd_func(offset, data); |
| 440 | | } |
| 441 | | |
| 442 | | |
| 443 | | WRITE_LINE_MEMBER( c64_expansion_slot_device::irq_w ) { m_out_irq_func(state); } |
| 444 | | WRITE_LINE_MEMBER( c64_expansion_slot_device::nmi_w ) { m_out_nmi_func(state); } |
| 445 | | WRITE_LINE_MEMBER( c64_expansion_slot_device::dma_w ) { m_out_dma_func(state); } |
| 446 | | WRITE_LINE_MEMBER( c64_expansion_slot_device::reset_w ) { m_out_reset_func(state); } |
| 447 | | |
| 448 | | |
| 449 | | //------------------------------------------------- |
| 450 | | // phi2 - system clock frequency |
| 451 | | //------------------------------------------------- |
| 452 | | |
| 453 | | int c64_expansion_slot_device::phi2() |
| 454 | | { |
| 455 | | return clock(); |
| 456 | | } |
| 457 | | |
| 458 | | |
| 459 | | //------------------------------------------------- |
| 460 | | // dotclock - dot clock frequency |
| 461 | | //------------------------------------------------- |
| 462 | | |
| 463 | | int c64_expansion_slot_device::dotclock() |
| 464 | | { |
| 465 | | return phi2() * 8; |
| 466 | | } |
trunk/src/mess/machine/c64exp.h
| r21071 | r21072 | |
| 54 | 54 | // INTERFACE CONFIGURATION MACROS |
| 55 | 55 | //************************************************************************** |
| 56 | 56 | |
| 57 | | #define C64_EXPANSION_INTERFACE(_name) \ |
| 58 | | const c64_expansion_slot_interface (_name) = |
| 59 | | |
| 60 | | |
| 61 | | #define MCFG_C64_EXPANSION_SLOT_ADD(_tag, _clock, _config, _slot_intf, _def_slot, _def_inp) \ |
| 57 | #define MCFG_C64_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot, _def_inp) \ |
| 62 | 58 | MCFG_DEVICE_ADD(_tag, C64_EXPANSION_SLOT, _clock) \ |
| 63 | | MCFG_DEVICE_CONFIG(_config) \ |
| 64 | 59 | MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) |
| 65 | 60 | |
| 61 | #define MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD() \ |
| 62 | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, 0, c64_expansion_cards, NULL, NULL) \ |
| 63 | MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c64_expansion_slot_device, irq_w), DEVWRITELINE(DEVICE_SELF_OWNER, c64_expansion_slot_device, nmi_w), DEVWRITELINE(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)) \ |
| 64 | MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, c64_expansion_slot_device, dma_cd_r), DEVWRITE8(DEVICE_SELF_OWNER, c64_expansion_slot_device, dma_cd_w), DEVWRITELINE(DEVICE_SELF_OWNER, c64_expansion_slot_device, dma_w)) |
| 66 | 65 | |
| 67 | 66 | |
| 67 | #define MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(_irq, _nmi, _reset) \ |
| 68 | downcast<c64_expansion_slot_device *>(device)->set_irq_callbacks(DEVCB2_##_irq, DEVCB2_##_nmi, DEVCB2_##_reset); |
| 69 | |
| 70 | #define MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(_read, _write, _dma) \ |
| 71 | downcast<c64_expansion_slot_device *>(device)->set_dma_callbacks(DEVCB2_##_read, DEVCB2_##_write, DEVCB2_##_dma); |
| 72 | |
| 73 | |
| 74 | |
| 68 | 75 | //************************************************************************** |
| 69 | 76 | // TYPE DEFINITIONS |
| 70 | 77 | //************************************************************************** |
| 71 | 78 | |
| 72 | | // ======================> c64_expansion_slot_interface |
| 73 | | |
| 74 | | struct c64_expansion_slot_interface |
| 75 | | { |
| 76 | | devcb_read8 m_in_dma_cd_cb; |
| 77 | | devcb_write8 m_out_dma_cd_cb; |
| 78 | | devcb_write_line m_out_irq_cb; |
| 79 | | devcb_write_line m_out_nmi_cb; |
| 80 | | devcb_write_line m_out_dma_cb; |
| 81 | | devcb_write_line m_out_reset_cb; |
| 82 | | }; |
| 83 | | |
| 84 | | |
| 85 | 79 | // ======================> c64_expansion_slot_device |
| 86 | 80 | |
| 87 | 81 | class device_c64_expansion_card_interface; |
| 88 | 82 | |
| 89 | 83 | class c64_expansion_slot_device : public device_t, |
| 90 | | public c64_expansion_slot_interface, |
| 91 | 84 | public device_slot_interface, |
| 92 | 85 | public device_image_interface |
| 93 | 86 | { |
| 94 | 87 | public: |
| 95 | 88 | // construction/destruction |
| 96 | 89 | c64_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 97 | | virtual ~c64_expansion_slot_device(); |
| 98 | 90 | |
| 91 | template<class _irq, class _nmi, class _reset> void set_irq_callbacks(_irq irq, _nmi nmi, _reset reset) { |
| 92 | m_write_irq.set_callback(irq); |
| 93 | m_write_dma_cd.set_callback(nmi); |
| 94 | m_write_reset.set_callback(reset); |
| 95 | } |
| 96 | |
| 97 | template<class _read, class _write, class _dma> void set_dma_callbacks(_read read, _write write, _dma dma) { |
| 98 | m_read_dma_cd.set_callback(read); |
| 99 | m_write_dma_cd.set_callback(write); |
| 100 | m_write_dma.set_callback(dma); |
| 101 | } |
| 102 | |
| 99 | 103 | // computer interface |
| 100 | 104 | UINT8 cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2); |
| 101 | 105 | void cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2); |
| 102 | 106 | int game_r(offs_t offset, int sphi2, int ba, int rw, int hiram); |
| 103 | 107 | int exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram); |
| 104 | | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 105 | | DECLARE_WRITE_LINE_MEMBER( port_reset_w ); |
| 106 | 108 | |
| 107 | 109 | // cartridge interface |
| 108 | | UINT8 dma_cd_r(offs_t offset); |
| 109 | | void dma_cd_w(offs_t offset, UINT8 data); |
| 110 | | DECLARE_WRITE_LINE_MEMBER( irq_w ); |
| 111 | | DECLARE_WRITE_LINE_MEMBER( nmi_w ); |
| 112 | | DECLARE_WRITE_LINE_MEMBER( dma_w ); |
| 113 | | DECLARE_WRITE_LINE_MEMBER( reset_w ); |
| 114 | | int phi2(); |
| 115 | | int dotclock(); |
| 110 | DECLARE_READ8_MEMBER( dma_cd_r ) { return m_read_dma_cd(offset); } |
| 111 | DECLARE_WRITE8_MEMBER( dma_cd_w ) { m_write_dma_cd(offset, data); } |
| 112 | DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); } |
| 113 | DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_write_nmi(state); } |
| 114 | DECLARE_WRITE_LINE_MEMBER( dma_w ) { m_write_dma(state); } |
| 115 | DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_write_reset(state); } |
| 116 | int phi2() { return clock(); } |
| 117 | int dotclock() { return phi2() * 8; } |
| 116 | 118 | |
| 117 | 119 | protected: |
| 118 | 120 | // device-level overrides |
| 119 | | virtual void device_config_complete(); |
| 121 | virtual void device_config_complete() { update_names(); } |
| 120 | 122 | virtual void device_start(); |
| 121 | 123 | virtual void device_reset(); |
| 122 | 124 | |
| r21071 | r21072 | |
| 138 | 140 | // slot interface overrides |
| 139 | 141 | virtual const char * get_default_card_software(const machine_config &config, emu_options &options); |
| 140 | 142 | |
| 141 | | devcb_resolved_read8 m_in_dma_cd_func; |
| 142 | | devcb_resolved_write8 m_out_dma_cd_func; |
| 143 | | devcb_resolved_write_line m_out_irq_func; |
| 144 | | devcb_resolved_write_line m_out_nmi_func; |
| 145 | | devcb_resolved_write_line m_out_dma_func; |
| 146 | | devcb_resolved_write_line m_out_reset_func; |
| 143 | devcb2_read8 m_read_dma_cd; |
| 144 | devcb2_write8 m_write_dma_cd; |
| 145 | devcb2_write_line m_write_irq; |
| 146 | devcb2_write_line m_write_nmi; |
| 147 | devcb2_write_line m_write_dma; |
| 148 | devcb2_write_line m_write_reset; |
| 147 | 149 | |
| 148 | | device_c64_expansion_card_interface *m_cart; |
| 150 | device_c64_expansion_card_interface *m_card; |
| 149 | 151 | }; |
| 150 | 152 | |
| 151 | 153 | |
| r21071 | r21072 | |
| 172 | 174 | 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) { }; |
| 173 | 175 | virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram) { return m_game; } |
| 174 | 176 | virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram) { return m_exrom; } |
| 175 | | virtual void c64_reset_w(int state) { }; |
| 176 | 177 | |
| 177 | 178 | c64_expansion_slot_device *m_slot; |
| 178 | 179 | |
trunk/src/mess/machine/c1571.c
| r21071 | r21072 | |
| 771 | 771 | |
| 772 | 772 | MCFG_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, via0_intf) |
| 773 | 773 | MCFG_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, via1_intf) |
| 774 | | MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_irq_w)) |
| 775 | | MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_sp_w)) |
| 776 | | MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, c1571_device, cia_pb_r), DEVWRITE8(DEVICE_SELF_OWNER, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_pc_w)) |
| 774 | MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF, c1571_device, cia_irq_w)) |
| 775 | MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF, c1571_device, cia_sp_w)) |
| 776 | MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, c1571_device, cia_pb_r), DEVWRITE8(DEVICE_SELF, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF, c1571_device, cia_pc_w)) |
| 777 | 777 | MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2) |
| 778 | 778 | |
| 779 | 779 | MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1570_floppy_interface) |
| r21071 | r21072 | |
| 793 | 793 | |
| 794 | 794 | MCFG_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, via0_intf) |
| 795 | 795 | MCFG_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, via1_intf) |
| 796 | | |
| 797 | | MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_irq_w)) |
| 798 | | MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_sp_w)) |
| 799 | | MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, c1571_device, cia_pb_r), DEVWRITE8(DEVICE_SELF_OWNER, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_pc_w)) |
| 800 | | |
| 796 | MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF, c1571_device, cia_irq_w)) |
| 797 | MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF, c1571_device, cia_sp_w)) |
| 798 | MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, c1571_device, cia_pb_r), DEVWRITE8(DEVICE_SELF, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF, c1571_device, cia_pc_w)) |
| 801 | 799 | MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2) |
| 802 | 800 | |
| 803 | 801 | MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_interface) |
| r21071 | r21072 | |
| 839 | 837 | |
| 840 | 838 | MCFG_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, via0_intf) |
| 841 | 839 | MCFG_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, via1_intf) |
| 842 | | |
| 843 | | MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_irq_w)) |
| 844 | | MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_sp_w)) |
| 845 | | MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, mini_chief_device, cia_pa_r), DEVWRITE8(DEVICE_SELF_OWNER, mini_chief_device, cia_pa_w)) |
| 846 | | MCFG_MOS6526_PORT_B_CALLBACKS(NULL, DEVWRITE8(DEVICE_SELF_OWNER, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_pc_w)) |
| 847 | | |
| 840 | MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF, c1571_device, cia_irq_w)) |
| 841 | MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF, c1571_device, cia_sp_w)) |
| 842 | MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, c1571_device, cia_pb_r), DEVWRITE8(DEVICE_SELF, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF, c1571_device, cia_pc_w)) |
| 848 | 843 | MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2) |
| 849 | 844 | |
| 850 | 845 | MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_interface) |
trunk/src/mess/machine/c64_supercpu.c
| r21071 | r21072 | |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | //------------------------------------------------- |
| 60 | | // C64_EXPANSION_INTERFACE( expansion_intf ) |
| 61 | | //------------------------------------------------- |
| 62 | | |
| 63 | | READ8_MEMBER( c64_supercpu_device::dma_cd_r ) |
| 64 | | { |
| 65 | | return m_slot->dma_cd_r(offset); |
| 66 | | } |
| 67 | | |
| 68 | | WRITE8_MEMBER( c64_supercpu_device::dma_cd_w ) |
| 69 | | { |
| 70 | | m_slot->dma_cd_w(offset, data); |
| 71 | | } |
| 72 | | |
| 73 | | WRITE_LINE_MEMBER( c64_supercpu_device::irq_w ) |
| 74 | | { |
| 75 | | m_slot->irq_w(state); |
| 76 | | } |
| 77 | | |
| 78 | | WRITE_LINE_MEMBER( c64_supercpu_device::nmi_w ) |
| 79 | | { |
| 80 | | m_slot->nmi_w(state); |
| 81 | | } |
| 82 | | |
| 83 | | WRITE_LINE_MEMBER( c64_supercpu_device::dma_w ) |
| 84 | | { |
| 85 | | m_slot->dma_w(state); |
| 86 | | } |
| 87 | | |
| 88 | | WRITE_LINE_MEMBER( c64_supercpu_device::reset_w ) |
| 89 | | { |
| 90 | | m_slot->reset_w(state); |
| 91 | | } |
| 92 | | |
| 93 | | static C64_EXPANSION_INTERFACE( expansion_intf ) |
| 94 | | { |
| 95 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, dma_cd_r), |
| 96 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, dma_cd_w), |
| 97 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, irq_w), |
| 98 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, nmi_w), |
| 99 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, dma_w), |
| 100 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_supercpu_device, reset_w) |
| 101 | | }; |
| 102 | | |
| 103 | | |
| 104 | | //------------------------------------------------- |
| 105 | 60 | // MACHINE_CONFIG_FRAGMENT( c64_supercpu ) |
| 106 | 61 | //------------------------------------------------- |
| 107 | 62 | |
| r21071 | r21072 | |
| 109 | 64 | MCFG_CPU_ADD(G65816_TAG, G65816, 1000000) |
| 110 | 65 | MCFG_CPU_PROGRAM_MAP(c64_supercpu_map) |
| 111 | 66 | |
| 112 | | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, 0, expansion_intf, c64_expansion_cards, NULL, NULL) |
| 67 | MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD() |
| 113 | 68 | MACHINE_CONFIG_END |
| 114 | 69 | |
| 115 | 70 | |
| r21071 | r21072 | |
| 128 | 83 | // INPUT_PORTS( c64_supercpu ) |
| 129 | 84 | //------------------------------------------------- |
| 130 | 85 | |
| 131 | | INPUT_CHANGED_MEMBER( c64_supercpu_device::reset ) |
| 132 | | { |
| 133 | | if (!newval) |
| 134 | | { |
| 135 | | device_reset(); |
| 136 | | } |
| 137 | | |
| 138 | | m_slot->reset_w(newval ? CLEAR_LINE : ASSERT_LINE); |
| 139 | | } |
| 140 | | |
| 141 | 86 | static INPUT_PORTS_START( c64_supercpu ) |
| 142 | 87 | PORT_START("FRONT") |
| 143 | 88 | PORT_DIPNAME( 0x01, 0x01, "Unit" ) |
| r21071 | r21072 | |
| 151 | 96 | PORT_DIPSETTING( 0x00, "Turbo" ) |
| 152 | 97 | |
| 153 | 98 | PORT_START("RESET") |
| 154 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_CHANGED_MEMBER(DEVICE_SELF, c64_supercpu_device, reset, 0) |
| 99 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w) |
| 155 | 100 | INPUT_PORTS_END |
| 156 | 101 | |
| 157 | 102 | |
| r21071 | r21072 | |
| 165 | 110 | } |
| 166 | 111 | |
| 167 | 112 | |
| 113 | |
| 168 | 114 | //************************************************************************** |
| 169 | 115 | // LIVE DEVICE |
| 170 | 116 | //************************************************************************** |
trunk/src/mess/machine/vic10exp.c
| r21071 | r21072 | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | //************************************************************************** |
| 19 | | // GLOBAL VARIABLES |
| 19 | // DEVICE DEFINITIONS |
| 20 | 20 | //************************************************************************** |
| 21 | 21 | |
| 22 | 22 | const device_type VIC10_EXPANSION_SLOT = &device_creator<vic10_expansion_slot_device>; |
| r21071 | r21072 | |
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | //------------------------------------------------- |
| 117 | | // vic10_expansion_slot_device - destructor |
| 118 | | //------------------------------------------------- |
| 119 | | |
| 120 | | vic10_expansion_slot_device::~vic10_expansion_slot_device() |
| 121 | | { |
| 122 | | } |
| 123 | | |
| 124 | | |
| 125 | | //------------------------------------------------- |
| 126 | 117 | // device_config_complete - perform any |
| 127 | 118 | // operations now that the configuration is |
| 128 | 119 | // complete |
| r21071 | r21072 | |
| 157 | 148 | |
| 158 | 149 | void vic10_expansion_slot_device::device_start() |
| 159 | 150 | { |
| 160 | | m_cart = dynamic_cast<device_vic10_expansion_card_interface *>(get_card_device()); |
| 151 | m_card = dynamic_cast<device_vic10_expansion_card_interface *>(get_card_device()); |
| 161 | 152 | |
| 162 | 153 | // resolve callbacks |
| 163 | 154 | m_out_irq_func.resolve(m_out_irq_cb, *this); |
| r21071 | r21072 | |
| 181 | 172 | |
| 182 | 173 | void vic10_expansion_slot_device::device_reset() |
| 183 | 174 | { |
| 184 | | res_w(ASSERT_LINE); |
| 185 | | res_w(CLEAR_LINE); |
| 175 | if (get_card_device()) |
| 176 | { |
| 177 | get_card_device()->reset(); |
| 178 | } |
| 186 | 179 | } |
| 187 | 180 | |
| 188 | 181 | |
| r21071 | r21072 | |
| 192 | 185 | |
| 193 | 186 | bool vic10_expansion_slot_device::call_load() |
| 194 | 187 | { |
| 195 | | if (m_cart) |
| 188 | if (m_card) |
| 196 | 189 | { |
| 197 | 190 | size_t size = 0; |
| 198 | 191 | |
| r21071 | r21072 | |
| 202 | 195 | |
| 203 | 196 | if (!mame_stricmp(filetype(), "80")) |
| 204 | 197 | { |
| 205 | | fread(m_cart->vic10_lorom_pointer(machine(), 0x2000), 0x2000); |
| 198 | fread(m_card->vic10_lorom_pointer(machine(), 0x2000), 0x2000); |
| 206 | 199 | |
| 207 | 200 | if (size == 0x4000) |
| 208 | 201 | { |
| 209 | | fread(m_cart->vic10_uprom_pointer(machine(), 0x2000), 0x2000); |
| 202 | fread(m_card->vic10_uprom_pointer(machine(), 0x2000), 0x2000); |
| 210 | 203 | } |
| 211 | 204 | } |
| 212 | | else if (!mame_stricmp(filetype(), "e0")) fread(m_cart->vic10_uprom_pointer(machine(), size), size); |
| 205 | else if (!mame_stricmp(filetype(), "e0")) fread(m_card->vic10_uprom_pointer(machine(), size), size); |
| 213 | 206 | else if (!mame_stricmp(filetype(), "crt")) |
| 214 | 207 | { |
| 215 | 208 | size_t roml_size = 0; |
| r21071 | r21072 | |
| 222 | 215 | UINT8 *roml = NULL; |
| 223 | 216 | UINT8 *romh = NULL; |
| 224 | 217 | |
| 225 | | if (roml_size) roml = m_cart->vic10_lorom_pointer(machine(), roml_size); |
| 226 | | if (romh_size) romh = m_cart->vic10_uprom_pointer(machine(), romh_size); |
| 218 | if (roml_size) roml = m_card->vic10_lorom_pointer(machine(), roml_size); |
| 219 | if (romh_size) romh = m_card->vic10_uprom_pointer(machine(), romh_size); |
| 227 | 220 | |
| 228 | 221 | cbm_crt_read_data(m_file, roml, romh); |
| 229 | 222 | } |
| r21071 | r21072 | |
| 232 | 225 | else |
| 233 | 226 | { |
| 234 | 227 | size = get_software_region_length("lorom"); |
| 235 | | if (size) memcpy(m_cart->vic10_lorom_pointer(machine(), size), get_software_region("lorom"), size); |
| 228 | if (size) memcpy(m_card->vic10_lorom_pointer(machine(), size), get_software_region("lorom"), size); |
| 236 | 229 | |
| 237 | 230 | size = get_software_region_length("uprom"); |
| 238 | | if (size) memcpy(m_cart->vic10_uprom_pointer(machine(), size), get_software_region("uprom"), size); |
| 231 | if (size) memcpy(m_card->vic10_uprom_pointer(machine(), size), get_software_region("uprom"), size); |
| 239 | 232 | |
| 240 | 233 | size = get_software_region_length("exram"); |
| 241 | | if (size) m_cart->vic10_exram_pointer(machine(), size); |
| 234 | if (size) m_card->vic10_exram_pointer(machine(), size); |
| 242 | 235 | } |
| 243 | 236 | } |
| 244 | 237 | |
| r21071 | r21072 | |
| 284 | 277 | |
| 285 | 278 | UINT8 vic10_expansion_slot_device::cd_r(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram) |
| 286 | 279 | { |
| 287 | | if (m_cart != NULL) |
| 280 | if (m_card != NULL) |
| 288 | 281 | { |
| 289 | | data = m_cart->vic10_cd_r(space, offset, data, lorom, uprom, exram); |
| 282 | data = m_card->vic10_cd_r(space, offset, data, lorom, uprom, exram); |
| 290 | 283 | } |
| 291 | 284 | |
| 292 | 285 | return data; |
| r21071 | r21072 | |
| 299 | 292 | |
| 300 | 293 | void vic10_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram) |
| 301 | 294 | { |
| 302 | | if (m_cart != NULL) |
| 295 | if (m_card != NULL) |
| 303 | 296 | { |
| 304 | | m_cart->vic10_cd_w(space, offset, data, lorom, uprom, exram); |
| 297 | m_card->vic10_cd_w(space, offset, data, lorom, uprom, exram); |
| 305 | 298 | } |
| 306 | 299 | } |
| 307 | 300 | |
| 308 | | WRITE_LINE_MEMBER( vic10_expansion_slot_device::port_res_w ) { if (m_cart != NULL) m_cart->vic10_res_w(state); } |
| 309 | | |
| 310 | | READ_LINE_MEMBER( vic10_expansion_slot_device::p0_r ) { int state = 0; if (m_cart != NULL) state = m_cart->vic10_p0_r(); return state; } |
| 311 | | WRITE_LINE_MEMBER( vic10_expansion_slot_device::p0_w ) { if (m_cart != NULL) m_cart->vic10_p0_w(state); } |
| 301 | READ_LINE_MEMBER( vic10_expansion_slot_device::p0_r ) { int state = 0; if (m_card != NULL) state = m_card->vic10_p0_r(); return state; } |
| 302 | WRITE_LINE_MEMBER( vic10_expansion_slot_device::p0_w ) { if (m_card != NULL) m_card->vic10_p0_w(state); } |
| 312 | 303 | WRITE_LINE_MEMBER( vic10_expansion_slot_device::irq_w ) { m_out_irq_func(state); } |
| 313 | | WRITE_LINE_MEMBER( vic10_expansion_slot_device::sp_w ) { m_out_sp_func(state); if (m_cart != NULL) m_cart->vic10_sp_w(state); } |
| 314 | | WRITE_LINE_MEMBER( vic10_expansion_slot_device::cnt_w ) { m_out_cnt_func(state); if (m_cart != NULL) m_cart->vic10_cnt_w(state); } |
| 304 | WRITE_LINE_MEMBER( vic10_expansion_slot_device::sp_w ) { m_out_sp_func(state); if (m_card != NULL) m_card->vic10_sp_w(state); } |
| 305 | WRITE_LINE_MEMBER( vic10_expansion_slot_device::cnt_w ) { m_out_cnt_func(state); if (m_card != NULL) m_card->vic10_cnt_w(state); } |
| 315 | 306 | WRITE_LINE_MEMBER( vic10_expansion_slot_device::res_w ) { m_out_res_func(state); } |
trunk/src/mess/machine/plus4exp.c
| r21071 | r21072 | |
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | //------------------------------------------------- |
| 187 | | // plus4_expansion_slot_device - destructor |
| 188 | | //------------------------------------------------- |
| 189 | | |
| 190 | | plus4_expansion_slot_device::~plus4_expansion_slot_device() |
| 191 | | { |
| 192 | | } |
| 193 | | |
| 194 | | |
| 195 | | //------------------------------------------------- |
| 196 | 187 | // device_config_complete - perform any |
| 197 | 188 | // operations now that the configuration is |
| 198 | 189 | // complete |
| r21071 | r21072 | |
| 227 | 218 | |
| 228 | 219 | void plus4_expansion_slot_device::device_start() |
| 229 | 220 | { |
| 230 | | m_cart = dynamic_cast<device_plus4_expansion_card_interface *>(get_card_device()); |
| 221 | m_card = dynamic_cast<device_plus4_expansion_card_interface *>(get_card_device()); |
| 231 | 222 | |
| 232 | 223 | // resolve callbacks |
| 233 | 224 | m_in_dma_cd_func.resolve(m_in_dma_cd_cb, *this); |
| r21071 | r21072 | |
| 251 | 242 | |
| 252 | 243 | void plus4_expansion_slot_device::device_reset() |
| 253 | 244 | { |
| 254 | | breset_w(ASSERT_LINE); |
| 255 | | breset_w(CLEAR_LINE); |
| 245 | if (get_card_device()) |
| 246 | { |
| 247 | get_card_device()->reset(); |
| 248 | } |
| 256 | 249 | } |
| 257 | 250 | |
| 258 | 251 | |
| r21071 | r21072 | |
| 262 | 255 | |
| 263 | 256 | bool plus4_expansion_slot_device::call_load() |
| 264 | 257 | { |
| 265 | | if (m_cart) |
| 258 | if (m_card) |
| 266 | 259 | { |
| 267 | 260 | size_t size = 0; |
| 268 | 261 | |
| r21071 | r21072 | |
| 273 | 266 | else |
| 274 | 267 | { |
| 275 | 268 | size = get_software_region_length("c1l"); |
| 276 | | if (size) memcpy(m_cart->plus4_c1l_pointer(machine(), size), get_software_region("c1l"), size); |
| 269 | if (size) memcpy(m_card->plus4_c1l_pointer(machine(), size), get_software_region("c1l"), size); |
| 277 | 270 | |
| 278 | 271 | size = get_software_region_length("c1h"); |
| 279 | | if (size) memcpy(m_cart->plus4_c1h_pointer(machine(), size), get_software_region("c1h"), size); |
| 272 | if (size) memcpy(m_card->plus4_c1h_pointer(machine(), size), get_software_region("c1h"), size); |
| 280 | 273 | |
| 281 | 274 | size = get_software_region_length("c2l"); |
| 282 | | if (size) memcpy(m_cart->plus4_c2l_pointer(machine(), size), get_software_region("c2l"), size); |
| 275 | if (size) memcpy(m_card->plus4_c2l_pointer(machine(), size), get_software_region("c2l"), size); |
| 283 | 276 | |
| 284 | 277 | size = get_software_region_length("c2h"); |
| 285 | | if (size) memcpy(m_cart->plus4_c2h_pointer(machine(), size), get_software_region("c2h"), size); |
| 278 | if (size) memcpy(m_card->plus4_c2h_pointer(machine(), size), get_software_region("c2h"), size); |
| 286 | 279 | |
| 287 | 280 | size = get_software_region_length("ram"); |
| 288 | | if (size) memset(m_cart->plus4_ram_pointer(machine(), size), 0, size); |
| 281 | if (size) memset(m_card->plus4_ram_pointer(machine(), size), 0, size); |
| 289 | 282 | |
| 290 | 283 | size = get_software_region_length("nvram"); |
| 291 | | if (size) memset(m_cart->plus4_nvram_pointer(machine(), size), 0, size); |
| 284 | if (size) memset(m_card->plus4_nvram_pointer(machine(), size), 0, size); |
| 292 | 285 | } |
| 293 | 286 | } |
| 294 | 287 | |
| r21071 | r21072 | |
| 324 | 317 | |
| 325 | 318 | UINT8 plus4_expansion_slot_device::cd_r(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) |
| 326 | 319 | { |
| 327 | | if (m_cart != NULL) |
| 320 | if (m_card != NULL) |
| 328 | 321 | { |
| 329 | | data = m_cart->plus4_cd_r(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h); |
| 322 | data = m_card->plus4_cd_r(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h); |
| 330 | 323 | } |
| 331 | 324 | |
| 332 | 325 | return data; |
| r21071 | r21072 | |
| 339 | 332 | |
| 340 | 333 | void plus4_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) |
| 341 | 334 | { |
| 342 | | if (m_cart != NULL) |
| 335 | if (m_card != NULL) |
| 343 | 336 | { |
| 344 | | m_cart->plus4_cd_w(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h); |
| 337 | m_card->plus4_cd_w(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h); |
| 345 | 338 | } |
| 346 | 339 | } |
| 347 | | |
| 348 | | |
| 349 | | //------------------------------------------------- |
| 350 | | // breset_w - buffered reset write |
| 351 | | //------------------------------------------------- |
| 352 | | |
| 353 | | WRITE_LINE_MEMBER( plus4_expansion_slot_device::breset_w ) |
| 354 | | { |
| 355 | | if (m_cart != NULL) |
| 356 | | { |
| 357 | | m_cart->plus4_breset_w(state); |
| 358 | | } |
| 359 | | } |
| 360 | | |
| 361 | | |
| 362 | | //------------------------------------------------- |
| 363 | | // dma_cd_r - DMA read |
| 364 | | //------------------------------------------------- |
| 365 | | |
| 366 | | UINT8 plus4_expansion_slot_device::dma_cd_r(offs_t offset) |
| 367 | | { |
| 368 | | return m_in_dma_cd_func(offset); |
| 369 | | } |
| 370 | | |
| 371 | | |
| 372 | | //------------------------------------------------- |
| 373 | | // dma_cd_w - DMA write |
| 374 | | //------------------------------------------------- |
| 375 | | |
| 376 | | void plus4_expansion_slot_device::dma_cd_w(offs_t offset, UINT8 data) |
| 377 | | { |
| 378 | | m_out_dma_cd_func(offset, data); |
| 379 | | } |
| 380 | | |
| 381 | | |
| 382 | | WRITE_LINE_MEMBER( plus4_expansion_slot_device::irq_w ) { m_out_irq_func(state); } |
| 383 | | WRITE_LINE_MEMBER( plus4_expansion_slot_device::aec_w ) { m_out_aec_func(state); } |
| 384 | | |
| 385 | | |
| 386 | | //------------------------------------------------- |
| 387 | | // phi2 - system clock frequency |
| 388 | | //------------------------------------------------- |
| 389 | | |
| 390 | | int plus4_expansion_slot_device::phi2() |
| 391 | | { |
| 392 | | return clock(); |
| 393 | | } |
trunk/src/mess/machine/plus4exp.h
| r21071 | r21072 | |
| 94 | 94 | public: |
| 95 | 95 | // construction/destruction |
| 96 | 96 | plus4_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 97 | | virtual ~plus4_expansion_slot_device(); |
| 98 | 97 | |
| 99 | 98 | // computer interface |
| 100 | 99 | UINT8 cd_r(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h); |
| 101 | 100 | void cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h); |
| 102 | 101 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 103 | | DECLARE_WRITE_LINE_MEMBER( breset_w ); |
| 104 | 102 | |
| 105 | 103 | // cartridge interface |
| 106 | | UINT8 dma_cd_r(offs_t offset); |
| 107 | | void dma_cd_w(offs_t offset, UINT8 data); |
| 108 | | DECLARE_WRITE_LINE_MEMBER( irq_w ); |
| 109 | | DECLARE_WRITE_LINE_MEMBER( aec_w ); |
| 110 | | int phi2(); |
| 111 | | int dotclock(); |
| 104 | DECLARE_READ8_MEMBER( dma_cd_r ) { return m_in_dma_cd_func(offset); } |
| 105 | DECLARE_WRITE8_MEMBER( dma_cd_w ) { m_out_dma_cd_func(offset, data); } |
| 106 | DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_out_irq_func(state); } |
| 107 | DECLARE_WRITE_LINE_MEMBER( aec_w ) { m_out_aec_func(state); } |
| 108 | int phi2() { return clock(); } |
| 112 | 109 | |
| 113 | 110 | protected: |
| 114 | 111 | // device-level overrides |
| r21071 | r21072 | |
| 139 | 136 | devcb_resolved_write_line m_out_irq_func; |
| 140 | 137 | devcb_resolved_write_line m_out_aec_func; |
| 141 | 138 | |
| 142 | | device_plus4_expansion_card_interface *m_cart; |
| 139 | device_plus4_expansion_card_interface *m_card; |
| 143 | 140 | }; |
| 144 | 141 | |
| 145 | 142 | |
| r21071 | r21072 | |
| 165 | 162 | // runtime |
| 166 | 163 | virtual UINT8 plus4_cd_r(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) { return data; }; |
| 167 | 164 | virtual void plus4_cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) { }; |
| 168 | | virtual void plus4_breset_w(int state) { }; |
| 169 | 165 | |
| 170 | 166 | protected: |
| 171 | 167 | plus4_expansion_slot_device *m_slot; |
trunk/src/mess/machine/vic20exp.c
| r21071 | r21072 | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | //************************************************************************** |
| 19 | | // MACROS/CONSTANTS |
| 19 | // DEVICE DEFINITIONS |
| 20 | 20 | //************************************************************************** |
| 21 | 21 | |
| 22 | | #define LOG 0 |
| 23 | | |
| 24 | | |
| 25 | | |
| 26 | | //************************************************************************** |
| 27 | | // GLOBAL VARIABLES |
| 28 | | //************************************************************************** |
| 29 | | |
| 30 | 22 | const device_type VIC20_EXPANSION_SLOT = &device_creator<vic20_expansion_slot_device>; |
| 31 | 23 | |
| 32 | 24 | |
| r21071 | r21072 | |
| 172 | 164 | |
| 173 | 165 | |
| 174 | 166 | //------------------------------------------------- |
| 175 | | // vic20_expansion_slot_device - destructor |
| 176 | | //------------------------------------------------- |
| 177 | | |
| 178 | | vic20_expansion_slot_device::~vic20_expansion_slot_device() |
| 179 | | { |
| 180 | | } |
| 181 | | |
| 182 | | |
| 183 | | //------------------------------------------------- |
| 184 | 167 | // device_config_complete - perform any |
| 185 | 168 | // operations now that the configuration is |
| 186 | 169 | // complete |
| r21071 | r21072 | |
| 214 | 197 | |
| 215 | 198 | void vic20_expansion_slot_device::device_start() |
| 216 | 199 | { |
| 217 | | m_cart = dynamic_cast<device_vic20_expansion_card_interface *>(get_card_device()); |
| 200 | m_card = dynamic_cast<device_vic20_expansion_card_interface *>(get_card_device()); |
| 218 | 201 | |
| 219 | 202 | // resolve callbacks |
| 220 | 203 | m_out_irq_func.resolve(m_out_irq_cb, *this); |
| r21071 | r21072 | |
| 237 | 220 | |
| 238 | 221 | void vic20_expansion_slot_device::device_reset() |
| 239 | 222 | { |
| 240 | | port_res_w(ASSERT_LINE); |
| 241 | | port_res_w(CLEAR_LINE); |
| 223 | if (get_card_device()) |
| 224 | { |
| 225 | get_card_device()->reset(); |
| 226 | } |
| 242 | 227 | } |
| 243 | 228 | |
| 244 | 229 | |
| r21071 | r21072 | |
| 248 | 233 | |
| 249 | 234 | bool vic20_expansion_slot_device::call_load() |
| 250 | 235 | { |
| 251 | | if (m_cart) |
| 236 | if (m_card) |
| 252 | 237 | { |
| 253 | 238 | size_t size = 0; |
| 254 | 239 | |
| 255 | 240 | if (software_entry() == NULL) |
| 256 | 241 | { |
| 257 | | if (!mame_stricmp(filetype(), "20")) fread(m_cart->vic20_blk1_pointer(machine(), 0x2000), 0x2000); |
| 258 | | else if (!mame_stricmp(filetype(), "40")) fread(m_cart->vic20_blk2_pointer(machine(), 0x2000), 0x2000); |
| 259 | | else if (!mame_stricmp(filetype(), "60")) fread(m_cart->vic20_blk3_pointer(machine(), 0x2000), 0x2000); |
| 260 | | else if (!mame_stricmp(filetype(), "70")) fread(m_cart->vic20_blk3_pointer(machine(), 0x2000) + 0x1000, 0x1000); |
| 261 | | else if (!mame_stricmp(filetype(), "a0")) fread(m_cart->vic20_blk5_pointer(machine(), 0x2000), 0x2000); |
| 262 | | else if (!mame_stricmp(filetype(), "b0")) fread(m_cart->vic20_blk5_pointer(machine(), 0x2000) + 0x1000, 0x1000); |
| 242 | if (!mame_stricmp(filetype(), "20")) fread(m_card->vic20_blk1_pointer(machine(), 0x2000), 0x2000); |
| 243 | else if (!mame_stricmp(filetype(), "40")) fread(m_card->vic20_blk2_pointer(machine(), 0x2000), 0x2000); |
| 244 | else if (!mame_stricmp(filetype(), "60")) fread(m_card->vic20_blk3_pointer(machine(), 0x2000), 0x2000); |
| 245 | else if (!mame_stricmp(filetype(), "70")) fread(m_card->vic20_blk3_pointer(machine(), 0x2000) + 0x1000, 0x1000); |
| 246 | else if (!mame_stricmp(filetype(), "a0")) fread(m_card->vic20_blk5_pointer(machine(), 0x2000), 0x2000); |
| 247 | else if (!mame_stricmp(filetype(), "b0")) fread(m_card->vic20_blk5_pointer(machine(), 0x2000) + 0x1000, 0x1000); |
| 263 | 248 | else if (!mame_stricmp(filetype(), "crt")) |
| 264 | 249 | { |
| 265 | 250 | // read the header |
| r21071 | r21072 | |
| 267 | 252 | fread(&header, 2); |
| 268 | 253 | UINT16 address = pick_integer_le(header, 0, 2); |
| 269 | 254 | |
| 270 | | if (LOG) logerror("Address %04x\n", address); |
| 271 | | |
| 272 | 255 | switch (address) |
| 273 | 256 | { |
| 274 | | case 0x2000: fread(m_cart->vic20_blk1_pointer(machine(), 0x2000), 0x2000); break; |
| 275 | | case 0x4000: fread(m_cart->vic20_blk2_pointer(machine(), 0x2000), 0x2000); break; |
| 276 | | case 0x6000: fread(m_cart->vic20_blk3_pointer(machine(), 0x2000), 0x2000); break; |
| 277 | | case 0x7000: fread(m_cart->vic20_blk3_pointer(machine(), 0x2000) + 0x1000, 0x1000); break; |
| 278 | | case 0xa000: fread(m_cart->vic20_blk5_pointer(machine(), 0x2000), 0x2000); break; |
| 279 | | case 0xb000: fread(m_cart->vic20_blk5_pointer(machine(), 0x2000) + 0x1000, 0x1000); break; |
| 257 | case 0x2000: fread(m_card->vic20_blk1_pointer(machine(), 0x2000), 0x2000); break; |
| 258 | case 0x4000: fread(m_card->vic20_blk2_pointer(machine(), 0x2000), 0x2000); break; |
| 259 | case 0x6000: fread(m_card->vic20_blk3_pointer(machine(), 0x2000), 0x2000); break; |
| 260 | case 0x7000: fread(m_card->vic20_blk3_pointer(machine(), 0x2000) + 0x1000, 0x1000); break; |
| 261 | case 0xa000: fread(m_card->vic20_blk5_pointer(machine(), 0x2000), 0x2000); break; |
| 262 | case 0xb000: fread(m_card->vic20_blk5_pointer(machine(), 0x2000) + 0x1000, 0x1000); break; |
| 280 | 263 | default: return IMAGE_INIT_FAIL; |
| 281 | 264 | } |
| 282 | 265 | } |
| r21071 | r21072 | |
| 284 | 267 | else |
| 285 | 268 | { |
| 286 | 269 | size = get_software_region_length("blk1"); |
| 287 | | if (size) memcpy(m_cart->vic20_blk1_pointer(machine(), size), get_software_region("blk1"), size); |
| 270 | if (size) memcpy(m_card->vic20_blk1_pointer(machine(), size), get_software_region("blk1"), size); |
| 288 | 271 | |
| 289 | 272 | size = get_software_region_length("blk2"); |
| 290 | | if (size) memcpy(m_cart->vic20_blk2_pointer(machine(), size), get_software_region("blk2"), size); |
| 273 | if (size) memcpy(m_card->vic20_blk2_pointer(machine(), size), get_software_region("blk2"), size); |
| 291 | 274 | |
| 292 | 275 | size = get_software_region_length("blk3"); |
| 293 | | if (size) memcpy(m_cart->vic20_blk3_pointer(machine(), size), get_software_region("blk3"), size); |
| 276 | if (size) memcpy(m_card->vic20_blk3_pointer(machine(), size), get_software_region("blk3"), size); |
| 294 | 277 | |
| 295 | 278 | size = get_software_region_length("blk5"); |
| 296 | | if (size) memcpy(m_cart->vic20_blk5_pointer(machine(), size), get_software_region("blk5"), size); |
| 279 | if (size) memcpy(m_card->vic20_blk5_pointer(machine(), size), get_software_region("blk5"), size); |
| 297 | 280 | |
| 298 | 281 | size = get_software_region_length("ram"); |
| 299 | | if (size) memcpy(m_cart->vic20_ram_pointer(machine(), size), get_software_region("ram"), size); |
| 282 | if (size) memcpy(m_card->vic20_ram_pointer(machine(), size), get_software_region("ram"), size); |
| 300 | 283 | |
| 301 | 284 | size = get_software_region_length("nvram"); |
| 302 | | if (size) memcpy(m_cart->vic20_nvram_pointer(machine(), size), get_software_region("nvram"), size); |
| 285 | if (size) memcpy(m_card->vic20_nvram_pointer(machine(), size), get_software_region("nvram"), size); |
| 303 | 286 | |
| 304 | 287 | } |
| 305 | 288 | } |
| r21071 | r21072 | |
| 336 | 319 | |
| 337 | 320 | UINT8 vic20_expansion_slot_device::cd_r(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) |
| 338 | 321 | { |
| 339 | | if (m_cart != NULL) |
| 322 | if (m_card != NULL) |
| 340 | 323 | { |
| 341 | | data = m_cart->vic20_cd_r(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); |
| 324 | data = m_card->vic20_cd_r(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); |
| 342 | 325 | } |
| 343 | 326 | |
| 344 | 327 | return data; |
| r21071 | r21072 | |
| 351 | 334 | |
| 352 | 335 | void vic20_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) |
| 353 | 336 | { |
| 354 | | if (m_cart != NULL) |
| 337 | if (m_card != NULL) |
| 355 | 338 | { |
| 356 | | m_cart->vic20_cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); |
| 339 | m_card->vic20_cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); |
| 357 | 340 | } |
| 358 | 341 | } |
| 359 | 342 | |
| 360 | | WRITE_LINE_MEMBER( vic20_expansion_slot_device::port_res_w ) { if (m_cart != NULL) m_cart->vic20_res_w(state); } |
| 361 | | |
| 362 | 343 | WRITE_LINE_MEMBER( vic20_expansion_slot_device::irq_w ) { m_out_irq_func(state); } |
| 363 | 344 | WRITE_LINE_MEMBER( vic20_expansion_slot_device::nmi_w ) { m_out_nmi_func(state); } |
| 364 | 345 | WRITE_LINE_MEMBER( vic20_expansion_slot_device::res_w ) { m_out_res_func(state); } |
trunk/src/mess/machine/c64_ieee488.c
| r21071 | r21072 | |
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | //------------------------------------------------- |
| 154 | | // C64_EXPANSION_INTERFACE( expansion_intf ) |
| 155 | | //------------------------------------------------- |
| 156 | | |
| 157 | | READ8_MEMBER( c64_ieee488_device::dma_cd_r ) |
| 158 | | { |
| 159 | | return m_slot->dma_cd_r(offset); |
| 160 | | } |
| 161 | | |
| 162 | | WRITE8_MEMBER( c64_ieee488_device::dma_cd_w ) |
| 163 | | { |
| 164 | | m_slot->dma_cd_w(offset, data); |
| 165 | | } |
| 166 | | |
| 167 | | WRITE_LINE_MEMBER( c64_ieee488_device::irq_w ) |
| 168 | | { |
| 169 | | m_slot->irq_w(state); |
| 170 | | } |
| 171 | | |
| 172 | | WRITE_LINE_MEMBER( c64_ieee488_device::nmi_w ) |
| 173 | | { |
| 174 | | m_slot->nmi_w(state); |
| 175 | | } |
| 176 | | |
| 177 | | WRITE_LINE_MEMBER( c64_ieee488_device::dma_w ) |
| 178 | | { |
| 179 | | m_slot->dma_w(state); |
| 180 | | } |
| 181 | | |
| 182 | | WRITE_LINE_MEMBER( c64_ieee488_device::reset_w ) |
| 183 | | { |
| 184 | | m_slot->reset_w(state); |
| 185 | | } |
| 186 | | |
| 187 | | static C64_EXPANSION_INTERFACE( expansion_intf ) |
| 188 | | { |
| 189 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, dma_cd_r), |
| 190 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, dma_cd_w), |
| 191 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, irq_w), |
| 192 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, nmi_w), |
| 193 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, dma_w), |
| 194 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, reset_w) |
| 195 | | }; |
| 196 | | |
| 197 | | |
| 198 | | //------------------------------------------------- |
| 199 | 154 | // MACHINE_CONFIG_FRAGMENT( c64_ieee488 ) |
| 200 | 155 | //------------------------------------------------- |
| 201 | 156 | |
| 202 | 157 | static MACHINE_CONFIG_FRAGMENT( c64_ieee488 ) |
| 203 | 158 | MCFG_TPI6525_ADD(MOS6525_TAG, tpi_intf) |
| 159 | |
| 204 | 160 | MCFG_CBM_IEEE488_ADD(NULL) |
| 205 | | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, 0, expansion_intf, c64_expansion_cards, NULL, NULL) |
| 161 | MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD() |
| 206 | 162 | MACHINE_CONFIG_END |
| 207 | 163 | |
| 208 | 164 | |
| r21071 | r21072 | |
| 264 | 220 | { |
| 265 | 221 | data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2); |
| 266 | 222 | |
| 267 | | if (!roml) |
| 223 | if (!roml && m_roml_sel) |
| 268 | 224 | { |
| 269 | | if (m_roml_sel) |
| 270 | | { |
| 271 | | data = m_roml[offset & 0xfff]; |
| 272 | | } |
| 225 | data = m_roml[offset & 0xfff]; |
| 273 | 226 | } |
| 274 | 227 | else if (!io2) |
| 275 | 228 | { |
| 276 | | data |= tpi6525_r(m_tpi, space, offset & 0x07); |
| 229 | data = tpi6525_r(m_tpi, space, offset & 0x07); |
| 277 | 230 | } |
| 278 | 231 | |
| 279 | 232 | return data; |
trunk/src/mess/drivers/c128.c
| r21071 | r21072 | |
| 1278 | 1278 | // C64_EXPANSION_INTERFACE( expansion_intf ) |
| 1279 | 1279 | //------------------------------------------------- |
| 1280 | 1280 | |
| 1281 | | READ8_MEMBER( c128_state::exp_dma_r ) |
| 1281 | READ8_MEMBER( c128_state::exp_dma_cd_r ) |
| 1282 | 1282 | { |
| 1283 | 1283 | int ba = 0, aec = 1, z80io = 1; |
| 1284 | 1284 | offs_t vma = 0; |
| r21071 | r21072 | |
| 1286 | 1286 | return read_memory(space, offset, vma, ba, aec, z80io); |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | | WRITE8_MEMBER( c128_state::exp_dma_w ) |
| 1289 | WRITE8_MEMBER( c128_state::exp_dma_cd_w ) |
| 1290 | 1290 | { |
| 1291 | 1291 | int ba = 0, aec = 1, z80io = 1; |
| 1292 | 1292 | offs_t vma = 0; |
| r21071 | r21072 | |
| 1323 | 1323 | } |
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | | static C64_EXPANSION_INTERFACE( expansion_intf ) |
| 1327 | | { |
| 1328 | | DEVCB_DRIVER_MEMBER(c128_state, exp_dma_r), |
| 1329 | | DEVCB_DRIVER_MEMBER(c128_state, exp_dma_w), |
| 1330 | | DEVCB_DRIVER_LINE_MEMBER(c128_state, exp_irq_w), |
| 1331 | | DEVCB_DRIVER_LINE_MEMBER(c128_state, exp_nmi_w), |
| 1332 | | DEVCB_DRIVER_LINE_MEMBER(c128_state, exp_dma_w), |
| 1333 | | DEVCB_DRIVER_LINE_MEMBER(c128_state, exp_reset_w) |
| 1334 | | }; |
| 1335 | 1326 | |
| 1336 | | |
| 1337 | 1327 | //------------------------------------------------- |
| 1338 | 1328 | // C64_USER_PORT_INTERFACE( user_intf ) |
| 1339 | 1329 | //------------------------------------------------- |
| r21071 | r21072 | |
| 1410 | 1400 | m_reset = 1; |
| 1411 | 1401 | |
| 1412 | 1402 | m_mmu->reset(); |
| 1403 | m_vic->reset(); |
| 1404 | m_vdc->reset(); |
| 1405 | m_sid->reset(); |
| 1413 | 1406 | m_cia1->reset(); |
| 1414 | 1407 | m_cia2->reset(); |
| 1408 | |
| 1415 | 1409 | m_iec->reset(); |
| 1416 | 1410 | m_exp->reset(); |
| 1417 | 1411 | m_user->reset(); |
| r21071 | r21072 | |
| 1469 | 1463 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL) |
| 1470 | 1464 | MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS8564_TAG, mos8564_device, lp_w)) |
| 1471 | 1465 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL) |
| 1472 | | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL) |
| 1466 | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, c64_expansion_cards, NULL, NULL) |
| 1467 | MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c128_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, c128_state, exp_nmi_w), DEVWRITELINE(DEVICE_SELF, c128_state, exp_reset_w)) |
| 1468 | MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, exp_dma_cd_r), DEVWRITE8(DEVICE_SELF, c128_state, exp_dma_cd_w), DEVWRITELINE(DEVICE_SELF, c128_state, exp_dma_w)) |
| 1473 | 1469 | MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL) |
| 1474 | 1470 | |
| 1475 | 1471 | // software list |
| r21071 | r21072 | |
| 1588 | 1584 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL) |
| 1589 | 1585 | MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS8566_TAG, mos8566_device, lp_w)) |
| 1590 | 1586 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL) |
| 1591 | | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL) |
| 1587 | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, c64_expansion_cards, NULL, NULL) |
| 1588 | MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c128_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, c128_state, exp_nmi_w), DEVWRITELINE(DEVICE_SELF, c128_state, exp_reset_w)) |
| 1589 | MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, exp_dma_cd_r), DEVWRITE8(DEVICE_SELF, c128_state, exp_dma_cd_w), DEVWRITELINE(DEVICE_SELF, c128_state, exp_dma_w)) |
| 1592 | 1590 | MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL) |
| 1593 | 1591 | |
| 1594 | 1592 | // software list |
trunk/src/mess/drivers/c64.c
| r21071 | r21072 | |
| 474 | 474 | //------------------------------------------------- |
| 475 | 475 | |
| 476 | 476 | static INPUT_PORTS_START( c64gs ) |
| 477 | // no keyboard |
| 477 | 478 | INPUT_PORTS_END |
| 478 | 479 | |
| 479 | 480 | |
| r21071 | r21072 | |
| 946 | 947 | // C64_EXPANSION_INTERFACE( expansion_intf ) |
| 947 | 948 | //------------------------------------------------- |
| 948 | 949 | |
| 949 | | READ8_MEMBER( c64_state::exp_dma_r ) |
| 950 | READ8_MEMBER( c64_state::exp_dma_cd_r ) |
| 950 | 951 | { |
| 951 | 952 | return m_maincpu->space(AS_PROGRAM).read_byte(offset); |
| 952 | 953 | } |
| 953 | 954 | |
| 954 | | WRITE8_MEMBER( c64_state::exp_dma_w ) |
| 955 | WRITE8_MEMBER( c64_state::exp_dma_cd_w ) |
| 955 | 956 | { |
| 956 | 957 | m_maincpu->space(AS_PROGRAM).write_byte(offset, data); |
| 957 | 958 | } |
| r21071 | r21072 | |
| 988 | 989 | } |
| 989 | 990 | } |
| 990 | 991 | |
| 991 | | static C64_EXPANSION_INTERFACE( expansion_intf ) |
| 992 | | { |
| 993 | | DEVCB_DRIVER_MEMBER(c64_state, exp_dma_r), |
| 994 | | DEVCB_DRIVER_MEMBER(c64_state, exp_dma_w), |
| 995 | | DEVCB_DRIVER_LINE_MEMBER(c64_state, exp_irq_w), |
| 996 | | DEVCB_DRIVER_LINE_MEMBER(c64_state, exp_nmi_w), |
| 997 | | DEVCB_DRIVER_LINE_MEMBER(c64_state, exp_dma_w), |
| 998 | | DEVCB_DRIVER_LINE_MEMBER(c64_state, exp_reset_w) |
| 999 | | }; |
| 1000 | 992 | |
| 1001 | | |
| 1002 | 993 | //------------------------------------------------- |
| 1003 | 994 | // C64_USER_PORT_INTERFACE( user_intf ) |
| 1004 | 995 | //------------------------------------------------- |
| r21071 | r21072 | |
| 1060 | 1051 | { |
| 1061 | 1052 | m_maincpu->reset(); |
| 1062 | 1053 | |
| 1054 | m_vic->reset(); |
| 1055 | m_sid->reset(); |
| 1063 | 1056 | m_cia1->reset(); |
| 1064 | 1057 | m_cia2->reset(); |
| 1058 | |
| 1065 | 1059 | m_iec->reset(); |
| 1066 | 1060 | m_exp->reset(); |
| 1067 | 1061 | m_user->reset(); |
| r21071 | r21072 | |
| 1111 | 1105 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL) |
| 1112 | 1106 | MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6567_TAG, mos6567_device, lp_w)) |
| 1113 | 1107 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL) |
| 1114 | | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL) |
| 1108 | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, c64_expansion_cards, NULL, NULL) |
| 1109 | MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c64_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_nmi_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_reset_w)) |
| 1110 | MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, exp_dma_cd_r), DEVWRITE8(DEVICE_SELF, c64_state, exp_dma_cd_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w)) |
| 1115 | 1111 | MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL) |
| 1116 | 1112 | MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) |
| 1117 | 1113 | |
| r21071 | r21072 | |
| 1220 | 1216 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL) |
| 1221 | 1217 | MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w)) |
| 1222 | 1218 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL) |
| 1223 | | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL) |
| 1219 | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, c64_expansion_cards, NULL, NULL) |
| 1220 | MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c64_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_nmi_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_reset_w)) |
| 1221 | MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, exp_dma_cd_r), DEVWRITE8(DEVICE_SELF, c64_state, exp_dma_cd_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w)) |
| 1224 | 1222 | MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL) |
| 1225 | 1223 | MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) |
| 1226 | 1224 | |
| r21071 | r21072 | |
| 1307 | 1305 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL) |
| 1308 | 1306 | MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w)) |
| 1309 | 1307 | MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL) |
| 1310 | | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL) |
| 1308 | MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, c64_expansion_cards, NULL, NULL) |
| 1309 | MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c64_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_nmi_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_reset_w)) |
| 1310 | MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, exp_dma_cd_r), DEVWRITE8(DEVICE_SELF, c64_state, exp_dma_cd_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w)) |
| 1311 | 1311 | MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL) |
| 1312 | 1312 | MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) |
| 1313 | 1313 | |