floppy_cmd[2], floppy_cmd[3], floppy_cmd[4], floppy_cmd[5],
floppy_cmd[6], floppy_cmd[7], floppy_cmd[8]);
write_log(_T("DMA addr %08x len %04x\n"), dma[2].page | dma[2].ac, dma[2].ab);
+ write_log(_T("IMG: Secs=%d Heads=%d\n"), fr.secs, fr.heads);
#endif
floppy_delay_hsync = 50;
int eot = floppy_cmd[6];
floppy_status[0] |= 0x40; // abnormal termination
floppy_status[2] |= 0x20; // wrong cylinder
} else if (fr.img) {
- bool end = false;
+ int end = 0;
pcf->sector = floppy_cmd[4] - 1;
pcf->head = (floppy_cmd[1] & 4) ? 1 : 0;
- while (!end) {
+ while (!end && !fr.wrprot) {
int len = 128 << floppy_cmd[5];
uae_u8 buf[512] = { 0 };
for (int i = 0; i < 512 && i < len; i++) {
int v = dma_channel_read(2);
- if (v < 0)
+ if (v < 0) {
+ end = -1;
break;
+ }
buf[i] = v;
- if (v >= 0x10000)
+ if (v >= 0x10000) {
+ end = 1;
break;
+ }
}
+ if (end < 0)
+ break;
zfile_fseek(fr.img, (pcf->cyl * fr.secs * fr.heads + pcf->head * fr.secs + pcf->sector) * 512, SEEK_SET);
zfile_fwrite(buf, 1, 512, fr.img);
pcf->sector++;
floppy_cmd[2], floppy_cmd[3], floppy_cmd[4], floppy_cmd[5],
floppy_cmd[6], floppy_cmd[7], floppy_cmd[8]);
write_log(_T("DMA addr %08x len %04x\n"), dma[2].page | dma[2].ac, dma[2].cb);
+ write_log(_T("IMG: Secs=%d Heads=%d\n"), fr.secs, fr.heads);
#endif
floppy_delay_hsync = 50;
int eot = floppy_cmd[6];
floppy_num, (floppy_cmd[0] & 0x40) ? 1 : 0,
floppy_cmd[2], floppy_cmd[3], floppy_cmd[4], floppy_cmd[5]);
write_log(_T("DMA addr %08x len %04x\n"), dma[2].page | dma[2].ac, dma[2].cb);
+ write_log(_T("IMG: Secs=%d Heads=%d\n"), fr.secs, fr.heads);
#endif
int secs = floppy_cmd[3];
if (valid_floppy && fr.img) {
pcf->head = (floppy_cmd[1] & 4) ? 1 : 0;
uae_u8 buf[512];
memset(buf, floppy_cmd[5], sizeof buf);
- for (int i = 0; i < secs && i < fr.secs; i++) {
+ for (int i = 0; i < secs && i < fr.secs && !fr.wrprot; i++) {
uae_u8 cx = dma_channel_read(2);
uae_u8 hx = dma_channel_read(2);
uae_u8 rx = dma_channel_read(2);
#endif
zfile_fseek(fr.img, (pcf->cyl * fr.secs * fr.heads + pcf->head * fr.secs + pcf->sector) * 512, SEEK_SET);
zfile_fwrite(buf, 1, 512, fr.img);
+ pcf->sector++;
}
} else {
floppy_status[0] |= 0x40; // abnormal termination