From 49cdfcf5b0f5f6a6940de398c855226004681fe8 Mon Sep 17 00:00:00 2001 From: uz Date: Fri, 8 Jul 2011 08:58:41 +0000 Subject: [PATCH] The BASIC stub does encode the start address with only 4 digits. Add a check so the linker will not generate an invalid header for program files with larger start addresses. git-svn-id: svn://svn.cc65.org/cc65/trunk@5074 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/cbm/exehdr.s | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libsrc/cbm/exehdr.s b/libsrc/cbm/exehdr.s index 541d2e583..6d0051d96 100644 --- a/libsrc/cbm/exehdr.s +++ b/libsrc/cbm/exehdr.s @@ -14,6 +14,7 @@ .addr Next .word .version ; Line number .byte $9E ; SYS token +; .byte <(((Start / 10000) .mod 10) + '0') .byte <(((Start / 1000) .mod 10) + '0') .byte <(((Start / 100) .mod 10) + '0') .byte <(((Start / 10) .mod 10) + '0') @@ -22,6 +23,11 @@ Next: .word 0 ; BASIC end marker Start: +; If the start address is larger than 4 digits, the header generated above +; will not contain the highest digit. Instead of wasting one more digit that +; is almost never used, check it at link time and generate an error so the +; user knows something is wrong. +.assert (Start < 10000), error, "Start address too large for generated BASIC stub" -- 2.39.5