summaryrefslogtreecommitdiff
path: root/src/stage2_functions.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/stage2_functions.asm')
-rw-r--r--src/stage2_functions.asm51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/stage2_functions.asm b/src/stage2_functions.asm
index 018cf6a..d692ed2 100644
--- a/src/stage2_functions.asm
+++ b/src/stage2_functions.asm
@@ -55,6 +55,34 @@ pm_print_char:
call inc_cursor
ret
+; IN dx: hex value to print
+pm_print_hex:
+ push bx
+ push si
+ mov si, HEX_TEMPLATE
+ mov bx, dx
+ shr bx, 12
+ mov bx, [HEXABET+bx]
+ mov [HEX_TEMPLATE+2], bl
+ mov bx, dx
+ and bx, 0x0FFF
+ shr bx, 8
+ mov bx, [HEXABET+bx]
+ mov [HEX_TEMPLATE+3], bl
+ mov bx, dx
+ and bx, 0x00FF
+ shr bx, 4
+ mov bx, [HEXABET+bx]
+ mov [HEX_TEMPLATE+4], bl
+ mov bx, dx
+ and bx, 0x000F
+ mov bx, [HEXABET+bx]
+ mov [HEX_TEMPLATE+5], bl
+ call pm_print_string
+ pop si
+ pop bx
+ ret
+
inc_cursor:
push eax
mov ax, [CURSOR_X]
@@ -106,3 +134,26 @@ update_vga_cursor:
pop ecx
pop ebx
ret
+
+check_magic:
+ push eax
+ push ebx
+ push ecx
+ push edx
+ push esi
+ mov eax, NOF_LOAD_SECTORS ; number of 512-byte sectors
+ shl eax, 9 ; 512 bytes per sector
+ mov ecx, 0x7e00 ; offset of stage 2
+ add ecx, eax
+ sub ecx, 11 ; the length of the magic string
+ mov dx, cx
+ call pm_print_hex
+ mov dx, [ecx]
+ call pm_print_hex
+ call pm_print_newline
+ pop esi
+ pop edx
+ pop ecx
+ pop ebx
+ pop eax
+ ret