use crate::*;
const DATA_ADDR: u64 = 0x2000;
fn write_f64(mem: u64, addr: u64, value: f64) {
let mut emu = emu64(); emu.maps.write_bytes_slice(addr, &value.to_le_bytes());
}
fn read_i16(mem: u64, addr: u64) -> i16 {
let emu = emu64(); let mut buf = [0u8; 2];
emu.maps.read_bytes_buff(&mut buf, addr);
i16::from_le_bytes(buf)
}
fn read_i32(mem: u64, addr: u64) -> i32 {
let emu = emu64(); let mut buf = [0u8; 4];
emu.maps.read_bytes_buff(&mut buf, addr);
i32::from_le_bytes(buf)
}
fn read_i64(mem: u64, addr: u64) -> i64 {
let emu = emu64(); let mut buf = [0u8; 8];
emu.maps.read_bytes_buff(&mut buf, addr);
i64::from_le_bytes(buf)
}
fn read_f64(mem: u64, addr: u64) -> f64 {
let emu = emu64(); let mut buf = [0u8; 8];
emu.maps.read_bytes_buff(&mut buf, addr);
f64::from_le_bytes(buf)
}
#[test]
fn test_fist_m16int_zero() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8, 0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 0.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 0);
}
#[test]
fn test_fist_m16int_positive_one() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 1.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 1);
}
#[test]
fn test_fist_m16int_negative_one() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, -1.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, -1);
}
#[test]
fn test_fist_m16int_100() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 100.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 100);
}
#[test]
fn test_fist_m16int_negative_100() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, -100.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, -100);
}
#[test]
fn test_fist_m16int_rounding_down() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 2.3);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 2);
}
#[test]
fn test_fist_m16int_rounding_up() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 2.7);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 3);
}
#[test]
fn test_fist_m16int_half_round_even() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 2.5);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 2);
}
#[test]
fn test_fist_m16int_preserves_st0() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0x1C, 0x25, 0x08, 0x30, 0x00, 0x00, 0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 42.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 42);
assert_eq!(emu.maps.read_f64(0x3008).unwrap(), 42.0);
}
#[test]
fn test_fistp_m16int_zero() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 0.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 0);
}
#[test]
fn test_fistp_m16int_positive() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 123.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 123);
}
#[test]
fn test_fistp_m16int_negative() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, -456.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, -456);
}
#[test]
fn test_fistp_m16int_rounding() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 99.6);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 100);
}
#[test]
fn test_fistp_m16int_max_value() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, i16::MAX as f64);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, i16::MAX);
}
#[test]
fn test_fistp_m16int_min_value() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, i16::MIN as f64);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, i16::MIN);
}
#[test]
fn test_fist_m32int_zero() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 0.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 0);
}
#[test]
fn test_fist_m32int_positive() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 12345.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 12345);
}
#[test]
fn test_fist_m32int_negative() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, -67890.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, -67890);
}
#[test]
fn test_fist_m32int_large() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 1000000.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 1000000);
}
#[test]
fn test_fist_m32int_rounding() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0xD8,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 1234.8);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 1235);
}
#[test]
fn test_fist_m32int_preserves_st0() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00,
0xDD, 0x1C, 0x25, 0x04, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 9999.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 9999);
assert_eq!(emu.maps.read_f64(0x3004).unwrap(), 9999.0);
}
#[test]
fn test_fistp_m32int_zero() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 0.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 0);
}
#[test]
fn test_fistp_m32int_positive() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 987654.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 987654);
}
#[test]
fn test_fistp_m32int_negative() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, -123456.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, -123456);
}
#[test]
fn test_fistp_m32int_max_value() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, i32::MAX as f64);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, i32::MAX);
}
#[test]
fn test_fistp_m32int_min_value() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, i32::MIN as f64);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, i32::MIN);
}
#[test]
fn test_fistp_m64int_zero() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x3C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 0.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_qword(0x3000).unwrap() as i64, 0);
}
#[test]
fn test_fistp_m64int_positive() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x3C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 123456789.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_qword(0x3000).unwrap() as i64, 123456789);
}
#[test]
fn test_fistp_m64int_negative() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x3C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, -987654321.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_qword(0x3000).unwrap() as i64, -987654321);
}
#[test]
fn test_fistp_m64int_large() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x3C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 1_000_000_000_000.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_qword(0x3000).unwrap() as i64, 1_000_000_000_000);
}
#[test]
fn test_fistp_m64int_rounding() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x3C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 999999.9);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_qword(0x3000).unwrap() as i64, 1000000);
}
#[test]
fn test_fistp_m64int_max_safe_integer() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x3C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
let max_safe = (1i64 << 53) - 1;
emu.maps.write_f64(DATA_ADDR, max_safe as f64);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_qword(0x3000).unwrap() as i64, max_safe);
}
#[test]
fn test_fistp_m64int_min_safe_integer() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDF, 0x3C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
let min_safe = -((1i64 << 53) - 1);
emu.maps.write_f64(DATA_ADDR, min_safe as f64);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_qword(0x3000).unwrap() as i64, min_safe);
}
#[test]
fn test_fist_does_not_pop() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00, 0xDB, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xDB, 0x14, 0x25, 0x04, 0x30, 0x00, 0x00, 0xDD, 0xD8, 0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 777.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 777);
assert_eq!(emu.maps.read_dword(0x3004).unwrap() as i32, 777);
}
#[test]
fn test_fistp_pops_stack() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00, 0xDD, 0x04, 0x25, 0x08, 0x20, 0x00, 0x00, 0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00, 0xDB, 0x1C, 0x25, 0x04, 0x30, 0x00, 0x00, 0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 100.0);
emu.maps.write_f64(DATA_ADDR + 8, 200.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 200);
assert_eq!(emu.maps.read_dword(0x3004).unwrap() as i32, 100);
}
#[test]
fn test_fistp_all_sizes() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00, 0xD9, 0xC0, 0xD9, 0xC0, 0xDF, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00, 0xDB, 0x1C, 0x25, 0x04, 0x30, 0x00, 0x00, 0xDF, 0x3C, 0x25, 0x08, 0x30, 0x00, 0x00, 0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 1234.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 1234);
assert_eq!(emu.maps.read_dword(0x3004).unwrap() as i32, 1234);
assert_eq!(emu.maps.read_qword(0x3008).unwrap() as i64, 1234);
}
#[test]
fn test_fist_fistp_mixed() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00, 0xDB, 0x14, 0x25, 0x00, 0x30, 0x00, 0x00, 0xDB, 0x1C, 0x25, 0x04, 0x30, 0x00, 0x00, 0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 500.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 500);
assert_eq!(emu.maps.read_dword(0x3004).unwrap() as i32, 500);
}
#[test]
fn test_fistp_round_to_nearest_even_positive() {
let mut emu = emu64(); let test_cases = vec![
(0.5, 0), (1.5, 2), (2.5, 2), (3.5, 4), ];
for (input, expected) in test_cases {
let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, input);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, expected, "Failed for input {}", input);
}
}
#[test]
fn test_fistp_round_to_nearest_even_negative() {
let mut emu = emu64(); let test_cases = vec![
(-0.5, 0), (-1.5, -2), (-2.5, -2), (-3.5, -4), ];
for (input, expected) in test_cases {
let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00,
0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00,
0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, input);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, expected, "Failed for input {}", input);
}
}
#[test]
fn test_fistp_after_arithmetic() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00, 0xDD, 0x04, 0x25, 0x08, 0x20, 0x00, 0x00, 0xDE, 0xC1, 0xDB, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00, 0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 10.5);
emu.maps.write_f64(DATA_ADDR + 8, 20.3);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_dword(0x3000).unwrap() as i32, 31);
}
#[test]
fn test_fistp_sequential() {
let mut emu = emu64(); let code = [
0xDD, 0x04, 0x25, 0x00, 0x20, 0x00, 0x00, 0xDD, 0x04, 0x25, 0x08, 0x20, 0x00, 0x00, 0xDD, 0x04, 0x25, 0x10, 0x20, 0x00, 0x00, 0xDF, 0x1C, 0x25, 0x00, 0x30, 0x00, 0x00, 0xDB, 0x1C, 0x25, 0x04, 0x30, 0x00, 0x00, 0xDF, 0x3C, 0x25, 0x08, 0x30, 0x00, 0x00, 0xf4,
];
emu.load_code_bytes(&code);
emu.maps.write_f64(DATA_ADDR, 1.0);
emu.maps.write_f64(DATA_ADDR + 8, 2.0);
emu.maps.write_f64(DATA_ADDR + 16, 3.0);
emu.run(None).unwrap();
assert_eq!(emu.maps.read_word(0x3000).unwrap() as i16, 3);
assert_eq!(emu.maps.read_dword(0x3004).unwrap() as i32, 2);
assert_eq!(emu.maps.read_qword(0x3008).unwrap() as i64, 1);
}