4 reading and writing regi, 5 using the arithmetic and, 1 selecting the active a – Maxim Integrated MAXQ Family User Manual
Page 31: 2 enabling auto-incremen, 4 reading and writing register bits -6, 5 using the arithmetic and logic unit -6, 1 selecting the active accumulator -6, 2 enabling auto-increment and auto-decrement -6, Maxq family user’s guide, 4 reading and writing register bits
3-6
MAXQ Family User’s Guide
3.4 Reading and Writing Register Bits
The MOVE instruction can also be used to directly set or clear any one of the lowest 8 bits of a peripheral register in module 0h-5h or
a system register in module 8h. The set or clear operation will not affect the upper byte of a 16-bit register that is the target of the set
or clear operation. If a set or clear instruction is used on a destination register that does not support this type of operation, the regis-
ter high byte will be written with the prefix data and the low byte will be written with the bit mask (i.e. all 0’s with a single 1 for the set
bit operation or all ones with a single 0 for the clear bit operation).
Register bits can be set or cleared individually using the MOVE instruction as follows.
move IGE, #1
; set IGE (Interrupt Global Enable) bit
move APC.6, #0
; clear IDS bit (APC.6)
As with other instructions, prefixing is required to select destination registers beyond index 07h.
The MOVE instruction may also be used to transfer any one of the lowest 8 bits from a register source or any bit of the active accu-
mulator (Acc) to the Carry flag. There is no restriction on the source register module for the ‘MOVE C, src.bit’ instruction.
move C, IIR.3
; copy IIR.3 to Carry
move C, Acc.7
; copy Acc.7 to Carry
Prefixing is required to select source registers beyond index 15h.
3.5 Using the Arithmetic and Logic Unit
The MAXQ provides either an 8-bit (MAXQ10) or 16-bit (MAXQ20) ALU, which allows operations to be performed between the active
accumulator and any other register. The default ALU configuration provides eight accumulator registers that are also either 8-bit
(MAXQ10) or 16-bit (MAXQ20) wide, of which any one may be selected as the active accumulator. Many MAXQ devices will be
equipped with 16 working accumulators.
3.5.1 Selecting the Active Accumulator
Any of the 16 accumulator registers A[0] through A[15] may be selected as the active accumulator by setting the low four bits of the
Accumulator Pointer Register (AP) to the index of the accumulator register you want to select.
move AP, #01h
; select A[1] as the active accumulator
move AP, #0Fh
; select A[15] as the active accumulator
The current active accumulator can be accessed as the Acc register, which is also the register used as the implicit destination for all
arithmetic and logical operations.
move A[0], #55h
; set A[0] = 55 hex (MAXQ10)
;
= 0055 hex (MAXQ20)
move AP, #00h
; select A[0] as active accumulator
move Acc, #55h
; set A[0] = 55 hex (MAXQ10)
;
= 0055 hex (MAXQ20)
3.5.2 Enabling Auto-Increment and Auto-Decrement
The accumulator pointer AP can be set to automatically increment or decrement after each arithmetic or logical operation. This is use-
ful for operations involving a number of accumulator registers, such as adding or subtracting two multibyte integers.
If auto-increment/decrement is enabled, the AP register increments or decrements after any of the following operations:
• ADD src (Add source to active accumulator)
• ADDC src (Add source to active accumulator with carry)
• SUB src (Subtract source from active accumulator)
• SUBB src (Subtract source from active accumulator with borrow)
• AND src (Logical AND active accumulator with source)
• OR src (Logical OR active accumulator with source)
• XOR src (Logical XOR active accumulator with source)
• CPL (Bit-wise complement active accumulator)
• NEG (Negate active accumulator)
Maxim Integrated