diff --git a/03_uart1/src/main.rs b/03_uart1/src/main.rs index 660261e8..012e54a2 100644 --- a/03_uart1/src/main.rs +++ b/03_uart1/src/main.rs @@ -42,6 +42,7 @@ fn main() { uart.getc(); // Press a key first before being greeted uart.puts("Hello Rustacean!\n"); + // echo everything back loop { uart.send(uart.getc()); } diff --git a/05_uart0/kernel8.img b/05_uart0/kernel8.img index fe9766c1..0f7e74d7 100755 Binary files a/05_uart0/kernel8.img and b/05_uart0/kernel8.img differ diff --git a/05_uart0/src/main.rs b/05_uart0/src/main.rs index 2d4da612..2d90506f 100644 --- a/05_uart0/src/main.rs +++ b/05_uart0/src/main.rs @@ -72,8 +72,11 @@ fn main() { uart.hex(mbox.buffer[6]); uart.hex(mbox.buffer[5]); uart.puts("\n"); + } else { + uart.puts("Unable to query serial!\n"); } + // echo everything back loop { uart.send(uart.getc()); } diff --git a/05_uart0/src/uart.rs b/05_uart0/src/uart.rs index bb526696..c410c1cc 100644 --- a/05_uart0/src/uart.rs +++ b/05_uart0/src/uart.rs @@ -173,8 +173,11 @@ impl Uart { let mut n; for i in 0..8 { + // get highest tetrad n = d.wrapping_shr(28 - i * 4) & 0xF; + // 0-9 => '0'-'9', 10-15 => 'A'-'F' + // Add proper offset for ASCII table if n > 9 { n += 0x37; } else {