src/mess/machine/vc1541.c
| r3605 | r3606 | |
| 606 | 606 | |
| 607 | 607 | if (drive->type == type_1541) |
| 608 | 608 | { |
| 609 | | cpunum_set_input_line(machine, drive->cpunumber, M6502_SET_OVERFLOW, 1); |
| 610 | | via_3_ca1_w(machine, 0,1); |
| 609 | cpu_set_input_line(machine->cpu[drive->cpunumber], M6502_SET_OVERFLOW, 1); |
| 610 | via_3_ca1_w(cpu_get_address_space(machine->cpu[drive->cpunumber], ADDRESS_SPACE_PROGRAM), 0,1); |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | drive->clock = 1; |
| r3605 | r3606 | |
| 642 | 642 | |
| 643 | 643 | if (drive->type == type_1541) |
| 644 | 644 | { |
| 645 | | cpunum_set_input_line(machine, drive->cpunumber, M6502_SET_OVERFLOW, 0); |
| 646 | | via_3_ca1_w(machine, 0, 0); |
| 645 | cpu_set_input_line(machine->cpu[drive->cpunumber], M6502_SET_OVERFLOW, 0); |
| 646 | via_3_ca1_w(cpu_get_address_space(machine->cpu[drive->cpunumber], ADDRESS_SPACE_PROGRAM), 0, 0); |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | drive->clock = 0; |
| r3605 | r3606 | |
| 671 | 671 | drive->via0irq = level; |
| 672 | 672 | DBG_LOG(2, "vc1541 via0 irq",("level %d %d\n",drive->via0irq,drive->via1irq)); |
| 673 | 673 | |
| 674 | | cpunum_set_input_line (machine, drive->cpunumber, M6502_IRQ_LINE, drive->via1irq || drive->via0irq); |
| 674 | cpu_set_input_line (machine->cpu[drive->cpunumber], M6502_IRQ_LINE, drive->via1irq || drive->via0irq); |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | static READ8_HANDLER( vc1541_via0_read_portb ) |
| r3605 | r3606 | |
| 724 | 724 | vc1541_serial_clock_write (1, drive->drive.serial.serial_clock = !(data & 0x08)); |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | | vc1541_serial_atn_write (machine, 1, drive->drive.serial.serial_atn = 1); |
| 727 | vc1541_serial_atn_write (space->machine, 1, drive->drive.serial.serial_atn = 1); |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | |
| r3605 | r3606 | |
| 761 | 761 | drive->via1irq = level; |
| 762 | 762 | DBG_LOG(2, "vc1541 via1 irq", ("level %d %d\n", drive->via0irq, drive->via1irq)); |
| 763 | 763 | |
| 764 | | cpunum_set_input_line (machine, drive->cpunumber, M6502_IRQ_LINE, drive->via1irq || drive->via0irq); |
| 764 | cpu_set_input_line (machine->cpu[drive->cpunumber], M6502_IRQ_LINE, drive->via1irq || drive->via0irq); |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | static READ8_HANDLER( vc1541_via1_read_porta ) |
| r3605 | r3606 | |
| 940 | 940 | serial.atn[0] = serial.atn[1] && serial.atn[2]; |
| 941 | 941 | if (serial.atn[0] == level) |
| 942 | 942 | { |
| 943 | #if 0 |
| 943 | 944 | DBG_LOG(1, "vc1541",("%d:%.4x atn %s\n", |
| 944 | 945 | cpu_getactivecpu (), |
| 945 | 946 | activecpu_get_pc(), |
| 946 | 947 | serial.atn[0]?"ATN":"atn")); |
| 948 | #endif |
| 947 | 949 | via_set_input_ca1 (machine, 2, !level); |
| 948 | 950 | #if 0 |
| 949 | 951 | value=drive->drive.serial.data; |
| r3605 | r3606 | |
| 979 | 981 | if (serial.data[0] != level) |
| 980 | 982 | { |
| 981 | 983 | serial.data[0] = serial.data[1] && serial.data[2]; |
| 984 | #if 0 |
| 982 | 985 | if (serial.data[0] == level) |
| 983 | 986 | { |
| 984 | 987 | DBG_LOG(1, "vc1541",("%d:%.4x data %s\n", |
| r3605 | r3606 | |
| 986 | 989 | activecpu_get_pc(), |
| 987 | 990 | serial.data[0]?"DATA":"data")); |
| 988 | 991 | } |
| 992 | #endif |
| 989 | 993 | } |
| 990 | 994 | } |
| 991 | 995 | } |
| r3605 | r3606 | |
| 1011 | 1015 | serial.clock[0] = serial.clock[1] && serial.clock[2]; |
| 1012 | 1016 | if (serial.clock[0] == level) |
| 1013 | 1017 | { |
| 1014 | | DBG_LOG(1, "vc1541",("%d:%.4x clock %s\n", |
| 1018 | /* DBG_LOG(1, "vc1541",("%d:%.4x clock %s\n", |
| 1015 | 1019 | cpu_getactivecpu (), |
| 1016 | 1020 | activecpu_get_pc(), |
| 1017 | | serial.clock[0]?"CLOCK":"clock")); |
| 1021 | serial.clock[0]?"CLOCK":"clock"));*/ |
| 1018 | 1022 | } |
| 1019 | 1023 | } |
| 1020 | 1024 | } |
| r3605 | r3606 | |
| 1085 | 1089 | */ |
| 1086 | 1090 | static TIMER_CALLBACK(c1551_irq_timer) |
| 1087 | 1091 | { |
| 1088 | | cpunum_set_input_line(machine, drive->cpunumber, M6502_IRQ_LINE, PULSE_LINE); |
| 1092 | cpu_set_input_line(machine->cpu[drive->cpunumber], M6502_IRQ_LINE, PULSE_LINE); |
| 1089 | 1093 | } |
| 1090 | 1094 | |
| 1091 | 1095 | /* |
| r3605 | r3606 | |
| 1254 | 1258 | |
| 1255 | 1259 | static void c1551x_write_data (running_machine *machine, TPI6525 *This, int data) |
| 1256 | 1260 | { |
| 1257 | | DBG_LOG(1, "c1551 cpu", ("%d write data %.2x\n", cpu_getactivecpu (), data)); |
| 1261 | // DBG_LOG(1, "c1551 cpu", ("%d write data %.2x\n", cpu_getactivecpu (), data)); |
| 1258 | 1262 | #ifdef CPU_SYNC |
| 1259 | 1263 | cpu_sync(); |
| 1260 | 1264 | #endif |
| 1261 | | |
| 1262 | | tpi6525_0_port_a_w(machine, 0,data); |
| 1265 | tpi6525_0_port_a_w(cpu_get_address_space(machine->cpu[drive->cpunumber], ADDRESS_SPACE_PROGRAM), 0,data); |
| 1263 | 1266 | } |
| 1264 | 1267 | |
| 1265 | 1268 | static int c1551x_read_data (running_machine *machine, TPI6525 *This) |
| r3605 | r3606 | |
| 1269 | 1272 | cpu_sync (); |
| 1270 | 1273 | #endif |
| 1271 | 1274 | |
| 1272 | | data = tpi6525_0_port_a_r(machine, 0); |
| 1273 | | DBG_LOG(2, "c1551 cpu",("%d read data %.2x\n", cpu_getactivecpu (), data)); |
| 1275 | data = tpi6525_0_port_a_r(cpu_get_address_space(machine->cpu[drive->cpunumber], ADDRESS_SPACE_PROGRAM), 0); |
| 1276 | // DBG_LOG(2, "c1551 cpu",("%d read data %.2x\n", cpu_getactivecpu (), data)); |
| 1274 | 1277 | return data; |
| 1275 | 1278 | } |
| 1276 | 1279 | |
| 1277 | 1280 | static void c1551x_write_handshake (running_machine *machine, TPI6525 *This, int data) |
| 1278 | 1281 | { |
| 1279 | | DBG_LOG(1, "c1551 cpu",("%d write handshake %.2x\n", cpu_getactivecpu (), data)); |
| 1282 | // DBG_LOG(1, "c1551 cpu",("%d write handshake %.2x\n", cpu_getactivecpu (), data)); |
| 1280 | 1283 | #ifdef CPU_SYNC |
| 1281 | 1284 | cpu_sync(); |
| 1282 | 1285 | #endif |
| 1283 | 1286 | |
| 1284 | | tpi6525_0_port_c_w(machine, 0,data&0x40?0xff:0x7f); |
| 1287 | tpi6525_0_port_c_w(cpu_get_address_space(machine->cpu[drive->cpunumber], ADDRESS_SPACE_PROGRAM), 0,data&0x40?0xff:0x7f); |
| 1285 | 1288 | } |
| 1286 | 1289 | |
| 1287 | 1290 | static int c1551x_read_handshake (running_machine *machine, TPI6525 *This) |
| r3605 | r3606 | |
| 1291 | 1294 | cpu_sync(); |
| 1292 | 1295 | #endif |
| 1293 | 1296 | |
| 1294 | | data = tpi6525_0_port_c_r(machine, 0) & 0x08 ? 0x80 : 0x00; |
| 1295 | | DBG_LOG(2, "c1551 cpu",("%d read handshake %.2x\n", cpu_getactivecpu (), data)); |
| 1297 | data = tpi6525_0_port_c_r(cpu_get_address_space(machine->cpu[drive->cpunumber], ADDRESS_SPACE_PROGRAM), 0) & 0x08 ? 0x80 : 0x00; |
| 1298 | // DBG_LOG(2, "c1551 cpu",("%d read handshake %.2x\n", cpu_getactivecpu (), data)); |
| 1296 | 1299 | return data; |
| 1297 | 1300 | } |
| 1298 | 1301 | |
| r3605 | r3606 | |
| 1303 | 1306 | cpu_sync(); |
| 1304 | 1307 | #endif |
| 1305 | 1308 | |
| 1306 | | data = tpi6525_0_port_c_r(machine, 0) & 0x03; |
| 1307 | | DBG_LOG(1, "c1551 cpu",("%d read status %.2x\n", cpu_getactivecpu (), data)); |
| 1309 | data = tpi6525_0_port_c_r(cpu_get_address_space(machine->cpu[drive->cpunumber], ADDRESS_SPACE_PROGRAM), 0) & 0x03; |
| 1310 | // DBG_LOG(1, "c1551 cpu",("%d read status %.2x\n", cpu_getactivecpu (), data)); |
| 1308 | 1311 | |
| 1309 | 1312 | return data; |
| 1310 | 1313 | } |
src/mess/machine/cbmieeeb.c
| r3605 | r3606 | |
| 361 | 361 | |
| 362 | 362 | void cbm_ieee_dav_w(int device, int data) |
| 363 | 363 | { |
| 364 | | DBG_LOG(1,"cbm ieee dav",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 364 | // DBG_LOG(1,"cbm ieee dav",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 365 | 365 | cbmieee.bus[device].dav=data; |
| 366 | 366 | if (device==0) c2031_state(cbm_drive); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | void cbm_ieee_nrfd_w(int device, int data) |
| 370 | 370 | { |
| 371 | | DBG_LOG(1,"cbm ieee nrfd",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 371 | // DBG_LOG(1,"cbm ieee nrfd",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 372 | 372 | cbmieee.bus[device].nrfd=data; |
| 373 | 373 | if (device==0) c2031_state(cbm_drive); |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | void cbm_ieee_ndac_w(int device, int data) |
| 377 | 377 | { |
| 378 | | DBG_LOG(1,"cbm ieee ndac",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 378 | // DBG_LOG(1,"cbm ieee ndac",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 379 | 379 | cbmieee.bus[device].ndac=data; |
| 380 | 380 | if (device==0) c2031_state(cbm_drive); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | void cbm_ieee_atn_w(int device, int data) |
| 384 | 384 | { |
| 385 | | DBG_LOG(1,"cbm ieee atn",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 385 | // DBG_LOG(1,"cbm ieee atn",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 386 | 386 | cbmieee.bus[device].atn=data; |
| 387 | 387 | if (device==0) c2031_state(cbm_drive); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | void cbm_ieee_eoi_w(int device, int data) |
| 391 | 391 | { |
| 392 | | DBG_LOG(1,"cbm ieee eoi",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 392 | // DBG_LOG(1,"cbm ieee eoi",("%.4x dev:%d %d\n", activecpu_get_pc(), device, data)); |
| 393 | 393 | cbmieee.bus[device].eoi=data; |
| 394 | 394 | if (device==0) c2031_state(cbm_drive); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | void cbm_ieee_data_w(int device, int data) |
| 398 | 398 | { |
| 399 | | DBG_LOG(1,"cbm ieee data",("%.4x dev:%d %.2x\n", activecpu_get_pc(), device, data)); |
| 399 | // DBG_LOG(1,"cbm ieee data",("%.4x dev:%d %.2x\n", activecpu_get_pc(), device, data)); |
| 400 | 400 | cbmieee.bus[device].data=data; |
| 401 | 401 | if (device==0) c2031_state(cbm_drive); |
| 402 | 402 | } |
src/mess/machine/cbm.c
| r3605 | r3606 | |
| 8 | 8 | #include "includes/cbm.h" |
| 9 | 9 | #include "formats/cbm_tap.h" |
| 10 | 10 | |
| 11 | #include "deprecat.h" |
| 11 | 12 | |
| 12 | | |
| 13 | 13 | /*********************************************** |
| 14 | 14 | |
| 15 | 15 | CBM Quickloads |
| r3605 | r3606 | |
| 25 | 25 | UINT32 bytesread; |
| 26 | 26 | UINT16 address = 0; |
| 27 | 27 | int i; |
| 28 | const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 28 | 29 | |
| 29 | 30 | if (!file_type) |
| 30 | 31 | goto error; |
| r3605 | r3606 | |
| 73 | 74 | goto error; |
| 74 | 75 | |
| 75 | 76 | for (i = 0; i < snapshot_size; i++) |
| 76 | | program_write_byte(address + i + offset, data[i]); |
| 77 | memory_write_byte(space, address + i + offset, data[i]); |
| 77 | 78 | |
| 78 | 79 | cbm_sethiaddress(address + snapshot_size); |
| 79 | 80 | free(data); |
| r3605 | r3606 | |
| 87 | 88 | |
| 88 | 89 | static void cbm_quick_sethiaddress(UINT16 hiaddress) |
| 89 | 90 | { |
| 90 | | program_write_byte(0x31, hiaddress & 0xff); |
| 91 | | program_write_byte(0x2f, hiaddress & 0xff); |
| 92 | | program_write_byte(0x2d, hiaddress & 0xff); |
| 93 | | program_write_byte(0x32, hiaddress >> 8); |
| 94 | | program_write_byte(0x30, hiaddress >> 8); |
| 95 | | program_write_byte(0x2e, hiaddress >> 8); |
| 91 | const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 92 | |
| 93 | memory_write_byte(space, 0x31, hiaddress & 0xff); |
| 94 | memory_write_byte(space, 0x2f, hiaddress & 0xff); |
| 95 | memory_write_byte(space, 0x2d, hiaddress & 0xff); |
| 96 | memory_write_byte(space, 0x32, hiaddress >> 8); |
| 97 | memory_write_byte(space, 0x30, hiaddress >> 8); |
| 98 | memory_write_byte(space, 0x2e, hiaddress >> 8); |
| 96 | 99 | } |
| 97 | 100 | |
| 98 | 101 | QUICKLOAD_LOAD( cbm_c16 ) |
| r3605 | r3606 | |
| 112 | 115 | |
| 113 | 116 | static void cbm_pet_quick_sethiaddress(UINT16 hiaddress) |
| 114 | 117 | { |
| 115 | | program_write_byte(0x2e, hiaddress & 0xff); |
| 116 | | program_write_byte(0x2c, hiaddress & 0xff); |
| 117 | | program_write_byte(0x2a, hiaddress & 0xff); |
| 118 | | program_write_byte(0x2f, hiaddress >> 8); |
| 119 | | program_write_byte(0x2d, hiaddress >> 8); |
| 120 | | program_write_byte(0x2b, hiaddress >> 8); |
| 118 | const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 119 | |
| 120 | memory_write_byte(space, 0x2e, hiaddress & 0xff); |
| 121 | memory_write_byte(space, 0x2c, hiaddress & 0xff); |
| 122 | memory_write_byte(space, 0x2a, hiaddress & 0xff); |
| 123 | memory_write_byte(space, 0x2f, hiaddress >> 8); |
| 124 | memory_write_byte(space, 0x2d, hiaddress >> 8); |
| 125 | memory_write_byte(space, 0x2b, hiaddress >> 8); |
| 121 | 126 | } |
| 122 | 127 | |
| 123 | 128 | QUICKLOAD_LOAD( cbm_pet ) |
| r3605 | r3606 | |
| 127 | 132 | |
| 128 | 133 | static void cbm_pet1_quick_sethiaddress(UINT16 hiaddress) |
| 129 | 134 | { |
| 130 | | program_write_byte(0x80, hiaddress & 0xff); |
| 131 | | program_write_byte(0x7e, hiaddress & 0xff); |
| 132 | | program_write_byte(0x7c, hiaddress & 0xff); |
| 133 | | program_write_byte(0x81, hiaddress >> 8); |
| 134 | | program_write_byte(0x7f, hiaddress >> 8); |
| 135 | | program_write_byte(0x7d, hiaddress >> 8); |
| 135 | const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 136 | |
| 137 | memory_write_byte(space, 0x80, hiaddress & 0xff); |
| 138 | memory_write_byte(space, 0x7e, hiaddress & 0xff); |
| 139 | memory_write_byte(space, 0x7c, hiaddress & 0xff); |
| 140 | memory_write_byte(space, 0x81, hiaddress >> 8); |
| 141 | memory_write_byte(space, 0x7f, hiaddress >> 8); |
| 142 | memory_write_byte(space, 0x7d, hiaddress >> 8); |
| 136 | 143 | } |
| 137 | 144 | |
| 138 | 145 | QUICKLOAD_LOAD( cbm_pet1 ) |
| r3605 | r3606 | |
| 142 | 149 | |
| 143 | 150 | static void cbmb_quick_sethiaddress(UINT16 hiaddress) |
| 144 | 151 | { |
| 145 | | program_write_byte(0xf0046, hiaddress & 0xff); |
| 146 | | program_write_byte(0xf0047, hiaddress >> 8); |
| 152 | const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 153 | |
| 154 | memory_write_byte(space, 0xf0046, hiaddress & 0xff); |
| 155 | memory_write_byte(space, 0xf0047, hiaddress >> 8); |
| 147 | 156 | } |
| 148 | 157 | |
| 149 | 158 | QUICKLOAD_LOAD( cbmb ) |
| r3605 | r3606 | |
| 158 | 167 | |
| 159 | 168 | static void cbm_c65_quick_sethiaddress(UINT16 hiaddress) |
| 160 | 169 | { |
| 161 | | program_write_byte(0x82, hiaddress & 0xff); |
| 162 | | program_write_byte(0x83, hiaddress >> 8); |
| 170 | const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 171 | |
| 172 | memory_write_byte(space, 0x82, hiaddress & 0xff); |
| 173 | memory_write_byte(space, 0x83, hiaddress >> 8); |
| 163 | 174 | } |
| 164 | 175 | |
| 165 | 176 | QUICKLOAD_LOAD( cbm_c65 ) |
src/mess/machine/tpi6525.c
| r3605 | r3606 | |
| 459 | 459 | |
| 460 | 460 | READ8_HANDLER ( tpi6525_0_port_r ) |
| 461 | 461 | { |
| 462 | | return tpi6525_port_r(machine, tpi6525, offset); |
| 462 | return tpi6525_port_r(space->machine, tpi6525, offset); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | READ8_HANDLER ( tpi6525_1_port_r ) |
| 466 | 466 | { |
| 467 | | return tpi6525_port_r(machine, tpi6525+1, offset); |
| 467 | return tpi6525_port_r(space->machine, tpi6525+1, offset); |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | READ8_HANDLER ( tpi6525_2_port_r ) |
| 471 | 471 | { |
| 472 | | return tpi6525_port_r(machine, tpi6525+2, offset); |
| 472 | return tpi6525_port_r(space->machine, tpi6525+2, offset); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | READ8_HANDLER ( tpi6525_3_port_r ) |
| 476 | 476 | { |
| 477 | | return tpi6525_port_r(machine, tpi6525+3, offset); |
| 477 | return tpi6525_port_r(space->machine, tpi6525+3, offset); |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | WRITE8_HANDLER ( tpi6525_0_port_w ) |
| 481 | 481 | { |
| 482 | | tpi6525_port_w(machine, tpi6525, offset, data); |
| 482 | tpi6525_port_w(space->machine, tpi6525, offset, data); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | WRITE8_HANDLER ( tpi6525_1_port_w ) |
| 486 | 486 | { |
| 487 | | tpi6525_port_w(machine, tpi6525+1, offset, data); |
| 487 | tpi6525_port_w(space->machine, tpi6525+1, offset, data); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | WRITE8_HANDLER ( tpi6525_2_port_w ) |
| 491 | 491 | { |
| 492 | | tpi6525_port_w(machine, tpi6525+2, offset, data); |
| 492 | tpi6525_port_w(space->machine, tpi6525+2, offset, data); |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | WRITE8_HANDLER ( tpi6525_3_port_w ) |
| 496 | 496 | { |
| 497 | | tpi6525_port_w(machine, tpi6525+3, offset, data); |
| 497 | tpi6525_port_w(space->machine, tpi6525+3, offset, data); |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | READ8_HANDLER ( tpi6525_0_port_a_r ) |