1
0
mirror of https://github.com/pevans/erc-c.git synced 2025-01-10 18:29:20 +00:00

Tracks don't move from shifting; sector work

The sector work being:

- We only wrap around if we go beyond the length of an encoded track, so
use ENC_ETRACK.
- If we DO wrap around, we don't use modulus; we simply reset to zero.
This commit is contained in:
Peter Evans 2018-02-20 14:33:36 -06:00
parent c7fbb4aa50
commit 08f3899de4

@ -1,6 +1,7 @@
#include <criterion/criterion.h>
#include "apple2.dd.h"
#include "apple2.enc.h"
static apple2dd *drive;
@ -109,11 +110,12 @@ Test(apple2_dd, shift)
// Push it beyond the sector boundary; see if the track position
// updates as it should.
apple2_dd_shift(drive, MAX_SECTOR_POS + 3);
cr_assert_eq(drive->track_pos, 2);
apple2_dd_shift(drive, ENC_ETRACK + 3);
cr_assert_eq(drive->track_pos, 0);
// this should be the mod of sector_pos and MAX_SECTOR_POS
cr_assert_eq(drive->sector_pos, 7);
printf("it's %d\n", drive->sector_pos);
cr_assert_eq(drive->sector_pos, 0);
}
Test(apple2_dd, step)