rnd() functions marked as having (internal) side effect

This commit is contained in:
Irmen de Jong 2020-11-22 01:47:25 +01:00
parent d1febc0208
commit 08aa13c90c
3 changed files with 5 additions and 4 deletions

View File

@ -1181,7 +1181,7 @@ $label nop""")
out(" lda #<${asmVar} | ldy #>${asmVar} | jsr floats.MOVFM")
}
else -> {
// todo evaluate directly into fac1 instead of via stack intermediate (add RegisterOrPair.FAC1 ??)
// todo evaluate directly into fac1 instead of via stack intermediate (add RegisterOrPair.FAC1/FAC2 ??)
translateExpression(returnvalue)
out(" jsr floats.pop_float_fac1")
}

View File

@ -130,9 +130,9 @@ private val functionSignatures: List<FSignature> = listOf(
FSignature("lsb" , true, listOf(FParam("value", setOf(DataType.UWORD, DataType.WORD))), DataType.UBYTE) { a, p, prg -> oneIntArgOutputInt(a, p, prg) { x: Int -> x and 255 }},
FSignature("msb" , true, listOf(FParam("value", setOf(DataType.UWORD, DataType.WORD))), DataType.UBYTE) { a, p, prg -> oneIntArgOutputInt(a, p, prg) { x: Int -> x ushr 8 and 255}},
FSignature("mkword" , true, listOf(FParam("msb", setOf(DataType.UBYTE)), FParam("lsb", setOf(DataType.UBYTE))), DataType.UWORD, ::builtinMkword),
FSignature("rnd" , true, emptyList(), DataType.UBYTE),
FSignature("rndw" , true, emptyList(), DataType.UWORD),
FSignature("rndf" , true, emptyList(), DataType.FLOAT),
FSignature("rnd" , false, emptyList(), DataType.UBYTE),
FSignature("rndw" , false, emptyList(), DataType.UWORD),
FSignature("rndf" , false, emptyList(), DataType.FLOAT),
FSignature("exit" , false, listOf(FParam("returnvalue", setOf(DataType.UBYTE))), null),
FSignature("rsave" , false, emptyList(), null),
FSignature("rrestore" , false, emptyList(), null),

View File

@ -27,6 +27,7 @@ main {
BC[lp] = rnd() & 15
DX[lp] = rnd() & 1
DY[lp] = rnd() & 1
void rnd()
}
; start clock