ECE 265 – LECTURE 11 Editing and the Assembler (updated 11/11/10) 12/15/2015 1 ECE265.

Slides:



Advertisements
Similar presentations
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions  Read Almy, Chapters 5 and 6.  Homework #3 and Lab #3 due next week.  Quiz next.
Advertisements

Code Composer Department of Electrical and Computer Engineering
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
The 8051 Microcontroller and Embedded Systems
EET 2261 Unit 5 Tables; Decision Trees & Logic Instructions
Railway Foundation Electronic, Electrical and Processor Engineering.
1 Lab Session-IV CSIT-120 Fall 2000 Precedence Rules Machine Language Programming The “Micro” Machine The “Micro” Simulator The “Micro” Translator (Thanks.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
Railway Foundation Electronic, Electrical and Processor Engineering.
The MSP430xxxx Department of Electrical and Computer Engineering
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
ECE 265 – LECTURE 4 The M68HC11 Address Modes 8/14/ ECE265.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
© 2010 Kettering University, All rights reserved..
The M68HC11 Basic Instruction Set Basic Arithmetic Instructions
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
EEL-4746 Microprocessor-based System Design Fall 2004 Semester Dr. Michael P. Frank.
Lab 1 – Assembly Language and Interfacing Start date: Week 3 Due date: Week 4 1.
Assembly Language Programming for the MC68HC11. Assembly language programming  Recall the 4 design levels for software development: – Application – High.
P.1ECE 331, Prof. A. Mason Professor Andrew Mason Michigan State University Spring 2013 ECE 331: PC Lab 1: Using HC12 ASM Simulators.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
ECE Lecture 1 1 Introduction to Microcontrolllers Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
9/20/6Lecture 3 - Instruction Set - Al1 Project Description.
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
9/20/6Lecture 3 - Instruction Set - Al1 Program Design.
ECE 265 – LECTURE 8 The M68HC11 Basic Instruction Set The remaining instructions 10/20/ ECE265.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
C o n f i d e n t i a l 1 Course: BCA Semester: III Subject Code : BC 0042 Subject Name: Operating Systems Unit number : 1 Unit Title: Overview of Operating.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
ECE 265 Midterm Review 12/1/ ECE265. Administrivia  The grade for quiz 3 was not entered into to Carmen before I handed them back.  I realize.
9/20/6Lecture 2 - Prog Model Architecture, Data Types and Addressing Modes.
1 Segments and Pseudo Operations Program Development.
Assembly Language ELEC 330 Digital Systems Engineering Dr. Ron Hayne.
ECE 265 – LECTURE 5 The M68HC11 Basic Instruction Set 12/8/ ECE265.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
1 ECE 372 – Microcontroller Design Assembly Programming HCS12 Assembly Programming Addressing Modes Stack Operations Subroutines.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Ch.2 Intro. To Assembly Language Programming
ECE 353 Lab 2 Pipeline Simulator Additional Material.
Ch.2 Intro. To Assembly Language Programming From Introduction to Embedded Systems: Interfacing to the Freescale 9s12 by Valvano, published by CENGAGE.
1 Microcontroller Fundamentals & Programming Addressing Modes.
Department of Electronic & Electrical Engineering Lecture 2. PIC16F84A Architecture / Instructions Memory. Program/Data (Harvard) File Registers (Data).
Embedded Systems Lecture 5 January 25 th, 2016.
EE345 Chapter 2 Lecture 3 April 4. Quiz every Wednesday 1 quiz = 1% extra credit five quizzes before midterm  5% for midterm. five quizzes before final.
EE345 Chapter 2 Lecture 3 April Instruction and addressing modes 1.Extended Addressing 2.Direct Addressing 3.Inherent Addressing 4.Immediate Addressing.
CC410: System Programming
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions
Addressing Modes in Microprocessors
Computer Science 210 Computer Organization
Chapter 5- Assembling , Linking, and Executing Programs
ECE 3430 – Intro to Microcomputer Systems
Learning Outcome #1 Architecture and Programming Model
Lesson Objectives A note about notes: Aims
The 8051 Microcontroller and Embedded Systems
ECE 3430 – Intro to Microcomputer Systems
Wed. Sept 6 Announcements
CS 301 Fall 2001 – Chapter 3 Slides by Prof. Hartman, following “IBM PC Assembly Language Programming” by Peter Abel 9/17/2018.
“Assembly Table Lookup”
Computer Science 210 Computer Organization
Assembler, Compiler, Interpreter
and Executing Programs
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME4447/6405 Microprocessor Control of Manufacturing Systems and
68000 Architecture, Data Types and Addressing Modes
Assembler, Compiler, Interpreter
Chapter 6 Programming the basic computer
Indexing Through Memory
Decisions in assembler code
Presentation transcript:

ECE 265 – LECTURE 11 Editing and the Assembler (updated 11/11/10) 12/15/ ECE265

Lecture Overview  Editing and Assembler  So far have covered the assembler language instructions and translating a program to assembler  Now Creating the assembler code file What goes on during the execution of the assembler  REF: Chapter 4.10 and /15/ ECE265

Assembler language files  Translated HLL to assembler.  Edit the assembler language program into an editor.  This is sometimes called a source file  What is done with the source file?  It is input as a data file to a program called and assembler.  Most times you simply use a simple text editor and set up the various fields at tabs.  The file is save as name.asm typically. 12/15/2015ECE265 3

What is output from the assembler  Input is your assembler language program  The output will look something like this 12/15/2015ECE265 4

And a machine code listing 12/15/2015ECE265 5

Another example 12/15/2015ECE265 6

Hand assembly  Knowing how to hand assemble assembler code is useful knowledge.  This is the same work the assembler does.  What value does knowing this help a computer engineer? It goes to knowledge base and a complete understanding of a processors (microprocessor or microcontroller) architecture. It is essential to being able to design and implement front line embedded systems requiring very accurate timing. 12/15/2015ECE265 7

Previous example  The code  ORG $0010  unkwn FCB47 set unknown value  guessRMB 1 location for guess var  incrRMB1 location for increment var  ORG $C000  LDAA #50  STAA guess  LSRAdivide by 2  STAA incr first guess is 50  LDAB incr  LSRB set to 25 12/15/2015ECE265 8

Previous ex continued  tolCMPA unknwn  BEQ done  BLT low  * guess is too high  SBAsubtract increment  incadjLSRBincr = incr/2  BCC ceilgd  INCBcarry was 1 so make ceil  ceilgdBRA tol  lowABAadd increment  BRA incadj  doneSTAA guessdone 12/15/2015ECE265 9

Hand assembly  Assembler directives  ORG $0010  unknwnFCB47 set unknown value  guessRMB 1 location for guess var  incrRMB1 location for increment var  Assembler output  Label LOC Contents($)  unkwn $0010 $2F  guess $0011  incr $ /15/2015ECE265 10

Hand assembly continued  The lines hand assemble  ORG $C000  LDAA #50  addr contents  $C   $32 is  and hexidecimal  for 50 ( ) 12/15/2015ECE265 11

The next instruction  STAA guess  $C002 $97 11  As address of  Guess is $ /15/2015ECE265 12

And then  LSRA  $C  STAA incr $C /15/2015ECE265 13

And then  LDAB incr  $C007 D6 12  LSRB  $C /15/2015ECE265 14

And then  tol CMPA unkwn  $C00A  As unkwn is at memory  Location $0010  tol will have value of  $C00A 12/15/2015ECE265 15

And then  BEQ done  BLT low  $C00C 27 rrdone  $C00E 2d rrlow  Where the relative address will be filled in after the first pass. 12/15/2015ECE265 16

And then  SBA  $C  incadjLSRB  $C /15/2015ECE265 17

And then  BCC ceilgd  $C rrjump  INCB  $C014 5C  ceilgdBRA tol  $C back_to_tol  ceilgd had value $C015 and at time of BCC execution, the PC will have value of $C014 so rrjump gets value of $01  back to tol will need a negative offset. The PC for calculation back to location $C00A from location $C017 is a negative 13 bytes – =  Or back_to_tol gets $F3 WHY? 12/15/2015ECE265 18

And finally  lowABA  $C  And low has an address of $C017  so rrlow gets 9  BRA incadj  $C to_incadj  incadj was at address $C011 so this is a -9  or to_incadj getting $F7  doneSTAA guess  $C01A /15/2015ECE265 19

The full code  ORG $0010  Loc contents comment  ORG $0010  $ unkwn FCB 47  $ guess RMB 1  $ incr RMB 1  ORG $C000  $C LDA #100  $C STAA guess  $C LSRA  $C STAA incr  $C007 D6 12 LDAB incr  $C LSRB  $C00A tol CMPA unkwn  $C00C 27 0E BEQ done 12/15/2015ECE  $C00F 2D 09 BLT low  $C SBA  $C incadj LSRB  $C BCC ceilgd  $C014 5C INCB  $C F3 ceilgd BRA tol  $C low ABA  $C F7 BRA incadj  $C01A done STAA guess  Symbol table  unkwn $0010 tol $C00A low $C017  guess $0011 incadj $C011 done $C01A  incr $0012 ceilgd $C015

Lecture summary 12/15/2015ECE  Have looked at hand assembly  a very useful skill

From the assembler  Copy of the window 12/15/2015ECE265 22

Assignment 12/15/2015ECE  Get to a THR simulator (will be downloadable from Carmen)  Enter the program we just hand assembled and confirm the hand coding. (CODE IS ON slide 8 and 9)  NOTE: page 0 has RAM and page E has ROM for you code. Use the table on page 27 for address of I/O. See example code on webpage.  Submit a 1/3 to full page writeup on if the code agrees or not, and your level of understanding of what an assembler does. Also capture the simulator window and turn in a copy of the simulator window after you have done the assemble.