git @ Cat's Eye Technologies SixtyPical / e565234
Support for `shl foo` and `shr foo` where `foo` is a byte storage. Chris Pressey 3 years ago
6 changed file(s) with 39 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
88 * More thorough tests and justifications written for the case of
99 assigning a routine to a vector with a "wider" type.
1010 * Support for `copy [ptra]+y, [ptrb]+y` to indirect LDA indirect STA.
11 * Support for `shl foo` and `shr foo` where `foo` is a byte storage.
1112
1213 0.15
1314 ----
8383 * `static` pointers -- currently not possible because pointers must be zero-page, thus `@`, thus uninitialized.
8484 * Question the value of the "consistent initialization" principle for `if` statement analysis.
8585 * `interrupt` routines -- to indicate that "the supervisor" has stored values on the stack, so we can trash them.
86 * Add absolute addressing in shl/shr, absolute-indexed for add, sub, etc.
86 * Add absolute-indexed for add, sub, and, or, xor, shl, shr
8787 * Automatic tail-call optimization (could be tricky, w/constraints?)
8888
8989 [VICE]: http://vice-emu.sourceforge.net/
342342 if dest == REG_A:
343343 self.emitter.emit(cls())
344344 else:
345 raise UnsupportedOpcodeError(instr)
345 self.emitter.emit(cls(self.absolute_or_zero_page(self.get_label(dest.name))))
346346 elif opcode == 'call':
347347 location = instr.location
348348 label = self.get_label(instr.location.name)
11191119
11201120 Some rudimentary tests for `shl`.
11211121
1122 | routine main
1123 | inputs a, c
1124 | outputs a, c, z, n
1122 | byte foo
1123 | routine main
1124 | inputs foo, a, c
1125 | outputs foo, a, c, z, n
11251126 | {
11261127 | shl a
1128 | shl foo
11271129 | }
11281130 = ok
11291131
11471149
11481150 Some rudimentary tests for `shr`.
11491151
1150 | routine main
1151 | inputs a, c
1152 | outputs a, c, z, n
1152 | byte foo
1153 | routine main
1154 | inputs foo, a, c
1155 | outputs foo, a, c, z, n
11531156 | {
11541157 | shr a
1158 | shr foo
11551159 | }
11561160 = ok
11571161
273273 | cmp y, foo
274274 | shl a
275275 | shr a
276 | shl foo
277 | shr foo
276278 | }
277279 = $080D LDA #$00
278280 = $080F LDX #$00
279281 = $0811 LDY #$00
280 = $0813 STA $0853
281 = $0816 STX $0853
282 = $0819 STY $0853
282 = $0813 STA $0859
283 = $0816 STX $0859
284 = $0819 STY $0859
283285 = $081C SEC
284286 = $081D CLC
285287 = $081E ADC #$01
286 = $0820 ADC $0853
288 = $0820 ADC $0859
287289 = $0823 SBC #$01
288 = $0825 SBC $0853
289 = $0828 INC $0853
290 = $0825 SBC $0859
291 = $0828 INC $0859
290292 = $082B INX
291293 = $082C INY
292 = $082D DEC $0853
294 = $082D DEC $0859
293295 = $0830 DEX
294296 = $0831 DEY
295297 = $0832 AND #$FF
296 = $0834 AND $0853
298 = $0834 AND $0859
297299 = $0837 ORA #$FF
298 = $0839 ORA $0853
300 = $0839 ORA $0859
299301 = $083C EOR #$FF
300 = $083E EOR $0853
302 = $083E EOR $0859
301303 = $0841 CMP #$01
302 = $0843 CMP $0853
304 = $0843 CMP $0859
303305 = $0846 CPX #$01
304 = $0848 CPX $0853
306 = $0848 CPX $0859
305307 = $084B CPY #$01
306 = $084D CPY $0853
308 = $084D CPY $0859
307309 = $0850 ROL A
308310 = $0851 ROR A
309 = $0852 RTS
311 = $0852 ROL $0859
312 = $0855 ROR $0859
313 = $0858 RTS
310314
311315 Compiling `if`.
312316
2828 | routine main {
2929 | ld a, 0
3030 | add a, 1 // We are adding the thing.
31 | sub a, 1
32 | shl a
33 | shr a
34 | and a, 1
35 | or a, 1
36 | xor a, 1
3137 | }
3238 = ok
3339
267273 | routine main {
268274 | ld a, 100
269275 | st a, screen
276 | shl screen
277 | shr screen
270278 | }
271279 = ok
272280