1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-06 00:28:58 +00:00

Fix bank for AbsInd and AbsIndLong addressing

The Absolute Indirect and Absolute Indirect Long addressing modes
(e.g. "JMP (addr)" and "JMP [addr]") are 16-bit values in bank 0.
The code analyzer was placing them in the program bank, which
meant the wrong symbol was being used.

Also, tweak some docs.
This commit is contained in:
Andy McFadden 2020-07-04 15:03:23 -07:00
parent 0fa77cba75
commit 8d291ba21e
6 changed files with 39 additions and 22 deletions

View File

@ -869,11 +869,11 @@ namespace SourceGen {
case OpDef.AddressMode.AbsIndexX:
case OpDef.AddressMode.AbsIndexY:
case OpDef.AddressMode.AbsIndexXInd:
case OpDef.AddressMode.AbsInd:
case OpDef.AddressMode.AbsIndLong:
case OpDef.AddressMode.StackAbs:
mAnattribs[offset].OperandAddress = operand | bank;
break;
case OpDef.AddressMode.AbsInd: // JMP (addr), always bank 0
case OpDef.AddressMode.AbsIndLong: // JMP [addr], always bank 0
case OpDef.AddressMode.DP:
case OpDef.AddressMode.DPIndexX:
case OpDef.AddressMode.DPIndexY:

View File

@ -87,17 +87,31 @@ sliced, allowing you to confirm the placement.</p>
<h2><a name="omf-converter">OMF Converter</a></h2>
<p>This tool allows you to view Apple IIgs Object Module Format
binaries, and convert them for disassembly. OMF files have multiple
segments with relocatable code. The conversion tool loads the OMF
file the same way the GS/OS System Loader would, and creates a
SourceGen project file for it with some basic attributes filled in.</p>
<p>This tool allows you to view Apple IIgs Object Module Format (OMF)
executables, and convert them for disassembly.</p>
<p>Only Load files may be converted (S16, PIF, etc). Compiler object
<p>OMF executables have multiple segments with relocatable code. References
to addresses aren't filled in until the program is loaded into memory,
which makes it difficult to disassemble the file. The conversion tool
loads the OMF file in roughly the same way the GS/OS System Loader would,
placing each segment at the start of a bank unless otherwise directed.
The loaded image is saved to a new file, and a SourceGen project file is
created with some basic attributes filled in.</p>
<p>Only "Load" files (S16, PIF, TOL, etc) may be converted. Compiler object
files and libraries contain unresolved references and are not supported.</p>
<p>The generated binary file is not in OMF format and will not execute
on an Apple IIgs.</p>
<p>The binary generated by the tool is not in OMF format and will not
execute on an Apple IIgs. To be functional, the sources must be
assembled by a program capable of generating OMF output, such as Merlin.</p>
<p>The relocation dictionaries from the executable are included in the
project file, and can be used to guide the disassembler's analysis. The
"use reloc data" setting in the project properties controls this feature.</p>
<p>A full explanation of the structure of OMF is beyond the scope of this
manual. For more information on OMF, see Appendix F of the GS/OS Reference
Manual.</p>
</div>

View File

@ -93,13 +93,13 @@ _L543268 jmp (backval,x)
_L54326B jmp (fwdval,x)
_L54326E jmp ($1008)
_L54326E jmp (lodat)
_L543271 jmp ($1008)
_L543271 jmp (lodat)
_L543274 jml [$1008]
_L543274 jml [lodat]
_L543277 jml [$1008]
_L543277 jml [lodat]
fwdval .long fwdchk

View File

@ -87,13 +87,13 @@ L54321C ldal backchk
:L54326B jmp (fwdval,x)
:L54326E jmp ($1008)
:L54326E jmp (lodat)
:L543271 jmp ($1008)
:L543271 jmp (lodat)
:L543274 jml [$1008]
:L543274 jml [lodat]
:L543277 jml [$1008]
:L543277 jml [lodat]
fwdval adr $54327d

View File

@ -95,13 +95,13 @@ L54321C: lda backchk
@L54326B: jmp (fwdval & $ffff,x)
@L54326E: jmp ($1008)
@L54326E: jmp (lodat)
@L543271: jmp ($1008)
@L543271: jmp (lodat)
@L543274: jml [$1008]
@L543274: jml [lodat]
@L543277: jml [$1008]
@L543277: jml [lodat]
fwdval: .faraddr fwdchk

View File

@ -354,6 +354,9 @@ namespace SourceGen.Tools.Omf {
uc = UndoableChange.CreateProjectPropertiesChange(proj.ProjectProps, newProps);
cs.Add(uc);
// TODO(someday): by default we apply a code hint to offset 0 of the first
// segment. The placement should take the segment's ENTRY into account.
Debug.WriteLine("Applying " + cs.Count + " changes");
proj.ApplyChanges(cs, false, out _);