Zneo cpu instruction classes – Zilog Z16F2810 User Manual
Page 38
Assembly Language Introduction
UM018809-0611
22
ZNEO
®
CPU Core
User Manual
; in data (RAM space) memory
Str_Data:
; Make Str_Data label equal to current addr.
DB "NEVAR"
; Directive to allocate and initialize data
;
bytes
Str_Length EQU $ - Str_Data ; Equate Str_Length to current
assembly
; address ("$") minus Str_Data address.
Blank_Data:
; Allocate an uninitialized data block
DS Str_Length
; that is the same size as the Str_Data block.
SEGMENT CODE
; Directive to put the following statements in
; instruction (ROM space) memory
REVERSE:
; Routine to reverse a block of data
LD R8, #Str_Data ; Load R8 with 1st address in Str_Data block
LD R12, #Blank_Data+Str_Length ;Next addr. after Blank_Data
LOOP:
; Start of loop
LD.UB R5,(R8++)
; Load byte pointed to by R8 into R5 LSB
; Increment R8 after load.
LD.B (--R12),R5
; Decrement R12, then
; Load byte pointed to by R12 with R5 LSB
CP R12, #Blank_Data ; Did we write all the bytes?
JP NZ,LOOP
; Repeat until Blank_Data block contains
; reversed copy of Str_Data bytes
For details about assembly instructions, see
the Instruction Set Reference chapter on
. For details about operand addressing and data sizes, see the
For information about how program flow can be interrupted, see the
page 41, System Exceptions on page 49, and Software Traps on page 53.
For details about assembly language syntax, expressions, directives, and using the assem-
bler, refer to
.
ZNEO CPU Instruction Classes
ZNEO CPU
instructions can be divided functionally into the following groups:
•
Arithmetic
•
Logical
•
Bit Manipulation
•
Rotate and Shift