Category:Z80 Assembly: Difference between revisions

Content added Content deleted
m (changed tags to display code correctly)
Line 46: Line 46:
* & or $ represents hexadecimal, and % represents binary.
* & or $ represents hexadecimal, and % represents binary.
* A register or a 16-bit value in parentheses represents a pointer being dereferenced. The size of the data pointed to will be the same as the size of the destination.
* A register or a 16-bit value in parentheses represents a pointer being dereferenced. The size of the data pointed to will be the same as the size of the destination.
<syntaxhighlight lang="Z80">
<lang z80>LD A,($4000) ;load the BYTE at memory address $4000 into the accumulator.
LD HL,($6000) ;load the WORD at memory address $6000 into HL.
LD A,($4000) ;load the BYTE at memory address $4000 into the accumulator.
LD HL,($6000) ;load the WORD at memory address $6000 into HL.
;Or, more accurately, load the BYTE at $6000 into L and the BYTE at $6001 into H.
;Or, more accurately, load the BYTE at $6000 into L and the BYTE at $6001 into H.
LD A,(HL) ;The value stored in HL is treated as a memory address, and the BYTE at that address is loaded into the accumulator.</lang>
LD A,(HL) ;The value stored in HL is treated as a memory address, and the BYTE at that address is loaded into the accumulator.
</syntaxhighlight>


==Efficient Coding Tricks==
==Efficient Coding Tricks==