Fixed load and store basic instruction being presented wrong.

This commit is contained in:
2021-01-11 13:02:35 +00:00
parent affd7034e6
commit a40802a84c
2 changed files with 6 additions and 6 deletions

View File

@@ -5,6 +5,7 @@ use crate::exe::inst::{
basic::{Decodable, Encodable},
InstFmt, Register,
};
use dcb_util::SignedHex;
use int_conv::{Signed, Truncated, ZeroExtended};
/// Load instruction kind
@@ -128,11 +129,10 @@ impl InstFmt for Inst {
self.kind.mnemonic()
}
fn fmt(&self, pos: crate::Pos, _bytes: &[u8], f: &mut std::fmt::Formatter) -> std::fmt::Result {
fn fmt(&self, _pos: crate::Pos, _bytes: &[u8], f: &mut std::fmt::Formatter) -> std::fmt::Result {
let Self { dst, src, offset, kind } = self;
let mnemonic = kind.mnemonic();
let address = pos + 4 * offset;
write!(f, "{mnemonic} {dst}, {address}({src})")
write!(f, "{mnemonic} {dst}, {}({src})", SignedHex(offset))
}
}

View File

@@ -5,6 +5,7 @@ use crate::exe::inst::{
basic::{Decodable, Encodable},
InstFmt, Register,
};
use dcb_util::SignedHex;
use int_conv::{Signed, Truncated, ZeroExtended};
/// Store instruction kind
@@ -115,11 +116,10 @@ impl InstFmt for Inst {
self.kind.mnemonic()
}
fn fmt(&self, pos: crate::Pos, _bytes: &[u8], f: &mut std::fmt::Formatter) -> std::fmt::Result {
fn fmt(&self, _pos: crate::Pos, _bytes: &[u8], f: &mut std::fmt::Formatter) -> std::fmt::Result {
let Self { dst, src, offset, kind } = self;
let mnemonic = kind.mnemonic();
let address = pos + 4 * offset;
write!(f, "{mnemonic} {dst}, {address}({src})")
write!(f, "{mnemonic} {dst}, {}({src})", SignedHex(offset))
}
}