-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSticks.ASM
99 lines (77 loc) · 1.82 KB
/
Sticks.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
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
include 'macro\proc16.inc'
;include 'Randomize.asm'
struc String Params&
{
local length
. db length, Params
length = $ - . - 1
}
alLeft = 0
alCenter = 1
alRight = 2
org 100h
Start:
cld
stdcall Screen.SetMode, $0003
mov bx, ax
stdcall Screen.WriteString, strHello, 12, alLeft, $90
stdcall Keyboard.ReadKey
push bx
stdcall Screen.SetMode, bx
ret
proc Screen.WriteString uses es si di,\
ofsString, nLine, alAlign, bAttr: BYTE
push $B800
pop es
mov di, 80 * 2
imul di, [nLine]
mov si, [ofsString]
lodsb
movzx cx, al
mov ax, [alAlign]
cmp ax, alLeft
je .DoWriteString
mov dx, 80
sub dx, cx
cmp ax, alRight
je @F
shr dx, 1
.@@:
shl dx, 1
add di, dx
.DoWriteString:
mov ah, byte[bAttr]
.WriteLoop:
lodsb
stosw
loop .WriteLoop
ret
endp
proc Screen.SetMode uses si di,\
wModeInfo
mov ah, 0Fh
int 10h
mov dl, al ;;Mode number
mov dh, bh ;;Page number
movzx ax, byte[wModeInfo]
int 10h
mov ah, 05h
mov al, byte[wModeInfo + 1]
int 10h
mov ax, dx
ret
endp
proc Keyboard.ReadKey
mov ax, $0c08
int 21h
movzx cx, al
test al, al
jnz @F
mov ah, $08
int 21h
mov ch, al
@@:
mov ax, cx
ret
endp
strHello String 'Welcome to the club body!'