Jump to content
JAC!

SDX & MADS: Defining Symbols relative to COMTAB

Recommended Posts

Hi,

 

three things first:

1) I've never used SDX and not even loaded a program for it

2) I know the file format though and wrote a parser for it

3) I know 1) and 2) are a somehow a contradiction, but who said this forum is for logical questions only

 

I have a program here as source that was done for SDX. The author (mono) uses the CPP pre-processor because the code uses symbols relative to COMTAB. The latter I assume is the base address for all system routines, like the EXEC ($0004) pointer under Amiga OS.

 

; In asm source you must include:
; #include "sdxdef.icl"
; and assembly with:
; $ cpp -P source.asm -o source.a && mads source.a
DECOUT2 = COMTAB-21
The reason behind using the pre-processor seems to be that MADS cannot result definition like the one above if COMTAB is a relocated symbol.
And when I replace
DIVA = COMTAB+255
DIVB = COMTAB+$103
FACA = COMTAB+255
FACB = COMTAB+$103
RESI = COMTAB+$107
by
FACA SMB 'FACA'
FACB SMB 'FACB'
RESI SMB 'RESI'

 

it all compiles fine with MADS without the pre-processor but will must likely not load because RESI for example will not be resolved.

What's the reason behind this? Does the SDX loader only resolve a subset of the entries known in this "COMTAB"?
If yes, why? I'd assume all entries in COMTAB are "public" (at least the code above anyway codes against that assumption/offsets).

Edited by JAC!

Share this post


Link to post
Share on other sites

Try to replace "RESI" with "COMTAB+$107" inplace.

For example:

 

lda RESI

 

replace with:

 

lda COMTAB+$107

 

It compiles and run correctly. Cpp does it this way :)

 

Edit: SDX resolves only COMTAB symbol, as an starting address of system variables table (this table contain variables like RESI, DIVA, DIVB, etc).

Edited by mono

Share this post


Link to post
Share on other sites

Hi mono. I know it works that way, the questions was why isn't it done the more flexible way.

The answer probably is all about saving memory at the expense of less flexibility/implicit addresses/openess.

Valid for an 8-bit machine and in fact even the Amiga OS libs worked exactly the same way.
Only the root pointer to each libs was dynamic. Within every libs relative jump tables were used.#

My thoughts were just too much into modern linkers and FJC's use case with the GUI.

Edited by JAC!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...