1use huc6280::{add, subtract, DecimalFormula};
9
10const P_VALUES: [u8; 8] = [0x00, 0x01, 0x08, 0x09, 0xC2, 0xC3, 0xEA, 0xEB];
12
13fn main() {
14 type Operation = fn(u8, u8, u8, DecimalFormula) -> (u8, u8);
15 let operations: [(&str, Operation); 2] = [("add", add), ("subtract", subtract)];
16 for (name, operation) in operations {
17 for (formula_name, formula) in [
18 ("mednafen", DecimalFormula::Mednafen),
19 ("mesen", DecimalFormula::Mesen),
20 ] {
21 for p in P_VALUES {
22 let mut digest: u64 = 0xCBF29CE484222325;
24 for a in 0..=255u8 {
25 for operand in 0..=255u8 {
26 let (result, flags) = operation(a, operand, p, formula);
27 for byte in [result, flags] {
28 digest = (digest ^ byte as u64).wrapping_mul(0x100000001B3);
29 }
30 }
31 }
32 println!("{name} {formula_name} p={p:02X} {digest:016x}");
33 }
34 }
35 }
36}