summaryrefslogtreecommitdiffstats
path: root/hacks/images/m6502/spacer.asm
blob: bdecbb573b2504c91b49487a6acc864d476768d3 (plain) (blame)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
; "spacer", move a space ship through an
; endless tunnel.  You die once you hit
; the walls.
;
; Controls:
;
;   W - move up
;   X - move down
;   Any other key will stop the ship
;
; Ps: this game runs awfully slow =)
;

start:
  jsr init

loop:
	;;   jsr drawShip			
  jsr drawMap
  jsr genMap
  jsr readKeys
  jmp loop

;--

drawShip:
  lda $82 			; mychange
;  asl				
  tay

  lda ypos,y
  sta $00
  iny
  lda ypos,y
  sta $01

  ldx #42
  lda ($00,x)
  cmp #0
  beq noCrash
  cmp #5
;  bne crashed	
;my changes
noCrash:
  lda #5
  sta ($00,x)

  lda $60
  cmp $61
  beq ret

  lda $61
  asl
  tay
  lda ypos,y
  sta $00
  iny
  lda ypos,y
  sta $01
  lda #0
  ldx #42
  sta ($00,x)

  lda $60
  sta $61
ret:
  rts

;--

crashed:
  lda $fe
  sta ($00,x)
  jmp crashed

;--

readKeys:
  lda $ff
  cmp #119
  bne notUp
  dec $60
  rts
notUp:
  cmp #120
  bne noMove
  inc $60
noMove:
  rts

;--

init:
  ldx #0
drawLogo:
  lda bottomLogo,x
  sta $500,x
  inx
  cpx #0
  bne drawLogo

  lda #10
  sta $60
  sta $61

  ldx #0
  lda #$c
c:sta $200,x
  sta $400,x
  dex
  cpx #0
  bne c

  lda #16
  sta $80  ; origin
  ldx #15
set:
  sta $81,x  ; target
  dex
  bpl set
  rts

;--

drawMap:
  lda #0
  sta $78
  lda #32
  sta $79
  lda #192
  sta $7a
  lda #224
  sta $7b

  ldx #15
drawLoop:
  lda $81,x
  sta $82,x
  tay
  lda ypos,y
  sta $00
  iny
  lda ypos,y
  sta $01

  lda #$c
  ldy $78
  sta ($00),y
  iny
  sta ($00),y

  ldy $7b
  sta ($00),y
  iny
  sta ($00),y

  ldy $79
  lda #0
  sta ($00),y
  iny
  sta ($00),y

  ldy $7a
  sta ($00),y
  iny
  sta ($00),y

  inc $78
  inc $79
  inc $7a
  inc $7b
  inc $78
  inc $79
  inc $7a
  inc $7b
  dex
  bpl drawLoop
  rts

;---

genMap:
  lda $80
  cmp $81
  beq done
  lda $80
  clc
  sbc $81
  bpl plus
  bmi minus
done:
  lda $fe
  and #$f
  asl
  sta $80
  rts
minus:
  dec $81
  dec $81
  rts
plus:
  inc $81
  inc $81
  rts

ypos:
  dcb $00,$02,$20,$02,$40,$02,$60,$02
  dcb $80,$02,$a0,$02,$c0,$02,$e0,$02
  dcb $00,$03,$20,$03,$40,$03,$60,$03
  dcb $80,$03,$a0,$03,$c0,$03,$e0,$03
  dcb $00,$04,$20,$04,$40,$04,$60,$04
  dcb $80,$04,$a0,$04,$c0,$04,$e0,$04
  dcb $00,$05,$20,$05,$40,$05,$60,$05
  dcb $80,$05,$a0,$05,$c0,$05,$e0,$05

bottomLogo:
  dcb $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
  dcb $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
  dcb $0,$0,$0,$0,$0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