1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-12-26 14:29:31 +00:00

compact parity table

This commit is contained in:
Stephen Crane 2019-02-25 10:19:38 +00:00
parent 8a27327729
commit fac66529f2

View File

@ -84,27 +84,17 @@ void i8080::daa() {
flags.C = c;
}
const uint8_t parity_table[] PROGMEM = {
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
const uint8_t partab[] PROGMEM = {
0x69, 0x96, 0x96, 0x69, 0x96, 0x69, 0x69, 0x96,
0x96, 0x69, 0x69, 0x96, 0x69, 0x96, 0x96, 0x69,
0x96, 0x69, 0x69, 0x96, 0x69, 0x96, 0x96, 0x69,
0x69, 0x96, 0x96, 0x69, 0x96, 0x69, 0x69, 0x96,
};
uint8_t parity_tbl(uint8_t r) {
return pgm_read_byte(parity_table + r);
uint8_t i = r / 8, b = pgm_read_byte(partab + i);
uint8_t m = (1 << (r % 8));
return m == (b & m);
}
#define O(o, e) case o: e(); break;