diff --git a/SourceGen/CodeAnalysis.cs b/SourceGen/CodeAnalysis.cs index b7e88ee..16dd1e4 100644 --- a/SourceGen/CodeAnalysis.cs +++ b/SourceGen/CodeAnalysis.cs @@ -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: diff --git a/SourceGen/RuntimeData/Help/tools.html b/SourceGen/RuntimeData/Help/tools.html index 1c4805e..b9e5f74 100644 --- a/SourceGen/RuntimeData/Help/tools.html +++ b/SourceGen/RuntimeData/Help/tools.html @@ -87,17 +87,31 @@ sliced, allowing you to confirm the placement.

OMF Converter

-

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.

+

This tool allows you to view Apple IIgs Object Module Format (OMF) +executables, and convert them for disassembly.

-

Only Load files may be converted (S16, PIF, etc). Compiler object +

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.

+ +

Only "Load" files (S16, PIF, TOL, etc) may be converted. Compiler object files and libraries contain unresolved references and are not supported.

-

The generated binary file is not in OMF format and will not execute -on an Apple IIgs.

+

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.

+ +

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.

+ +

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.

diff --git a/SourceGen/SGTestData/Expected/20052-branches-and-banks_64tass.S b/SourceGen/SGTestData/Expected/20052-branches-and-banks_64tass.S index d2f7ea8..0b2c03f 100644 --- a/SourceGen/SGTestData/Expected/20052-branches-and-banks_64tass.S +++ b/SourceGen/SGTestData/Expected/20052-branches-and-banks_64tass.S @@ -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 diff --git a/SourceGen/SGTestData/Expected/20052-branches-and-banks_Merlin32.S b/SourceGen/SGTestData/Expected/20052-branches-and-banks_Merlin32.S index d5523ea..dd09f2e 100644 --- a/SourceGen/SGTestData/Expected/20052-branches-and-banks_Merlin32.S +++ b/SourceGen/SGTestData/Expected/20052-branches-and-banks_Merlin32.S @@ -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 diff --git a/SourceGen/SGTestData/Expected/20052-branches-and-banks_cc65.S b/SourceGen/SGTestData/Expected/20052-branches-and-banks_cc65.S index ae4ade4..cbca746 100644 --- a/SourceGen/SGTestData/Expected/20052-branches-and-banks_cc65.S +++ b/SourceGen/SGTestData/Expected/20052-branches-and-banks_cc65.S @@ -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 diff --git a/SourceGen/Tools/Omf/Loader.cs b/SourceGen/Tools/Omf/Loader.cs index b1b01a7..8d9762e 100644 --- a/SourceGen/Tools/Omf/Loader.cs +++ b/SourceGen/Tools/Omf/Loader.cs @@ -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 _);