1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-26 06:49:19 +00:00

Use two .ORGs for first-word-is-load-addr

First is always at zero, second is at the address.  This puts an
ORG directive right at the start of the code, and avoids potentially
assembler-specific wrap-around behavior when the desired load
address is $0000 or $0001.

(issue #23)
This commit is contained in:
Andy McFadden 2018-10-05 17:25:41 -07:00
parent 92add74fc3
commit 440eec2396

View File

@ -253,21 +253,18 @@ namespace SourceGen {
ProjectProps.EntryFlags = Setup.SystemDefaults.GetEntryFlags(sysDef); ProjectProps.EntryFlags = Setup.SystemDefaults.GetEntryFlags(sysDef);
// Configure the load address. // Configure the load address.
int loadAddr;
if (Setup.SystemDefaults.GetFirstWordIsLoadAddr(sysDef) && mFileData.Length > 2) { if (Setup.SystemDefaults.GetFirstWordIsLoadAddr(sysDef) && mFileData.Length > 2) {
loadAddr = RawData.GetWord(mFileData, 0, 2, false); int loadAddr = RawData.GetWord(mFileData, 0, 2, false);
loadAddr -= 2; mAddrMap.Set(0, 0);
if (loadAddr < 0) { mAddrMap.Set(2, loadAddr);
loadAddr += 65536;
}
OperandFormats[0] = FormatDescriptor.Create(2, FormatDescriptor.Type.NumericLE, OperandFormats[0] = FormatDescriptor.Create(2, FormatDescriptor.Type.NumericLE,
FormatDescriptor.SubType.None); FormatDescriptor.SubType.None);
TypeHints[0] = CodeAnalysis.TypeHint.NoHint; TypeHints[0] = CodeAnalysis.TypeHint.NoHint;
TypeHints[2] = CodeAnalysis.TypeHint.Code; TypeHints[2] = CodeAnalysis.TypeHint.Code;
} else { } else {
loadAddr = Setup.SystemDefaults.GetLoadAddress(sysDef); int loadAddr = Setup.SystemDefaults.GetLoadAddress(sysDef);
mAddrMap.Set(0, loadAddr);
} }
mAddrMap.Set(0, loadAddr);
foreach (string str in sysDef.SymbolFiles) { foreach (string str in sysDef.SymbolFiles) {
ProjectProps.PlatformSymbolFileIdentifiers.Add(str); ProjectProps.PlatformSymbolFileIdentifiers.Add(str);