Difference between revisions of "PM Opc EX"

From SublabWiki
Jump to: navigation, search
(EX instruction (PLEASE REVIEW!))
(No difference)

Revision as of 11:11, 20 April 2009

EX = Expand Register

Hex Mnemonic Cycles
CE A8 EX BA, A 12

Flags Affected: None

Execute

A       = Register A
BA      = Register BA: (B shl 8) or A
; EX BA, A
;
; BA = Destination
; A  = Source

IF (A and 0x80 == 0) THEN
  B = 0x00
ELSE
  B = 0xFF
ENDIF

Description

EX expands register A into BA, turning a signed 8-bits value into 16-bits.

Conditions

Zero: Set when result is 0

Sign: Set when bit 7 of the result is 1

Carry and Overflow remain unchanged

Examples

; A = 0x05
EX BA, A
; BA = 0x0005
; F = (Zero=0):(Sign=0)
; A = 0xF9
EX BA, A
; BA = 0xFFF9
; F = (Zero=0):(Sign=1)
; A = 0x00
EX BA, A
; BA = 0x0000
; F = (Zero=1):(Sign=0)

« Back to Instruction set