Re: A86: Menus


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

Re: A86: Menus






Garcia wrote:

> >> >I know I'm not Pat, but I think I can give a good go at these questions.
> $01
> >executes assembly and is followed by two bytes that are loaded into the
> register
> >bc (when it the program is executed).  I'm almost certain that $41 loads
> the hl
> >register, while $c1 loads the de register with the following bytes.  It may
> be
> >the other way around, though.
>
> So I change the first byte to $01 and then.... what does bc have to do with
> what is executed, is that where it jumps to...  Also how will I be able to
> specify it in two bytes if the 86 uses 24 bit mem and likewise how will I
> know that the address is accurate since programs move around.

  Ok, the format looks like this:

$01; two bytes which will be loaded into bc; $c3; two bytes for address to jump
to; zero terminated string to display in entry slot.

The reason you would want to load the bytes into bc is so that you can point to
the same code with different entries and do something with bc.
For instance:

entry:
.db 1                            ;type, also ld bc, xx xx
.dw bc_value            ;value to store in bc
.db $c3                        ;jp xx xx
.dw code                    ;pointer to code
.db "Push me!",0

code:
 ld a,b
 cp 5

or

code:
 ld l,c
 ld h,b
 ld de,$d1c3
 call _cphlde

When you use a menu, the ROM page one is swapped for you.  This is where all the
ROM's menus are kept and is, as far as I can tell, the same on both calcs (the
pointers aren't, but the menus are thankfully all in the same place).  Your
program will be at $d748 and you can access your menus there.  There are asaps
for both the math menu and the custom menu (nine for the math; 15 for the
custom).  If you are doing some kind of sqrt hack, your esh program will be
loaded to $d748.  So you don't need more than a two byte pointer.  The ROM
points to it's page change and change back thing, so it also only needs two
bytes.
I could be wrong about the $41,$c1 loading values into the other register pairs,
but it seems logical enough.
  ;-)

You might want to look at this:

http://www.eden.rutgers.edu/~assets/86menu.htm

            -Dux


References: