Re: LZ: Question with programming


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

Re: LZ: Question with programming



Will Stokes wrote:
> 
> I just got this kinda thing to work recently. right off the bat you should
> change :
> 
> > ld de,PROGRAM_START ;Add offset to your program
> > add hl,de
> > ld de,Matrix1       ;Add offset from program start to matrix
> > add hl,de
> 
> to:
> 
>         ld hl, PROGRAM_START
>         ld de, Matrix1
>         add hl, de
> 
> I think this is right. You get the idea.

In the code i wrote i had not used de at that point and hl was loaded
with the offset from the start of the matrix. so when you load hl with
program start the offset from thre beggining of the matrix is deleted.
Besides that your code only gives a pointer to the beggining of the 
matrix not to the element. YOu could change the code i wrote to the 
following, but i think the first code was ok

:a holds offset from start
ld e,a
ld d,0
ld hl,PROGRAM_START
add hl,de
ld de,matrix1
add hl,de

AS you can see this code does exactly the same as the original, rigth ?
-- 
_______________________________________

Dines Justesen
Email: dines@post1.com or
       c958362@student.dtu.dk
WWW  : http://www.gbar.dtu.dk/~c958362/
_______________________________________


References: