From 3d99d2559d61988566e074a4bd4843f5c7ba127f Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Wed, 27 Jan 2021 11:14:12 +0100 Subject: [PATCH] Added hex printing test --- src/bootloader.asm | 5 +++++ src/elib/convert.asm | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bootloader.asm b/src/bootloader.asm index b7f282d..d23bd2b 100644 --- a/src/bootloader.asm +++ b/src/bootloader.asm @@ -6,6 +6,10 @@ call println mov bx, infoString call println +mov dx, 0x002e ; test the conversion +call hexToASCII +call println + jmp $ ; inf loop ;; includes @@ -15,6 +19,7 @@ jmp $ ; inf loop ; eLIB %include "elib/io.asm" +%include "elib/convert.asm" ;; Data welcomeString: db "Welcome to: e Operating-System (eOS)", ASCII_END diff --git a/src/elib/convert.asm b/src/elib/convert.asm index b54f1b4..005a89b 100644 --- a/src/elib/convert.asm +++ b/src/elib/convert.asm @@ -4,13 +4,15 @@ HEX_OUT: db "0x0000", ASCII_END ; This SR is going to mess up some registers ; since it fills the register with the desired ; pointer toward the string. +; +; Disclaimer: use popa if you want to get back your registers!!! + hexToASCII: - ; pusha mov cx, 0 ; incrementor hexloop: cmp cx, 4 ; check if we reached the end - je return ; if so just return our new ASCII string + je hexreturn ; if so just return our new ASCII string mov ax, dx @@ -36,6 +38,6 @@ hexToASCII: inc cx ; increment and go onto next char jmp hexloop - return: + hexreturn: mov bx, HEX_OUT ret