[A83] Re: AppVars
[Prev][Next][Index][Thread]
[A83] Re: AppVars
> ld hl,(avloc)
> ld b,n
> loop1:
> inc hl
> djnz loop
...Just one little thing. It makes more sense to do something like this:
ld hl,(avloc)
ld de,n ; or ld bc,n
add hl,de ; or add hl,bc
You save on size and speed, and it makes the code easier to follow.
-Dan Englender
----- Original Message -----
From: "Hyperbyte" <hyper@hysoft-automation.com>
To: <assembly-83@lists.ticalc.org>
Sent: Monday, June 25, 2001 1:05 PM
Subject: [A83] Re: AppVars
>
> I'll try...
>
> ;> Is anyone out there good with appvars?
> >
> ;> I created an appvar like so:
>
> > ld hl,appvart
> ;Okay, that's correct
>
> ;> b_call setxxxxop2
> ;This won't do, it doesn't take the bytes hl is pointing to,
> ;but the value of hl itself
> ;> b_call op2toop1
> ;This won't do too..
>
> ;Use
> rst rMOV9TOOP1 ; instead, (see appguru ch. 17)
>
> > ld hl,10
>
> ;Okay, you want 10 bytes in size...
>
> > b_call createappvar
>
> ;Use:
> inc de
> inc de ; to go to the start of the appvar now.
> ld hl,de
> ; hl now points to the start of the appvar...
>
> ;just for code legibility:
> jr continue
> > appvart: .db AppVarObj,"HELLO",0
> continue:
>
> ;> Now how would I read from this appvar?? And can I define them as
variables,
> ;> like for instance, HELLO = 3rd byte.
>
> ; do "avloc equ [some user space location]" in your programs header
> ; now:
>
> ld (avloc),hl ; to store your data for future reference.
>
> ;to store something to the n'th byte. (location independent code follows)
>
> ld hl,(avloc)
> ld b,n ; n = number of byte (0 = 1st byte)
> loop:
> inc hl
> djnz loop
>
> ld (hl), a ; a contains byte you want to store
>
> ;to load something from the n'th byte (again, location independent)
>
> ld hl,(avloc)
> ld b,n
> loop1:
> inc hl
> djnz loop
>
> ld a,(hl) ; a now contains loaded byte
>
>
> > THanks for your help
> Don't mention it :-)
>
> --Peter Martijn
>
>
> >
> > -joel
> >
> >
>
>
>
References: