Addressing Mode Description Addressing Mode Source Format Abbrev. Description

Similar documents
Table 1: Mnemonics Operations Dictionary. Add Accumulators Add B to Y. Add with carry to B. Add Memory to B. Add 16-bit to D And B with Memory

Programming the Motorola MC68HC11 Microcontroller

The Motorola 68HC11 Instruc5on Set

Department of Computer Science and Engineering

SECTION 6 CENTRAL PROCESSING UNIT

Disassembly of an HC12 Program It is sometimes useful to be able to convert HC12 op codes into mnemonics. For example, consider the hex code:

EE319K Fall 2007 Quiz 1A Page 1. (5) Question 2. What will be the value of the carry (C) bit after executing the following? ldab #210 subb #60

EE319K Fall 2006 Quiz 1 Page 1

EE319K Fall 2005 Quiz 1A Page 1

Reading Assignment. 68HC12 Instruction Set. M68HC12 Instruction Set Categories. Some Tips. Endianness (Byte Order) Load and Store Instructions

Lecture 6 Assembly Programming: Branch & Iteration

EE319K Fall 2003 Quiz 1 Page 1

Chapter 2: HCS12 Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

Fri. Aug 25 Announcements

MIGRATING TO THE 68HC12 IN C

EE319K Spring 2010 Exam 1A Page 1

EE319K Fall 2010 Exam 1B Page 1

Assembly Language Development Process. ECE/CS 5780/6780: Embedded System Design. Assembly Language Listing. Assembly Language Syntax

2) [ 2 marks] Both of the following statements cause the value $0300 to be stored in location $1000, but at different times. Explain the difference.

0b) [2] Can you name 2 people form technical support services (stockroom)?

Menu. Programming Models for the Atmel XMEGA Architecture (and others devices) Assembly Programming Addressing Modes for the XMEGA Instruction Set

ECE/CS 5780/6780: Embedded System Design

Administrivia. ECE/CS 5780/6780: Embedded System Design. Assembly Language Syntax. Assembly Language Development Process

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

COE538 Lecture Notes Week 3 (Week of Sept 17, 2012)

(5) Question 7. Simplified memory cycles (you may or may not need all 5 entries) R/W Addr Data

Chapter 2 HCS12 Assembly Language

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).

Lecture 7 Assembly Programming: Shift & Logical

EE 3170 Microcontroller Applications

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES

EE4390 Microprocessors

instruction 1 Fri Oct 13 13:05:

ECET Chapter 2, Part 3 of 3

EE 308 Spring The HCS12 has 6 addressing modes

Condition Code Register. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

HC11 Instruction Set

538 Lecture Notes Week 3

538 Lecture Notes Week 3

Outline. 2.8 Stack. 2.9 Subroutines

Transporting M68HC11 Code to M68HC12 Devices

538 Lecture Notes Week 2

EE 3170 Microcontroller Applications

68HC11 PROGRAMMER'S MODEL

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)

Exam I Review February 2017

Motorola Semiconductor Technical Data. CPU12 Reference Guide. Figure 1. Programming Model. Order this document by CPU12RG/D Rev. 1

Motorola HC11. Fun with Microcontrollers and Embedded Systems

Motorola 6809 and Hitachi 6309 Programmer s Reference

Lecture 9 Subroutines

EE319K Fall 2006 Final A Page 1

S12CPUV2. Reference Manual HCS12. Microcontrollers. S12CPUV2/D Rev. 0 7/2003 MOTOROLA.COM/SEMICONDUCTORS

AN1064. Motorola Semiconductor Application Note. Use of Stack Simplifies M68HC11 Programming By Gordon Doughman. Introduction

Introduction to Microcontroller. Systems. Embedded system. Assembler or C? Datatypes 2. Datatypes 1

CS 273 Machine Programming and Organization Lecture Notes

ECE 3120 Computer Systems Arithmetic Programming

Exam 2 E2-1 Fall Name: Exam 2

Introduction to Microcomputer Systems Addressing modes

CPU12 REFERENCE MANUAL

CHAPTER 8. Solutions for Exercises

Most of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access

EE319K Fall 2007 Quiz 3 Page 1 of 8

Timing Generation and Measurements

Exam 2 E2-1 Fall Name: Exam 2

CPU08RM/AD REV 3 8M68HC08M. CPU08 Central Processor Unit. Reference Manual

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

