We really need to review how storage location labels are emitted.
Chris Pressey
4 years ago
39 | 39 |
|
40 | 40 |
def __repr__(self):
|
41 | 41 |
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__)
|
42 | 53 |
|
43 | 54 |
|
44 | 55 |
class Label(Emittable):
|
238 | 238 |
| }
|
239 | 239 |
= 00c0a200a9009d0dc0bd0dc060
|
240 | 240 |
|
|
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 |
|
241 | 284 |
Copy byte to byte.
|
242 | 285 |
|
243 | 286 |
| byte bar
|