mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-02-19 20:30:45 +00:00
Support for shl foo
and shr foo
where foo
is a byte storage.
This commit is contained in:
parent
b451176f37
commit
e565234d28
@ -9,6 +9,7 @@ History of SixtyPical
|
||||
* More thorough tests and justifications written for the case of
|
||||
assigning a routine to a vector with a "wider" type.
|
||||
* Support for `copy [ptra]+y, [ptrb]+y` to indirect LDA indirect STA.
|
||||
* Support for `shl foo` and `shr foo` where `foo` is a byte storage.
|
||||
|
||||
0.15
|
||||
----
|
||||
|
@ -84,7 +84,7 @@ are trashed inside the block.
|
||||
* `static` pointers -- currently not possible because pointers must be zero-page, thus `@`, thus uninitialized.
|
||||
* Question the value of the "consistent initialization" principle for `if` statement analysis.
|
||||
* `interrupt` routines -- to indicate that "the supervisor" has stored values on the stack, so we can trash them.
|
||||
* Add absolute addressing in shl/shr, absolute-indexed for add, sub, etc.
|
||||
* Add absolute-indexed for add, sub, and, or, xor, shl, shr
|
||||
* Automatic tail-call optimization (could be tricky, w/constraints?)
|
||||
|
||||
[VICE]: http://vice-emu.sourceforge.net/
|
||||
|
@ -343,7 +343,7 @@ class Compiler(object):
|
||||
if dest == REG_A:
|
||||
self.emitter.emit(cls())
|
||||
else:
|
||||
raise UnsupportedOpcodeError(instr)
|
||||
self.emitter.emit(cls(self.absolute_or_zero_page(self.get_label(dest.name))))
|
||||
elif opcode == 'call':
|
||||
location = instr.location
|
||||
label = self.get_label(instr.location.name)
|
||||
|
@ -1120,11 +1120,13 @@ Some rudimentary tests for `xor`.
|
||||
|
||||
Some rudimentary tests for `shl`.
|
||||
|
||||
| byte foo
|
||||
| routine main
|
||||
| inputs a, c
|
||||
| outputs a, c, z, n
|
||||
| inputs foo, a, c
|
||||
| outputs foo, a, c, z, n
|
||||
| {
|
||||
| shl a
|
||||
| shl foo
|
||||
| }
|
||||
= ok
|
||||
|
||||
@ -1148,11 +1150,13 @@ Some rudimentary tests for `shl`.
|
||||
|
||||
Some rudimentary tests for `shr`.
|
||||
|
||||
| byte foo
|
||||
| routine main
|
||||
| inputs a, c
|
||||
| outputs a, c, z, n
|
||||
| inputs foo, a, c
|
||||
| outputs foo, a, c, z, n
|
||||
| {
|
||||
| shr a
|
||||
| shr foo
|
||||
| }
|
||||
= ok
|
||||
|
||||
|
@ -274,40 +274,44 @@ Some instructions.
|
||||
| cmp y, foo
|
||||
| shl a
|
||||
| shr a
|
||||
| shl foo
|
||||
| shr foo
|
||||
| }
|
||||
= $080D LDA #$00
|
||||
= $080F LDX #$00
|
||||
= $0811 LDY #$00
|
||||
= $0813 STA $0853
|
||||
= $0816 STX $0853
|
||||
= $0819 STY $0853
|
||||
= $0813 STA $0859
|
||||
= $0816 STX $0859
|
||||
= $0819 STY $0859
|
||||
= $081C SEC
|
||||
= $081D CLC
|
||||
= $081E ADC #$01
|
||||
= $0820 ADC $0853
|
||||
= $0820 ADC $0859
|
||||
= $0823 SBC #$01
|
||||
= $0825 SBC $0853
|
||||
= $0828 INC $0853
|
||||
= $0825 SBC $0859
|
||||
= $0828 INC $0859
|
||||
= $082B INX
|
||||
= $082C INY
|
||||
= $082D DEC $0853
|
||||
= $082D DEC $0859
|
||||
= $0830 DEX
|
||||
= $0831 DEY
|
||||
= $0832 AND #$FF
|
||||
= $0834 AND $0853
|
||||
= $0834 AND $0859
|
||||
= $0837 ORA #$FF
|
||||
= $0839 ORA $0853
|
||||
= $0839 ORA $0859
|
||||
= $083C EOR #$FF
|
||||
= $083E EOR $0853
|
||||
= $083E EOR $0859
|
||||
= $0841 CMP #$01
|
||||
= $0843 CMP $0853
|
||||
= $0843 CMP $0859
|
||||
= $0846 CPX #$01
|
||||
= $0848 CPX $0853
|
||||
= $0848 CPX $0859
|
||||
= $084B CPY #$01
|
||||
= $084D CPY $0853
|
||||
= $084D CPY $0859
|
||||
= $0850 ROL A
|
||||
= $0851 ROR A
|
||||
= $0852 RTS
|
||||
= $0852 ROL $0859
|
||||
= $0855 ROR $0859
|
||||
= $0858 RTS
|
||||
|
||||
Compiling `if`.
|
||||
|
||||
|
@ -29,6 +29,12 @@ Program with comments.
|
||||
| routine main {
|
||||
| ld a, 0
|
||||
| add a, 1 // We are adding the thing.
|
||||
| sub a, 1
|
||||
| shl a
|
||||
| shr a
|
||||
| and a, 1
|
||||
| or a, 1
|
||||
| xor a, 1
|
||||
| }
|
||||
= ok
|
||||
|
||||
@ -268,6 +274,8 @@ Explicit memory address.
|
||||
| routine main {
|
||||
| ld a, 100
|
||||
| st a, screen
|
||||
| shl screen
|
||||
| shr screen
|
||||
| }
|
||||
= ok
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user