ECE 372 Microcontroller Design Assembly Programming. ECE 372 Microcontroller Design Assembly Programming

The 6502 Instruction Set

Lecture #3 Microcontroller Instruction Set Embedded System Engineering Philip Koopman Wednesday, 20-Jan-2015

Sample Problem Set #1

Lecture 11: Advanced Arithmetic Instructions

C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions

Module 1-G. Marcos and Structured Programming

Accumulator and memory instructions 1. Loads, stores, and transfers 2. Arithmetic operations 3. Multiply and divide 4. Logical operations 5. Data test

Cmpt 150 The Freescale CPU12 March, The Freescale HC12

Microcontrollers and Embedded Systems. Fun with Motorola/Freescale HC11

HC11 Instruction Set Architecture

HC11 Instruction Set Architecture

ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7

Coe538 Final Study Guide 2016 (Questions & Answers)

7.5 HCS08 Instruction Set Summary

Introduction to Embedded Microcomputer Systems Lecture 8.1. Computers in the future may weigh no more than 1.5 tons Popular Science, 1949

ECET Chapter 2, Part 2 of 3

A. CPU INSTRUCTION SET SUMMARY

Microcontrollers. 2IN60: Real-time Architectures (for automotive systems) Mike Holenderski,

EE 3170 Microcontroller Applications

COSC345 Software Engineering. Basic Computer Architecture and The Stack

EECE416 :Microcomputer Fundamentals and Design Instruction Sets and Groups

Introduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12. EE383: Introduction to Embedded Systems University of Kentucky

Exam 1 Feb. 23, 25, 27?

Chapter 7 Central Processor Unit (S08CPUV2)

Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 2003

PROGRAMMING THE MICROCONTROLLER

Using the stack and the stack pointer

HC 11 Instructions! From Alex Hollowayʼs notes with! many thanks!

CET335 Microprocessor Interfacing Lab 5: LCD Interface (Bus Attached Peripheral)

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3. You will be able to use all of the Motorola data manuals on the exam.

Transcription:

Addressing Mode Description Addressing Mode Source Format Abbrev. Description Inherent INST (no operands) INH Operands (if any) are in CPU registers Immediate INST #opr8i or INST #opr16i IMM Operand is included in instruction stream. 8- or 16-bit size implied by context Direct INST opr8a DIR Operand is the lower 8 bits of an address in the range $0000-$00FF Extended (Direct) INST opr16a EXT Operand is a 16-bit address Relative INST rel8 or INST rel16 REL An 8-bit or 16-bit relative offset from the current PC is supplied in the instruction Indexed (5-bit offset) INST oprx5,xysp IDX 5-bit signed constant offset from x,y,sp, or pc Indexed (9-bit offset) INST oprx9,xysp IDX1 9-bit signed constant offset from x, y, sp, or pc (lower 8-bits of offset in one extension byte) Indexed (16-bit offset) INST oprx16,xysp IDX2 16-bit constant offset from x, y, sp, or pc (16-bit offset in two extension bytes) Indexed (accumulator offset) INST abd,xysp IDX Indexed with 8-bit (A or B) or 16-bit (D) accumulator offset from x, y, sp, or pc Indexed-Indirect (16-bit offset) INST [oprx16,xysp] [IDX2] Pointer to operand is found at 16-bit constant offset from x, y, sp, or pc Indexed-Indirect (D acc. offset) INST [D,xysp] [D,IDX] Pointer to operand is found at x, y, sp, or pc plus the value in D Indexed (pre-decrement) INST oprx3,-xys IDX Auto pre-decrement x, y, or sp by 1 ~ 8 Indexed (pre-increment) INST oprx3,+xys IDX Auto pre-increment x, y, or sp by 1 ~ 8 Indexed (post-decrement) INST oprx3,xys- IDX Auto post-decrement x, y, or sp by 1 ~ 8 Indexed (post-increment) INST oprx3,xys+ IDX Auto post-increment x, y, or sp by 1 ~ 8 1 of 16

