-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathASCII BouncingBallAnimation.asm
More file actions
71 lines (61 loc) · 946 Bytes
/
ASCII BouncingBallAnimation.asm
File metadata and controls
71 lines (61 loc) · 946 Bytes
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
.model small
.stack 100h
.data
ball db 'O'
clear db ' '
.code
main:
mov ax, @data
mov ds, ax
mov cx, 10 ; number of bounces
next_bounce:
; move forward
mov si, 1
move_right:
mov dl, si
mov dh, 10 ; row
call print_ball
call delay
; clear previous
mov dl, si
mov dh, 10
call clear_ball
inc si
cmp si, 70
jne move_right
; move backward
dec si
move_left:
mov dl, si
mov dh, 10
call print_ball
call delay
call clear_ball
dec si
cmp si, 1
jne move_left
loop next_bounce
mov ah, 4Ch
int 21h
;-------------------------------
print_ball:
mov ah, 02h
mov bh, 0
int 10h ; move cursor
mov ah, 0Eh
mov al, 'O'
int 10h
ret
clear_ball:
mov ah, 02h
mov bh, 0
int 10h
mov ah, 0Eh
mov al, ' '
int 10h
ret
delay:
mov cx, 0FFFF
d1: loop d1
ret
end main