make sure BASIC rom is banked in again when program exits

This commit is contained in:
Irmen de Jong 2021-04-05 23:12:10 +02:00
parent 64c85b9617
commit 5b890847e5
3 changed files with 10 additions and 13 deletions

View File

@ -517,8 +517,6 @@ asmsub init_system() {
jsr c64.CHROUT jsr c64.CHROUT
lda #147 ; clear screen lda #147 ; clear screen
jsr c64.CHROUT jsr c64.CHROUT
ldx #4
stx $01 ; select rom bank 4 (enable basic again)
lda #0 lda #0
tax tax
tay tay

View File

@ -157,7 +157,12 @@ internal class AsmGen(private val program: Program,
pha""") pha""")
} }
jmp("main.start") // make sure that on the cx16 and c64, basic rom is banked in again when we exit the program
when(compTarget.name) {
Cx16Target.name -> out(" jsr main.start | lda #4 | sta $01 | rts")
C64Target.name -> out(" jsr main.start | lda #31 | sta $01 | rts")
else -> jmp("main.start")
}
} }
private fun slaballocations() { private fun slaballocations() {

View File

@ -1,22 +1,15 @@
%import textio %import textio
%import floats %import floats
%zeropage dontuse %zeropage basicsafe
main { main {
sub start() { sub start() {
;cx16.rombank(4)
float f1 = 9.9999 float f1 = 9.9999
float f2 = 8.8888 float f2 = 8.8888
float f3 = 0.1111 float f3 = 0.1111
%asm {{
phx
ldy #<f1
lda #>f1
jsr $FE42
jsr $FE7B
plx
}}
f3=cos(f3) f3=cos(f3)
floats.print_f(f1) floats.print_f(f1)
@ -28,9 +21,10 @@ main {
f3 = cos(f3) f3 = cos(f3)
floats.print_f(f3) floats.print_f(f3)
cx16.rombank(0)
txt.print("ok!\n") txt.print("ok!\n")
sys.wait(2*60) sys.wait(2*60)
} }
} }