mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 23:29:55 +00:00
fix push() of signed values
This commit is contained in:
parent
0a568f2530
commit
d6abd72e55
@ -174,11 +174,12 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
||||
}
|
||||
|
||||
private fun funcPush(fcall: IFunctionCall, func: FSignature) {
|
||||
val signed = fcall.args[0].inferType(program).oneOf(DataType.BYTE, DataType.WORD)
|
||||
if(func.name=="push") {
|
||||
asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.A)
|
||||
asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.A, signed)
|
||||
asmgen.out(" pha")
|
||||
} else {
|
||||
asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.AY)
|
||||
asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.AY, signed)
|
||||
if (asmgen.isTargetCpu(CpuType.CPU65c02))
|
||||
asmgen.out(" pha | phy")
|
||||
else
|
||||
|
@ -2083,7 +2083,7 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
||||
else -> throw AssemblyError("weird target kind for inplace negate float ${target.kind}")
|
||||
}
|
||||
}
|
||||
else -> throw AssemblyError("negate of invalid type")
|
||||
else -> throw AssemblyError("negate of invalid type $dt")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,9 @@ main {
|
||||
uword @shared uw
|
||||
ubyte @shared ub
|
||||
word @shared ww
|
||||
byte @shared bb
|
||||
|
||||
push(127)
|
||||
push(-bb)
|
||||
pop(ub)
|
||||
txt.print_ub(ub)
|
||||
txt.nl()
|
||||
|
Loading…
Reference in New Issue
Block a user