Difference between revisions of "Z80 Instruction Set"

From WikiTI
Jump to: navigation, search
Line 1: Line 1:
 
{{Wikify}}
 
{{Wikify}}
'''ld''' ''(register1,register2) (memaddress,register)'' - Transfers data.
 
  
'''jp''' ''(memaddress) (1bitregister,memaddress)'' - Performs a direct jump
+
== Data Movement ==
 +
'''EX'''
 +
Three possible arguments:
  
'''jr''' ''(memaddress) (1bitregister,memaddress)'' - Performs a relative jump
+
''EX DE, HL''
 +
Swaps H with D and L with E
  
'''set''' ''(bit,byte)'' - Sets a bit
+
''EX AF, AF'''
 +
Swaps AF with its shadow
  
'''res''' ''(bit,byte)'' - Resets a bit
+
''EX (SP), HL''
 +
Swaps (SP) with L and (SP+1) with H.  Index registers are also valid
  
'''bit''' ''(bit,byte)'' - Test to see whether a bit is set or reset.
 
  
'''call''' ''(memaddress)'' - Performs a call
+
'''EXX'''
 +
Swap BC, DE and HL with their shadows
  
'''ret''' - Returns from a call
+
 
 +
'''LD'''
 +
Four main arguments:
 +
 
 +
''LD reg, #''
 +
Sets the eight or 16 bit contents of reg to #
 +
 
 +
''LD reg2, reg1''
 +
Copies the contents of 8 bit reg1 to reg2
 +
 
 +
''LD (imm16), reg''
 +
Copies the value of 8 or 16 bit reg to 16 bit memory address imm16.  Programmers should remember that 16 bit values are stored little-endian.
 +
 
 +
''LD reg, (imm16)''
 +
Does the opposite of ''LD (imm16), reg''

Revision as of 17:42, 21 February 2006


Please format this article according to the guidelines and Wikification suggestions, then remove this {{Wikify}} notice from the article.


Data Movement

EX Three possible arguments:

EX DE, HL Swaps H with D and L with E

EX AF, AF' Swaps AF with its shadow

EX (SP), HL Swaps (SP) with L and (SP+1) with H. Index registers are also valid


EXX Swap BC, DE and HL with their shadows


LD Four main arguments:

LD reg, # Sets the eight or 16 bit contents of reg to #

LD reg2, reg1 Copies the contents of 8 bit reg1 to reg2

LD (imm16), reg Copies the value of 8 or 16 bit reg to 16 bit memory address imm16. Programmers should remember that 16 bit values are stored little-endian.

LD reg, (imm16) Does the opposite of LD (imm16), reg