atarixl: check at startup whether RAM beneath the ROM is in use
If detected, the program refuses to run, preventing a crash. The check only works with SpartaDOS. I don't have an overview which DOSes potentially use the RAM under the ROM. Or which other installed programs might use it. No additional runtime memory space is consumed, since the change is in the "system check" load chunk which gets replaced by the user program during loading.
This commit is contained in:
parent
c7a40db1b7
commit
e4e3dbf756
1 changed files with 31 additions and 2 deletions
|
@ -68,8 +68,32 @@ cont: ldx #0 ; channel 0
|
|||
|
||||
.segment "SYSCHK"
|
||||
|
||||
rts ; for older DOSes which unconditionally run the first load chunk
|
||||
|
||||
.ifdef __ATARIXL__
|
||||
|
||||
; check for SpartaDOS and its usage of RAM below ROM
|
||||
; return CF 0/1 for bad/ok
|
||||
sdcheck:lda DOS
|
||||
cmp #'S'
|
||||
bne sdcrts0 ; not SpartaDOS, assume RAM is not used
|
||||
lda DOS+1 ; SD version
|
||||
cmp #$40 ; SD-X has $40 or higher
|
||||
bcc sdcrts1 ; older versions (except maybe 1.x) always use the RAM under the ROM
|
||||
ldy #31 ; offset for OSRMFLG
|
||||
lda (DOSVEC),y ; get OSRMFLG
|
||||
bne sdcrts1
|
||||
|
||||
sdcrts0:clc
|
||||
rts
|
||||
sdcrts1:sec
|
||||
rts
|
||||
|
||||
ramrom_txt:
|
||||
.byte "Memory under ROM is in use.", ATEOL
|
||||
.byte "Cannot run this program.", ATEOL
|
||||
ramrom_txt_len = * - ramrom_txt
|
||||
|
||||
lmemerrxl_txt:
|
||||
.byte "Not enough memory to move screen", ATEOL
|
||||
.byte "memory to low memory. Consider using", ATEOL
|
||||
|
@ -94,8 +118,13 @@ syschk: lda $fcd8 ; from ostype.s
|
|||
|
||||
jmp mem_err
|
||||
|
||||
sys_ok:
|
||||
.include "xlmemchk.inc" ; calculate lowest address we will use when we move the screen buffer down
|
||||
sys_ok: jsr sdcheck ; check for SpartaDOS-X, and if found, whether it uses the RAM under the ROM
|
||||
bcc sd_ok
|
||||
|
||||
print_string2 ramrom_txt, ramrom_txt_len
|
||||
jmp fail
|
||||
|
||||
sd_ok: .include "xlmemchk.inc" ; calculate lowest address we will use when we move the screen buffer down
|
||||
|
||||
lda MEMLO
|
||||
cmp lowadr
|
||||
|
|
Loading…
Add table
Reference in a new issue