Difference between revisions of "PM Opc SWAP"

From SublabWiki
Jump to: navigation, search
(SWAP Instruction)
 
m (Examples)
 
(2 intermediate revisions by 2 users not shown)
Line 14: Line 14:
 
|12
 
|12
 
|}
 
|}
 
'''Flags Affected:''' None
 
  
 
=== Execute ===
 
=== Execute ===
  
  A        = (8-Bits) Register A
+
  A        = (8-Bits) Register A
  [HL]    = (8-Bits) Memory: (I shl 16) or HL
+
  [HL]    = (8-Bits) Memory: (I shl 16) or HL
  
 
  ; SWAP Ds
 
  ; SWAP Ds
Line 30: Line 28:
 
=== Description ===
 
=== Description ===
  
Swap low and high nibbles of register A and return the formed byte into register A.
+
Swap low and high nibbles of a given byte.
  
 
=== Conditions ===
 
=== Conditions ===
Line 39: Line 37:
  
 
  ; A = 0x3A
 
  ; A = 0x3A
  SWAP A
+
  '''SWAP A'''
 
  ; A = 0xA3
 
  ; A = 0xA3
  
 
  ; [HL] = 0xF6
 
  ; [HL] = 0xF6
  SWAP [HL]
+
  '''SWAP [HL]'''
 
  ; [HL] = 0x6F
 
  ; [HL] = 0x6F
  
 
[[PM_InstructionList|'''« Back to Instruction set''']]
 
[[PM_InstructionList|'''« Back to Instruction set''']]

Latest revision as of 00:32, 21 April 2009

SWAP = Swap Low and High Nibbles

Hex Mnemonic Cycles
F6 SWAP A 8
F7 SWAP [HL] 12

Execute

A        = (8-Bits) Register A
[HL]     = (8-Bits) Memory: (I shl 16) or HL
; SWAP Ds
;
; Ds = Source/Destination

Ds = (Ds SHL 4) OR (Ds SHR 4)

Description

Swap low and high nibbles of a given byte.

Conditions

None

Examples

; A = 0x3A
SWAP A
; A = 0xA3
; [HL] = 0xF6
SWAP [HL]
; [HL] = 0x6F

« Back to Instruction set