src/mess/drivers/scorpion.c
| r10079 | r10080 | |
| 183 | 183 | |
| 184 | 184 | /* rom 0=zx128, 1=zx48, 2 = service monitor, 3=tr-dos */ |
| 185 | 185 | |
| 186 | static UINT8 *ram_0000; |
| 187 | static UINT8 ram_disabled_by_beta; |
| 188 | |
| 186 | 189 | static void scorpion_update_memory(running_machine *machine) |
| 187 | 190 | { |
| 188 | 191 | spectrum_state *state = machine->driver_data<spectrum_state>(); |
| 189 | 192 | UINT8 *messram = ram_get_ptr(machine->device(RAM_TAG)); |
| 190 | | address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 191 | 193 | |
| 192 | 194 | state->screen_location = messram + ((state->port_7ffd_data & 8) ? (7<<14) : (5<<14)); |
| 193 | 195 | |
| r10079 | r10080 | |
| 195 | 197 | |
| 196 | 198 | if ((state->port_1ffd_data & 0x01)==0x01) |
| 197 | 199 | { |
| 198 | | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 200 | ram_0000 = messram+(8<<14); |
| 199 | 201 | memory_set_bankptr(machine, "bank1", messram+(8<<14)); |
| 200 | 202 | logerror("RAM\n"); |
| 201 | 203 | } |
| r10079 | r10080 | |
| 209 | 211 | { |
| 210 | 212 | state->ROMSelection = ((state->port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 211 | 213 | } |
| 212 | | memory_unmap_write(space, 0x0000, 0x3fff, 0, 0); |
| 213 | 214 | memory_set_bankptr(machine, "bank1", machine->region("maincpu")->base() + 0x010000 + (state->ROMSelection<<14)); |
| 214 | 215 | } |
| 215 | 216 | |
| 216 | 217 | |
| 217 | 218 | } |
| 218 | 219 | |
| 220 | static WRITE8_HANDLER( scorpion_0000_w ) |
| 221 | { |
| 222 | spectrum_state *state = space->machine->driver_data<spectrum_state>(); |
| 223 | |
| 224 | if ( ! ram_0000 ) |
| 225 | return; |
| 226 | |
| 227 | if ((state->port_1ffd_data & 0x01)==0x01) |
| 228 | { |
| 229 | if ( ! ram_disabled_by_beta ) |
| 230 | ram_0000[offset] = data; |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | |
| 219 | 235 | DIRECT_UPDATE_HANDLER( scorpion_direct ) |
| 220 | 236 | { |
| 221 | 237 | spectrum_state *state = machine->driver_data<spectrum_state>(); |
| r10079 | r10080 | |
| 223 | 239 | UINT16 pc = cpu_get_reg(machine->device("maincpu"), STATE_GENPCBASE); |
| 224 | 240 | address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 225 | 241 | |
| 242 | ram_disabled_by_beta = 0; |
| 226 | 243 | if (betadisk_is_active(beta)) |
| 227 | 244 | { |
| 228 | 245 | if (pc >= 0x4000) |
| 229 | 246 | { |
| 230 | 247 | state->ROMSelection = ((state->port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 231 | 248 | betadisk_disable(beta); |
| 232 | | memory_unmap_write(space, 0x0000, 0x3fff, 0, 0); |
| 249 | ram_disabled_by_beta = 1; |
| 233 | 250 | memory_set_bankptr(machine, "bank1", machine->region("maincpu")->base() + 0x010000 + (state->ROMSelection<<14)); |
| 234 | 251 | } |
| 235 | 252 | } |
| r10079 | r10080 | |
| 240 | 257 | } |
| 241 | 258 | if((address>=0x0000) && (address<=0x3fff)) |
| 242 | 259 | { |
| 243 | | memory_unmap_write(space, 0x0000, 0x3fff, 0, 0); |
| 260 | ram_disabled_by_beta = 1; |
| 244 | 261 | direct.explicit_configure(0x0000, 0x3fff, 0x3fff, space->machine->region("maincpu")->base() + 0x010000 + (state->ROMSelection<<14)); |
| 245 | 262 | memory_set_bankptr(machine, "bank1", space->machine->region("maincpu")->base() + 0x010000 + (state->ROMSelection<<14)); |
| 246 | 263 | return ~0; |
| r10079 | r10080 | |
| 309 | 326 | device_t *beta = machine->device(BETA_DISK_TAG); |
| 310 | 327 | address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 311 | 328 | |
| 312 | | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 329 | ram_0000 = NULL; |
| 330 | memory_install_read_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 331 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, scorpion_0000_w); |
| 313 | 332 | |
| 314 | 333 | betadisk_disable(beta); |
| 315 | 334 | betadisk_clear_status(beta); |
| 316 | | // This causes severe slowdown (5fps vs 750fps) removed until rewritten |
| 317 | | //space->set_direct_update_handler(direct_update_delegate_create_static(scorpion_direct, *machine)); |
| 335 | space->set_direct_update_handler(direct_update_delegate_create_static(scorpion_direct, *machine)); |
| 318 | 336 | |
| 319 | 337 | memset(messram,0,256*1024); |
| 320 | 338 | |