Jump to content

GB Programming: Difference between revisions

m
Text replacement - "(hl)" to "[hl]"
m (Text replacement - "(\bld(?:|i|l|d|h) (?:.+, ?)?)\((.+)\)" to "$1[$2]")
m (Text replacement - "(hl)" to "[hl]")
Line 446:
So now, how to access memory? With parentheses! To access memory address $CD38, you just have to use ($CD38). Yay!
 
To access the memory location pointed to by HL, just do... ([hl)]! It's the same with BC and DE.
 
So, to retrieve the value at memory address $6511 into register A : ''ld a, [$6511]''
Line 494:
!C
|-
|INC <nowiki>{reg8 | reg16 | ([hl)]}</nowiki>
|Adds one to the operand ("increments" it)
|Affected, except for reg16
|Not affected
|-
|DEC <nowiki>{reg8 | reg16 | ([hl)]}</nowiki>
|Subtracts one to the operand ("decrements" it)
|Affected, except for reg16
|Not affected
|-
|ADD A, <nowiki>{reg8 | imm8 | ([hl)]}</nowiki>
|Adds the operand to the accumulator
|Affected
Line 514:
|Not affected
|-
|SUB <nowiki>{reg8 | imm8 | ([hl)]}</nowiki>
|Subtracts the operand from the accumulator. The syntax SUB A, <nowiki>{...}</nowiki> is also valid but less common.
|Affected
Line 582:
ld b, [hl]
sub a, b
inc ([hl)]
inc hl
ld [hl], b
Line 819:
ld b, [hl]
</pre>
If ([hl)] equals $63, execution jumps to placeItems.
 
Otherwise, executions continues through, increments hl twice, then jumps to "someplace"
Line 1,074:
Notice here that doing ''sub a, b'' actually increased A's value!
 
inc ([hl)] ; (HL) = ($C004) = $DF
 
inc hl ; HL = $C005
Cookies help us deliver our services. By using our services, you agree to our use of cookies.