1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
;TODO fix null problem, allow passing value insted of pointer
bios_print:
pusha
mov ah, 0x0e
.print_loop:
mov al, [bx]
cmp al, 0
je .fini
test cx, cx ; if cx is zero, ascii, otherwise hex string
jne .print_hex
int 0x10
.print_hex_ret:
inc bx
jmp .print_loop
.fini:
mov al, 0xd
int 0x10
mov al, 0xa
int 0x10
popa
ret
.print_hex:
mov al, '0'
int 0x10
mov al, 'x'
int 0x10
mov al, [bx]
shr al, 4
call .bios_print_nibble
mov al, [bx]
and al, 0x0f
call .bios_print_nibble
mov al, ' '
int 0x10
jmp .print_hex_ret
.bios_print_nibble:
cmp al, 9
ja .print_hex_letter
add al, 0x30
int 0x10
ret
.print_hex_letter:
add al, 0x57
int 0x10
ret
|