mirror of
https://github.com/jscrane/r65emu.git
synced 2024-12-27 05:32:04 +00:00
compact parity table
This commit is contained in:
parent
8a27327729
commit
fac66529f2
26
i8080.cpp
26
i8080.cpp
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user