mirror of
https://github.com/irmen/prog8.git
synced 2025-01-27 10:31:40 +00:00
fix pokew() crash with certain address expressions
This commit is contained in:
parent
25199dfb43
commit
c968bacb01
@ -680,12 +680,13 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> throw AssemblyError("wrong pokew arg type")
|
else -> {
|
||||||
|
asmgen.assignExpressionToVariable(fcall.args[0], "P8ZP_SCRATCH_W1", DataType.UWORD, null)
|
||||||
|
asmgen.assignExpressionToRegister(fcall.args[1], RegisterOrPair.AY)
|
||||||
|
asmgen.out(" jsr prog8_lib.func_pokew")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmgen.assignExpressionToVariable(fcall.args[0], "P8ZP_SCRATCH_W1", DataType.UWORD, null)
|
|
||||||
asmgen.assignExpressionToRegister(fcall.args[1], RegisterOrPair.AY)
|
|
||||||
asmgen.out(" jsr prog8_lib.func_pokew")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun funcPeekW(fcall: PtBuiltinFunctionCall, resultToStack: Boolean, resultRegister: RegisterOrPair?) {
|
private fun funcPeekW(fcall: PtBuiltinFunctionCall, resultToStack: Boolean, resultRegister: RegisterOrPair?) {
|
||||||
|
@ -91,4 +91,22 @@ main {
|
|||||||
assign.target.identifier!!.name shouldBe "cx16.r0"
|
assign.target.identifier!!.name shouldBe "cx16.r0"
|
||||||
assign.value shouldBe instanceOf<PtArrayIndexer>()
|
assign.value shouldBe instanceOf<PtArrayIndexer>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("peek and poke argument types") {
|
||||||
|
val text="""
|
||||||
|
main {
|
||||||
|
sub start() {
|
||||||
|
uword[3] arr
|
||||||
|
ubyte i = 42
|
||||||
|
uword ww = peekw(arr[i])
|
||||||
|
ubyte xx = peek(arr[i])
|
||||||
|
xx = @(arr[i])
|
||||||
|
|
||||||
|
@(arr[i]) = 42
|
||||||
|
poke(arr[i], 42)
|
||||||
|
pokew(arr[i], 4242)
|
||||||
|
}
|
||||||
|
}"""
|
||||||
|
compileText(C64Target(), false, text, writeAssembly = true) shouldNotBe null
|
||||||
|
}
|
||||||
})
|
})
|
@ -3,8 +3,6 @@ TODO
|
|||||||
|
|
||||||
For next minor release
|
For next minor release
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
- check that peekw() and peek() and @(...) accept a[i] where a=uword
|
|
||||||
- fix pokew() crash with args like: a[i] (where a=uword) , z % twoIMinusOne
|
|
||||||
- fix Github issue with X register https://github.com/irmen/prog8/issues/94
|
- fix Github issue with X register https://github.com/irmen/prog8/issues/94
|
||||||
- fix Github issue with array problems https://github.com/irmen/prog8/issues/99
|
- fix Github issue with array problems https://github.com/irmen/prog8/issues/99
|
||||||
- fix IR/VM: animals.p8 example somehow doesn't print the animal name correctly in the first question, and exits after 1 animal instead of looping
|
- fix IR/VM: animals.p8 example somehow doesn't print the animal name correctly in the first question, and exits after 1 animal instead of looping
|
||||||
|
Loading…
x
Reference in New Issue
Block a user