mirror of
https://github.com/irmen/prog8.git
synced 2025-08-10 10:25:31 +00:00
fix startup subroutine linking in VM
This commit is contained in:
@@ -3,9 +3,6 @@ TODO
|
|||||||
|
|
||||||
For next minor release
|
For next minor release
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
- fix IR/VM: animals.p8 example is borked, it jumps straight to a suggestion and then somehow doesn't print the animal name correctly in the first question, and exits after 1 animal instead of looping
|
|
||||||
this has happened after v8.7: caused by c21913a6 ir: keep order of children in block 22-11-2022
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,6 +2,9 @@
|
|||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
%option no_sysinit
|
%option no_sysinit
|
||||||
|
|
||||||
|
; The documentation for custom PS2 key handlers can be found here:
|
||||||
|
; https://github.com/X16Community/x16-docs/blob/master/X16%20Reference%20-%2002%20-%20Editor.md#custom-keyboard-scancode-handler
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
@@ -69,6 +72,9 @@ main {
|
|||||||
; Unfortunately this also means you cannot decide from that prog8 code
|
; Unfortunately this also means you cannot decide from that prog8 code
|
||||||
; if the keyboard press should be consumed/ignored or put into the keyboard queue
|
; if the keyboard press should be consumed/ignored or put into the keyboard queue
|
||||||
; (this is controlled by returning 0 or 1 in register A here)
|
; (this is controlled by returning 0 or 1 in register A here)
|
||||||
|
;
|
||||||
|
; see:
|
||||||
|
; https://github.com/X16Community/x16-docs/tree/X16%20Reference%20-%2002%20-%20Editor.md#custom-keyboard-scancode-handler
|
||||||
|
|
||||||
%asm {{
|
%asm {{
|
||||||
php
|
php
|
||||||
|
@@ -23,9 +23,11 @@ class VmProgramLoader {
|
|||||||
// make sure that if there is a "main.start" entrypoint, we jump to it
|
// make sure that if there is a "main.start" entrypoint, we jump to it
|
||||||
irProgram.blocks.firstOrNull()?.let {
|
irProgram.blocks.firstOrNull()?.let {
|
||||||
if(it.children.any { sub -> sub is IRSubroutine && sub.label=="main.start" }) {
|
if(it.children.any { sub -> sub is IRSubroutine && sub.label=="main.start" }) {
|
||||||
val chunk = IRCodeChunk(null, null)
|
val previous = programChunks.lastOrNull()
|
||||||
|
val chunk = IRCodeChunk(null, previous)
|
||||||
placeholders[Pair(chunk, 0)] = "main.start"
|
placeholders[Pair(chunk, 0)] = "main.start"
|
||||||
chunk += IRInstruction(Opcode.JUMP, labelSymbol = "main.start")
|
chunk += IRInstruction(Opcode.JUMP, labelSymbol = "main.start")
|
||||||
|
previous?.let { p -> p.next = chunk }
|
||||||
programChunks += chunk
|
programChunks += chunk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user