git @ Cat's Eye Technologies SixtyPical / 404f8c7
We really need to review how storage location labels are emitted. Chris Pressey 3 years ago
2 changed file(s) with 54 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3939
4040 def __repr__(self):
4141 return "%s(%r)" % (self.__class__.__name__, self.value)
42
43
44 class Table(Emittable):
45 def size(self):
46 return 256
47
48 def serialize(self, addr=None):
49 return chr(0) * self.size()
50
51 def __repr__(self):
52 return "%s()" % (self.__class__.__name__)
4253
4354
4455 class Label(Emittable):
238238 | }
239239 = 00c0a200a9009d0dc0bd0dc060
240240
241 Byte tables take up 256 bytes in memory. This is clearer if you disassemble the output,
242 but what we don't want to see, is something like:
243
244 $800E LDX #$00
245 $8010 LDA $0816,X
246 $8013 STA $0818,X
247 $8016 RTS
248
249 | byte table tab1
250 | byte table tab2
251 |
252 | routine main
253 | inputs tab1
254 | outputs tab2
255 | trashes a, x, n, z
256 | {
257 | ld x, 0
258 | ld a, tab1 + x
259 | st a, tab2 + x
260 | }
261 = 00c0a200bd09c09d0bc060
262
263 Byte storage locations take up only 1 byte in memory. This is clearer if you disassemble the output,
264 but what we don't want to see, is something like:
265
266 $800E LDX #$00
267 $8010 LDA $0816
268 $8013 STA $0818
269 $8016 RTS
270
271 | byte one
272 | byte two
273 |
274 | routine main
275 | outputs one, two
276 | trashes a, x, n, z
277 | {
278 | ld a, 0
279 | st a, one
280 | st a, two
281 | }
282 = 00c0a200bd09c09d0bc060
283
241284 Copy byte to byte.
242285
243286 | byte bar