-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdrawBall.asm
67 lines (56 loc) · 1.08 KB
/
drawBall.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
EXTRN BALL_X:WORD
EXTRN BALL_Y:WORD
PUBLIC drawBall
PUBLIC clearBall
.MODEL SMALL
.STACK 100h
.DATA
BALL_SIZE EQU 5
.CODE
drawBall PROC FAR
MOV AX,00h
MOV CX,BALL_X ;Mov the x,y for ball
MOV DX,BALL_Y
MOV AX,00h
DRAW_HORIZONTAL_VERTICAL:
MOV AH,0ch
MOV AL,0Ah
MOV BH,00h
INT 10h ; Draw the pixel
INC CX
MOV AX,CX
SUB AX,BALL_X
CMP AX,BALL_SIZE
JL DRAW_HORIZONTAL_VERTICAL ;Loop for X-axis
MOV CX,BALL_X
INC DX
MOV AX,DX
SUB AX,BALL_Y
CMP AX,BALL_SIZE
JL DRAW_HORIZONTAL_VERTICAL ;Loop for Y-axis
RET
drawBall ENDP
clearBall PROC FAR
MOV AX,00h
MOV CX,BALL_X ;Mov the x,y for ball
MOV DX,BALL_Y
MOV AX,00h
clearHorizontalVertical:
MOV AH,0ch
MOV AL,00h
MOV BH,00h
INT 10h ; Draw the pixel
INC CX
MOV AX,CX
SUB AX,BALL_X
CMP AX,BALL_SIZE
JL clearHorizontalVertical ;Loop for X-axis
MOV CX,BALL_X
INC DX
MOV AX,DX
SUB AX,BALL_Y
CMP AX,BALL_SIZE
JL clearHorizontalVertical ;Loop for Y-axis
RET
clearBall ENDP
END