mirror of
https://github.com/irmen/prog8.git
synced 2025-01-11 13:29:45 +00:00
PrefixExpression doesn't cause clobber risk
This commit is contained in:
parent
2560042ac7
commit
ea0fe8d3d2
@ -44,9 +44,6 @@ internal fun asmsub6502ArgsHaveRegisterClobberRisk(args: List<Expression>,
|
||||
it.registerOrPair in listOf(RegisterOrPair.Y, RegisterOrPair.AY, RegisterOrPair.XY)
|
||||
}
|
||||
}
|
||||
is PrefixExpression -> {
|
||||
return true // TODO really, is prefixexpression problematic for register clobbering?
|
||||
}
|
||||
is FunctionCall -> {
|
||||
if (expr.target.nameInSource == listOf("lsb") || expr.target.nameInSource == listOf("msb"))
|
||||
return isClobberRisk(expr.args[0])
|
||||
|
@ -3,9 +3,6 @@ TODO
|
||||
|
||||
For next compiler release (7.4)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Figure out in asmsub6502ArgsHaveRegisterClobberRisk if prefixexpression is clobbering or not
|
||||
|
||||
|
||||
Use GoSub to call subroutines (statements):
|
||||
- [DONE] allow separate assigns to subroutine's parameter variables / registers
|
||||
- [DONE] turn a regular subroutine call into assignments to the parameters + GoSub (take code from gosub branch)
|
||||
|
@ -5,6 +5,32 @@
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
ubyte[] array = 100 to 50 step -2
|
||||
ubyte @shared dummy
|
||||
word b1 = 1111
|
||||
byte b2 = 22
|
||||
word b3 = 3333
|
||||
dummy++
|
||||
func(-b1,-b2,-b3)
|
||||
}
|
||||
|
||||
sub printz(word a1, byte a2, word a3) {
|
||||
txt.print_w(a1)
|
||||
txt.spc()
|
||||
txt.print_b(a2)
|
||||
txt.spc()
|
||||
txt.print_w(a3)
|
||||
txt.nl()
|
||||
}
|
||||
asmsub func(word a1 @XY, byte a2 @A, word a3 @R0) {
|
||||
%asm {{
|
||||
stx printz.a1
|
||||
sty printz.a1+1
|
||||
sta printz.a2
|
||||
lda cx16.r0
|
||||
sta printz.a3
|
||||
lda cx16.r0+1
|
||||
sta printz.a3+1
|
||||
jmp printz
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user