1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

It appears the problem is as simple as sectors being counted from zero.

This commit is contained in:
Thomas Harte 2016-08-01 10:08:38 -04:00
parent f5e4ea3351
commit bc10b3ee9a
2 changed files with 2 additions and 4 deletions

View File

@ -126,7 +126,6 @@ void Machine::process_input_bit(int value, unsigned int cycles_since_index_hole)
{
_driveVIA.set_sync_detected(true);
_bit_window_offset = -1; // i.e. this bit isn't the first within a data window, but the next might be
printf("X");
}
else
{
@ -141,7 +140,6 @@ void Machine::process_input_bit(int value, unsigned int cycles_since_index_hole)
{
set_overflow_line(true);
}
printf("%02x.", (uint8_t)_shift_register);
}
else
set_overflow_line(false);

View File

@ -112,8 +112,8 @@ std::shared_ptr<Track> D64::get_track_at_position(unsigned int position)
uint8_t *sector_data = &data[sector * 349];
sector_data[0] = sector_data[1] = sector_data[2] = 0xff;
uint8_t sector_number = (uint8_t)(sector+1);
uint8_t track_number = (uint8_t)((position >> 1) + 1);
uint8_t sector_number = (uint8_t)(sector); // sectors count from 0
uint8_t track_number = (uint8_t)((position >> 1) + 1); // tracks count from 1
uint8_t checksum = (uint8_t)(sector_number ^ track_number ^ _disk_id ^ (_disk_id >> 8));
uint8_t header_start[4] = {
0x08, checksum, sector_number, track_number