Jump to content

Pointers and references: Difference between revisions

m
Line 2,073:
ld e,(hl) ;load the E register with the byte at memory address &D000.
 
ld bc,(&E000) ;load the register pair BC from memory address &E000. The Game Boy cannot use this addressing mode.
; This is the same as:
; ld a,(&E000)
Line 2,081:
 
ld IX,&F000
ld a,(IX+3) ;load A with the byte stored at &F003, The Game Boy cannot use this addressing mode.</lang>
 
Keep in mind that <code>HL</code>, <code>IX</code>, and <code>IY</code> are more flexible in the valid addressing modes that can be used.
Below are examples of code that are '''not valid''' and will be rejected by your assembler. (regardless of whether you are programming on a "real" Z80 or a Game Boy)
 
<lang z80>ld h,(bc) ;if (bc) or (de) is the operand of a LD command, the other operand must be A.
1,489

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.