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

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)
This commit is contained in:
Andy McFadden 2018-10-05 20:44:30 -07:00
parent 440eec2396
commit 3c4e6cfe7a

View File

@ -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);