Intel mcs-48 manual XCH A,R r Exchange Accumulator-Register Contents

Models: mcs-48

1 478
Download 478 pages 26.88 Kb
Page 108
Image 108

INSTRUCTION SET

XCH A,R r Exchange Accumulator-Register Contents

1001011rrri

The contents of the accumulator and the contents of working register 'r'are exchanged.

(A)~ (Rr)

r=0-7

Example: Move PSW contents to Reg 7 without losing accumulator contents.

XCHAR7: XCH A,R7 ;EXCHANGE CONTENTS OF REG 7

;AND ACC

MOV A, PSW ;MOVE PSW CONTENTS TO ACC

XCH A,R7 ;EXCHANGE CONTENTS OF REG 7 ;AND ACC AGAIN

XCH A,@R r Exchange Accumulator and Data Memory Contents

100101000ri

The contents of the accumulator and the contents of the resident data memory location addressed by bits 0-5*of register 'r'are exchanged. Register 'r' contents are unaffected.

(A)~ ((Rr))

r=0-1

Example: Decrement contents of location 52.

DEC52: MOV RO,#52

;MOVE '52'DEC TO ADDRESS

 

;REG 0

XCH A,@RO

;EXCHANGE CONTENTS OF ACC

 

;AND LOCATION 52

DEC A

;DECREMENT ACC CONTENTS

XCH A,@RO

;EXCHANGE CONTENTS OF ACC

 

;AND LOCATION 52 AGAIN

XCHD A,@R r Exchange Accumulator and Data Memory 4-Bit Data

100111 000r l

This instruction exchanges bits 0-3 of the accumulator with bits 0-3 of the data memory location addressed by bits 0-5*of register 'r'Bits. 4-7 of the accumulator,

bits 4-7 of the data memory location, and the contents of register 'r'-are unaffected.

(AO- 3) ~ ((RrO-3)) r=0-1

Mnemonics copyright Intel Corporation 1976.

'0-6for8039/8049

4-35

Page 108
Image 108
Intel mcs-48 XCH A,R r Exchange Accumulator-Register Contents, XCH A,@R r Exchange Accumulator and Data Memory Contents