moa/src/main.rs
transistor 10e905674b Added MUL, DIV, NEG, DBcc, and Scc instructions, and fixed issue with ADD/SUB flags
With ADDA, SUBA, and ADDQ/SUBQ when the target is an address register, the condition
flags should not be changed, but the code was changing them, which caused problems.
I've fixed it by making the ADD/SUB executions check for an address target and
will not update flags in that case.  This should only occur when the actual instruction
was an ADDA or ADDQ with an address register target
2021-10-02 21:59:28 -07:00

54 lines
1.2 KiB
Rust

#[macro_use]
mod error;
mod memory;
mod cpus;
mod devices;
use crate::memory::{AddressSpace, MemoryBlock};
use crate::cpus::m68k::MC68010;
use crate::devices::mc68681::MC68681;
fn main() {
let mut space = AddressSpace::new();
let monitor = MemoryBlock::load("monitor.bin").unwrap();
for byte in monitor.contents.iter() {
print!("{:02x} ", byte);
}
space.insert(0x00000000, Box::new(monitor));
let ram = MemoryBlock::new(vec![0; 0x00100000]);
space.insert(0x00100000, Box::new(ram));
let mut serial = MC68681::new();
serial.open().unwrap();
space.insert(0x00700000, Box::new(serial));
let mut cpu = MC68010::new();
//cpu.enable_tracing();
//cpu.add_breakpoint(0x0c94);
//cpu.add_breakpoint(0x0cf2);
while cpu.is_running() {
match cpu.step(&mut space) {
Ok(()) => { },
Err(err) => {
cpu.dump_state(&mut space);
panic!("{:?}", err);
},
}
//serial.step();
}
/*
// TODO I need to add a way to decode and dump the assembly for a section of code, in debugger
cpu.state.pc = 0x0db4;
while cpu.is_running() {
cpu.decode_next(&mut space).unwrap();
}
*/
}