From 0b2b58c5e31187a0ad8c8c6bf4d7f93ab64aa962 Mon Sep 17 00:00:00 2001 From: Charles Averill Date: Fri, 8 Dec 2023 15:48:25 -0600 Subject: [PATCH] Add print char syscall --- name-emu/src/syscall.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/name-emu/src/syscall.rs b/name-emu/src/syscall.rs index 757b4355..ac5fa245 100644 --- a/name-emu/src/syscall.rs +++ b/name-emu/src/syscall.rs @@ -32,7 +32,13 @@ pub(crate) fn syscall(mips: &mut Mips, code: u32) -> Result<(), ExecutionErrors> 10 => { Err(ExecutionErrors::Event { event: ExecutionEvents::ProgramComplete }) } - + // Print char. Writes the value in $a0 as a char to the screen + 11 => { + if let Some(c) = std::char::from_u32(mips.regs[4]) { + print!("{}", c); + } + Ok(()) + } _ => Err(ExecutionErrors::SyscallInvalidSyscallNumber) } -} \ No newline at end of file +}