LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz
|
|
- Alexina Hill
- 6 years ago
- Views:
Transcription
1 LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz G-CPU Important Notes (see Schwartz s lecture for a general overview) - The G-CPU is little endian, meaning the LSB is stored and loaded before the MSB in a 16-bit word (as opposed to big endian). - The conditional code register (CCR) contains a negative (N) flag and a zero (Z) flag, which are only dependent on register A. - The memory used in the G-CPU is synchronous. For this reason, a memory clock (MCLK) is used to drive the SRAM and EPROM. Two T flipflops are used in series to create a system clock (CLOCK ) that is 1/4 th the speed of the memory clock. In this way, we can pretend that the SRAM and EPROM are running asynchronously to the system. - The SRAM used in the G-CPU has both input data lines (for writing) and output data lines (for reading). - The exhaustive next state truth table (NSTT) that is stored in the memory for implementing the controller has 2 14 possible states/addresses. - Branch statements (BRA, BEQ, BN, BP) only modify the lowest byte of an address. For this reason, you cannot jump past certain break points (where the ninth bit changes). Assembly Language Format Instruction Set: A list of all the operations that can be performed by a μprocessor. General format for an instruction (on the MC68HC11): Label: Operation-Mnemonic Operand(s) ;Comments - A label is a symbolic name for the address of an instruction. - A label is not required and is generally only used when necessary. - The colon (:) is optional and is not considered part of the label. - Labels are used with branch and jump statements. - Labels can be used to point to a specific address containing data. - An operation-mnemonic is an abbreviation that corresponds to a command. - Note: A mnemonic is a memory aid. - An operand denotes the object to be operated upon. - An operand may represent an address, register, or immediate data. - Comments are used to explain code, making it easier to follow. - The assembler I used in college denoted comments with a semi-colon. (Look at the instruction set for the G-CPU.) Page 1 of 6
2 Addressing Modes Effective Address: The address of the data operated on by an instruction. - You should be able to find the effective address for: - Immediate Addressing (the address of the operand pointed to by the PC) - Extended Addressing - Direct Addressing - Indexed Addressing - Inherent Addressing - Addressing is inherent to the instruction (usually used with registers). - Examples: TAB INX SUM_BA - Immediate Addressing (denoted by a # symbol) - The operand is the data to be used by the instruction. - Examples: LDAA #$42 LDX #$1B00 (You cannot STAA #$42. Why?) Note: Certain symbols indicate the radix for a number: $ => => Octal % => Binary => ASCII (none) => Decimal - Extended Addressing - The operand gives the address where the data is stored. - Examples: LDAA $1300 STAA $1400 LDX $ Direct Addressing (the G-CPU does not have this type of addressing) - Similar to extended addressing, except: - The upper address byte is assumed to be $00 - Direct addressing only accesses the address range $0000-$00FF - $0000 to $00FF is called the direct page - Direct addressing is faster than extended addressing - Examples: LDAA $A0 STAA $B0 LDX $C0 Note: The assembler knows the difference between extended because only one byte was given for the address. Page 2 of 6
3 - Indexed Addressing - Gives the address relative to the address in an index register (IX or IY). - The number supplied is a displacement/offset. - Displacements are (positive) unsigned binary, ranging from $00 to $FF. - Examples: LDAA 0,X STAA $2A, Y Note: IX and IY remain unchanged. - Relative Addressing (the G-CPU does not have this type of addressing) - Similar to indexed, but used to change the Program Counter (PC). - Displacements are 2 s complement, ranging from $00 to $FF. - Generally, used with branch statements. - Examples: BEQ $FE ;Branches back 2 addresses BNE $04 ;Branches forward 4 addresses Note: The MC68HC11 has memory-mapped I/O, meaning that its input and output ports are accessed using the same addressing modes as memory (discussed above). Assembler Directives Assembly control: ORG => Sets the origin (starting point) of the program or dataset Example: ORG $1300 Symbol Definition: EQU => Assigns a permanent value to a symbol name. Example: Answer EQU $42 (Note: Answer can be used anywhere the value $42 could be used.) Data Definition/Storage Allocation: DC.B => Define constant byte (allocates and initializes memory) Examples: (label) DC.B $42, $AB, $F0, 64 DC.W => Define constant word (allocates and initializes memory) Example: (label) DC.W $42AB, $F040 DS.B => Define storage bytes (allocates uninitialized memory space) Example: (label) DS.B 4 DS.W => Define storage word (allocates uninitialized memory space) Example: (label) DS.W 2 Page 3 of 6
4 Example Code Given a location in memory containing a dataset of X consecutive, 8-bit, unsigned binary numbers, write a program that adds the numbers together and stores the result in another portion of memory. The dataset at the given memory location is organized as follows: - X is the first byte and is an unsigned binary number indicating how many numbers must be added together to obtain the result. - Next is the address where the sum should be stored. - Finally, the dataset of consecutive, 8-bit, unsigned binary numbers. (Note: You may ignore problems with overflow/roll-over.) ORG $19FF ;Table in SRAM (Given) DS.B 1 Dataset DC.B 3 ;X DC.W $FF19 ;Address to store the sum (little endian). DC.B $4A, $11, $24 ;Dataset ORG $0000 ;G-CPU always starts at $0000 LDX #Dataset ;IX points to dataset (Dataset address is a given) LDAA 0,X ;RegA gets counter INX LDY 0,X ;IY points to storage location LDAB #$00 STAB 0,Y ;Initialize current sum to zero INX Loop INX STAA Counter ;Save counter LDAA 0,X ;Get next value LDAB 0,Y ;Get current sum SUM_AB ;Add current numbers into RegB STAB 0,Y ;Save current sum LDAB #NegOne LDAA Counter ;Get counter SUM_BA ;Decrement counter BNE Loop ;Repeat until count is zero (all numbers are added) Done BEQ Done ;End program ORG $1000 ;Storage values must be in SRAM (not EPROM) Counter DS.B 1 ;Storage for the counter NegOne EQU $FF ;To decrement, we must add a 2 s complement -1. Note: We wrote the code using indexed addressing so that it is a general program that can be used for any memory location (as opposed to hard coded to a specific address). Page 4 of 6
5 So what happens next? We created our program in a text editor. This is called our source file. Next we use and assembler to assemble our program, generating 2 files: - The List file is a human readable file containing: - Addressing information - Machine code (only binary/hexadecimal) - Assembly code (the program) - The Object file is the assembled machine code the μprocessor will use. We simulate and debug the program at this point. The final Object file is then downloaded to memory so the μprocessor can run it. Hand Assembly There is no G-CPU assembler, so we need to hand assemble the code. - Use the G-CPU Instruction Set (found in the G-CPU documentation). Addresses Machine Code Labels Assembly Code ORG $19FF $19FF $XX DS.B 1 $1A00 $03 Dataset DC.B 3 $1A01-$1A02 $FF $19 DC.W $FF19 $1A03-$1A05 $4A $11 $24 DC.B $4A, $11, $24 ORG $0000 $0000-$0002 $08 $00 $1A LDX #Dataset $0003-$0004 $0C $00 LDAA 0,X $0005 $30 INX $0006-$0007 $?? $00 LDY 0,X $0008-$0009 $03 $00 LDAB #$00 $000A-$000B $13 $00 STAB 0,Y $000C $30 INX $000D $30 Loop INX $000E-$0010 $06 $00 $10 STAA Counter $0011-$0012 $0C $00 LDAA 0,X $0013-$0014 $0F $00 LDAB 0,Y $0015 $15 SUM_AB $0016-$0017 $13 $00 STAB 0,Y $0018-$0019 $03 $FF LDAB #NegOne $001A-$001B $04 $00 $10 LDAA Counter $001C $14 SUM_BA $001D-$001E $21 $0D BNE Loop $001F-$0020 $20 $1F Done BEQ Done ORG $1000 $1000 $XX Counter DS.B 1 NegOne EQU $FF Note: The G-CPU cannot perform the LDY 0,X operation See next page for solutions. Page 5 of 6
6 Possible ways to work around the LDY 0,X problem: Option 1: Add a label at $1A01 called Address: LDY Address Option 2: Rearrange the table so that the storage address comes before X. LDY Dataset (You must increment IX twice before retrieving the counter.) Option 3: Define a space to save the address and load IY from there. LDAB 0,X STAB LSB LDAB 1,X STAB MSB LDY LSB... ORG $1001 LSB DS.B 1 MSB DS.B 1 Page 6 of 6
Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my...
Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my... See examples on web: DirAddr.asm, ExtAddr.asm, IndAddr.asm,
More informationHomework 12 Solutions
Page 1/6 1. Here is a short program that shows all addressing modes: We are given a table of student's test scores where there are three scores in a semester per student. Unfortunately, the person who
More informationME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7
ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume LECTURE 7 Reading Assignments Reading assignments for this week and next
More informationDecimal, Hexadecimal and Binary Numbers Writing an assembly language program
Decimal, Hexadecimal and Binary Numbers Writing an assembly language program o Disassembly of MC9S12 op codes o Use flow charts to lay out structure of program o Use common flow structures if-then if-then-else
More informationEE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University
EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1 Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University What is Assembly Language? Assembly language is a programming language
More informationTotal: EEL 3701 Digital Logic & Computer Systems Final Exam Fall Semester 2007 COVER SHEET: Re-Grade Information: 1 (10) 2 (10) 3 (10) 4 (14) 5 (14)
COVER SHEET: Prob. Points: Re-Grade Information: Total: 1 (10) 2 (10) 3 (10) 4 (14) 5 (14) 6 (15) 7 (15) 8 (12) (100) 1 Remember to show ALL work here and in EVERY problem on this exam. [10%] 1. Circuit
More informationY = (A + C) (A + B) (B + C)
EEL3701 Dr. Gugel Last Name First Name Spring 2012 Final Quiz UF ID# Open book and open notes, 90-minute examination to be done in non-red pencil or pen. No electronic devices permitted. All work and solutions
More information538 Lecture Notes Week 2
538 Lecture Notes Week 2 (Sept. 13, 2017) 1/15 Announcements 538 Lecture Notes Week 2 Labs begin this week. Lab 1 is a one-week lab. Lab 2 (starting next week) is a two-week lab. 1 Answers to last week's
More informationChapter 2: HCS12 Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh
Chapter 2: HCS12 Assembly Programming EE383: Introduction to Embedded Systems University of Kentucky Samir Rawashdeh With slides based on material by H. Huang Delmar Cengage Learning 1 Three Sections of
More informationLecture 5 Assembly Programming: Arithmetic
CPE 390: Microprocessor Systems Spring 2018 Lecture 5 Assembly Programming: Arithmetic Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030
More informationAddition and Subtraction of Hexadecimal Numbers Simple assembly language programming
Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming o A simple Assembly Language Program o Assembling an Assembly Language Program o Simple 9S12 programs o Hex code generated
More informationLecture 6 Assembly Programming: Branch & Iteration
CPE 390: Microprocessor Systems Spring 2018 Lecture 6 Assembly Programming: Branch & Iteration Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ
More informationEE 3170 Microcontroller Applications
Q. 3.9 of HW3 EE 37 Microcontroller Applications (a) (c) (b) (d) Midterm Review: Miller Chapter -3 -The Stuff That Might Be On the Exam D67 (e) (g) (h) CEC23 (i) (f) (j) (k) (l) (m) EE37/CC/Lecture-Review
More informationME 6405 Introduction to Mechatronics
ME 6405 Introduction to Mechatronics Fall 2005 Instructor: Professor Charles Ume LECTURE 9 Homework 1 Solution 1. Write an assembly language program to clear the usable internal RAM in the M68HC11E9. Solution:
More informationLab 2 Part 1 Assembly Language Programming and 9S12 Ports
Lab 2 Part 1 Assembly Language Programming and 9S12 Ports In this sequence of three labs, you will learn how to write simple assembly language programs for the MC9S12 microcontroller, and how to use general
More informationMC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES
MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes o Review of Addressing Modes o Which branch instruction to use (signed vs unsigned) o Using X and Y registers
More information1. Memory Mapped Systems 2. Adding Unsigned Numbers
1 Memory Mapped Systems 2 Adding Unsigned Numbers 1 1 Memory Mapped Systems Our system uses a memory space Address bus is 16-bit locations Data bus is 8-bit 2 Adding Unsigned Numbers 2 Our system uses
More informationAddition and Subtraction of Hexadecimal Numbers Simple assembly language programming
Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming o A simple Assembly Language Program o Assembling an Assembly Language Program o Simple 9S12 programs o Hex code generated
More informationCodeWarrior. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff
CodeWarrior 1 Assembler An assembler is a program that translates assembly language into machine code. Machine code are the numbers that the CPU recognizes as instructions. $B6 $10 $00 Assembly language
More informationMost of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access
HC12 Addressing Modes Instruction coding and execution o Inherent, Extended, Direct, Immediate, Indexed, and Relative Modes o Summary of MC9S12 Addressing Modes o Using X and Y registers as pointers o
More informationExam I Review February 2017
Exam I Review February 2017 Binary Number Representations Conversion of binary to hexadecimal and decimal. Convert binary number 1000 1101 to hexadecimal: Make groups of 4 bits to convert to hexadecimal,
More informationProgramming the Motorola MC68HC11 Microcontroller
Programming the Motorola MC68HC11 Microcontroller COMMON PROGRAM INSTRUCTIONS WITH EXAMPLES aba Add register B to register A Similar commands are abx aby aba add the value in register B to the value in
More informationMark II Aiken Relay Calculator
Introduction to Embedded Microcomputer Systems Lecture 6.1 Mark II Aiken Relay Calculator 2.12. Tutorial 2. Arithmetic and logical operations format descriptions examples h 8-bit unsigned hexadecimal $00
More informationECE 3120 Computer Systems Arithmetic Programming
ECE 3120 Computer Systems Arithmetic Programming Manjeera Jeedigunta http://blogs.cae.tntech.edu/msjeedigun21 Email: msjeedigun21@tntech.edu Tel: 931-372-6181, Prescott Hall 120 Today: Multiplication and
More informationCross Assembly and Program Development
Cross Assembly and ENGG4640/3640; Fall 2004; Prepared by Radu Muresan 1 Introduction Text Editor Program Ex. DOS, Notepad, Word saved as ASCII Source Code Assembler or Cross-Assembler Object Code Machine
More informationIt translates (converts) assembly language to machine code.
Assemblers 1 It translates (converts) assembly language to machine code. Example: LDAA $0180 Uses an instruction set manual: Tests/Final Exam. B6 01 80 Use software: Like the IDE in the Lab. 2 Assembler:
More informationLecture 9 Subroutines
CPE 390: Microprocessor Systems Spring 2018 Lecture 9 Subroutines Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 Adapted from HCS12/9S12
More informationECE331 Handout 3- ASM Instructions, Address Modes and Directives
ECE331 Handout 3- ASM Instructions, Address Modes and Directives ASM Instructions Functional Instruction Groups Data Transfer/Manipulation Arithmetic Logic & Bit Operations Data Test Branch Function Call
More informationEE319 K Lecture 7. Address mode review Assembler, Debugging Psuedo ops 16 bit timer finite state machines. University of Texas ECE
EE319 K Lecture 7 Address mode review Assembler, Debugging Psuedo ops 16 bit timer finite state machines University of Texas ECE Texas and execution A $24 EEPROM $F800 $F801 $86 $F802 $24 $F803 }ldaa #36
More informationIntroduction to Programming
Introduction to Programming Chapter 2 Microcontrollers Objectives Describe the difference between source code and machine code. Define opcode, operand, and address of an operand. Explain the purpose of
More informationECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays
Assembly Programming Arrays Assembly Programming Arrays Array For Loop Example: unsigned short a[]; for(j=; j
More informationN bit is set if result of operation in negative (MSB = 1) Z bit is set if result of operation is zero (All bits = 0)
Addition and Subtraction of Hexadecimal Numbers. Setting the C (Carry), V (Overflow), N (Negative) and Z (Zero) bits How the C, V, N and Z bits of the CCR are changed Condition Code Register Bits N, Z,
More information2) [ 2 marks] Both of the following statements cause the value $0300 to be stored in location $1000, but at different times. Explain the difference.
1) [ 9 marks] Write a sequence of directives for an HCS12 assembly language program that performs all of these tasks, in this order: a) Define an array called Measurements starting from memory location
More informationECE3120: Computer Systems Hardware & Software Development Tools
ECE3120: Computer Systems Hardware & Software Development Tools Manjeera Jeedigunta http://blogs.cae.tntech.edu/msjeedigun21 Email: msjeedigun21@tntech.edu Tel: 931-372-6181, Prescott Hall 120 Using the
More informationHC11 Instruction Set Architecture
HC11 Instruction Set Architecture High-level HC11 architecture Interrupt logic MEMORY Timer and counter M8601 CPU core Serial I/O A/D converter Port A Port B Port C Port D Port E CMPE12 Summer 2009 16-2
More informationHC11 Instruction Set Architecture
HC11 Instruction Set Architecture Summer 2008 High-level HC11 architecture Interrupt logic MEMORY Timer and counter M8601 CPU core Serial I/O A/D converter Port A Port B Port C Port D Port E CMPE12 Summer
More information538 Lecture Notes Week 3
538 Lecture Notes Week 3 (Sept. 16, 2013) 1/18 538 Lecture Notes Week 3 Answers to last week's questions 1 Write code so that the least significant bit of Accumulator A is cleared, the most significant
More informationIntroduction to the 9S12 Microcontroller
Introduction to the 9S12 Microcontroller o Harvard architecture and Princeton architecture o Memory map for a Princeton architecture microprocessor o 68HC12 Address Space o 68HC12 ALU o 68HC12 Programming
More informationLecture 7 Assembly Programming: Shift & Logical
CPE 390: Microprocessor Systems Fall 2017 Lecture 7 Assembly Programming: Shift & Logical Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030
More informationIntroduction to Microcontrollers
Motorola M68HC11 Specs Assembly Programming Language BUFFALO Topics of Discussion Microcontrollers M68HC11 Package & Pinouts Accumulators Index Registers Special Registers Memory Map I/O Registers Instruction
More informationUsing the stack and the stack pointer
Using the stack and the stack pointer o The Stack and Stack Pointer o The stack is a memory area for temporary storage o The stack pointer points to the last byte in the stack o Some instructions which
More informationComputer Organization I. Lecture 28: Architecture of M68HC11
Computer Organization I Lecture 28: Architecture of M68HC11 Overview Architecture of HC11 Microprocessor Format of HC11 Assembly Code Objectives To understand the simplified architecture of HC11 To know
More informationExam 1 Feb. 23, 25, 27?
Exam 1 Feb. 23, 25, 27? You will be able to use all of the Motorola data manuals on the exam. No calculators will be allowed for the exam. Numbers Decimal to Hex (signed and unsigned) Hex to Decimal (signed
More informationSerial Communication Through an Asynchronous FIFO Buffer
Serial Communication Through an Asynchronous FIFO Buffer Final Project Report December 9, 2000 E155 Nick Bodnaruk and Andrew Ingram Abstract: For our clinic, we need to be able to use serial communication
More informationECET Chapter 2, Part 3 of 3
ECET 310-001 Chapter 2, Part 3 of 3 W. Barnes, 9/2006, rev d. 10/07 Ref. Huang, Han-Way, The HCS12/9S12: An Introduction to Software and Hardware Interfacing, Thomson/Delmar. In This Set of Slides: 1.
More informationCOSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)
COSC 243 Instruction Sets And Addressing Modes 1 Overview This Lecture Source Chapters 12 & 13 (10 th editition) Textbook uses x86 and ARM (we use 6502) Next 2 Lectures Assembly language programming 2
More informationA Simple MC9S12 Program
A Simple MC9S12 Program All programs and data must be placed in memory between address 0x1000 and 0x3BFF. For our programs we will put the first instruction at 0x2000, and the first data byte at 0x1000
More informationECE L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE
L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE The purpose of this lab is to introduce you to the layout and structure of Assembly Language programs and their format. You will write your own programs
More information68000 Architecture, Data Types and Addressing Modes. 9/20/6 Lecture 2 - Prog Model 1
68000 Architecture, Data Types and Addressing Modes 9/20/6 Lecture 2 - Prog Model 1 Lecture Overview Assembler Language Programmers Model Registers Addressing Modes 9/20/6 Lecture 2 - Prog Model 2 Assembler
More informationIntroduction 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.
Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3 o Comparison of C and Assembly programs for the HC12 o How to compile a C program using the GNU-C compiler o Using pointers to access
More informationDisassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers
Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers o How to disassemble an MC9S12 instruction sequence o Binary numbers are a code and represent what the programmer intends for the
More informationDisassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers
Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers o How to disassemble an MC9S12 instruction sequence o Binary numbers are a code and represent what the programmer intends for the
More informationWhat is an Addressing Mode?
Addressing Modes 1 2 What is an Addressing Mode? An addressing mode is a way in which an operand is specified in an instruction. There are different ways in which an operand may be specified in an instruction.
More informationIntroduction to Computers - Chapter 4
Introduction to Computers - Chapter 4 Since the invention of the transistor and the first digital computer of the 1940s, computers have been increasing in complexity and performance; however, their overall
More informationEMCH 367 Fundamentals of Microcontrollers Example_Sort EXAMPLE SORT
OBJECTIVE This example has the following objectives: EXAMPLE SORT Review the use of keystroke commands for controlling a process Introduce the concept of multiple sort and its sequential sort equivalent
More informationMenu. >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board. Machine Codes 6811: $86 $0A GCPU: $02 $0A
Big Picture Assembler Directives Examples using: Menu >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board Look into my... See on web-site: GCPU_to_XMEGA.pdf, Examples:
More informationIntroduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12. EE383: Introduction to Embedded Systems University of Kentucky
Introduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12 EE383: Introduction to Embedded Systems University of Kentucky Samir Rawashdeh With slides based on material by H. Huang Delmar
More information68000 Assembler by Paul McKee. User's Manual
Contents 68000 Assembler by Paul McKee User's Manual 1 Introduction 2 2 Source Code Format 2 2.1 Source Line Format............................... 2 2.1.1 Label Field............................... 2 2.1.2
More informationCMPEN 472 Sample EXAM II
CMPEN 472 Sample EXAM II Name: Student ID number (last 4 digit): Please write your name on every page. Write your solutions clearly. You may use backside of each page for scratch but the solutions must
More informationSample Problem Set #1
Sample Problem Set #1 Notes: These problems are typical exam problems; most are drawn from previous homeworks and exams. This exam is open book, open notes. It may help to have a calculator. For partial
More informationECET Chapter 2, Part 2 of 3
ECET 310-001 Chapter 2, Part 2 of 3 W. Barnes, 9/2006, rev d. 10/07 Ref. Huang, Han-Way, The HCS12/9S12: An Introduction to Software and Hardware Interfacing, Thomson/Delmar. In This Set of Slides: 1.
More informationECE 4510/5530 Microcontroller Applications Chapter 1
Microcontroller Applications Chapter 1 Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences Chapter 1 Overview Basic Computer
More informationMC9S12 Address Space
MC9S12 Address Space MC9S12 has 16 address lines MC9S12 can address 2 16 distinct locations For MC9S12, each location holds one byte (eight bits) MC9S12 can address 2 16 bytes 2 16 = 65536 2 16 = 2 6 2
More informationChapter 2 HCS12 Assembly Language
Chapter 2 HCS12 Assembly Language ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 2.1 Assembly language program structure 2.2 Data transfer instructions 2.3 Arithmetic
More informationEE 308 Spring The HCS12 has 6 addressing modes
The HCS12 has 6 addressing modes Most of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access Effective Address: Memory address used by
More informationMacro Assembler. Defini3on from h6p://www.computeruser.com
The Macro Assembler Macro Assembler Defini3on from h6p://www.computeruser.com A program that translates assembly language instruc3ons into machine code and which the programmer can use to define macro
More informationCHAPTER ASSEMBLY LANGUAGE PROGRAMMING
CHAPTER 2 8051 ASSEMBLY LANGUAGE PROGRAMMING Registers Register are used to store information temporarily: A byte of data to be processed An address pointing to the data to be fetched The vast majority
More informationWed. Sept 6 Announcements
Wed. Sept 6 Announcements HW 3 / Lab 3 posted [1.C]-1 Endianness Problem: Memory is byte addressed. Sometimes you want to access multi-byte values (16-bit, 32-bits etc.) X is 2-bytes Addr Memory Value
More informationCE-320 Microcomputers I Winter 2010 LAB 1: MINIIDE GROUP #: NAME: PARTNER: Lab 1 Page 1
LAB 1: MINIIDE GROUP #: NAME: PARTNER: Lab 1 Page 1 LAB 1: MINIIDE GOALS Understand Wytec s Dragon12+ evaluation board Know how to use Dragon12 commands Understand an integrated development environment
More informationC SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions
C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions 1. (12 marks) Circle the correct answer for each of the following: The 8-bit two's complement representation of -15
More information538 Lecture Notes Week 5
538 Lecture Notes Week 5 (October 4, 2017) 1/18 538 Lecture Notes Week 5 Announements Midterm: Tuesday, October 25 Answers to last week's questions 1. With the diagram shown for a port (single bit), what
More informationECE 331: PC Lab 3 Stack and Subroutines
ECE 331: PC Lab 3 Stack and Subroutines Professor Andrew Mason Michigan State University Rev: S11 p.1 Announcements Objectives Topics Outline Review starting and using ASM development environment Pushing
More information2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).
AS12 Assembler Directives A Summary of 9S12 instructions Disassembly of 9S12 op codes Huang Section 1.8, Chapter 2 MC9S12 V1.5 Core User Guide Version 1.2, Section 12 o A labels is a name assigned the
More informationCSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1
CSIS1120A 10. Instruction Set & Addressing Mode CSIS1120A 10. Instruction Set & Addressing Mode 1 Elements of a Machine Instruction Operation Code specifies the operation to be performed, e.g. ADD, SUB
More informationECE 3120 Lab 1 Code Entry, Assembly, and Execution
ASSEMBLY PROGRAMMING WITH CODE WARRIOR The purpose of this lab is to introduce you to the layout and structure of assembly language programs and their format, as well as to the use of the Code Warrior
More informationModule 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function
Module 8: Atmega32 Stack & Subroutine Stack Pointer Subroutine Call function Stack Stack o Stack is a section of RAM used by the CPU to store information temporarily (i.e. data or address). o The CPU needs
More information538 Lecture Notes Week 5
538 Lecture Notes Week 5 (Sept. 30, 2013) 1/15 538 Lecture Notes Week 5 Answers to last week's questions 1. With the diagram shown for a port (single bit), what happens if the Direction Register is read?
More informationECE/CE 3720: Embedded System Design
Produce-Consumer Examples Slide 1 ECE/CE 3720: Embedded System Design Chris J. Myers Slide 3 Source/producer Keyboard input Program with data Sink/consumer Program that interprets Printer output Lecture
More informationLecture 11: Advanced Arithmetic Instructions
Lecture 11: Advanced Arithmetic Instructions Today s Goals Use basic multiplication li and divisioni i instructions. ti Use shift and rotate instructions Multiplication Three different multiplication li
More informationOutline. 2.8 Stack. 2.9 Subroutines
Outline 21 Assembly language program structure 22 Data transfer instructions 23 Arithmetic instructions 24 Branch and loop instructions 25 Shift and rotate instructions 26 Boolean logic instructions 27
More informationORG ; TWO. Assembly Language Programming
Dec 2 Hex 2 Bin 00000010 ORG ; TWO Assembly Language Programming OBJECTIVES this chapter enables the student to: Explain the difference between Assembly language instructions and pseudo-instructions. Identify
More informationThe Motorola 68HC11 Instruc5on Set
The Motorola 68HC11 Instruc5on Set Some Defini5ons A, B * accumulators A and B D * double accumulator (A + B) IX, IY * index registers X and Y SP * stack pointer M * some memory loca5on opr * an operand
More informationm 1 se 7 m 23 Introduction to Embedded Microcomputer Systems Lecture 16.1 Recap Finite State Machines Pointer implementation
Introduction to Embedded Microcomputer Systems Lecture 16.1 Recap Finite State Machines Pointer implementation Overview Fixed-point: why, when, how Local variables: scope and allocation How these concepts
More informationAssembly Language. Instructor: Dmitri A. Gusev. Spring Lecture 10, February 27, CSC : Introduction to Computer Science
Assembly Language Instructor: Dmitri A. Gusev Spring 2007 CSC 120.02: Introduction to Computer Science Lecture 10, February 27, 2007 Basic Definitions Assembly language is a low-level programming language
More informationProcessor design - MIPS
EASY Processor design - MIPS Q.1 What happens when a register is loaded? 1. The bits of the register are set to all ones. 2. The bit pattern in the register is copied to a location in memory. 3. A bit
More informationModule 1-G. Marcos and Structured Programming
Module 1-G Marcos and Structured Programming 1 Learning Outcome #1 An ability to program a microcontroller to perform various tasks How? A. Architecture and Programming Model B. Instruction Set Overview
More informationLab 7: Asynchronous Serial I/O
CpE 390 Microprocessor Systems Lab 7: Asynchronous Serial I/O 1. Introduction Serial communications is the transfer of data, one bit at a time, over a communications channel. Serial communications can
More informationHarry H. Porter, 2006
The SPARC Computer Architecture Harry Porter Portland State University 1 CS-321 Lexer Parser Type Checking Intermediate Code Generation All semantic error checking finished in this phase IR - Intermediate
More informationProgram Development. Chapter 5
Chapter 5 Program Development Expected Outcomes Distinguish between various codes in the programming language Explain the role of assembler and compiler Distinguish between different data types Use directive
More informationRyerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 2003
Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 23 Name: Student Number: Time limit: 3 hours Section: Examiners: K Clowes,
More informationIntroduction to Microcomputer Systems Addressing modes
Dept. of Computer Science and Engineering Introduction to Microcomputer Systems Overview Addressing mode Source form Abbreviation Description Inherent INST (no externally supplied operands) INH Immediate
More informationS12CPUV2. Reference Manual HCS12. Microcontrollers. S12CPUV2/D Rev. 0 7/2003 MOTOROLA.COM/SEMICONDUCTORS
HCS12 Microcontrollers /D Rev. 0 7/2003 MOTOROLA.COM/SEMICONDUCTORS To provide the most up-to-date information, the revision of our documents on the World Wide Web will be the most current. Your printed
More informationIntroduction to Microcontrollers II
Introduction to Microcontrollers II brset, brclr Indexed Addressing Example µp Laboratory #2 BUFFALO Assembling Code EECE 143 Digital Design Project Purpose: To allow students to design their own digital
More informationHistory of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram
History of the Microprocessor ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 1: 68HC12 In 1968, Bob Noyce and Gordon Moore left Fairchild Semiconductor and formed Integrated Electronics
More informationHC 11 Instructions! From Alex Hollowayʼs notes with! many thanks!
HC 11 Instructions! From Alex Hollowayʼs notes with! many thanks! Instruction Classes! Accumulator and Memory! Stack and Index Register! Condition Code Register! Program Control! Accumulator and memory
More informationProfessor E. Ambikairajah UNSW Sydney
ELEC2117 Chapter 3a: PIC16F886 Instruction set Professor Eliathamby Ambikairajah Head of School of Electrical Engineering and Telecommunications, UNSW, Sydney 06 March 2017 Prof E Ambikairajah Instruction
More informationAddressing Modes. To review data transfer instructions and applying the more advanced addressing modes.
Addressing Modes Aims To review 68000 data transfer instructions and applying the more advanced addressing modes. Intended Learning Outcomes At the end of this module, students t should be able to Review
More informationIntroduction to Microcontrollers II
Introduction to Microcontrollers II brset, brclr Indexed Addressing Example µp Laboratory #2 BUFFALO Assembling Code EECE 143 Digital Design Project Purpose:To allow students to design their own digital
More informationExam 2 E2-1 Fall Name: Exam 2
Exam 2 E2-1 Fall 2004 1. Short Answer [20 pts] Exam 2 a. [4 points] Show the contents of registers A, B, SP, and X after the following code executes: lds #$a00 ldab #$23 A = ldaa #$87 ldx #$2543 B = pshd
More informationECE 3610 MICROPROCESSING SYSTEMS
24.361 Lab. 4 31 ECE 3610 MICROPROCESSING SYSTEMS Laboratory 4 LAB 4: ASSEMBLER DIRECTIVES, THE STACK, SUBROUTINES, AND BUBBLE SORTING 1 INTRODUCTION This lab deals with the use of the stack and subroutines
More information