-
Notifications
You must be signed in to change notification settings - Fork 0
/
library1.asm
67 lines (62 loc) · 1.3 KB
/
library1.asm
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
display_letter:
push ax
push bx
mov ah,0x0e ; Load AH with code for terminal output
mov bx,0x000f ; Load BH page zero and BL color (graphic mode)
int 0x10 ; Call the BIOS for displaying one letter
pop bx
pop ax
ret
display_number:
mov dx,0
mov cx,10
div cx
push dx
cmp ax,0
je display_number_1
call display_number
display_number_1:
pop ax
add al,'0'
call display_letter
ret
read_keyboard:
push ax
mov ah,0x00 ; Load AH with code for keyboard read
int 0x16 ; Call the BIOS for reading keyboard
pop ax
ret
newline:
push ax
mov al,13
call display_letter
mov al,10
call display_letter
pop ax
ret
print_string:
push ax
push bx
print_string_loop:
mov al,[bx]
test al,al
je end
push bx
mov ah,0x0e ; Load AH with code for terminal output
mov bx,0x000f ; Load BH page zero and BL color (graphic mode)
int 0x10 ; Call the BIOS for displaying one letter
pop bx
inc bx
jmp print_string_loop
end:
pop bx
pop ax
ret
clear_text_screen:
; clear screen
push ax
mov ah, 0x00
mov al, 0x03 ; text mode 80x25 16 colours
int 0x10
pop ax
ret