From 0e674af1b2c026758e8be82ca24432ae15939a20 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Sun, 22 Jan 2023 09:08:33 +1100 Subject: [PATCH] swap rom endian --- src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.rs b/src/main.rs index 4d366ff..6cc5fcd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -331,3 +331,15 @@ fn cpu_ram_init(cpu: &mut CPU) { cpu.memory.set(0xFF48, 0xFF); cpu.memory.set(0xFF49, 0xFF); } + +#[allow(dead_code)] +fn swap_rom_endian(rom: &ROM) -> ROM { + rom.chunks(2) + .map(|l| { + let mut m = l.to_owned(); + m.reverse(); + m + }) + .flatten() + .collect() +}