Re: A86: Re: Ram Screen program.


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

Re: A86: Re: Ram Screen program.




What about an #include right in the middle of it?  so that the entire sqrtX
program will be in a separate file with an .org _asm_exec_ram?

You could have
code:
 .db $8E28
 #include "sqrtKEY.asm"
end_code:

Dux Gregis wrote:

> Jeremy Goetsch wrote:
>
> > >Don't ask me why hl points so
> > >high when _puts is used, I have no clue.  Could someone please explain?
> > >
> >
> > Your sqrtKEY handler program is essentially a program within a program. When
> > a key is pressed, the part between "code" and "code_end" will be copied to
> > _asm_exec_ram and executed. Hence, the label "code", when executed, will be
> > equivelent to _asm_exec_ram. In the installer program, however, this is
> > obviously not the case, as there is all that installer code before it. The
> > assembler doesn't know that this will be run as a separate program, so it
> > calculates the labels, including "memmenu", in relation to the beginning of
> > the entire installer program. So what you have to do is subtract the
> > difference between the start of the handler code ("code") and the start of
> > the installer code (_asm_exec_ram) every time you give an address in the
> > handler code (except for relative addresses).
> >
> > What I like to do is define a macro for this, like:
> > #define CodeOffset    (code - _asm_exec_ram + 2)
> >
> > (The +2 is because the 8E28 token will not be copied or executed.)
> >
> > Then just use:
> >     ld hl, memmenu - CodeOffset
> > instead of:
> >     ld hl, memmenu
> >
> > Later,
> >    Jeremy G.
>
>  An easier way to use a second .org, so that the labels are organized under
> _asm_exec_ram starting at where the code begins.  It can be tricky to get the
> copy labels correct, but if you use this for a template, you shouldn't have a
> problem:  http://www.eden.rutgers.edu/~assets/KeyTemp.asm
>
> Note:  TASM will wack out, so only do this if you're using Assembly Studio



--
Stephen Hicks
mailto:shicks@mindspring.com
ICQ:5453914
IRC/AIM:Kupopo
Hopemage:http://www.mindspring.com/~shicks/



References: