-
Notifications
You must be signed in to change notification settings - Fork 0
/
paddle.asm
92 lines (76 loc) · 2.32 KB
/
paddle.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
update_paddle:
lda #-100 ; to 0 (y)
ldb #0 ; to 0 (x)
jsr Moveto_d ; move the vector beam the
; relative position
lda PaddlePositionY
ldb PaddlePositionX ; to 0 (x)
jsr Moveto_d ; move the vector beam the
; relative position
ldx #paddle_list ; load the address of the to be
; drawn vector list to X
jsr Draw_VLc ; draw the line now
lda PaddlePositionY
ldb PaddlePositionX
nega
negb
jsr Moveto_d
lda #100
ldb #0
jsr Moveto_d
jsr Joy_Digital ; read joystick positions
lda Vec_Joy_1_X ; load joystick 1 position
; X to A
beq no_x_movement ; if zero, than no x position
bmi left_move ; if negative, than left
; otherwise right
right_move:
lda PaddlePositionX
cmpa #80
bgt no_x_movement
lda #3
sta PaddleVelocityX
jmp after_move
left_move:
lda PaddlePositionX
cmpa #-80
blt no_x_movement
lda #-3
sta PaddleVelocityX
jmp after_move
no_x_movement:
lda #0
sta PaddleVelocityX
after_move:
lda PaddlePositionX
adda PaddleVelocityX
sta PaddlePositionX
button_check:
lda PaddleIsJumping
bne no_button_press
jsr Read_Btns
lda Vec_Button_1_1
beq no_button_press
inc PaddleIsJumping
lda #15
sta PaddleVelocityY
no_button_press:
jumping_update:
lda PaddleIsJumping
beq jumping_update_over
lda PaddlePositionY
adda PaddleVelocityY
sta PaddlePositionY
dec PaddleVelocityY
has_final_velocity:
lda PaddlePositionY
cmpa #0
blt reset_jump
jmp jumping_update_over
reset_jump:
lda #0
sta PaddleIsJumping
sta PaddlePositionY
sta PaddleVelocityY
jumping_update_over:
rts