Load and Store Instructions LDAA Load A (M) A LDAB Load B (M) B LDD Load D (M:M+1) (A:B) LDS Load SP (M:M+1) SP LDX Load index register X (M:M+1) X LDY Load index register Y (M:M+1) X LEAS Load effective address into SP Effective address SP LEAX Load effective address into X Effective address X LEAY Load effective address into Y Effective address Y STAA Store A (A) M STAB Store B (B) M STD Store D (A) M, (B) M+1 STS Store SP (SP) M, M+1 STX Store X (X) M:M+1 STY Store Y (Y) M:M+1 2 of 16

Transfer Instructions TAB Transfer A to B (A) B TAP Transfer A to CCR (A) CCR TBA Transfer B to A (B) A TFR Transfer register to register (A, B, CCR, D, X, Y, or SP) A, B, CCR, D, X, Y, or SP TPA Transfer CCR to A (CCR) A TSX Transfer SP to X (SP) X TSY Transfer SP to Y (SP) Y TXS Transfer X to SP (X) SP TYS Transfer Y to SP (Y) SP Exchange Instructions EXG Exchange register to register (A, B, CCR, D, X, Y, or SP) A, B, CCR, D, X, Y, or SP) XGDX Exchange D with X (D) (X) XGDY Exchange D with Y (D) (Y) Sign Extension Instruction SEX Sign extend 8-Bit operand (A, B, or CCR) D, X, Y, or SP 3 of 16

Add and Subtract Instructions ABA Add B to A (A) + (B) A ABX Add B to X (B) + (X) X ABY Add B to Y (B) + (Y) Y ADCA Add with carry to A (A) + (M) + C A ADCB Add with carry to B (B) + (M) + C B ADDA Add without carry to A (A) + (M) A ADDB Add without carry to B (B) + (M) B ADDD Add to D (A:B) + (M : M + 1) A : B SBA Subtract B from A (A) (B) A SBCA Subtract with borrow from A (A) (M) C A SBCB Subtract with borrow from B (B) (M) C B SUBA Subtract memory from A (A) (M) A SUBB Subtract memory from B (B) (M) B SUBD Subtract memory from D (A:B) (D) (M : M + 1) D 4 of 16

Boolean Logic Instructions ANDA AND A with memory (A) (M) A ANDB AND B with memory (B) (M) B ANDCC AND CCR with memory (clear CCR bits) (CCR) (M) CCR EORA Exclusive OR A with memory (A) (M) A EORB Exclusive OR B with memory (B) (M) B ORAA OR A with memory (A) + (M) A ORAB OR B with memory (B) + (M) B ORCC OR CCR with memory (set CCR bits) (CCR) + (M) CCR BCD Add and Subtract Instructions ABA Add B to A (A) + (B) A ADCA Add with carry to A (A) + (M) + C A ADCB(1) Add with carry to B (B) + (M) + C B ADDA Add memory to A (A) + (M) A ADDB(1) Add memory to B (B) + (M) B DAA Decimal adjust A (A) bcd(a) 1. These instructions are not normally used for BCD operations because, although they affect H correctly, they do not leave the result in the correct accumulator (A) to be used with the DAA instruction. Thus additional steps would be needed to adjust the result to correct BCD form. 5 of 16

Decrement and Increment Instructions DEC Decrement memory (M) $01 M DECA Decrement A (A) $01 A DECB Decrement B (B) $01 B DES Decrement SP (SP) $0001 SP DEX Decrement X (X) $0001 X DEY Decrement Y (Y) $0001 Y INC Increment memory (M) + $01 M INCA Increment A (A) + $01 A INCB Increment B (B) + $01 B INS Increment SP (SP) + $0001 SP INX Increment X (X) + $0001 X INY Increment Y (Y) + $0001 Y 6 of 16

Multiplication, Multiplication and Addition and Division Instructions MUL 8 by 8 multiply (unsigned) (A) (B) A : B EMUL 16 by 16 multiply (unsigned) (D) (Y) Y : D EMULS 16 by 16 multiply (signed) (D) (Y) Y : D EMACS Multiply and accumulate (signed) 16 bit by 16 bit 32 bit ((M(X):M(X+1)) (M(Y):M(Y+1))) + (M ~ M + 3) M ~ M + 3 EDIV 32 by 16 divide (unsigned) (Y : D) (X) Y, Remainder D EDIVS 32 by 16 divide (signed) (Y : D) (X) Y, Remainder D FDIV 16 by 16 fractional divide (D) (X) X, Remainder D IDIV 16 by 16 integer divide (unsigned) (D) (X) X, Remainder D IDIVS 16 by 16 integer divide (signed) (D) (X) X, Remainder D 7 of 16

