From b4e66ea886ad12df007d08306749459edd30ef3e Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sun, 17 May 2026 14:16:33 +0200 Subject: [PATCH] libsrc/atari/system_check.s: fix MEMLO check Old check forced the program's load address to be one more than MEMLO. But MEMLO points to the first byte of usable RAM, not the last byte of unusable RAM. Problem found by Flashjazzcat, see https://github.com/cc65/cc65/issues/2964. --- libsrc/atari/system_check.s | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libsrc/atari/system_check.s b/libsrc/atari/system_check.s index 762fc954f..863221a0d 100644 --- a/libsrc/atari/system_check.s +++ b/libsrc/atari/system_check.s @@ -136,10 +136,10 @@ sys_ok: jsr sdcheck ; check for SpartaDOS-X, and if found, whether i sd_ok: .include "xlmemchk.inc" ; calculate lowest address we will use when we move the screen buffer down - lda MEMLO - cmp lowadr - lda MEMLO+1 - sbc lowadr+1 + ;lda lowadr ; already loaded in xlmemchk.inc + cmp MEMLO + lda lowadr+1 + sbc MEMLO+1 bcc memlo_ok ; load address was too low @@ -184,11 +184,11 @@ syschk: bcc mem_err ; program doesn't fit into memory - lda MEMLO - cmp #<__STARTADDRESS__ - lda MEMLO+1 - sbc #>__STARTADDRESS__ - bcc memlo_ok + lda #<__STARTADDRESS__ + cmp MEMLO + lda #>__STARTADDRESS__ + sbc MEMLO+1 + bcs memlo_ok ; load address was too low print_string2 lmemerr_txt, lmemerr_txt_len