forked from AhmedAmrNabil/brick-breaker-assembly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
movePad.asm
68 lines (54 loc) · 937 Bytes
/
movePad.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
EXTRN PADDLE_X:WORD
EXTRN PADDLE1_X:WORD
EXTRN PADDLE1_VEL_X:WORD
EXTRN PADDLE2_X:WORD
EXTRN drawPaddle:FAR
EXTRN clearPaddle:FAR
EXTRN PADDLE_WIDTH:WORD
EXTRN SKIP_PADDLE_CHECK:WORD
PUBLIC movePaddle1
.MODEL small
.386
.STACK 100h
.DATA
.CODE
movePaddle1 PROC FAR
MOV AX, SKIP_PADDLE_CHECK
CMP AX, 1
JE movePaddle1End
CMP PADDLE1_VEL_X,0
JE skipMovePaddle1
movePaddle1End:
MOV AX, PADDLE1_X
MOV PADDLE_X, AX
CALL clearPaddle
MOV AX, PADDLE1_X
ADD AX, PADDLE1_VEL_X
CMP AX, 0
JLE setPaddleStart
MOV DX,160
SUB DX, PADDLE_WIDTH
CMP AX, DX
JGE setPaddleEnd
JMP movePad
setPaddleStart:
MOV PADDLE1_X,0
JMP skipMovement
setPaddleEnd:
MOV DX,160
SUB DX, PADDLE_WIDTH
MOV PADDLE1_X, DX
JMP skipMovement
MovePad:
MOV AX, PADDLE1_X
ADD AX, PADDLE1_VEL_X
MOV PADDLE1_X,AX
skipMovement:
MOV AX,PADDLE1_X
MOV PADDLE_X, AX
CALL drawPaddle
skipMovePaddle1:
MOV SKIP_PADDLE_CHECK,0
RET
movePaddle1 ENDP
END