beautypg.com

3 reading and writing regi, 1 loading an 8-bit regis, 2 loading a 16-bit regis – Maxim Integrated MAXQ7667 User Manual

Page 31: 3 moving values between, 3 reading and writing registers -4, Maxq7667 user’s guide, 3 reading and writing registers

background image

___________________________________________________________________________________________________________

3-4

MAXQ7667 User’s Guide

Generally, prefixing operations can be inserted automatically by the assembler as needed, so that (for example)

move DP[0], #1234h

actually assembles as

move PFX[0], #12h

move DP[0], #34h

However, the operation

move DP[0], #0055h

does not require a prefixing operation even though the register DP[0] is 16-bit. This is because the prefix value defaults to zero, so the line

move PFX[0], #00h

is not required.

3.3 Reading and Writing Registers

All functions in the MAXQ7667 are accessed through registers, either directly or indirectly. This section discusses loading registers with

immediate values and transferring values between registers of the same size and different sizes.

3.3.1 Loading an 8-Bit Register with an Immediate Value

Any writable 8-bit register with a subindex from 0h to 7h within its module can be loaded with an immediate value in a single cycle

using the MOVE instruction.

move AP, #05h

; load accumulator pointer register with 5 hex

Writable 8-bit registers with subindexes 8h and higher can be loaded with an immediate value using MOVE as well, but an additional

cycle is required to set the prefix value for the destination.

move WDCN, #33h

; assembles to: move PFX[2], #00h

;

move (WDCN-80h), #33h

3.3.2 Loading a 16-Bit Register with a 16-Bit Immediate Value

Any writable 16-bit register with a subindex from 0h to 07h can be loaded with an immediate value in a single cycle if the high byte of

that immediate value is zero.

move LC[0], #0010h

; prefix defaults to zero for high byte

If the high byte of that immediate value is not zero or if the 16-bit destination subindex is greater than 7h, an extra cycle is required to

load the prefix value for the high byte and/or the high-order register index bits.

; high byte <> #00h

move LC[0], #0110h

; assembles to: move PFX[0], #01h

;

move LC[0], #10h

; destination sub-index > 7h

move A[8], #0034h

; assembles to: move PFX[2], #00h

;

move (A[8]-80h), #34h

3.3.3 Moving Values Between Registers of the Same Size

Moving data between same-size registers can be done in a single-cycle MOVE if the destination register’s index is from 0h to 7h and

the source register index is between 0h and Fh.

move A[0], A[8]

; copy accumulator 8 to accumulator 0

move LC[0], LC[1]

; copy loop counter 1 to loop counter 0

If the destination register’s index is greater than 7h or if the source register index is greater than Fh, prefixing is required.

move A[15], A[0]

; assembles to: move PFX[2], #00h

;

move (A[15]-80h), A[0]