This commit is contained in:
5225225 2020-06-06 15:59:39 +01:00
parent d394c95c02
commit ebfe2a0f97
1 changed files with 8 additions and 5 deletions

View File

@ -250,7 +250,7 @@ impl Default for Machine {
RSTAT: Flags::FSE, RSTAT: Flags::FSE,
IP: 0, IP: 1,
RCALL: 0, RCALL: 0,
RSK: 0xffff, RSK: 0xffff,
RSR: 0, RSR: 0,
@ -348,6 +348,7 @@ OP::RCPF => 2,
} }
fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) { fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) {
println!("{:#02x?}", &bytes[0..8]);
let mut consumed = 0; let mut consumed = 0;
let def = DefinitionWord(bytes[0]); let def = DefinitionWord(bytes[0]);
@ -377,6 +378,7 @@ fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) {
bytes = &bytes[1..]; bytes = &bytes[1..];
consumed += 1; consumed += 1;
println!("{:016b}", aw);
for i in 0..register_count { for i in 0..register_count {
registers.insert(0_usize, Register::into_register(aw & 0b1111)); registers.insert(0_usize, Register::into_register(aw & 0b1111));
aw >>= 4; aw >>= 4;
@ -464,6 +466,7 @@ impl Machine {
let arg0 = cur_instruction.args[0].as_immediate(); let arg0 = cur_instruction.args[0].as_immediate();
self.write(cur_instruction.args[1], arg0); self.write(cur_instruction.args[1], arg0);
self.RSTAT.set(Flags::FZERO, arg0 == 0); self.RSTAT.set(Flags::FZERO, arg0 == 0);
eprintln!("copying {} to {:?}", arg0, cur_instruction.args[1]);
} }
OP::CMP => { OP::CMP => {
let a = self.read(cur_instruction.args[0]); let a = self.read(cur_instruction.args[0]);
@ -509,10 +512,10 @@ fn main() {
let mut codeinner = code.inner(); let mut codeinner = code.inner();
let mut m = Machine::default(); let mut m = Machine::default();
m.SIN = sin.inner().to_vec(); m.SIN[1..=sin.inner().len()].copy_from_slice(sin.inner());
m.SCODE = code.inner().to_vec(); m.SCODE[1..=code.inner().len()].copy_from_slice(code.inner());
dump_instructions(&m.SCODE[1..]); // dump_instructions(&m.SCODE[1..]);
// while m.step() {} while m.step() {}
} }