Re: LZ: Another Question


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

Re: LZ: Another Question



Frank wrote:
> 
> I know everyone is getting annoyed with me asking question so i have been
> trying to figure this out myself but until i get the z80 book i need some
> help.. i need some type of routine to read 2 coordinate in and store 1 in HL
> and one in DE for example
> 
> .db $0405,$0608
> 
> The routine should load $0405,hl and $0608,de ... i wrote some that kinda
> worked but i would like to see how an experience programmer would do it...
> 
> Thanx


You should store those as words! Like this:


Words:
 .dw $0405,$0608


To read those, you can do like this:


 ld hl,Words
 ld de,(PROGRAM_ADDR)
 add hl,de
 push hl
 call LD_HL_MHL
 ex de,hl
 pop hl
 inc hl
 inc hl
 call LD_HL_MHL
 ex de,hl


Now HL should contain $0405 and DE $0608.


<pre>
-- 
Jimmy Mårdell               "Trying to get a grip of life
mailto:mja@algonet.se         with all these fears i cannot hide
http://www.algonet.se/~mja     But how to keep an open mind
IRC: Yarin                      when i'm so fucked up i could die"
</pre>


References: