use dynarmic_sys::Dynarmic;
fn main() -> anyhow::Result<()> {
let emu: Dynarmic<()> = Dynarmic::new();
let code_addr = 0x1000000;
emu.mem_map(code_addr, 2 * 1024 * 1024, 7)?;
let code: [u8; 12] = [
0x40, 0x05, 0x80, 0xd2, 0x00, 0x04, 0x00, 0x91, 0x00, 0x00, 0x20, 0xd4, ];
emu.mem_write(code_addr, &code)?;
println!("Starting emulation at 0x{:x}...", code_addr);
emu.emu_start(code_addr, code_addr + code.len() as u64)?;
let x0 = emu.reg_read(0)?;
println!("Emulation finished. X0 = {}", x0);
assert_eq!(x0, 43);
println!("Success!");
Ok(())
}