mirror of
https://github.com/pevans/erc-c.git
synced 2025-08-08 05:25:01 +00:00
Several changes...
1. We have much more logging. 2. We were not properly turning off drives when we would get called with C0x8. 3. We now roll over sector pos if we are greater than ENC_ETRACK. 4. We now reset sector pos when we step.
This commit is contained in:
@@ -281,6 +281,10 @@ apple2_dd_phaser(apple2dd *drive, int phase)
|
|||||||
int step = transitions[(drive->phase * 5) + phase];
|
int step = transitions[(drive->phase * 5) + phase];
|
||||||
apple2_dd_step(drive, step);
|
apple2_dd_step(drive, step);
|
||||||
|
|
||||||
|
log_info("Phase %1d, step %2d, track %2d, sector pos %05x, segment position %05x",
|
||||||
|
phase, step, drive->track_pos / 2, drive->sector_pos,
|
||||||
|
apple2_dd_position(drive));
|
||||||
|
|
||||||
// Record this new phase for the next time we make a transition
|
// Record this new phase for the next time we make a transition
|
||||||
drive->phase = phase;
|
drive->phase = phase;
|
||||||
}
|
}
|
||||||
@@ -316,6 +320,12 @@ apple2_dd_read(apple2dd *drive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vm_8bit byte = vm_segment_get(drive->data, apple2_dd_position(drive));
|
vm_8bit byte = vm_segment_get(drive->data, apple2_dd_position(drive));
|
||||||
|
drive->latch = byte;
|
||||||
|
|
||||||
|
log_info("Read byte %02x at track %2d, sector %2d, position %05x",
|
||||||
|
byte, drive->track_pos / 2, drive->sector_pos / ENC_ESECTOR,
|
||||||
|
apple2_dd_position(drive));
|
||||||
|
|
||||||
apple2_dd_shift(drive, 1);
|
apple2_dd_shift(drive, 1);
|
||||||
|
|
||||||
return byte;
|
return byte;
|
||||||
@@ -385,7 +395,7 @@ apple2_dd_shift(apple2dd *drive, int pos)
|
|||||||
|
|
||||||
drive->sector_pos += pos;
|
drive->sector_pos += pos;
|
||||||
|
|
||||||
if (drive->sector_pos >= ENC_ETRACK) {
|
if (drive->sector_pos > ENC_ETRACK) {
|
||||||
// We need to reset the sector pos to zero, because...
|
// We need to reset the sector pos to zero, because...
|
||||||
drive->sector_pos = 0;
|
drive->sector_pos = 0;
|
||||||
}
|
}
|
||||||
@@ -408,6 +418,8 @@ apple2_dd_step(apple2dd *drive, int steps)
|
|||||||
} else if (drive->track_pos < 0) {
|
} else if (drive->track_pos < 0) {
|
||||||
drive->track_pos = 0;
|
drive->track_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drive->sector_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -466,6 +478,10 @@ apple2_dd_switch_phase(apple2dd *drive, size_t addr)
|
|||||||
case 0x7: phase = 4; break;
|
case 0x7: phase = 4; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (phase == -1) {
|
||||||
|
log_info("Phase addr %02x, operation skipped", addr & 0xf);
|
||||||
|
}
|
||||||
|
|
||||||
apple2_dd_phaser(drive, phase);
|
apple2_dd_phaser(drive, phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,7 +595,7 @@ SEGMENT_READER(apple2_dd_switch_read)
|
|||||||
|
|
||||||
// In the first if block, we will handle 0x0..0x8; in the second if,
|
// In the first if block, we will handle 0x0..0x8; in the second if,
|
||||||
// we'll do 0x9..0xB, 0xE, and 0xF.
|
// we'll do 0x9..0xB, 0xE, and 0xF.
|
||||||
if (nib < 0x9) {
|
if (nib < 0x8) {
|
||||||
apple2_dd_switch_phase(drive, nib);
|
apple2_dd_switch_phase(drive, nib);
|
||||||
} else if (nib < 0xC || nib > 0xD) {
|
} else if (nib < 0xC || nib > 0xD) {
|
||||||
apple2_dd_switch_drive(mach, nib);
|
apple2_dd_switch_drive(mach, nib);
|
||||||
@@ -617,7 +633,7 @@ SEGMENT_WRITER(apple2_dd_switch_write)
|
|||||||
drive = mach->drive1;
|
drive = mach->drive1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nib < 0x9) {
|
if (nib < 0x8) {
|
||||||
apple2_dd_switch_phase(drive, nib);
|
apple2_dd_switch_phase(drive, nib);
|
||||||
} else if (nib < 0xC || nib > 0xD) {
|
} else if (nib < 0xC || nib > 0xD) {
|
||||||
apple2_dd_switch_drive(mach, nib);
|
apple2_dd_switch_drive(mach, nib);
|
||||||
|
Reference in New Issue
Block a user