Compare commits
2 Commits
fc3b588425
...
4e23ac7bff
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e23ac7bff | |||
| cd2e5319bc |
@@ -579,6 +579,10 @@ fn process_line(prgm: &mut Program, (linenum, line): (usize, String), rgx: &Rege
|
|||||||
chk(2);
|
chk(2);
|
||||||
Instruction::Xor(reg(0), reg(1), Op2::Direct(-1))
|
Instruction::Xor(reg(0), reg(1), Op2::Direct(-1))
|
||||||
}
|
}
|
||||||
|
"swi" => {
|
||||||
|
chk(0);
|
||||||
|
Instruction::Swi()
|
||||||
|
}
|
||||||
"let" => {
|
"let" => {
|
||||||
chk(2);
|
chk(2);
|
||||||
let r = reg(0);
|
let r = reg(0);
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ impl Display for Cond {
|
|||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
pub(crate) fn instr_to_text(i: u32, a: u32, book: &HashMap<u32, String>) -> String {
|
pub(crate) fn instr_to_text(i: u32, a: u32, book: &HashMap<u32, String>) -> String {
|
||||||
let addr = |addr: u32| {
|
let addr = |addr: u32| {
|
||||||
let real = a.wrapping_add(addr * 4);
|
let real = a.wrapping_add(addr * 4) % 0x8000_0000;
|
||||||
match book.get(&real) {
|
match book.get(&real) {
|
||||||
Some(s) => s.clone(),
|
Some(s) => s.clone(),
|
||||||
None => format!("{addr}"),
|
None => format!("{addr}"),
|
||||||
@@ -722,6 +722,7 @@ impl Computer {
|
|||||||
if N >= 16 {
|
if N >= 16 {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
println!("serving interupt {kind:?} {arg:?}");
|
println!("serving interupt {kind:?} {arg:?}");
|
||||||
match self.interupts {
|
match self.interupts {
|
||||||
InteruptState::Disabled => {
|
InteruptState::Disabled => {
|
||||||
|
|||||||
@@ -323,7 +323,11 @@ fn main() -> Result<(), Error> {
|
|||||||
simulation.regs[i + 1]
|
simulation.regs[i + 1]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
println!("SP: {:08x} PC: {:08x}", simulation.sp, simulation.pc);
|
println!(
|
||||||
|
"SP: {:08x} PC: {:08x}",
|
||||||
|
simulation.sp * 4,
|
||||||
|
simulation.pc * 4
|
||||||
|
);
|
||||||
println!("RAM near SP");
|
println!("RAM near SP");
|
||||||
let min_pc = (simulation.pc).min(0x0100_0000 / 4 - 8);
|
let min_pc = (simulation.pc).min(0x0100_0000 / 4 - 8);
|
||||||
let min_sp = (simulation.sp).min(0x0100_0000 / 4 - 8);
|
let min_sp = (simulation.sp).min(0x0100_0000 / 4 - 8);
|
||||||
@@ -381,7 +385,7 @@ fn main() -> Result<(), Error> {
|
|||||||
if next.len() >= 2 {
|
if next.len() >= 2 {
|
||||||
match parse_int::parse::<u32>(next[1]) {
|
match parse_int::parse::<u32>(next[1]) {
|
||||||
Ok(i) => {
|
Ok(i) => {
|
||||||
let v = simulation.ram[i as usize/4];
|
let v = simulation.ram[i as usize / 4];
|
||||||
println!(
|
println!(
|
||||||
"0x{:8x} -- {}",
|
"0x{:8x} -- {}",
|
||||||
v,
|
v,
|
||||||
|
|||||||
Reference in New Issue
Block a user