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