Add Disassemble, fix bug in position calculation
* Disassemble structure can be used for dumping an object section * Assembler position calculation was messing up, causing jump addresses to be wrong. This is fixed. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
use crate::vm::{error::*, flags::Flags, inst::*, reg::*, vm::*, visit::*, mem::MemCursor};
|
||||
use std::io::stdin;
|
||||
|
||||
impl Vm {
|
||||
pub fn tick(&mut self) -> Result<()> {
|
||||
let next_ip = visit_inst(self)?;
|
||||
let next_ip = self.visit_inst()?;
|
||||
self.set_reg(IP, next_ip);
|
||||
Ok(())
|
||||
}
|
||||
@@ -23,7 +22,7 @@ impl Vm {
|
||||
}
|
||||
}
|
||||
|
||||
impl InstAcceptor for Vm {
|
||||
impl VisitInst for Vm {
|
||||
type Out = Addr;
|
||||
|
||||
fn cursor(&self) -> MemCursor {
|
||||
|
||||
Reference in New Issue
Block a user