Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #273

Re: "LINKER", a program found on Asimov's "EDASM.DSK"

From David Schmenk <dschmenk@gmail.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: "LINKER", a program found on Asimov's "EDASM.DSK"
Date 2012-04-12 13:49 -0700
Organization http://groups.google.com
Message-ID <10552127.469.1334263793942.JavaMail.geo-discussion-forums@pbig5> (permalink)
References <3d9c2b3a-8d6a-4f59-add5-5bc3314f4cbc@i18g2000vbx.googlegroups.com> <7d9425ef-1115-4819-987f-d8cecd7b62d4@lf20g2000pbb.googlegroups.com> <55ccb74c-dae2-4418-b7a9-cf91384adab2@d4g2000vbn.googlegroups.com> <80a11a15-259d-4e50-94af-19755234e0c1@r9g2000yqd.googlegroups.com> <3f8904a4-759b-4853-aba1-31e9e4f75d11@dc2g2000vbb.googlegroups.com>

Show all headers | View raw


On Thursday, April 12, 2012 12:05:38 PM UTC-7, A2CPM wrote:
> Hi, y'all!
> 
>     Before I was made aware of the information available on Dr.
> Matthews site, I created a source file for "EDASM.ASM".  If you
> display the catalog for "EDASM.DSK", you will see that the auxiliary
> address for "EDASM.ASM" is $3000.  But "EDASM.ASM" is actually loaded
> at $6800.  Then, $6800 to $77FF is copied to $D000 to $DFFF in bank
> 1.  So, the source file I created for "EDASM.ASM" has two 'ORG'
> statements, one for $D000 and one for $7800.
> 
>     As a test for "LINKER", I broke the source file I generated for
> "EDASM.ASM" into two parts and added ENTRY and EXTRN mnemonics to the
> two parts to allow references between the two pieces to be satisfied.
> But a comparison of the module created by "LINKER" against "EDASM.ASM"
> reveals that "LINKER" can apparently only create modules that occupy
> contiguous memory.  All the references from the first assembly (loaded
> at $6800 but lives at $D000 in bank 1) to the second assembly (loaded
> at $7800 and runs there) were off by $5900.  An attempt to inform
> "LINKER" that the second 'REL' file actually starts at $7800, not
> $D100, by inserting ' ORG $7800' before the line specifying the second
> 'REL' file was rejected by "LINKER".  Also, "LINKER" did not correctly
> resolve inter-module references when there was an offset from an
> address defined by an 'EXTRN'.  Example: ' LDA OUTREF+1' where
> 'OUTREF' is defined in an 'EXTRN' statement.
> 
> Willi

Willi-

I'm glad you're looking at this.  It looks like the LINKER isn't doing quite what it should.  EDASM will place the offset calculation into the REL file.  It is up to the linker/loader to add the offset into the external address' base.  I've been finding out how to run through the fixup table and can now successfully load REL files generated by EDASM and link in PLASMAs runtime library (including offsets to EXTRNs).  You can easily fix the LINKER by having it add in the value at the fixup address with the EXTRNally resolved address.

As for using multiple ORG statements, that is probably causing confusion with the REL directive.  Even though you are assembling a REL file, it still requires an ORG statement to set a base address for the assembly.  The ORG value is saved in the AUX field of the file, much like a BIN file, and used when calculating the relocation offset.  (Note: Virtual ][ has a bug where it forgets the AUX value between runs when mounting a directory as a ProDOS volume)  I think having an ORG directive is pointless when generating a REL file, but that's how it works.  I discovered that placing multiple ORG directives in the ASM source will generate multiple object files, one for each ORG.  Wanting to build a single binary that would relocate certain sections to different addresses required an additional tool to reconnect the separate object files back into one.  I had to build using the SYS objective in order to get everything assembled at the address I wanted it.

Dave...

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

"LINKER", a program found on Asimov's "EDASM.DSK" A2CPM <a2@wilserv.com> - 2012-04-08 21:51 -0700
  Re: "LINKER", a program found on Asimov's "EDASM.DSK" MarkLim <markpmlim@yahoo.com.sg> - 2012-04-09 06:18 -0700
    Re: "LINKER", a program found on Asimov's "EDASM.DSK" A2CPM <a2@wilserv.com> - 2012-04-10 11:44 -0700
      Re: "LINKER", a program found on Asimov's "EDASM.DSK" MarkLim <markpmlim@yahoo.com.sg> - 2012-04-10 14:23 -0700
        Re: "LINKER", a program found on Asimov's "EDASM.DSK" A2CPM <a2@wilserv.com> - 2012-04-12 12:05 -0700
          Re: "LINKER", a program found on Asimov's "EDASM.DSK" Steven Hirsch <snhirsch@gmail.com> - 2012-04-12 15:37 -0400
          Re: "LINKER", a program found on Asimov's "EDASM.DSK" David Schmenk <dschmenk@gmail.com> - 2012-04-12 13:49 -0700
            Re: "LINKER", a program found on Asimov's "EDASM.DSK" A2CPM <a2@wilserv.com> - 2012-04-12 17:52 -0700
            Re: "LINKER", a program found on Asimov's "EDASM.DSK" Steven Hirsch <snhirsch@gmail.com> - 2012-04-13 16:57 -0400

csiph-web