1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-30 01:50:10 +00:00

Expand reach of external symbol nearby-target test

If PTR is defined as an external symbol, we were automatically
symbol-ifying PTR+1.  Now we also symbolify PTR+2.  This helps with
24-bit pointers on the 65816, and 16-bit "jump vectors", where the
address is preceded by a JMP opcode.

Removed the "AMPERV_" symbol I added to make the tutorial look
right.
This commit is contained in:
Andy McFadden 2018-10-08 13:15:16 -07:00
parent 3a001c5f8a
commit b37d3dba02
3 changed files with 13 additions and 10 deletions

View File

@ -702,11 +702,14 @@ namespace SourceGen {
// address map split as well, since the first byte past is an external
// address, and a label at the end of the current region will be offset
// from by this.)
if (sym == null && (attr.OperandAddress & 0xffff) != 0xffff && checkNearby) {
if (sym == null && (attr.OperandAddress & 0xffff) > 0 && checkNearby) {
sym = SymbolTable.FindAddressByValue(attr.OperandAddress - 1);
}
// TODO(maybe): if this is a 65816, check for a symbol at addr-2, for the
// benefit of long pointers.
// If that didn't work, try addr-2. Good for 24-bit addresses and jump
// vectors that start with a JMP instruction.
if (sym == null && (attr.OperandAddress & 0xffff) > 1 && checkNearby) {
sym = SymbolTable.FindAddressByValue(attr.OperandAddress - 2);
}
if (sym != null) {
mAnattribs[offset].DataDescriptor =
FormatDescriptor.Create(mAnattribs[offset].Length,

View File

@ -26,8 +26,7 @@ ERRFLG @ $D8 ;$80 if onerr active
HPAG @ $E6 ;hi-res page to draw on ($20 or $40)
SCALE @ $E7 ;hi-res graphics scale factor
AMPERV @ $03F5 ;jump to function that handles Applesoft '&' cmds
AMPERV_ @ $03F6 ;vector to function that handles Applesoft '&' cmds
AMPERV @ $03F5 ;JMP to function that handles Applesoft '&' cmds
;
; Useful Applesoft routines.

View File

@ -327,15 +327,16 @@ can do. We assume you've already finished the Basic Features tutorial.</p>
and navigate to the Examples directory. In A2-Amper-fdraw, select
<code>AMPERFDRAW#061d60</code>. Click OK to create the project.</p>
<p>Not a lot to see here -- just half a dozen lines of loads and stores.
We can make it a bit more meaningful by loading an additional platform
This particular program interfaces with Applesoft BASIC, so we can make it
a bit more meaningful by loading an additional platform
symbol file. Select Edit > Project Properties, then the Symbol Files
tab. Click Add Symbol Files. The file browser starts in the RuntimeData
directory. In the Apple folder, select <code>Applesoft.sym65</code>, and
click Open. Click OK to close the project properties window.</p>
<p>The STA instructions now reference <code>AMPERV_</code>, which is noted
as a call vector. We can see it setting up a call to $1d70. As it happens,
the start address of the code is $1d60 -- the last four digits of the
filename -- so let's make that change. Double-click the initial .ORG
<p>The STA instructions now reference <code>AMPERV</code>, which is noted
as a call vector. We can see the code setting up a jump to $1d70. As it
happens, the start address of the code is $1d60 -- the last four digits of
the filename -- so let's make that change. Double-click the initial .ORG
statement, and change it from $2000 to $1d60. We can now see that $1d70
starts right after this initial chunk of code.</p>