Re: A86: actual asm help


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

Re: A86: actual asm help




> ld hl,_textshadow
>
> ld a,1
> ld (hl),a ......what does h contain...and what does l contain

That's an indirect load (using HL for indirection).  It doesn't change the
value of HL.  H points to the high byte of the address of _textshadow, and L
points to the low byte of the address.  To see the exact value, check the
includes or symbol table (I don't remember, nor is it important...ram page 1
has much more space :)

> ld a,(hl)
> cp 1    ...........does a now contain 1

Yes.  CP only sets the flags, it does not change the value of anything.

> ld bc,$FC00
> ld (hl),bc.......what does h contain and what does l contain

Well, nothing, because there's no LD (hl),rr instruction.  You can't do an
indirect 16-bit load.  Were it possible, HL would still contain whatever
value it contained before.  To do that:

 ld (hl),c   ; load low byte in high position
 inc hl      ; move to next byte in ram
 ld (hl),b   ; remember, the z80 reverses 16 bit numbers in memory
 dec hl      ; if you want HL as it was before

> i really have trouble with keeping in my head what value is in each
register
> when a 8 bit register is loaded into a 16 bit register....do you have to
> clear the upper or lower byte first like m68k asm ?

Hehe...you're confusing a direct load with an indirect load.  You can't load
an 8 bit register into a 16 bit register and vice versa.  However, if you
load part of an 16 bit register into part of another 16 bit register, it
won't affect the other part (yeah, that does sound confusing):

 ld bc,$1234     ; b = $12, c = $34
 ld de,$5678     ; d = $56, e = $78

 ld d,c          ; d = $34, e = $78 (still)

                 ; bc = $1234
                 ; de = $5348

Make more sense now?  There's a question in the 86 Central FAQ dealing with
this, so read it (I don't feel like retyping it all now :)  Oh, and since I
finally got the password to the main sites (after the update, Matt redid all
the permissions), so 86 will once again be updated (I hope)...




References: