From fb2d32359cda7007dbf2535203db3ecf6d526fdf Mon Sep 17 00:00:00 2001 From: darcy Date: Sat, 28 Sep 2024 12:26:17 +1000 Subject: [PATCH] Implement `PUTSP` based on `PUTS` --- src/runtime.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/runtime.rs b/src/runtime.rs index c69df2d..cdf8242 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -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 => {