L7 – Assembler Directives

Slides:



Advertisements
Similar presentations
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 12P. 1Winter Quarter User-Written Functions.
Advertisements

Lecture 13: 10/8/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Branches Two branch instructions:
Code Composer Department of Electrical and Computer Engineering
Single Variable and a Lot of Variables The declaration int k; float f; reserve one single integer variable called k and one single floating point variable.
SPIM and MIPS programming
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
1 Today’s lecture  Last lecture we started talking about control flow in MIPS (branches)  Finish up control-flow (branches) in MIPS —if/then —loops —case/switch.
MIPS Assembly Language Programming
1 Computer Architecture MIPS Simulator and Assembly language.
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
Assembly Language Working with the CPU.
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
CSS 372 Lecture 1 Course Overview: CSS 372 Web page Syllabus Lab Ettiquette Lab Report Format Review of CSS 371: Simple Computer Architecture Traps Interrupts.
Variables and constants Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences.
1 Lab Session-III CSIT-120 Spring 2001 Revising Previous session Data input and output While loop Exercise Limits and Bounds GOTO SLIDE 13 Lab session.
Manipulating Strings.
The MSP430xxxx Department of Electrical and Computer Engineering
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
CIS Computer Programming Logic
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
MIPS coding. SPIM Some links can be found such as:
C Tokens Identifiers Keywords Constants Operators Special symbols.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
CSC 107 – Programming For Science. The Week’s Goal.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 3 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Kirk Scott Computer Science The University of Alaska Anchorage 1.
Ch Chapter 4 Basic Data Types and Variables 4.1 Basic Data Types In C TABLE 4.1 Introduction to Basic Data Types in C Type SizeDescription char 1.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Pointers in C++. Topics Covered  Introduction to Pointers  Pointers and arrays  Character Pointers, Arrays and Strings  Examples.
1.2 Primitive Data Types and Variables
C++ Programming Lecture 19 Strings The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
C++ Programming Lecture 14 Arrays – Part I The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
C is a high level language (HLL)
Department of Electronic & Electrical Engineering Statements Blocks{} Semicolons ; Variables Names keywords Scope.
7-Nov Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Oct lecture23-24-hll-interrupts 1 High Level Language vs. Assembly.
CS501 Advanced Computer Architecture Lecture 29 Dr.Noor Muhammad Sheikh.
C LANGUAGE UNIT 3. UNIT 3 Arrays Arrays – The concept of array – Defining arrays – Initializing arrays.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
ECE 447: Lecture 13 Assembler Directives. ECE 447: Defining a Constant #define PORTB 0x1004PORTB EQU $1004 #define DELAY 100 ………. #undef DELAY #define.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 3 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
CS 312 Computer Architecture & Organization
Computer Architecture & Operations I
User Interaction and Variables
ECE 3430 – Intro to Microcomputer Systems
ECE 382 Lesson 8 Lesson Outline Miniquiz Assignment 3
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
(Numerical Arrays of Multiple Dimensions)
Computer Science 210 Computer Organization
Chapter 6: Data Types Lectures # 10.
In this lecture Global variables Local variables System stack
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
Ken D. Nguyen Department of Computer Science Georgia State University
Assembly Language Programming I: Introduction
One-Dimensional Array Introduction Lesson xx
Final Exam Review Department of Electrical and Computer Engineering
Computer Science 210 Computer Organization
The University of Adelaide, School of Computer Science
Variables Title slide variables.
Lecture 1. Program Surgery
C++ Programming Lecture 20 Strings
Generalities for Assembly Language
Ken D. Nguyen Department of Computer Science Georgia State University
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
Variables and Constants
CS 286 Computer Architecture & Organization
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
Getting Started With Coding
Presentation transcript:

L7 – Assembler Directives ECE 2560 L7 – Assembler Directives Department of Electrical and Computer Engineering The Ohio State University ECE 3561 - Lecture 1

Lect 6 – Assembler Directives What are assembler directives? The MSP 430 directives to Specify where user code is Reserve space for variables Set the value for constants Other useful directives This assembler directives covered in this class are only part of those available. ECE 3561 - Lecture 1

Assembler Directives What are assembler directives? How do you set up an area of memory to be data For temporary data of the program Set up constants for use in my program And other possible uses Assembler Directives are a means by which you can ‘direct’ the assembler to take specific actions. ECE 3561 - Lecture 1

Where is information on them Information on the assembler directives can be found in CCS help. Do a search for assembler directives and the top item is ‘Chapter 5. Assembler Directives. There are a lot of directives. In class only a small number of them will be addressed. Section 5.1 is the Directives Summary Chapter 2 also has information on the assembler directives. ECE 3561 - Lecture 1

High level directives The code you develop is divided into sections named .text – Used for program code (ROM) .data – Assembles the directives following into the .data section and RAM memory area of the selected MSP430xxxx version. .intvec – Creates an interrupt vector entry in a named section that points to an interrupt routine name. (located in ROM) More on this later. ECE 3561 - Lecture 1

When starting a new project The code template Note .text section Code goes here You need to terminate execution of your code loop JMP loop ECE 3561 - Lecture 1

Where to put data? Use: To reserve space for data variable used in your program. The data registers are one place to use for the data variables in a program. Limited to 12 specific locations R5-15. Program will often have need of more than 12 variables. The first program could have use mostly register but used memory instead. Where to store them? IN MEMORY There needs to be a means to reference them, i.e., they need to be named. ECE 3561 - Lecture 1

Storing variables in memory First need a section for variables .data Examples of this were shown during the demo. For example .word reserves space and initializes the value - use: label .word 0xFFFF label2 .word 0xAAAA,0x1111,0x2222 .byte reserves space for byte values - use: label3 .byte 0x11 label4 .byte 0x40 ECE 3561 - Lecture 1

Declare and initialize values .bits – initializes one or more successive bits (use of one bit will use the entire byte) .char declares and initialized one or more successive bytes to be the ASCII values of the character. lbl .char 8, “def” Will place the values 8h in memory, then the ascii for d (64), ascii for e (65), ascii for f (66) .string – initializes one of more text strings Mlbl .string “now is the time” ECE 3561 - Lecture 1

More value types .int – initializes one or more 16-bit integers .long – initializes one or more 32-bit integers .float – initializes one or more floating point numbers – IEEE format – 32 bits .uint – initializes one or more unsigned integers ECE 3561 - Lecture 1

Just want to reserve space To reserve space in RAM and attach a label to it so it can be referenced .bes – Used for uninitialized objects (global data – variables) label .bes size - label points to the end of the reserved space .space – Used for uninitialized objects splbl .space size2 - splbl points to the start of the reserved space ECE 3561 - Lecture 1

For further reference For a further explanation of the assembler directive you can look in section 5.12, Directives Reference, in the MSP430 Assembly Language Tool User’s Guide (available in Code Composer help). ECE 3561 - Lecture 1

Summary - Assignment These are the most relevant directives for this class. No new assignment. ECE 3561 - Lecture 1