Re: A86: Libraries and Loaders


[Prev][Next][Index][Thread]

Re: A86: Libraries and Loaders



> What if those things change during the course of execution?  If the
> program you run creates a new variable, there's a good chance the memory
> will be shifted around and the will write back into the wrong place.
> It would be prudent to get look up the program's address again.

Now you have a point, if a prog was deleted and another was created it
would shift everything.  Okay, I will change that in the next version of
AShell.

Either way, asm progs with imported functions cant be called with Asm(
 
> Okay, then, let's talk.  Don't go hastily making a library service,
> calling it "standard" and hoping that people will follow it.  Let's get
> people to agree to a standard first.  Most of all, let's not rely on
> ourselves too much.  You said Martin Hock has experience--good!  Please
> ask him to subscribe to the list so we can pick his brain.  I'd like to
> try to get David Ellsworth (Fargo) to give us some tips, too.

I'll talk to him, he just got an 86 and he's going to port Insane Game
:)
 
> Ah, but then it gets complicated to decide between "ld hl,$8000" and
> "ld hl,($8000)."  With the table, there's no question about which
> addresses need relocation--every fixup is explicitly addressed, which
> means no mistakes can be made.

good point
 
> Besides, a program can be executable _and_ export functions at the same
> time.  In this case, it would have to start at _asm_exec_ram.

I dont like this: a program should only export 1 function.  Suppose we
have a library with 10 functions, and between every executable program,
only 6 of those functions are used.  We have 4 functions sitting there
wasting mem.
 
> If you're worried export tables taking up a lot of memory in libraries,
> don't.  Think about the kinds of functions that are useful in libraries:
> FindPixel, FastLine, WriteBack--they would all need few fixups.  After
> all, the only things that need fixing are absolute jump and data accesses
> within the part of the function that gets relocated.

I'm not worried about export tables taking up mem, I'm worried about
unused functions.
 
> If you're worried about import tables taking up a lot of memory in
> programs, don't.  There's an easy solution if a function is called so
> frequently that it would require many fixups:  create a stub function.
> 
>          FindPixel:  call slGraph.FindPixel  ; call from graphics lib
>                      ret
> 
> Then, there's only one fixup in the whole program.

ditto to what I said above

Bill


Follow-Ups: References: