From 3c4e6cfe7a93ac77605480f005576de9e77d7ef4 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Fri, 5 Oct 2018 20:44:30 -0700 Subject: [PATCH] Another swing at first-word-is-load-addr If we set the length word to assemble at address zero, the rest of the code will try to use it as a zero-page label, so don't do that. Instead, we use the start address, creating an overlapping region. Easy enough to edit if that's undesirable. (issue #23) --- SourceGen/DisasmProject.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SourceGen/DisasmProject.cs b/SourceGen/DisasmProject.cs index 67db917..c2f475c 100644 --- a/SourceGen/DisasmProject.cs +++ b/SourceGen/DisasmProject.cs @@ -254,8 +254,13 @@ namespace SourceGen { // Configure the load address. if (Setup.SystemDefaults.GetFirstWordIsLoadAddr(sysDef) && mFileData.Length > 2) { + // First two bytes are the load address, code starts at offset +000002. We + // need to put the load address into the stream, but don't want it to get + // picked up as an address for something else. So we set it to the same + // address as the start of the file. The overlapping-address code should do + // the right thing with it. int loadAddr = RawData.GetWord(mFileData, 0, 2, false); - mAddrMap.Set(0, 0); + mAddrMap.Set(0, loadAddr); mAddrMap.Set(2, loadAddr); OperandFormats[0] = FormatDescriptor.Create(2, FormatDescriptor.Type.NumericLE, FormatDescriptor.SubType.None);