src/mess/machine/ncr5380.c
| r6201 | r6202 | |
| 55 | 55 | static UINT8 n5380_Registers[8]; |
| 56 | 56 | static UINT8 last_id; |
| 57 | 57 | static UINT8 n5380_Command[32]; |
| 58 | | static INT32 cmd_ptr, d_ptr, d_limit; |
| 58 | static INT32 cmd_ptr, d_ptr, d_limit, next_req_flag; |
| 59 | 59 | static UINT8 n5380_Data[512]; |
| 60 | 60 | |
| 61 | 61 | #if NCR5380_DEVICE_CONVERSION |
| r6201 | r6202 | |
| 181 | 181 | if (get_cmd_len(n5380_Command[0]) == cmd_ptr) |
| 182 | 182 | { |
| 183 | 183 | if (VERBOSE) |
| 184 | | logerror("NCR5380: Command (to ID %d): %x %x %x %x %x %x\n", last_id, n5380_Command[0], n5380_Command[1], n5380_Command[2], n5380_Command[3], n5380_Command[4], n5380_Command[5]); |
| 184 | logerror("NCR5380: Command (to ID %d): %x %x %x %x %x %x %x %x %x %x (PC %x)\n", last_id, n5380_Command[0], n5380_Command[1], n5380_Command[2], n5380_Command[3], n5380_Command[4], n5380_Command[5], n5380_Command[6], n5380_Command[7], n5380_Command[8], n5380_Command[9], cpu_get_pc(space->cpu)); |
| 185 | 185 | |
| 186 | 186 | SCSISetCommand(devices[last_id], &n5380_Command[0], 16); |
| 187 | 187 | SCSIExecCommand(devices[last_id], &d_limit); |
| r6201 | r6202 | |
| 329 | 329 | d_limit -= 512; |
| 330 | 330 | d_ptr = 0; |
| 331 | 331 | |
| 332 | next_req_flag = 1; |
| 333 | |
| 332 | 334 | // don't issue a "false" read |
| 333 | 335 | if (d_limit > 0) |
| 334 | 336 | { |
| r6201 | r6202 | |
| 341 | 343 | { |
| 342 | 344 | n5380_Registers[R5380_BUSSTATUS] |= 0x80; |
| 343 | 345 | } |
| 346 | |
| 347 | // drop /REQ |
| 348 | n5380_Registers[R5380_BUSSTATUS] &= ~0x20; |
| 349 | |
| 350 | // clear phase match |
| 351 | n5380_Registers[R5380_BUSANDSTAT] &= ~0x08; |
| 344 | 352 | } |
| 345 | 353 | } |
| 346 | 354 | } |
| r6201 | r6202 | |
| 350 | 358 | |
| 351 | 359 | default: |
| 352 | 360 | rv = n5380_Registers[reg]; |
| 361 | |
| 362 | // temporarily drop /REQ |
| 363 | if ((reg == R5380_BUSSTATUS) && (next_req_flag)) |
| 364 | { |
| 365 | rv &= ~0x20; |
| 366 | next_req_flag = 0; |
| 367 | } |
| 353 | 368 | break; |
| 354 | 369 | } |
| 355 | 370 | |
| r6201 | r6202 | |
| 369 | 384 | memset(n5380_Registers, 0, sizeof(n5380_Registers)); |
| 370 | 385 | memset(devices, 0, sizeof(devices)); |
| 371 | 386 | |
| 387 | next_req_flag = 0; |
| 388 | |
| 372 | 389 | // try to open the devices |
| 373 | 390 | for (i = 0; i < interface->scsidevs->devs_present; i++) |
| 374 | 391 | { |
| r6201 | r6202 | |
| 382 | 399 | state_save_register_item(machine, "ncr5380", NULL, 0, cmd_ptr); |
| 383 | 400 | state_save_register_item(machine, "ncr5380", NULL, 0, d_ptr); |
| 384 | 401 | state_save_register_item(machine, "ncr5380", NULL, 0, d_limit); |
| 402 | state_save_register_item(machine, "ncr5380", NULL, 0, next_req_flag); |
| 385 | 403 | } |
| 386 | 404 | |
| 387 | 405 | void ncr5380_exit( const struct NCR5380interface *interface ) |