src/mess/drivers/scorpion.c
| r3709 | r3710 | |
| 194 | 194 | |
| 195 | 195 | static int ROMSelection; |
| 196 | 196 | |
| 197 | //static UINT8 *rom_pointer; |
| 198 | |
| 197 | 199 | static void scorpion_update_memory(running_machine *machine) |
| 198 | 200 | { |
| 199 | 201 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| r3709 | r3710 | |
| 204 | 206 | if ((scorpion_256_port_1ffd_data & 0x01)==0x01) |
| 205 | 207 | { |
| 206 | 208 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 207 | | memory_set_bankptr(machine, 1, mess_ram+(8<<14)); |
| 209 | memory_set_bankptr(machine, 1, mess_ram+(8<<14)); |
| 210 | logerror("RAM\n"); |
| 208 | 211 | } |
| 209 | 212 | else |
| 210 | 213 | { |
| r3709 | r3710 | |
| 212 | 215 | { |
| 213 | 216 | ROMSelection = 2; |
| 214 | 217 | } else { |
| 215 | | /* ROM switching */ |
| 216 | 218 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 217 | 219 | } |
| 218 | 220 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| r3709 | r3710 | |
| 224 | 226 | |
| 225 | 227 | static DIRECT_UPDATE_HANDLER( scorpion_direct ) |
| 226 | 228 | { |
| 229 | UINT16 pc = cpu_get_reg(space->machine->cpu[0], REG_PREVIOUSPC); |
| 227 | 230 | if (betadisk_is_active()) { |
| 228 | | if (cpu_get_pc(space->machine->cpu[0]) >= 0x4000) { |
| 231 | if (pc >= 0x4000) { |
| 229 | 232 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 230 | 233 | betadisk_disable(); |
| 231 | | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "main") + 0x010000 + 0x4000*ROMSelection); // Set BASIC ROM |
| 232 | 234 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 235 | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "main") + 0x010000 + (ROMSelection<<14)); |
| 233 | 236 | } |
| 234 | | } else if (((cpu_get_pc(space->machine->cpu[0]) & 0xff00) == 0x3d00) && (ROMSelection==1)) |
| 237 | } else if (((pc & 0xff00) == 0x3d00) && (ROMSelection==1)) |
| 235 | 238 | { |
| 236 | 239 | ROMSelection = 3; |
| 237 | 240 | betadisk_enable(); |
| 238 | | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "main") + 0x01c000); // Set TRDOS ROM |
| 241 | |
| 242 | } |
| 243 | if((address>=0x0000) && (address<=0x3fff)) { |
| 239 | 244 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 240 | | } |
| 245 | direct->raw = direct->decrypted = memory_region(space->machine, "main") + 0x010000 + (ROMSelection<<14); |
| 246 | memory_set_bankptr(space->machine, 1, direct->raw); |
| 247 | return ~0; |
| 248 | } |
| 241 | 249 | return address; |
| 242 | 250 | } |
| 243 | 251 | |
| r3709 | r3710 | |
| 290 | 298 | |
| 291 | 299 | static MACHINE_RESET( scorpion ) |
| 292 | 300 | { |
| 293 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 301 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 294 | 302 | |
| 295 | | memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 303 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 296 | 304 | |
| 297 | 305 | betadisk_disable(); |
| 298 | 306 | betadisk_clear_status(); |