This commit is contained in:
xenia 2020-06-07 21:49:22 -04:00
parent 33e024d565
commit 6fb0aa5217
1 changed files with 10 additions and 3 deletions

View File

@ -367,10 +367,10 @@ fn arg_count(opcode: OP) -> usize {
}
fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) {
//println!("{:#02x?}", &bytes[0..8]);
let mut consumed = 0;
let def = DefinitionWord(bytes[0]);
print!("{:04x} ", bytes[0]);
bytes = &bytes[1..];
consumed += 1;
@ -394,6 +394,7 @@ fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) {
if register_count > 0 {
let mut aw = bytes[0];
//dbg!(aw);
print!("{:04x} ", bytes[0]);
bytes = &bytes[1..];
consumed += 1;
@ -419,17 +420,23 @@ fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) {
AFLG::Register => args.push(Arg::Register(registers.remove(0))),
AFLG::SIN => {
args.push(Arg::SIN(bytes[0]));
print!("{:04x} ", bytes[0]);
bytes = &bytes[1..];
consumed += 1;
}
AFLG::SMAIN => {
args.push(Arg::SMAIN(bytes[0]));
print!("{:04x} ", bytes[0]);
bytes = &bytes[1..];
consumed += 1;
}
}
}
for _ in 0..(4-consumed) {
print!(" ");
}
(Instruction { def, args }, consumed)
}
@ -696,7 +703,7 @@ fn main() {
m.SIN[1..=sin.inner().len()].copy_from_slice(sin.inner());
m.SCODE[1..=code.inner().len()].copy_from_slice(code.inner());
m.input = vec![
0x05,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x0a];
log::debug!("{:?}", &m.SIN[1..=sin.inner().len()]);
@ -706,7 +713,7 @@ fn main() {
// Return here if you don't want it to run
// return;
return;
while m.step() {}
}