Added hex printing test

pull/5/head
E. Almqvist 4 years ago
parent f811dce0eb
commit 3d99d2559d
  1. 5
      src/bootloader.asm
  2. 8
      src/elib/convert.asm

@ -6,6 +6,10 @@ call println
mov bx, infoString mov bx, infoString
call println call println
mov dx, 0x002e ; test the conversion
call hexToASCII
call println
jmp $ ; inf loop jmp $ ; inf loop
;; includes ;; includes
@ -15,6 +19,7 @@ jmp $ ; inf loop
; eLIB ; eLIB
%include "elib/io.asm" %include "elib/io.asm"
%include "elib/convert.asm"
;; Data ;; Data
welcomeString: db "Welcome to: e Operating-System (eOS)", ASCII_END welcomeString: db "Welcome to: e Operating-System (eOS)", ASCII_END

@ -4,13 +4,15 @@ HEX_OUT: db "0x0000", ASCII_END
; This SR is going to mess up some registers ; This SR is going to mess up some registers
; since it fills the register with the desired ; since it fills the register with the desired
; pointer toward the string. ; pointer toward the string.
;
; Disclaimer: use popa if you want to get back your registers!!!
hexToASCII: hexToASCII:
; pusha
mov cx, 0 ; incrementor mov cx, 0 ; incrementor
hexloop: hexloop:
cmp cx, 4 ; check if we reached the end 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 mov ax, dx
@ -36,6 +38,6 @@ hexToASCII:
inc cx ; increment and go onto next char inc cx ; increment and go onto next char
jmp hexloop jmp hexloop
return: hexreturn:
mov bx, HEX_OUT mov bx, HEX_OUT
ret ret

Loading…
Cancel
Save