-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_hero_sprites.s
117 lines (87 loc) · 1.47 KB
/
update_hero_sprites.s
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
; vim: set syntax=asm_ca65:
.include "constants.inc"
.segment "ZEROPAGE"
.import controller_1_input
.segment "CODE"
.import face_hero_north
.import face_hero_northwest
.import face_hero_west
.import face_hero_southwest
.import face_hero_south
.import face_hero_southeast
.import face_hero_east
.import face_hero_northeast
.proc update_hero_sprites
PHP
PHA
TXA
PHA
TYA
PHA
LDA controller_1_input
AND #BTN_UP
BEQ check_left
LDA controller_1_input
AND #BTN_LEFT
BEQ check_up_right
JMP face_northwest
check_up_right:
LDA controller_1_input
AND #BTN_RIGHT
BEQ face_north
JMP face_northeast
check_left:
LDA controller_1_input
AND #BTN_LEFT
BEQ check_down
LDA controller_1_input
AND #BTN_DOWN
BEQ face_west
JMP face_southwest
check_down:
LDA controller_1_input
AND #BTN_DOWN
BEQ check_right
LDA controller_1_input
AND #BTN_RIGHT
BEQ face_south
JMP face_southeast
check_right:
LDA controller_1_input
AND #BTN_RIGHT
BEQ done
JMP face_east
face_north:
JSR face_hero_north
JMP done
face_northwest:
JSR face_hero_northwest
JMP done
face_west:
JSR face_hero_west
JMP done
face_southwest:
JSR face_hero_southwest
JMP done
face_south:
JSR face_hero_south
JMP done
face_southeast:
JSR face_hero_southeast
JMP done
face_east:
JSR face_hero_east
JMP done
face_northeast:
JSR face_hero_northeast
JMP done
done:
PLA
TAY
PLA
TAX
PLA
PLP
RTS
.endproc
.export update_hero_sprites