CPU S12Z
CPU S12Z
Reference Manual
Linear S12Z
Microcontrollers
CPUS12ZRM
Rev. 1.01
01/2013
freescale.com
Table 0-1. Revision History
1.01 24 Jan 2013 Fixed typos and grammar errors throughout the document.
Chapter 1
Introduction
1.1 Introduction to S12Z CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3 Symbols and Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.3.1 Source form notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.3.2 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.3.3 CPU registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3.4 Memory and addressing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3.5 Condition code register (CCR) bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.3.6 Address mode notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.3.7 Machine coding notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3.8 CCR activity notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3.9 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Chapter 2
Overview
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.2 Programmer’s Model and CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.2.1 General Purpose Data Registers (Di) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.2.2 Index Registers (X, Y) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2.3 Stack Pointer (SP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2.4 Program Counter (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2.5 Condition Code Register (CCR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.2.5.1 U Control Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.2.5.2 IPL[2:0] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2.5.3 S Control Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2.5.4 X Mask Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2.5.5 I Mask Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.2.5.6 N Status Bit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.2.5.7 Z Status Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.2.5.8 V Status Bit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.2.5.9 C Status Bit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3 Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.4 Memory Operand Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.5 CPU Register Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6 Memory Organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Chapter 3
Addressing Modes
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 Summary of Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.3 Inherent Addressing Mode (INH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.4 Register Addressing Mode (REG, REG*) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.5 Immediate Addressing Modes (IMM, IMM1, IMM2, IMM3, IMM4) . . . . . . . . . . . . . . . . . . . . . . . 30
3.5.1 Short Immediate Addressing mode (IMMe4*) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Chapter 4
Instruction Queue
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.2 Queue Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.2.1 S12Z CPU Instruction Queue Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.2.2 S12Z CPU Operation Dispatcher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.2.3 Changes in Execution Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.2.3.1 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2.3.2 Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2.4 Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2.4.1 Conditional Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.2.4.2 Bit Condition Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.2.4.3 Loop Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.2.5 Jumps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Chapter 5
Instruction Set Overview
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.2 Instruction Set Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.3 Instruction Set Organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.4 Register and Memory Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.4.1 Data Movement and Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Chapter 6
Instruction Glossary
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.2 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
ABS — Absolute Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
ADC — Add with Carry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
ADD — Add without Carry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
AND — Bitwise AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
ANDCC — Bitwise AND CCL with Immediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
ASL — Arithmetic Shift Left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
ASR — Arithmetic Shift Right. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
BCC — Branch if Carry Clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
BCLR — Test and Clear Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
BCS — Branch if Carry Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
BEQ — Branch if Equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
BFEXT — Bit Field Extract. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
BFINS — Bit Field Insert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
BGE — Branch if Greater Than or Equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
BGND — Enter Background Debug Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
BGT — Branch if Greater Than . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
BHI — Branch if Higher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
BHS — Branch if Higher or Same . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
BIT — Bit Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
BLE — Branch if Less Than or Equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
BLO — Branch if Lower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
BLS — Branch if Lower or Same . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
BLT — Branch if Less Than . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
BMI — Branch if Minus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
BNE — Branch if Not Equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
BPL — Branch if Plus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
BRA — Branch Always . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
BRCLR — Test Bit and Branch if Clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
BRSET — Test Bit and Branch if Set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
BSET — Test and Set Bit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
BSR — Branch to Subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
BTGL — Test and Toggle Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
BVC — Branch if Overflow Clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
BVS — Branch if Overflow Set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
CLB — Count Leading Sign-Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Chapter 7
Exceptions
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
7.2 Types of Exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
7.3 Exception Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
7.3.1 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
7.3.2 Software Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
7.3.2.1 Unimplemented Op-code Traps (SPARE, TRAP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
7.3.2.2 Software Interrupt and System Call Instructions (SWI, SYS) . . . . . . . . . . . . . . . . . . . . . 309
7.3.3 Machine Exception. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
7.3.4 X-bit-Maskable Interrupt Request (XIRQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
7.3.5 I-bit-Maskable Interrupt Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
7.3.6 Return-from-Interrupt Instruction (RTI). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
7.4 Interrupt Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
7.5 Exception Processing Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
7.5.1 Vector Fetch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
7.5.2 Reset Exception Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
7.5.3 Interrupt and Unimplemented Opcode Trap Exception Processing . . . . . . . . . . . . . . . . . . 313
Chapter 8
Instruction Execution Timing
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
8.2 Instruction Execution Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
8.2.1 No Operation Instruction Execution Times (NOP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
8.2.2 Move Instruction Execution Times (MOV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
8.2.3 Load Instruction Execution Times (LD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
8.2.4 Store Instruction Execution Times (ST) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
8.2.5 Push Register(s) onto Stack Instruction Execution Times (PSH) . . . . . . . . . . . . . . . . . . . 317
8.2.6 Pull Register(s) from Stack Instruction Execution Times (PUL). . . . . . . . . . . . . . . . . . . . . 317
8.2.7 Load Effective Address Instruction Execution Times (LEA). . . . . . . . . . . . . . . . . . . . . . . . 318
8.2.8 Clear Instruction Execution Times (CLR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
8.2.9 Register-To-Register Transfer and Exchange Execution Times (TFR, EXG, SEX, ZEX) . 318
8.2.10 Logical AND/OR Instruction Execution Times (AND, OR, BIT, EOR) . . . . . . . . . . . . . . . . 319
8.2.11 One’s Complement (Invert) Instruction Execution Times (COM) . . . . . . . . . . . . . . . . . . . . 320
8.2.12 Increment and Decrement Instruction Execution Times (INC, DEC) . . . . . . . . . . . . . . . . . 320
8.2.13 Add and Subtract Instruction Execution Times (ADD, ADC, SUB, SBC, CMP). . . . . . . . . 321
8.2.14 Two’s Complement (Negate) Instruction Execution Times (NEG) . . . . . . . . . . . . . . . . . . . 321
Chapter 9
Data Bus Operation
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
9.2 Access Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
9.3 Data Transfer Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Appendix A
Instruction Reference
A.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
A.2 S12Z Instruction Set Summary Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
A.3 S12Z Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
A.4 Postbyte Coding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
A.4.1 General Operand (OPR) Addressing Postbyte (xb) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
A.4.2 Math Postbyte (mb) for MUL, MAC, DIV, MOD and QMUL . . . . . . . . . . . . . . . . . . . . . . . . 366
A.4.3 Loop Primitive Postbyte (lb) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
A.4.4 Shift and Rotate Postbyte (sb) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
A.4.5 Bit Manipulation Postbyte (bm) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
A.4.6 Bitfield Postbyte (bb) for BFEXT and BFINS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
A.4.7 Transfer and Exchange Postbytes (tb) and (eb) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
indexed postbyte was re-worked into a general operand (OPR) addressing system. This new addressing
mode postbyte includes indexed addressing modes like the CPU12 and extended addressing modes, a
quick-immediate mode, and register-as-memory addressing mode.
In addition to this general OPR addressing postbyte, the S12Z instruction set uses postbytes for
transfer/exchange, looping primitives, math (MUL, DIV, MAC, and MOD), relative addressing, shifts,
bit-field instructions, and push/pull.
1.2 Features
The S12Z CPU is the next generation of CPU in the CPU12 line. This high-speed 16-bit processor has an
expanded programmers model with 24-bit wide X, Y, SP, and PC registers and replaces the A, B, and D
accumulators with a set of eight general purpose registers Di. Improved addressing modes support efficient
use of the 16-megabyte (24-bit) linear address space.
bwplbwpl — Any of the characters B, W, P, L, or 2-letter pairs BB, BW, BP, BL, WB, WW….LB, LW, LP, or LL to indicate
the sizes for an instruction with two input operands.
B=byte, W=16-bit word, P=24-bit pointer, L=32-bit long-word. The two-letter codes allow the size of each
operand to be specified separately and the one-letter codes indicate the same size is used for both input
operands.
bwl — Any of the characters B, W, or L to indicate the size of the operation.
B=byte, W=16-bit word, L=32-bit long-word
bwpl — Any of the characters B, W, P, or L to indicate the size of the operation.
B=byte, W=16-bit word, P=24-bit pointer, L=32-bit long-word
cc — Branching condition (EQ, NE, MI, PL, GT, or LE) for loop instructions test-and branch (TBcc) or decrement
and branch (DBcc).
Branch if… EQ - equal; NE - not equal; MI - minus; PL - plus; GT - greater than; LE - less than or equal
cpureg — Any of the CPU registers D0, D1, D2, D3, D4, D5, D6, D7, X, Y, SP, CCH, CCL, or CCW. Used for transfer
and exchange instructions.
Di — Any of the eight CPU data registers D2, D3, D4, D5, D0, D1, D6, or D7.
Dj — Typically used for a second operand.
Dk — Used for a third operand in MAC, MOD, MUL, and DIV instructions.
Ds — Used for a source operand.
Dd — Used for a destination operand.
Dn — Used for a numeric control parameter such as the number of positions to shift.
Dp — Any of the four 16-bit CPU data registers D2, D3, D4, or D5. Used to specify the width and offset parameters
in bit field instructions BFEXT and BFINS.
opr1i — Any label or expression that evaluates to a 1-bit (5-bit) immediate operand. Used to specify number of shifts
opr5i for shift and rotate instructions. Immediate value is encoded in the shift postbytes (sb) or (sb+xb).
opr8i — Any label or expression that evaluates to an 8-bit immediate operand.
opr16i — Any label or expression that evaluates to a 16-bit immediate operand.
opr18i — Any label or expression that evaluates to an 18-bit immediate operand. Two bits of the 18-bit operand are
encoded into the opcode. The value is zero-extended and placed in X or Y.
opr24 — A 24-bit address which can be considered signed or unsigned.
opr24a — A 24-bit address.
opr24i — A 24-bit immediate constant.
opr24u — A 24-bit unsigned constant offset.
opr32i — Any label or expression that evaluates to a 32-bit immediate operand.
oprdest — Any label or expression that evaluates to an address within +127/–128 or +/–16K from the current location.
Used for 7-bit or 15-bit relative branches.
oprimmsz — Any label or expression that evaluates to an immediate operand of the same size as the CPU register involved
in the instruction (8, 16, or 32 bits).
oprmemreg — Refer to the OPR addressing summary to see how to expand this into the operand specification for 1 of 16
OPR addressing modes (allowed forms and brief description shown here below).
#oprsxe4i — Short Immediate. oprsxe4i is any label or expression which evaluates to one of the values -1, 1, 2, 3...14,
or 15. Auto sign-extended to 8, 16, 24, or 32 bits.
Di — Register as operand. Di is any one of the eight CPU data registers D0, D1, D2, D3, D4, D5, D6, or D7.
(opru4,xys) — Short offset (0-15) from X, Y, or S. opru4 is any label or expression that evaluates to unsigned 0-15.
(+xy) | (xy+) | (–xy) | (xy–) | (–S) | (S+) — Auto pre/post inc/dec from X, Y, or S (S=SP).
Where xy is either of the two index register names X or Y.
(Di,xys) — Register offset from X, Y, or S. xys is any one of the 24-bit indexing registers X, Y, or S (S=SP).
16-bit D2, D3, D4, D5 treated as signed, D0, D1, D6, D7 treated as unsigned.
[Di,xy] — Register offset from X or Y Indirect. D2, D3, D4, D5 treated as signed, D0, D1, D6, D7 are unsigned.
(oprs9,xysp) — 9-bit signed offset from X, Y, S, or P. oprs9 is any label or expression that evaluates to a 9-bit signed value
from –256 to +256. (0 is treated as +256) xysp is any one of the 24-bit registers X, Y, S or P (S=SP P=PC).
[oprs9,xysp] — 9-bit signed offset from X, Y, S, or P Indirect.
opru14 — Short Extended (16K). opru14 is any label or expression that evaluates to a 14-bit unsigned address from
$000000 through $003FFF. All registers and 12K of RAM.
(opru18,Di) — 18-bit unsigned offset from Di. opr18 is any label or expression that evaluates to an 18-bit unsigned value
from $000000 through $03FFFF (256K).
opru18 — Medium Extended (256K). Reaches any address from $000000 to $03FFFF. All on-chip RAM.
(opr24,xysp) — 24-bit offset from X, Y, S, or P. opr24 is any label or expression that evaluates to a 24-bit value (16M).
[opr24,xysp] — 24-bit offset from X, Y, S, or P Indirect.
(opru24,Di) — 24-bit offset from Di. Can also be considered as a register offset from any 16M address or label.
opr24 — Long Extended (16M). Reaches any address in the full 16M memory space.
[opr24] — 24-bit address Indirect.
oprregs1 — Any combination of the CPU registers in the list (CCH, CCL, D0, D1, D2, D3) separated by commas. Used
with the PSH and PUL instructions.
oprregs2 — Any combination of the CPU registers in the list (D4, D5, D6, D7, X, Y) separated by commas. Used with the
PSH and PUL instructions.
oprs9 — Any label or expression that evaluates to a 9-bit signed value from –256 to +256. (0 is treated as +256)
oprsxe4i — Any label or expression which evaluates to one of the values -1, 1, 2, 3...14, or 15. Auto sign-extended to 8,
16, 24, or 32 bits.
opru4 — Any label or expression that evaluates to the unsigned values 0 through 15.
opru14 — Any label or expression that evaluates to a 14-bit unsigned address from $000000 through $003FFF. All
registers and 12K of RAM.
opru18 — Any label or expression that evaluates to an 18-bit unsigned value from $000000 through $03FFFF (256K).
trapnum — Any label or expression that evaluates to the code for one of the unused opcodes on pg2 of the opcode map.
Valid values are 0x92..0x9F, 0xA8..0xAF, 0xB8..0xBF and 0xC0..0xFF.
width:offset — Any label or expression that evaluates to a 10-bit immediate operand. Used to specify field width and offset
w:o for bit field instructions where w and o are each 5-bit values (w=0 treated as 32).
xy — One of the two index register names X or Y.
xys — Any one of the 24-bit indexing registers X, Y, or S (S=SP).
xysp — Any one of the 24-bit registers X, Y, S or P (S=SP P=PC).
1.3.2 Operators
+ — Add
– — Subtract or negate (two’s complement)
∗ — Multiply
/ — Divide
|expression| — Absolute value of the expression shown between vertical bars
MS, MD — Source and Destination memory operands. MS and MD use separate addressing modes to specify each of
these operands.
M(SP) — The memory location pointed-to by the stack pointer. Similarly, the notation M(SP):M(SP+1):M(SP+2) indicates
the three memory bytes at address=SP, address=SP+1, and address=SP+2.
M:M+1:M+2 — A 24-bit value in three consecutive memory locations. The higher-order (most significant) 8 bits are located at
address=M, and the next two 8-bit values are located at the next higher sequential addresses.
$ — This prefix indicates a hexadecimal value
% — This prefix indicates a binary value
1.3.9 Definitions
Logic level 1 is the voltage that corresponds to the true (1) state.
Logic level 0 is the voltage that corresponds to the false (0) state.
Set refers specifically to establishing logic level 1 on a bit or bits.
Cleared refers specifically to establishing logic level 0 on a bit or bits.
Asserted means that a signal is in active logic state. An active low signal changes from logic level 1 to
logic level 0 when asserted, and an active high signal changes from logic level 0 to logic level 1.
Negated means that an asserted signal changes logic state. An active low signal changes from logic level 0
to logic level 1 when negated, and an active high signal changes from logic level 1 to logic level 0.
ADDR is the mnemonic for address bus.
DATA is the mnemonic for data bus.
LSB means least significant bit or bits.
MSB means most significant bit or bits.
LSW means least significant word or words.
MSW means most significant word or words.
A range of bit locations is referred to by mnemonic and the numbers that define the range. For example,
DATA[15:8] form the high byte of the data bus.
CARRY
TWO’S COMPLEMENT OVERFLOW
ZERO
NEGATIVE
I-INTERRUPT MASK
X-INTERRUPT MASK
STOP MODE ENABLE
INTERRUPT PRIORITY LEVEL [2:0]
USER/SUPERVISOR STATE
Figure 2-1. CPU Registers
There are load effective address instructions for D6 and D7, and indexed addressing sub modes that allow
an 18-bit or 24-bit constant offset from a data register Di. This helps in programming situations where
more than two index/pointer registers are needed.
Bit-field instructions use a 5-bit value to specify the width of the field to operate on and a 5-bit value to
specify the offset (starting bit number) of the field to be operated on. There are variations of these
instructions that allow these two 5-bit values to be supplied in one of the four 16-bit data registers D2~D5.
15 CCH 8 7 CCL 0
CONDITION CODE REGISTER U SI – – – IPL S X – I N Z V C CCR or CCW
CARRY
TWO’S COMPLEMENT OVERFLOW
ZERO
NEGATIVE
I-INTERRUPT MASK
X-INTERRUPT MASK
STOP MODE ENABLE
INTERRUPT PRIORITY LEVEL [2:0]
STACK INDICATOR
USER/SUPERVISOR STATE
In some architectures, only a few instructions affect condition codes, so that multiple instructions must be
executed in order to load and test a variable. Since most CPU S12Z instructions automatically update
condition codes, it is rarely necessary to execute an extra instruction for this purpose. The challenge in
using the S12Z lies in finding instructions that do not alter the condition codes. The most important of these
instructions are LEA, moves, pushes, pulls, transfers, and exchanges.
It is always a good idea to refer to an instruction set summary to check which condition codes are affected
by a particular instruction. For example, signed branches require a valid V condition code status flag and
some instructions such as LEA do not update V. So signed branches are not useful after an LEA instruction.
The following paragraphs describe normal uses of the condition codes. There are other, more specialized
uses. For instance, the C status bit is used to indicate the value of a bit prior to setting it with a BSET
instruction to allow implementation of semaphores. Always refer to the detailed instruction descriptions
to fully understand how CCR bits are affected.
Unused bits in the CCR are reserved for future use and should be zero for any CCR write operations.
2.2.5.2 IPL[2:0]
The IPL bits allow the nesting of interrupts, blocking interrupts of a lower priority. The current IPL is
automatically pushed to the stack by the standard interrupt stacking procedure. The new IPL is copied to
the CCR from the Priority Level of the highest priority active interrupt request channel. The copying takes
place when the interrupt vector is fetched. The IPL bits are restored from the exception stack frame by
executing the RTI instruction.
Normally, a return-from-interrupt (RTI) instruction at the end of the interrupt service routine restores
register values that were present before the interrupt occurred. Since the CCR is stacked before the X bit
is set, the RTI normally clears the X bit, and thus re-enables non-maskable interrupts. While it is possible
to manipulate the stacked value of X so that X is set after an RTI, there is no software method to set X (and
disable XIRQ) once X has been cleared.
The C status bit is used to indicate the value of a bit prior to setting it with a BSET instruction to allow
implementation of semaphores.
the high half (CCH), or the whole 16-bit CCR (CCW). CPU registers are hard-wired in the CPU and are
not part of the 16-megabyte memory map.
• [EXT3] — 24-bit Address Indirect submode of general OPR addressing. This allows a 24-bit
pointer to an operand to be located anywhere in the 16-megabyte memory space.
In the detailed descriptions of the addressing modes below, 16 addressing mode variations are identified
with an asterisk* to indicate that these addressing modes are specified in the general operand (OPR)
addressing mode postbyte (xb). All instruction opcodes that support OPR addressing have access to these
same 16 addressing mode variations.
EXT1 uses 6 bits in the xb postbyte plus one extension byte to specify the 14-bit extended address. EXT2
uses 2 bits in the xb postbyte plus 2 extension bytes to specify the 18-bit extended address. EXT3 and
EXT24 use 3 bytes to specify a 24-bit address, but EXT3 is a sub-mode of general OPR addressing so it
requires the xb postbyte in addition to the 24-bit address. EXT24 is more efficient (one less byte of object
code) than EXT3 but only load, store, JMP, and JSR instructions offer EXT24 addressing mode because
they are the most frequently used instructions that need to access operands anywhere in the 16-megabyte
address space.
The CPU would first read the 16-bit memory value pointed to by index register X, then increment X (by 2
because the operand that was read was two bytes), then store the value at the address that is formed by
adding D2 to index register X (the new incremented value in X, not the value X had when the instruction
started).
The CPU accesses memory information by the 24-bit address of the most significant byte of an operand
without regard to alignment and a memory controller takes care of reading or writing the appropriate
information. If necessary the memory controller may access misaligned operands in multiple bus cycles.
Like earlier HC11 and HC12 CPUs, the S12Z CPU makes no distinction between program memory and
data memory. There is a single linearly addressed 16-megabyte address space and there are no separate
instructions to access operands differently in program space than in RAM memory spaces. However, the
linear S12Z CPU accesses program information and data information through separate memory busses and
controllers. If the program is in a different memory than the data, it is possible for the CPU to access data
operands at the same time as program code.
instruction. R15 relative address mode allows a branch range of –16,384 to +16,383 from the address of
the first byte of object code for the current instruction.
Reset
sequence
no Breakpoint yes
pending?
no Interrupt yes
pending?
select
Decode Instruction SWI vector
Advance PC
no Sequence yes
complete?
Minimum amount of
PC[1:0] bus-cycles required
after Change-of-Flow
0 1
1 2
2 2
3 2
NOTE
The numbers in Table 4-1 only represent the minimum amount of
bus-cycles required to fetch 4 bytes of new program-code after a
change-of-flow event.
4.2.3.1 Exceptions
Exceptions are events that require processing outside the normal flow of instruction execution. S12Z CPU
Exceptions include six types of exceptions:
• Reset
• Unimplemented opcode traps
• Software interrupt instructions
• Machine exception
• X-bit interrupts
• I-bit interrupts
S12Z CPU exception handling is designed to minimize the effect of queue operation on context switching.
Thus, an exception vector fetch is the first part of exception processing, and fetches to refill the queue from
the address pointed to by the vector are done in parallel with the stacking operations that preserve context,
so that program access time does not delay the switch. Refer to Chapter 7, “Exceptions” for detailed
information.
4.2.3.2 Subroutines
The S12Z CPU can branch to (BSR) or jump to (JSR) subroutines.
BSR uses relative addressing mode to generate the effective address of the subroutine, while JSR can use
various other addressing modes. Both instructions calculate a return address, stack the address, then
perform a queue-flush operation to refill the instruction queue.
Subroutines are terminated with a return-from-subroutine (RTS) instruction. RTS unstacks the return
address, then performs a queue-reset operation to refill the instruction queue.
4.2.4 Branches
Branch instructions cause execution flow to change when specific pre-conditions exist. The S12Z CPU
instruction set includes:
• Conditional branches
• Bit-condition branches
Types and conditions of branch instructions are described in Section 5.5.1, “Branch Instructions”. All
branch instructions affect the queue similarly, but there are differences in overall cycle counts between the
various types. Loop primitive instructions are a special type of branch instruction used to implement
counter-based loops.
Branch instructions have two execution cases:
4.2.5 Jumps
Jump (JMP) is the simplest change of flow instruction. JMP performs a queue-reset operation to refill the
instruction queue with program information from the new address.
Load
PUL oprregs1 Pull specified CPU registers from Stack (M(SP)~M(SP+n-1)) ⇒ regs; (SP) + n ⇒ SP
PUL oprregs2 mask 1 - CCH, CCL, D0, D1, D2, D3 (D3 in LSB)
PUL ALL mask 2 - D4, D5, D6, D7, X, Y (Y in LSB)
PUL ALL16b pulls all registers in the same order as RTI
LEA D6,oprmemreg Load Effective Address into 32-bit D6 or D7 00:Effective Address ⇒ D6, or
LEA D7,oprmemreg 00:Effective Address ⇒ D7
LEA S,oprmemreg Load Effective Address into 24-bit X, Y, or SP Effective Address ⇒ SP, or
LEA X,oprmemreg Effective Address ⇒ X, or
LEA Y,oprmemreg Effective Address ⇒ Y
Store
PSH oprregs1 Push specified CPU registers onto Stack (SP) – n ⇒ SP; (regs) ⇒ M(SP)~M(SP+n-1)
PSH oprregs2 mask 1 - CCH, CCL, D0, D1, D2, D3 (D3 in LSB)
PSH ALL mask 2 - D4, D5, D6, D7, X, Y (Y in LSB)
PSH ALL16b pushes registers in the same order as SWI
BCLR Di,#opr5i Clear Bit n in Memory or in Di (M) & ~bitn ⇒ M or (Di) & ~bitn ⇒ Di
BCLR.bwl oprmemreg,#opr5i C equal the original value of bitn in M or Di
BCLR.bwl oprmemreg,Dn (semaphore)
For certain control and status register locations, reading a control register may be part of a flag clearing
sequence which can change the state of a status flag or modify a FIFO pointer. These registers are clearly
described in the data sheet for a specific MCU. For normal flash or RAM memory, reading a location does
not change the contents of that location.
Addition
Increment
LEA S,(#opr8i,S) Add sign-extended 8-bit Immediate to X, Y, or SP (SP) + sign-extend (M) ⇒ SP, or
LEA X,(#opr8i,X) no change to CCR bits (X) + sign-extend (M) ⇒ X, or
LEA Y,(#opr8i,Y) (Y) + sign-extend (M) ⇒ Y
Subtraction
Decrement
Compare
Absolute Value
5.4.2.1 Add
8-, 16-, and 32-bit addition of signed or unsigned values can be performed between registers or between a
register and memory. Instructions that add the carry bit in the condition code register (CCR) facilitate
multiple precision computation.
5.4.2.4 Subtract
8-, 16-, and 32-bit subtraction of signed or unsigned values can be performed between registers or between
a register and memory. Instructions that subtract the carry bit in the CCR facilitate multiple precision
computation.
24-bit index registers X and Y can be subtracted with the result going to 32-bit data register D6. In this
case, the values in X and Y are treated as unsigned addresses and the result is treated as a signed long
integer.
5.4.2.5 Compare
Compare instructions perform a subtraction between a pair of registers or between a register and memory.
The result is not stored, but condition codes are affected by the operation. These instructions are generally
used to establish conditions for branch instructions. In this architecture, most instructions update condition
code bits automatically, so it is often unnecessary to include separate test or compare instructions in
application programs.
5.4.2.6 Negate
Negate operations replace the value with its twos complement. This is equivalent to multiplying by –1. It
inverts the sign of a twos complement signed value. There is a separate COM instruction which performs
a Boolean bit-by-bit inversion which is described in Section 5.4.5.5, “Invert (bit-by-bit Ones
Complement)”.
Fractional Multiplication
Saturate
CLB cpureg,cpureg Count leading sign-bits of (r1) ⇒ (r2) count leading sign-bits of (r1) ⇒ (r2)
D0~D7
1
The definition of signed fractional data-formats s.7, s.15, s.23 and s.31 is the same as the definition used in the ISO-C draft
Technical Report document TR 18037.
2 The definition of unsigned fractional data-formats .8, .16, .24 and .32 is the same as the definition used in the ISO-C draft
5.4.4.2 Saturate
Saturate the content of the operand register using the information stored in the overflow (V-) and negative
(N-)flags by a previous instruction. This works for most instructions which are capable of producing a
signed result in two’s complement format (e.g. ADD, SUB, NEG, ABS, ...).
Logical AND
ANDCC #opr8i Bitwise AND CCL with immediate byte in Memory (CCL) & (M) ⇒ CCL
(S, X, and I can only be changed in supervisor
state)
BIT Di,#oprimmsz Bitwise AND Di with Memory (Di) & (M); Sets CCR bits; Operands unchanged
BIT Di,oprmemreg
Logical OR
ORCC #opr8i Bitwise OR CCL with Immediate Mask (CCL) | (M) ⇒ CCL
(S, X, and I can only be changed in supervisor
state)
Logical Exclusive-OR
COM.bwl oprmemreg 1’s Complement Memory Location or Di ~(M) ⇒ M equivalent to $F..F – (M) ⇒ M
~(Di) ⇒ Di equivalent to $F..F – (Di) ⇒ Di
5.4.5.2 BIT (logical AND to set CCR but operand is left unchanged)
The BIT instruction has the same source forms as the AND instruction and it performs a bit-by-bit AND
between the input operands and affects the condition code bits in the same way as the AND operation.
However, rather than replacing the source CPU data register with the result of the AND operation, the input
operands are left unchanged.
To use the BIT instructions, use the second input operand to specify a mask with 1’s in all bit positions that
are to be checked. If any of these bit positions are 1 in the source CPU data register, the result of the AND
will be non-zero (the Z condition code bit will be cleared). In some programming cases, this can be more
efficient than using multiple BRCLR instructions to test several bits and it has the advantage of testing
several bits at exactly the same time.
5.4.5.3 Logical OR
The OR instructions perform a bit-by-bit OR operation between a CPU data register and either an
immediate operand or a memory operand that uses OPR addressing. The result replaces the contents of the
original CPU data register. Because OPR addressing can be used to specify another CPU data register, this
instruction can perform the Boolean OR between two CPU data registers. If the OPR addressing mode is
used to specify a memory operand, it is assumed to be the same width as the source/destination register.
Arithmetic Shifts
Logical Shifts
BCLR Di,#opr5i Clear Bit n in Memory or in Di (M) & ~bitn ⇒ M or (Di) & ~bitn ⇒ Di
BCLR.bwl oprmemreg,#opr5i C equal the original value of bitn in M or Di
BCLR.bwl oprmemreg,Dn (semaphore)
ANDCC #opr8i Bitwise AND CCL with immediate byte in Memory (CCL) & (M) ⇒ CCL
(Clear CCR bits that are 0 in the immediate mask)
(S, X, and I can only be changed in supervisor
state)
ORCC #opr8i Bitwise OR CCL with Immediate Mask (CCL) | (M) ⇒ CCL
(Set CCR bits that are 1 in the immediate mask)
(S, X, and I can only be changed in supervisor
state)
BFEXT Dd,Ds,Dp Bit Field Extract Extract bit field with width w and offset o from Ds or
BFEXT Dd,Ds,#width:offset a memory operand, and store it into the low order
BFEXT.bwpl Dd,oprmemreg,Dp bits of Dd or memory (filling unused bits with 0).
BFEXT.bwpl oprmemreg,Ds,Dp The source operand or destination operand must
BFEXT.bwpl Dd,oprmemreg,#width:offset be a register (memory to memory not allowed)
BFEXT.bwpl oprmemreg,Ds,#width:offset
BFINS Dd,Ds,Dp Bit Field Insert Insert bit field with width w from the low order bits of
BFINS Dd,Ds,#width:offset Ds or a memory operand into Dd or a memory
BFINS.bwpl Dd,oprmemreg,Dp operand beginning at offset bit number o. The
BFINS.bwpl oprmemreg,Ds,Dp source operand or destination operand must be a
BFINS.bwpl Dd,oprmemreg,#width:offset register (memory to memory not allowed)
BFINS.bwpl oprmemreg,Ds,#width:offset
The load, pull, and RTI instructions are used to read information from memory into CPU registers. In
addition, the pull and RTI instructions automatically update the stack pointer as information is read from
the stack. Store, push, SWI, and WAI are used to write information from CPU registers into memory. In
addition, push, SWI, and WAI automatically update the stack pointer as information is written to the stack.
Add, subtract, and compare are a little different for the index registers and stack pointer. These address
calculations use the load effective address instructions for most arithmetic calculations. 32-bit CPU
registers D6 and D7 can also be used for address registers so there are LEA instructions for D6, D7, X, Y,
and SP. Many or the sub-modes in the OPR addressing mode perform address calculations such as adding
small constants to an index register or adding a CPU data register to an index register. LEA provides a way
to save the results of these address calculations in an index or pointer register.
There are subtract instructions to subtract X–Y or Y–X and save the difference in the 32-bit D6 register.
Finally there are instructions to compare X, Y, or SP to a 24-bit immediate value, a memory operand using
OPR addressing, or for comparing X to Y.
Table 5-9 shows a summary of the index and pointer manipulation instructions.
Load
PUL oprregs1 Pull specified CPU registers from Stack (M(SP)~M(SP+n-1)) ⇒ regs; (SP) + n ⇒ SP
PUL oprregs2 mask 1 - CCH, CCL, D0, D1, D2, D3 (D3 in LSB)
PUL ALL mask 2 - D4, D5, D6, D7, X, Y (Y in LSB)
PUL ALL16b pulls all registers in the same order as RTI
Store
PSH oprregs1 Push specified CPU registers onto Stack (SP) – n ⇒ SP; (regs) ⇒ M(SP)~M(SP+n-1)
PSH oprregs2 mask 1 - CCH, CCL, D0, D1, D2, D3 (D3 in LSB)
PSH ALL mask 2 - D4, D5, D6, D7, X, Y (Y in LSB)
PSH ALL16b pushes registers in the same order as SWI
LEA D6,oprmemreg Load Effective Address into 32-bit D6 or D7 00:Effective Address ⇒ D6, or
LEA D7,oprmemreg 00:Effective Address ⇒ D7
LEA S,oprmemreg Load Effective Address into 24-bit X, Y, or SP Effective Address ⇒ SP, or
LEA X,oprmemreg Effective Address ⇒ X, or
LEA Y,oprmemreg Effective Address ⇒ Y
LEA S,(#opr8i,S) Add sign-extended 8-bit Immediate to X, Y, or SP (SP) + sign-extend (M) ⇒ SP, or
LEA X,(#opr8i,X) no change to CCR bits (X) + sign-extend (M) ⇒ X, or
LEA Y,(#opr8i,Y) (Y) + sign-extend (M) ⇒ Y
5.4.9.1 Load
Load instructions allow the 24-bit index registers or stack pointer to be loaded with a 24-bit immediate
value or a 24-bit memory operand. Usually, other instructions use the 24-bit extended sub-mode of OPR
addressing to handle loads from anywhere in memory, but for X, Y, and SP, there are more efficient 4-byte
instructions to access global memory space.
There are even more efficient instructions to load X or Y with an 18-bit immediate value. These
instructions work with other addressing modes such as 18-bit extended and 18-bit offset indexed modes to
work more efficiently with control registers and RAM variables in the first 256K of the memory map.
5.4.9.3 Store
Store instructions allow the 24-bit index registers or stack pointer to be stored in memory using OPR
addressing mode. Usually, other instructions use the 24-bit extended sub-mode of OPR addressing to
handle stores to anywhere in memory, but for X and Y there are more efficient 4-byte instructions to access
global memory space.
memory operand. The second type adds an 8-bit immediate signed value to X, Y, or SP so it provides a
very efficient way to adjust an index register or SP by a value between –128 and +127.
There are LEA instructions for D6 and D7 because these 32-bit CPU registers can be used for extra index
registers in some application programs.
The quick immediate sub mode and the register as memory sub mode of the OPR addressing mode are not
appropriate for use with LEA because these two sub modes do not access any memory operands and
therefore do not compute an effective address. For all other OPR sub modes, an effective address is
internally computed by the CPU. In the case of a load data register instruction, this effective address would
be used to read data from memory, and in the case of a load effective address instruction (LEA), this
effective address is saved in the selected index or pointer register.
based on a single CCR bit, signed branches, and unsigned branches. Bit-value branches use the state of a
selected bit in a selected CPU data register or memory location to decide whether or not to branch. The
third kind of branches are the loop control branches which decrement or test a counter in a CPU register
or memory location and then branch on the conditions Not Equal, Equal, Plus, Minus, Greater Than, or
Less Than or Equal.
Table 5-10 shows a summary of the conditional branch instructions.
Unconditional Branches
Simple Branches
Signed Branches
Unsigned Branches
BRCLR Di,#opr5i,oprdest Test Bit n in Memory or in Di and branch if clear Branch if (M) & bitn = 0 or if (Di) & bitn = 0
BRCLR.bwl oprmemreg,#opr5i,oprdest Branch offset is 7 bits or 15 bits
BRCLR.bwl oprmemreg,Dn,oprdest
BRSET Di,#opr5i,oprdest Test Bit n in Memory or in Di and branch if set Branch if (M) & bitn ≠ 0 or if (Di) & bitn ≠ 0
BRSET.bwl oprmemreg,#opr5i,oprdest Branch offset is 7 bits or 15 bits
BRSET.bwl oprmemreg,Dn,oprdest
• Unsigned branches are taken when comparison or test of unsigned quantities results in a specific
combination of condition code register bits.
• Signed branches are taken when comparison or test of signed quantities results in a specific
combination of condition code register bits.
If the branch conditions are true, execution continues at the specified destination address (branch taken),
otherwise execution continues with the next instruction after the branch instruction (branch not taken). The
branch is accomplished by conditionally adding the signed offset to the PC address of the branch
instruction. The programmer specifies the destination as an address or program label and the assembler or
compiler translates that into the appropriate signed offset value.
5.5.1.3 Loop Control Branches (decrement and branch or test and branch)
Loop control branches use a loop count or loop control variable which is decremented or tested before
determining whether the branch should be taken or not. The loop count or control variable may be one of
the eight CPU data registers, X, Y, or a byte, word, pointer, or long-word variable in memory.
When the loop count is decremented by one for each pass through the loop, the decrement is included as
part of the decrement-and-branch instruction. If the loop control variable will be adjusted by some amount
other than –1 for each pass through the loop, the adjustment must be done with separate instructions in the
loop and the loop control branch will test the control variable and then branch or not branch based on the
value (test-and-branch).
Decrement and branch and Test and branch each have the same six choices for the branch condition. The
branch conditions are Not Equal-DBNE/TBNE, Equal-DBEQ/TBEQ, Plus-DBPL/TBPL,
Minus-DBMI/TBMI, Greater Than-DBGT/TBGT, and Less Than or Equal-DBLE/TBLE. If the loop test
condition is true, execution continues at the specified destination address (branch taken), otherwise
execution continues with the next instruction after the branch instruction (branch not taken). The branch
is accomplished by conditionally adding the signed offset to the PC address of the branch instruction. The
programmer specifies the destination as an address or program label and the assembler or compiler
translates that into the appropriate signed offset value.
5.5.2 Jump
Jump (JMP) instructions cause immediate changes in sequence. The JMP instruction loads the PC with an
address in the 16 megabyte memory map, and program execution continues at that address. The address
can be provided as an absolute 24-bit address or determined by the general OPR address modes. The OPR
sub modes include indexed, indexed indirect, and short extended addressing mode options. Because the
quick immediate and register-as-memory sub modes of OPR addressing do not generate a memory
address, these two sub modes are not appropriate for a jump instruction. The 24-bit extended version of
the jump instruction is just as efficient as the 18-bit extended OPR sub mode and more efficient than the
24-bit extended sub mode of OPR addressing so the absolute 24-bit extended version of the instruction is
preferred compared to those OPR sub modes.
Interrupt Stacking
TRAP #trapnum Unimplemented (pg2) Opcode Trap Interrupt (SP) – 3 ⇒ SP; RTNH:RTNM:RTNL ⇒ M(SP)~M(SP+2);
(SP) – 3 ⇒ SP; YH:YM:YL ⇒ M(SP)~M(SP+2);
(SP) – 3 ⇒ SP; XH:XM:XL ⇒ M(SP)~M(SP+2);
(SP) – 4 ⇒ SP; D7H:D7MH:D7ML:D7L ⇒
M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D6H:D6MH:D6ML:D6L ⇒
M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D4H:D4L, D5H:D5L ⇒ M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D2H:D2L, D3H:D3L ⇒ M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; CCH, CCL, D0, D1 ⇒ M(SP)~M(SP+3);
0 ⇒ U; 1 ⇒ I; (TRAP Vector) ⇒ PC
SPARE Unimplemented pg1 Opcode Trap Interrupt (SP) – 3 ⇒ SP; RTNH:RTNM:RTNL ⇒ M(SP)~M(SP+2);
(SP) – 3 ⇒ SP; YH:YM:YL ⇒ M(SP)~M(SP+2);
(SP) – 3 ⇒ SP; XH:XM:XL ⇒ M(SP)~M(SP+2);
(SP) – 4 ⇒ SP; D7H:D7MH:D7ML:D7L ⇒
M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D6H:D6MH:D6ML:D6L ⇒
M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D4H:D4L, D5H:D5L ⇒ M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D2H:D2L, D3H:D3L ⇒ M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; CCH, CCL, D0, D1 ⇒ M(SP)~M(SP+3);
0 ⇒ U; 1 ⇒ I; (pg1 TRAP Vector) ⇒ PC
Interrupt Return
The SYS instruction is similar to SWI except that is located on page 2 of the opcode map (requires 2 bytes
of object code instead of 1) and it uses a separate vector from SWI. SYS provides for a way to change from
user state to supervisor state (change U from 1 to 0). This is not usually possible using other instructions
in a user state program because all instructions except SYS/SWI and TRAP/SPARE are prevented from
changing U from 1 to 0. SWI could be used to change from user to supervisor state, but SWI is sometimes
used by debug programs so a separate SYS instruction was included.
A TRAP exception is caused by any unimplemented opcode on page 2 of the opcode map. TRAP causes
an exception using the separate TRAP vector. The TRAP ISR can determine which unimplemented opcode
caused the TRAP exception by checking the return address on the stack and then reading the instruction
opcode from memory at the two bytes before the return address.
SPARE is similar to TRAP except it is caused by execution of an unimplemented (spare) opcode on page
1 of the opcode map and it uses a separate vector. It is important to distinguish between page 1 and page
2 unimplemented opcodes so that the ISR knows where to look in memory for the unimplemented opcode
that was responsible for the exception.
WAI causes the CPU to save the CPU register context on the stack as if an exception had occurred, and
then suspend processing until an exception does occur. This can be useful to synchronize program
execution to an event with less uncertainty. The event could be an external signal or a system event that is
effectively independent of the running program such as a timer event or a received character. WAI reduces
response time to the interrupt by stacking the registers on entry to wait so that this doesn’t need to be done
when the interrupt arrives. WAI also eliminates the uncertainty of waiting for the current instruction to
complete before responding to the interrupt.
Wait instructions can only be executed when the CPU is in supervisor state. In user state WAI acts similar
to a NOP instruction and execution continues to the next instruction. This helps prevent accidental entry
into standby modes.
STOP STOP All Clocks and enter a low power state (SP) – 3 ⇒ SP; RTNH:RTNM:RTNL ⇒ M(SP)~M(SP+2);
If S control bit = 1, the STOP instruction is disabled (SP) – 3 ⇒ SP; YH:YM:YL ⇒ M(SP)~M(SP+2);
and acts like a NOP. (SP) – 3 ⇒ SP; XH:XM:XL ⇒ M(SP)~M(SP+2);
(SP) – 4 ⇒ SP; D7H:D7MH:D7ML:D7L ⇒
M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D6H:D6MH:D6ML:D6L ⇒
M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D4H:D4L, D5H:D5L ⇒ M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; D2H:D2L, D3H:D3L ⇒ M(SP)~M(SP+3);
(SP) – 4 ⇒ SP; CCH, CCL, D0, D1 ⇒ M(SP)~M(SP+3);
STOP All Clocks
No Operation (NOP)
NOP No operation –
BGND Enter active Background mode enter Background if BDM enabled; else continue
6.2 Glossary
This subsection contains an entry for each assembly mnemonic, in alphabetic order.
Description
Replace the content of Di with its absolute value. Operation size depends on (matches) the size of Di.
If the content of Di is negative, it is replaced with its two’s complement value. If the content of Di is
either positive, zero or a two’s complement overflow occurred, Di remains unchanged. Two’s
complement overflow occurs only when the original value has its MSB set and all other bits clear (the
most negative value possible for the size, that is either 0x80, 0x8000, or 0x80000000), two’s
complement overflow occurs because it is not possible to express a positive two’s complement value
with the same magnitude.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ –
N: Set if a two’s complement overflow resulted from the operation. Cleared otherwise.
Z: Set if the result is zero. Cleared otherwise.
V: Set if a two’s complement overflow resulted from the operation. Cleared otherwise.
1B 4n ABS Di
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di used for the source and
destination for the operation (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
Description
Add with carry to register Di and store the result to Di. When the operand is an immediate value, it has
the same size as register Di. In the case of the general OPR addressing operand, oprmemreg can be a
sign-extended immediate value (–1, 1, 2, 3..14, 15), a data register, a memory operand the same size
as Di at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with indexed or
indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 1 1 0 0 SD REGISTER Di 6n
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size of the register Di.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Add without carry to register Di and store the result to Di. When the operand is an immediate value, it
has the same size as register Di. In the case of the general OPR addressing operand, oprmemreg can be
a sign-extended immediate value (–1, 1, 2, 3..14, 15), a data register, a memory operand the same size
as Di at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with indexed or
indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
OPR/1/2/3
7 6 5 4 3 2 1 0
0 1 1 0 0 SD REGISTER Di 6n
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size of the register Di.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Bitwise AND register Di with a memory operand and store the result to Di. When the operand is an
immediate value, it has the same size as register Di. In the case of the general OPR addressing operand,
oprmemreg can be a sign-extended immediate value (–1, 1, 2, 3..14, 15), a data register, a memory
operand the same size as Di at a 14- 18- or 24-bit extended address, or a memory operand that is
addressed with indexed or indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 –
OPR/1/2/3
7 6 5 4 3 2 1 0
0 1 1 0 1 SD REGISTER Di 6q
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size of the register Di.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Performs a bitwise AND operation between the 8-bit immediate memory operand and the content of
CCL (the low order 8 bits of the CCR). The result is stored in CCL.
When the CPU is in user state, this instruction is restricted to changing the condition codes (the flags
N, Z, V, C) and cannot change the settings in the S, X, or I bits.
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − − − ⇓ ⇓ − ⇓ ⇓ ⇓ ⇓ ⇓ supervisor state
− − − − − − − − − − − − ⇓ ⇓ ⇓ ⇓ user state
Condition code bits are cleared if the corresponding bit in the immediate mask is 0. Condition code
bits remain 0 if they were 0 before the operation.
CE i1 ANDCC #opr8i
0
C MSB LSB
Description
Arithmetically shifts an operand n bit-positions to the left. The result is saved in a CPU register, or in
the case of a 2-operand shift the result is saved in the same memory location or register used for the
source. The operand to be shifted may be one of the eight data registers or an 8-, 16-, 24-, or 32-bit
memory operand. In the case of the general OPR addressing operand, oprmemreg can be a data register,
a memory operand at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with
indexed or indirect addressing mode. The number of bit positions to shift the operand is supplied in a
1-bit or 5-bit immediate operand or in the low order 5 bits of a register or byte-sized memory operand.
When the number of bit positions to shift is provided in a 5-bit immediate value, the least significant
bit is encoded in the sb postbyte and the higher four bits are encoded as a short-immediate value in the
xb postbyte. If the destination register is wider than the source operand, the source operand is
sign-extended to the width of the destination register before shifting. If the destination register is
narrower than the source operand, the operand is shifted and then truncated to the width of the
destination register. Zero is shifted into the LSB and the MSB is shifted out through the carry bit (C).
The N-flag is set according to the inverted MSB of the operand. This can be used by the SAT instruction
(together with the V-flag) to saturate the result.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
C: Set if the last bit shifted out of the MSB of the operand was set before the shift, cleared
otherwise. If the shift count is 0, C is not changed.
1n sb xb ASL Dd,Ds,Dn
1n sb ASL Dd,Ds,#opr1i
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 0 DESTINATION REGISTER Dd 1n
A/L=1 L/R=1 0 0 x or N[0] SOURCE REGISTER Ds sb
OPR POSTBYTE (specifes number of shifts in byte-sized memory operand) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1n sb xb ASL Dd,Ds,Dn ;see REG-REG
1n sb xb ASL Dd,Ds,#opr5i ;see REG-IMM n=xb[3:0]:sb[3]
1n sb xb ASL Dd,Ds,(opru4,xys)
1n sb xb ASL Dd,Ds,{(+-xy)|(xy+-)|(-s)|(s+)}
1n sb xb ASL Dd,Ds,(Di,xys)
1n sb xb ASL Dd,Ds,[Di,xy]
1n sb xb x1 ASL Dd,Ds,(oprs9,xysp)
1n sb xb x1 ASL Dd,Ds,[oprs9,xysp]
1n sb xb x1 ASL Dd,Ds,opru14
1n sb xb x2 x1 ASL Dd,Ds,(opru18,Di)
1n sb xb x2 x1 ASL Dd,Ds,opru18
1n sb xb x3 x2 x1 ASL Dd,Ds,(opr24,xysp)
1n sb xb x3 x2 x1 ASL Dd,Ds,[opr24,xysp]
1n sb xb x3 x2 x1 ASL Dd,Ds,(opru24,Di)
1n sb xb x3 x2 x1 ASL Dd,Ds,opr24
1n sb xb x3 x2 x1 ASL Dd,Ds,[opr24]
1n sb xb ASL.bwpl #oprsxe4i,#opr1i
1n sb xb ASL.bwpl Ds,#opr1i ;see more efficient REG-IMM version
1n sb xb ASL.bwpl (opru4,xys),#opr1i
1n sb xb ASL.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr1i
1n sb xb ASL.bwpl (Di,xys),#opr1i
1n sb xb ASL.bwpl [Di,xy],#opr1i
1n sb xb x1 ASL.bwpl (oprs9,xysp),#opr1i
1n sb xb x1 ASL.bwpl [oprs9,xysp],#opr1i
1n sb xb x1 ASL.bwpl opru14,#opr1i
1n sb xb x2 x1 ASL.bwpl (opru18,Di),#opr1i
1n sb xb x2 x1 ASL.bwpl opru18,#opr1i
1n sb xb x3 x2 x1 ASL.bwpl (opr24,xysp),#opr1i
1n sb xb x3 x2 x1 ASL.bwpl [opr24,xysp],#opr1i
1n sb xb x3 x2 x1 ASL.bwpl (opru24,Di),#opr1i
1n sb xb x3 x2 x1 ASL.bwpl opr24,#opr1i
1n sb xb x3 x2 x1 ASL.bwpl [opr24],#opr1i
1n sb xb xb ASL.bwpl #oprsxe4i,#opr5i
1n sb xb xb ASL.bwpl Di,#opr5i ;see more efficient REG-IMM version
1n sb xb xb ASL.bwpl (opru4,xys),#opr5i
1n sb xb xb ASL.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr5i
1n sb xb xb ASL.bwpl (Di,xys),#opr5i
1n sb xb xb ASL.bwpl [Di,xy],#opr5i
1n sb xb x1 xb ASL.bwpl (oprs9,xysp),#opr5i
1n sb xb x1 xb ASL.bwpl [oprs9,xysp],#opr5i
1n sb xb x1 xb ASL.bwpl opru14,#opr5i
1n sb xb x2 x1 xb ASL.bwpl (opru18,Di),#opr5i
1n sb xb x2 x1 xb ASL.bwpl opru18,#opr5i
1n sb xb x3 x2 x1 xb ASL.bwpl (opr24,xysp),#opr5i
1n sb xb x3 x2 x1 xb ASL.bwpl [opr24,xysp],#opr5i
1n sb xb x3 x2 x1 xb ASL.bwpl (opru24,Di),#opr5i
1n sb xb x3 x2 x1 xb ASL.bwpl opr24,#opr5i
1n sb xb x3 x2 x1 xb ASL.bwpl [opr24],#opr5i
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 0 DESTINATION REGISTER Dd 1n
A/L=1 L/R=1 1 1 x or N[0] 0 SIZE (.B, .W, .P, .L) sb
OPR POSTBYTE (for source operand) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for number of shifts - byte sized memory operands) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
The .bwpl suffix on the instruction mnemonic refers to the size (byte, word, pointer, or long) of the
source operand. The parameter operand is N[4:1]:N[0], the low five bits in a register Dn, or the low
five bits in a byte sized memory operand.
Instruction Fields
A/L - This bit selects arithmetic (1) or logical (0) shifts.
L/R - This bit selects the shift direction, left (1) or right (0).
DESTINATION REGISTER Dd - This field specifies data register Dd (0:0:0=D2, 0:0:1=D3,
0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) where the result of the shift is
stored.
SOURCE REGISTER Ds - This field specifies data register Ds (0:0:0=D2, 0:0:1=D3, 0:1:0=D4,
0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is the source operand to be shifted.
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the number of positions (0–31) to shift the operand. Only the low-order 5 bits of the parameter
register are used.
SD REGISTER Di - This field specifies the number of the data register Di which is used as the source
operand and as the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) for a 2-operand shift operation.
N[0] - This field contains the least significant bit of the 5-bit immediate operand n=0–31, or in the case
of the efficient shifts, this bit selects shifting by 1 (N[0]=0) or shifting by 2 (N[0]=1).
N[4:1] - This field contains the upper four bits of the 5-bit immediate operand n=0–31.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the source operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location. In
the case of the parameter operand, short immediate mode is used to specify the upper four bits of the
5-bit immediate value that specifies the number of bit positions to shift the source operand.
MSB LSB C
Description
Arithmetically shifts an operand n bit-positions to the right. The result is saved in a CPU register, or in
the case of a 2-operand memory shift the result is saved in the same memory location used for the
source. The operand to be shifted may be one of the eight data registers or an 8-, 16-, 24-, or 32-bit
memory operand. In the case of the general OPR addressing operand, oprmemreg can be a data register,
a memory operand at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with
indexed or indirect addressing mode. The number of bit positions to shift the operand is supplied in a
1-bit or 5-bit immediate operand or in the low order 5 bits of a register or byte-sized memory operand.
When the number of bit positions to shift is provided in a 5-bit immediate value, the least significant
bit is encoded in the sb postbyte and the higher four bits are encoded as a short-immediate value in the
xb postbyte. If the destination register is wider than the source operand, the source operand is
sign-extended to the width of the destination register before shifting. If the destination register is
narrower than the source operand, the operand is shifted and then truncated to the width of the
destination register. A copy of the original MSB sign value is shifted into the MSB and the LSB is
shifted out through the carry bit (C).
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
1n sb xb ASR Dd,Ds,Dn
1n sb ASR Dd,Ds,#opr1i
1n sb xb ASR.bwpl #oprsxe4i,#opr1i
1n sb xb ASR.bwpl Ds,#opr1i ;see more efficient REG-IMM version
1n sb xb ASR.bwpl (opru4,xys),#opr1i
1n sb xb ASR.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr1i
1n sb xb ASR.bwpl (Di,xys),#opr1i
1n sb xb ASR.bwpl [Di,xy],#opr1i
1n sb xb x1 ASR.bwpl (oprs9,xysp),#opr1i
1n sb xb x1 ASR.bwpl [oprs9,xysp],#opr1i
1n sb xb x1 ASR.bwpl opru14,#opr1i
1n sb xb x2 x1 ASR.bwpl (opru18,Di),#opr1i
1n sb xb x2 x1 ASR.bwpl opru18,#opr1i
1n sb xb x3 x2 x1 ASR.bwpl (opr24,xysp),#opr1i
1n sb xb x3 x2 x1 ASR.bwpl [opr24,xysp],#opr1i
1n sb xb x3 x2 x1 ASR.bwpl (opru24,Di),#opr1i
1n sb xb x3 x2 x1 ASR.bwpl opr24,#opr1i
1n sb xb x3 x2 x1 ASR.bwpl [opr24],#opr1i
1n sb xb xb ASR.bwpl #oprsxe4i,#opr5i
1n sb xb xb ASR.bwpl Di,#opr5i ;see more efficient REG-IMM version
1n sb xb xb ASR.bwpl (opru4,xys),#opr5i
1n sb xb xb ASR.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr5i
1n sb xb xb ASR.bwpl (Di,xys),#opr5i
1n sb xb xb ASR.bwpl [Di,xy],#opr5i
1n sb xb x1 xb ASR.bwpl (oprs9,xysp),#opr5i
1n sb xb x1 xb ASR.bwpl [oprs9,xysp],#opr5i
1n sb xb x1 xb ASR.bwpl opru14,#opr5i
1n sb xb x2 x1 xb ASR.bwpl (opru18,Di),#opr5i
1n sb xb x2 x1 xb ASR.bwpl opru18,#opr5i
1n sb xb x3 x2 x1 xb ASR.bwpl (opr24,xysp),#opr5i
1n sb xb x3 x2 x1 xb ASR.bwpl [opr24,xysp],#opr5i
1n sb xb x3 x2 x1 xb ASR.bwpl (opru24,Di),#opr5i
1n sb xb x3 x2 x1 xb ASR.bwpl opr24,#opr5i
1n sb xb x3 x2 x1 xb ASR.bwpl [opr24],#opr5i
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 0 DESTINATION REGISTER Dd 1n
A/L=1 L/R=0 1 1 N[0] 0 SIZE (.B, .W, .P, .L) sb
OPR POSTBYTE (for source operand) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for number of shifts - byte sized memory operands) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
The .bwpl suffix on the instruction mnemonic refers to the size (byte, word, pointer, or long) of the
source operand. The parameter operand is always the low five bits in a byte sized memory operand.
1n sb xb ASR.bwpl #oprsxe4i,#opr1i
1n sb xb ASR.bwpl Ds,#opr1i ;see more efficient REG-IMM version
1n sb xb ASR.bwpl (opru4,xys),#opr1i
1n sb xb ASR.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr1i
1n sb xb ASR.bwpl (Di,xys),#opr1i
1n sb xb ASR.bwpl [Di,xy],#opr1i
1n sb xb x1 ASR.bwpl (oprs9,xysp),#opr1i
1n sb xb x1 ASR.bwpl [oprs9,xysp],#opr1i
1n sb xb x1 ASR.bwpl opru14,#opr1i
1n sb xb x2 x1 ASR.bwpl (opru18,Di),#opr1i
1n sb xb x2 x1 ASR.bwpl opru18,#opr1i
1n sb xb x3 x2 x1 ASR.bwpl (opr24,xysp),#opr1i
1n sb xb x3 x2 x1 ASR.bwpl [opr24,xysp],#opr1i
1n sb xb x3 x2 x1 ASR.bwpl (opru24,Di),#opr1i
1n sb xb x3 x2 x1 ASR.bwpl opr24,#opr1i
1n sb xb x3 x2 x1 ASR.bwpl [opr24],#opr1i
Instruction Fields
A/L - This bit selects arithmetic (1) or logical (0) shifts.
L/R - This bit selects the shift direction, left (1) or right (0).
DESTINATION REGISTER Dd - This field specifies data register Dd (0:0:0=D2, 0:0:1=D3,
0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) where the result of the shift is
stored.
SOURCE REGISTER Ds - This field specifies data register Ds (0:0:0=D2, 0:0:1=D3, 0:1:0=D4,
0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is the source operand to be shifted.
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the number of positions (0–31) to shift the operand. Only the low-order 5 bits of the parameter
register are used.
N[0] - This field contains the least significant bit of the 5-bit immediate operand n=0–31, or in the case
of the efficient shifts, this bit selects shifting by 1 (N[0]=0) or shifting by 2 (N[0]=1).
N[4:1] - This field contains the upper four bits of the 5-bit immediate operand n=0–31.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the source operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location. In
the case of the parameter operand, short immediate mode is used to specify the upper four bits of the
5-bit immediate value that specifies the number of bit positions to shift the source operand.
Description
Tests the C status bit. If C = 0 then program execution continues at location (PC) + REL
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests and copies the original state of the specified bit into the C condition code bit to be used for
semaphores. Then clears the specified bit in Di or a memory operand by performing a bitwise AND
with a mask that has all bits set except the specified bit. The bit to be cleared is specified in a 5-bit
immediate value or in the low order five bits of a data register Dn. In the case of the general OPR
addressing operand, oprmemreg can be a data register, an 8-, 16-, or 32-bit memory operand at a 14-
18- or 24-bit extended address, or a memory operand that is addressed with indexed or indirect
addressing mode. It is not appropriate to specify a short-immediate operand with the OPR addressing
mode because it is not possible to modify (clear a bit in) the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 ∆
EC bm BCLR Di,#opr5i
REG-REG
7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 EC
1 PARAMETER REGISTER Dn 0 0 0 1 bm
1 0 1 1 1 SD REGISTER Di xb
EC bm xb BCLR Di,Dn
OPR/1/2/3-IMM
Byte-sized operand (.B)
7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 EC
1 n[2:0] 0 0 0 0 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR/1/2/3-REG
7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 EC
1 PARAMETER REGISTER Dn SIZE (.B-0:0, .W-0:1, .L-1:1) 0 1 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the bit number of the bit in the operand that is to be cleared. Only the low-order 5 bits of the
parameter register are used.
n[4:0] - This field contains the 5-bit immediate parameter that specifies the bit number of the bit in the
operand that is to be cleared.
SIZE - This field specifies 8-bit byte (0:0), 16-bit word (0:1), or 32-bit long-word (1:1) as the size of
the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Short immediate mode is not appropriate for instructions that store a result to the specified operand.
Description
Tests the C status bit. If C = 1 then program execution continues at location (PC) + REL
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests the Z status bit. If Z = 1 then program execution continues at location (PC) + REL
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Extracts a bit field from the specified source (register Ds or memory location), if necessary zero
extends to the width of the destination, and stores the result to the destination (register Dd or memory
location). The bit field width and offset are specified in the parameter (register Dp or immediate
operand). The field width determines the number of bits in the field (0b00000 is treated as 32). The
field offset specifies the right-most starting bit of the field in Ds.
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − − − − − ∆ ∆ 0 −
1B 0q bb BFEXT Dd,Ds,Dp
REG-REG-IMM
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 DESTINATION REGISTER Dd 0q
0 0 1 SOURCE REGISTER Ds WIDTH[4:3] bb
WIDTH[2:0] OFFSET[4:0] i1
1B 0q bb i1 BFEXT Dd,Ds,#width:offset
REG-OPR/1/2/3-REG
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 DESTINATION REGISTER Dd 0q
0 1 0 0 SIZE (.B, .W, .P, .L) PARAMETER REG Dp bb
OPR POSTBYTE (specifies source) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR/1/2/3-REG-REG
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 SOURCE REGISTER Ds 0q
0 1 0 1 SIZE (.B, .W, .P, .L) PARAMETER REG Dp bb
OPR POSTBYTE (specifes destination) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
REG-OPR/1/2/3-IMM
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 DESTINATION REGISTER Dd 0q
0 1 1 0 SIZE (.B, .W, .P, .L) WIDTH[4:3] bb
WIDTH[2:0] OFFSET[4:0] i1
OPR POSTBYTE (specifies source) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR/1/2/3-REG-IMM
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 SOURCE REGISTER 0q
0 1 1 1 SIZE (.B, .W, .P, .L) WIDTH[4:3] bb
WIDTH[2:0] OFFSET[4:0] I1
OPR POSTBYTE (specifies destination) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 0q bb i1 xb x3 x2 x1 BFEXT.bwpl opr24,Ds,#width:offset
1B 0q bb i1 xb x3 x2 x1 BFEXT.bwpl [opr24],Ds,#width:offset
Instruction Fields
DESTINATION REGISTER Dd - This field specifies the number of the data register Dd used for the
destination (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and
1:1:1=D7).
SOURCE REGISTER Ds - This field specifies the number of the data register Ds used for the source
operand (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
PARAMETER REG Dp - This field specifies the number of the 16-bit data register which contains both
width and offset parameters for the operation (0b00 = D2, 0b01 = D3, 0b10 = D4, and 0b11 = D5). The
width parameter is 5 bits wide and is taken from bits [9:5] of the parameter register; the values 1..31
represent width-values 1..31. The value zero represents a width of 32. The offset parameter is 5 bits
wide and is taken from bits [4:0] of the parameter register; it represents a value range of 0..31.
WIDTH - This field specifies the width of the bit-field to be extracted from the source operand. This
field is 5 bits wide. The values 1..31 represent width-values 1..31. The value zero represents a width of
32.
OFFSET - This field specifies the offset of the low-order bit of the bit-field to be extracted from the
source operand. This field is 5 bits wide. The values 0..31 directly represent the offset values 0..31.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Inserts a bit field of specified width from the low-order bits of a specified source (register Ds or
memory location), into the destination (register Dd or memory location), beginning at the specified
offset. The bit field width and offset are specified in the parameter (register Dp or immediate operand).
The field width determines the number of bits in the field (0b00000 is treated as 32). The field offset
specifies the right-most starting bit where the field will be inserted.
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − − − − − ∆ ∆ 0 −
1B 0q bb BFINS Dd,Ds,Dp
REG-REG-IMM
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 DESTINATION REGISTER Dd 0q
1 0 1 SOURCE REGISTER Ds WIDTH[4:3] bb
WIDTH[2:0] OFFSET[4:0] i1
1B 0q bb i1 BFINS Dd,Ds,#width:offset
REG-OPR/1/2/3-REG
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 DESTINATION REGISTER Dd 0q
1 1 0 0 SIZE (.B, .W, .P, .L) PARAMETER REG Dp bb
OPR POSTBYTE (specifies source) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR/1/2/3-REG-REG
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 SOURCE REGISTER Ds 0q
1 1 0 1 SIZE (.B, .W, .P, .L) PARAMETER REG Dp bb
OPR POSTBYTE (specifes destination) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
REG-OPR/1/2/3-IMM
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 DESTINATION REGISTER Dd 0q
1 1 1 0 SIZE (.B, .W, .P, .L) WIDTH[4:3] bb
WIDTH[2:0] OFFSET[4:0] i1
OPR POSTBYTE (specifies source) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR/1/2/3-REG-IMM
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 1 SOURCE REGISTER Ds 0q
1 1 1 1 SIZE (.B, .W, .P, .L) WIDTH[4:3] bb
WIDTH[2:0] OFFSET[4:0] I1
OPR POSTBYTE (specifies destination) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 0q bb i1 xb x3 x2 x1 BFINS.bwpl opr24,Ds,#width:offset
1B 0q bb i1 xb x3 x2 x1 BFINS.bwpl [opr24],Ds,#width:offset
Instruction Fields
DESTINATION REGISTER Dd- This field specifies the number of the data register Dd used for the
destination (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and
1:1:1=D7).
SOURCE REGISTER Ds- This field specifies the number of the data register Ds used for the source
operand (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
PARAMETER REG Dp - This field specifies the number of the 16 bit data register which contains both
width and offset parameters for the operation (0b00 = D2, 0b01 = D3, 0b10 = D4, and 0b11 = D5). The
width parameter is 5 bits wide and is taken from bits [9:5] of the parameter register; the values 1..31
represent width-values 1..31. The value zero represents a width of 32. The offset parameter is 5 bits
wide and is taken from bits [4:0] of the parameter register; it represents a value range of 0..31.
WIDTH - This field specifies the width of the bit-field to be extracted from the source operand. This
field is 5 bits wide. The values 1..31 represent width-values 1..31. The value zero represents a width of
32.
OFFSET - This field specifies the offset of the low-order bit of the bit-field to be extracted from the
source operand. This field is 5 bits wide. The values 0..31 directly represent the offset values 0..31.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
BGE can be used to branch after subtracting or comparing signed two’s complement values. After
CMP, SBC, or SUB, the branch occurs if the CPU register value is greater than or equal to the value in
memory (or a second register if the OPR addressing mode is used to specify a data register).
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
If the background debug mode is enabled by the ENBDM control bit=1 in the Background Debug
Controller (BDC), stop processing application instructions and enter the active background debug
mode to await serial BDM commands. If the background debug mode is not enabled, this instruction
behaves like a NOP and the application program continues to execute.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
00 BGND
Description
BGT can be used to branch after subtracting or comparing signed two’s complement values. After
CMP, SBC, or SUB, the branch occurs if the CPU register value is greater than the value in memory
(or a second register if the OPR addressing mode is used to specify a data register).
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
BHI can be used to branch after subtracting or comparing unsigned values. After CMP, SBC, or SUB,
the branch occurs if the CPU register value is greater than the value in memory (or a second register if
the OPR addressing mode is used to specify a data register). BHI should not be used for branching after
instructions that do not affect the C bit in the CCR, such as INC, DEC, LD, or ST.
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
BHS can be used to branch after subtracting or comparing unsigned values. After CMP, SBC, or SUB,
the branch occurs if the CPU register value is greater than or equal to the value in memory (or a second
register if the OPR addressing mode is used to specify a data register). BHS should not be used for
branching after instructions that do not affect the C bit in the CCR, such as INC, DEC, LD, or ST.
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Bitwise AND register Di with a memory operand to set condition code bits but do not change the
contents of the register or memory operand. When the operand is an immediate value, it has the same
size as register Di. In the case of the general OPR addressing operand, oprmemreg can be a
sign-extended immediate value (–1, 1, 2, 3..14, 15), a data register, a memory operand the same size
as Di at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with indexed or
indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 –
OPR/1/2/3
7 6 5 4 3 2 1 0
0 1 1 0 1 SD REGISTER Di 6q
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size of the register Di.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
BLE can be used to branch after subtracting or comparing signed two’s complement values. After
CMP, SBC, or SUB, the branch occurs if the CPU register value is less than or equal to the value in
memory (or a second register if the OPR addressing mode is used to specify a data register).
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
If BLO is executed immediately after execution of a CMP, SBC, or SUB instruction, a branch occurs
if and only if the unsigned binary number in the CPU register is less than the unsigned number in
memory (or a second register if the OPR addressing mode is used to specify a data register). BLO
should not be used for branching after instructions that do not affect the C bit in the CCR, such as INC,
DEC, LD, or ST.
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
If BLS is executed immediately after execution of a CMP, SBC, or SUB instruction, a branch occurs
if and only if the unsigned binary number in the CPU register is less than or equal to the unsigned
number in memory (or a second register if the OPR addressing mode is used to specify a data register).
BLS should not be used for branching after instructions that do not affect the C bit in the CCR, such
as INC, DEC, LD, or ST.
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
BLTE can be used to branch after subtracting or comparing signed two’s complement values. After
CMP, SBC, or SUB, the branch occurs if the CPU register value is less than the value in memory (or
a second register if the OPR addressing mode is used to specify a data register).
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests the N status bit. If N = 1 then program execution continues at location (PC) + REL
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests the Z status bit. If Z = 0 then program execution continues at location (PC) + REL
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests the N status bit. If N = 0 then program execution continues at location (PC) + REL
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Unconditional branch to an address formed by adding the address of the current PC (the address of the
opcode for the current branch instruction) plus the 7-bit or 15-bit two’s complement displacement that
is included in the second or second and third bytes of the branch instruction. A displacement of zero
will result in an infinite loop back to the beginning of the current branch instruction.
Since the BRA condition is always satisfied, the branch is always taken, and the instruction queue must
always be refilled.
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests the specified bit in Di or a memory operand, and branches if the bit was clear. The bit to be tested
is specified in a 5-bit immediate value or in the low order five bits of a data register Dn. In the case of
the general OPR addressing operand, oprmemreg can be a short immediate value (–1, 1, 2, 3...14, 15),
a data register, an 8-, 16-, or 32-bit memory operand at a 14- 18- or 24-bit extended address, or a
memory operand that is addressed with indexed or indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – – – – ∆
C: Set if the bit being tested was set before the operation. Cleared otherwise.
REG-REG-REL
7 6 5 4 3 2 1 0
0 0 0 0 0 0 1 0 02
1 PARAMETER REGISTER Dn 0 0 0 1 bm
1 0 1 1 1 SD REGISTER Di xb
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
OPR/1/2/3-IMM-REL
Byte-sized operand (.B)
7 6 5 4 3 2 1 0
0 0 0 0 0 0 1 0 02
1 n[2:0] 0 0 0 0 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
OPR/1/2/3-REG-REL
7 6 5 4 3 2 1 0
0 0 0 0 0 0 1 0 02
1 PARAMETER REGISTER Dn SIZE (.B-0:0, .W-0:1, .L-1:1) 0 1 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
Instruction Fields
REGISTER - This field specifies the number of the data register Di which is used as the source operand
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the bit number of the bit in the operand that is to be tested. Only the low-order 5 bits of the
parameter register are used.
n[4:0] - This field contains the 5-bit immediate parameter that specifies the bit number of the bit in the
operand that is to be tested.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand, performs the same function as the
REG-IMM or REG-REG versions but is less efficient.
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests the specified bit in Di or a memory operand, and branches if the bit was set. The bit to be tested
is specified in a 5-bit immediate value or in the low order five bits of a data register Dn. In the case of
the general OPR addressing operand, oprmemreg can be a short immediate value (–1, 1, 2, 3...14, 15),
a data register, an 8-, 16-, or 32-bit memory operand at a 14- 18- or 24-bit extended address, or a
memory operand that is addressed with indexed or indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – – – – ∆
C: Set if the bit being tested was set before the operation. Cleared otherwise.
REG-REG-REL
7 6 5 4 3 2 1 0
0 0 0 0 0 0 1 1 03
1 PARAMETER REGISTER Dn 0 0 0 1 bm
1 0 1 1 1 SD REGISTER Di xb
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
OPR/1/2/3-IMM-REL
Byte-sized operand (.B)
7 6 5 4 3 2 1 0
0 0 0 0 0 0 1 1 03
1 n[2:0] 0 0 0 0 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
OPR/1/2/3-REG-REL
7 6 5 4 3 2 1 0
0 0 0 0 0 0 1 1 03
1 PARAMETER REGISTER Dn SIZE (.B-0:0, .W-0:1, .L-1:1) 0 1 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
Instruction Fields
REGISTER - This field specifies the number of the data register Di which is used as the source operand
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the bit number of the bit in the operand that is to be tested. Only the low-order 5 bits of the
parameter register are used.
n[4:0] - This field contains the 5-bit immediate parameter that specifies the bit number of the bit in the
operand that is to be tested.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), or 32-bit long-word (0b11) as the size
of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand, performs the same function as the
REG-IMM or REG-REG versions but is less efficient.
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests and copies the original state of the specified bit into the C condition code bit to be used for
semaphores. Then sets the specified bit in Di or a memory operand by performing a bitwise OR with
a mask that has all bits clear except the specified bit. The bit to be set is specified in a 5-bit immediate
value or in the low order five bits of a data register Dn. In the case of the general OPR addressing
operand, oprmemreg can be a data register, an 8-, 16-, or 32-bit memory operand at a 14- 18- or 24-bit
extended address, or a memory operand that is addressed with indexed or indirect addressing mode. It
is not appropriate to specify a short-immediate operand with the OPR addressing mode because it is
not possible to modify (set a bit in) the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 ∆
ED bm BSET Di,#opr5i
REG-REG
7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 ED
1 PARAMETER REGISTER Dn 0 0 0 1 bm
1 0 1 1 1 SD REGISTER Di xb
ED bm xb BSET Di,Dn
OPR/1/2/3-IMM
Byte-sized operand (.B)
7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 ED
1 n[2:0] 0 0 0 0 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR/1/2/3-REG
7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 ED
1 PARAMETER REGISTER Dn SIZE (.B-0:0, .W-0:1, .L-1:1) 0 1 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the bit number of the bit in the operand that is to be set. Only the low-order 5 bits of the
parameter register are used.
n[4:0] - This field contains the 5-bit immediate parameter that specifies the bit number of the bit in the
operand that is to be set.
SIZE - This field specifies 8-bit byte (0:0), 16-bit word (0:1), or 32-bit long-word (1:1) as the size of
the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Short immediate mode is not appropriate for instructions that store a result to the specified operand.
Description
Sets up conditions to return to normal program flow, then transfers control to a subroutine. Uses the
address of the instruction after the BSR as a return address.
Decrements the SP by three, to allow the three bytes of the return address to be stacked.
Stacks the return address (the SP points to the most-significant byte of the return address).
Branches to the location (PC) + REL.
Subroutines are normally terminated with an RTS instruction, which restores the return address from
the stack.
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests and copies the original state of the specified bit into the C condition code bit to be used for
semaphores. Then toggles (inverts) the specified bit in Di or a memory operand by performing a
bitwise Exclusive-OR with a mask that has all bits cleared except the specified bit. The bit to be toggled
is specified in a 5-bit immediate value or in the low order five bits of a data register Dn. In the case of
the general OPR addressing operand, oprmemreg can be a data register, an 8-, 16-, 24-, or 32-bit
memory operand at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with
indexed or indirect addressing mode. It is not appropriate to specify a short-immediate operand with
the OPR addressing mode because it is not possible to modify (toggle a bit in) the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 ∆
EE bm BTGL Di,#opr5i
REG-REG
7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 EE
1 PARAMETER REGISTER Dn 0 0 0 1 bm
1 0 1 1 1 SD REGISTER Di xb
EE bm xb BTGL Di,Dn
OPR/1/2/3-IMM
Byte-sized operand (.B)
7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 EE
1 n[2:0] 0 0 0 0 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR/1/2/3-REG
7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 EE
1 PARAMETER REGISTER Dn SIZE (.B-0:0, .W-0:1, .L-1:1) 0 1 bm
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the bit number of the bit in the operand that is to be toggled. Only the low-order 5 bits of the
parameter register are used.
n[4:0] - This field contains the 5-bit immediate parameter that specifies the bit number of the bit in the
operand that is to be toggled.
SIZE - This field specifies 8-bit byte (0:0), 16-bit word (0:1), or 32-bit long-word (1:1) as the size of
the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Short immediate mode is not appropriate for instructions that store a result to the specified operand.
Description
Tests the V status bit. If V = 0 then program execution continues at location (PC) + REL
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Tests the V status bit. If V = 1 then program execution continues at location (PC) + REL
See Section 3.6, “Relative Addressing Modes (REL, REL1)” for details of branch execution.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
Instruction Fields
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit.
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Counts the number of leading sign-bits in the source register, decrements this number and then copies
the result into the destination register.
The result can be directly used as shift-width operand to normalize a fractional number in the source
register by shifting its content to the left.
Only the data-registers D0..D7 can be used as arguments for this instruction.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – 0 ∆ 0 –
N: 0, cleared.
Z: Set if the result is zero. Cleared otherwise.
V: 0, cleared.
1B 91 cb CLB cpureg,cpureg
Instruction Fields
SOURCE REGISTER Di - This field specifies the number of the data register Di which is used as the
source operand (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and
1:1:1=D7).
DESTINATION REGISTER Di - This field specifies the number of the data register Di which is used
as the result register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and
1:1:1=D7).
Description
Clears the C status bit. This instruction is assembled as ANDCC #$FE. The ANDCC instruction can
be used to clear any combination of bits in the CCL in one operation.
CLC can be used to set up the C bit prior to a shift or rotate instruction involving the C bit.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – − − – 0
C: Cleared.
CE FE CLC
Description
Clears the I mask bit. This instruction is assembled as ANDCC #$EF. The ANDCC instruction can be
used to clear any combination of bits in the CCL in one operation.
When the I bit is cleared, interrupts are enabled.
There is a 1-cycle (bus clock) delay in the clearing mechanism for the I bit so that, if interrupts were
previously disabled, the next instruction after a CLI will always be executed, even if there was an
interrupt pending prior to execution of the CLI instruction.
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − − − − 0 − − − − supervisor state
− − − − − − − − − − − − − − user state
CE EF CLI
Description
Clears a memory operand M, a CPU register Di, or index registers X or Y. In the case of the general
OPR addressing operand, oprmemreg can be a data register, a memory operand at a 14- 18- or 24-bit
extended address, or a memory operand that is addressed with indexed or indirect addressing mode.
The size of the memory operand M is determined by the suffix (b=8 bit byte, w=16 bit word, p=24 bit
pointer, or l=32 bit long-word). If the OPR memory addressing mode is used to specify a data register
Di, the register determines the size for the operation and the .bwpl suffix is ignored. It is inappropriate
to specify a short immediate operand using the OPR addressing mode for this instruction because it is
not possible to clear the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – 0 1 0 0
N: 0, cleared.
Z: 1, set.
V: 0, cleared.
C: 0, cleared.
3q CLR Di
INH
7 6 5 4 3 2 1 0
1 0 0 1 1 0 1 Y/X 9p
9A CLR X
9B CLR Y
OPR/1/2/3
7 6 5 4 3 2 1 0
1 0 1 1 1 1 SIZE (.B, .W, .P, .L) Bp
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as the first
source operand (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and
1:1:1=D7).
Y/X - This field selects either Y (1) or X (0) to be cleared.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Clears the V status bit. This instruction is assembled as ANDCC #$FD. The ANDCC instruction can
be used to clear any combination of bits in the CCL in one operation.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – − − 0 –
V: Cleared.
CE FD CLV
CMP Compare
CMP
Operation
(Di) − (M); (X) – (M); (Y) – (M); (S) – (M); or (X) – (Y)
Syntax Variations Addressing Modes
CMP Di,#oprimmsz IMM1/2/4
CMP Di,oprmemreg OPR/1/2/3
CMP xy,#opr24i IMM3
CMP xy,oprmemreg OPR/1/2/3
CMP S,#opr24i IMM3
CMP S,oprmemreg OPR/1/2/3
CMP X,Y INH
Description
Compare register Di, X, Y, or S to an immediate value or to a memory operand, or compare X to Y and
set the condition codes, which may then be used for arithmetic and logical conditional branching. The
operation is equivalent to a subtract but the result is not stored and the contents of the CPU register and
the memory operand are not changed. When the operand is an immediate value, it has the same size as
the CPU register. In the case of the general OPR addressing operand, oprmemreg can be a
sign-extended immediate value (–1, 1, 2, 3..14, 15), a data register, a memory operand the same size
as the CPU register at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with
indexed or indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – - – – – – – ∆ ∆ ∆ ∆
Ep i3 i2 i1 CMP xy,#opr24i
1B 04 i3 i2 i1 CMP S,#opr24i
1B 02 xb x2 x1 CMP S,(opru18,Dj)
1B 02 xb x2 x1 CMP S,opru18
1B 02 xb x3 x2 x1 CMP S,(opr24,xysp)
1B 02 xb x3 x2 x1 CMP S,[opr24,xysp]
1B 02 xb x3 x2 x1 CMP S,(opru24,Dj)
1B 02 xb x3 x2 x1 CMP S,opr24
1B 02 xb x3 x2 x1 CMP S,[opr24]
FC CMP X,Y
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as the first
source operand (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and
1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes 3 bytes or 4 bytes wide, depending on the size of the source
register.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Y/X - This field specified either the X (0) or Y (1) index register as the first source operand.
Description
Complements (inverts) a memory operand M. The memory operand oprmemreg can be a data register,
a memory operand at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with
indexed or indirect addressing mode. The size of the memory operand M is determined by the suffix
(b=8 bit byte, w=16 bit word, or l=32 bit long-word). If the OPR memory addressing mode is used to
specify a data register Di, the register determines the size for the operation and the .bwl suffix is
ignored. It is inappropriate to specify a short immediate operand using the OPR addressing mode for
this instruction because it is not possible to modify the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 –
Cp xb x2 x1 COM.bwl opru18
Cp xb x3 x2 x1 COM.bwl (opr24,xysp)
Cp xb x3 x2 x1 COM.bwl [opr24,xysp]
Cp xb x3 x2 x1 COM.bwl (opru24,Di)
Cp xb x3 x2 x1 COM.bwl opr24
Cp xb x3 x2 x1 COM.bwl [opr24]
Instruction Fields
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), or 32-bit long-word (0b11) as the size
of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Decrement the operand (internally determining the N and Z conditions but not modifying the CCR)
then branch if the specified condition is true. The condition (cc) can be NE (not equal), EQ (equal), PL
(plus), MI (minus), GT (greater than), or LE (less than or equal). The operand may be one of the eight
data registers, index register X, index register Y, or an 8-, 16-, 24-, or 32-bit memory operand. In the
case of the general OPR addressing operand, oprmemreg can be a data register, a memory operand at
a 14- 18- or 24-bit extended address, or a memory operand that is addressed with indexed or indirect
addressing mode. It is not appropriate to specify a short-immediate operand with the OPR addressing
mode because it is not possible to modify (decrement) the immediate operand. The relative offset for
the branch can be either 7 bits (–64 to +63) or 15 bits (~+/–16K) displacement from the DBcc opcode
location.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – − − − −
REG-REL (X, Y)
7 6 5 4 3 2 1 0
0 0 0 0 1 1 0 1 0B
1 CC (NE,EQ,PL,MI,GT,LE,–,–) 1 0 don’t care Y/X lb
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
OPR/1/2/3-REL
7 6 5 4 3 2 1 0
0 0 0 0 1 1 0 1 0B
1 CC (NE,EQ,PL,MI,GT,LE,–,–) 1 1 SIZE (.B, .W, .P, .L) lb
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
Instruction Fields
CC - This field specifies the condition for the branch according to the table below:
REGISTER - This field specifies the number of the data register Di which is used as the source operand
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the operation.
Y/X - This field specifies either index register X (0) or index register Y (1) as the source operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a short-immediate operand, is not appropriate because you
cannot alter (decrement) the immediate operand value. Using OPR addressing mode to specify a
register operand, performs the same function as the REG-REL versions but is less efficient.
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit .
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
DEC Decrement
DEC
Operation
(Di) − 1 ⇒ Di
(M) − 1 ⇒ M
Syntax Variations Addressing Modes
DEC Di INH
DEC.bwl oprmemreg OPR/1/2/3
Description
Decrement a register Di or memory operand M. The memory operand oprmemreg can be a data
register, a memory operand at a 14- 18- or 24-bit extended address, or a memory operand that is
addressed with indexed or indirect addressing mode. The size of the memory operand M is determined
by the suffix (b=8 bit byte, w=16 bit word, or l=32 bit long-word). If the OPR memory addressing
mode is used to specify a data register Dj, the register determines the size for the operation and the .bwl
suffix is ignored. It is inappropriate to specify a short immediate operand using the OPR addressing
mode for this instruction because it is not possible to modify the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ −
4n DEC Di
OPR/1/2/3
7 6 5 4 3 2 1 0
1 0 1 0 1 1 SIZE (.B, .W, –, .L) Ap
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), or 32-bit long-word (0b11) as the size
of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Divides a signed two’s complement dividend by a signed two’s complement divisor to produce a signed
two’s complement quotient in a register Dd. The dividend may be a register Dj or an 8-bit (.B),
16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand M1. The divisor may be a register Dk, an 8-bit,
16-bit , or 32-bit immediate value, or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory
operand M or M2. To ensure compatibility with the C standard, the sign of the quotient is the
exclusive-OR of the sign of the dividend and the divisor.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
N: Set if the MSB of the result is set. Undefined after overflow or division by
zero. Cleared otherwise.
Z: Set if the result is zero. Undefined after overflow or division by zero.
Cleared otherwise.
V: Set if the signed result does not fit in the result register Dd. Undefined after
division by zero. Cleared otherwise.
C: Set if divisor was zero. Cleared otherwise. (Indicates division by zero).
1B 3n mb DIVS Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 0 QUOTIENT REGISTER Dd 3n
1 1 DIVIDEND REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA (Divisor)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
1B 3n mb i1 DIVS.B Dd,Dj,#opr8i
1B 3n mb i2 i1 DIVS.W Dd,Dj,#opr16i ;short-imm better for some values
1B 3n mb i4 i3 i2 i1 DIVS.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 0 QUOTIENT REGISTER Dd 3n
1 1 DIVIDEND REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2 divisor) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 3n mb xb DIVS.bwl Dd,Dj,#oprsxe4i
1B 3n mb xb DIVS.bwl Dd,Dj,Dk ;see more efficient REG-REG version
1B 3n mb xb DIVS.bwl Dd,Dj,(opru4,xys)
1B 3n mb xb DIVS.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
1B 3n mb xb DIVS.bwl Dd,Dj,(Di,xys)
1B 3n mb xb DIVS.bwl Dd,Dj,[Di,xy]
1B 3n mb xb x1 DIVS.bwl Dd,Dj,(oprs9,xysp)
1B 3n mb xb x1 DIVS.bwl Dd,Dj,[oprs9,xysp]
1B 3n mb xb x1 DIVS.bwl Dd,Dj,opru14
1B 3n mb xb x2 x1 DIVS.bwl Dd,Dj,(opru18,Dj)
1B 3n mb xb x2 x1 DIVS.bwl Dd,Dj,opru18
1B 3n mb xb x3 x2 x1 DIVS.bwl Dd,Dj,(opr24,xysp)
1B 3n mb xb x3 x2 x1 DIVS.bwl Dd,Dj,[opr24,xysp]
1B 3n mb xb x3 x2 x1 DIVS.bwl Dd,Dj,(opru24,Dj)
1B 3n mb xb x3 x2 x1 DIVS.bwl Dd,Dj,opr24
1B 3n mb xb x3 x2 x1 DIVS.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 0 QUOTIENT REGISTER Dd 3n
1 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1 dividend) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2 divisor) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
QUOTIENT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
DIVIDEND REGISTER - This field specifies the number of the data register Dj used as dividend
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
DIVISOR REGISTER - This field specifies the number of the data register Dk used as divisor
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the divisor. The 0b10 combination is not available for the REG-IMM version of the
instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 (dividend) and M2 (divisor) which use
the general OPR addressing mode to specify short-immediate, register, or memory operands (0b00 =
8-bit byte, 0b01 = 16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a
short-immediate operand is specified, it is internally sign-extended to the size specified by the
M1_SIZE and/or M2_SIZE specifications. When a register is specified, it determines the size and the
M1_SIZE and/or M2_SIZE specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both the dividend and the divisor, is less
efficient than using the REG-REG version of the instruction.
Description
Divides an unsigned dividend by an unsigned divisor to produce an unsigned quotient in a register Dd.
The dividend may be a register Dj or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory
operand M1. The divisor may be a register Dk, an 8-bit, 16-bit , or 32-bit immediate value, or an 8-bit
(.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand M or M2.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
N: Set if the MSB of the result is set. Undefined after overflow or division by
zero. Cleared otherwise.
Z: Set if the result is zero. Undefined after overflow or division by zero.
Cleared otherwise.
V: Set if the unsigned result does not fit in the result register Dd. Undefined
after division by zero. Cleared otherwise.
C: Set if divisor was zero. Cleared otherwise. (Indicates division by zero).
1B 3n mb DIVU Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 0 QUOTIENT REGISTER Dd 3n
0 1 DIVIDEND REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA (divisor)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
1B 3n mb i1 DIVU.B Dd,Dj,#opr8i
1B 3n mb i2 i1 DIVU.W Dd,Dj,#opr16i ;short-imm better for some values
1B 3n mb i4 i3 i2 i1 DIVU.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 0 QUOTIENT REGISTER Dd 3n
0 1 DIVIDEND REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2 divisor) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 3n mb xb DIVU.bwl Dd,Dj,#oprsxe4i
1B 3n mb xb DIVU.bwl Dd,Dj,Dk ;see more efficient REG-REG version
1B 3n mb xb DIVU.bwl Dd,Dj,(opru4,xys)
1B 3n mb xb DIVU.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
1B 3n mb xb DIVU.bwl Dd,Dj,(Di,xys)
1B 3n mb xb DIVU.bwl Dd,Dj,[Di,xy]
1B 3n mb xb x1 DIVU.bwl Dd,Dj,(oprs9,xysp)
1B 3n mb xb x1 DIVU.bwl Dd,Dj,[oprs9,xysp]
1B 3n mb xb x1 DIVU.bwl Dd,Dj,opru14
1B 3n mb xb x2 x1 DIVU.bwl Dd,Dj,(opru18,Di)
1B 3n mb xb x2 x1 DIVU.bwl Dd,Dj,opru18
1B 3n mb xb x3 x2 x1 DIVU.bwl Dd,Dj,(opr24,xysp)
1B 3n mb xb x3 x2 x1 DIVU.bwl Dd,Dj,[opr24,xysp]
1B 3n mb xb x3 x2 x1 DIVU.bwl Dd,Dj,(opru24,Di)
1B 3n mb xb x3 x2 x1 DIVU.bwl Dd,Dj,opr24
1B 3n mb xb x3 x2 x1 DIVU.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 0 QUOTIENT REGISTER Dd 3n
0 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1 dividend) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2 divisor) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
QUOTIENT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
DIVIDEND REGISTER - This field specifies the number of the data register Dj used as dividend
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
DIVISOR REGISTER - This field specifies the number of the data register Dk used as divisor
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the divisor. The 0b10 combination is not available for the REG-IMM version of the
instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 (dividend) and M2 (divisor) which use
the general OPR addressing mode to specify short-immediate, register, or memory operands (0b00 =
8-bit byte, 0b01 = 16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a
short-immediate operand is specified, it is internally sign-extended to the size specified by the
M1_SIZE and/or M2_SIZE specifications. When a register is specified, it determines the size and the
M1_SIZE and/or M2_SIZE specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both the dividend and the divisor, is less
efficient than using the REG-REG version of the instruction.
EOR Exclusive OR
EOR
Operation
(Di) ^ (M) ⇒ Di
Syntax Variations Addressing Modes
EOR Di,#oprimmsz IMM1/2/4
EOR Di,oprmemreg OPR/1/2/3
Description
Bitwise Exclusive-OR register Di with a memory operand and store the result to Di. When the operand
is an immediate value, it has the same size as register Di. In the case of the general OPR addressing
operand, oprmemreg can be a sign-extended immediate value (–1, 1, 2, 3..14, 15), a data register, a
memory operand the same size as Di at a 14- 18- or 24-bit extended address, or a memory operand that
is addressed with indexed or indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 –
OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
1 0 0 0 1 SD REGISTER Di 8q
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE) x1
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE) x2
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE) x3
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size of the register Di.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Exchange contents of CPU registers.
If both registers have the same size, a direct exchange is performed.
If the first register is smaller than the second register, it is sign-extended and written to the second
register. In this case the first register is not changed. When the first register is smaller than the second
register, the SEX instruction mnemonic may be used instead of EXG.
If the first register is larger than the second register, the smaller register is sign-extended as it is
transferred into the larger register and the larger register is truncated during the transfer into the smaller
register. These are not considered useful operations, this description simply documents what would
happen if these unexpected combinations occur.
The two special cases EXG CCW,CCL and EXG CCW,CCH are ambiguous so CCW is not changed
(this is equivalent to a NOP instruction).
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
In some cases (such as exchanging CCL with D0) the exchange instruction can cause the contents of
another register to be written into the CCR so the CCR effects shown above do not apply. Unused bits
in the CCR cannot be changed by any exchange instruction. The X interrupt mask can be cleared by
an instruction in supervisor state but cannot be set (changed from 0 to 1) by any exchange instruction.
In user state, the X and I interrupt masks cannot be changed by any exchange instruction.
D3 D4 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D2 -0 –
⇔ D2 ⇔ D2 ⇔ D2 ⇒ D2 ⇒ D2 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D2 ⇒ D2 ⇔ D2
D2 D4 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D3 -1 –
Freescale Semiconductor
⇔ D3 ⇔ D3 ⇔ D3 ⇒ D3 ⇒ D3 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D3 ⇒ D3 ⇔ D3
D2 D3 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D4 -2 –
⇔ D4 ⇔ D4 ⇔ D4 ⇒ D4 ⇒ D4 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D4 ⇒ D4 ⇔ D4
D2 D3 D4 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D5 -3 –
⇔ D5 ⇔ D5 ⇔ D5 ⇒ D5 ⇒ D5 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D5 ⇒ D5 ⇔ D5
Big Big Big Big D1 Big Big Big Big Big CCH CCL Big
D0 -4 –
⇔Small ⇔Small ⇔Small ⇔Small ⇔ D0 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇔ D0 ⇔ D0 ⇔Small
Big Big Big Big D0 Big Big Big Big Big CCH CCL Big
D1 -5 –
⇔Small ⇔Small ⇔Small ⇔Small ⇔ D1 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇔ D1 ⇔ D1 ⇔Small
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 D7 sex:X sex:Y sex:S sex:CCH sex:CCL sex:CCW
D6 -6 –
⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇔ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 D6 sex:X sex:Y sex:S sex:CCH sex:CCL sex:CCW
D7 -7 –
⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇔ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 Big Big Y S sex:CCH sex:CCL sex:CCW
X -8 –
⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇔Small ⇔Small ⇔X ⇔X ⇒X ⇒X ⇒X
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 Big Big X S sex:CCH sex:CCL sex:CCW
Y -9 –
⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇔Small ⇔Small ⇔Y ⇔Y ⇒Y ⇒Y ⇒Y
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 Big Big X Y sex:CCH sex:CCL sex:CCW
S -A –
⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇔Small ⇔Small ⇔S ⇔S ⇒S ⇒S ⇒S
reserved -B
-F –
EXG Big,Small: Small register gets low part of Big register, Big register gets sign-extended Small register. These cases are not expected to be useful in application programs.
EXG CCW,CCH and EXG CCW,CCL are ambiguous cases so CCW is not changed (equivalent to NOP)
189
Chapter 6 Instruction Glossary
Chapter 6 Instruction Glossary
INC Increment
INC
Operation
(Di) + 1 ⇒ Di
(M) + 1 ⇒ M
Syntax Variations Addressing Modes
INC Di INH
INC.bwl oprmemreg OPR/1/2/3
Description
Increment a register Di or memory operand M. The memory operand oprmemreg can be a data register,
a memory operand at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with
indexed or indirect addressing mode. The size of the memory operand M is determined by the suffix
(b=8 bit byte, w=16 bit word, or l=32 bit long-word). If the OPR memory addressing mode is used to
specify a data register Dj, the register determines the size for the operation and the .bwl suffix is
ignored. It is inappropriate to specify a short immediate operand using the OPR addressing mode for
this instruction because it is not possible to modify the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ −
3n INC Di
OPR/1/2/3
7 6 5 4 3 2 1 0
1 0 0 1 1 1 SIZE (.B, .W, –, .L) 9p
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), or 32-bit long-word (0b11) as the size
of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
JMP Jump
JMP
Operation
Effective Address ⇒ PC
Syntax Variations Addressing Modes
JMP opr24a EXT3
JMP oprmemreg OPR/1/2/3
Description
Unconditional jump to extended address.
A JMP instruction causes the instruction queue to be refilled before execution resumes at the new
address.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
BA a3 a2 a1 JMP opr24a
OPR/1/2/3
7 6 5 4 3 2 1 0
1 0 1 0 1 0 1 0 AA
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
AA xb x2 x1 JMP (opru18,Di)
AA xb x2 x1 JMP opru18 ;EXT version is just as efficient
AA xb x3 x2 x1 JMP (opr24,xysp)
AA xb x3 x2 x1 JMP [opr24,xysp]
AA xb x3 x2 x1 JMP (opru24,Di)
AA xb x3 x2 x1 JMP opr24 ;EXT version is more efficient
AA xb x3 x2 x1 JMP [opr24]
Instruction Fields
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a 14- 18- or 24-bit extended memory
address, or an indexed or indexed-indirect memory location. Short immediate is not appropriate as a
jump destination. Di cannot be used as the destination of a jump instruction. There is no advantage to
using the 18-bit or 24-bit variations of OPR addressing compared to using the 24-bit EXT version of
the jump instruction.
Description
Sets up conditions to return to normal program flow, then transfers control to a subroutine. Uses the
address of the instruction after the JSR as a return address.
Decrements the SP by three, to allow the three bytes of the return address to be stacked.
Stacks the return address (the SP points to the most-significant byte of the return address).
Jumps to the effective address.
Subroutines are normally terminated with an RTS instruction, which restores the return address from
the stack.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
BB a3 a2 a1 JSR opr24a
OPR/1/2/3
7 6 5 4 3 2 1 0
1 0 1 0 1 0 1 1 AB
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
AB xb JSR (opru4,xys)
AB xb JSR {(+-xy)|(xy+-)|(-s)|(s+)}
AB xb JSR (Di,xys)
AB xb JSR [Di,xy]
AB xb x1 JSR (oprs9,xysp)
AB xb x1 JSR [oprs9,xysp]
AB xb x1 JSR opru14
AB xb x2 x1 JSR (opru18,Di)
AB xb x2 x1 JSR opru18 ;EXT version is just as efficient
AB xb x3 x2 x1 JSR (opr24,xysp)
AB xb x3 x2 x1 JSR [opr24,xysp]
AB xb x3 x2 x1 JSR (opru24,Di)
AB xb x3 x2 x1 JSR opr24 ;EXT version is more efficient
AB xb x3 x2 x1 JSR [opr24]
Instruction Fields
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a 14- 18- or 24-bit extended memory
address, or an indexed or indexed-indirect memory location. Short immediate is not appropriate as a
JSR destination. Di cannot be used as the destination of a JSR instruction. There is no advantage to
using the 18-bit or 24-bit variations of OPR addressing compared to using the 24-bit EXT version of
the JSR instruction.
LD Load
(Di, X, Y, or SP)
LD
Operation
(M) ⇒ Di
(M) ⇒ X
(M) ⇒ Y
(M) ⇒ SP
Syntax Variations Addressing Modes
LD Di,#oprimmsz IMM1/2/4 (same size as Di)
LD Di,opr24a EXT3 (24-bit address)
LD Di,oprmemreg OPR/1/2/3
LD xy,#opr18i IMM2 (efficient 18-bit)
LD xy,#opr24i IMM3 (same size as X or Y)
LD xy,opr24a EXT3 (24-bit address)
LD xy,oprmemreg OPR/1/2/3
LD S,#opr24i IMM3 (same size as SP)
LD S,oprmemreg OPR/1/2/3
Description
Load a register Di, X, Y, or SP with the contents of a memory location. In the case of the general OPR
addressing operand, oprmemreg can be a sign-extended immediate value (–1, 1, 2, 3..14, 15), a data
register, a memory operand the same size as Di , X, Y, or SP at a 14- 18- or 24-bit extended address,
or a memory operand that is addressed with indexed or indirect addressing mode. There is also an
efficient 24-bit extended addressing mode version of the instructions for Di, X and Y. For immediate
addressing mode, the memory operand is usually the same size as the register that is being loaded,
however, in addition to the 24-bit immediate versions of LD X and LD Y, there are also more efficient
18-bit immediate versions for X and Y which compliment the 18-bit OPR extended addressing mode
to work efficiently with variables in the first 256 kilobyte of memory.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 –
7 6 5 4 3 2 1 0
1 0 0 1 1 0 0 Y/X 9p
IMMEDIATE DATA[23:16] i3
IMMEDIATE DATA[16:8] i2
IMMEDIATE DATA[7:0] i1
9p i3 i2 i1 LD xy,#opr24i
EXT3 (X or Y)
7 6 5 4 3 2 1 0
1 0 1 1 1 0 0 Y/X Bp
ADDRESS[23:16] a3
ADDRESS[15:8] a2
ADDRESS[7:0] a1
Bp a3 a2 a1 LD xy,opr24a
OPR/1/2/3 (X or Y)
7 6 5 4 3 2 1 0
1 0 1 0 1 0 0 Y/X Ap
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 03 i3 i2 i1 LD S,#opr24i
OPR/1/2/3 (SP)
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 0 0 0 0 00
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
REGISTER - This field specifies the number of the data register Di which is used as the destination
register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
Y/X - This field selects either the X index register or the Y index register.
ADDRESS - This field is used for address bits used for extended addressing mode.
IMMEDIATE DATA[17:16] - This field holds address bits 17 and 16 of an 18-bit address.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes, 3 bytes, or 4 bytes wide, depending on the size of the register
Di, X, Y, or SP.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Load Di, X, Y, or SP with an effective address or add a signed 8-bit immediate value to X, Y, or SP.
This description needs quite a bit of work to explain the odd cases such as short-imm, Di, pre/post
inc/dec, and indirect variations of OPR addressing.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – − − − –
OPR/1/2/3 (X or Y)
7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 Y/X 0p
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
D7/D6 - This field selects either D6 (0) or D7 (1) as the destination register.
Y/X - This field selects either the X index register or the Y index register.
IMMEDIATE DATA - This field contains the signed 8-bit immediate operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a 14- 18- or 24-bit extended memory
address, or an indexed or indexed-indirect memory location. Unlike other indexed addressing, LEA
uses the address produced by the addressing mode rather than the operand that is located at this
address. Short immediate and register Di variations of OPR addressing are not appropriate for LEA
because these values do not have an associated effective address.
0
C MSB LSB
Description
Logically shift an operand n bit-positions to the left. The result is saved in a CPU register, or in the case
of a 2-operand memory shift the result is saved in the same memory location used for the source. The
operand to be shifted may be one of the eight data registers or an 8-, 16-, 24-, or 32-bit memory
operand. In the case of the general OPR addressing operand, oprmemreg can be a data register, a
memory operand at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with
indexed or indirect addressing mode. The number of bit positions to shift the operand is supplied in a
1-bit or 5-bit immediate operand or in the low order 5 bits of a register or byte-sized memory operand.
When the number of bit positions to shift is provided in a 5-bit immediate value, the least significant
bit is encoded in the sb postbyte and the higher four bits are encoded as a short-immediate value in the
xb postbyte. If the destination register is wider than the source operand, the source operand is
zero-extended to the width of the destination register before shifting. If the destination register is
narrower than the source operand, the operand is shifted and then truncated to the width of the
destination register. Zero is shifted into the LSB and the MSB is shifted out through the carry bit (C).
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
1n sb xb LSL Dd,Ds,Dn
1n sb LSL Dd,Ds,#opr1i
1n sb xb LSL.bwpl #oprsxe4i,#opr1i
1n sb xb LSL.bwpl Ds,#opr1i ;see more efficient REG-IMM version
1n sb xb LSL.bwpl (opru4,xys),#opr1i
1n sb xb LSL.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr1i
1n sb xb LSL.bwpl (Di,xys),#opr1i
1n sb xb LSL.bwpl [Di,xy],#opr1i
1n sb xb x1 LSL.bwpl (oprs9,xysp),#opr1i
1n sb xb x1 LSL.bwpl [oprs9,xysp],#opr1i
1n sb xb x1 LSL.bwpl opru14,#opr1i
1n sb xb x2 x1 LSL.bwpl (opru18,Di),#opr1i
1n sb xb x2 x1 LSL.bwpl opru18,#opr1i
1n sb xb x3 x2 x1 LSL.bwpl (opr24,xysp),#opr1i
1n sb xb x3 x2 x1 LSL.bwpl [opr24,xysp],#opr1i
1n sb xb x3 x2 x1 LSL.bwpl (opru24,Di),#opr1i
1n sb xb x3 x2 x1 LSL.bwpl opr24,#opr1i
1n sb xb x3 x2 x1 LSL.bwpl [opr24],#opr1i
1n sb xb xb LSL.bwpl #oprsxe4i,#opr5i
1n sb xb xb LSL.bwpl Di,#opr5i ;see more efficient REG-IMM version
1n sb xb xb LSL.bwpl (opru4,xys),#opr5i
1n sb xb xb LSL.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr5i
1n sb xb xb LSL.bwpl (Di,xys),#opr5i
1n sb xb xb LSL.bwpl [Di,xy],#opr5i
1n sb xb x1 xb LSL.bwpl (oprs9,xysp),#opr5i
1n sb xb x1 xb LSL.bwpl [oprs9,xysp],#opr5i
1n sb xb x1 xb LSL.bwpl opru14,#opr5i
1n sb xb x2 x1 xb LSL.bwpl (opru18,Di),#opr5i
1n sb xb x2 x1 xb LSL.bwpl opru18,#opr5i
1n sb xb x3 x2 x1 xb LSL.bwpl (opr24,xysp),#opr5i
1n sb xb x3 x2 x1 xb LSL.bwpl [opr24,xysp],#opr5i
1n sb xb x3 x2 x1 xb LSL.bwpl (opru24,Di),#opr5i
1n sb xb x3 x2 x1 xb LSL.bwpl opr24,#opr5i
1n sb xb x3 x2 x1 xb LSL.bwpl [opr24],#opr5i
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 0 DESTINATION REGISTER Dd 1n
A/L=0 L/R=1 1 1 N[0] 0 SIZE (.B, .W, .P, .L) sb
OPR POSTBYTE (for source operand) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for number of shifts - byte sized memory operands) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
The .bwpl suffix on the instruction mnemonic refers to the size (byte, word, pointer, or long) of the
source operand. The parameter operand is always the low five bits in a byte sized memory operand.
1n sb xb LSL.bwpl #oprsxe4i,#opr1i
1n sb xb LSL.bwpl Ds,#opr1i ;see more efficient REG-IMM version
1n sb xb LSL.bwpl (opru4,xys),#opr1i
1n sb xb LSL.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr1i
1n sb xb LSL.bwpl (Di,xys),#opr1i
1n sb xb LSL.bwpl [Di,xy],#opr1i
1n sb xb x1 LSL.bwpl (oprs9,xysp),#opr1i
1n sb xb x1 LSL.bwpl [oprs9,xysp],#opr1i
1n sb xb x1 LSL.bwpl opru14,#opr1i
1n sb xb x2 x1 LSL.bwpl (opru18,Di),#opr1i
1n sb xb x2 x1 LSL.bwpl opru18,#opr1i
1n sb xb x3 x2 x1 LSL.bwpl (opr24,xysp),#opr1i
1n sb xb x3 x2 x1 LSL.bwpl [opr24,xysp],#opr1i
1n sb xb x3 x2 x1 LSL.bwpl (opru24,Di),#opr1i
1n sb xb x3 x2 x1 LSL.bwpl opr24,#opr1i
1n sb xb x3 x2 x1 LSL.bwpl [opr24],#opr1i
Instruction Fields
A/L - This bit selects arithmetic (1) or logical (0) shifts.
L/R - This bit selects the shift direction, left (1) or right (0).
DESTINATION REGISTER Dd - This field specifies data register Dd (0:0:0=D2, 0:0:1=D3,
0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) where the result of the shift is
stored.
SOURCE REGISTER Ds - This field specifies data register Ds (0:0:0=D2, 0:0:1=D3, 0:1:0=D4,
0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is the source operand to be shifted.
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the number of positions (0–31) to shift the operand. Only the low-order 5 bits of the parameter
register are used.
N[0] - This field contains the least significant bit of the 5-bit immediate operand n=0–31, or in the case
of the efficient shifts, this bit selects shifting by 1 (N[0]=0) or shifting by 2 (N[0]=1).
N[4:1] - This field contains the upper four bits of the 5-bit immediate operand n=0–31.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the source operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location. In
the case of the parameter operand, short immediate mode is used to specify the upper four bits of the
5-bit immediate value that specifies the number of bit positions to shift the source operand.
0
MSB LSB C
Description
Logically shift an operand n bit-positions to the right. The result is saved in a CPU register, or in the
case of a 2-operand memory shift the result is saved in the same memory location used for the source.
The operand to be shifted may be one of the eight data registers or an 8-, 16-, 24-, or 32-bit memory
operand. In the case of the general OPR addressing operand, oprmemreg can be a data register, a
memory operand at a 14- 18- or 24-bit extended address, or a memory operand that is addressed with
indexed or indirect addressing mode. The number of bit positions to shift the operand is supplied in a
1-bit or 5-bit immediate operand or in the low order 5 bits of a register or byte-sized memory operand.
When the number of bit positions to shift is provided in a 5-bit immediate value, the least significant
bit is encoded in the sb postbyte and the higher four bits are encoded as a short-immediate value in the
xb postbyte. If the destination register is wider than the source operand, the source operand is
zero-extended to the width of the destination register before shifting. If the destination register is
narrower than the source operand, the operand is shifted and then truncated to the width of the
destination register. Zero is shifted into the LSB and the MSB is shifted out through the carry bit (C).
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 ∆
N: Normally cleared. Set if MSB was set and shift count was 0 (no shift).
Z: Set if the result is zero. Cleared otherwise.
V: Normally cleared. Set if truncation changes the sign or magnitude of the result.
C: Set if the last bit shifted out of the LSB of the operand was set before the shift, cleared
otherwise. If the shift count is 0, C is not changed.
1n sb xb LSR Dd,Ds,Dn
1n sb LSR Dd,Ds,#opr1i
1n sb xb LSR.bwpl #oprsxe4i,#opr1i
1n sb xb LSR.bwpl Ds,#opr1i ;see more efficient REG-IMM version
1n sb xb LSR.bwpl (opru4,xys),#opr1i
1n sb xb LSR.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr1i
1n sb xb LSR.bwpl (Di,xys),#opr1i
1n sb xb LSR.bwpl [Di,xy],#opr1i
1n sb xb x1 LSR.bwpl (oprs9,xysp),#opr1i
1n sb xb x1 LSR.bwpl [oprs9,xysp],#opr1i
1n sb xb x1 LSR.bwpl opru14,#opr1i
1n sb xb x2 x1 LSR.bwpl (opru18,Di),#opr1i
1n sb xb x2 x1 LSR.bwpl opru18,#opr1i
1n sb xb x3 x2 x1 LSR.bwpl (opr24,xysp),#opr1i
1n sb xb x3 x2 x1 LSR.bwpl [opr24,xysp],#opr1i
1n sb xb x3 x2 x1 LSR.bwpl (opru24,Di),#opr1i
1n sb xb x3 x2 x1 LSR.bwpl opr24,#opr1i
1n sb xb x3 x2 x1 LSR.bwpl [opr24],#opr1i
1n sb xb xb LSR.bwpl #oprsxe4i,#opr5i
1n sb xb xb LSR.bwpl Di,#opr5i ;see more efficient REG-IMM version
1n sb xb xb LSR.bwpl (opru4,xys),#opr5i
1n sb xb xb LSR.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr5i
1n sb xb xb LSR.bwpl (Di,xys),#opr5i
1n sb xb xb LSR.bwpl [Di,xy],#opr5i
1n sb xb x1 xb LSR.bwpl (oprs9,xysp),#opr5i
1n sb xb x1 xb LSR.bwpl [oprs9,xysp],#opr5i
1n sb xb x1 xb LSR.bwpl opru14,#opr5i
1n sb xb x2 x1 xb LSR.bwpl (opru18,Di),#opr5i
1n sb xb x2 x1 xb LSR.bwpl opru18,#opr5i
1n sb xb x3 x2 x1 xb LSR.bwpl (opr24,xysp),#opr5i
1n sb xb x3 x2 x1 xb LSR.bwpl [opr24,xysp],#opr5i
1n sb xb x3 x2 x1 xb LSR.bwpl (opru24,Di),#opr5i
1n sb xb x3 x2 x1 xb LSR.bwpl opr24,#opr5i
1n sb xb x3 x2 x1 xb LSR.bwpl [opr24],#opr5i
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 0 DESTINATION REGISTER Dd 1n
A/L=0 L/R=0 1 1 N[0] 0 SIZE (.B, .W, .P, .L) sb
OPR POSTBYTE (for source operand) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for number of shifts - byte sized memory operands) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
The .bwpl suffix on the instruction mnemonic refers to the size (byte, word, pointer, or long) of the
source operand. The parameter operand is always the low five bits in a byte sized memory operand.
1n sb xb LSR.bwpl #oprsxe4i,#opr1i
1n sb xb LSR.bwpl Ds,#opr1i ;see more efficient REG-IMM version
1n sb xb LSR.bwpl (opru4,xys),#opr1i
1n sb xb LSR.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},#opr1i
1n sb xb LSR.bwpl (Di,xys),#opr1i
1n sb xb LSR.bwpl [Di,xy],#opr1i
1n sb xb x1 LSR.bwpl (oprs9,xysp),#opr1i
1n sb xb x1 LSR.bwpl [oprs9,xysp],#opr1i
1n sb xb x1 LSR.bwpl opru14,#opr1i
1n sb xb x2 x1 LSR.bwpl (opru18,Di),#opr1i
1n sb xb x2 x1 LSR.bwpl opru18,#opr1i
1n sb xb x3 x2 x1 LSR.bwpl (opr24,xysp),#opr1i
1n sb xb x3 x2 x1 LSR.bwpl [opr24,xysp],#opr1i
1n sb xb x3 x2 x1 LSR.bwpl (opru24,Di),#opr1i
1n sb xb x3 x2 x1 LSR.bwpl opr24,#opr1i
1n sb xb x3 x2 x1 LSR.bwpl [opr24],#opr1i
Instruction Fields
A/L - This bit selects arithmetic (1) or logical (0) shifts.
L/R - This bit selects the shift direction, left (1) or right (0).
DESTINATION REGISTER Dd - This field specifies data register Dd (0:0:0=D2, 0:0:1=D3,
0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) where the result of the shift is
stored.
SOURCE REGISTER Ds - This field specifies data register Ds (0:0:0=D2, 0:0:1=D3, 0:1:0=D4,
0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is the source operand to be shifted.
PARAMETER REGISTER Dn - This field specifies the number of the data register Dn (0:0:0=D2,
0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7) which is used to
specify the number of positions (0–31) to shift the operand. Only the low-order 5 bits of the parameter
register are used.
N[0] - This field contains the least significant bit of the 5-bit immediate operand n=0–31, or in the case
of the efficient shifts, this bit selects shifting by 1 (N[0]=0) or shifting by 2 (N[0]=1).
N[4:1] - This field contains the upper four bits of the 5-bit immediate operand n=0–31.
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the source operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location. In
the case of the parameter operand, short immediate mode is used to specify the upper four bits of the
5-bit immediate value that specifies the number of bit positions to shift the source operand.
Description
Multiplies two signed two’s complement operands, adds this product to a register Dd, and stores the
accumulated result to register Dd. The first source operand may be a register Dj or an 8-bit (.B), 16-bit
(.W), 24-bit (.P), or 32-bit (.L) memory operand M1. The second source operand may be a register Dk,
an 8-bit, 16-bit , or 32-bit immediate value, or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L)
memory operand M or M2. Both source operands and the result are interpreted as signed two’s
complement values.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
1B 4q mb MACS Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 1 0 0 1 RESULT REGISTER Dd 4q
1 1 SOURCE REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
1B 4q mb i1 MACS.B Dd,Dj,#opr8i
1B 4q mb i2 i1 MACS.W Dd,Dj,#opr16i ;short-imm better for some values
1B 4q mb i4 i3 i2 i1 MACS.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 1 0 0 1 RESULT REGISTER Dd 4q
1 1 SOURCE REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 4q mb xb MACS.bwl Dd,Dj,#oprsxe4i
1B 4q mb xb MACS.bwl Dd,Dj,Dk ;see more efficient REG-REG version
1B 4q mb xb MACS.bwl Dd,Dj,(opru4,xys)
1B 4q mb xb MACS.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
1B 4q mb xb MACS.bwl Dd,Dj,(Di,xys)
1B 4q mb xb MACS.bwl Dd,Dj,[Di,xy]
1B 4q mb xb x1 MACS.bwl Dd,Dj,(oprs9,xysp)
1B 4q mb xb x1 MACS.bwl Dd,Dj,[oprs9,xysp]
1B 4q mb xb x1 MACS.bwl Dd,Dj,opru14
1B 4q mb xb x2 x1 MACS.bwl Dd,Dj,(opru18,Di)
1B 4q mb xb x2 x1 MACS.bwl Dd,Dj,opru18
1B 4q mb xb x3 x2 x1 MACS.bwl Dd,Dj,(opr24,xysp)
1B 4q mb xb x3 x2 x1 MACS.bwl Dd,Dj,[opr24,xysp]
1B 4q mb xb x3 x2 x1 MACS.bwl Dd,Dj,(opru24,Di)
1B 4q mb xb x3 x2 x1 MACS.bwl Dd,Dj,opr24
1B 4q mb xb x3 x2 x1 MACS.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 1 0 0 1 RESULT REGISTER Dd 4q
1 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
RESULT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE REGISTER or SOURCE 1 REGISTER - This field specifies the number of the data register
Dj used as an operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE 2 REGISTER - This field specifies the number of the data register Dk used as the second
operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the divisor. The 0b10 combination is not available for the REG-IMM1/2/4 version of the
instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 and M2 which use the general OPR
addressing mode to specify short-immediate, register, or memory operands (0b00 = 8-bit byte, 0b01 =
16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a short-immediate operand is
specified, it is internally sign-extended to the size specified by the M1_SIZE and/or M2_SIZE
specifications. When a register is specified, it determines the size and the M1_SIZE and/or M2_SIZE
specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both source operands, is less efficient
than using the REG-REG version of the instruction.
Description
Multiplies two unsigned operands, adds this product to a register Dd, and stores the accumulated result
to register Dd. The first source operand may be a register Dj or an 8-bit (.B), 16-bit (.W), 24-bit (.P),
or 32-bit (.L) memory operand M1. The second source operand may be a register Dk, an 8-bit, 16-bit
, or 32-bit immediate value, or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand M
or M2. Both source operands and the result are interpreted as unsigned values.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
1B 4q mb MACU Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 1 0 0 1 RESULT REGISTER Dd 4q
0 1 SOURCE REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
1B 4q mb i1 MACU.B Dd,Dj,#opr8i
1B 4q mb i2 i1 MACU.W Dd,Dj,#opr16i ;short-imm better for some values
1B 4q mb i4 i3 i2 i1 MACU.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 1 0 0 1 RESULT REGISTER Dd 4q
0 1 SOURCE REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 4q mb xb MACU.bwl Dd,Dj,#oprsxe4i
1B 4q mb xb MACU.bwl Dd,Dj,Dk ;see more efficient REG-REG version
1B 4q mb xb MACU.bwl Dd,Dj,(opru4,xys)
1B 4q mb xb MACU.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
1B 4q mb xb MACU.bwl Dd,Dj,(Di,xys)
1B 4q mb xb MACU.bwl Dd,Dj,[Di,xy]
1B 4q mb xb x1 MACU.bwl Dd,Dj,(oprs9,xysp)
1B 4q mb xb x1 MACU.bwl Dd,Dj,[oprs9,xysp]
1B 4q mb xb x1 MACU.bwl Dd,Dj,opru14
1B 4q mb xb x2 x1 MACU.bwl Dd,Dj,(opru18,Di)
1B 4q mb xb x2 x1 MACU.bwl Dd,Dj,opru18
1B 4q mb xb x3 x2 x1 MACU.bwl Dd,Dj,(opr24,xysp)
1B 4q mb xb x3 x2 x1 MACU.bwl Dd,Dj,[opr24,xysp]
1B 4q mb xb x3 x2 x1 MACU.bwl Dd,Dj,(opru24,Di)
1B 4q mb xb x3 x2 x1 MACU.bwl Dd,Dj,opr24
1B 4q mb xb x3 x2 x1 MACU.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 1 0 0 1 RESULT REGISTER Dd 4q
0 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
RESULT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE REGISTER or SOURCE 1 REGISTER - This field specifies the number of the data register
Dj used as an operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE 2 REGISTER - This field specifies the number of the data register Dk used as the second
operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the divisor. The 0b10 combination is not available for the REG-IMM1/2/4 version of the
instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 and M2 which use the general OPR
addressing mode to specify short-immediate, register, or memory operands (0b00 = 8-bit byte, 0b01 =
16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a short-immediate operand is
specified, it is internally sign-extended to the size specified by the M1_SIZE and/or M2_SIZE
specifications. When a register is specified, it determines the size and the M1_SIZE and/or M2_SIZE
specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both source operands, is less efficient
than using the REG-REG version of the instruction.
Description
Subtracts the signed value of memory operand M from the signed value in register Di to determine
which is larger. The larger of the two values is stored in register Di. The size of memory operand M is
determined by the size of register Di.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
1B 2q xb x2 x1 MAXS Di,opru18
1B 2q xb x3 x2 x1 MAXS Di,(opr24,xysp)
1B 2q xb x3 x2 x1 MAXS Di,[opr24,xysp]
1B 2q xb x3 x2 x1 MAXS Di,(opru24,Dj)
1B 2q xb x3 x2 x1 MAXS Di,opr24
1B 2q xb x3 x2 x1 MAXS Di,[opr24]
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Subtracts the unsigned value of memory operand M from the unsigned value in register Di to determine
which is larger. The larger of the two values is stored in register Di. The size of memory operand M is
determined by the size of register Di.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
1B 1q xb x2 x1 MAXU Di,opru18
1B 1q xb x3 x2 x1 MAXU Di,(opr24,xysp)
1B 1q xb x3 x2 x1 MAXU Di,[opr24,xysp]
1B 1q xb x3 x2 x1 MAXU Di,(opru24,Dj)
1B 1q xb x3 x2 x1 MAXU Di,opr24
1B 1q xb x3 x2 x1 MAXU Di,[opr24]
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Subtracts the signed value of memory operand M from the signed value in register Di to determine
which is smaller. The smaller of the two values is stored in register Di. The size of memory operand
M is determined by the size of register Di.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
1B 2n xb x2 x1 MINS Di,opru18
1B 2n xb x3 x2 x1 MINS Di,(opr24,xysp)
1B 2n xb x3 x2 x1 MINS Di,[opr24,xysp]
1B 2n xb x3 x2 x1 MINS Di,(opru24,Dj)
1B 2n xb x3 x2 x1 MINS Di,opr24
1B 2n xb x3 x2 x1 MINS Di,[opr24]
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Subtracts the unsigned value of memory operand M from the unsigned value in register Di to determine
which is smaller. The smaller of the two values is stored in register Di. The size of memory operand
M is determined by the size of register Di.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
1B 1n xb x2 x1 MINU Di,opru18
1B 1n xb x3 x2 x1 MINU Di,(opr24,xysp)
1B 1n xb x3 x2 x1 MINU Di,[opr24,xysp]
1B 1n xb x3 x2 x1 MINU Di,(opru24,Dj)
1B 1n xb x3 x2 x1 MINU Di,opr24
1B 1n xb x3 x2 x1 MINU Di,[opr24]
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Divides a signed two’s complement dividend by a signed two’s complement divisor to produce a signed
two’s complement remainder in a register Dd. The dividend may be a register Dj or an 8-bit (.B), 16-bit
(.W), 24-bit (.P), or 32-bit (.L) memory operand M1. The divisor may be a register Dk, an 8-bit, 16-bit,
or 32-bit immediate value, or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand M
or M2. To ensure compatibility with the C standard requirement that a = (a/b)*b + (a % b), the sign of
the result (remainder) is the same as the sign of the dividend.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
N: Set if the MSB of the result is set. Undefined after overflow or division by
zero. Cleared otherwise.
Z: Set if the result is zero. Undefined after overflow or division by zero.
Cleared otherwise.
V: Set if the signed remainder does not fit in the result register Dd. Undefined
after division by zero. Cleared otherwise.
C: Set if divisor was zero. Cleared otherwise. (Indicates division by zero).
1B 3q mb MODS Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 1 RESULT REGISTER Dd 3q
1 1 DIVIDEND REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA (Divisor)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
1B 3q mb i1 MODS.B Dd,Dj,#opr8i
1B 3q mb i2 i1 MODS.W Dd,Dj,#opr16i ;short-imm better for some values
1B 3q mb i4 i3 i2 i1 MODS.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 1 RESULT REGISTER Dd 3q
1 1 DIVIDEND REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2 divisor) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 3q mb xb MODS.bwl Dd,Dj,#oprsxe4i
1B 3q mb xb MODS.bwl Dd,Dj,Dk ;see more efficient REG-REG version
1B 3q mb xb MODS.bwl Dd,Dj,(opru4,xys)
1B 3q mb xb MODS.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
1B 3q mb xb MODS.bwl Dd,Dj,(Di,xys)
1B 3q mb xb MODS.bwl Dd,Dj,[Di,xy]
1B 3q mb xb x1 MODS.bwl Dd,Dj,(oprs9,xysp)
1B 3q mb xb x1 MODS.bwl Dd,Dj,[oprs9,xysp]
1B 3q mb xb x1 MODS.bwl Dd,Dj,opru14
1B 3q mb xb x2 x1 MODS.bwl Dd,Dj,(opru18,Di)
1B 3q mb xb x2 x1 MODS.bwl Dd,Dj,opru18
1B 3q mb xb x3 x2 x1 MODS.bwl Dd,Dj,(opr24,xysp)
1B 3q mb xb x3 x2 x1 MODS.bwl Dd,Dj,[opr24,xysp]
1B 3q mb xb x3 x2 x1 MODS.bwl Dd,Dj,(opru24,Di)
1B 3q mb xb x3 x2 x1 MODS.bwl Dd,Dj,opr24
1B 3q mb xb x3 x2 x1 MODS.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 1 RESULT REGISTER Dd 3q
1 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1 dividend) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2 divisor) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
RESULT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
DIVIDEND REGISTER - This field specifies the number of the data register Dj used as dividend
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
DIVISOR REGISTER - This field specifies the number of the data register Dk used as divisor
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the divisor. The 0b10 combination is not available for the REG-IMM1/2/4 version of the
instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 (dividend) and M2 (divisor) which use
the general OPR addressing mode to specify short-immediate, register, or memory operands (0b00 =
8-bit byte, 0b01 = 16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a
short-immediate operand is specified, it is internally sign-extended to the size specified by the
M1_SIZE and/or M2_SIZE specifications. When a register is specified, it determines the size and the
M1_SIZE and/or M2_SIZE specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both the dividend and the divisor, is less
efficient than using the REG-REG version of the instruction.
Description
Divides an unsigned dividend by an unsigned divisor to produce an unsigned remainder in a register
Dd. The dividend may be a register Dj or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory
operand M1. The divisor may be a register Dk, an 8-bit, 16-bit, or 32-bit immediate value, or an 8-bit
(.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand M or M2.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
N: Set if the MSB of the result is set. Undefined after overflow or division by
zero. Cleared otherwise.
Z: Set if the result is zero. Undefined after overflow or division by zero.
Cleared otherwise.
V: Set if the unsigned remainder does not fit in the result register Dd.
Undefined after division by zero. Cleared otherwise.
C: Set if divisor was zero. Cleared otherwise. (Indicates division by zero).
1B 3q mb MODU Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 1 RESULT REGISTER Dd 3q
0 1 DIVIDEND REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA (divisor)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
1B 3q mb i1 MODU.B Dd,Dj,#opr8i
1B 3q mb i2 i1 MODU.W Dd,Dj,#opr16i ;short-imm better for some values
1B 3q mb i4 i3 i2 i1 MODU.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 1 RESULT REGISTER Dd 3q
0 1 DIVIDEND REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2 divisor) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B 3q mb xb MODU.bwl Dd,Dj,#oprsxe4i
1B 3q mb xb MODU.bwl Dd,Dj,Dk ;see more efficient REG-REG version
1B 3q mb xb MODU.bwl Dd,Dj,(opru4,xys)
1B 3q mb xb MODU.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
1B 3q mb xb MODU.bwl Dd,Dj,(Di,xys)
1B 3q mb xb MODU.bwl Dd,Dj,[Di,xy]
1B 3q mb xb x1 MODU.bwl Dd,Dj,(oprs9,xysp)
1B 3q mb xb x1 MODU.bwl Dd,Dj,[oprs9,xysp]
1B 3q mb xb x1 MODU.bwl Dd,Dj,opru14
1B 3q mb xb x2 x1 MODU.bwl Dd,Dj,(opru18,Di)
1B 3q mb xb x2 x1 MODU.bwl Dd,Dj,opru18
1B 3q mb xb x3 x2 x1 MODU.bwl Dd,Dj,(opr24,xysp)
1B 3q mb xb x3 x2 x1 MODU.bwl Dd,Dj,[opr24,xysp]
1B 3q mb xb x3 x2 x1 MODU.bwl Dd,Dj,(opru24,Di)
1B 3q mb xb x3 x2 x1 MODU.bwl Dd,Dj,opr24
1B 3q mb xb x3 x2 x1 MODU.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 1 1 1 RESULT REGISTER Dd 3q
0 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1 dividend) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2 divisor) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
RESULT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
DIVIDEND REGISTER - This field specifies the number of the data register Dj used as dividend
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
DIVISOR REGISTER - This field specifies the number of the data register Dk used as divisor
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the divisor. The 0b10 combination is not available for the REG-IMM1/2/4 version of the
instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 (dividend) and M2 (divisor) which use
the general OPR addressing mode to specify short-immediate, register, or memory operands (0b00 =
8-bit byte, 0b01 = 16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a
short-immediate operand is specified, it is internally sign-extended to the size specified by the
M1_SIZE and/or M2_SIZE specifications. When a register is specified, it determines the size and the
M1_SIZE and/or M2_SIZE specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both the dividend and the divisor, is less
efficient than using the REG-REG version of the instruction.
Description
Move (copy) an 8-bit, 16-bit, 24-bit, or 32-bit immediate value to a memory location of the same size
(or a register Di), or move (copy) 8-bits, 16-bits, 24-bits, or 32-bits from one memory location (or
register Di) to another memory location of the same size (or register Dj). The size of the operation is
normally specified by the dot suffix B, W, P, or L on the MOV instruction.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – − − − −
0F i4 i3 i2 i1 xb x3 x2 x1 MOV.L #opr32i,opr24
0F i4 i3 i2 i1 xb x3 x2 x1 MOV.L #opr32i,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 1 SIZE (.B, .W, .P, .L) 1p
OPR POSTBYTE (for source) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for destination) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SIZE - This field specifies the size of the memory value to move (0b00 = 8-bit byte, 0b01 = 16-bit word,
0b10 = 24-bit pointer, and 0b11 = 32-bit long-word).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes, 3 bytes, or 4 bytes wide, depending on the size specified by SIZE
or by the instrruction opcode.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a short-immediate operand for the destination, is not
appropriate because the move instruction cannot modify the immediate operand.
Description
Multiplies two signed two’s complement operands and stores the signed two’s complement result to
register Dd. The first source operand may be a register Dj or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or
32-bit (.L) memory operand M1. The second source operand may be a register Dk, an 8-bit, 16-bit , or
32-bit immediate value, or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand M or
M2. Both source operands and the result are interpreted as signed two’s complement values.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ 0
4q mb MULS Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 1 0 0 1 RESULT REGISTER Dd 4q
1 1 SOURCE REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
4q mb i1 MULS.B Dd,Dj,#opr8i
4q mb i2 i1 MULS.W Dd,Dj,#opr16i ;short-imm better for some values
4q mb i4 i3 i2 i1 MULS.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 1 0 0 1 RESULT REGISTER Dd 4q
1 1 SOURCE REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
4q mb xb MULS.bwl Dd,Dj,#oprsxe4i
4q mb xb MULS.bwl Dd,Dj,Dk ;see more efficient REG-REG version
4q mb xb MULS.bwl Dd,Dj,(opru4,xys)
4q mb xb MULS.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
4q mb xb MULS.bwl Dd,Dj,(Di,xys)
4q mb xb MULS.bwl Dd,Dj,[Di,xy]
4q mb xb x1 MULS.bwl Dd,Dj,(oprs9,xysp)
4q mb xb x1 MULS.bwl Dd,Dj,[oprs9,xysp]
4q mb xb x1 MULS.bwl Dd,Dj,opru14
4q mb xb x2 x1 MULS.bwl Dd,Dj,(opru18,Di)
4q mb xb x2 x1 MULS.bwl Dd,Dj,opru18
4q mb xb x3 x2 x1 MULS.bwl Dd,Dj,(opr24,xysp)
4q mb xb x3 x2 x1 MULS.bwl Dd,Dj,[opr24,xysp]
4q mb xb x3 x2 x1 MULS.bwl Dd,Dj,(opru24,Di)
4q mb xb x3 x2 x1 MULS.bwl Dd,Dj,opr24
4q mb xb x3 x2 x1 MULS.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 1 0 0 1 RESULT REGISTER Dd 4q
1 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
RESULT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE REGISTER or SOURCE 1 REGISTER - This field specifies the number of the data register
Dj used as an operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE 2 REGISTER - This field specifies the number of the data register Dk used as the second
operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the immediate operand. The 0b10 combination is not available for the REG-IMM1/2/4
version of the instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 and M2 which use the general OPR
addressing mode to specify short-immediate, register, or memory operands (0b00 = 8-bit byte, 0b01 =
16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a short-immediate operand is
specified, it is internally sign-extended to the size specified by the M1_SIZE and/or M2_SIZE
specifications. When a register is specified, it determines the size and the M1_SIZE and/or M2_SIZE
specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both source operands, is less efficient
than using the REG-REG version of the instruction.
Description
Multiplies two unsigned operands and stores the unsigned result to register Dd. The first source
operand may be a register Dj or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand
M1. The second source operand may be a register Dk, an 8-bit, 16-bit , or 32-bit immediate value, or
an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand M or M2. Both source operands
and the result are interpreted as unsigned values.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ 0
4q mb MULU Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 1 0 0 1 RESULT REGISTER Dd 4q
0 1 SOURCE REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
4q mb i1 MULU.B Dd,Dj,#opr8i
4q mb i2 i1 MULU.W Dd,Dj,#opr16i ;short-imm better for some values
4q mb i4 i3 i2 i1 MULU.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 1 0 0 1 RESULT REGISTER Dd 4q
0 1 SOURCE REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
4q mb xb MULU.bwl Dd,Dj,#oprsxe4i
4q mb xb MULU.bwl Dd,Dj,Dk ;see more efficient REG-REG version
4q mb xb MULU.bwl Dd,Dj,(opru4,xys)
4q mb xb MULU.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
4q mb xb MULU.bwl Dd,Dj,(Di,xys)
4q mb xb MULU.bwl Dd,Dj,[Di,xy]
4q mb xb x1 MULU.bwl Dd,Dj,(oprs9,xysp)
4q mb xb x1 MULU.bwl Dd,Dj,[oprs9,xysp]
4q mb xb x1 MULU.bwl Dd,Dj,opru14
4q mb xb x2 x1 MULU.bwl Dd,Dj,(opru18,Di)
4q mb xb x2 x1 MULU.bwl Dd,Dj,opru18
4q mb xb x3 x2 x1 MULU.bwl Dd,Dj,(opr24,xysp)
4q mb xb x3 x2 x1 MULU.bwl Dd,Dj,[opr24,xysp]
4q mb xb x3 x2 x1 MULU.bwl Dd,Dj,(opru24,Di)
4q mb xb x3 x2 x1 MULU.bwl Dd,Dj,opr24
4q mb xb x3 x2 x1 MULU.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 1 0 0 1 RESULT REGISTER Dd 4q
0 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
RESULT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE REGISTER or SOURCE 1 REGISTER - This field specifies the number of the data register
Dj used as an operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE 2 REGISTER - This field specifies the number of the data register Dk used as the second
operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the immediate operand. The 0b10 combination is not available for the REG-IMM1/2/4
version of the instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 and M2 which use the general OPR
addressing mode to specify short-immediate, register, or memory operands (0b00 = 8-bit byte, 0b01 =
16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a short-immediate operand is
specified, it is internally sign-extended to the size specified by the M1_SIZE and/or M2_SIZE
specifications. When a register is specified, it determines the size and the M1_SIZE and/or M2_SIZE
specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both source operands, is less efficient
than using the REG-REG version of the instruction.
Description
Replaces the content of memory location M with its two’s complement. The memory operand
oprmemreg can be a data register, a memory operand at a 14- 18- or 24-bit extended address, or a
memory operand that is addressed with indexed or indirect addressing mode. The size of the memory
operand M is determined by the suffix (.B=8 bit byte, .W=16 bit word, or .L=32 bit long-word). If the
OPR memory addressing mode is used to specify a data register Dj, the register determines the size for
the operation and the .bwl suffix is ignored. It is inappropriate to specify a short immediate operand
using the OPR addressing mode for this instruction because it is not possible to modify the immediate
operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
Dp xb NEG.bwl [Di,xy]
Dp xb x1 NEG.bwl (oprs9,xysp)
Dp xb x1 NEG.bwl [oprs9,xysp]
Dp xb x1 NEG.bwl opru14
Dp xb x2 x1 NEG.bwl (opru18,Di)
Dp xb x2 x1 NEG.bwl opru18
Dp xb x3 x2 x1 NEG.bwl (opr24,xysp)
Dp xb x3 x2 x1 NEG.bwl [opr24,xysp]
Dp xb x3 x2 x1 NEG.bwl (opru24,Di)
Dp xb x3 x2 x1 NEG.bwl opr24
Dp xb x3 x2 x1 NEG.bwl [opr24]
Instruction Fields
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), or 32-bit long-word (0b11) as the size
of the operation.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a data register, a 14- 18- or 24-bit
extended memory address, or an indexed or indexed-indirect memory location. It is inappropriate to
specify a short immediate operand using the OPR addressing mode for this instruction because it is
not possible to modify the immediate operand.
Description
This single-byte instruction increments the PC and does nothing else. No CPU registers are affected.
NOP is typically used to produce a time delay, although some software disciplines discourage CPU
frequency-based time delays. During debug, NOP instructions are sometimes used to temporarily
replace other machine code instructions, thus disabling the replaced instruction(s).
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − − − − − − − − −
01 NOP
OR Bitwise OR
OR
Operation
(Di) ⏐ (M) ⇒ Di
Syntax Variations Addressing Modes
OR Di,#oprimmsz IMM1/2/4
OR Di,oprmemreg OPR/1/2/3
Description
Bitwise OR register Di with a memory operand and store the result to Di. When the operand is an
immediate value, it has the same size as register Di. In the case of the general OPR addressing operand,
oprmemreg can be a sign-extended immediate value (–1, 1, 2, 3..14, 15), a data register, a memory
operand the same size as Di at a 14- 18- or 24-bit extended address, or a memory operand that is
addressed with indexed or indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 –
OPR/1/2/3
7 6 5 4 3 2 1 0
1 0 0 0 1 SD REGISTER Di 8q
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size of the register Di.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Performs a bitwise OR operation between the 8-bit immediate memory operand and the content of
CCL (the low order 8 bits of the CCR). The result is stored in CCL.
When the CPU is in user state, this instruction is restricted to changing the condition codes (the flags
N, Z, V, C) and cannot change the settings in the S, X, or I bits.
No software instruction can change the X bit from 0 to 1 in user or supervisor state.
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − ⇑ − − ⇑ ⇑ ⇑ ⇑ ⇑ supervisor state
− − − − − − − − − − ⇑ ⇑ ⇑ ⇑ user state
Condition code bits are set if the corresponding bit was 1 before the operation or if the corresponding
bit in the immediate mask is 1.
DE i1 ORCC #opr8i
Description
Push specified CPU registers onto stack.
There are two possible register lists (oprregs1, oprregs2) and two special cases:
• oprregs1 includes any combination of the registers CCH, CCL, D0, D1, D2, D3
• oprregs2 includes any combination of the registers D4, D5, D6, D7, X, Y
• If pb postbyte = 0x00, push all registers in the order Y,X,D7,D6,D5,D4,D3,D2,D1,D0,CCL,CCH
• If pb postbyte = 0x40, push all 4 16-bit registers in the order D5,D4,D3,D2
The registers to be pushed are encoded in an instruction postbyte (pb) which includes one mask bit for
each of the registers in the list as well as a control bit that specifies which list the registers are from and
whether they should be pushed or pulled. If a combination of registers includes random registers from
both lists, two PSH instructions are required. Registers are pushed starting with the lowest order byte
of the register that is furthest to the right in the list. The stack pointer is decremented by one for each
byte that is pushed onto the stack. After the PSH instruction, SP points at the last byte that was pushed.
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − − − − − − − − −
04 pb PSH oprregs1
04 pb PSH oprregs2
04 00 PSH ALL
04 40 PSH ALL16b
Instruction Fields
The MASK2/1 and R0..R5 fields specify the registers to be pushed onto the stack as listed in the table
below.
MASK2/1 R5 R4 R3 R2 R1 R0
0 CCH CCL D0 D1 D2 D3
1 D4 D5 D6 D7 X Y
The R0..R5 fields are treated as a mask to determine if the associated register is to be pushed on the
stack (“1”) or not (“0”).
The register are pushed on the stack in right-to-left sequence (the register associated with R0 is pushed
first, the register associated with R5 is pushed last).
Description
Pull specified CPU registers from stack.
There are two possible register lists (oprregs1, oprregs2) and two special cases:
• oprregs1 includes any combination of the registers CCH, CCL, D0, D1, D2, D3
• oprregs2 includes any combination of the registers D4, D5, D6, D7, X, Y
• If pb postbyte = 0x80, pull all registers in the order CCH,CCL,D0,D1,D2,D3,D4,D5,D6,D7,X,Y
• If pb postbyte = 0xC0, pull all 4 16-bit registers in the order D2,D3,D4,D5
The registers to be pulled are encoded in an instruction postbyte which includes one mask bit for each
of the registers in the list as well as a control bit that specifies which list the registers are from and
whether they should be pushed or pulled. If a combination of registers includes random registers from
both lists, two PUL instructions are required. Registers are pulled starting with the highest order byte
of the register that is furthest to the left in the list. The stack pointer is incremented by one for each
byte that is pulled from the stack. After the PUL instruction, SP points at the next higher address above
the last byte that was pulled.
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − − − − − − − − −
If CCH or CCL are pulled, the values pulled are written directly into the CCR and the CCR details
shown in the figure above do not apply. Unimplemented bits in the CCR can not be changed. In user
state, only the four flag bits N, Z, V, and C can be modified. In supervisor state, any of the implemented
CCR bits can be modified however the X bit can never be changed from 0 to 1 by any instruction in
any mode.
Instruction Fields
The MASK2/1 and R0..R5 fields specify the registers to be pulled from the stack as listed in the table
below.
MASK2/1 R5 R4 R3 R2 R1 R0
0 CCH CCL D0 D1 D2 D3
1 D4 D5 D6 D7 X Y
The R0..R5 fields are treated as a mask to determine if the associated register is to be pulled from the
stack (“1”) or not (“0”).
The register are pulled on the stack in left-to-right sequence (the register associated with R5 is pulled
first, the register associated with R0 is pulled last).
Description
Multiplies two signed fractional two’s complement operands and stores the signed fractional two’s
complement result to register Dd. The first source operand may be a register Dj or an 8-bit (.B), 16-bit
(.W), 24-bit (.P), or 32-bit (.L) memory operand M1. The second source operand may be a register Dk,
an 8-bit, 16-bit , or 32-bit immediate value, or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L)
memory operand M or M2.
Both source operands and the result are interpreted as signed fractional two’s complement numbers in
s.7, s.15, s.23 or s.31 formats as defined in ISO-C Technical Report TR 18037. That means the MSB
is interpreted as sign, the remaining 7, 15, 23 or 31 bits are interpreted as fractional portion of a
fixed-point number (also known as “Q”-format).
In order to allow operands of different sizes to be multiplied, the source operands are aligned. This
means that smaller operands are right-appended with zeroes to make the sizes of both operands match.
This ensures the alignment of the position of the binary point of the source operands before the actual
multiplication operation commences.
The content of the result register represents the most-significant portion of the actual multiplication
result. Any least significant multiplication result-bits not fitting into the result register are cut-off
without rounding.
If both source operands contain the representation of the minimum negative number of the fixed-point
range, this operation saturates. In this case the result is the representation of the maximum positive
number of the fixed-point range.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ 0
1B Bn mb QMULS Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
1 0 1 1 0 RESULT REGISTER Dd Bn
1 1 SOURCE REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
1B Bn mb i1 QMULS.B Dd,Dj,#opr8i
1B Bn mb i2 i1 QMULS.W Dd,Dj,#opr16i ;short-imm better for some values
1B Bn mb i4 i3 i2 i1 QMULS.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
1 0 1 1 0 RESULT REGISTER Dd Bn
1 1 SOURCE REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B Bn mb xb QMULS.bwl Dd,Dj,#oprsxe4i
1B Bn mb xb QMULS.bwl Dd,Dj,Dk ;see more efficient REG-REG version
1B Bn mb xb QMULS.bwl Dd,Dj,(opru4,xys)
1B Bn mb xb QMULS.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
1B Bn mb xb QMULS.bwl Dd,Dj,(Di,xys)
1B Bn mb xb QMULS.bwl Dd,Dj,[Di,xy]
1B Bn mb xb x1 QMULS.bwl Dd,Dj,(oprs9,xysp)
1B Bn mb xb x1 QMULS.bwl Dd,Dj,[oprs9,xysp]
1B Bn mb xb x1 QMULS.bwl Dd,Dj,opru14
1B Bn mb xb x2 x1 QMULS.bwl Dd,Dj,(opru18,Di)
1B Bn mb xb x2 x1 QMULS.bwl Dd,Dj,opru18
1B Bn mb xb x3 x2 x1 QMULS.bwl Dd,Dj,(opr24,xysp)
1B Bn mb xb x3 x2 x1 QMULS.bwl Dd,Dj,[opr24,xysp]
1B Bn mb xb x3 x2 x1 QMULS.bwl Dd,Dj,(opru24,Di)
1B Bn mb xb x3 x2 x1 QMULS.bwl Dd,Dj,opr24
1B Bn mb xb x3 x2 x1 QMULS.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
1 0 1 1 0 RESULT REGISTER Dd Bn
1 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
RESULT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE REGISTER or SOURCE 1 REGISTER - This field specifies the number of the data register
Dj used as an operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE 2 REGISTER - This field specifies the number of the data register Dk used as the second
operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the immediate operand. The 0b10 combination is not available for the REG-IMM1/2/4
version of the instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 and M2 which use the general OPR
addressing mode to specify short-immediate, register, or memory operands (0b00 = 8-bit byte, 0b01 =
16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a short-immediate operand is
specified, it is internally sign-extended to the size specified by the M1_SIZE and/or M2_SIZE
specifications. When a register is specified, it determines the size and the M1_SIZE and/or M2_SIZE
specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both source operands, is less efficient
than using the REG-REG version of the instruction.
Description
Multiplies two unsigned operands and stores the unsigned result to register Dd. The first source
operand may be a register Dj or an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand
M1. The second source operand may be a register Dk, an 8-bit, 16-bit , or 32-bit immediate value, or
an 8-bit (.B), 16-bit (.W), 24-bit (.P), or 32-bit (.L) memory operand M or M2. Both source operands
and the result are interpreted as unsigned values.
Both source operands and the result are interpreted as unsigned numbers in .8, .16, .24 or .32 formats
as defined in ISO-C Technical Report TR 18037. That means all 8, 16, 24 or 32 bits are interpreted as
fractional portion of a fixed-point number (also known as “Q”-format).
In order to allow operands of different sizes to be multiplied, the source operands are aligned. This
means that smaller operands are right-appended with zeroes to make the sizes of both operands match.
This ensures the alignment of the position of the binary point of the source operands before the actual
multiplication operation commences.
The content of the result register represents the most-significant portion of the actual multiplication
result. Any least significant multiplication result-bits not fitting into the result register are cut-off
without rounding.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 0
1B Bn mb QMULU Dd,Dj,Dk
REG-IMM1/2/4
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
1 0 1 1 0 RESULT REGISTER Dd Bn
0 1 SOURCE REGISTER Dj 1 IMM_SIZE (.B, .W, –, .L) mb
IMMEDIATE DATA
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE SPECIFIED IN SUFFIX)
1B Bn mb i1 QMULU.B Dd,Dj,#opr8i
1B Bn mb i2 i1 QMULU.W Dd,Dj,#opr16i ;short-imm better for some values
1B Bn mb i4 i3 i2 i1 QMULU.L Dd,Dj,#opr32i ;short-imm better for some values
REG-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
1 0 1 1 0 RESULT REGISTER Dd Bn
0 1 SOURCE REGISTER Dj M2_SIZE (.B, .W, –, .L) mb
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
1B Bn mb xb QMULU.bwl Dd,Dj,#oprsxe4i
1B Bn mb xb QMULU.bwl Dd,Dj,Dk ;see more efficient REG-REG version
1B Bn mb xb QMULU.bwl Dd,Dj,(opru4,xys)
1B Bn mb xb QMULU.bwl Dd,Dj,{(+-xy)|(xy+-)|(-s)|(s+)}
1B Bn mb xb QMULU.bwl Dd,Dj,(Di,xys)
1B Bn mb xb QMULU.bwl Dd,Dj,[Di,xy]
1B Bn mb xb x1 QMULU.bwl Dd,Dj,(oprs9,xysp)
1B Bn mb xb x1 QMULU.bwl Dd,Dj,[oprs9,xysp]
1B Bn mb xb x1 QMULU.bwl Dd,Dj,opru14
1B Bn mb xb x2 x1 QMULU.bwl Dd,Dj,(opru18,Di)
1B Bn mb xb x2 x1 QMULU.bwl Dd,Dj,opru18
1B Bn mb xb x3 x2 x1 QMULU.bwl Dd,Dj,(opr24,xysp)
1B Bn mb xb x3 x2 x1 QMULU.bwl Dd,Dj,[opr24,xysp]
1B Bn mb xb x3 x2 x1 QMULU.bwl Dd,Dj,(opru24,Di)
1B Bn mb xb x3 x2 x1 QMULU.bwl Dd,Dj,opr24
1B Bn mb xb x3 x2 x1 QMULU.bwl Dd,Dj,[opr24]
OPR/1/2/3-OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
1 0 1 1 0 RESULT REGISTER Dd Bn
0 1 M1_SIZE (.B, .W, .P, .L) M2_SIZE (.B, .W, .P, .L) 1 0 mb
OPR POSTBYTE (for M1) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
OPR POSTBYTE (for M2) xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
All combinations are valid although some, such as specifying a data register for both M1 and M2 can
be done more efficiently using the REG-REG version of the instruction.
Instruction Fields
RESULT REGISTER- This field specifies the number of the data register Dd used for the result
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE REGISTER or SOURCE 1 REGISTER - This field specifies the number of the data register
Dj used as an operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SOURCE 2 REGISTER - This field specifies the number of the data register Dk used as the second
operand for the multiplication (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
IMM_SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01) or 32-bit long-word (0b11) as
the size of the immediate operand. The 0b10 combination is not available for the REG-IMM1/2/4
version of the instruction because those codes are used for the OPR-OPR version.
M1_SIZE and M2_SIZE - These fields specify the size of M1 and M2 which use the general OPR
addressing mode to specify short-immediate, register, or memory operands (0b00 = 8-bit byte, 0b01 =
16-bit word, 0b10 = 24-bit pointer, and 0b11 = 32-bit long-word). When a short-immediate operand is
specified, it is internally sign-extended to the size specified by the M1_SIZE and/or M2_SIZE
specifications. When a register is specified, it determines the size and the M1_SIZE and/or M2_SIZE
specifications are ignored.
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size specified by IMM_SIZE.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand for both source operands, is less efficient
than using the REG-REG version of the instruction.
C MSB LSB
Description
Rotate an operand left (through the carry bit) 1 bit-position. The 8-bit byte (.B), 16-bit word (.W),
24-bit pointer (.P), or 32-bit long-word (.L) memory operand to be rotated is specified using general
OPR addressing. The operand, oprmemreg, can be a data register, a memory operand at a 14- 18- or
24-bit extended address, or a memory operand that is addressed with indexed or indirect addressing
mode. The original carry bit is shifted into the LSB and the MSB is shifted out to the carry bit (C). It
is not appropriate to specify a short-immediate operand with the OPR addressing mode because it is
not possible to modify the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 ∆
Instruction Fields
L/R - This bit selects the rotate direction, left (1) or right (0).
SIZE (.B, .W, .P, .L) - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10)
or 32-bit long-word (0b11) as the size of the source operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a data register, a 14- 18- or 24-bit
extended memory address, or an indexed or indexed-indirect memory location.
MSB LSB C
Description
Rotate an operand right (through the carry bit) 1 bit-position. The 8-bit byte (.B), 16-bit word (.W),
24-bit pointer (.P), or 32-bit long-word (.L) memory operand to be rotated is specified using general
OPR addressing. The operand, oprmemreg, can be a data register, a memory operand at a 14- 18- or
24-bit extended address, or a memory operand that is addressed with indexed or indirect addressing
mode. The original carry bit is shifted into the MSB and the LSB is shifted out to the carry bit (C). It
is not appropriate to specify a short-immediate operand with the OPR addressing mode because it is
not possible to modify the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 ∆
Instruction Fields
L/R - This bit selects the rotate direction, left (1) or right (0).
SIZE (.B, .W, .P, .L) - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10)
or 32-bit long-word (0b11) as the size of the source operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a data register, a 14- 18- or 24-bit
extended memory address, or an indexed or indexed-indirect memory location.
Description
Restores system context after exception processing is completed. The condition codes, data registers
D0..D7, the pointer registers X and Y, and the PC (return address) are restored to a state pulled from
the stack.
If another interrupt is pending when RTI has finished restoring registers from the stack, the SP is
adjusted to preserve stack content, and the new vector is fetched.
CCR Details
U - - - - IPL S X - I N Z V C
⇑ − − − − ∆ ∆ ⇓ − ∆ ∆ ∆ ∆ ∆
CCR contents are restored from the stack. Unimplemented bits in the CCR can not be changed.
Normally RTI is executed from within an interrupt service routine and the MCU is in supervisor state,
however it is possible that RTI could be executed from user state due to runaway or a software error.
In user state, only the four flag bits N, Z, V, and C can be modified. In supervisor state, any of the
implemented CCR bits can be modified however the X bit can never be changed from 0 to 1 by any
instruction in any mode.
1B 90 RTI
Description
Restores context at the end of a subroutine. Loads the PC with a 24-bit value pulled from the stack and
updates the SP (incremented by 3). Program execution continues at the address restored from the stack.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
05 RTS
SAT Saturate
SAT
Operation
saturated(Di) ⇒ Di
Syntax Variations Addressing Modes
SAT Di INH
Description
Replace the content of Di with its saturated value. The operand is treated as a signed value. Operation
size depends on (matches) the size of Di.
This instruction uses the information left by a previous operation in the overflow (V-)-flag and the
negative (N-)flag to decide whether the content of Di is replaced by a value representing the positive
or the negative boundary of the signed value range defined by the size of Di.
If the overflow (V-)flag is set, the content of Di is replaced with the value as defined by the state of
negative (N-)flag.
If the negative (N-)flag is set, the value written to Di is the maximum positive number of the signed
value range. Otherwise (N==0) the minimum negative number of the signed value range is used.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 –
1B An SAT Di
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di used for the source and
destination for the operation (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7).
Description
Subtract with borrow from register Di and store the result to Di. When the operand is an immediate
value, it has the same size as register Di. In the case of the general OPR addressing operand,
oprmemreg can be a sign-extended immediate value (–1, 1, 2, 3..14, 15), a data register, a memory
operand the same size as Di at a 14- 18- or 24-bit extended address, or a memory operand that is
addressed with indexed or indirect addressing mode.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
OPR/1/2/3
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
1 0 0 0 0 SD REGISTER Di 8n
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size of the register Di.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Sets the C status bit. This instruction is assembled as ORCC #$01. The ORCC instruction can be used
to set any combination of bits in the CCL in one operation.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – − − − 1
C: Set.
DE 01 SEV
Description
Sets the I mask bit. This instruction is assembled as ORCC #$10. The ORCC instruction can be used
to set any combination of bits in the CCL in one operation.
When the I bit is set, interrupts are disabled.
CCR Details
U - - - - IPL S X - I N Z V C
− − − − − − − − − 1 − − − − supervisor state
− − − − − − − − − − − − − − user state
DE 10 SEI
Description
Sets the V status bit. This instruction is assembled as ORCC #$02. The ORCC instruction can be used
to set any combination of bits in the CCL in one operation.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – − − 1 –
V: Set.
DE 02 SEV
SEX Sign-Extend
(smaller CPU register to a larger CPU register) SEX
Syntax Variations Addressing Modes
SEX cpureg,cpureg INH
Description
Provided the first register is smaller than the second register, it is sign-extended and written to the
second register.
If the first register is the same size or larger than the second register, an exchange operation is done.
see the EXG instruction.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
In some cases (such as sign-extending D0 to CCW) the sign-extend instruction can cause the contents
of another register to be written into the CCR so the CCR effects shown above do not apply. Unused
bits in the CCR cannot be changed by any sign-extend or exchange instruction. The X interrupt mask
can be cleared by an instruction in supervisor state but cannot be set (changed from 0 to 1) by any
sign-extend or exchange instruction. In user state, the X and I interrupt masks cannot be changed by
any sign-extend or exchange instruction.
AE eb SEX cpureg,cpureg
D3 D4 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D2 -0 –
⇔ D2 ⇔ D2 ⇔ D2 ⇒ D2 ⇒ D2 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D2 ⇒ D2 ⇔ D2
D2 D4 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D3 -1 –
Freescale Semiconductor
⇔ D3 ⇔ D3 ⇔ D3 ⇒ D3 ⇒ D3 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D3 ⇒ D3 ⇔ D3
D2 D3 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D4 -2 –
⇔ D4 ⇔ D4 ⇔ D4 ⇒ D4 ⇒ D4 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D4 ⇒ D4 ⇔ D4
D2 D3 D4 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D5 -3 –
⇔ D5 ⇔ D5 ⇔ D5 ⇒ D5 ⇒ D5 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D5 ⇒ D5 ⇔ D5
Big Big Big Big D1 Big Big Big Big Big CCH CCL Big
D0 -4 –
⇔Small ⇔Small ⇔Small ⇔Small ⇔ D0 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇔ D0 ⇔ D0 ⇔Small
Big Big Big Big D0 Big Big Big Big Big CCH CCL Big
D1 -5 –
⇔Small ⇔Small ⇔Small ⇔Small ⇔ D1 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇔ D1 ⇔ D1 ⇔Small
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 D7 sex:X sex:Y sex:S sex:CCH sex:CCL sex:CCW
D6 -6 –
⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇔ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 D6 sex:X sex:Y sex:S sex:CCH sex:CCL sex:CCW
D7 -7 –
⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇔ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 Big Big Y S sex:CCH sex:CCL sex:CCW
X -8 –
⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇔Small ⇔Small ⇔X ⇔X ⇒X ⇒X ⇒X
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 Big Big X S sex:CCH sex:CCL sex:CCW
Y -9 –
⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇔Small ⇔Small ⇔Y ⇔Y ⇒Y ⇒Y ⇒Y
sex:D2 sex:D3 sex:D4 sex:D5 sex:D0 sex:D1 Big Big X Y sex:CCH sex:CCL sex:CCW
S -A –
⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇔Small ⇔Small ⇔S ⇔S ⇒S ⇒S ⇒S
reserved -B
CCL -D – NOP
⇔Small ⇔Small ⇔Small ⇔Small ⇔ CCL ⇔ CCL ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇔ CCL
D2 D3 D4 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL
CCW -E –
⇔ CCW ⇔ CCW ⇔ CCW ⇔ CCW ⇒ CCW ⇒ CCW ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ CCW ⇒ CCW
-F –
EXG Big,Small: Small register gets low part of Big register, Big register gets sign-extended Small register. These cases are not expected to be useful in application programs.
EXG CCW,CCH and EXG CCW,CCL are ambiguous cases so CCW is not changed (equivalent to NOP)
285
Chapter 6 Instruction Glossary
Chapter 6 Instruction Glossary
Description
This instruction mnemonic is used as a placeholder for the unimplemented opcodes on page 1 of the
opcode map. If any of these unimplemented opcodes is encountered in an application program, the
CPU context is saved on the stack as in an SWI instruction and program execution continues at the
address specified in the Page1 TRAP Vector.
CCR Details
U - - - - IPL S X - I N Z V C
0 – – – – – – – – 1 − − − –
U: Cleared.
I: Set.
At this time, the one unimplemented opcode on Page 1 of the opcode map are 0xEF. It is expected that
some of these codes will be used for additional instructions in the final version of this instruction set.
ST Store
(Di, X, Y, or SP)
ST
Operation
(Di) ⇒ M
(X) ⇒ M
(Y) ⇒ M
(SP) ⇒ M
Syntax Variations Addressing Modes
ST Di,opr24a EXT (24-bit address)
ST Di,oprmemreg OPR/1/2/3
ST xy,opr24a EXT (24-bit address)
ST xy,oprmemreg OPR/1/2/3
ST S,oprmemreg OPR/1/2/3
Description
Store a register Di, X, Y, or SP to a memory location. In the case of the general OPR addressing
operand, oprmemreg can be a data register, a memory operand the same size as Di , X, Y, or SP at a
14- 18- or 24-bit extended address, or a memory operand that is addressed with indexed or indirect
addressing mode. There are also efficient 24-bit extended addressing mode versions of the instructions
to store Di, X or Y. It is inappropriate to specify a short immediate operand using the OPR addressing
mode for this instruction because it is not possible to modify the immediate operand.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ 0 –
Dn a3 a2 a1 ST Di,opr24a
OPR/1/2/3 (Di)
7 6 5 4 3 2 1 0
1 1 0 0 0 REGISTER Cn
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Dp a3 a2 a1 ST xy,opr24a
OPR/1/2/3 (X or Y)
7 6 5 4 3 2 1 0
1 1 0 0 1 0 0 Y/X Cp
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Cp xb x3 x2 x1 ST xy,[opr24,xysp]
Cp xb x3 x2 x1 ST xy,(opru24,Dj)
Cp xb x3 x2 x1 ST xy,opr24
Cp xb x3 x2 x1 ST xy,[opr24]
OPR/1/2/3 (SP)
7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 1 1B
0 0 0 0 0 0 0 1 01
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
Instruction Fields
REGISTER - This field specifies the number of the data register Di which is used as the source register
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
Y/X - This field selects either the X index register or the Y index register.
ADDRESS - This field is used for address bits used for extended addressing mode.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a data register, a 14- 18- or 24-bit
extended memory address, or an indexed or indexed-indirect memory location. The short-immediate
variation is not appropriate for a store instruction.
Description
If the CPU is in user state or if the S control bit in the CCR is set, STOP acts like a NOP instruction.
If the CPU is in supervisor state and the S bit is cleared, STOP stacks the CPU context, stops system
clocks, and puts the device in a standby mode. Standby operation minimizes system power
consumption. The contents of registers and the states of I/O pins remain unchanged.
Asserting RESET, XIRQ, or IRQ signals (if enabled) ends the standby mode. Stacking on entry to
STOP allows the CPU to recover quickly when an interrupt is used, provided a stable clock is present.
CCR Details
U - - - - IPL S X - I N Z V C
− – – – – – – – – − − − − –
1B 05 STOP
Description
Subtract without borrow from register Di and store the result to Di, or Subtract X–Y or Y–X and store
the result to D6. When the operand is an immediate value, it has the same size as register Di. In the
case of the general OPR addressing operand, oprmemreg can be a sign-extended immediate value (–1,
1, 2, 3..14, 15), a data register, a memory operand the same size as Di at a 14- 18- or 24-bit extended
address, or a memory operand that is addressed with indexed or indirect addressing mode.
In the case of SUB D6,X,Y or SUB D6,Y,X source operands X and Y are treated as unsigned and the
result is a signed long int.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – ∆ ∆ ∆ ∆
FD SUB D6,X,Y
7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 0 FE
FE SUB D6,Y,X
IMM1/2/4
7 6 5 4 3 2 1 0
0 1 1 1 0 SD REGISTER Di 7p
IMMEDIATE DATA
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE OF Di)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE OF Di)
(OPTIONAL IMMEDIATE DATA DEPENDING ON SIZE OF Di)
Instruction Fields
SD REGISTER Di - This field specifies the number of the data register Di which is used as a source
operand and for the destination register (0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0,
1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
IMMEDIATE and OPTIONAL IMMEDIATE DATA - These fields contain the immediate operand.
This operand is either 1 byte, 2 bytes or 4 bytes wide, depending on the size of the register Di.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Description
Causes an interrupt without an external interrupt service request. Uses the address of the next
instruction after the SWI as a return address. Stacks the CPU context, then sets the I mask and clears
the U bit to change to supervisor state. SWI is not affected by the state of the I interrupt mask (SWI
interrupts cannot be blocked by the interrupt mask).
Because the opcode for SWI is 0xFF, if the CPU encounters an uninitialized area of memory that reads
0xFF, an SWI instruction will be performed.
CCR Details
U - - - - IPL S X - I N Z V C
0 – – – – – – – – 1 − − − –
U: Cleared.
I: Set.
FF SWI
Description
Enter System operating state. Similar to SWI except the SYS Vector is used instead of the SWI vector.
Uses the address of the next instruction after the SYS as a return address. Stacks the CPU context, then
sets the I mask and clears the U bit to change to supervisor state. SYS is not affected by the state of the
I interrupt mask (SYS interrupts cannot be blocked by the interrupt mask).
CCR Details
U - - - - IPL S X - I N Z V C
0 – – – – – – – – 1 − − − –
U: Cleared.
I: Set.
1B 07 SYS
Description
Test the operand (internally determining the N and Z conditions but not modifying the CCR) then
branch if the specified condition is true. The condition (cc) can be NE (not equal), EQ (equal), PL
(plus), MI (minus), GT (greater than), or LE (less than or equal). The operand may be one of the eight
data registers, index register X, index register Y, or an 8-, 16-, 24-, or 32-bit memory operand. In the
case of the general OPR addressing operand, oprmemreg can be a data register, a memory operand at
a 14- 18- or 24-bit extended address, or a memory operand that is addressed with indexed or indirect
addressing mode. The relative offset for the branch can be either 7 bits (–64 to +63) or 15 bits
(~+/–16K) displacement from the TBcc opcode location.
CCR Details
U - - - - IPL S X - I N Z V C
– − − − − – − − − – − − − −
REG-REL (X, Y)
7 6 5 4 3 2 1 0
0 0 0 0 1 1 0 1 0B
0 CC (NE,EQ,PL,MI,GT,LE,–,–) 1 0 don’t care Y/X lb
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
OPR/1/2/3-REL
7 6 5 4 3 2 1 0
0 0 0 0 1 1 0 1 0B
0 CC (NE,EQ,PL,MI,GT,LE,–,–) 1 1 SIZE (.B, .W, .P, .L) lb
OPR POSTBYTE xb
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
(OPTIONAL ADDRESS-BYTE DEPENDING ON ADDRESS-MODE)
REL_SIZE 7 bit DISPLACEMENT (REL_SIZE==0) or high-order 7 bits of 15 bit DISPLACEMENT (REL_SIZE==1) rb
Optional low-order 8 bits of 15-bit DISPLACEMENT (REL_SIZE==1) r1
0B lb xb rb TBcc.bwpl #oprsxe4i,oprdest
0B lb xb rb r1 TBcc.bwpl #oprsxe4i,oprdest
0B lb xb rb TBcc.bwpl Di,oprdest ;see efficient REG-REL version
0B lb xb rb r1 TBcc.bwpl Di,oprdest ;see efficient REG-REL version
0B lb xb rb TBcc.bwpl (opru4,xys),oprdest ;(7-bit)
0B lb xb rb r1 TBcc.bwpl (opru4,xys),oprdest ;(15-bit)
0B lb xb rb TBcc.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},oprdest ;(7-bit)
0B lb xb rb r1 TBcc.bwpl {(+-xy)|(xy+-)|(-s)|(s+)},oprdest ;(15-bit)
0B lb xb rb TBcc.bwpl (Di,xys),oprdest ;(7-bit)
0B lb xb rb r1 TBcc.bwpl (Di,xys),oprdest ;(15-bit)
0B lb xb rb TBcc.bwpl [Di,xy],oprdest ;(7-bit)
0B lb xb rb r1 TBcc.bwpl [Di,xy],oprdest ;(15-bit)
0B lb xb x1 rb TBcc.bwpl (oprs9,xysp),oprdest ;(7-bit)
0B lb xb x1 rb r1 TBcc.bwpl (oprs9,xysp),oprdest ;(15-bit)
0B lb xb x1 rb TBcc.bwpl [oprs9,xysp],oprdest ;(7-bit)
0B lb xb x1 rb r1 TBcc.bwpl [oprs9,xysp],oprdest ;(15-bit)
0B lb xb x1 rb TBcc.bwpl opru14,oprdest ;(7-bit)
0B lb xb x1 rb r1 TBcc.bwpl opru14,oprdest ;(15-bit)
0B lb xb x2 x1 rb TBcc.bwpl (opru18,Di),oprdest ;(7-bit)
0B lb xb x2 x1 rb r1 TBcc.bwpl (opru18,Di),oprdest ;(15-bit)
0B lb xb x2 x1 rb TBcc.bwpl opru18,oprdest ;(7-bit)
0B lb xb x2 x1 rb r1 TBcc.bwpl opru18,oprdest ;(15-bit)
0B lb xb x3 x2 x1 rb TBcc.bwpl (opr24,xysp),oprdest ;(7-bit)
0B lb xb x3 x2 x1 rb r1 TBcc.bwpl (opr24,xysp),oprdest ;(15-bit)
0B lb xb x3 x2 x1 rb TBcc.bwpl [opr24,xysp],oprdest ;(7-bit)
0B lb xb x3 x2 x1 rb r1 TBcc.bwpl [opr24,xysp],oprdest ;(15-bit)
0B lb xb x3 x2 x1 rb TBcc.bwpl (opru24,Di),oprdest ;(7-bit)
0B lb xb x3 x2 x1 rb r1 TBcc.bwpl (opru24,Di),oprdest ;(15-bit)
0B lb xb x3 x2 x1 rb TBcc.bwpl opr24,oprdest ;(7-bit)
0B lb xb x3 x2 x1 rb r1 TBcc.bwpl opr24,oprdest ;(15-bit)
Instruction Fields
CC - This field specifies the condition for the branch according to the table below:
REGISTER - This field specifies the number of the data register Di which is used as the source operand
(0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7).
SIZE - This field specifies 8-bit byte (0b00), 16-bit word (0b01), 24-bit pointer (0b10) or 32-bit
long-word (0b11) as the size of the operation.
Y/X - This field specifies either index register X (0) or index register Y (1) as the source operand.
OPR POSTBYTE and the associated 0, 1, 2, or 3 optional extension byte(s) specify an operand
according to the rules for the xb postbyte. This operand may be a short-immediate value, a data register,
a 14- 18- or 24-bit extended memory address, or an indexed or indexed-indirect memory location.
Using OPR addressing mode to specify a register operand, performs the same function as the
REG-REL versions but is less efficient.
REL_SIZE - This field specifies the size of the DISPLACEMENT 0=7-bit; 1=15=bit .
DISPLACEMENT - This field specifies the number of bytes between the branch instruction and the
next instruction to be executed if the condition is met.
Description
Transfer (copy) the contents of one CPU register to another CPU register.
If both registers are the same size, a direct transfer is performed.
If the first register is larger than the second register, only the low portion is transferred (truncate).
If the first register is smaller than the second register, it is zero-extended and written to the second
register.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
In some cases (such as transferring D0 to CCL) the transfer instruction can cause the contents of
another register to be written into the CCR so the CCR effects shown above do not apply. Unused bits
in the CCR cannot be changed by any transfer instruction. The X interrupt mask can be cleared by an
instruction in supervisor state but cannot be set (changed from 0 to 1) by any transfer instruction. In
user state, the X and I interrupt masks cannot be changed by any transfer instruction.
9E tb TFR cpureg,cpureg
Freescale Semiconductor
D2 D4 D5 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D3 -1 –
⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3
D2 D3 D5 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D4 -2 –
⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4
D2 D3 D4 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D5 -3 –
⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5
D2L D3L D4L D5L D1 D6L D7L XL YL SL CCH CCL CCL
D0 -4 –
⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0
D2L D3L D4L D5L D0 D6L D7L XL YL SL CCH CCL CCL
D1 -5 –
⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1
0000:D2 0000:D3 0000:D4 0000:D5 000000:D0 000000:D1 D7 00:X 00:Y 00:SP 000000:CCH 000000:CCL 0000:CCW
D6 -6 –
⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6
0000:D2 0000:D3 0000:D4 0000:D5 000000:D0 000000:D1 D6 00:X 00:Y 00:SP 000000:CCH 000000:CCL 0000:CCW
D7 -7 –
⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L Y S 0000:CCH 0000:CCL 00:CCW
X -8 –
⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L X S 0000:CCH 0000:CCL 00:CCW
Y -9 –
⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L X Y 0000:CCH 0000:CCL 00:CCW
S -A –
⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S
reserved -B
-F –
299
Chapter 6 Instruction Glossary
Chapter 6 Instruction Glossary
Description
This instruction mnemonic is used for the unimplemented opcodes on page 2 of the opcode map. If any
of these unimplemented opcodes is encountered in an application program, the CPU context is saved
on the stack as in an SWI instruction and program execution continues at the address specified in the
Page 2 TRAP Vector.
These opcodes and the TRAP ISR can be used to extend the instruction set with software routines.
CCR Details
U - - - - IPL S X - I N Z V C
0 – – – – – – – – 1 − − − –
U: Cleared.
I: Set.
1B tn TRAP tn
Description
If the CPU is in user state, WAI acts like a NOP instruction. If the CPU is in supervisor state, WAI
stacks the CPU context and stops the CPU clock. Other system clocks can continue to operate so
peripheral modules can continue to run. The contents of registers and the states of I/O pins remain
unchanged.
Asserting RESET, XIRQ, or IRQ signals (if enabled) ends the standby mode. Stacking on entry to WAI
allows the CPU to recover quickly when an interrupt is used.
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – − − − –
1B 06 WAI
ZEX Zero-Extend
(smaller CPU register to a larger CPU register) ZEX
Syntax Variations Addressing Modes
ZEX cpureg,cpureg INH
Description
Zero-extend the contents of a smaller CPU register to a larger CPU register. This is an alternate
mnemonic for the TFR instruction in the special case when the source register is smaller than the
destination register.
If both registers are the same size, a direct transfer is performed. (see TFR instruction)
If the first register is larger than the second register, only the low portion is transferred (truncate). (see
TFR instruction)
CCR Details
U - - - - IPL S X - I N Z V C
– – – – – – – – – – – – – –
In some cases (such as transferring D0 to CCL) the transfer instruction can cause the contents of
another register to be written into the CCR so the CCR effects shown above do not apply. Unused bits
in the CCR cannot be changed by any transfer instruction. The X interrupt mask can be cleared by an
instruction in supervisor state but cannot be set (changed from 0 to 1) by any transfer instruction. In
user state, the X and I interrupt masks cannot be changed by any transfer instruction.
Freescale Semiconductor
D2 D4 D5 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D3 -1 –
⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3
D2 D3 D5 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D4 -2 –
⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4
D2 D3 D4 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D5 -3 –
⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5
D2L D3L D4L D5L D1 D6L D7L XL YL SL CCH CCL CCL
D0 -4 –
⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0
D2L D3L D4L D5L D0 D6L D7L XL YL SL CCH CCL CCL
D1 -5 –
⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1
0000:D2 0000:D3 0000:D4 0000:D5 000000:D0 000000:D1 D7 00:X 00:Y 00:S 000000:CCH 000000:CCL 0000:CCW
D6 -6 –
⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6
0000:D2 0000:D3 0000:D4 0000:D5 000000:D0 000000:D1 D6 00:X 00:Y 00:S 000000:CCH 000000:CCL 0000:CCW
D7 -7 –
⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L Y S 0000:CCH 0000:CCL 00:CCW
X -8 –
⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L X S 0000:CCH 0000:CCL 00:CCW
Y -9 –
⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L X Y 0000:CCH 0000:CCL 00:CCW
S -A –
⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S
reserved -B
-F –
303
Chapter 6 Instruction Glossary
Chapter 6 Instruction Glossary
3. Machine exception.
A machine exception cannot be masked. Sources for a machine exception are defined in the
Memory Map Control module (MMC). Please refer to the MMC chapter in the MCU Reference
Manual for details.
4. X-bit interrupt.
The interrupt service requests from the XIRQ pin is handled as a X-bit interrupt.
This exception can be masked with the X-bit (X=1). The I-bit and the IPL-bits have no effect.
5. All remaining interrupt service requests can be masked with the I-bit (I=1) and are subject to
priority filtering using the IPL-bits.
7.3.1 Reset
Unlike other exceptions which are normally detected and processed at instruction boundaries only, a Reset
is always performed immediately. Integration module circuitry determines the type of reset that has
occurred, performs basic system configuration, then passes control to the CPU. The CPU fetches the Reset
vector, jumps to the address pointed to by the vector, and begins to execute code at that address. For more
information on possible causes of a reset please refer to the MCU reference manual of the device.
Then the address stored in the interrupt vector is fetched and copied to the program counter.
Next, the return address and the content of the registers are stacked as shown in Table 7-1.
In parallel to the stacking sequence new program code is fetched to start to re-fill the instruction queue.
After the CCR is stacked, the I-bit (and the X-bit, if an XIRQ interrupt service request caused the interrupt)
is set.
The U-bit is cleared to make sure the interrupt service routine is executed in supervisor state.
Execution continues at the address pointed to by the vector for the highest-priority interrupt that was
pending at the beginning of the interrupt sequence.
At the end of the interrupt service routine, an RTI instruction restores context from the stacked registers,
and normal program execution resumes.
refer to the s12z_int module chapter in the device reference manual for more information on the Interrupt
Vector Base Register).
Supervisor state is forced regardless of the current state of the U-bit. This ensures the vector fetch cycle
and the entire exception stacking sequence taking place in supervisor state. This is independent from the
actual clearing of the U-bit which during an interrupt sequence does not happen until the CCH register was
stacked. Please refer to Figure 7-1 for details.
S
(supervisor=1)
Start-of-Exception Start-of-Unstacking
End-of-Exception End-of-Unstacking
and U-bit clear
EXCEPTION U-bit
cleared by
UNSTACK
(supervisor=1) (supervisor=1)
Debugger
(BDC)
Start-of-Exception
U
(supervisor=0)
Right before the vector fetch cycle, the S12Z CPU issues a signal to ask the interrupt module for the vector
address of the highest priority, pending exception. This address is then used to fetch the address of the
interrupt service routine (ISR).
After the vector fetch, the CPU selects one of the four alternate execution paths, depending upon the cause
of the exception (please refer to Figure 7-2 for details).
Start
Fetch Vector
Yes
Reset?
No
Yes
Machine Exception?
No
Yes
Interrupt?
No
Set I-bit and X-bit Set I-bit Set I-bit, If XIRQ set X-bit
Clear U-bit Clear U-bit Clear U-bit, update IPL-bits
End
n(r/w)
n− This is the total number of required bus-clock cycles to execute the instruction.
Internal CPU cycles are included as well as cycles required for operand fetches, if applicable. This number
represents the minimum number of required clock-cycles (best case) to execute an instruction; any (optional)
instruction queue fetches and additional wait-cycles for memory accesses are not included.
r/w − This represents the number of operand reads (r) and operand writes (w).
For example: an instruction which does a read-modify-write from/to memory shows (1/1) here.
Operation Cycles
NOP 1(0/0)
Destination
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
Source REG (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
REG
2(0/0) 3(0/1) 3(0/1) 4.5(1/1) 4.5(1/1)
IMMe4
(IDX)
(++IDX) 3.5(1/0) 4.5(1/1) 4.5(1/1) 6(2/1) 6(2/1)
(REG,IDX)
(IDX1)
(IDX3)
(IDX2,REG)
(IDX3,REG) 4(1/0) 5(1/1) 5(1/1) 6.5(2/1) 6.5(2/1)
EXT1
EXT2
EXT3
[IDX1]
[IDX3] 5.5(2/0) 6.5(2/1) 6.5(2/1) 8(3/1) 8(3/1)
[EXT3]
LD Dn,#IMM1 LD XY,#IMMu18
1(0/0) 1(0/0)
LD Dn,#IMM2 LD XY,#IMM3
LD Dn,REG LD XYS,REG
1(0/0) 1(0/0)
LD Dn,#IMMe4 LD XYS,#IMMe4
LD Dn,(IDX) LD XYS,(IDX)
LD Dn,(++IDX) 2.5(1/0) LD XYS,(++IDX) 2.5(1/0)
LD Dn,(REG,IDX) LD XYS,(REG,IDX)
LD Dn,(IDX1) LD XYS,(IDX1)
LD Dn,(IDX3) LD XYS,(IDX3)
LD Dn,(IDX2,REG) LD XYS,(IDX2,REG)
LD Dn,(IDX3,REG) 3(1/0) LD XYS,(IDX3,REG) 3(1/0)
LD Dn,EXT1 LD XYS,EXT1
LD Dn,EXT2 LD XYS,EXT2
LD Dn,EXT3 LD XYS,EXT3
LD Dn,[IDX1] LD XYS,[IDX1]
LD Dn,[IDX3] 4.5(2/0) LD XYS,[IDX3] 4.5(2/0)
LD Dn,[EXT3] LD XYS,[EXT3]
ST Dn,(IDX) ST XYS,(IDX)
ST Dn,(++IDX) 2(0/1) ST XYS,(++IDX) 2(0/1)
ST Dn,(REG,IDX) ST XYS,(REG,IDX)
ST Dn,(IDX1) ST XYS,(IDX1)
ST Dn,(IDX3) ST XYS,(IDX3)
ST Dn,(IDX2,REG) ST XYS,(IDX2,REG)
ST Dn,(IDX3,REG) 2.5(0/1) ST XYS,(IDX3,REG) 2.5(0/1)
ST Dn,EXT1 ST XYS,EXT1
ST Dn,EXT2 ST XYS,EXT2
ST Dn,EXT3 ST XYS,EXT3
ST Dn,[IDX1] ST XYS,[IDX1]
ST Dn,[IDX3] 4(1/1) ST XYS,[IDX3] 4(1/1)
ST Dn,[EXT3] ST XYS,[EXT3]
Operation Cycles
Operation Cycles
Operation Cycles
LEA D67XYS,(IDX)
LEA D67XYS,(++IDX) 1(0/0)
LEA D67XYS,(REG,IDX)
LEA D67XYS,(IDX1)
LEA D67XYS,(IDX3)
LEA D67XYS,(IDX2,REG)
LEA D67XYS,(IDX3,REG) 1.5(0/0)
LEA D67XYS,EXT1
LEA D67XYS,EXT2
LEA D67XYS,EXT3
LEA D67XYS,[IDX1]
LEA D67XYS,[IDX3] 3(1/0)
LEA D67XYS,[EXT3]
Operation Cycles
CLR Dn
1(0/0)
CLR XY
CLR.bwpl (IDX)
CLR.bwpl (++IDX) 2(0/1)
CLR.bwpl (REG,IDX)
CLR.bwpl (IDX1)
CLR.bwpl (IDX3)
CLR.bwpl (IDX2,REG)
CLR.bwpl (IDX3,REG) 2.5(0/1)
CLR.bwpl EXT1
CLR.bwpl EXT2
CLR.bwpl EXT3
CLR.bwpl [IDX1]
CLR.bwpl [IDX3] 4(1/1)
CLR.bwpl [EXT3]
Destination
Dn
1(0/0) 1(0/0) 1(0/0) 1.5(0/0) 1.5(0/0)
XYS
Destination
Dn
1(0/0) 1(0/0) 1(0/0) 1.5(0/0) 1.5(0/0)
XYS
8.2.10 Logical AND/OR Instruction Execution Times (AND, OR, BIT, EOR)
Table 8-12 shows the number of clock cycles required for execution of a logical AND/OR instruction
(AND, OR, BIT, EOR).
Table 8-12. Logical Operation Execution Timing
Operation Cycles
<OP> Dn,#IMM1
1(0/0)
<OP> Dn,#IMM2
<OP> Dn,REG
1(0/0)
<OP> Dn,#IMMe4
<OP> Dn,(IDX)
<OP> Dn,(++IDX) 2.5(1/0)
<OP> Dn,(REG,IDX)
<OP> Dn,(IDX1)
<OP> Dn,(IDX3)
<OP> Dn,(IDX2,REG)
<OP> Dn,(IDX3,REG) 3(1/0)
<OP> Dn,EXT1
<OP> Dn,EXT2
<OP> Dn,EXT3
<OP> Dn,[IDX1]
<OP> Dn,[IDX3] 4.5(2/0)
<OP> Dn,[EXT3]
Operation Cycles
COM.bwl (IDX)
COM.bwl (++IDX) 3.5(1/1)
COM.bwl (REG,IDX)
COM.bwl (IDX1)
COM.bwl (IDX3)
COM.bwl (IDX2,REG)
COM.bwl (IDX3,REG) 4(1/1)
COM.bwl EXT1
COM.bwl EXT2
COM.bwl EXT3
COM.bwl [IDX1]
COM.bwl [IDX3] 5.5(2/1)
COM.bwl [EXT3]
Operation Cycles
<OP> Dn 1(0/0)
<OP>.bwl (IDX)
<OP>.bwl (++IDX) 3.5(1/1)
<OP>.bwl (REG,IDX)
<OP>.bwl (IDX1)
<OP>.bwl (IDX3)
<OP>.bwl (IDX2,REG)
<OP>.bwl (IDX3,REG) 4(1/1)
<OP>.bwl EXT1
<OP>.bwl EXT2
<OP>.bwl EXT3
<OP>.bwl [IDX1]
<OP>.bwl [IDX3] 5.5(2/1)
<OP>.bwl [EXT3]
8.2.13 Add and Subtract Instruction Execution Times (ADD, ADC, SUB,
SBC, CMP)
Table 8-15 and Table 8-16 show the number of clock cycles required for execution of an Add, Subtract or
Compare instruction (ADD, ADC, SUB, SBC, CMP).
Table 8-15. Arithmetic Operation Execution Timing
Operation Cycles
<OP> Dn,#IMM1
1(0/0)
<OP> Dn,#IMM2
<OP> Dn,REG
1(0/0)
<OP> Dn,#IMMe4
<OP> Dn,(IDX)
<OP> Dn,(++IDX) 2.5(1/0)
<OP> Dn,(REG,IDX)
<OP> Dn,(IDX1)
<OP> Dn,(IDX3)
<OP> Dn,(IDX2,REG)
<OP> Dn,(IDX3,REG) 3(1/0)
<OP> Dn,EXT1
<OP> Dn,EXT2
<OP> Dn,EXT3
<OP> Dn,[IDX1]
<OP> Dn,[IDX3] 4.5(2/0)
<OP> Dn,[EXT3]
Operation Cycles
SUB D6,X,Y
CMP X,Y 1(0/0)
CMP Y,X
Operation Cycles
NEG.bwl (IDX)
NEG.bwl (++IDX) 3.5(1/1)
NEG.bwl (REG,IDX)
Operation Cycles
NEG.bwl (IDX1)
NEG.bwl (IDX3)
NEG.bwl (IDX2,REG)
NEG.bwl (IDX3,REG) 4(1/1)
NEG.bwl EXT1
NEG.bwl EXT2
NEG.bwl EXT3
NEG.bwl [IDX1]
NEG.bwl [IDX3] 5.5(2/1)
NEG.bwl [EXT3]
Operation Cycles
ABS Dn 1(0/0)
Operation Cycles
SAT Dn 1(0/0)
Operation Cycles
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
2(0/0) − − − − −
Dn
3.5(0/0) − − − − −
2(0/0) − − − − −
IMM1
IMM2
3.5(0/0) − − − − −
IMM4 4(0/0) − − − − −
1
The rows with shaded background describe the instruction execution timing
if at least one of the source operands is bigger than 16 bits. Otherwise the
instruction timing shown in the rows with white background is valid.
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
1(0/0) − − − − −
Dn
2.5(0/0) − − − − −
1(0/0) − − − − −
IMM1
IMM2
2.5(0/0) − − − − −
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
IMM4 3(0/0) − − − − −
1
The rows with shaded background describe the instruction execution timing
if at least one of the source operands is bigger than 16 bits. Otherwise the
instruction timing shown in the rows with white background is valid.
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
3.5(0/0) − − − − −
Dn
6.5(0/0) − − − − −
3.5(0/0) − − − − −
IMM1
6.5(0/0) − − − − −
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
4(0/0) − − − − −
IMM2
7(0/0) − − − − −
IMM4 7(0/0) − − − − −
1
The rows with shaded background describe the instruction execution timing
if at least one of the source operands for the implied multiply operation is
bigger than 16 bits. Otherwise the instruction timing shown in the rows with
white background is valid.
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
2.5(0/0) − − − − −
Dn
5.5(0/0) − − − − −
3(0/0) − − − − −
IMM1
6(0/0) − − − − −
3.5(0/0) − − − − −
IMM2
6.5(0/0) − − − − −
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
IMM4 6.5(0/0) − − − − −
1
The rows with shaded background describe the instruction execution timing
if at least one of the source operands for the implied multiply operation is
bigger than 16 bits. Otherwise the instruction timing shown in the rows with
white background is valid.
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
2.5(0/0) − − − − −
Dn
4(0/0) − − − − −
2.5(0/0) − − − − −
IMM1
4(0/0) − − − − −
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
3(0/0) − − − − −
IMM2
4.5(0/0) − − − − −
IMM4 4.5(0/0) − − − − −
1
The rows with shaded background describe the instruction execution timing
if at least one of the source operands for the implied multiply operation is
bigger than 16 bits. Otherwise the instruction timing shown in the rows with
white background is valid.
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
1.5(0/0) − − − − −
Dn
3(0/0) − − − − −
1.5(0/0) − − − − −
IMM1
3(0/0) − − − − −
2(0/0) − − − − −
IMM2
3.5(0/0) − − − − −
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
IMM4 3.5(0/0) − − − − −
1
The rows with shaded background describe the instruction execution timing
if at least one of the source operands for the implied multiply operation is
bigger than 16 bits. Otherwise the instruction timing shown in the rows with
white background is valid.
8.2.21 Divide and Modulo Instruction Execution Times (DIVS, DIVU, MODS,
MODU)
Table 8-27 and Table 8-28 show the number of clock cycles required for execution of Signed Divide or
Modulo (DIVS, MODS) and Unsigned Divide or Modulo (DIVU, MODU) operations.
Table 8-27. Signed Divide/Modulo (DIVS/MODS) Execution Timing1
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
Dn 3+n(0/0) − − − − −
IMM1 3+n(0/0) − − − − −
IMM2
3.5+n(0/0) − − − − −
IMM4
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
REG
3+n(0/0) 4+n(0/0) 5.5+n(1/0) 6+n(1/0) 7+n(2/0) 7.5+n(2/0)
IMMe4
(IDX)
(++IDX) 4.5+n(1/0) 5.5+n(1/0) 7+n(2/0) 7.5+n(2/0) 8.5+n(3/0) 9+n(3/0)
(REG,IDX)
(IDX1)
(IDX3)
(IDX2,REG)
(IDX3,REG) 5+n(1/0) 5.5+n(1/0) 7+n(2/0) 7.5+n(2/0) 8.5+n(3/0) 9+n(3/0)
EXT1
EXT2
EXT3
[IDX1]
[IDX2] 6.5+n(2/0) 7+n(2/0) 8.5+n(3/0) 9+n(3/0) 10+n(4/0) 10.5+n(4/0)
[EXT3]
1
The letter ‘n’ denotes the number of cycles to be added depending on the size
(number of bits divided by 2) of the dividend (or nominator) operand; ‘n’ is either
4, 8, 12 or 16.
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
Dn 2.5+n(0/0) − − − − −
IMM1 2.5+n(0/0) − − − − −
IMM2
3+n(0/0) − − − − −
IMM4
REG
2.5+n(0/0) 3.5+n(0/0) 5+n(1/0) 5.5+n(1/0) 6.5+n(2/0) 7+n(2/0)
IMMe4
(IDX)
(++IDX) 4+n(1/0) 5+n(1/0) 6.5+n(2/0) 7+n(2/0) 8+n(3/0) 8.5+n(3/0)
(REG,IDX)
(IDX1)
(IDX3)
(IDX2,REG)
(IDX3,REG) 4.5+n(1/0) 5+n(1/0) 6.5+n(2/0) 7+n(2/0) 8+n(3/0) 8.5+n(3/0)
EXT1
EXT2
EXT3
Source1
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
REG
Source2 Dn (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
[IDX1]
[IDX2] 6+n(2/0) 6.5+n(2/0) 8+n(3/0) 8.5+n(3/0) 9.5+n(4/0) 10+n(4/0)
[EXT3]
1
The letter ‘n’ denotes the number of cycles to be added depending on the size
(in number of bits divided by 2) of the dividend (or nominator) operand; ‘n’ is
either 4, 8, 12 or 16.
Operation Cycles
<OP> Dn,REG
2(0/0)
<OP> Dn,#IMMe4
<OP> Dn,(IDX)
<OP> Dn,(++IDX) 3.5(1/0)
<OP> Dn,(REG,IDX)
<OP> Dn,(IDX1)
<OP> Dn,(IDX3)
<OP> Dn,(IDX2,REG)
<OP> Dn,(IDX3,REG) 4(1/0)
<OP> Dn,EXT1
<OP> Dn,EXT2
<OP> Dn,EXT3
<OP> Dn,[IDX1]
<OP> Dn,[IDX3] 5.5(2/0)
<OP> Dn,[EXT3]
Table 8-30. Shift (ASL, ASR, LSL, LSR) to Register Execution Timing
Source1
(shift operand)
(IDX1)
(IDX3)
(IDX) (IDX2,REG) [IDX1]
Source2 REG
Ds (++IDX) (IDX3,REG) [REG,IDX] [IDX3]
(shift width) IMMe4
(REG,IDX) EXT1 [EXT3]
EXT2
EXT3
IMM (3..31)
1(0/0) 2(0/0) 3.5(1/0) 4(1/0) 5(2/0) 5.5(2/0)
REG
(IDX)
(++IDX) 2.5(1/0) 3.5(1/0) 5(2/0) 5.5(2/0) 6.5(3/0) 7(3/0)
(REG,IDX)
(IDX1)
(IDX3)
(IDX2,REG)
(IDX3,REG) 3(1/0) 3.5(1/0) 5(2/0) 5.5(2/0) 6.5(3/0) 7(3/0)
EXT1
EXT2
EXT3
[IDX1]
[IDX2] 4.5(2/0) 5(2/0) 6.5(3/0) 7(3/0) 8.5(4/0) 9(4/0)
[EXT3]
Operation Cycles
<OP>.bwpl (IDX)
<OP>.bwpl (++IDX) 3.5(1/1)
<OP>.bwpl (REG,IDX)
<OP>.bwpl (IDX1)
<OP>.bwpl (IDX3)
<OP>.bwpl (IDX2,REG)
<OP>.bwpl (IDX3,REG) 4(1/1)
<OP>.bwpl EXT1
<OP>.bwpl EXT2
<OP>.bwpl EXT3
<OP>.bwpl [IDX1]
<OP>.bwpl [IDX3] 5.5(2/1)
<OP>.bwpl [EXT3]
Operation Cycles
<OP>.bwpl (IDX)
<OP>.bwpl (++IDX) 3.5(1/1)
<OP>.bwpl (REG,IDX)
<OP>.bwpl (IDX1)
<OP>.bwpl (IDX3)
<OP>.bwpl (IDX2,REG)
<OP>.bwpl (IDX3,REG) 4(1/1)
<OP>.bwpl EXT1
<OP>.bwpl EXT2
<OP>.bwpl EXT3
<OP>.bwpl [IDX1]
<OP>.bwpl [IDX3] 5.5(2/1)
<OP>.bwpl [EXT3]
Operation Cycles
<OP> REG,#opr5i
1.5(0/0)
<OP> REG,Dn
<OP>.bwl (IDX),#opr5i
<OP>.bwl (++IDX),#opr5i
<OP>.bwl (REG,IDX),#opr5i
4(1/1)
<OP>.bwl (IDX),Dn
<OP>.bwl (++IDX),Dn
<OP>.bwl (REG,IDX),Dn
<OP>.bwl (IDX1),#opr5i
<OP>.bwl (IDX3),#opr5i
<OP>.bwl (IDX2,REG),#opr5i
<OP>.bwl (IDX3,REG),#opr5i
<OP>.bwl EXT1,#opr5i
<OP>.bwl EXT2,#opr5i
<OP>.bwl EXT3,#opr5i
4.5(1/1)
<OP>.bwl (IDX1),Dn
<OP>.bwl (IDX3),Dn
<OP>.bwl (IDX2,REG),Dn
<OP>.bwl (IDX3,REG),Dn
<OP>.bwl EXT1,Dn
<OP>.bwl EXT2,Dn
<OP>.bwl EXT3,Dn
<OP>.bwl [REG,IDX],#opr5i
5.5(2/1)
<OP>.bwl [REG,IDX],Dn
Operation Cycles
<OP>.bwl [IDX1],#opr5i
<OP>.bwl [IDX3],#opr5i
<OP>.bwl [EXT3],#opr5i
6(2/1)
<OP>.bwl [IDX1],Dn
<OP>.bwl [IDX3],Dn
<OP>.bwl [EXT3],Dn
BFEXT Dd,Ds,#width:offset
2(0/0)
BFEXT Dd,Ds,Dp
BFINS Dd,Ds,#width:offset
2.5(0/0)
BFINS Dd,Ds,Dp
Operation Cycles
Operation Cycles
JMP (IDX)
JMP (++IDX) 2.0(0/0)
JMP (REG,IDX)
JMP (IDX1)
JMP (IDX3)
JMP (IDX2,REG)
JMP (IDX3,REG) 2.5(0/0)
JMP EXT1
JMP EXT2
JMP EXT3
JMP [IDX1]
JMP [IDX3] 3.5(1/0)
JMP [EXT3]
Cycles Cycles
Operation
(taken) (not taken)
Cycles Cycles
Operation
(taken) (not taken)
<OP> REG,#opr5i,oprdest
3(0/0) 2.5(0/0)
<OP> REG,Dn,oprdest
<OP>.bwl (IDX),#opr5i,oprdest
<OP>.bwl (++IDX),#opr5i,oprdest
<OP>.bwl (REG,IDX),#opr5i,oprdest
4.5(1/0) 4(1/0)
<OP>.bwl (IDX),Dn,oprdest
<OP>.bwl (++IDX),Dn,oprdest
<OP>.bwl (REG,IDX),Dn,oprdest
<OP>.bwl (IDX1),#opr5i,oprdest
<OP>.bwl (IDX3),#opr5i,oprdest
<OP>.bwl (IDX2,REG),#opr5i,oprdest
<OP>.bwl (IDX3,REG),#opr5i,oprdest
<OP>.bwl EXT1,#opr5i,oprdest
<OP>.bwl EXT2,#opr5i,oprdest
<OP>.bwl EXT3,#opr5i,oprdest
5(1/0) 4.5(1/0)
<OP>.bwl (IDX1),Dn,oprdest
<OP>.bwl (IDX3),Dn,oprdest
<OP>.bwl (IDX2,REG),Dn,oprdest
<OP>.bwl (IDX3,REG),Dn,oprdest
<OP>.bwl EXT1,Dn,oprdest
<OP>.bwl EXT2,Dn,oprdest
<OP>.bwl EXT3,Dn,oprdest
<OP>.bwl [REG,IDX],#opr5i,oprdest
6(2/0) 5.5(2/0)
<OP>.bwl [REG,IDX],Dn,oprdest
<OP>.bwl [IDX1],#opr5i,oprdest
<OP>.bwl [IDX3],#opr5i,oprdest
<OP>.bwl [EXT3],#opr5i,oprdest
6.5(2/0) 6(2/0)
<OP>.bwl [IDX1],Dn,oprdest
<OP>.bwl [IDX3],Dn,oprdest
<OP>.bwl [EXT3],Dn,oprdest
Cycles Cycles
Operation
(taken) (not taken)
DBcc Di,oprdest
DBcc xy,oprdest 2.5(0/0) 2(0/0)
DBcc REG,oprdest
DBcc.bwpl (IDX),oprdest
DBcc,bwpl (++IDX),oprdest 4.5(1/1) 4(1/1)
DBcc.bwpl (REG,IDX),oprdest
Cycles Cycles
Operation
(taken) (not taken)
DBcc.bwpl (IDX1),oprdest
DBcc.bwpl (IDX3),oprdest
DBcc.bwpl (IDX2,REG),oprdest
DBcc.bwpl (IDX3,REG),oprdest 5(1/1) 4.5(1/1)
DBcc.bwpl EXT1,oprdest
DBcc.bwpl EXT2,oprdest
DBcc.bwpl EXT3,oprdest
DBcc.bwpl [IDX1],oprdest
DBcc.bwpl [IDX3],oprdest 6.5(2/1) 6(2/1)
DBcc.bwpl [EXT3],oprdest
Cycles Cycles
Operation
(taken) (not taken)
TBcc Di,oprdest
TBcc xy,oprdest 2.5(0/0) 2(0/0)
TBcc REG,oprdest
TBcc.bwpl (IDX),oprdest
TBcc,bwpl (++IDX),oprdest 4(1/0) 3.5(1/0)
TBcc.bwpl (REG,IDX),oprdest
TBcc.bwpl (IDX1),oprdest
TBcc.bwpl (IDX3),oprdest
TBcc.bwpl (IDX2,REG),oprdest
TBcc.bwpl (IDX3,REG),oprdest 4.5(1/0) 4(1/0)
TBcc.bwpl EXT1,oprdest
TBcc.bwpl EXT2,oprdest
TBcc.bwpl EXT3,oprdest
TBcc.bwpl [IDX1],oprdest
TBcc.bwpl [IDX3],oprdest 6(2/0) 5.5(2/0)
TBcc.bwpl [EXT3],oprdest
Operation Cycles
JSR (IDX)
JSR (++IDX) 2.5(0/1)
JSR (REG,IDX)
JSR (IDX1)
JSR (IDX3)
JSR (IDX2,REG)
JSR (IDX3,REG) 3(0/1)
JSR EXT1
JSR EXT2
JSR EXT3
JSR [IDX1]
JSR [IDX3] 4.5(1/1)
JSR [EXT3]
Operation Cycles
Operation Cycles
RTS 3(1/0)
The Machine Exception Sequence causes a reset of the instruction queue. That means additional cycles to
fetch new program-code are required after execution of this sequence (for details please refer to Chapter 4,
“Instruction Queue”).
Table 8-45. Machine Exception Execution Timing
Operation Cycles
Operation Cycles
Operation Cycles
SPARE
8(1/8)
TRAP num
Operation Cycles
SWI
8(1/8)
SYS
Operation Cycles
RTI
6.5(8/0)
(no pending interrupt)
RTI
8.5(9/0)
(pending interrupt)
Operation Cycles
Exit Wait
WAI 3(1/0)
(interrupt)
(CPU in supervisor state)
Exit Wait
1(0/0)
(continue)
WAI
1(0/0)
(CPU in user state)
STOP
(STOP disabled or 1(0/0)
CPU in user state)
Operation Cycles
BGND
1(0/0)
(BDC disabled)
Table 9-1. Data Transfer Alignment for Read and Write Cycles
00 1 [OP7:OP0] − − −
01 1 − [OP7:OP0] − −
Byte
(8-bit)
10 1 − − [OP7:OP0] −
11 1 − − − [OP7:OP0]
00 1 [OP15:OP8] [OP7:OP0] − −
01 1 − [OP15:OP8] [OP7:OP0] −
Word
(16-bit)
10 1 − − [OP15:OP8] [OP7:OP0]
11 2 [OP7:OP0] − − [OP15:OP8]
1
The operand bytes in shaded fields are transferred in the second access of a split bus transfer
Opcode in Hexadecimal F0
BRA Instruction Mnemonic
REL Addressing Mode(s) or Postbyte
Opcode in Hexadecimal 1B 00
LD S Instruction Mnemonic
OPR Addressing Mode(s) or Postbyte
The IMMe4 short immediate mode uses an enumerated 4-bit code to select 1-of-16 constants where
0:0:0:0 indicates –1 and the remaining 15 codes indicate the values 1, 2, ...14, 15. These constants are
automatically sign-extended to the size of the operation. For example, the instruction LD X #–1 is an
efficient 2-byte instruction which loads 0xFFFFFF into the 24-bit index register.
* Shift instructions treat the 4-bit short immediate value as the upper four bits of a 5-bit immediate value
where the least significant bit of the 5-bit value is located in the shift postbyte.
D[2:0] selects 1-of-8 CPU data registers 0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5, 1:0:0=D0, 1:0:1=D1,
1:1:0=D6, and 1:1:1=D7. For XY, 0=X and 1=Y. For XYSP, 0:0=X, 0:1=Y, 1:0=S, and 1:1=PC. For XYS,
0:0=X, 0:1=Y, 1:0=S, and the remaining 1:1 code corresponds to another row in the decode table. The bit
labeled sign holds the high-order 9th (or sign bit) of a 9-bit signed value.
The following table shows the coding map for the xb postbyte, that results from the above decode.
Table A-4. General Operand Addressing Postbyte (xb) Coding Map
0_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ 8_ 9_ A_ B_ C_ D_ E_ F_
_0 0,X 0,Y 0,S –1 n,D2
IDX u4 IDX u4 IDX u4 IMMe4 IDX2,REG u18 n,X n,Y n,S n,PC
1,X 1,Y 1,S 1 n,D3 IDX1 s9 IDX1 s9 IDX1 s9 IDX1 s9
_1 IDX u4 IDX u4 IDX u4 IMMe4 IDX2,REG u18
2,X 2,Y 2,S 2 n,D4 n,X n,Y n,S n,PC
_2 IDX u4 IDX u4 IDX u4 IMMe4 IDX2,REG u18 IDX3 24b IDX3 24b IDX3 24b IDX3 24b
3,X 3,Y 3,S 3 n,D5 auto,–X auto,–Y auto,+X auto,+Y
_3 IDX u4 IDX u4 IDX u4 IMMe4 IDX2,REG u18 ++IDX ++IDX ++IDX ++IDX
15,X 15,Y 15,S 15 D7,X D7,Y D7,S D7 [D7,X] [D7,Y] n,D7 auto,S+
_F IDX u4 IDX u4 IDX u4 IMMe4 REG,IDX REG,IDX REG,IDX REG [REG,IDX] [REG,IDX] IDX3,REG
24b ++IDX
A.4.2 Math Postbyte (mb) for MUL, MAC, DIV, MOD and QMUL
For math instructions MUL, MAC, DIV, MOD, and QMUL, the destination is specified in bits 2:0 of the
opcode and the mb postbyte specifies the addressing modes for the two source operands. OPR addressing
modes support 16 general operand addressing sub-modes including indexed, extended, register, and auto
increment modes.
In the following decode table, Rs1 and Rs2 refer to source operand registers for the first and second
operands. The 3-bit codes select 1-of-8 CPU data registers 0:0:0=D2, 0:0:1=D3, 0:1:0=D4, 0:1:1=D5,
1:0:0=D0, 1:0:1=D1, 1:1:0=D6, and 1:1:1=D7. Memory operand size options include 8-bit byte, 16-bit
word, 24-bit pointer, and 32-bit long word.
Table A-5. MUL, MAC, DIV, MOD, and QMUL Postbyte (mb) Postbyte Decode
mb postbyte bitwise encoding Addressing modes for
b7 b6 b5 b4 b3 b2 b1 b0 Operand 1 , Operand 2
0 Rs1 Rs2 Register , Register
1 Rs1 0 Size 2 = 0:0 byte Register , OPR.B
1 Rs1 0 Size 2 = 0:1 word Register , OPR.W
1 Rs1 0 Size 2 = 1:1 long Register , OPR.L
1 Rs1 1 Size 2 = 0:0 byte Register , IMM1
1 Rs1 1 Size 2 = 0:1 word Register , IMM2
1 Rs1 1 Size 2 = 1:1 long Register , IMM4
1 Size 1 = 0:0 byte Size 2 = 0:0 byte 1 0 OPR.B , OPR.B
1 Size 1 = 0:0 byte Size 2 = 0:1 word 1 0 OPR.B , OPR.W
1 Size 1 = 0:0 byte Size 2 = 1:0 pointer 1 0 OPR.B , OPR.P
1 Size 1 = 0:0 byte Size 2 = 1:1 long 1 0 OPR.B , OPR.L
1 = Signed, 1 Size 1 = 0:1 word Size 2 = 0:0 byte 1 0 OPR.W , OPR.B
0 = Unsigned
1 Size 1 = 0:1 word Size 2 = 0:1 word 1 0 OPR.W , OPR.W
1 Size 1 = 0:1 word Size 2 = 1:0 pointer 1 0 OPR.W , OPR.P
1 Size 1 = 0:1 word Size 2 = 1:1 long 1 0 OPR.W , OPR.L
1 Size 1 = 1:0 pointer Size 2 = 0:0 byte 1 0 OPR.P , OPR.B
1 Size 1 = 1:0 pointer Size 2 = 0:1 word 1 0 OPR.P , OPR.W
1 Size 1 = 1:0 pointer Size 2 = 1:0 pointer 1 0 OPR.P , OPR.P
1 Size 1 = 1:0 pointer Size 2 = 1:1 long 1 0 OPR.P , OPR.L
1 Size 1 = 1:1 long Size 2 = 0:0 byte 1 0 OPR.L , OPR.B
1 Size 1 = 1:1 long Size 2 = 0:1 word 1 0 OPR.L , OPR.W
1 Size 1 = 1:1 long Size 2 = 1:0 pointer 1 0 OPR.L , OPR.P
1 Size 1 = 1:1 long Size 2 = 1:1 long 1 0 OPR.L , OPR.L
The following table shows the coding map for the mb postbyte, that results from the above decode.
Table A-6. MUL, MAC, DIV, MOD, and QMUL Postbyte (mb) Coding Map
Unsigned Signed
0_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ 8_ 9_ A_ B_ C_ D_ E_ F_
D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6,
_0 D2 D2 D2 D2 OPR.B OPR.B OPR.B OPR.B D2 D2 D2 D2 OPR.B OPR.B OPR.B OPR.B
D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6,
_1 D3 D3 D3 D3 OPR.W OPR.W OPR.W OPR.W D3 D3 D3 D3 OPR.W OPR.W OPR.W OPR.W
D2, D4, D0, D6, OPR.B, OPR.W, OPR.P, OPR.L, D2, D4, D0, D6, OPR.B, OPR.W, OPR.P, OPR.L,
_2 D4 D4 D4 D4 OPR.B OPR.B OPR.B OPR.B D4 D4 D4 D4 OPR.B OPR.B OPR.B OPR.B
_3 D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6,
D5 D5 D5 D5 OPR.L OPR.L OPR.L OPR.L D5 D5 D5 D5 OPR.L OPR.L OPR.L OPR.L
D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6,
_4 D0 D0 D0 D0 IMM1 IMM1 IMM1 IMM1 D0 D0 D0 D0 IMM1 IMM1 IMM1 IMM1
D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6,
_5 D1 D1 D1 D1 IMM2 IMM2 IMM2 IMM2 D1 D1 D1 D1 IMM2 IMM2 IMM2 IMM2
D2, D4, D0, D6, OPR.B, OPR.W, OPR.P, OPR.L, D2, D4, D0, D6, OPR.B, OPR.W, OPR.P, OPR.L,
_6 D6 D6 D6 D6 OPR.W OPR.W OPR.W OPR.W D6 D6 D6 D6 OPR.W OPR.W OPR.W OPR.W
D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6, D2, D4, D0, D6,
_7 D7 D7 D7 D7 IMM4 IMM4 IMM4 IMM4 D7 D7 D7 D7 IMM4 IMM4 IMM4 IMM4
D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7,
_8 D2 D2 D2 D2 OPR.B OPR.B OPR.B OPR.B D2 D2 D2 D2 OPR.B OPR.B OPR.B OPR.B
D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7,
_9 D3 D3 D3 D3 OPR.W OPR.W OPR.W OPR.W D3 D3 D3 D3 OPR.W OPR.W OPR.W OPR.W
D3, D5, D1, D7, OPR.B, OPR.W, OPR.P, OPR.L, D3, D5, D1, D7, OPR.B, OPR.W, OPR.P, OPR.L,
_A D4 D4 D4 D4 OPR.P OPR.P OPR.P OPR.P D4 D4 D4 D4 OPR.P OPR.P OPR.P OPR.P
D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7,
_B D5 D5 D5 D5 OPR.L OPR.L OPR.L OPR.L D5 D5 D5 D5 OPR.L OPR.L OPR.L OPR.L
D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7,
_C D0 D0 D0 D0 IMM1 IMM1 IMM1 IMM1 D0 D0 D0 D0 IMM1 IMM1 IMM1 IMM1
D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7,
_D D1 D1 D1 D1 IMM2 IMM2 IMM2 IMM2 D1 D1 D1 D1 IMM2 IMM2 IMM2 IMM2
D3, D5, D1, D7, OPR.B, OPR.W, OPR.P, OPR.L, D3, D5, D1, D7, OPR.B, OPR.W, OPR.P, OPR.L,
_E D6 D6 D6 D6 OPR.L OPR.L OPR.L OPR.L D6 D6 D6 D6 OPR.L OPR.L OPR.L OPR.L
D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7, D3, D5, D1, D7,
_F D7 D7 D7 D7 IMM4 IMM4 IMM4 IMM4 D7 D7 D7 D7 IMM4 IMM4 IMM4 IMM4
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_0
D2,D2 D0,D2 D2,#w:o D0,#w:o OPR.B,D2 OPR.B,D2 D2,D2 D0,D2 D2,#w:o D0,#w:o OPR.B,D2 OPR.B,D2
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_1
D2,D3 D0,D3 D2,#w:o D0,#w:o OPR.B,D3 OPR.B,D3 D2,D3 D0,D3 D2,#w:o D0,#w:o OPR.B,D3 OPR.B,D3
BFEXT Dd BFEXT Ds BFINS Dd BFINS Ds
OPR.B,#w:o OPR.B,#w:o OPR.B,#w:o OPR.B,#w:o
Appendix A Instruction Reference
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_2
D2,D4 D0,D4 D2,#w:o D0,#w:o OPR.B,D4 OPR.B,D4 D2,D4 D0,D4 D2,#w:o D0,#w:o OPR.B,D4 OPR.B,D4
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_3
D2,D5 D0,D5 D2,#w:o D0,#w:o OPR.B,D5 OPR.B,D5 D2,D5 D0,D5 D2,#w:o D0,#w:o OPR.B,D5 OPR.B,D5
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_4
D3,D2 D1,D2 D3,#w:o D1,#w:o OPR.W,D2 OPR.W,D2 D3,D2 D1,D2 D3,#w:o D1,#w:o OPR.W,D2 OPR.W,D2
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_5
D3,D3 D1,D3 D3,#w:o D1,#w:o OPR.W,D3 OPR.W,D3 D3,D3 D1,D3 D3,#w:o D1,#w:o OPR.W,D3 OPR.W,D3
BFEXT Dd BFEXT Ds BFINS Dd BFINS Ds
OPR.W,#w:o OPR.W,#w:o OPR.W,#w:o OPR.W,#w:o
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_6
D3,D4 D1,D4 D3,#w:o D1,#w:o OPR.W,D4 OPR.W,D4 D3,D4 D1,D4 D3,#w:o D1,#w:o OPR.W,D4 OPR.W,D4
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_7
D3,D5 D1,D5 D3,#w:o D1,#w:o OPR.W,D5 OPR.W,D5 D3,D5 D1,D5 D3,#w:o D1,#w:o OPR.W,D5 OPR.W,D5
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_8
D4,D2 D6,D2 D4,#w:o D6,#w:o OPR.P,D2 OPR.P,D2 D4,D2 D6,D2 D4,#w:o D6,#w:o OPR.P,D2 OPR.P,D2
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_9
D4,D3 D6,D3 D4,#w:o D6,#w:o OPR.P,D3 OPR.P,D3 D4,D3 D6,D3 D4,#w:o D6,#w:o OPR.P,D3 OPR.P,D3
BFEXT Dd BFEXT Ds BFINS Dd BFINS Ds
OPR.P,#w:o OPR.P,#w:o OPR.P,#w:o OPR.P,#w:o
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_A
D4,D4 D6,D4 D4,#w:o D6,#w:o OPR.P,D4 OPR.P,D4 D4,D4 D6,D4 D4,#w:o D6,#w:o OPR.P,D4 OPR.P,D4
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_C
D5,D2 D7,D2 D5,#w:o D7,#w:o OPR.L,D2 OPR.L,D2 D5,D2 D7,D2 D5,#w:o D7,#w:o OPR.L,D2 OPR.L,D2
Table A-14. Bitfield Extract/Insert Postbyte (bb) Coding Map
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_D
D5,D3 D7,D3 D5,#w:o D7,#w:o OPR.L,D3 OPR.L,D3 D5,D3 D7,D3 D5,#w:o D7,#w:o OPR.L,D3 OPR.L,D3
BFEXT Dd BFEXT Ds BFINS Dd BFINS Ds
OPR.L,#w:o OPR.L,#w:o OPR.L,#w:o OPR.L,#w:o
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_E
D5,D4 D7,D4 D5,#w:o D7,#w:o OPR.L,D4 OPR.L,D4 D5,D4 D7,D4 D5,#w:o D7,#w:o OPR.L,D4 OPR.L,D4
BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Dd BFEXT Ds BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Dd BFINS Ds
_F
D5,D5 D7,D5 D5,#w:o D7,#w:o OPR.L,D5 OPR.L,D5 D5,D5 D7,D5 D5,#w:o D7,#w:o OPR.L,D5 OPR.L,D5
Freescale Semiconductor
Appendix A Instruction Reference
Refer to the exchange and sign-extend coding map below. When the source register is narrower than the
destination register, the smaller source register is sign-extended as it is copied into the larger destination
register and the source register is unchanged. When the source register is wider than the destination
register, the narrower register is sign-extended as it is transferred into the wider register and the wider
register is truncated during the transfer into the narrower register. These are not considered useful
operations, this description simply documents what would happen if these unexpected combinations occur.
The two special cases EXG CCW,CCL and EXG CCW,CCH are ambiguous so CCW is not changed (this
is equivalent to a NOP instruction).
Refer to the transfer coding map below. When the source register is narrower than the destination register,
the smaller source register is zero-extended as it is transferred into the wider destination register. When the
source register is wider than the destination register, the lower portion of the source register is transferred
to the destination register.
D3 D4 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D2 -0 –
⇔ D2 ⇔ D2 ⇔ D2 ⇒ D2 ⇒ D2 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D2 ⇒ D2 ⇔ D2
D2 D4 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D3 -1 –
⇔ D3 ⇔ D3 ⇔ D3 ⇒ D3 ⇒ D3 ⇔Small ⇔Small ⇔Small ⇔Small ⇔Small ⇒ D3 ⇒ D3 ⇔ D3
D2 D3 D5 sex:D0 sex:D1 Big Big Big Big Big sex:CCH sex:CCL CCW
D4 -2 –
Appendix A Instruction Reference
-F –
EXG Big,Small: Small register gets low part of Big register, Big register gets sign-extended Small register. These cases are not expected to be useful in application programs.
EXG CCW,CCH and EXG CCW,CCL are ambiguous cases so CCW is not changed (equivalent to NOP)
Freescale Semiconductor
source D2 D3 D4 D5 D0 D1 D6 D7 X Y S – CCH CCL CCW
destination 0- 1- 2- 3- 4- 5- 6- 7- 8- 9- A- B- C- D- E- F-
Freescale Semiconductor
D2 D4 D5 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D3 -1 –
⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3 ⇒ D3
D2 D3 D5 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D4 -2 –
⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4 ⇒ D4
D2 D3 D4 00:D0 00:D1 D6L D7L XL YL SL 00:CCH 00:CCL CCW
D5 -3 –
⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5 ⇒ D5
D2L D3L D4L D5L D1 D6L D7L XL YL SL CCH CCL CCL
D0 -4 –
⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0 ⇒ D0
D2L D3L D4L D5L D0 D6L D7L XL YL SL CCH CCL CCL
D1 -5 –
⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1 ⇒ D1
0000:D2 0000:D3 0000:D4 0000:D5 000000:D0 000000:D1 D7 00:X 00:Y 00:S 000000:CCH 000000:CCL 0000:CCW
D6 -6 –
⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6 ⇒ D6
0000:D2 0000:D3 0000:D4 0000:D5 000000:D0 000000:D1 D6 00:X 00:Y 00:S 000000:CCH 000000:CCL 0000:CCW
D7 -7 –
⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7 ⇒ D7
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L Y S 0000:CCH 0000:CCL 00:CCW
X -8 –
⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X ⇒X
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L X S 0000:CCH 0000:CCL 00:CCW
Y -9 –
⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y ⇒Y
00:D2 00:D3 00:D4 00:D5 0000:D0 0000:D1 D6L D7L X Y 0000:CCH 0000:CCL 00:CCW
S -A –
⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S ⇒S
-F –
373
Appendix A Instruction Reference
Appendix A Instruction Reference
Refer to the Count Leading Sign-Bits coding map below (shaded fields are reserved).
Table A-19. Count Leading Sign-Bits (cb) Coding Map
0_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ 8_ 9_ A_ B_ C_ D_ E_ F_
_0 D2,D2 D3,D2 D4,D2 D5,D2 D0,D2 D1,D2 D6,D2 D7,D2 D2,D2 D3,D2 D4,D2 D5,D2 D0,D2 D1,D2 D6,D2 D7,D2
_1 D2,D3 D3,D3 D4,D3 D5,D3 D0,D3 D1,D3 D6,D3 D7,D3 D2,D3 D3,D3 D4,D3 D5,D3 D0,D3 D1,D3 D6,D3 D7,D3
_2 D2,D4 D3,D4 D4,D4 D5,D4 D0,D4 D1,D4 D6,D4 D7,D4 D2,D4 D3,D4 D4,D4 D5,D4 D0,D4 D1,D4 D6,D4 D7,D4
_3 D2,D5 D3,D5 D4,D5 D5,D5 D0,D5 D1,D5 D6,D5 D7,D5 D2,D5 D3,D5 D4,D5 D5,D5 D0,D5 D1,D5 D6,D5 D7,D5
_4 D2,D0 D3,D0 D4,D0 D5,D0 D0,D0 D1,D0 D6,D0 D7,D0 D2,D0 D3,D0 D4,D0 D5,D0 D0,D0 D1,D0 D6,D0 D7,D0
_5 D2,D1 D3,D1 D4,D1 D5,D1 D0,D1 D1,D1 D6,D1 D7,D1 D2,D1 D3,D1 D4,D1 D5,D1 D0,D1 D1,D1 D6,D1 D7,D1
_6 D2,D6 D3,D6 D4,D6 D5,D6 D0,D6 D1,D6 D6,D6 D7,D6 D2,D6 D3,D6 D4,D6 D5,D6 D0,D6 D1,D6 D6,D6 D7,D6
_7 D2,D7 D3,D7 D4,D7 D5,D7 D0,D7 D1,D7 D6,D7 D7,D7 D2,D7 D3,D7 D4,D7 D5,D7 D0,D7 D1,D7 D6,D7 D7,D7
_8 D2,D2 D3,D2 D4,D2 D5,D2 D0,D2 D1,D2 D6,D2 D7,D2 D2,D2 D3,D2 D4,D2 D5,D2 D0,D2 D1,D2 D6,D2 D7,D2
_9 D2,D3 D3,D3 D4,D3 D5,D3 D0,D3 D1,D3 D6,D3 D7,D3 D2,D3 D3,D3 D4,D3 D5,D3 D0,D3 D1,D3 D6,D3 D7,D3
_A D2,D4 D3,D4 D4,D4 D5,D4 D0,D4 D1,D4 D6,D4 D7,D4 D2,D4 D3,D4 D4,D4 D5,D4 D0,D4 D1,D4 D6,D4 D7,D4
_B D2,D5 D3,D5 D4,D5 D5,D5 D0,D5 D1,D5 D6,D5 D7,D5 D2,D5 D3,D5 D4,D5 D5,D5 D0,D5 D1,D5 D6,D5 D7,D5
_C D2,D0 D3,D0 D4,D0 D5,D0 D0,D0 D1,D0 D6,D0 D7,D0 D2,D0 D3,D0 D4,D0 D5,D0 D0,D0 D1,D0 D6,D0 D7,D0
_D D2,D1 D3,D1 D4,D1 D5,D1 D0,D1 D1,D1 D6,D1 D7,D1 D2,D1 D3,D1 D4,D1 D5,D1 D0,D1 D1,D1 D6,D1 D7,D1
_E D2,D6 D3,D6 D4,D6 D5,D6 D0,D6 D1,D6 D6,D6 D7,D6 D2,D6 D3,D6 D4,D6 D5,D6 D0,D6 D1,D6 D6,D6 D7,D6
_F D2,D7 D3,D7 D4,D7 D5,D7 D0,D7 D1,D7 D6,D7 D7,D7 D2,D7 D3,D7 D4,D7 D5,D7 D0,D7 D1,D7 D6,D7 D7,D7
YL Push order is top to bottom (Higher memory addresses are at the top)
YM Y Pull order is bottom to top
YH
XL If the mask bit corresponding to a register is 0, skip that register in the push or pull operation.
XM X
XH
D7L
D7ML
D7
D7MH
D7H
D6L
D6ML
D6
D6MH
D6H
D5L
D5
D5H
D4L
D4
D4H
D3L
D3
D3H
D2L
D2
D2H
D1 D1
D0 D0
CCL
CCR
CCH
E-mail:
[email protected]
<size-12>CPUS12ZRM
Rev. 1.01, <size-12>01/2013