mirror of
https://github.com/pevans/erc-c.git
synced 2025-01-31 04:31:01 +00:00
Adjust length/data for sectors; cleanup some magic numbers
This commit is contained in:
parent
2318b1917a
commit
28061c1d11
@ -41,30 +41,34 @@ static vm_8bit f_sector[] = {
|
|||||||
* function.
|
* function.
|
||||||
*/
|
*/
|
||||||
static vm_8bit f_enc_sector[] = {
|
static vm_8bit f_enc_sector[] = {
|
||||||
0xd5, 0xaa, 0xad, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xaf, 0x9a, 0xd3, 0xfd, 0xb6, 0xcb,
|
//0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
0xb5, 0xfa, 0xb5, 0xe6, 0xb9, 0xf3, 0xea, 0xe7, 0xd6, 0xdb, 0xad, 0xb9, 0xfe, 0xe7, 0xfd, 0xeb,
|
//0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
0xfa, 0xee, 0xf3, 0xe9, 0xb7, 0xfa, 0xde, 0xcb, 0xf6, 0xcb, 0xcb, 0x96, 0xfa, 0xec, 0xaf, 0xaf,
|
//0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
0xcb, 0xcb, 0xf7, 0xee, 0xec, 0xd3, 0xd9, 0xbb, 0xf6, 0xd9, 0xab, 0xbf, 0xcb, 0xcb, 0xb2, 0xa6,
|
0xd5, 0xaa, 0x96, 0xff, 0xfe, 0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xfe, 0xde, 0xaa, 0xeb, 0xff, 0xff,
|
||||||
0xcb, 0x97, 0xf4, 0xf5, 0xac, 0xed, 0xb9, 0xad, 0xae, 0xdf, 0xce, 0xe9, 0xb5, 0xb5, 0x9f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9b, 0xea, 0xfe, 0xe7,
|
0x9a, 0xf5, 0xdf, 0xe9, 0xa7, 0xba, 0xf3, 0x9f, 0xf3, 0xab, 0xb2, 0x97, 0xda, 0xef, 0xf3, 0xb5,
|
||||||
0xf3, 0xb5, 0xd6, 0xad, 0xf9, 0xee, 0xea, 0xe6, 0xfd, 0xdb, 0x9b, 0xfd, 0xf4, 0x96, 0xdf, 0xdf,
|
0xb4, 0xee, 0x9f, 0xfb, 0xff, 0xb9, 0xee, 0xdb, 0xdd, 0xaf, 0xdb, 0xce, 0xbf, 0xe7, 0xe5, 0x97,
|
||||||
0xde, 0xaa, 0xeb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0xdb, 0xbe, 0xe9, 0x9f, 0x9a, 0x9b, 0xab, 0xaf, 0xdc, 0x9b, 0xcb, 0x96, 0x9b, 0xa7, 0xfb, 0xaf,
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0xf2, 0xcb, 0xea, 0xf5, 0xf9, 0xce, 0x9a, 0xfc, 0xdc, 0xef, 0xbb, 0xeb, 0xfa, 0xde, 0xb3, 0xbb,
|
||||||
|
0xb3, 0xaf, 0xbe, 0xb9, 0xbc, 0x97, 0xad, 0xcd, 0xea, 0xba, 0x9b, 0xea, 0xfe, 0xe7, 0xf3, 0xb5,
|
||||||
|
0xd6, 0xad, 0xf9, 0xee, 0xea, 0xe6, 0xfd, 0xdb, 0x9b, 0xfd, 0xf4, 0x96, 0xdf, 0xdf, 0xde, 0xaa,
|
||||||
|
0xeb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
};
|
};
|
||||||
|
|
||||||
static vm_segment *seg;
|
static vm_segment *seg;
|
||||||
@ -155,12 +159,12 @@ Test(apple2_enc, sector)
|
|||||||
|
|
||||||
// The number of bytes (343, plus the self-sync, prologue/epilogue,
|
// The number of bytes (343, plus the self-sync, prologue/epilogue,
|
||||||
// etc. etc.)
|
// etc. etc.)
|
||||||
cr_assert_eq(len, 382);
|
cr_assert_eq(len, ENC_ESECTOR - ENC_ESECTOR_HEADER);
|
||||||
|
|
||||||
// Let's see if the bytes equal what we expect for our sector
|
// Let's see if the bytes equal what we expect for our sector
|
||||||
// fixture
|
// fixture
|
||||||
for (i = 0; i < 382; i++) {
|
for (i = ENC_ESECTOR_HEADER; i < ENC_ESECTOR; i++) {
|
||||||
cr_assert_eq(vm_segment_get(dest, i), f_enc_sector[i]);
|
cr_assert_eq(vm_segment_get(dest, i - ENC_ESECTOR_HEADER), f_enc_sector[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,10 +203,8 @@ Test(apple2_enc, track)
|
|||||||
cr_assert_eq(vm_segment_get(dest, i), 0xff);
|
cr_assert_eq(vm_segment_get(dest, i), 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ENC_ESECTOR; i++) {
|
for (i = ENC_ETRACK_HEADER; i < ENC_ESECTOR + ENC_ETRACK_HEADER; i++) {
|
||||||
cr_assert_eq(
|
cr_assert_eq(vm_segment_get(dest, i), f_enc_sector[i - ENC_ETRACK_HEADER]);
|
||||||
vm_segment_get(dest, i + ENC_ETRACK_HEADER + ENC_ESECTOR_HEADER),
|
|
||||||
f_enc_sector[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_segment_free(dest);
|
vm_segment_free(dest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user