Compare Instructions and Test Instructions CBA Compare A to B (A) (B) CMPA Compare A to memory (A) (M) CMPB Compare B to memory (B) (M) CPD Compare D to memory (16-bit) (A : B) (M : M + 1) CPS Compare SP to memory (16-bit) (SP) (M : M + 1) CPX Compare X to memory (16-bit) (X) (M : M + 1) CPY Compare Y to memory (16-bit) (Y) (M : M + 1) TST Test memory for zero or minus (M) $00 TSTA Test A for zero or minus (A) $00 TSTB Test B for zero or minus (B) $00 8 of 16

Unary and Simple Branch Instructions Mnemonic Function Equation or Operation Unary Branches BRA Branch always 1 = 1 BRN Branch never 1 = 0 Simple Branches BCC Branch if carry clear C = 0 BCS Branch if carry set C = 1 BEQ Branch if equal Z = 1 BMI Branch if minus N = 1 BNE Branch if not equal Z = 0 BPL Branch if plus N = 0 BVC Branch if overflow clear V = 0 BVS Branch if overflow set V = 1 9 of 16

Unsigned and Signed Branch Instructions Mnemonic Function Relation Equation or Operation Unsigned Branches BHI Branch if higher R > M C + Z = 0 BHS Branch if higher or same R M C = 0 BLO Branch if lower R < M C = 1 BLS Branch if lower or same R M C+ Z = 1 BGE Signed Branches Branch if greater than or equal R M N V = 0 BGT Branch if greater than R > M Z + (N V) = 0 BLE Branch if less than or equal R M Z+ (N V) = 1 BLT Branch if less than R < M N V = 1 Bit Condition Branch Instructions Mnemonic Function Equation or Operation BRCLR Branch if selected bits clear (M) (mm) = 0 BRSET Branch if selected bits set (~M) (mm) = 0 10 of 16

Loop Primitive Instructions Mnemonic Function Equation or Operation DBEQ Decrement counter and branch if = 0, (counter = A, B, D, X, Y, or SP) DBNE Decrement counter and branch if 0, (counter = A, B, D, X, Y, or SP) IBEQ Increment counter and branch if = 0, (counter = A, B, D, X, Y, or SP) IBNE Increment counter and branch if 0, (counter = A, B, D, X, Y, or SP) TBEQ Test counter and branch if = 0, (counter = A, B, D, X,Y, or SP) TBNE Test counter and branch if 0, (counter = A, B, D, X,Y, or SP) (counter) 1 counter, If (counter) = 0, then branch; else continue to next instruction (counter) 1 counter, If (counter) not = 0, then branch; else continue to next instruction (counter) + 1 counter, If (counter) = 0, then branch; else continue to next instruction (counter) + 1 counter, If (counter) not = 0, then branch; else continue to next instruction If (counter) = 0, then branch; else continue to next instruction If (counter) not = 0, then branch; else continue to next instruction 11 of 16

Shift and Rotate Instructions Logical Shifts LSL LSLA LSLB Logic shift left memory Logic shift left A Logic shift left B C b7 b6 b5 b4 b3 b2 b1 b0 0 LSLD Logic shift left D LSR LSRA LSRB Logic shift right memory Logic shift right A Logic shift right B 0 b7 b6 b5 b4 b3 b2 b1 b0 C LSRD Logic shift right D 0 b7 b6 b5 b4 b3 b2 b1 b0 b7 b6 b5 b4 b3 b2 b1 b0 C Arithmetic Shifts A B ASL ASLA ASLB Arithmetic shift left memory Arithmetic shift left A Arithmetic shift left B C b7 b6 b5 b4 b3 b2 b1 b0 0 ASLD Arithmetic shift left D ASR ASRA ASRB Arithmetic shift right memory Arithmetic shift right A Arithmetic shift right B b7 b6 b5 b4 b3 b2 b1 b0 C Rotates ROL ROLA ROLB ROR RORA RORB Rotate left memory through carry Rotate left A through carry Rotate left B through carry Rotate right memory through carry Rotate right A through carry Rotate right B through carry C b7 b6 b5 b4 b3 b2 b1 b0 b7 b6 b5 b4 b3 b2 b1 b0 C 12 of 16

