Skip to content

Commit

Permalink
Implement PUTSP based on PUTS
Browse files Browse the repository at this point in the history
  • Loading branch information
dxrcy committed Sep 28, 2024
1 parent a442eaa commit fb2d323
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,22 @@ impl RunState {
}
// putsp
0x24 => {
// TODO: impl putsp
todo!("TODO: putsp can be put off until someone needs it")
let mut addr = *self.reg(0);
loop {
let chr_raw = *self.mem(addr);
let chr_high = ((chr_raw >> 8) & 0xFF) as u8 as char;
if chr_high == '\0' {
break;
}
print!("{}", chr_high);
let chr_low = (chr_raw & 0xFF) as u8 as char;
if chr_low == '\0' {
break;
}
print!("{}", chr_low);
addr += 1;
}
stdout().flush().unwrap();
}
// halt
0x25 => {
Expand Down

0 comments on commit fb2d323

Please sign in to comment.