-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasmsprite.s
More file actions
146 lines (134 loc) · 1.79 KB
/
asmsprite.s
File metadata and controls
146 lines (134 loc) · 1.79 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
.include "atari.inc"
.global _up
.global _down
.global _swap
.global _x1
.global _x2
.global _x3
.global _x1v
.global _x2v
.global _x3v
.global _decBarrels
.importzp ptr1, tmp
.import popax
.import _curpm
.import _backpm
.segment "ZEROPAGE"
foo: .res 1
.segment "BSS"
_x1: .res 1
_x2: .res 1
_x3: .res 1
_x1v: .res 1
_x2v: .res 1
_x3v: .res 1
.segment "CODE"
_swap:
; Swap PMBase buffers
ldx _curpm+1 ; the high byte of the pointer
ldy _backpm+1 ; the high byte of the pointer
stx _backpm+1
sty _curpm+1
sty PMBASE
rts
_decBarrels:
ldx _x1v
cpx #0
beq b2
ldx _x1
dex
dex
stx HPOSP1
stx _x1
cpx #30
bne b2
ldx #200
stx _x1
ldx #0
stx _x1v
b2:
ldx _x2v
cpx #0
beq b3
ldx _x2
dex
dex
stx HPOSP2
stx _x2
cpx #40
bne b3
ldx #200
stx _x2
ldx #0
stx _x2v
b3:
ldx _x3v
cpx #0
beq bexit
ldx _x3
dex
dex
stx HPOSP3
stx _x3
cpx #50
bne bexit
ldx #200
stx _x3
ldx #0
stx _x3v
bexit:
rts
_up:
sta foo
jsr popax
sta ptr1
stx ptr1+1
uoloop:
ldy #$0
lda (ptr1),y
tax
iny
uiloop:
lda (ptr1),y
dey
sta (ptr1),y
iny
iny
cpy #$80
bne uiloop
txa
dey
sta (ptr1),y
ldx foo
dex
stx foo
bne uoloop
rts
_down:
sta foo
jsr popax
sta ptr1
stx ptr1+1
doloop:
ldy #$80
lda (ptr1),y
tax
dey
diloop:
lda (ptr1),y
iny
sta (ptr1),y
dey
dey
bne diloop
lda (ptr1),y
iny
sta (ptr1),y
dey
txa
sta (ptr1),y
ldx foo
dex
stx foo
bne doloop
rts;-------------------------------------------------------------------------------