diff --git a/SourceGen/DisasmProject.cs b/SourceGen/DisasmProject.cs index 7943c08..47c7ec5 100644 --- a/SourceGen/DisasmProject.cs +++ b/SourceGen/DisasmProject.cs @@ -1037,7 +1037,15 @@ namespace SourceGen { // order, so we can just overwrite earlier symbols with matching labels. foreach (PlatformSymbols ps in PlatformSyms) { foreach (Symbol sym in ps) { - SymbolTable[sym.Label] = sym; + if (sym.Value == PlatformSymbols.ERASE_VALUE) { + // "erase" value + if (SymbolTable.TryGetValue(sym.Label, out Symbol found)) { + SymbolTable.Remove(found); + } + } else { + // overwrite + SymbolTable[sym.Label] = sym; + } } } diff --git a/SourceGen/PlatformSymbols.cs b/SourceGen/PlatformSymbols.cs index 337e354..cba57e5 100644 --- a/SourceGen/PlatformSymbols.cs +++ b/SourceGen/PlatformSymbols.cs @@ -28,6 +28,8 @@ namespace SourceGen { /// public class PlatformSymbols : IEnumerable { public const string FILENAME_EXT = ".sym65"; + private const string ERASE_VALUE_STR = "ERASE"; + public const int ERASE_VALUE = -1; public static readonly string FILENAME_FILTER = Res.Strings.FILE_FILTER_SYM65; /// @@ -165,20 +167,28 @@ namespace SourceGen { } else if (typeAndDir == '>') { direction = DefSymbol.DirectionFlags.Write; } + string badParseMsg; int value, numBase; bool parseOk; + string valueStr = matches[0].Groups[GROUP_VALUE].Value; if (isConst) { // Allow various numeric options, and preserve the value. - parseOk = Asm65.Number.TryParseInt(matches[0].Groups[GROUP_VALUE].Value, - out value, out numBase); + parseOk = Asm65.Number.TryParseInt(valueStr, out value, out numBase); badParseMsg = CommonUtil.Properties.Resources.ERR_INVALID_NUMERIC_CONSTANT; + } else if (valueStr.ToUpperInvariant().Equals(ERASE_VALUE_STR)) { + parseOk = true; + value = ERASE_VALUE; + numBase = 10; + badParseMsg = CommonUtil.Properties.Resources.ERR_INVALID_ADDRESS; } else { // Allow things like "05/1000". Always hex. numBase = 16; - parseOk = Asm65.Address.ParseAddress(matches[0].Groups[GROUP_VALUE].Value, - (1 << 24) - 1, out value); + parseOk = Asm65.Address.ParseAddress(valueStr, (1 << 24) - 1, + out value); + // limit to positive 24-bit values + parseOk &= (value >= 0 && value < 0x01000000); badParseMsg = CommonUtil.Properties.Resources.ERR_INVALID_ADDRESS; } diff --git a/SourceGen/RuntimeData/Apple/F8-ROM-nozp.sym65 b/SourceGen/RuntimeData/Apple/F8-ROM-nozp.sym65 new file mode 100644 index 0000000..c4a5b1c --- /dev/null +++ b/SourceGen/RuntimeData/Apple/F8-ROM-nozp.sym65 @@ -0,0 +1,45 @@ +; Copyright 2019 faddenSoft. All Rights Reserved. +; See the LICENSE.txt file for distribution terms (Apache 2.0). + +; +; Sometimes code uses the ROM entry points but redefines the zero-page +; addresses for its own purposes. Having the MON_* symbols is distracting. +; This erases them from the symbol table. +; +; To use: include this file, and ensure it comes after F8-ROM.sym65 in +; the platform symbol file list. +; + +*SYNOPSIS Remove monitor ROM zero-page symbols + +MON_WNDLEFT @ erase +MON_WNDWDTH @ erase +MON_WNDTOP @ erase +MON_WNDBTM @ erase +MON_CH @ erase +MON_CV @ erase +MON_GBASL @ erase +MON_GBASH @ erase +MON_H2 @ erase +MON_V2 @ erase +MON_COLOR @ erase +MON_INVFLAG @ erase +MON_PROMPT @ erase +MON_CSWL @ erase +MON_CSWH @ erase +MON_KSWL @ erase +MON_KSWH @ erase +MON_PCL @ erase +MON_PCH @ erase +MON_A1L @ erase +MON_A1H @ erase +MON_A2L @ erase +MON_A2H @ erase +MON_A3L @ erase +MON_A3H @ erase +MON_A4L @ erase +MON_A4H @ erase +MON_A5L @ erase +MON_A5H @ erase +MON_RNDL @ erase +MON_RNDH @ erase diff --git a/SourceGen/RuntimeData/Help/advanced.html b/SourceGen/RuntimeData/Help/advanced.html index d12731b..37a387e 100644 --- a/SourceGen/RuntimeData/Help/advanced.html +++ b/SourceGen/RuntimeData/Help/advanced.html @@ -71,7 +71,8 @@ written.

The VALUE is a number in decimal, hexadecimal (with a leading '$'), or binary (with a leading '%'). The numeric base will be recorded and used when formatting the symbol in generated output, so use whichever form is most -appropriate. Values are unsigned 24-bit numbers.

+appropriate. Values are unsigned 24-bit numbers. The special value +"erase" may be used to erase a symbol defined in an earlier platform file.

The WIDTH is optional, and ignored for constants. It must be a decimal or hexadecimal value between 1 and 65536, inclusive. If omitted,