cx16: reset rom/ram/monitor banks at program exit to sane values.

This commit is contained in:
Irmen de Jong 2022-07-01 00:14:38 +02:00
parent 7901ec2a64
commit fb989ae62f
3 changed files with 7 additions and 9 deletions

View File

@ -127,11 +127,8 @@ internal class ProgramAndVarsGen(
"cx16" -> {
if(options.floats)
asmgen.out(" lda #4 | sta $01") // to use floats, make sure Basic rom is banked in
asmgen.out(" jsr main.start | lda #4 | sta $01")
if(!options.noSysInit)
asmgen.out(" jsr main.start")
asmgen.out(" jmp ${compTarget.name}.cleanup_at_exit")
else
asmgen.out(" rts")
}
"c64" -> {
asmgen.out(" jsr main.start | lda #31 | sta $01")

View File

@ -639,8 +639,12 @@ asmsub init_system_phase2() {
asmsub cleanup_at_exit() {
; executed when the main subroutine does rts
; just an rts here, nothing special to clean up on cx16
%asm {{
lda #1
sta $00 ; ram bank 1
lda #4
sta $01 ; rom bank 4 (kernal)
stz $2d ; hack to reset machine code monitor bank to 0
rts
}}
}

View File

@ -3,9 +3,6 @@ TODO
For next release
^^^^^^^^^^^^^^^^
- cx16 programs seem to poke 0, 56 at exit?
- assembling hello4.asm prints stray characters in the string
- petaxian roller.p8 line 49 (also see test.p8) generates large code compared to 8.2
- code gen for if statements has become inefficient? vm/6502?