The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP 2620 1.

Slides:



Advertisements
Similar presentations
Chapter 9 TRAP Routines and Subroutines. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9-2 Subroutines.
Advertisements

Introduction to Computing Systems from bits & gates to C & beyond Chapter 7 LC-2 Assembly Language.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 7 LC-2 Assembly Language.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
The Assembly Language Level
Chapter 3 Loaders and Linkers
Linkage Editors Difference between a linkage editor and a linking loader: Linking loader performs all linking and relocation operations, including automatic.
3. Loaders & Linkers1 Chapter III: Loaders and Linkers Chapter goal: r To realize how a source program be loaded into memory m Loading m Relocation m Linking.
Chapter 3 Loaders and Linkers
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
The Functions and Purposes of Translators Code Generation (Intermediate Code, Optimisation, Final Code), Linkers & Loaders.
1 Starting a Program The 4 stages that take a C++ program (or any high-level programming language) and execute it in internal memory are: Compiler - C++
Programming Types of Testing.
CPS4200 System Programming 2007 Spring 1 Systems Programming Chapter 2 Assembler I.
Loader- Machine Independent Loader Features
CS2422 Assembly Language & System Programming December 22, 2005.
Assemblers Dr. Monther Aldwairi 10/21/20071Dr. Monther Aldwairi.
An introduction to systems programming
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
Compiling and Linking. Compiling is quite the same as creating an executable file! Instead, creating an executable is a multistage process divided into.
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
Types of software. Sonam Dema..
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
MIPS coding. SPIM Some links can be found such as:
1 History of compiler development 1953 IBM develops the 701 EDPM (Electronic Data Processing Machine), the first general purpose computer, built as a “defense.
5-1 Chapter 5 - Languages and the Machine Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of Computer.
CPS4200 System Programming 2007 Spring 1 Systems Programming Chapter 2 Assembler II.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
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.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
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.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
Computer Science 210 Computer Organization More on Assembler.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /29/2013 Lecture 13: Compile-Link-Load Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
L ECTURE -9 Topics : Compiler Interpreter Loader Linker. Types of Software..
1.4 Representation of data in computer systems Instructions.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Software. Introduction n A computer can’t do anything without a program of instructions. n A program is a set of instructions a computer carries out.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
CS501 Advanced Computer Architecture Lecture 29 Dr.Noor Muhammad Sheikh.
CC410: System Programming
Topic 2: Hardware and Software
Why don’t programmers have to program in machine code?
Advanced Computer Systems
Assembler Directives Code generation flow
Computer Science 210 Computer Organization
Chapter 5- Assembling , Linking, and Executing Programs
System Programming and administration
CS 3305 System Calls Lecture 7.
-by Nisarg Vasavada (Compiled*)
History of compiler development
Computer Science 210 Computer Organization
Assembler, Compiler, Interpreter
and Executing Programs
The Assembly Language Level
Compiler Construction
Chapter 7 LC-2 Assembly Language.
Loaders and Linkers: Features
Machine Independent Features
Chapter 7 LC-2 Assembly Language.
The Assembly Language Level
Assembler, Compiler, Interpreter
MARIE: An Introduction to a Simple Computer
Chapter 1 Introduction.
Chapter 6 Programming the basic computer
An introduction to systems programming
Lecture 7 Separate compilation
Presentation transcript:

The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP

Multiple File Assembly Language Programs Our purpose has been so far to show how to move up from machine code to assembly language We see that assembly language does save us a good deal of work This happens more so in C or C++

Multiple File Assembly Language Programs We also show how a two pass assembler system works for one input file There are a few topics we need to consider before we go on further – Executable images – More than one object file

Executable Images We the computer begins execution of a program, the entity being executed is called an executable image Many times, these are created from modules that are separate from each other by different programmers

Executable Images Each modules is assembled separately into an object file by the assembler The process we have discussed is the same for multiple modules However, some of the modules may have been written in C or C++ These are translated to object code as well

Executable Images Some of the rest of the modules are library routines provided by the operating system Some of the modules can be written by users Each object file, no matter how it was written originally, has the instructions, plus any associated data in memory

Executable Images The final step in this process to get an executable image is to link all the object modules together This creates one image file that can be run by the computer

More than one object file As we discussed before, it is very common to have more than one object file to link Matter of fact, it is unusually to have just one object file We can see this in our character counting example

More than one object file In this example, we have two parts – The assembly code to count the particular character – The file data for the characters that we are counting We would typically have these as two separate modules

More than one object file If this is the case, we more than likely would not know the location of the starting address of the file This is assigned at link time usually

More than one object file So, instead of the line PTR.FILLx4000 We would have PTR.FILLSTARTofFILE

More than one object file However, the compiler does not know where STARTofFILE is located now There is no entry for this label in the symbol table after the first pass The solution is to use the pseudo-op.EXTERNAL

More than one object file This specifies that a symbolic name is in another file We would have to include in our assembly file the command.EXTERNAL STARTofFILE This indicates the symbol is in another file and avoids an error

More than one object file Unfortunately, the current LC-3 language does not support this! However, in many other assembly languages, this exists and gets used extensively for external modules