summaryrefslogtreecommitdiff
path: root/xxx/boot1/print_string_16.asm
blob: 9f81a8721ca739f074b285baed66bf14ab2b1e03 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
[bits 16]

BLANK:
    db 0x12

SPACE:
    db " ",0

;print_string routine ([bx])
;this routine will print a null terminated string at [bx] to the screen.
print_string:

    pusha			;push all registers
    mov ah,0x0e

    print_string_loop:

	;check if value at [bx] is "\0" (end of string)
	mov cl,[bx]
	cmp cl,0
	je print_string_finish

	;otherwise instruct BIOS to print the current char
	mov al,cl
	int 0x10

	;proceed with next char
        inc bx
	jmp print_string_loop

    print_string_finish:

    popa			;pop all registers
    ret				;return to caller

print_clear:

pusha
    mov ah,0x6	    ;func
    mov al,0	    ;scroll one line
    mov bh,[BLANK]  ;blank char

    mov ch,0	    ;upper left corner
    mov cl,0
    mov dh,20	    ;lower right corner
    mov dl,40
    int 0x10

    mov ah,0x2
    mov bh,0
    mov dl,0
    mov dh,20
    int 0x10
popa

print_nextline:

    pusha

    mov ah,0x6	    ;func
    mov al,1	    ;scroll one line
    mov bh,[BLANK]  ;blank char

    mov ch,0	    ;upper left corner
    mov cl,0
    mov dh,20	    ;lower right corner
    mov dl,40
    int 0x10


    mov ah,0x3
    mov bh,0
    int 0x10


    mov ah,0x2
    mov dl,0
    int 0x10

    mov bx,SPACE
    call print_string

    popa
    ret


;print byte from al to screen
 print_hex_byte: 

 pusha

   mov [.temp],al
   shr al,4
   cmp al,10
   sbb al,69h
   das
 
   mov ah,0Eh
   int 10h
 
   mov al,[.temp]
   ror al,4
   shr al,4
   cmp al,10
   sbb al,69h
   das
 
   mov ah,0Eh
   int 10h

popa
 
   ret
 
 .temp db 0