Bit Test and Manipulation Instructions BCLR Clear bits in memory (M) (not(mm)) M BITA Bit test A (A) (M) BITB Bit test B (B) (M) BSET Set bits in memory (M) + (mm) M 13 of 16

Stack Operation Instructions PSHA Push A (SP) 1 SP; (A) M(SP) PSHB Push B (SP) 1 SP; (B) M(SP) PSHC Push CCR (SP) 1 SP; (A) M(SP) PSHD Push D (SP) 2 SP; (A : B) M(SP) : M(SP+1) PSHX Push X (SP) 2 SP; (X) M(SP) : M(SP+1) PSHY Push Y (SP) 2 SP; (Y) M(SP) : M(SP+1) PULA Pull A (M(SP)) A; (SP) + 1 SP PULB Pull B (M(SP)) B; (SP) + 1 SP PULC Pull CCR (M(SP)) CCR; (SP) + 1 SP PULD Pull D (M(SP) : M(SP+1)) A : B; (SP) + 2 SP PULX Pull X (M(SP) : M(SP+1)) X; (SP) + 2 SP PULY Pull Y (M(SP) : M(SP+1)) Y; (SP) + 2 SP 14 of 16

Jump and Subroutine Instructions BSR Branch to subroutine SP 2 SP RTNH : RTNL M(SP) : M(SP+1) Subroutine address PC CALL Call subroutine in expanded memory SP 2 SP RTNH:RTNL M(SP) : M(SP+1) SP 1 SP (PPAGE) M(SP) Page PPAGE Subroutine address PC JMP Jump Address PC JSR Jump to subroutine SP 2 SP RTNH : RTNL M(SP) : M(SP+1) Subroutine address PC RTC Return from call M(SP) PPAGE SP + 1 SP M(SP) : M(SP+1) PCH : PCL SP + 2 SP RTS Return from subroutine M(SP) : M(SP+1) PCH : PCL SP + 2 SP 15 of 16

9S12DP256 Memory Map Address Module Size (Bytes) $0000 - $0017 CORE (Ports A, B, E, Modes, Inits, Test) 24 $0018 - $0019 Reserved 2 $001A - $001B Device ID register (PARTID) 2 $001C - $001F CORE (MEMSIZ, IRQ, HPRIO) 4 $0020 - $0027 Reserved 8 $0028 - $002F CORE (Background Debug Mode) 8 $0030 - $0033 CORE (PPAGE, Port K) 4 $0034 - $003F Clock and Reset Generator (PLL, RTI, COP) 12 $0040 - $007F Enhanced Capture Timer 16-bit 8 channels 64 $0080 - $009F Analog to Digital Converter 10-bit 8 channels (ATD0) 32 $00A0 - $00C7 Pulse Width Modulator 8-bit 8 channels (PWM) 40 $00C8 - $00CF Serial Communications Interface 0 (SCI0) 8 $00D0 - $00D7 Serial Communications Interface 0 (SCI1) 8 $00D8 - $00DF Serial Peripheral Interface (SPI0) 8 $00E0 - $00E7 Inter IC Bus 8 $00E8 - $00EF Byte Data Link Controller (BDLC) 8 $00F0 - $00F7 Serial Peripheral Interface (SPI1) 8 $00F8 - $00FF Serial Peripheral Interface (SPI2) 8 $0100- $010F Flash Control Register 16 $0110 - $011B EEPROM Control Register 12 $011C - $011F Reserved 4 $0120 - $013F Analog to Digital Converter 10-bit 8 channels (ATD1) 32 $0140 - $017F Motorola Scalable Can (CAN0) 64 $0180 - $01BF Motorola Scalable Can (CAN1) 64 $01C0 - $01FF Motorola Scalable Can (CAN2) 64 $0200 - $023F Motorola Scalable Can (CAN3) 64 $0240 - $027F Port Integration Module (PIM) 64 $0280 - $02BF Motorola Scalable Can (CAN4) 64 $02C0 - $03FF Reserved 320 $0000 - $0FFF EEPROM array 4096 $1000 - $3FFF RAM array 12288 $4000 - $7FFF Fixed Flash EEPROM 16384 $8000 - $BFFF Flash EEPROM Page Window 16384 $C000 - $FFFF Fixed Flash EEPROM 16384 16 of 16