From 62a15d52bba04b5b72d739c150aae11adba09e57 Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Thu, 26 Sep 2019 14:53:50 +0000 Subject: [PATCH] Save some bytes on printing hexnumbers --- lib/print.asm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/print.asm b/lib/print.asm index dda25a1..906c6e5 100644 --- a/lib/print.asm +++ b/lib/print.asm @@ -1,11 +1,18 @@ ; important functions in this file: kprintf +; print a word +; in: ax +print16: + xchg ah,al + call print8 + xchg ah,al + ; print a byte ; in: al print8: push ax ; avoid destroying ah push bx - mov bx, 0x0000 + xor bx, bx aam 16 ; high nibble moved into ah, low nibble into al add ax, 0x3030 push ax @@ -24,12 +31,3 @@ print8: mov ah, 0x0e int 0x10 ret - -; print a word -; in: ax -print16: - xchg ah,al - call print8 - xchg ah,al - call print8 - ret