-
Notifications
You must be signed in to change notification settings - Fork 1
/
bouncy.asm
268 lines (218 loc) · 3.95 KB
/
bouncy.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
;a macro to print msgs
print macro string
pusha
lea dx, string
mov ah, 09h
int 21h
endm
; a macro for mouse cursor
mouse macro x, y
pusha
mov ah, 02h
mov bx, 0
mov dh, x
mov dl, y
int 10h
popa
endm
.model small
.stack 100h
.data
fn db "scores.txt", 0
handle dw ?
userScore db "0",'$'
space db "------------",'$'
read db 15 dup('$'),'$'
username db "vaneeza ", '$'
bcordx dw 0
bcordx1 dw 0
bcordy dw 0
bcordy1 dw 0
scoring1 db "ooooo",'$'
scoring2 db "o",'$'
scoring3 db "o ooooo",'$'
scoring4 db "ooooo oooooo oooo ooooo o",'$'
scoring5 db " o o o o o o ooooo",'$'
scoring6 db " o o o o oooo o",'$'
scoring7 db "ooooo oooooo oooo o o ooooo",'$'
.code
main proc
mov ax, @data
mov ds, ax
mov ah, 00h
mov al, 12h
int 10h
mov bcordx,0
mov bcordx1,640
mov bcordy,0
mov bcordy1,480
call createborders
mov ah, 02h
mov bh, 0
mov dh, 5 ;Row Number
mov dl, 20 ;Column Number
int 10h
print scoring1
mov ah, 02h
mov bh, 0
mov dh, 6 ;Row Number
mov dl, 20 ;Column Number
int 10h
print scoring2
mov ah, 02h
mov bh, 0
mov dh, 7 ;Row Number
mov dl, 20 ;Column Number
int 10h
print scoring3
mov ah, 02h
mov bh, 0
mov dh, 8 ;Row Number
mov dl, 20 ;Column Number
int 10h
print scoring4
mov ah, 02h
mov bh, 0
mov dh, 9 ;Row Number
mov dl, 20 ;Column Number
int 10h
print scoring5
mov ah, 02h
mov bh, 0
mov dh, 10 ;Row Number
mov dl, 20 ;Column Number
int 10h
print scoring6
mov ah, 02h
mov bh, 0
mov dh, 11 ;Row Number
mov dl, 20 ;Column Number
int 10h
print scoring7
mov ah, 02h
mov bh, 0
mov dh, 15 ;Row Number
mov dl, 20 ;Column Number
int 10h
call writeScore
call readScore
mov ah, 4ch
int 21h
main endp
createborders proc uses ax bx cx dx
mov ah,0Ch
mov al,02h
mov bx,0
label1:
mov cx,bcordx
mov dx,bcordy
.while cx<bcordx1
int 10h
inc cx
.endw
.while dx<bcordy1
int 10h
inc dx
.endw
.while cx>bcordx
int 10h
dec cx
.endw
.while dx>bcordy
int 10h
dec dx
.endw
add bcordx,2
add bcordy,2
sub bcordx1,2
sub bcordy1,2
mov al, 05h
inc bx
cmp bx,9
jne label1
ret
createborders ENDP
writeScore PROC uses ax bx cx dx
;creating file--------
mov ah,3ch
mov cx,0
mov dx,offset fn
int 21h
;opening file--------
mov ah,3dh
mov al,2
mov dx,offset fn
int 21h
mov handle,ax
;writing in file------------
mov cx,0
mov dx,0
mov ah,42h
mov al,2
int 21h
mov ah,40h
mov bx,handle
mov cx,15
mov dx,offset username
int 21h
; mov ah,40h
; mov bx,handle
; mov cx,15
; mov dx,offset space
; int 21h
; mov ah,40h
; mov bx,handle
; mov cx,15
; mov dx,offset userScore
; int 21h
;closing file------
mov ah, 03eh
mov bx, handle
int 21h
;======================
; ;opening file--------
; mov ah,3dh
; mov al,2
; mov dx,offset fn
; int 21h
; mov handle,ax
; ;writing in file------------
; mov cx,0
; mov dx,0
; mov ah,42h
; mov al,2
; int 21h
; mov ah,40h
; mov bx,handle
; mov cx,15
; mov dx,offset userScore
; int 21h
; ;closing file------
; mov ah, 03eh
; mov bx, handle
; int 21h
ret
writeScore endp
readScore proc uses ax bx cx dx
;opening file-------
mov ah,3dh
mov al,2
mov dx,offset fn
int 21h
mov handle,ax
;reading file------------
mov ah,3fh
mov cx,15
mov dx,offset read
mov bx,handle
int 21h
lea dx,read
mov ah,09h
int 21h
;closing file------
mov ah, 03eh
mov bx, handle
int 21h
ret
readScore endp
end