-
Notifications
You must be signed in to change notification settings - Fork 2
/
function.s
executable file
·113 lines (94 loc) · 1.1 KB
/
function.s
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
; function.s
[BITS 16]
print:
lodsb
cmp al, 0
je _print
mov bl, 4
call putchar_
;call getcurs
;inc dl
;call putcurs
jmp print
_print:
ret
getkey:
mov ax, 0
int 16h
ret
getkey_:
mov ax, 0
mov ah, 1
int 16h
jz _getkey
call getkey
_getkey:
ret
; al : ascii ==> ax
putchar:
; char al, color bl
mov ah, 9
mov bh, 0
mov cx, 1
int 10h
ret
putchar_: ; mode teletype
; char al, color bl
mov ah, 0Eh
mov bh, 0
int 10h
ret
getchar:
mov ah, 8
mov bh, 0
int 10h
; char al, color bl
getcurs:
mov ah, 3
mov bh, 0
int 10h
ret
; x: dl, y: dh
putcurs:
; x : dl, y : dh
mov ah, 2
mov bh, 0
int 10h
ret
;get_time:
; mov ah, 0
; int 1Ah
; ret
; ; cx:dx => time
last dw 3749h
random:
mov ax, [last]
mov dx, 8405h
mul dx
cmp dx, [last]
jne _random
mov ah, dl
inc ax
_random:
mov [last], ax
; ax and dx <== rand mov ax, dx
ret
sleep:
; time : cx:dx
mov ah, 86h
int 15h
ret
putnbr: ; nbr = ax
; mov bx, 10
; div bx
; mov dx, 0
; push dx
; cmp bx, 0
; je put_nbr_
; mov ax, bx
; call putnbr
;put_nbr_: pop ax
; add al, '0'
; call putchar_
; ret
; int 10h BIP