Pointers and references: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 2,073: | Line 2,073: | ||
ld e,(hl) ;load the E register with the byte at memory address &D000. |
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. |
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: |
; This is the same as: |
||
; ld a,(&E000) |
; ld a,(&E000) |
||
Line 2,081: | Line 2,081: | ||
ld IX,&F000 |
ld IX,&F000 |
||
ld a,(IX+3) ;load A with the byte stored at &F003</lang> |
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. |
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 |
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. |
<lang z80>ld h,(bc) ;if (bc) or (de) is the operand of a LD command, the other operand must be A. |