Add execution to VM via file, starting to iron out bugs

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-02-09 15:43:07 -05:00
parent 00027c4542
commit c982be553f
5 changed files with 93 additions and 16 deletions

View File

@@ -1,4 +1,5 @@
use crate::vm::{error::*, flags::Flags, inst::*, reg::*, vm::*};
use std::io::stdin;
impl Vm {
pub fn tick(&mut self) -> Result<()> {
@@ -120,6 +121,12 @@ impl Vm {
_ => panic!("unknown instruction opcode: 0x{:04x}", op),
}
println!("op: {:04x} {}", op, inst_name(op).unwrap());
println!("ip: {:05x}", self.ip());
println!("next_ip: {:05x}", next_ip);
let mut _line = String::new();
stdin().read_line(&mut _line).unwrap();
self.set_reg(IP, next_ip);
Ok(())