-
Notifications
You must be signed in to change notification settings - Fork 9
/
toShirley.asm
176 lines (142 loc) · 1.86 KB
/
toShirley.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
;To Shirley
;Jackie Wu (Wu Kan)
;2016-03-01
outDelay equ 50000
inDelay equ 2400
;set data segment
mov ax,07c0h
mov ds,ax
;text window
;25 * 80
mov ax,0B800h
mov es,ax
%macro SETMEM 2
mov ax,%2
mov [%1],ax
%endmacro
START:
call DELAY
call SHOWINFO
call DELAY
SETMEM pos,1107H
SETMEM vel,0001H
mov cx,14
call LINE
SETMEM pos,1015H
SETMEM vel,0FFFFH
mov cx,2
call LINE
SETMEM pos,0F0CH
SETMEM vel,0FF01H
mov cx,5
call LINE
SETMEM pos,130CH
SETMEM vel,0101H
mov cx,5
call LINE
SETMEM pos,1D07H
SETMEM vel,0100H
mov cx,13
call LINE
SETMEM pos,1E0AH
SETMEM vel,0001H
mov cx,12
call LINE
SETMEM pos,1E0AH
SETMEM vel,0100H
mov cx,11
call LINE
SETMEM pos,280AH
SETMEM vel,0001H
mov cx,11
call LINE
SETMEM pos,2715H
SETMEM vel,0FFFFH
mov cx,2
call LINE
SETMEM pos,2307H
SETMEM vel,0001H
mov cx,15
call LINE
SETMEM pos,200DH
SETMEM vel,0101H
mov cx,2
call LINE
SETMEM pos,2011H
SETMEM vel,0101H
mov cx,2
call LINE
SETMEM pos,250DH
SETMEM vel,0101H
mov cx,2
call LINE
SETMEM pos,2511H
SETMEM vel,0101H
mov cx,2
call LINE
jmp $
LINE:
;cx is the len of line
LINELOOP:
call DELAY
call SHOW
call MOVEPOS
loop LINELOOP
ret
SHOWINFO:
mov cx,[msgLen]
mov si,message
mov di, 0*80 + 0
printChar:
mov al,[si]
inc si
mov ah,07H
mov [es:di],ax
add di,2
loop printChar
ret
DELAY:
push cx
mov cx, outDelay
LOOP1:
mov ax, inDelay
LOOP2:
dec ax
jg LOOP2
loop LOOP1
pop cx
ret
MOVEPOS:
mov ax,[pos]
mov bx,[vel]
add ah,bh
add al,bl
mov [pos],ax
ret
SHOW:
push cx
mov bx,[pos]
mov ax,0
mov al,bl
mov dx,80
mul dx
mov dx,0
mov dl,bh
add ax,dx
mov cx,2
mul cx
mov bx, ax
mov al,[char]
mov ah,[color]
mov [es:bx],ax
pop cx
ret
DATA:
message db "To Shirley"
msgLen dw $-message
pos dw 0000h
vel dw 0000h
char db 'a'
color db 09H
times 510-($-$$) db 0
dw 0xaa55