Re: A86: Using other variables/files.


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

Re: A86: Using other variables/files.



In a message dated 97-09-19 02:15:26 EDT, you write:

> 
>  Does anyone know how to access other variables from in Assembly, what I
>  have in mind is accessing another compiled program, which holds my text
>  data, and then displaying it from my main program.  Would I have to put a
>  .ret at the beginning so if someone ran it it wouldn't crash calc?
>  
>  Andres
>  
>  

It would be a good idea to put that ret there.  To access other variables,
you really have two options.  Both use rst 20/10h to get the address, but
once it's in ahl, you can do one of the following:

1) Call the call that converts ahl to hl with page in a and re-assign both
pages.  $4000-$7FFF to the page where it starts (a), and $8000-$CFFF to the
next page (a+1).  Then use hl (remember to subtract $4000, because it expects
it to start in the 3rd 16k, instead of the 2nd.)  The downside of this is you
have to swap that 1st page to $D to use calls, and then switch back... :-(

2) Keep ahl pointed to the variable and increment it as much as necessary to
make it point where you want.  Then call the call that converts it to hl
_and_ switches the ram page for you, print the text (and hope that it's not
between pages), and then put the absolute address back in ahl.  If you don't
and it overlaps pages, then you're screwed, so you need to switch the page
each time you point somewhere else in it.

3) Just thought of this one.  It might work, and it wiuld be easier.  Again,
keep ahl pointing to the data you need to use, but then, there might be a
call to move some # of bytes from (abs_src) to (abs_dest), so you can point
(abs_dest) to somewhere in your program that can store a single line at a
time or something....  If this one works, tell me.... :-)

~Stephen Hicks