| 454 | } |
| 455 | |
| 456 | static int command_write(TrapContext *ctx, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual) |
| 457 | { |
| 458 | uae_u32 blocksize = dev->di.bytespersector; |
| 459 | length /= blocksize; |
| 460 | offset /= blocksize; |
| 461 | while (length > 0) { |
| 462 | uae_u8 buffer[4096]; |
| 463 | int err; |
| 464 | trap_memcpyah_safe(ctx, buffer, data, blocksize); |
| 465 | err = sys_command_write (dev->unitnum, buffer, (int)offset, 1); |
| 466 | if (!err) |
| 467 | return 20; |
| 468 | if (err < 0) |
| 469 | return 28; // write protected |
| 470 | data += blocksize; |
| 471 | offset++; |
| 472 | length--; |
| 473 | } |
| 474 | return 0; |
| 475 | } |
| 476 | |
| 477 | static int command_cd_read(TrapContext *ctx, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual) |
| 478 | { |
no test coverage detected