src/mess/machine/pdp1.c
| r3642 | r3643 | |
| 528 | 528 | tape_reader.rcl = 0; |
| 529 | 529 | if (tape_reader.rcp) |
| 530 | 530 | { |
| 531 | | cpunum_set_reg(0, PDP1_IO, tape_reader.rb); /* transfer reader buffer to IO */ |
| 531 | cpu_set_reg(machine->cpu[0], PDP1_IO, tape_reader.rb); /* transfer reader buffer to IO */ |
| 532 | 532 | pdp1_pulse_iot_done(); |
| 533 | 533 | } |
| 534 | 534 | else |
| r3642 | r3643 | |
| 923 | 923 | { |
| 924 | 924 | io_status &= ~io_st_tyi; |
| 925 | 925 | if (USE_SBS) |
| 926 | | cpunum_set_input_line_and_vector(Machine, 0, 0, CLEAR_LINE, 0); /* interrupt it, baby */ |
| 926 | cpu_set_input_line_and_vector(Machine->cpu[0], 0, CLEAR_LINE, 0); /* interrupt it, baby */ |
| 927 | 927 | } |
| 928 | 928 | } |
| 929 | 929 | |
| r3642 | r3643 | |
| 993 | 993 | { |
| 994 | 994 | io_status |= io_st_pen; |
| 995 | 995 | |
| 996 | | cpunum_set_reg(0, PDP1_PF3, 1); |
| 996 | cpu_set_reg(machine->cpu[0], PDP1_PF3, 1); |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | if (nac) |
| r3642 | r3643 | |
| 1149 | 1149 | } while (parallel_drum.wc); |
| 1150 | 1150 | activecpu_adjust_icount(-ATTOTIME_TO_CYCLES(0, delay)); |
| 1151 | 1151 | /* if no error, skip */ |
| 1152 | | cpunum_set_reg(0, PDP1_PC, cpunum_get_reg(0, PDP1_PC)+1); |
| 1152 | cpu_set_reg(machine->cpu[0], PDP1_PC, cpunum_get_reg(0, PDP1_PC)+1); |
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | void iot_dra(int op2, int nac, int mb, int *io, int ac) |
| r3642 | r3643 | |
| 1276 | 1276 | typewriter.tb = (i << 4) + j; |
| 1277 | 1277 | io_status |= io_st_tyi; |
| 1278 | 1278 | #if USE_SBS |
| 1279 | | cpunum_set_input_line_and_vector(machine, 0, 0, ASSERT_LINE, 0); /* interrupt it, baby */ |
| 1279 | cpu_set_input_line_and_vector(machine->cpu[0], 0, ASSERT_LINE, 0); /* interrupt it, baby */ |
| 1280 | 1280 | #endif |
| 1281 | | cpunum_set_reg(0, PDP1_PF1, 1); |
| 1281 | cpu_set_reg(machine->cpu[0], PDP1_PF1, 1); |
| 1282 | 1282 | pdp1_typewriter_drawchar(machine, typewriter.tb); /* we want to echo input */ |
| 1283 | 1283 | break; |
| 1284 | 1284 | } |
| r3642 | r3643 | |
| 1359 | 1359 | int ta_transitions; |
| 1360 | 1360 | |
| 1361 | 1361 | |
| 1362 | | cpunum_set_reg(0, PDP1_SS, input_port_read(machine, "SENSE")); |
| 1362 | cpu_set_reg(machine->cpu[0], PDP1_SS, input_port_read(machine, "SENSE")); |
| 1363 | 1363 | |
| 1364 | 1364 | /* read new state of control keys */ |
| 1365 | 1365 | control_keys = input_port_read(machine, "CSW"); |
| r3642 | r3643 | |
| 1371 | 1371 | |
| 1372 | 1372 | if (control_transitions & pdp1_extend) |
| 1373 | 1373 | { |
| 1374 | | cpunum_set_reg(0, PDP1_EXTEND_SW, ! cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 1374 | cpu_set_reg(machine->cpu[0], PDP1_EXTEND_SW, ! cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 1375 | 1375 | } |
| 1376 | 1376 | if (control_transitions & pdp1_start_nobrk) |
| 1377 | 1377 | { |
| 1378 | 1378 | pdp1_pulse_start_clear(); /* pulse Start Clear line */ |
| 1379 | | cpunum_set_reg(0, PDP1_EXD, cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 1380 | | cpunum_set_reg(0, PDP1_SBM, 0); |
| 1381 | | cpunum_set_reg(0, PDP1_OV, 0); |
| 1382 | | cpunum_set_reg(0, PDP1_PC, cpunum_get_reg(0, PDP1_TA)); |
| 1383 | | cpunum_set_reg(0, PDP1_RUN, 1); |
| 1379 | cpu_set_reg(machine->cpu[0], PDP1_EXD, cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 1380 | cpu_set_reg(machine->cpu[0], PDP1_SBM, 0); |
| 1381 | cpu_set_reg(machine->cpu[0], PDP1_OV, 0); |
| 1382 | cpu_set_reg(machine->cpu[0], PDP1_PC, cpunum_get_reg(0, PDP1_TA)); |
| 1383 | cpu_set_reg(machine->cpu[0], PDP1_RUN, 1); |
| 1384 | 1384 | } |
| 1385 | 1385 | if (control_transitions & pdp1_start_brk) |
| 1386 | 1386 | { |
| 1387 | 1387 | pdp1_pulse_start_clear(); /* pulse Start Clear line */ |
| 1388 | | cpunum_set_reg(0, PDP1_EXD, cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 1389 | | cpunum_set_reg(0, PDP1_SBM, 1); |
| 1390 | | cpunum_set_reg(0, PDP1_OV, 0); |
| 1391 | | cpunum_set_reg(0, PDP1_PC, cpunum_get_reg(0, PDP1_TA)); |
| 1392 | | cpunum_set_reg(0, PDP1_RUN, 1); |
| 1388 | cpu_set_reg(machine->cpu[0], PDP1_EXD, cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 1389 | cpu_set_reg(machine->cpu[0], PDP1_SBM, 1); |
| 1390 | cpu_set_reg(machine->cpu[0], PDP1_OV, 0); |
| 1391 | cpu_set_reg(machine->cpu[0], PDP1_PC, cpunum_get_reg(0, PDP1_TA)); |
| 1392 | cpu_set_reg(machine->cpu[0], PDP1_RUN, 1); |
| 1393 | 1393 | } |
| 1394 | 1394 | if (control_transitions & pdp1_stop) |
| 1395 | 1395 | { |
| 1396 | | cpunum_set_reg(0, PDP1_RUN, 0); |
| 1397 | | cpunum_set_reg(0, PDP1_RIM, 0); /* bug : we stop after reading an even-numbered word |
| 1396 | cpu_set_reg(machine->cpu[0], PDP1_RUN, 0); |
| 1397 | cpu_set_reg(machine->cpu[0], PDP1_RIM, 0); /* bug : we stop after reading an even-numbered word |
| 1398 | 1398 | (i.e. data), whereas a real pdp-1 stops after reading |
| 1399 | 1399 | an odd-numbered word (i.e. dio instruciton) */ |
| 1400 | 1400 | } |
| 1401 | 1401 | if (control_transitions & pdp1_continue) |
| 1402 | 1402 | { |
| 1403 | | cpunum_set_reg(0, PDP1_RUN, 1); |
| 1403 | cpu_set_reg(machine->cpu[0], PDP1_RUN, 1); |
| 1404 | 1404 | } |
| 1405 | 1405 | if (control_transitions & pdp1_examine) |
| 1406 | 1406 | { |
| 1407 | 1407 | pdp1_pulse_start_clear(); /* pulse Start Clear line */ |
| 1408 | | cpunum_set_reg(0, PDP1_PC, cpunum_get_reg(0, PDP1_TA)); |
| 1409 | | cpunum_set_reg(0, PDP1_MA, cpunum_get_reg(0, PDP1_PC)); |
| 1410 | | cpunum_set_reg(0, PDP1_IR, LAC); /* this instruction is actually executed */ |
| 1408 | cpu_set_reg(machine->cpu[0], PDP1_PC, cpunum_get_reg(0, PDP1_TA)); |
| 1409 | cpu_set_reg(machine->cpu[0], PDP1_MA, cpunum_get_reg(0, PDP1_PC)); |
| 1410 | cpu_set_reg(machine->cpu[0], PDP1_IR, LAC); /* this instruction is actually executed */ |
| 1411 | 1411 | |
| 1412 | | cpunum_set_reg(0, PDP1_MB, READ_PDP_18BIT(cpunum_get_reg(0, PDP1_MA))); |
| 1413 | | cpunum_set_reg(0, PDP1_AC, cpunum_get_reg(0, PDP1_MB)); |
| 1412 | cpu_set_reg(machine->cpu[0], PDP1_MB, READ_PDP_18BIT(cpunum_get_reg(0, PDP1_MA))); |
| 1413 | cpu_set_reg(machine->cpu[0], PDP1_AC, cpunum_get_reg(0, PDP1_MB)); |
| 1414 | 1414 | } |
| 1415 | 1415 | if (control_transitions & pdp1_deposit) |
| 1416 | 1416 | { |
| 1417 | 1417 | pdp1_pulse_start_clear(); /* pulse Start Clear line */ |
| 1418 | | cpunum_set_reg(0, PDP1_PC, cpunum_get_reg(0, PDP1_TA)); |
| 1419 | | cpunum_set_reg(0, PDP1_MA, cpunum_get_reg(0, PDP1_PC)); |
| 1420 | | cpunum_set_reg(0, PDP1_AC, cpunum_get_reg(0, PDP1_TW)); |
| 1421 | | cpunum_set_reg(0, PDP1_IR, DAC); /* this instruction is actually executed */ |
| 1418 | cpu_set_reg(machine->cpu[0], PDP1_PC, cpunum_get_reg(0, PDP1_TA)); |
| 1419 | cpu_set_reg(machine->cpu[0], PDP1_MA, cpunum_get_reg(0, PDP1_PC)); |
| 1420 | cpu_set_reg(machine->cpu[0], PDP1_AC, cpunum_get_reg(0, PDP1_TW)); |
| 1421 | cpu_set_reg(machine->cpu[0], PDP1_IR, DAC); /* this instruction is actually executed */ |
| 1422 | 1422 | |
| 1423 | | cpunum_set_reg(0, PDP1_MB, cpunum_get_reg(0, PDP1_AC)); |
| 1423 | cpu_set_reg(machine->cpu[0], PDP1_MB, cpunum_get_reg(0, PDP1_AC)); |
| 1424 | 1424 | WRITE_PDP_18BIT(cpunum_get_reg(0, PDP1_MA), cpunum_get_reg(0, PDP1_MB)); |
| 1425 | 1425 | } |
| 1426 | 1426 | if (control_transitions & pdp1_read_in) |
| 1427 | 1427 | { /* set cpu to read instructions from perforated tape */ |
| 1428 | 1428 | pdp1_pulse_start_clear(); /* pulse Start Clear line */ |
| 1429 | | cpunum_set_reg(0, PDP1_PC, (cpunum_get_reg(0, PDP1_TA) & 0170000) |
| 1429 | cpu_set_reg(machine->cpu[0], PDP1_PC, (cpunum_get_reg(0, PDP1_TA) & 0170000) |
| 1430 | 1430 | | (cpunum_get_reg(0, PDP1_PC) & 0007777)); /* transfer ETA to EPC */ |
| 1431 | | /*cpunum_set_reg(0, PDP1_MA, cpunum_get_reg(0, PDP1_PC));*/ |
| 1432 | | cpunum_set_reg(0, PDP1_EXD, cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 1433 | | cpunum_set_reg(0, PDP1_OV, 0); /* right??? */ |
| 1434 | | cpunum_set_reg(0, PDP1_RUN, 0); |
| 1435 | | cpunum_set_reg(0, PDP1_RIM, 1); |
| 1431 | /*cpu_set_reg(machine->cpu[0], PDP1_MA, cpunum_get_reg(0, PDP1_PC));*/ |
| 1432 | cpu_set_reg(machine->cpu[0], PDP1_EXD, cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 1433 | cpu_set_reg(machine->cpu[0], PDP1_OV, 0); /* right??? */ |
| 1434 | cpu_set_reg(machine->cpu[0], PDP1_RUN, 0); |
| 1435 | cpu_set_reg(machine->cpu[0], PDP1_RIM, 1); |
| 1436 | 1436 | } |
| 1437 | 1437 | if (control_transitions & pdp1_reader) |
| 1438 | 1438 | { |
| r3642 | r3643 | |
| 1442 | 1442 | } |
| 1443 | 1443 | if (control_transitions & pdp1_single_step) |
| 1444 | 1444 | { |
| 1445 | | cpunum_set_reg(0, PDP1_SNGL_STEP, ! cpunum_get_reg(0, PDP1_SNGL_STEP)); |
| 1445 | cpu_set_reg(machine->cpu[0], PDP1_SNGL_STEP, ! cpunum_get_reg(0, PDP1_SNGL_STEP)); |
| 1446 | 1446 | } |
| 1447 | 1447 | if (control_transitions & pdp1_single_inst) |
| 1448 | 1448 | { |
| 1449 | | cpunum_set_reg(0, PDP1_SNGL_INST, ! cpunum_get_reg(0, PDP1_SNGL_INST)); |
| 1449 | cpu_set_reg(machine->cpu[0], PDP1_SNGL_INST, ! cpunum_get_reg(0, PDP1_SNGL_INST)); |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | /* remember new state of control keys */ |
| r3642 | r3643 | |
| 1460 | 1460 | tw_transitions = tw_keys & (~ old_tw_keys); |
| 1461 | 1461 | |
| 1462 | 1462 | if (tw_transitions) |
| 1463 | | cpunum_set_reg(0, PDP1_TW, cpunum_get_reg(0, PDP1_TW) ^ tw_transitions); |
| 1463 | cpu_set_reg(machine->cpu[0], PDP1_TW, cpunum_get_reg(0, PDP1_TW) ^ tw_transitions); |
| 1464 | 1464 | |
| 1465 | 1465 | /* remember new state of test word keys */ |
| 1466 | 1466 | old_tw_keys = tw_keys; |
| r3642 | r3643 | |
| 1473 | 1473 | ta_transitions = ta_keys & (~ old_ta_keys); |
| 1474 | 1474 | |
| 1475 | 1475 | if (ta_transitions) |
| 1476 | | cpunum_set_reg(0, PDP1_TA, cpunum_get_reg(0, PDP1_TA) ^ ta_transitions); |
| 1476 | cpu_set_reg(machine->cpu[0], PDP1_TA, cpunum_get_reg(0, PDP1_TA) ^ ta_transitions); |
| 1477 | 1477 | |
| 1478 | 1478 | /* remember new state of test word keys */ |
| 1479 | 1479 | old_ta_keys = ta_keys; |
src/mess/machine/dai.c
| r3642 | r3643 | |
| 34 | 34 | |
| 35 | 35 | static DIRECT_UPDATE_HANDLER(dai_opbaseoverride) |
| 36 | 36 | { |
| 37 | | tms5501_set_pio_bit_7 (0, (input_port_read(machine, "IN8") & 0x04) ? 1:0); |
| 37 | tms5501_set_pio_bit_7 (0, (input_port_read(space->machine, "IN8") & 0x04) ? 1:0); |
| 38 | 38 | return address; |
| 39 | 39 | } |
| 40 | 40 | |
| r3642 | r3643 | |
| 46 | 46 | tms5501_sensor (0, 0); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | | static void dai_update_memory (int dai_rom_bank) |
| 49 | static void dai_update_memory(running_machine *machine, int dai_rom_bank) |
| 50 | 50 | { |
| 51 | 51 | memory_set_bank(machine, 2, dai_rom_bank); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | static TIMER_CALLBACK(dai_bootstrap_callback) |
| 55 | 55 | { |
| 56 | | cpunum_set_reg(0, I8080_PC, 0xc000); |
| 56 | cpu_set_reg(machine->cpu[0], I8080_PC, 0xc000); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | static UINT8 dai_keyboard_scan_mask = 0; |
| r3642 | r3643 | |
| 80 | 80 | static void dai_interrupt_callback(int intreq, UINT8 vector) |
| 81 | 81 | { |
| 82 | 82 | if (intreq) |
| 83 | | cpunum_set_input_line_and_vector(Machine, 0, 0, HOLD_LINE, vector); |
| 83 | cpu_set_input_line_and_vector(Machine->cpu[0], 0, HOLD_LINE, vector); |
| 84 | 84 | else |
| 85 | 85 | cpu_set_input_line(Machine->cpu[0], 0, CLEAR_LINE); |
| 86 | 86 | } |
| r3642 | r3643 | |
| 180 | 180 | bit 6-7 ROM bank switching |
| 181 | 181 | ***************************************************************************/ |
| 182 | 182 | |
| 183 | | READ8_HANDLER( dai_io_discrete_devices_r ) |
| 183 | READ8_HANDLER( dai_io_discrete_devices_r ) |
| 184 | 184 | { |
| 185 | 185 | UINT8 data = 0x00; |
| 186 | 186 | |
| 187 | 187 | switch(offset & 0x000f) { |
| 188 | 188 | case 0x00: |
| 189 | | data = input_port_read(machine, "IN8"); |
| 189 | data = input_port_read(space->machine, "IN8"); |
| 190 | 190 | data |= 0x08; // serial ready |
| 191 | | if (mame_rand(machine)&0x01) |
| 191 | if (mame_rand(space->machine)&0x01) |
| 192 | 192 | data |= 0x40; // random number generator |
| 193 | | if (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.01) |
| 193 | if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.01) |
| 194 | 194 | data |= 0x80; // tape input |
| 195 | 195 | break; |
| 196 | 196 | |
| r3642 | r3643 | |
| 225 | 225 | dai_paddle_enable = (data&0x08)>>3; |
| 226 | 226 | dai_cassette_motor[0] = (data&0x10)>>4; |
| 227 | 227 | dai_cassette_motor[1] = (data&0x20)>>5; |
| 228 | | cassette_change_state(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), dai_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 229 | | cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x01) ? -1.0 : 1.0); |
| 230 | | dai_update_memory ((data&0xc0)>>6); |
| 228 | cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), dai_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 229 | cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), (data & 0x01) ? -1.0 : 1.0); |
| 230 | dai_update_memory (space->machine, (data&0xc0)>>6); |
| 231 | 231 | LOG_DAI_PORT_W (offset, (data&0x06)>>2, "discrete devices - paddle select"); |
| 232 | 232 | LOG_DAI_PORT_W (offset, (data&0x08)>>3, "discrete devices - paddle enable"); |
| 233 | 233 | LOG_DAI_PORT_W (offset, (data&0x10)>>4, "discrete devices - cassette motor 1"); |
src/mess/machine/tx0.c
| r3642 | r3643 | |
| 341 | 341 | /* shuffle and insert data into AC */ |
| 342 | 342 | ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3); |
| 343 | 343 | /* write modified AC */ |
| 344 | | cpunum_set_reg(0, TX0_AC, ac); |
| 344 | cpu_set_reg(machine->cpu[0], TX0_AC, ac); |
| 345 | 345 | |
| 346 | 346 | tape_reader.rc = (tape_reader.rc+1) & 3; |
| 347 | 347 | |
| r3642 | r3643 | |
| 595 | 595 | if ((magtape.state == MTS_SELECTED) || ((magtape.state == MTS_SELECTING) && (magtape.command == 2))) |
| 596 | 596 | { /* unit has become unavailable */ |
| 597 | 597 | magtape.state = MTS_UNSELECTING; |
| 598 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_RWC); |
| 598 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_RWC); |
| 599 | 599 | schedule_unselect(); |
| 600 | 600 | } |
| 601 | 601 | } |
| r3642 | r3643 | |
| 623 | 623 | if ((mar & 03) != 1) |
| 624 | 624 | { /* unimplemented device: remain in unselected state and set rwc |
| 625 | 625 | flag? */ |
| 626 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_RWC); |
| 626 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_RWC); |
| 627 | 627 | } |
| 628 | 628 | else |
| 629 | 629 | { |
| r3642 | r3643 | |
| 681 | 681 | if (image_ftell(magtape.img) == 0) |
| 682 | 682 | { /* tape at ldp */ |
| 683 | 683 | magtape.state = MTS_UNSELECTING; |
| 684 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_RWC); |
| 684 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_RWC); |
| 685 | 685 | schedule_unselect(); |
| 686 | 686 | } |
| 687 | 687 | else if (image_fseek(magtape.img, -1, SEEK_CUR)) |
| r3642 | r3643 | |
| 750 | 750 | logerror("invalid longitudinal parity\n"); |
| 751 | 751 | /* set EOR and unselect... */ |
| 752 | 752 | magtape.state = MTS_UNSELECTING; |
| 753 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_EOR); |
| 753 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_EOR); |
| 754 | 754 | schedule_unselect(); |
| 755 | 755 | magtape.irg_pos = MTIRGP_ENDMINUS1; |
| 756 | 756 | } |
| r3642 | r3643 | |
| 806 | 806 | /*image_unload(magtape.img);*/ |
| 807 | 807 | /* Or do we stop at EOT mark??? */ |
| 808 | 808 | magtape.state = MTS_UNSELECTING; |
| 809 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_EOT); |
| 809 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_EOT); |
| 810 | 810 | schedule_unselect(); |
| 811 | 811 | } |
| 812 | 812 | } |
| r3642 | r3643 | |
| 824 | 824 | { /* read command */ |
| 825 | 825 | magtape.u.read.space_flag = FALSE; |
| 826 | 826 | tx0_pulse_io_complete(); |
| 827 | | cpunum_set_reg(0, TX0_LR, ((cpunum_get_reg(0, TX0_LR) >> 1) & 0333333) |
| 827 | cpu_set_reg(machine->cpu[0], TX0_LR, ((cpunum_get_reg(0, TX0_LR) >> 1) & 0333333) |
| 828 | 828 | | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); |
| 829 | 829 | /* check parity */ |
| 830 | 830 | if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ magtape.binary_flag)) |
| 831 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 831 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 832 | 832 | } |
| 833 | 833 | else |
| 834 | 834 | { /* space command */ |
| r3642 | r3643 | |
| 847 | 847 | } |
| 848 | 848 | if (!magtape.u.read.space_flag) |
| 849 | 849 | { |
| 850 | | cpunum_set_reg(0, TX0_LR, ((cpunum_get_reg(0, TX0_LR) >> 1) & 0333333) |
| 850 | cpu_set_reg(machine->cpu[0], TX0_LR, ((cpunum_get_reg(0, TX0_LR) >> 1) & 0333333) |
| 851 | 851 | | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); |
| 852 | 852 | /* check parity */ |
| 853 | 853 | if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ magtape.binary_flag)) |
| 854 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 854 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 855 | 855 | } |
| 856 | 856 | magtape.u.read.state = MTRDS_STATE2; |
| 857 | 857 | break; |
| r3642 | r3643 | |
| 865 | 865 | } |
| 866 | 866 | if (!magtape.u.read.space_flag) |
| 867 | 867 | { |
| 868 | | cpunum_set_reg(0, TX0_LR, ((cpunum_get_reg(0, TX0_LR) >> 1) & 0333333) |
| 868 | cpu_set_reg(machine->cpu[0], TX0_LR, ((cpunum_get_reg(0, TX0_LR) >> 1) & 0333333) |
| 869 | 869 | | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); |
| 870 | 870 | /* check parity */ |
| 871 | 871 | if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ magtape.binary_flag)) |
| 872 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 872 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 873 | 873 | /* synchronize with cpy instruction */ |
| 874 | 874 | if (magtape.cpy_pending) |
| 875 | 875 | tx0_pulse_io_complete(); |
| 876 | 876 | else |
| 877 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_RWC); |
| 877 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_RWC); |
| 878 | 878 | } |
| 879 | 879 | magtape.u.read.state = MTRDS_STATE3; |
| 880 | 880 | break; |
| r3642 | r3643 | |
| 886 | 886 | magtape.u.read.state = MTRDS_STATE1; |
| 887 | 887 | if (!magtape.u.read.space_flag) |
| 888 | 888 | { |
| 889 | | cpunum_set_reg(0, TX0_LR, ((cpunum_get_reg(0, TX0_LR) >> 1) & 0333333) |
| 889 | cpu_set_reg(machine->cpu[0], TX0_LR, ((cpunum_get_reg(0, TX0_LR) >> 1) & 0333333) |
| 890 | 890 | | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); |
| 891 | 891 | /* check parity */ |
| 892 | 892 | if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ magtape.binary_flag)) |
| 893 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 893 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 894 | 894 | } |
| 895 | 895 | } |
| 896 | 896 | else |
| r3642 | r3643 | |
| 930 | 930 | logerror("invalid longitudinal parity\n"); |
| 931 | 931 | /* no idea if the original tx-0 magtape controller |
| 932 | 932 | checks parity, but can't harm if we do */ |
| 933 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 933 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_PC); |
| 934 | 934 | } |
| 935 | 935 | /* set EOR and unselect... */ |
| 936 | 936 | magtape.state = MTS_UNSELECTING; |
| 937 | | cpunum_set_reg(0, TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_EOR); |
| 937 | cpu_set_reg(machine->cpu[0], TX0_PF, cpunum_get_reg(0, TX0_PF) | PF_EOR); |
| 938 | 938 | schedule_unselect(); |
| 939 | 939 | magtape.irg_pos = MTIRGP_START; |
| 940 | 940 | break; |
| r3642 | r3643 | |
| 975 | 975 | lr = cpunum_get_reg(0, TX0_LR); |
| 976 | 976 | buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001); |
| 977 | 977 | buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!magtape.binary_flag) << 6)) & 0100; |
| 978 | | cpunum_set_reg(0, TX0_LR, lr >> 1); |
| 978 | cpu_set_reg(machine->cpu[0], TX0_LR, lr >> 1); |
| 979 | 979 | } |
| 980 | 980 | else |
| 981 | 981 | { |
| r3642 | r3643 | |
| 985 | 985 | lr = cpunum_get_reg(0, TX0_LR); |
| 986 | 986 | buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001); |
| 987 | 987 | buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!magtape.binary_flag) << 6)) & 0100; |
| 988 | | cpunum_set_reg(0, TX0_LR, lr >> 1); |
| 988 | cpu_set_reg(machine->cpu[0], TX0_LR, lr >> 1); |
| 989 | 989 | magtape.u.write.counter = 2; |
| 990 | 990 | break; |
| 991 | 991 | } |
| r3642 | r3643 | |
| 1139 | 1139 | previous LR */ |
| 1140 | 1140 | lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); |
| 1141 | 1141 | /* write modified LR */ |
| 1142 | | cpunum_set_reg(0, TX0_LR, lr); |
| 1142 | cpu_set_reg(machine->cpu[0], TX0_LR, lr); |
| 1143 | 1143 | tx0_typewriter_drawchar(machine, charcode); /* we want to echo input */ |
| 1144 | 1144 | break; |
| 1145 | 1145 | } |
| r3642 | r3643 | |
| 1175 | 1175 | |
| 1176 | 1176 | if (control_transitions & tx0_stop_cyc0) |
| 1177 | 1177 | { |
| 1178 | | cpunum_set_reg(0, TX0_STOP_CYC0, !cpunum_get_reg(0, TX0_STOP_CYC0)); |
| 1178 | cpu_set_reg(machine->cpu[0], TX0_STOP_CYC0, !cpunum_get_reg(0, TX0_STOP_CYC0)); |
| 1179 | 1179 | } |
| 1180 | 1180 | if (control_transitions & tx0_stop_cyc1) |
| 1181 | 1181 | { |
| 1182 | | cpunum_set_reg(0, TX0_STOP_CYC1, !cpunum_get_reg(0, TX0_STOP_CYC1)); |
| 1182 | cpu_set_reg(machine->cpu[0], TX0_STOP_CYC1, !cpunum_get_reg(0, TX0_STOP_CYC1)); |
| 1183 | 1183 | } |
| 1184 | 1184 | if (control_transitions & tx0_gbl_cm_sel) |
| 1185 | 1185 | { |
| 1186 | | cpunum_set_reg(0, TX0_GBL_CM_SEL, !cpunum_get_reg(0, TX0_GBL_CM_SEL)); |
| 1186 | cpu_set_reg(machine->cpu[0], TX0_GBL_CM_SEL, !cpunum_get_reg(0, TX0_GBL_CM_SEL)); |
| 1187 | 1187 | } |
| 1188 | 1188 | if (control_transitions & tx0_stop) |
| 1189 | 1189 | { |
| 1190 | | cpunum_set_reg(0, TX0_RUN, 0); |
| 1191 | | cpunum_set_reg(0, TX0_RIM, 0); |
| 1190 | cpu_set_reg(machine->cpu[0], TX0_RUN, 0); |
| 1191 | cpu_set_reg(machine->cpu[0], TX0_RIM, 0); |
| 1192 | 1192 | } |
| 1193 | 1193 | if (control_transitions & tx0_restart) |
| 1194 | 1194 | { |
| 1195 | | cpunum_set_reg(0, TX0_RUN, 1); |
| 1196 | | cpunum_set_reg(0, TX0_RIM, 0); |
| 1195 | cpu_set_reg(machine->cpu[0], TX0_RUN, 1); |
| 1196 | cpu_set_reg(machine->cpu[0], TX0_RIM, 0); |
| 1197 | 1197 | } |
| 1198 | 1198 | if (control_transitions & tx0_read_in) |
| 1199 | 1199 | { /* set cpu to read instructions from perforated tape */ |
| 1200 | 1200 | tx0_pulse_reset(); |
| 1201 | | cpunum_set_reg(0, TX0_RUN, 0); |
| 1202 | | cpunum_set_reg(0, TX0_RIM, 1); |
| 1201 | cpu_set_reg(machine->cpu[0], TX0_RUN, 0); |
| 1202 | cpu_set_reg(machine->cpu[0], TX0_RIM, 1); |
| 1203 | 1203 | } |
| 1204 | 1204 | if (control_transitions & tx0_toggle_dn) |
| 1205 | 1205 | { |
| r3642 | r3643 | |
| 1218 | 1218 | if (tsr_index >= 2) |
| 1219 | 1219 | { |
| 1220 | 1220 | UINT32 cm_sel = (UINT32) cpunum_get_reg(0, TX0_CM_SEL); |
| 1221 | | cpunum_set_reg(0, TX0_CM_SEL, cm_sel ^ (1 << (tsr_index - 2))); |
| 1221 | cpu_set_reg(machine->cpu[0], TX0_CM_SEL, cm_sel ^ (1 << (tsr_index - 2))); |
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| 1224 | 1224 | if (control_transitions & tx0_lr_sel) |
| r3642 | r3643 | |
| 1226 | 1226 | if (tsr_index >= 2) |
| 1227 | 1227 | { |
| 1228 | 1228 | UINT32 lr_sel = (UINT32) cpunum_get_reg(0, TX0_LR_SEL); |
| 1229 | | cpunum_set_reg(0, TX0_LR_SEL, (lr_sel ^ (1 << (tsr_index - 2)))); |
| 1229 | cpu_set_reg(machine->cpu[0], TX0_LR_SEL, (lr_sel ^ (1 << (tsr_index - 2)))); |
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| r3642 | r3643 | |
| 1242 | 1242 | |
| 1243 | 1243 | /* update toggle switch register */ |
| 1244 | 1244 | if (tsr_transitions) |
| 1245 | | cpunum_set_reg(0, TX0_TBR+tsr_index, cpunum_get_reg(0, TX0_TBR+tsr_index) ^ tsr_transitions); |
| 1245 | cpu_set_reg(machine->cpu[0], TX0_TBR+tsr_index, cpunum_get_reg(0, TX0_TBR+tsr_index) ^ tsr_transitions); |
| 1246 | 1246 | |
| 1247 | 1247 | /* remember new state of toggle switch register keys */ |
| 1248 | 1248 | old_tsr_keys = tsr_keys; |
src/mess/machine/ti85.c
| r3642 | r3643 | |
| 443 | 443 | if (file) |
| 444 | 444 | { |
| 445 | 445 | mame_fread(file, mem+0x8000, sizeof(unsigned char)*0x8000); |
| 446 | | cpunum_set_reg(0, Z80_PC,0x0239); |
| 446 | cpu_set_reg(machine->cpu[0], Z80_PC,0x0239); |
| 447 | 447 | } |
| 448 | 448 | else |
| 449 | 449 | memset(mem+0x8000, 0, sizeof(unsigned char)*0x8000); |
| r3642 | r3643 | |
| 461 | 461 | if (file) |
| 462 | 462 | { |
| 463 | 463 | mame_fread(file, mem+0x8000, sizeof(unsigned char)*0x8000); |
| 464 | | cpunum_set_reg(0, Z80_PC,0x0b5f); |
| 464 | cpu_set_reg(machine->cpu[0], Z80_PC,0x0b5f); |
| 465 | 465 | } |
| 466 | 466 | else |
| 467 | 467 | memset(mem+0x8000, 0, sizeof(unsigned char)*0x8000); |
| r3642 | r3643 | |
| 479 | 479 | if (file) |
| 480 | 480 | { |
| 481 | 481 | mame_fread(file, ti86_ram, sizeof(unsigned char)*128*1024); |
| 482 | | cpunum_set_reg(0, Z80_PC,0x0c59); |
| 482 | cpu_set_reg(machine->cpu[0], Z80_PC,0x0c59); |
| 483 | 483 | } |
| 484 | 484 | else |
| 485 | 485 | memset(ti86_ram, 0, sizeof(unsigned char)*128*1024); |
| r3642 | r3643 | |
| 498 | 498 | /* Set registers */ |
| 499 | 499 | lo = reg[0x00] & 0x0ff; |
| 500 | 500 | hi = reg[0x01] & 0x0ff; |
| 501 | | cpunum_set_reg(0, Z80_AF, (hi << 8) | lo); |
| 501 | cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo); |
| 502 | 502 | lo = reg[0x04] & 0x0ff; |
| 503 | 503 | hi = reg[0x05] & 0x0ff; |
| 504 | | cpunum_set_reg(0, Z80_BC, (hi << 8) | lo); |
| 504 | cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo); |
| 505 | 505 | lo = reg[0x08] & 0x0ff; |
| 506 | 506 | hi = reg[0x09] & 0x0ff; |
| 507 | | cpunum_set_reg(0, Z80_DE, (hi << 8) | lo); |
| 507 | cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo); |
| 508 | 508 | lo = reg[0x0c] & 0x0ff; |
| 509 | 509 | hi = reg[0x0d] & 0x0ff; |
| 510 | | cpunum_set_reg(0, Z80_HL, (hi << 8) | lo); |
| 510 | cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo); |
| 511 | 511 | lo = reg[0x10] & 0x0ff; |
| 512 | 512 | hi = reg[0x11] & 0x0ff; |
| 513 | | cpunum_set_reg(0, Z80_IX, (hi << 8) | lo); |
| 513 | cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo); |
| 514 | 514 | lo = reg[0x14] & 0x0ff; |
| 515 | 515 | hi = reg[0x15] & 0x0ff; |
| 516 | | cpunum_set_reg(0, Z80_IY, (hi << 8) | lo); |
| 516 | cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo); |
| 517 | 517 | lo = reg[0x18] & 0x0ff; |
| 518 | 518 | hi = reg[0x19] & 0x0ff; |
| 519 | | cpunum_set_reg(0, Z80_PC, (hi << 8) | lo); |
| 519 | cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo); |
| 520 | 520 | lo = reg[0x1c] & 0x0ff; |
| 521 | 521 | hi = reg[0x1d] & 0x0ff; |
| 522 | | cpunum_set_reg(0, Z80_SP, (hi << 8) | lo); |
| 522 | cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo); |
| 523 | 523 | lo = reg[0x20] & 0x0ff; |
| 524 | 524 | hi = reg[0x21] & 0x0ff; |
| 525 | | cpunum_set_reg(0, Z80_AF2, (hi << 8) | lo); |
| 525 | cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo); |
| 526 | 526 | lo = reg[0x24] & 0x0ff; |
| 527 | 527 | hi = reg[0x25] & 0x0ff; |
| 528 | | cpunum_set_reg(0, Z80_BC2, (hi << 8) | lo); |
| 528 | cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo); |
| 529 | 529 | lo = reg[0x28] & 0x0ff; |
| 530 | 530 | hi = reg[0x29] & 0x0ff; |
| 531 | | cpunum_set_reg(0, Z80_DE2, (hi << 8) | lo); |
| 531 | cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo); |
| 532 | 532 | lo = reg[0x2c] & 0x0ff; |
| 533 | 533 | hi = reg[0x2d] & 0x0ff; |
| 534 | | cpunum_set_reg(0, Z80_HL2, (hi << 8) | lo); |
| 535 | | cpunum_set_reg(0, Z80_IFF1, reg[0x30]&0x0ff); |
| 536 | | cpunum_set_reg(0, Z80_IFF2, reg[0x34]&0x0ff); |
| 537 | | cpunum_set_reg(0, Z80_HALT, reg[0x38]&0x0ff); |
| 538 | | cpunum_set_reg(0, Z80_IM, reg[0x3c]&0x0ff); |
| 539 | | cpunum_set_reg(0, Z80_I, reg[0x40]&0x0ff); |
| 534 | cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo); |
| 535 | cpu_set_reg(machine->cpu[0], Z80_IFF1, reg[0x30]&0x0ff); |
| 536 | cpu_set_reg(machine->cpu[0], Z80_IFF2, reg[0x34]&0x0ff); |
| 537 | cpu_set_reg(machine->cpu[0], Z80_HALT, reg[0x38]&0x0ff); |
| 538 | cpu_set_reg(machine->cpu[0], Z80_IM, reg[0x3c]&0x0ff); |
| 539 | cpu_set_reg(machine->cpu[0], Z80_I, reg[0x40]&0x0ff); |
| 540 | 540 | |
| 541 | | cpunum_set_reg(0, Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); |
| 541 | cpu_set_reg(machine->cpu[0], Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); |
| 542 | 542 | |
| 543 | 543 | activecpu_set_input_line(0, 0); |
| 544 | 544 | activecpu_set_input_line(INPUT_LINE_NMI, 0); |