src/mess/messdriv.c
| r3580 | r3581 | |
| 456 | 456 | //128u4 DRIVER( osborne1 ) /* 1981 Osborne-1 */ |
| 457 | 457 | |
| 458 | 458 | /* SINCLAIR RESEARCH */ |
| 459 | | //128u4 DRIVER( zx80 ) /* 1980 Sinclair ZX-80 */ |
| 460 | | //128u4 DRIVER( zx81 ) /* 1981 Sinclair ZX-81 */ |
| 461 | | //128u4 DRIVER( ts1000 ) /* 1982 Timex Sinclair 1000 */ |
| 462 | | //128u4 DRIVER( pc8300 ) /* Your Computer - PC8300 */ |
| 463 | | //128u4 DRIVER( pow3000 ) /* Creon Enterprises - Power 3000 */ |
| 464 | | //128u4 DRIVER( lambda ) /* Lambda 8300 */ |
| 459 | DRIVER( zx80 ) /* 1980 Sinclair ZX-80 */ |
| 460 | DRIVER( zx81 ) /* 1981 Sinclair ZX-81 */ |
| 461 | DRIVER( ts1000 ) /* 1982 Timex Sinclair 1000 */ |
| 462 | DRIVER( pc8300 ) /* Your Computer - PC8300 */ |
| 463 | DRIVER( pow3000 ) /* Creon Enterprises - Power 3000 */ |
| 464 | DRIVER( lambda ) /* Lambda 8300 */ |
| 465 | 465 | |
| 466 | | //128u4 DRIVER( spectrum )/* 1982 ZX Spectrum */ |
| 467 | | //128u4 DRIVER( spec80k ) /* 1987 ZX Spectrum 80k */ |
| 468 | | //128u4 DRIVER( specide ) /* 1995 ZX Spectrum IDE */ |
| 469 | | //128u4 DRIVER( inves ) /* 1986 Inves Spectrum 48K+ */ |
| 470 | | //128u4 DRIVER( tk90x ) /* 1985 TK90x Color Computer */ |
| 471 | | //128u4 DRIVER( tk95 ) /* 1986 TK95 Color Computer */ |
| 472 | | //128u4 DRIVER( tc2048 ) /* 198? TC2048 */ |
| 473 | | //128u4 DRIVER( ts2068 ) /* 1983 TS2068 */ |
| 474 | | //128u4 DRIVER( uk2086 ) /* 1986 UK2086 */ |
| 466 | DRIVER( spectrum )/* 1982 ZX Spectrum */ |
| 467 | DRIVER( spec80k ) /* 1987 ZX Spectrum 80k */ |
| 468 | DRIVER( specide ) /* 1995 ZX Spectrum IDE */ |
| 469 | DRIVER( inves ) /* 1986 Inves Spectrum 48K+ */ |
| 470 | DRIVER( tk90x ) /* 1985 TK90x Color Computer */ |
| 471 | DRIVER( tk95 ) /* 1986 TK95 Color Computer */ |
| 472 | DRIVER( tc2048 ) /* 198? TC2048 */ |
| 473 | DRIVER( ts2068 ) /* 1983 TS2068 */ |
| 474 | DRIVER( uk2086 ) /* 1986 UK2086 */ |
| 475 | |
| 476 | DRIVER( spec128 ) /* 1986 ZX Spectrum 128 */ |
| 477 | DRIVER( specpls2 ) /* 1986 ZX Spectrum +2 */ |
| 478 | DRIVER( specpl2a ) /* 1987 ZX Spectrum +2a */ |
| 479 | DRIVER( specpls3 ) /* 1987 ZX Spectrum +3 */ |
| 480 | DRIVER( specpl3e ) /* 2000 ZX Spectrum +3e */ |
| 481 | DRIVER( sp3e8bit ) /* 2002 ZX Spectrum +3e 8bit IDE */ |
| 482 | DRIVER( sp3ezcf ) /* 2002 ZX Spectrum +3e ZXCF */ |
| 483 | DRIVER( sp3eata ) /* 2002 ZX Spectrum +3e ZXATASP */ |
| 484 | DRIVER( scorpion ) |
| 485 | DRIVER( pentagon ) |
| 475 | 486 | |
| 476 | | //128u4 DRIVER( spec128 ) /* 1986 ZX Spectrum 128 */ |
| 477 | | //128u4 DRIVER( specpls2 ) /* 1986 ZX Spectrum +2 */ |
| 478 | | //128u4 DRIVER( specpl2a ) /* 1987 ZX Spectrum +2a */ |
| 479 | | //128u4 DRIVER( specpls3 ) /* 1987 ZX Spectrum +3 */ |
| 480 | | //128u4 DRIVER( specpl3e ) /* 2000 ZX Spectrum +3e */ |
| 481 | | //128u4 DRIVER( sp3e8bit ) /* 2002 ZX Spectrum +3e 8bit IDE */ |
| 482 | | //128u4 DRIVER( sp3ezcf ) /* 2002 ZX Spectrum +3e ZXCF */ |
| 483 | | //128u4 DRIVER( sp3eata ) /* 2002 ZX Spectrum +3e ZXATASP */ |
| 484 | | //128u4 DRIVER( scorpion ) |
| 485 | | //128u4 DRIVER( pentagon ) |
| 486 | | |
| 487 | 487 | //128u4 DRIVER( ql ) /* 1984 Sinclair QL (UK) */ |
| 488 | 488 | //128u4 DRIVER( ql_us ) /* 1984 Sinclair QL (USA) */ |
| 489 | 489 | //128u4 DRIVER( ql_es ) /* 1984 Sinclair QL (Spain) */ |
| r3580 | r3581 | |
| 1030 | 1030 | /* Spectrum clones */ |
| 1031 | 1031 | |
| 1032 | 1032 | /* ICE-Felix */ |
| 1033 | | //128u4 DRIVER( hc85 ) /* 1985 HC-85 */ |
| 1034 | | //128u4 DRIVER( hc90 ) /* 1990 HC-90 */ |
| 1035 | | //128u4 DRIVER( hc91 ) /* 1991 HC-91 */ |
| 1036 | | //128u4 DRIVER( hc128 ) /* 1991 HC-128 */ |
| 1037 | | //128u4 DRIVER( hc2000 ) /* 1992 HC-2000 */ |
| 1033 | DRIVER( hc85 ) /* 1985 HC-85 */ |
| 1034 | DRIVER( hc90 ) /* 1990 HC-90 */ |
| 1035 | DRIVER( hc91 ) /* 1991 HC-91 */ |
| 1036 | DRIVER( hc128 ) /* 1991 HC-128 */ |
| 1037 | DRIVER( hc2000 ) /* 1992 HC-2000 */ |
| 1038 | |
| 1039 | DRIVER( cip03 ) /* 1988 CIP-03 */ |
| 1040 | DRIVER( jet ) /* 1990 JET */ |
| 1038 | 1041 | |
| 1039 | | //128u4 DRIVER( cip03 ) /* 1988 CIP-03 */ |
| 1040 | | //128u4 DRIVER( jet ) /* 1990 JET */ |
| 1041 | | |
| 1042 | 1042 | /* Didaktik Skalica */ |
| 1043 | | //128u4 DRIVER( dgama87) /* 1987 Didaktik Gama 87 */ |
| 1044 | | //128u4 DRIVER( dgama88) /* 1988 Didaktik Gama 88 */ |
| 1045 | | //128u4 DRIVER( dgama89) /* 1989 Didaktik Gama 89 */ |
| 1046 | | //128u4 DRIVER( didakt90) /* 1990 Didaktik Skalica 90 */ |
| 1047 | | //128u4 DRIVER( didakm91) /* 1991 Didaktik M 91 */ |
| 1048 | | //128u4 DRIVER( didaktk) /* 1992 Didaktik Kompakt */ |
| 1049 | | //128u4 DRIVER( didakm93) /* 1993 Didaktik M 93 */ |
| 1050 | | |
| 1051 | | //128u4 DRIVER( mistrum ) /* 1988 Mistrum */ |
| 1043 | DRIVER( dgama87) /* 1987 Didaktik Gama 87 */ |
| 1044 | DRIVER( dgama88) /* 1988 Didaktik Gama 88 */ |
| 1045 | DRIVER( dgama89) /* 1989 Didaktik Gama 89 */ |
| 1046 | DRIVER( didakt90) /* 1990 Didaktik Skalica 90 */ |
| 1047 | DRIVER( didakm91) /* 1991 Didaktik M 91 */ |
| 1048 | DRIVER( didaktk) /* 1992 Didaktik Kompakt */ |
| 1049 | DRIVER( didakm93) /* 1993 Didaktik M 93 */ |
| 1052 | 1050 | |
| 1051 | DRIVER( mistrum ) /* 1988 Mistrum */ |
| 1052 | |
| 1053 | 1053 | /* Russian clones */ |
| 1054 | 1054 | |
| 1055 | | //128u4 DRIVER( blitz ) /* 1990 Blic */ |
| 1056 | | //128u4 DRIVER( byte ) /* 1990 Byte */ |
| 1057 | | //128u4 DRIVER( orizon ) /* 199? Orizon-Micro */ |
| 1058 | | //128u4 DRIVER( quorum48 ) /* 1993 Kvorum 48K */ |
| 1059 | | //128u4 DRIVER( magic6 ) /* 1993 Magic 6 */ |
| 1060 | | //128u4 DRIVER( compani1 ) /* 1990 Kompanion 1 */ |
| 1055 | DRIVER( blitz ) /* 1990 Blic */ |
| 1056 | DRIVER( byte ) /* 1990 Byte */ |
| 1057 | DRIVER( orizon ) /* 199? Orizon-Micro */ |
| 1058 | DRIVER( quorum48 ) /* 1993 Kvorum 48K */ |
| 1059 | DRIVER( magic6 ) /* 1993 Magic 6 */ |
| 1060 | DRIVER( compani1 ) /* 1990 Kompanion 1 */ |
| 1061 | 1061 | |
| 1062 | 1062 | /* Kramer */ |
| 1063 | 1063 | //128u4 DRIVER(kramermc) /* 1987 Kramer MC */ |
src/mess/machine/spectrum.c
| r3580 | r3581 | |
| 53 | 53 | } |
| 54 | 54 | SPECTRUM_SNAPSHOT_TYPE; |
| 55 | 55 | |
| 56 | | static OPBASE_HANDLER(spectrum_opbaseoverride) |
| 56 | static DIRECT_UPDATE_HANDLER(spectrum_direct) |
| 57 | 57 | { |
| 58 | 58 | /* Hack for correct handling 0xffff interrupt vector */ |
| 59 | 59 | if (address == 0x0001) |
| 60 | | if (cpunum_get_reg(0, REG_PREVIOUSPC)==0xffff) |
| 60 | if (cpu_get_reg(space->machine->cpu[0], REG_PREVIOUSPC)==0xffff) |
| 61 | 61 | { |
| 62 | | cpunum_set_reg(0, Z80_PC, 0xfff4); |
| 62 | cpu_set_reg(space->machine->cpu[0], Z80_PC, 0xfff4); |
| 63 | 63 | return 0xfff4; |
| 64 | 64 | } |
| 65 | 65 | return address; |
| r3580 | r3581 | |
| 67 | 67 | |
| 68 | 68 | MACHINE_RESET( spectrum ) |
| 69 | 69 | { |
| 70 | | memory_set_opbase_handler(0, spectrum_opbaseoverride); |
| 70 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 71 | memory_set_direct_update_handler(space, spectrum_direct); |
| 71 | 72 | } |
| 72 | 73 | |
| 73 | 74 | SNAPSHOT_LOAD(spectrum) |
| r3580 | r3581 | |
| 103 | 104 | spectrum_setup_z80(image->machine, snapshot_data, snapshot_size); |
| 104 | 105 | } |
| 105 | 106 | free(snapshot_data); |
| 106 | | logerror("Snapshot loaded - new PC = %04x\n", (unsigned) cpunum_get_reg(0, Z80_PC) & 0x0ffff); |
| 107 | //logerror("Snapshot loaded - new PC = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], Z80_PC) & 0x0ffff); |
| 107 | 108 | return INIT_PASS; |
| 108 | 109 | |
| 109 | 110 | error: |
| r3580 | r3581 | |
| 192 | 193 | UINT8 lo, hi, data; |
| 193 | 194 | UINT16 offset, size; |
| 194 | 195 | UINT16 status; |
| 196 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 195 | 197 | |
| 196 | 198 | lo = pSnapshot[2] & 0x0ff; |
| 197 | 199 | hi = pSnapshot[3] & 0x0ff; |
| r3580 | r3581 | |
| 204 | 206 | |
| 205 | 207 | lo = pSnapshot[6] & 0x0ff; |
| 206 | 208 | hi = pSnapshot[7] & 0x0ff; |
| 207 | | cpunum_set_reg(0, Z80_BC, (hi << 8) | lo); |
| 209 | cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo); |
| 208 | 210 | lo = pSnapshot[8] & 0x0ff; |
| 209 | 211 | hi = pSnapshot[9] & 0x0ff; |
| 210 | | cpunum_set_reg(0, Z80_DE, (hi << 8) | lo); |
| 212 | cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo); |
| 211 | 213 | lo = pSnapshot[10] & 0x0ff; |
| 212 | 214 | hi = pSnapshot[11] & 0x0ff; |
| 213 | | cpunum_set_reg(0, Z80_HL, (hi << 8) | lo); |
| 215 | cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo); |
| 214 | 216 | lo = pSnapshot[12] & 0x0ff; |
| 215 | 217 | hi = pSnapshot[13] & 0x0ff; |
| 216 | | cpunum_set_reg(0, Z80_AF, (hi << 8) | lo); |
| 218 | cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo); |
| 217 | 219 | |
| 218 | 220 | lo = pSnapshot[14] & 0x0ff; |
| 219 | 221 | hi = pSnapshot[15] & 0x0ff; |
| 220 | | cpunum_set_reg(0, Z80_IX, (hi << 8) | lo); |
| 222 | cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo); |
| 221 | 223 | lo = pSnapshot[16] & 0x0ff; |
| 222 | 224 | hi = pSnapshot[17] & 0x0ff; |
| 223 | | cpunum_set_reg(0, Z80_IY, (hi << 8) | lo); |
| 225 | cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo); |
| 224 | 226 | |
| 225 | 227 | lo = pSnapshot[18] & 0x0ff; |
| 226 | 228 | hi = pSnapshot[19] & 0x0ff; |
| 227 | | cpunum_set_reg(0, Z80_BC2, (hi << 8) | lo); |
| 229 | cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo); |
| 228 | 230 | lo = pSnapshot[20] & 0x0ff; |
| 229 | 231 | hi = pSnapshot[21] & 0x0ff; |
| 230 | | cpunum_set_reg(0, Z80_DE2, (hi << 8) | lo); |
| 232 | cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo); |
| 231 | 233 | lo = pSnapshot[22] & 0x0ff; |
| 232 | 234 | hi = pSnapshot[23] & 0x0ff; |
| 233 | | cpunum_set_reg(0, Z80_HL2, (hi << 8) | lo); |
| 235 | cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo); |
| 234 | 236 | lo = pSnapshot[24] & 0x0ff; |
| 235 | 237 | hi = pSnapshot[25] & 0x0ff; |
| 236 | | cpunum_set_reg(0, Z80_AF2, (hi << 8) | lo); |
| 238 | cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo); |
| 237 | 239 | |
| 238 | | cpunum_set_reg(0, Z80_R, (pSnapshot[26] & 0x0ff)); |
| 239 | | cpunum_set_reg(0, Z80_I, (pSnapshot[27] & 0x0ff)); |
| 240 | cpu_set_reg(machine->cpu[0], Z80_R, (pSnapshot[26] & 0x0ff)); |
| 241 | cpu_set_reg(machine->cpu[0], Z80_I, (pSnapshot[27] & 0x0ff)); |
| 240 | 242 | |
| 241 | 243 | lo = pSnapshot[28] & 0x0ff; |
| 242 | 244 | hi = pSnapshot[29] & 0x0ff; |
| 243 | | cpunum_set_reg(0, Z80_SP, (hi << 8) | lo); |
| 245 | cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo); |
| 244 | 246 | lo = pSnapshot[30] & 0x0ff; |
| 245 | 247 | hi = pSnapshot[31] & 0x0ff; |
| 246 | | cpunum_set_reg(0, Z80_PC, (hi << 8) | lo); |
| 248 | cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo); |
| 247 | 249 | |
| 248 | 250 | lo = pSnapshot[32] & 0x0ff; |
| 249 | 251 | hi = pSnapshot[33] & 0x0ff; |
| r3580 | r3581 | |
| 264 | 266 | status = (hi << 8) | lo; |
| 265 | 267 | |
| 266 | 268 | data = (status & 0x01); |
| 267 | | cpunum_set_reg(0, Z80_IFF1, data); |
| 269 | cpu_set_reg(machine->cpu[0], Z80_IFF1, data); |
| 268 | 270 | data = (status & 0x04)>>2; |
| 269 | | cpunum_set_reg(0, Z80_IFF2, data); |
| 271 | cpu_set_reg(machine->cpu[0], Z80_IFF2, data); |
| 270 | 272 | |
| 271 | 273 | data = (status & 0x08)>>3; |
| 272 | 274 | if (data) |
| 273 | | cpunum_set_reg(0, Z80_IM, 0); |
| 275 | cpu_set_reg(machine->cpu[0], Z80_IM, 0); |
| 274 | 276 | else |
| 275 | 277 | { |
| 276 | 278 | data = (status & 0x02)>>1; |
| 277 | 279 | if (data) |
| 278 | | cpunum_set_reg(0, Z80_IM, 2); |
| 280 | cpu_set_reg(machine->cpu[0], Z80_IM, 2); |
| 279 | 281 | else |
| 280 | | cpunum_set_reg(0, Z80_IM, 1); |
| 282 | cpu_set_reg(machine->cpu[0], Z80_IM, 1); |
| 281 | 283 | } |
| 282 | 284 | |
| 283 | 285 | data = (status & 0x10)>>4; |
| r3580 | r3581 | |
| 289 | 291 | |
| 290 | 292 | /* memory dump */ |
| 291 | 293 | for (i = 0; i < size; i++) |
| 292 | | program_write_byte(i + offset, pSnapshot[38 + i]); |
| 294 | memory_write_byte(space, i + offset, pSnapshot[38 + i]); |
| 293 | 295 | } |
| 294 | 296 | |
| 295 | 297 | /******************************************************************* |
| r3580 | r3581 | |
| 329 | 331 | long bank_offset; |
| 330 | 332 | unsigned char lo, hi, data; |
| 331 | 333 | unsigned short addr; |
| 334 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 332 | 335 | |
| 333 | 336 | if ((SnapshotSize != 49179) && (spectrum_128_port_7ffd_data == -1)) |
| 334 | 337 | { |
| r3580 | r3581 | |
| 336 | 339 | return; |
| 337 | 340 | } |
| 338 | 341 | |
| 339 | | cpunum_set_reg(0, Z80_I, (pSnapshot[0] & 0x0ff)); |
| 342 | cpu_set_reg(machine->cpu[0], Z80_I, (pSnapshot[0] & 0x0ff)); |
| 340 | 343 | lo = pSnapshot[1] & 0x0ff; |
| 341 | 344 | hi = pSnapshot[2] & 0x0ff; |
| 342 | | cpunum_set_reg(0, Z80_HL2, (hi << 8) | lo); |
| 345 | cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo); |
| 343 | 346 | lo = pSnapshot[3] & 0x0ff; |
| 344 | 347 | hi = pSnapshot[4] & 0x0ff; |
| 345 | | cpunum_set_reg(0, Z80_DE2, (hi << 8) | lo); |
| 348 | cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo); |
| 346 | 349 | lo = pSnapshot[5] & 0x0ff; |
| 347 | 350 | hi = pSnapshot[6] & 0x0ff; |
| 348 | | cpunum_set_reg(0, Z80_BC2, (hi << 8) | lo); |
| 351 | cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo); |
| 349 | 352 | lo = pSnapshot[7] & 0x0ff; |
| 350 | 353 | hi = pSnapshot[8] & 0x0ff; |
| 351 | | cpunum_set_reg(0, Z80_AF2, (hi << 8) | lo); |
| 354 | cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo); |
| 352 | 355 | lo = pSnapshot[9] & 0x0ff; |
| 353 | 356 | hi = pSnapshot[10] & 0x0ff; |
| 354 | | cpunum_set_reg(0, Z80_HL, (hi << 8) | lo); |
| 357 | cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo); |
| 355 | 358 | lo = pSnapshot[11] & 0x0ff; |
| 356 | 359 | hi = pSnapshot[12] & 0x0ff; |
| 357 | | cpunum_set_reg(0, Z80_DE, (hi << 8) | lo); |
| 360 | cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo); |
| 358 | 361 | lo = pSnapshot[13] & 0x0ff; |
| 359 | 362 | hi = pSnapshot[14] & 0x0ff; |
| 360 | | cpunum_set_reg(0, Z80_BC, (hi << 8) | lo); |
| 363 | cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo); |
| 361 | 364 | lo = pSnapshot[15] & 0x0ff; |
| 362 | 365 | hi = pSnapshot[16] & 0x0ff; |
| 363 | | cpunum_set_reg(0, Z80_IY, (hi << 8) | lo); |
| 366 | cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo); |
| 364 | 367 | lo = pSnapshot[17] & 0x0ff; |
| 365 | 368 | hi = pSnapshot[18] & 0x0ff; |
| 366 | | cpunum_set_reg(0, Z80_IX, (hi << 8) | lo); |
| 369 | cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo); |
| 367 | 370 | data = (pSnapshot[19] & 0x04) >> 2; |
| 368 | | cpunum_set_reg(0, Z80_IFF2, data); |
| 369 | | cpunum_set_reg(0, Z80_IFF1, data); |
| 371 | cpu_set_reg(machine->cpu[0], Z80_IFF2, data); |
| 372 | cpu_set_reg(machine->cpu[0], Z80_IFF1, data); |
| 370 | 373 | data = (pSnapshot[20] & 0x0ff); |
| 371 | | cpunum_set_reg(0, Z80_R, data); |
| 374 | cpu_set_reg(machine->cpu[0], Z80_R, data); |
| 372 | 375 | lo = pSnapshot[21] & 0x0ff; |
| 373 | 376 | hi = pSnapshot[22] & 0x0ff; |
| 374 | | cpunum_set_reg(0, Z80_AF, (hi << 8) | lo); |
| 377 | cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo); |
| 375 | 378 | lo = pSnapshot[23] & 0x0ff; |
| 376 | 379 | hi = pSnapshot[24] & 0x0ff; |
| 377 | | cpunum_set_reg(0, Z80_SP, (hi << 8) | lo); |
| 380 | cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo); |
| 378 | 381 | data = (pSnapshot[25] & 0x0ff); |
| 379 | | cpunum_set_reg(0, Z80_IM, data); |
| 382 | cpu_set_reg(machine->cpu[0], Z80_IM, data); |
| 380 | 383 | |
| 381 | 384 | /* Set border colour */ |
| 382 | 385 | PreviousFE = (PreviousFE & 0xf8) | (pSnapshot[26] & 0x07); |
| r3580 | r3581 | |
| 401 | 404 | /* memory dump */ |
| 402 | 405 | for (i = 0; i < 49152; i++) |
| 403 | 406 | { |
| 404 | | program_write_byte(i + 16384, pSnapshot[27 + i]); |
| 407 | memory_write_byte(space,i + 16384, pSnapshot[27 + i]); |
| 405 | 408 | } |
| 406 | 409 | |
| 407 | 410 | if (SnapshotSize == 49179) |
| 408 | 411 | { |
| 409 | 412 | /* get pc from stack */ |
| 410 | | addr = cpunum_get_reg(0, Z80_SP) & 0xFFFF; |
| 413 | addr = cpu_get_reg(machine->cpu[0], Z80_SP) & 0xFFFF; |
| 411 | 414 | |
| 412 | | cpunum_set_reg(0, Z80_PC, |
| 413 | | ((UINT16) program_read_byte(addr + 0) ) >> 8 | |
| 414 | | ((UINT16) program_read_byte(addr + 1) ) >> 0); |
| 415 | cpu_set_reg(machine->cpu[0], Z80_PC, |
| 416 | ((UINT16) memory_read_byte(space,addr + 0) ) >> 8 | |
| 417 | ((UINT16) memory_read_byte(space,addr + 1) ) >> 0); |
| 415 | 418 | |
| 416 | 419 | addr += 2; |
| 417 | | cpunum_set_reg(0, Z80_SP, (addr & 0x0ffff)); |
| 420 | cpu_set_reg(machine->cpu[0], Z80_SP, (addr & 0x0ffff)); |
| 418 | 421 | |
| 419 | 422 | |
| 420 | 423 | } |
| r3580 | r3581 | |
| 438 | 441 | spectrum_128_port_7ffd_data += i; |
| 439 | 442 | spectrum_update_paging(machine); |
| 440 | 443 | for (j = 0; j < 16384; j++) |
| 441 | | program_write_byte(j + 49152, pSnapshot[bank_offset + j]); |
| 444 | memory_write_byte(space,j + 49152, pSnapshot[bank_offset + j]); |
| 442 | 445 | bank_offset += 16384; |
| 443 | 446 | } |
| 444 | 447 | } |
| r3580 | r3581 | |
| 450 | 453 | /* program counter */ |
| 451 | 454 | lo = pSnapshot[49179] & 0x0ff; |
| 452 | 455 | hi = pSnapshot[49180] & 0x0ff; |
| 453 | | cpunum_set_reg(0, Z80_PC, (hi << 8) | lo); |
| 456 | cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo); |
| 454 | 457 | } |
| 455 | 458 | } |
| 456 | 459 | |
| 457 | 460 | |
| 458 | | static void spectrum_z80_decompress_block(unsigned char *pSource, int Dest, int size) |
| 461 | static void spectrum_z80_decompress_block(running_machine *machine,unsigned char *pSource, int Dest, int size) |
| 459 | 462 | { |
| 460 | 463 | unsigned char ch; |
| 461 | 464 | int i; |
| 462 | | |
| 465 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 466 | |
| 463 | 467 | do |
| 464 | 468 | { |
| 465 | 469 | /* get byte */ |
| r3580 | r3581 | |
| 494 | 498 | |
| 495 | 499 | for (i = 0; i < count; i++) |
| 496 | 500 | { |
| 497 | | program_write_byte(Dest, data); |
| 501 | memory_write_byte(space,Dest, data); |
| 498 | 502 | Dest++; |
| 499 | 503 | } |
| 500 | 504 | } |
| 501 | 505 | else |
| 502 | 506 | { |
| 503 | 507 | /* single 0x0ed */ |
| 504 | | program_write_byte(Dest, ch); |
| 508 | memory_write_byte(space,Dest, ch); |
| 505 | 509 | Dest++; |
| 506 | 510 | pSource++; |
| 507 | 511 | size--; |
| r3580 | r3581 | |
| 511 | 515 | else |
| 512 | 516 | { |
| 513 | 517 | /* not 0x0ed */ |
| 514 | | program_write_byte(Dest, ch); |
| 518 | memory_write_byte(space,Dest, ch); |
| 515 | 519 | Dest++; |
| 516 | 520 | pSource++; |
| 517 | 521 | size--; |
| r3580 | r3581 | |
| 584 | 588 | int i; |
| 585 | 589 | unsigned char lo, hi, data; |
| 586 | 590 | SPECTRUM_Z80_SNAPSHOT_TYPE z80_type; |
| 591 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 587 | 592 | |
| 588 | 593 | z80_type = spectrum_identify_z80(pSnapshot, SnapshotSize); |
| 589 | 594 | |
| r3580 | r3581 | |
| 624 | 629 | /* AF */ |
| 625 | 630 | hi = pSnapshot[0] & 0x0ff; |
| 626 | 631 | lo = pSnapshot[1] & 0x0ff; |
| 627 | | cpunum_set_reg(0, Z80_AF, (hi << 8) | lo); |
| 632 | cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo); |
| 628 | 633 | /* BC */ |
| 629 | 634 | lo = pSnapshot[2] & 0x0ff; |
| 630 | 635 | hi = pSnapshot[3] & 0x0ff; |
| 631 | | cpunum_set_reg(0, Z80_BC, (hi << 8) | lo); |
| 636 | cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo); |
| 632 | 637 | /* HL */ |
| 633 | 638 | lo = pSnapshot[4] & 0x0ff; |
| 634 | 639 | hi = pSnapshot[5] & 0x0ff; |
| 635 | | cpunum_set_reg(0, Z80_HL, (hi << 8) | lo); |
| 640 | cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo); |
| 636 | 641 | |
| 637 | 642 | /* SP */ |
| 638 | 643 | lo = pSnapshot[8] & 0x0ff; |
| 639 | 644 | hi = pSnapshot[9] & 0x0ff; |
| 640 | | cpunum_set_reg(0, Z80_SP, (hi << 8) | lo); |
| 645 | cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo); |
| 641 | 646 | |
| 642 | 647 | /* I */ |
| 643 | | cpunum_set_reg(0, Z80_I, (pSnapshot[10] & 0x0ff)); |
| 648 | cpu_set_reg(machine->cpu[0], Z80_I, (pSnapshot[10] & 0x0ff)); |
| 644 | 649 | |
| 645 | 650 | /* R */ |
| 646 | 651 | data = (pSnapshot[11] & 0x07f) | ((pSnapshot[12] & 0x01) << 7); |
| 647 | | cpunum_set_reg(0, Z80_R, data); |
| 652 | cpu_set_reg(machine->cpu[0], Z80_R, data); |
| 648 | 653 | |
| 649 | 654 | /* Set border colour */ |
| 650 | 655 | PreviousFE = (PreviousFE & 0xf8) | ((pSnapshot[12] & 0x0e) >> 1); |
| r3580 | r3581 | |
| 654 | 659 | |
| 655 | 660 | lo = pSnapshot[13] & 0x0ff; |
| 656 | 661 | hi = pSnapshot[14] & 0x0ff; |
| 657 | | cpunum_set_reg(0, Z80_DE, (hi << 8) | lo); |
| 662 | cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo); |
| 658 | 663 | |
| 659 | 664 | lo = pSnapshot[15] & 0x0ff; |
| 660 | 665 | hi = pSnapshot[16] & 0x0ff; |
| 661 | | cpunum_set_reg(0, Z80_BC2, (hi << 8) | lo); |
| 666 | cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo); |
| 662 | 667 | |
| 663 | 668 | lo = pSnapshot[17] & 0x0ff; |
| 664 | 669 | hi = pSnapshot[18] & 0x0ff; |
| 665 | | cpunum_set_reg(0, Z80_DE2, (hi << 8) | lo); |
| 670 | cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo); |
| 666 | 671 | |
| 667 | 672 | lo = pSnapshot[19] & 0x0ff; |
| 668 | 673 | hi = pSnapshot[20] & 0x0ff; |
| 669 | | cpunum_set_reg(0, Z80_HL2, (hi << 8) | lo); |
| 674 | cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo); |
| 670 | 675 | |
| 671 | 676 | hi = pSnapshot[21] & 0x0ff; |
| 672 | 677 | lo = pSnapshot[22] & 0x0ff; |
| 673 | | cpunum_set_reg(0, Z80_AF2, (hi << 8) | lo); |
| 678 | cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo); |
| 674 | 679 | |
| 675 | 680 | lo = pSnapshot[23] & 0x0ff; |
| 676 | 681 | hi = pSnapshot[24] & 0x0ff; |
| 677 | | cpunum_set_reg(0, Z80_IY, (hi << 8) | lo); |
| 682 | cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo); |
| 678 | 683 | |
| 679 | 684 | lo = pSnapshot[25] & 0x0ff; |
| 680 | 685 | hi = pSnapshot[26] & 0x0ff; |
| 681 | | cpunum_set_reg(0, Z80_IX, (hi << 8) | lo); |
| 686 | cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo); |
| 682 | 687 | |
| 683 | 688 | /* Interrupt Flip/Flop */ |
| 684 | 689 | if (pSnapshot[27] == 0) |
| 685 | 690 | { |
| 686 | | cpunum_set_reg(0, Z80_IFF1, 0); |
| 687 | | /* cpunum_set_reg(0, Z80_IRQ_STATE, 0); */ |
| 691 | cpu_set_reg(machine->cpu[0], Z80_IFF1, 0); |
| 692 | /* cpu_set_reg(machine->cpu[0], Z80_IRQ_STATE, 0); */ |
| 688 | 693 | } |
| 689 | 694 | else |
| 690 | 695 | { |
| 691 | | cpunum_set_reg(0, Z80_IFF1, 1); |
| 692 | | /* cpunum_set_reg(0, Z80_IRQ_STATE, 1); */ |
| 696 | cpu_set_reg(machine->cpu[0], Z80_IFF1, 1); |
| 697 | /* cpu_set_reg(machine->cpu[0], Z80_IRQ_STATE, 1); */ |
| 693 | 698 | } |
| 694 | 699 | |
| 695 | 700 | cpu_set_input_line(machine->cpu[0], 0, data); |
| r3580 | r3581 | |
| 705 | 710 | { |
| 706 | 711 | data = 0; |
| 707 | 712 | } |
| 708 | | cpunum_set_reg(0, Z80_IFF2, data); |
| 713 | cpu_set_reg(machine->cpu[0], Z80_IFF2, data); |
| 709 | 714 | |
| 710 | 715 | /* Interrupt Mode */ |
| 711 | | cpunum_set_reg(0, Z80_IM, (pSnapshot[29] & 0x03)); |
| 716 | cpu_set_reg(machine->cpu[0], Z80_IM, (pSnapshot[29] & 0x03)); |
| 712 | 717 | |
| 713 | 718 | if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K_OLD) |
| 714 | 719 | { |
| 715 | 720 | lo = pSnapshot[6] & 0x0ff; |
| 716 | 721 | hi = pSnapshot[7] & 0x0ff; |
| 717 | | cpunum_set_reg(0, Z80_PC, (hi << 8) | lo); |
| 722 | cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo); |
| 718 | 723 | |
| 719 | 724 | spectrum_page_basicrom(machine); |
| 720 | 725 | |
| r3580 | r3581 | |
| 722 | 727 | { |
| 723 | 728 | logerror("Not compressed\n"); /* not compressed */ |
| 724 | 729 | for (i = 0; i < 49152; i++) |
| 725 | | program_write_byte(i + 16384, pSnapshot[30 + i]); |
| 730 | memory_write_byte(space,i + 16384, pSnapshot[30 + i]); |
| 726 | 731 | } |
| 727 | 732 | else |
| 728 | 733 | { |
| 729 | 734 | logerror("Compressed\n"); /* compressed */ |
| 730 | | spectrum_z80_decompress_block(pSnapshot + 30, 16384, 49152); |
| 735 | spectrum_z80_decompress_block(machine, pSnapshot + 30, 16384, 49152); |
| 731 | 736 | } |
| 732 | 737 | } |
| 733 | 738 | else |
| r3580 | r3581 | |
| 739 | 744 | |
| 740 | 745 | lo = pSnapshot[32] & 0x0ff; |
| 741 | 746 | hi = pSnapshot[33] & 0x0ff; |
| 742 | | cpunum_set_reg(0, Z80_PC, (hi << 8) | lo); |
| 747 | cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo); |
| 743 | 748 | |
| 744 | 749 | if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine->gamedrv->name,"ts2068"))) |
| 745 | 750 | { |
| 746 | 751 | /* Only set up sound registers for 128K machine or TS2068! */ |
| 747 | 752 | for (i = 0; i < 16; i++) |
| 748 | 753 | { |
| 749 | | ay8910_control_port_0_w(machine, 0, i); |
| 750 | | ay8910_write_port_0_w(machine, 0, pSnapshot[39 + i]); |
| 754 | ay8910_control_port_0_w(space, 0, i); |
| 755 | ay8910_write_port_0_w(space, 0, pSnapshot[39 + i]); |
| 751 | 756 | } |
| 752 | | ay8910_control_port_0_w(machine, 0, pSnapshot[38]); |
| 757 | ay8910_control_port_0_w(space, 0, pSnapshot[38]); |
| 753 | 758 | } |
| 754 | 759 | |
| 755 | 760 | pSource = pSnapshot + header_size; |
| r3580 | r3581 | |
| 801 | 806 | |
| 802 | 807 | /* not compressed */ |
| 803 | 808 | for (i = 0; i < 16384; i++) |
| 804 | | program_write_byte(i + Dest, pSource[i]); |
| 809 | memory_write_byte(space,i + Dest, pSource[i]); |
| 805 | 810 | } |
| 806 | 811 | else |
| 807 | 812 | { |
| 808 | 813 | logerror("Compressed\n"); |
| 809 | 814 | |
| 810 | 815 | /* block is compressed */ |
| 811 | | spectrum_z80_decompress_block(&pSource[3], Dest, 16384); |
| 816 | spectrum_z80_decompress_block(machine,&pSource[3], Dest, 16384); |
| 812 | 817 | } |
| 813 | 818 | } |
| 814 | 819 | |
| r3580 | r3581 | |
| 850 | 855 | |
| 851 | 856 | QUICKLOAD_LOAD(spectrum) |
| 852 | 857 | { |
| 858 | const address_space *space = cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 853 | 859 | int i; |
| 854 | 860 | int quick_addr = 0x4000; |
| 855 | 861 | int quick_length; |
| r3580 | r3581 | |
| 866 | 872 | return INIT_FAIL; |
| 867 | 873 | |
| 868 | 874 | for (i = 0; i < quick_length; i++) |
| 869 | | program_write_byte(i + quick_addr, quick_data[i]); |
| 875 | memory_write_byte(space,i + quick_addr, quick_data[i]); |
| 870 | 876 | |
| 871 | 877 | logerror("quick loading at %.4x size:%.4x\n", quick_addr, quick_length); |
| 872 | 878 | return INIT_PASS; |
src/mess/machine/zx.c
| r3580 | r3581 | |
| 16 | 16 | #define DEBUG_ZX81_PORTS 1 |
| 17 | 17 | #define DEBUG_ZX81_VSYNC 1 |
| 18 | 18 | |
| 19 | | #define LOG_ZX81_IOR(_comment) { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOR: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, video_screen_get_vpos(machine->primary_screen), _comment); } |
| 20 | | #define LOG_ZX81_IOW(_comment) { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOW: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, video_screen_get_vpos(machine->primary_screen), _comment); } |
| 19 | #define LOG_ZX81_IOR(_comment) { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOR: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, video_screen_get_vpos(space->machine->primary_screen), _comment); } |
| 20 | #define LOG_ZX81_IOW(_comment) { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOW: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, video_screen_get_vpos(space->machine->primary_screen), _comment); } |
| 21 | 21 | #define LOG_ZX81_VSYNC { if (DEBUG_ZX81_VSYNC) logerror("VSYNC starts in scanline: %d\n", video_screen_get_vpos(machine->primary_screen)); } |
| 22 | 22 | |
| 23 | 23 | static UINT8 zx_tape_bit = 0x80; |
| 24 | 24 | |
| 25 | 25 | static WRITE8_HANDLER( zx_ram_w ) |
| 26 | 26 | { |
| 27 | | UINT8 *rom = memory_region(machine, "main"); |
| 28 | | |
| 27 | UINT8 *rom = memory_region(space->machine, "main"); |
| 29 | 28 | rom[offset | 0x4000] = data; |
| 30 | 29 | |
| 31 | 30 | if ((offset > 0x29) && (offset < 0x300)) |
| 32 | 31 | { |
| 33 | 32 | if (data & 0x40) |
| 34 | | program_write_byte (offset | 0xc000, data); |
| 33 | memory_write_byte (space, offset | 0xc000, data); |
| 35 | 34 | else |
| 36 | | program_write_byte (offset | 0xc000, 0); |
| 35 | memory_write_byte (space, offset | 0xc000, 0); |
| 37 | 36 | } |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | 39 | DRIVER_INIT ( zx ) |
| 41 | 40 | { |
| 42 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, SMH_BANK1); |
| 43 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, zx_ram_w); |
| 44 | | memory_set_bankptr(1, memory_region(machine, "main") + 0x4000); |
| 41 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 42 | |
| 43 | memory_install_read8_handler(space, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, SMH_BANK1); |
| 44 | memory_install_write8_handler(space, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, zx_ram_w); |
| 45 | memory_set_bankptr(machine, 1, memory_region(machine, "main") + 0x4000); |
| 45 | 46 | } |
| 46 | 47 | |
| 47 | 48 | #if 0 |
| 48 | | static OPBASE_HANDLER ( zx_setopbase ) |
| 49 | static OPBASE_HANDLER ( zx_setdirect ) |
| 49 | 50 | { |
| 50 | 51 | if ((address > 0xc029) && (address < 0xc300)) |
| 51 | 52 | { |
| r3580 | r3581 | |
| 62 | 63 | } |
| 63 | 64 | #endif |
| 64 | 65 | |
| 65 | | static OPBASE_HANDLER ( zx_setopbase ) |
| 66 | static DIRECT_UPDATE_HANDLER ( zx_setdirect ) |
| 66 | 67 | { |
| 67 | 68 | if (address & 0x8000) |
| 68 | | zx_ula_r(machine, address, "main"); |
| 69 | zx_ula_r(space->machine, address, "main"); |
| 69 | 70 | return address; |
| 70 | 71 | } |
| 71 | 72 | |
| 72 | | static OPBASE_HANDLER ( pc8300_setopbase ) |
| 73 | static DIRECT_UPDATE_HANDLER ( pc8300_setdirect ) |
| 73 | 74 | { |
| 74 | 75 | if (address & 0x8000) |
| 75 | | zx_ula_r(machine, address, "gfx1"); |
| 76 | zx_ula_r(space->machine, address, "gfx1"); |
| 76 | 77 | return address; |
| 77 | 78 | } |
| 78 | 79 | |
| 79 | | static void common_init_machine(opbase_handler_func setopbase) |
| 80 | | { |
| 81 | | memory_set_opbase_handler(0, setopbase); |
| 82 | | zx_tape_bit = 0x80; |
| 83 | | } |
| 84 | 80 | |
| 85 | 81 | MACHINE_RESET ( zx80 ) |
| 86 | 82 | { |
| 87 | | common_init_machine(zx_setopbase); |
| 83 | memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), zx_setdirect); |
| 84 | zx_tape_bit = 0x80; |
| 88 | 85 | } |
| 89 | 86 | |
| 90 | 87 | MACHINE_RESET ( zx81 ) |
| 91 | 88 | { |
| 92 | | common_init_machine(zx_setopbase); |
| 89 | memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), zx_setdirect); |
| 90 | zx_tape_bit = 0x80; |
| 93 | 91 | } |
| 94 | 92 | |
| 95 | 93 | MACHINE_RESET ( pc8300 ) |
| 96 | 94 | { |
| 97 | | common_init_machine(pc8300_setopbase); |
| 95 | memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), pc8300_setdirect); |
| 96 | zx_tape_bit = 0x80; |
| 98 | 97 | } |
| 99 | 98 | |
| 100 | 99 | static TIMER_CALLBACK(zx_tape_pulse) |
| r3580 | r3581 | |
| 104 | 103 | |
| 105 | 104 | WRITE8_HANDLER ( zx_io_w ) |
| 106 | 105 | { |
| 107 | | const device_config *screen = video_screen_first(machine->config); |
| 106 | const device_config *screen = video_screen_first(space->machine->config); |
| 108 | 107 | int height = video_screen_get_height(screen); |
| 109 | 108 | |
| 110 | 109 | if ((offset & 2) == 0) |
| r3580 | r3581 | |
| 124 | 123 | } |
| 125 | 124 | else |
| 126 | 125 | { |
| 127 | | zx_ula_bkgnd(machine, 1); |
| 126 | zx_ula_bkgnd(space->machine, 1); |
| 128 | 127 | if (ula_frame_vsync == 2) |
| 129 | 128 | { |
| 130 | | cpu_spinuntil_time(video_screen_get_time_until_pos(machine->primary_screen, height - 1, 0)); |
| 129 | cpu_spinuntil_time(space->cpu,video_screen_get_time_until_pos(space->machine->primary_screen, height - 1, 0)); |
| 131 | 130 | ula_scanline_count = height - 1; |
| 132 | | logerror ("S: %d B: %d\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); |
| 131 | logerror ("S: %d B: %d\n", video_screen_get_vpos(space->machine->primary_screen), video_screen_get_hpos(space->machine->primary_screen)); |
| 133 | 132 | } |
| 134 | 133 | |
| 135 | 134 | LOG_ZX81_IOW("ULA IRQs on"); |
| r3580 | r3581 | |
| 138 | 137 | |
| 139 | 138 | READ8_HANDLER ( zx_io_r ) |
| 140 | 139 | { |
| 141 | | const device_config *screen = video_screen_first(machine->config); |
| 140 | const device_config *screen = video_screen_first(space->machine->config); |
| 142 | 141 | int data = 0xff; |
| 143 | 142 | |
| 144 | 143 | if ((offset & 1) == 0) |
| 145 | 144 | { |
| 146 | | int extra1 = input_port_read(machine, "SPC0"); |
| 147 | | int extra2 = input_port_read(machine, "SPC1"); |
| 145 | int extra1 = input_port_read(space->machine, "SPC0"); |
| 146 | int extra2 = input_port_read(space->machine, "SPC1"); |
| 148 | 147 | |
| 149 | 148 | // ula_scancode_count = 0; |
| 150 | 149 | if ((offset & 0x0100) == 0) |
| 151 | 150 | { |
| 152 | | data &= input_port_read(machine, "ROW0"); |
| 151 | data &= input_port_read(space->machine, "ROW0"); |
| 153 | 152 | /* SHIFT for extra keys */ |
| 154 | 153 | if (extra1 != 0xff || extra2 != 0xff) |
| 155 | 154 | data &= ~0x01; |
| 156 | 155 | } |
| 157 | 156 | if ((offset & 0x0200) == 0) |
| 158 | | data &= input_port_read(machine, "ROW1"); |
| 157 | data &= input_port_read(space->machine, "ROW1"); |
| 159 | 158 | if ((offset & 0x0400) == 0) |
| 160 | | data &= input_port_read(machine, "ROW2"); |
| 159 | data &= input_port_read(space->machine, "ROW2"); |
| 161 | 160 | if ((offset & 0x0800) == 0) |
| 162 | | data &= input_port_read(machine, "ROW3") & extra1; |
| 161 | data &= input_port_read(space->machine, "ROW3") & extra1; |
| 163 | 162 | if ((offset & 0x1000) == 0) |
| 164 | | data &= input_port_read(machine, "ROW4") & extra2; |
| 163 | data &= input_port_read(space->machine, "ROW4") & extra2; |
| 165 | 164 | if ((offset & 0x2000) == 0) |
| 166 | | data &= input_port_read(machine, "ROW5"); |
| 165 | data &= input_port_read(space->machine, "ROW5"); |
| 167 | 166 | if ((offset & 0x4000) == 0) |
| 168 | | data &= input_port_read(machine, "ROW6"); |
| 167 | data &= input_port_read(space->machine, "ROW6"); |
| 169 | 168 | if ((offset & 0x8000) == 0) |
| 170 | | data &= input_port_read(machine, "ROW7"); |
| 169 | data &= input_port_read(space->machine, "ROW7"); |
| 171 | 170 | if (video_screen_get_refresh(screen) > 55) |
| 172 | 171 | data &= ~0x40; |
| 173 | 172 | |
| 174 | 173 | if (ula_irq_active) |
| 175 | 174 | { |
| 176 | | zx_ula_bkgnd(machine, 0); |
| 175 | zx_ula_bkgnd(space->machine, 0); |
| 177 | 176 | ula_irq_active = 0; |
| 178 | 177 | |
| 179 | 178 | LOG_ZX81_IOR("ULA IRQs off"); |
| 180 | 179 | } |
| 181 | 180 | else |
| 182 | 181 | { |
| 183 | | if ((cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) < -0.75) && zx_tape_bit) |
| 182 | if ((cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) < -0.75) && zx_tape_bit) |
| 184 | 183 | { |
| 185 | 184 | zx_tape_bit = 0x00; |
| 186 | 185 | timer_set(ATTOTIME_IN_USEC(362), NULL, 0, zx_tape_pulse); |
| r3580 | r3581 | |
| 193 | 192 | if (ula_frame_vsync == 3) |
| 194 | 193 | { |
| 195 | 194 | ula_frame_vsync = 2; |
| 196 | | LOG_ZX81_VSYNC; |
| 195 | // LOG_ZX81_VSYNC; |
| 197 | 196 | } |
| 198 | 197 | } |
| 199 | 198 | else |
| r3580 | r3581 | |
| 204 | 203 | |
| 205 | 204 | READ8_HANDLER ( pow3000_io_r ) |
| 206 | 205 | { |
| 207 | | const device_config *screen = video_screen_first(machine->config); |
| 206 | const device_config *screen = video_screen_first(space->machine->config); |
| 208 | 207 | int data = 0xff; |
| 209 | 208 | |
| 210 | 209 | if ((offset & 1) == 0) |
| 211 | 210 | { |
| 212 | | int extra1 = input_port_read(machine, "SPC0"); |
| 213 | | int extra2 = input_port_read(machine, "SPC1"); |
| 211 | int extra1 = input_port_read(space->machine, "SPC0"); |
| 212 | int extra2 = input_port_read(space->machine, "SPC1"); |
| 214 | 213 | |
| 215 | 214 | // ula_scancode_count = 0; |
| 216 | 215 | if ((offset & 0x0100) == 0) |
| 217 | 216 | { |
| 218 | | data &= input_port_read(machine, "ROW0") & extra1; |
| 217 | data &= input_port_read(space->machine, "ROW0") & extra1; |
| 219 | 218 | /* SHIFT for extra keys */ |
| 220 | 219 | if (extra1 != 0xff || extra2 != 0xff) |
| 221 | 220 | data &= ~0x01; |
| 222 | 221 | } |
| 223 | 222 | if ((offset & 0x0200) == 0) |
| 224 | | data &= input_port_read(machine, "ROW1") & extra2; |
| 223 | data &= input_port_read(space->machine, "ROW1") & extra2; |
| 225 | 224 | if ((offset & 0x0400) == 0) |
| 226 | | data &= input_port_read(machine, "ROW2"); |
| 225 | data &= input_port_read(space->machine, "ROW2"); |
| 227 | 226 | if ((offset & 0x0800) == 0) |
| 228 | | data &= input_port_read(machine, "ROW3"); |
| 227 | data &= input_port_read(space->machine, "ROW3"); |
| 229 | 228 | if ((offset & 0x1000) == 0) |
| 230 | | data &= input_port_read(machine, "ROW4"); |
| 229 | data &= input_port_read(space->machine, "ROW4"); |
| 231 | 230 | if ((offset & 0x2000) == 0) |
| 232 | | data &= input_port_read(machine, "ROW5"); |
| 231 | data &= input_port_read(space->machine, "ROW5"); |
| 233 | 232 | if ((offset & 0x4000) == 0) |
| 234 | | data &= input_port_read(machine, "ROW6"); |
| 233 | data &= input_port_read(space->machine, "ROW6"); |
| 235 | 234 | if ((offset & 0x8000) == 0) |
| 236 | | data &= input_port_read(machine, "ROW7"); |
| 235 | data &= input_port_read(space->machine, "ROW7"); |
| 237 | 236 | if (video_screen_get_refresh(screen) > 55) |
| 238 | 237 | data &= ~0x40; |
| 239 | 238 | |
| 240 | 239 | if (ula_irq_active) |
| 241 | 240 | { |
| 242 | | zx_ula_bkgnd(machine, 0); |
| 241 | zx_ula_bkgnd(space->machine, 0); |
| 243 | 242 | ula_irq_active = 0; |
| 244 | 243 | LOG_ZX81_IOR("ULA IRQs off"); |
| 245 | 244 | } |
| 246 | 245 | else |
| 247 | 246 | { |
| 248 | | if ((cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) < -0.75) && zx_tape_bit) |
| 247 | if ((cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) < -0.75) && zx_tape_bit) |
| 249 | 248 | { |
| 250 | 249 | zx_tape_bit = 0x00; |
| 251 | 250 | timer_set(ATTOTIME_IN_USEC(362), NULL, 0, zx_tape_pulse); |
| r3580 | r3581 | |
| 258 | 257 | if (ula_frame_vsync == 3) |
| 259 | 258 | { |
| 260 | 259 | ula_frame_vsync = 2; |
| 261 | | LOG_ZX81_VSYNC; |
| 260 | // LOG_ZX81_VSYNC; |
| 262 | 261 | } |
| 263 | 262 | } |
| 264 | 263 | else |
src/mess/drivers/scorpion.c
| r3580 | r3581 | |
| 196 | 196 | |
| 197 | 197 | static void scorpion_update_memory(running_machine *machine) |
| 198 | 198 | { |
| 199 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 199 | 200 | spectrum_128_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14)); |
| 200 | 201 | |
| 201 | | memory_set_bankptr(4, mess_ram + (((spectrum_128_port_7ffd_data & 0x07) | ((scorpion_256_port_1ffd_data & 0x10)>>1)) * 0x4000)); |
| 202 | memory_set_bankptr(machine, 4, mess_ram + (((spectrum_128_port_7ffd_data & 0x07) | ((scorpion_256_port_1ffd_data & 0x10)>>1)) * 0x4000)); |
| 202 | 203 | |
| 203 | 204 | if ((scorpion_256_port_1ffd_data & 0x01)==0x01) |
| 204 | 205 | { |
| 205 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 206 | | memory_set_bankptr(1, mess_ram+(8<<14)); |
| 206 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 207 | memory_set_bankptr(machine, 1, mess_ram+(8<<14)); |
| 207 | 208 | } |
| 208 | 209 | else |
| 209 | 210 | { |
| r3580 | r3581 | |
| 214 | 215 | /* ROM switching */ |
| 215 | 216 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 216 | 217 | } |
| 217 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 218 | | memory_set_bankptr(1, memory_region(machine, "main") + 0x010000 + (ROMSelection<<14)); |
| 218 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 219 | memory_set_bankptr(machine, 1, memory_region(machine, "main") + 0x010000 + (ROMSelection<<14)); |
| 219 | 220 | } |
| 220 | 221 | |
| 221 | 222 | |
| 222 | 223 | } |
| 223 | 224 | |
| 224 | | static OPBASE_HANDLER( scorpion_opbase ) |
| 225 | static DIRECT_UPDATE_HANDLER( scorpion_direct ) |
| 225 | 226 | { |
| 226 | 227 | if (betadisk_is_active()) { |
| 227 | | if (activecpu_get_pc() >= 0x4000) { |
| 228 | if (cpu_get_pc(space->machine->cpu[0]) >= 0x4000) { |
| 228 | 229 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 229 | 230 | betadisk_disable(); |
| 230 | | memory_set_bankptr(1, memory_region(machine, "main") + 0x010000 + 0x4000*ROMSelection); // Set BASIC ROM |
| 231 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 231 | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "main") + 0x010000 + 0x4000*ROMSelection); // Set BASIC ROM |
| 232 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 232 | 233 | } |
| 233 | | } else if (((activecpu_get_pc() & 0xff00) == 0x3d00) && (ROMSelection==1)) |
| 234 | } else if (((cpu_get_pc(space->machine->cpu[0]) & 0xff00) == 0x3d00) && (ROMSelection==1)) |
| 234 | 235 | { |
| 235 | 236 | ROMSelection = 3; |
| 236 | 237 | betadisk_enable(); |
| 237 | | memory_set_bankptr(1, memory_region(machine, "main") + 0x01c000); // Set TRDOS ROM |
| 238 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 238 | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "main") + 0x01c000); // Set TRDOS ROM |
| 239 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 239 | 240 | } |
| 240 | 241 | return address; |
| 241 | 242 | } |
| r3580 | r3581 | |
| 259 | 260 | spectrum_128_port_7ffd_data = data; |
| 260 | 261 | |
| 261 | 262 | /* update memory */ |
| 262 | | scorpion_update_memory(machine); |
| 263 | scorpion_update_memory(space->machine); |
| 263 | 264 | } |
| 264 | 265 | |
| 265 | 266 | static WRITE8_HANDLER(scorpion_port_1ffd_w) |
| r3580 | r3581 | |
| 268 | 269 | if ((spectrum_128_port_7ffd_data & 0x20)==0) |
| 269 | 270 | { |
| 270 | 271 | scorpion_256_port_1ffd_data = data; |
| 271 | | scorpion_update_memory(machine); |
| 272 | scorpion_update_memory(space->machine); |
| 272 | 273 | } |
| 273 | 274 | } |
| 274 | 275 | |
| r3580 | r3581 | |
| 289 | 290 | |
| 290 | 291 | static MACHINE_RESET( scorpion ) |
| 291 | 292 | { |
| 292 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 293 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 293 | 294 | |
| 295 | memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 296 | |
| 294 | 297 | betadisk_disable(); |
| 295 | 298 | betadisk_clear_status(); |
| 296 | 299 | |
| 297 | | memory_set_opbase_handler( 0, scorpion_opbase ); |
| 300 | memory_set_direct_update_handler(space, scorpion_direct ); |
| 298 | 301 | |
| 299 | 302 | memset(mess_ram,0,256*1024); |
| 300 | 303 | |
| 301 | 304 | /* Bank 5 is always in 0x4000 - 0x7fff */ |
| 302 | | memory_set_bankptr(2, mess_ram + (5<<14)); |
| 305 | memory_set_bankptr(machine, 2, mess_ram + (5<<14)); |
| 303 | 306 | |
| 304 | 307 | /* Bank 2 is always in 0x8000 - 0xbfff */ |
| 305 | | memory_set_bankptr(3, mess_ram + (2<<14)); |
| 308 | memory_set_bankptr(machine, 3, mess_ram + (2<<14)); |
| 306 | 309 | |
| 307 | 310 | spectrum_128_port_7ffd_data = 0; |
| 308 | 311 | scorpion_256_port_1ffd_data = 0; |
src/mess/drivers/specpls3.c
| r3580 | r3581 | |
| 184 | 184 | |
| 185 | 185 | static WRITE8_HANDLER(spectrum_plus3_port_3ffd_w) |
| 186 | 186 | { |
| 187 | | if (~input_port_read(machine, "CONFIG") & 0x20) |
| 188 | | nec765_data_w(machine, 0,data); |
| 187 | if (~input_port_read(space->machine, "CONFIG") & 0x20) |
| 188 | nec765_data_w(space, 0,data); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | static READ8_HANDLER(spectrum_plus3_port_3ffd_r) |
| 192 | 192 | { |
| 193 | | if (input_port_read(machine, "CONFIG") & 0x20) |
| 193 | if (input_port_read(space->machine, "CONFIG") & 0x20) |
| 194 | 194 | return 0xff; |
| 195 | 195 | else |
| 196 | | return nec765_data_r(machine, 0); |
| 196 | return nec765_data_r(space, 0); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | static READ8_HANDLER(spectrum_plus3_port_2ffd_r) |
| 201 | 201 | { |
| 202 | | if (input_port_read(machine, "CONFIG") & 0x20) |
| 202 | if (input_port_read(space->machine, "CONFIG") & 0x20) |
| 203 | 203 | return 0xff; |
| 204 | 204 | else |
| 205 | | return nec765_status_r(machine, 0); |
| 205 | return nec765_status_r(space, 0); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
| 209 | 209 | void spectrum_plus3_update_memory(running_machine *machine) |
| 210 | 210 | { |
| 211 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 212 | |
| 211 | 213 | if (spectrum_128_port_7ffd_data & 8) |
| 212 | 214 | { |
| 213 | 215 | logerror("+3 SCREEN 1: BLOCK 7\n"); |
| r3580 | r3581 | |
| 232 | 234 | ram_page = spectrum_128_port_7ffd_data & 0x07; |
| 233 | 235 | ram_data = mess_ram + (ram_page<<14); |
| 234 | 236 | |
| 235 | | memory_set_bankptr(4, ram_data); |
| 237 | memory_set_bankptr(machine, 4, ram_data); |
| 236 | 238 | |
| 237 | 239 | logerror("RAM at 0xc000: %02x\n",ram_page); |
| 238 | 240 | |
| 239 | 241 | /* Reset memory between 0x4000 - 0xbfff in case extended paging was being used */ |
| 240 | 242 | /* Bank 5 in 0x4000 - 0x7fff */ |
| 241 | | memory_set_bankptr(2, mess_ram + (5<<14)); |
| 243 | memory_set_bankptr(machine, 2, mess_ram + (5<<14)); |
| 242 | 244 | |
| 243 | 245 | /* Bank 2 in 0x8000 - 0xbfff */ |
| 244 | | memory_set_bankptr(3, mess_ram + (2<<14)); |
| 246 | memory_set_bankptr(machine, 3, mess_ram + (2<<14)); |
| 245 | 247 | |
| 246 | 248 | |
| 247 | 249 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) | |
| r3580 | r3581 | |
| 251 | 253 | |
| 252 | 254 | ChosenROM = memory_region(machine, "main") + 0x010000 + (ROMSelection<<14); |
| 253 | 255 | |
| 254 | | memory_set_bankptr(1, ChosenROM); |
| 255 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 256 | memory_set_bankptr(machine, 1, ChosenROM); |
| 257 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 256 | 258 | |
| 257 | 259 | logerror("rom switch: %02x\n", ROMSelection); |
| 258 | 260 | } |
| r3580 | r3581 | |
| 269 | 271 | memory_selection = &spectrum_plus3_memory_selections[(MemorySelection<<2)]; |
| 270 | 272 | |
| 271 | 273 | ram_data = mess_ram + (memory_selection[0]<<14); |
| 272 | | memory_set_bankptr(1, ram_data); |
| 274 | memory_set_bankptr(machine, 1, ram_data); |
| 273 | 275 | /* allow writes to 0x0000-0x03fff */ |
| 274 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 276 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK1); |
| 275 | 277 | |
| 276 | 278 | ram_data = mess_ram + (memory_selection[1]<<14); |
| 277 | | memory_set_bankptr(2, ram_data); |
| 279 | memory_set_bankptr(machine, 2, ram_data); |
| 278 | 280 | |
| 279 | 281 | ram_data = mess_ram + (memory_selection[2]<<14); |
| 280 | | memory_set_bankptr(3, ram_data); |
| 282 | memory_set_bankptr(machine, 3, ram_data); |
| 281 | 283 | |
| 282 | 284 | ram_data = mess_ram + (memory_selection[3]<<14); |
| 283 | | memory_set_bankptr(4, ram_data); |
| 285 | memory_set_bankptr(machine, 4, ram_data); |
| 284 | 286 | |
| 285 | 287 | logerror("extended memory paging: %02x\n",MemorySelection); |
| 286 | 288 | } |
| r3580 | r3581 | |
| 303 | 305 | spectrum_128_port_7ffd_data = data; |
| 304 | 306 | |
| 305 | 307 | /* update memory */ |
| 306 | | spectrum_plus3_update_memory(machine); |
| 308 | spectrum_plus3_update_memory(space->machine); |
| 307 | 309 | } |
| 308 | 310 | |
| 309 | 311 | static WRITE8_HANDLER(spectrum_plus3_port_1ffd_w) |
| r3580 | r3581 | |
| 325 | 327 | if ((spectrum_128_port_7ffd_data & 0x20)==0) |
| 326 | 328 | { |
| 327 | 329 | /* no */ |
| 328 | | spectrum_plus3_update_memory(machine); |
| 330 | spectrum_plus3_update_memory(space->machine); |
| 329 | 331 | } |
| 330 | 332 | } |
| 331 | 333 | |
src/mess/drivers/spectrum.c
| r3580 | r3581 | |
| 177 | 177 | if ((Changed & 0x07)!=0) |
| 178 | 178 | { |
| 179 | 179 | /* yes - send event */ |
| 180 | | EventList_AddItemOffset(machine, 0x0fe, data & 0x07, ATTOTIME_TO_CYCLES(0,attotime_mul(video_screen_get_scan_period(machine->primary_screen), video_screen_get_vpos(machine->primary_screen)))); |
| 180 | EventList_AddItemOffset(space->machine, 0x0fe, data & 0x07, ATTOTIME_TO_CYCLES(0,attotime_mul(video_screen_get_scan_period(space->machine->primary_screen), video_screen_get_vpos(space->machine->primary_screen)))); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | if ((Changed & (1<<4))!=0) |
| r3580 | r3581 | |
| 189 | 189 | if ((Changed & (1<<3))!=0) |
| 190 | 190 | { |
| 191 | 191 | /* write cassette data */ |
| 192 | | cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), (data & (1<<3)) ? -1.0 : +1.0); |
| 192 | cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), (data & (1<<3)) ? -1.0 : +1.0); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | PreviousFE = data; |
| r3580 | r3581 | |
| 209 | 209 | int lines = offset>>8; |
| 210 | 210 | int data = 0xff; |
| 211 | 211 | |
| 212 | | int cs_extra1 = input_port_read(machine, "PLUS0") & 0x1f; |
| 213 | | int cs_extra2 = input_port_read(machine, "PLUS1") & 0x1f; |
| 214 | | int cs_extra3 = input_port_read(machine, "PLUS2") & 0x1f; |
| 215 | | int ss_extra1 = input_port_read(machine, "PLUS3") & 0x1f; |
| 216 | | int ss_extra2 = input_port_read(machine, "PLUS4") & 0x1f; |
| 212 | int cs_extra1 = input_port_read(space->machine, "PLUS0") & 0x1f; |
| 213 | int cs_extra2 = input_port_read(space->machine, "PLUS1") & 0x1f; |
| 214 | int cs_extra3 = input_port_read(space->machine, "PLUS2") & 0x1f; |
| 215 | int ss_extra1 = input_port_read(space->machine, "PLUS3") & 0x1f; |
| 216 | int ss_extra2 = input_port_read(space->machine, "PLUS4") & 0x1f; |
| 217 | 217 | |
| 218 | 218 | /* Caps - V */ |
| 219 | 219 | if ((lines & 1)==0) |
| 220 | 220 | { |
| 221 | | data &= input_port_read(machine, "LINE0"); |
| 221 | data &= input_port_read(space->machine, "LINE0"); |
| 222 | 222 | /* CAPS for extra keys */ |
| 223 | 223 | if (cs_extra1 != 0x1f || cs_extra2 != 0x1f || cs_extra3 != 0x1f) |
| 224 | 224 | data &= ~0x01; |
| r3580 | r3581 | |
| 226 | 226 | |
| 227 | 227 | /* A - G */ |
| 228 | 228 | if ((lines & 2)==0) |
| 229 | | data &= input_port_read(machine, "LINE1"); |
| 229 | data &= input_port_read(space->machine, "LINE1"); |
| 230 | 230 | |
| 231 | 231 | /* Q - T */ |
| 232 | 232 | if ((lines & 4)==0) |
| 233 | | data &= input_port_read(machine, "LINE2"); |
| 233 | data &= input_port_read(space->machine, "LINE2"); |
| 234 | 234 | |
| 235 | 235 | /* 1 - 5 */ |
| 236 | 236 | if ((lines & 8)==0) |
| 237 | | data &= input_port_read(machine, "LINE3") & cs_extra1; |
| 237 | data &= input_port_read(space->machine, "LINE3") & cs_extra1; |
| 238 | 238 | |
| 239 | 239 | /* 6 - 0 */ |
| 240 | 240 | if ((lines & 16)==0) |
| 241 | | data &= input_port_read(machine, "LINE4") & cs_extra2; |
| 241 | data &= input_port_read(space->machine, "LINE4") & cs_extra2; |
| 242 | 242 | |
| 243 | 243 | /* Y - P */ |
| 244 | 244 | if ((lines & 32)==0) |
| 245 | | data &= input_port_read(machine, "LINE5") & ss_extra1; |
| 245 | data &= input_port_read(space->machine, "LINE5") & ss_extra1; |
| 246 | 246 | |
| 247 | 247 | /* H - Enter */ |
| 248 | 248 | if ((lines & 64)==0) |
| 249 | | data &= input_port_read(machine, "LINE6"); |
| 249 | data &= input_port_read(space->machine, "LINE6"); |
| 250 | 250 | |
| 251 | 251 | /* B - Space */ |
| 252 | 252 | if ((lines & 128)==0) |
| 253 | 253 | { |
| 254 | | data &= input_port_read(machine, "LINE7") & cs_extra3 & ss_extra2; |
| 254 | data &= input_port_read(space->machine, "LINE7") & cs_extra3 & ss_extra2; |
| 255 | 255 | /* SYMBOL SHIFT for extra keys */ |
| 256 | 256 | if (ss_extra1 != 0x1f || ss_extra2 != 0x1f) |
| 257 | 257 | data &= ~0x02; |
| r3580 | r3581 | |
| 260 | 260 | data |= (0xe0); /* Set bits 5-7 - as reset above */ |
| 261 | 261 | |
| 262 | 262 | /* cassette input from wav */ |
| 263 | | if (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038 ) |
| 263 | if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038 ) |
| 264 | 264 | { |
| 265 | 265 | data &= ~0x40; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /* Issue 2 Spectrums default to having bits 5, 6 & 7 set. |
| 269 | 269 | Issue 3 Spectrums default to having bits 5 & 7 set and bit 6 reset. */ |
| 270 | | if (input_port_read(machine, "CONFIG") & 0x80) |
| 270 | if (input_port_read(space->machine, "CONFIG") & 0x80) |
| 271 | 271 | data ^= (0x40); |
| 272 | 272 | return data; |
| 273 | 273 | } |
| r3580 | r3581 | |
| 275 | 275 | /* kempston joystick interface */ |
| 276 | 276 | READ8_HANDLER(spectrum_port_1f_r) |
| 277 | 277 | { |
| 278 | | return input_port_read(machine, "KEMPSTON") & 0x1f; |
| 278 | return input_port_read(space->machine, "KEMPSTON") & 0x1f; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /* fuller joystick interface */ |
| 282 | 282 | READ8_HANDLER(spectrum_port_7f_r) |
| 283 | 283 | { |
| 284 | | return input_port_read(machine, "FULLER") | (0xff^0x8f); |
| 284 | return input_port_read(space->machine, "FULLER") | (0xff^0x8f); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /* mikrogen joystick interface */ |
| 288 | 288 | READ8_HANDLER(spectrum_port_df_r) |
| 289 | 289 | { |
| 290 | | return input_port_read(machine, "MIKROGEN") | (0xff^0x1f); |
| 290 | return input_port_read(space->machine, "MIKROGEN") | (0xff^0x1f); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | static READ8_HANDLER ( spectrum_port_ula_r ) |
| 294 | 294 | { |
| 295 | | return video_screen_get_vpos(machine->primary_screen)<193 ? spectrum_colorram[(video_screen_get_vpos(machine->primary_screen)&0xf8)<<2]:0xff; |
| 295 | return video_screen_get_vpos(space->machine->primary_screen)<193 ? spectrum_colorram[(video_screen_get_vpos(space->machine->primary_screen)&0xf8)<<2]:0xff; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /* ports are not decoded full. |
| r3580 | r3581 | |
| 443 | 443 | |
| 444 | 444 | static INTERRUPT_GEN( spec_interrupt ) |
| 445 | 445 | { |
| 446 | | cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE); |
| 446 | cpu_set_input_line(device, 0, HOLD_LINE); |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | static const cassette_config spectrum_cassette_config = |
src/mess/drivers/timex.c
| r3580 | r3581 | |
| 169 | 169 | static WRITE8_HANDLER(ts2068_port_f4_w) |
| 170 | 170 | { |
| 171 | 171 | ts2068_port_f4_data = data; |
| 172 | | ts2068_update_memory(machine); |
| 172 | ts2068_update_memory(space->machine); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | static READ8_HANDLER(ts2068_port_ff_r) |
| r3580 | r3581 | |
| 186 | 186 | Bit 7 Cartridge (0) / EXROM (1) select |
| 187 | 187 | */ |
| 188 | 188 | ts2068_port_ff_data = data; |
| 189 | | ts2068_update_memory(machine); |
| 189 | ts2068_update_memory(space->machine); |
| 190 | 190 | logerror("Port %04x write %02x\n", offset, data); |
| 191 | 191 | } |
| 192 | 192 | |
| r3580 | r3581 | |
| 210 | 210 | *******************************************************************/ |
| 211 | 211 | void ts2068_update_memory(running_machine *machine) |
| 212 | 212 | { |
| 213 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 213 | 214 | unsigned char *ChosenROM, *ExROM, *DOCK; |
| 214 | | read8_machine_func rh; |
| 215 | | write8_machine_func wh; |
| 215 | read8_space_func rh; |
| 216 | write8_space_func wh; |
| 216 | 217 | |
| 217 | 218 | DOCK = timex_cart_data; |
| 218 | 219 | |
| r3580 | r3581 | |
| 224 | 225 | { |
| 225 | 226 | rh = SMH_BANK1; |
| 226 | 227 | wh = SMH_UNMAP; |
| 227 | | memory_set_bankptr(1, ExROM); |
| 228 | memory_set_bankptr(machine, 1, ExROM); |
| 228 | 229 | logerror("0000-1fff EXROM\n"); |
| 229 | 230 | } |
| 230 | 231 | else |
| 231 | 232 | { |
| 232 | 233 | if (timex_cart_type == TIMEX_CART_DOCK) |
| 233 | 234 | { |
| 234 | | memory_set_bankptr(1, DOCK); |
| 235 | memory_set_bankptr(machine, 1, DOCK); |
| 235 | 236 | rh = SMH_BANK1; |
| 236 | 237 | if (timex_cart_chunks&0x01) |
| 237 | 238 | wh = SMH_BANK9; |
| r3580 | r3581 | |
| 249 | 250 | else |
| 250 | 251 | { |
| 251 | 252 | ChosenROM = memory_region(machine, "main") + 0x010000; |
| 252 | | memory_set_bankptr(1, ChosenROM); |
| 253 | memory_set_bankptr(machine, 1, ChosenROM); |
| 253 | 254 | rh = SMH_BANK1; |
| 254 | 255 | wh = SMH_UNMAP; |
| 255 | 256 | logerror("0000-1fff HOME\n"); |
| 256 | 257 | } |
| 257 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x1fff, 0, 0, rh); |
| 258 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x1fff, 0, 0, wh); |
| 258 | memory_install_read8_handler(space, 0x0000, 0x1fff, 0, 0, rh); |
| 259 | memory_install_write8_handler(space, 0x0000, 0x1fff, 0, 0, wh); |
| 259 | 260 | |
| 260 | 261 | if (ts2068_port_f4_data & 0x02) |
| 261 | 262 | { |
| 262 | 263 | if (ts2068_port_ff_data & 0x80) |
| 263 | 264 | { |
| 264 | | memory_set_bankptr(2, ExROM); |
| 265 | memory_set_bankptr(machine, 2, ExROM); |
| 265 | 266 | rh = SMH_BANK2; |
| 266 | 267 | wh = SMH_UNMAP; |
| 267 | 268 | logerror("2000-3fff EXROM\n"); |
| r3580 | r3581 | |
| 270 | 271 | { |
| 271 | 272 | if (timex_cart_type == TIMEX_CART_DOCK) |
| 272 | 273 | { |
| 273 | | memory_set_bankptr(2, DOCK+0x2000); |
| 274 | memory_set_bankptr(machine, 2, DOCK+0x2000); |
| 274 | 275 | rh = SMH_BANK2; |
| 275 | 276 | if (timex_cart_chunks&0x02) |
| 276 | 277 | wh = SMH_BANK10; |
| r3580 | r3581 | |
| 288 | 289 | else |
| 289 | 290 | { |
| 290 | 291 | ChosenROM = memory_region(machine, "main") + 0x012000; |
| 291 | | memory_set_bankptr(2, ChosenROM); |
| 292 | memory_set_bankptr(machine, 2, ChosenROM); |
| 292 | 293 | rh = SMH_BANK2; |
| 293 | 294 | wh = SMH_UNMAP; |
| 294 | 295 | logerror("2000-3fff HOME\n"); |
| 295 | 296 | } |
| 296 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, rh); |
| 297 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, wh); |
| 297 | memory_install_read8_handler(space, 0x2000, 0x3fff, 0, 0, rh); |
| 298 | memory_install_write8_handler(space, 0x2000, 0x3fff, 0, 0, wh); |
| 298 | 299 | |
| 299 | 300 | if (ts2068_port_f4_data & 0x04) |
| 300 | 301 | { |
| 301 | 302 | if (ts2068_port_ff_data & 0x80) |
| 302 | 303 | { |
| 303 | | memory_set_bankptr(3, ExROM); |
| 304 | memory_set_bankptr(machine, 3, ExROM); |
| 304 | 305 | rh = SMH_BANK3; |
| 305 | 306 | wh = SMH_UNMAP; |
| 306 | 307 | logerror("4000-5fff EXROM\n"); |
| r3580 | r3581 | |
| 309 | 310 | { |
| 310 | 311 | if (timex_cart_type == TIMEX_CART_DOCK) |
| 311 | 312 | { |
| 312 | | memory_set_bankptr(3, DOCK+0x4000); |
| 313 | memory_set_bankptr(machine, 3, DOCK+0x4000); |
| 313 | 314 | rh = SMH_BANK3; |
| 314 | 315 | if (timex_cart_chunks&0x04) |
| 315 | 316 | wh = SMH_BANK11; |
| r3580 | r3581 | |
| 326 | 327 | } |
| 327 | 328 | else |
| 328 | 329 | { |
| 329 | | memory_set_bankptr(3, mess_ram); |
| 330 | | memory_set_bankptr(11, mess_ram); |
| 330 | memory_set_bankptr(machine, 3, mess_ram); |
| 331 | memory_set_bankptr(machine, 11, mess_ram); |
| 331 | 332 | rh = SMH_BANK3; |
| 332 | 333 | wh = SMH_BANK11; |
| 333 | 334 | logerror("4000-5fff RAM\n"); |
| 334 | 335 | } |
| 335 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, rh); |
| 336 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, wh); |
| 336 | memory_install_read8_handler(space, 0x4000, 0x5fff, 0, 0, rh); |
| 337 | memory_install_write8_handler(space, 0x4000, 0x5fff, 0, 0, wh); |
| 337 | 338 | |
| 338 | 339 | if (ts2068_port_f4_data & 0x08) |
| 339 | 340 | { |
| 340 | 341 | if (ts2068_port_ff_data & 0x80) |
| 341 | 342 | { |
| 342 | | memory_set_bankptr(4, ExROM); |
| 343 | memory_set_bankptr(machine, 4, ExROM); |
| 343 | 344 | rh = SMH_BANK4; |
| 344 | 345 | wh = SMH_UNMAP; |
| 345 | 346 | logerror("6000-7fff EXROM\n"); |
| r3580 | r3581 | |
| 348 | 349 | { |
| 349 | 350 | if (timex_cart_type == TIMEX_CART_DOCK) |
| 350 | 351 | { |
| 351 | | memory_set_bankptr(4, DOCK+0x6000); |
| 352 | memory_set_bankptr(machine, 4, DOCK+0x6000); |
| 352 | 353 | rh = SMH_BANK4; |
| 353 | 354 | if (timex_cart_chunks&0x08) |
| 354 | 355 | wh = SMH_BANK12; |
| r3580 | r3581 | |
| 365 | 366 | } |
| 366 | 367 | else |
| 367 | 368 | { |
| 368 | | memory_set_bankptr(4, mess_ram + 0x2000); |
| 369 | | memory_set_bankptr(12, mess_ram + 0x2000); |
| 369 | memory_set_bankptr(machine, 4, mess_ram + 0x2000); |
| 370 | memory_set_bankptr(machine, 12, mess_ram + 0x2000); |
| 370 | 371 | rh = SMH_BANK4; |
| 371 | 372 | wh = SMH_BANK12; |
| 372 | 373 | logerror("6000-7fff RAM\n"); |
| 373 | 374 | } |
| 374 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, rh); |
| 375 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, wh); |
| 375 | memory_install_read8_handler(space, 0x6000, 0x7fff, 0, 0, rh); |
| 376 | memory_install_write8_handler(space, 0x6000, 0x7fff, 0, 0, wh); |
| 376 | 377 | |
| 377 | 378 | if (ts2068_port_f4_data & 0x10) |
| 378 | 379 | { |
| 379 | 380 | if (ts2068_port_ff_data & 0x80) |
| 380 | 381 | { |
| 381 | | memory_set_bankptr(5, ExROM); |
| 382 | memory_set_bankptr(machine, 5, ExROM); |
| 382 | 383 | rh = SMH_BANK5; |
| 383 | 384 | wh = SMH_UNMAP; |
| 384 | 385 | logerror("8000-9fff EXROM\n"); |
| r3580 | r3581 | |
| 387 | 388 | { |
| 388 | 389 | if (timex_cart_type == TIMEX_CART_DOCK) |
| 389 | 390 | { |
| 390 | | memory_set_bankptr(5, DOCK+0x8000); |
| 391 | memory_set_bankptr(machine, 5, DOCK+0x8000); |
| 391 | 392 | rh = SMH_BANK5; |
| 392 | 393 | if (timex_cart_chunks&0x10) |
| 393 | 394 | wh = SMH_BANK13; |
| r3580 | r3581 | |
| 404 | 405 | } |
| 405 | 406 | else |
| 406 | 407 | { |
| 407 | | memory_set_bankptr(5, mess_ram + 0x4000); |
| 408 | | memory_set_bankptr(13, mess_ram + 0x4000); |
| 408 | memory_set_bankptr(machine, 5, mess_ram + 0x4000); |
| 409 | memory_set_bankptr(machine, 13, mess_ram + 0x4000); |
| 409 | 410 | rh = SMH_BANK5; |
| 410 | 411 | wh = SMH_BANK13; |
| 411 | 412 | logerror("8000-9fff RAM\n"); |
| 412 | 413 | } |
| 413 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x9fff, 0, 0,rh); |
| 414 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x9fff, 0, 0,wh); |
| 414 | memory_install_read8_handler(space, 0x8000, 0x9fff, 0, 0,rh); |
| 415 | memory_install_write8_handler(space, 0x8000, 0x9fff, 0, 0,wh); |
| 415 | 416 | |
| 416 | 417 | if (ts2068_port_f4_data & 0x20) |
| 417 | 418 | { |
| 418 | 419 | if (ts2068_port_ff_data & 0x80) |
| 419 | 420 | { |
| 420 | | memory_set_bankptr(6, ExROM); |
| 421 | memory_set_bankptr(machine, 6, ExROM); |
| 421 | 422 | rh = SMH_BANK6; |
| 422 | 423 | wh = SMH_UNMAP; |
| 423 | 424 | logerror("a000-bfff EXROM\n"); |
| r3580 | r3581 | |
| 426 | 427 | { |
| 427 | 428 | if (timex_cart_type == TIMEX_CART_DOCK) |
| 428 | 429 | { |
| 429 | | memory_set_bankptr(6, DOCK+0xa000); |
| 430 | memory_set_bankptr(machine, 6, DOCK+0xa000); |
| 430 | 431 | rh = SMH_BANK6; |
| 431 | 432 | if (timex_cart_chunks&0x20) |
| 432 | 433 | wh = SMH_BANK14; |
| r3580 | r3581 | |
| 443 | 444 | } |
| 444 | 445 | else |
| 445 | 446 | { |
| 446 | | memory_set_bankptr(6, mess_ram + 0x6000); |
| 447 | | memory_set_bankptr(14, mess_ram + 0x6000); |
| 447 | memory_set_bankptr(machine, 6, mess_ram + 0x6000); |
| 448 | memory_set_bankptr(machine, 14, mess_ram + 0x6000); |
| 448 | 449 | rh = SMH_BANK6; |
| 449 | 450 | wh = SMH_BANK14; |
| 450 | 451 | logerror("a000-bfff RAM\n"); |
| 451 | 452 | } |
| 452 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0, rh); |
| 453 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0, wh); |
| 453 | memory_install_read8_handler(space, 0xa000, 0xbfff, 0, 0, rh); |
| 454 | memory_install_write8_handler(space, 0xa000, 0xbfff, 0, 0, wh); |
| 454 | 455 | |
| 455 | 456 | if (ts2068_port_f4_data & 0x40) |
| 456 | 457 | { |
| 457 | 458 | if (ts2068_port_ff_data & 0x80) |
| 458 | 459 | { |
| 459 | | memory_set_bankptr(7, ExROM); |
| 460 | memory_set_bankptr(machine, 7, ExROM); |
| 460 | 461 | rh = SMH_BANK7; |
| 461 | 462 | wh = SMH_UNMAP; |
| 462 | 463 | logerror("c000-dfff EXROM\n"); |
| r3580 | r3581 | |
| 465 | 466 | { |
| 466 | 467 | if (timex_cart_type == TIMEX_CART_DOCK) |
| 467 | 468 | { |
| 468 | | memory_set_bankptr(7, DOCK+0xc000); |
| 469 | memory_set_bankptr(machine, 7, DOCK+0xc000); |
| 469 | 470 | rh = SMH_BANK7; |
| 470 | 471 | if (timex_cart_chunks&0x40) |
| 471 | 472 | wh = SMH_BANK15; |
| r3580 | r3581 | |
| 482 | 483 | } |
| 483 | 484 | else |
| 484 | 485 | { |
| 485 | | memory_set_bankptr(7, mess_ram + 0x8000); |
| 486 | | memory_set_bankptr(15, mess_ram + 0x8000); |
| 486 | memory_set_bankptr(machine, 7, mess_ram + 0x8000); |
| 487 | memory_set_bankptr(machine, 15, mess_ram + 0x8000); |
| 487 | 488 | rh = SMH_BANK7; |
| 488 | 489 | wh = SMH_BANK15; |
| 489 | 490 | logerror("c000-dfff RAM\n"); |
| 490 | 491 | } |
| 491 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, rh); |
| 492 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, wh); |
| 492 | memory_install_read8_handler(space, 0xc000, 0xdfff, 0, 0, rh); |
| 493 | memory_install_write8_handler(space, 0xc000, 0xdfff, 0, 0, wh); |
| 493 | 494 | |
| 494 | 495 | if (ts2068_port_f4_data & 0x80) |
| 495 | 496 | { |
| 496 | 497 | if (ts2068_port_ff_data & 0x80) |
| 497 | 498 | { |
| 498 | | memory_set_bankptr(8, ExROM); |
| 499 | memory_set_bankptr(machine, 8, ExROM); |
| 499 | 500 | rh = SMH_BANK8; |
| 500 | 501 | wh = SMH_UNMAP; |
| 501 | 502 | logerror("e000-ffff EXROM\n"); |
| r3580 | r3581 | |
| 504 | 505 | { |
| 505 | 506 | if (timex_cart_type == TIMEX_CART_DOCK) |
| 506 | 507 | { |
| 507 | | memory_set_bankptr(8, DOCK+0xe000); |
| 508 | memory_set_bankptr(machine, 8, DOCK+0xe000); |
| 508 | 509 | rh = SMH_BANK8; |
| 509 | 510 | if (timex_cart_chunks&0x80) |
| 510 | 511 | wh = SMH_BANK16; |
| r3580 | r3581 | |
| 521 | 522 | } |
| 522 | 523 | else |
| 523 | 524 | { |
| 524 | | memory_set_bankptr(8, mess_ram + 0xa000); |
| 525 | | memory_set_bankptr(16, mess_ram + 0xa000); |
| 525 | memory_set_bankptr(machine, 8, mess_ram + 0xa000); |
| 526 | memory_set_bankptr(machine, 16, mess_ram + 0xa000); |
| 526 | 527 | rh = SMH_BANK8; |
| 527 | 528 | wh = SMH_BANK16; |
| 528 | 529 | logerror("e000-ffff RAM\n"); |
| 529 | 530 | } |
| 530 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, rh); |
| 531 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, wh); |
| 531 | memory_install_read8_handler(space, 0xe000, 0xffff, 0, 0, rh); |
| 532 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, wh); |
| 532 | 533 | } |
| 533 | 534 | |
| 534 | 535 | static ADDRESS_MAP_START (ts2068_io, ADDRESS_SPACE_IO, 8) |
| r3580 | r3581 | |
| 589 | 590 | |
| 590 | 591 | static MACHINE_RESET( tc2048 ) |
| 591 | 592 | { |
| 592 | | memory_set_bankptr(1, mess_ram); |
| 593 | | memory_set_bankptr(2, mess_ram); |
| 593 | memory_set_bankptr(machine, 1, mess_ram); |
| 594 | memory_set_bankptr(machine, 2, mess_ram); |
| 594 | 595 | ts2068_port_ff_data = 0; |
| 595 | 596 | |
| 596 | 597 | MACHINE_RESET_CALL(spectrum); |