Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 12

INTRODUCTION

Software
Application software usually used by end-user It is concerned with the solution of some problem, using the computer as a tool, instead of how computers actually work. System software System software consists of a variety of programs that support the operation of a computer (ex: text editor, compiler, debugger) One characteristic in which most system software differ from application software is machine dependency A system software programmer must know the target machine structure

System Software and Machine Architecture


Machine dependent system software System programs are to support the operation and use of the target computer. The difference between different machine Machine code Instruction formats Addressing mode Registers Machine independent system software General design and logic is basically the same: Code optimization General design and logic of an assembler

System Software
The system software includes Assembler Linker Loader Macro processor Text editor Compiler Operating system Debugging system Source Code Control System (optional) Database Management System

ASSEMBLER

Role of Assembler
Role of Assembler

Source Program

Assembler

Object Code

Linker

Executable Code

Loader

Introduction to Assemblers
Fundamental functions translating mnemonic operation codes to their machine language equivalents assigning machine addresses to symbolic labels Machine dependency different machine instruction formats and codes

Assembler Directives
Pseudo-Instructions Not translated into machine instructions Providing information to the assembler Basic assembler directives START

END BYTE WORD RESB RESW

Assemblers functions
Convert mnemonic operation codes to their machine language equivalents Convert symbolic operands to their equivalent machine addresses Build the machine instructions in the proper format Convert the data constants to internal machine representations Write the object program and the assembly listing

Two Pass Assembler


Pass 1 Assign addresses to all statements in the program Save the values assigned to all labels for use in Pass 2 Perform some processing of assembler directives Pass 2 Assemble instructions Generate data values defined by BYTE, WORD Perform processing of assembler directives not done in Pass 1 Write the object program and the assembly listing

Two Pass Assembler

Read from input line LABEL, OPCODE, OPERAND

Source program

Pass 1

Intermediate file SYMTAB

Pass 2

Object codes

OPTAB

SYMTAB

Data Structures Operation Code Table (OPTAB) Symbol Table (SYMTAB) Location Counter (LOCCTR) OPTAB (operation code table) Content menmonic, machine code (instruction format, length) etc. Characteristic Static table Implementation array or hash table, easy for search. LOCCTR (Location Counter)

It contains the address of the next instruction to be stored in the memory.

SYMTAB None of the relative terms may enter into a multiplication or division operation Errors: BUFEND+BUFFER 100-BUFFER 3*BUFFER The type of an expression Keep track of the types of all symbols defined in the program

Symbol RETADR BUFFER BUFEND MAXLEN

Type R R R A

Value 30 36 1036 1000

MACRO

Introduction Concept A macro instruction is a notational convenience for the programmer It allows the programmer to write shorthand version of a program (module programming) The macro processor replaces each macro invocation with the corresponding sequence of statements (expanding)

Macro Processor
Recognize macro definitions Save the macro definition Recognize macro calls Expand macro calls

Source Code (with macro)

Macro Processor

Expanded Code

Compiler or Assembler

Obj Code

obj

Macro Definition copy code parameter substitution

conditional macro expansion macro instruction defining macros

Copy code -- Example

Source STRG MACRO STA DATA1 STB DATA2 STX DATA3 MEND . STRG . STRG . .

Expanded source . . . STA DATA1 STB DATA2 STX DATA3 . STA DATA1 STB DATA2 STX DATA3 .

LOADERS
Introduction

To execute an object program, we needs Relocation, which modifies the object program so that it can be loaded at an address different from the location originally specified Linking, which combines two or more separate object programs and supplies the information needed to allow references between them Loading and Allocation, which allocates memory location and brings the object program into memory for execution

Type of loaders
Assemble-and-go loader Absolute loader (bootstrap loader) Relocating loader (relative loader) Direct linking loader

Design options
Linkage editors Dynamic linking Bootstrap loaders

Assemble-and-go Loader
Characteristic The object code is stored in memory after assembly Single JUMP instruction Advantage Simple, developing environment Disadvantage Whenever the assembly program is to be executed, it has to be assembled again Programs have to be coded in the same language

Design of an Absolute Loader


Absolute Program Advantage Simple and efficient Disadvantage The need for programmer to specify the actual address Difficult to use subroutine libraries Program Logic Fig. 3.2 Algorithm for an absolute loader

Begin read Header record verify program name and length read first Text record while record type is not E do begin {if object code is in character form, convert into internal representation} move object code to specified location in memory read next object program record end jump to address specified in End record end

Object Code Representation


Figure 3.1 (a) Each byte of assembled code is given using its hexadecimal representation in character form Easy to read by human beings In general Each byte of object code is stored as a single byte Most machine store object programs in a binary form We must be sure that our file and device conventions do not cause some of the program bytes to be interpreted as control characters

A Simple Bootstrap Loader


Bootstrap Loader When a computer is first tuned on or restarted, a special type of absolute loader, called bootstrap loader is executed This bootstrap loads the first program to be run by the computer -- usually an operating system Example (SIC bootstrap loader) The bootstrap itself begins at address 0 It loads the OS starting address 0x80 No header record or control information, the object code is consecutive bytes of memory

Relocating Loaders
Motivation efficient sharing of the machine with larger memory and when several independent programs are to be run together support the use of subroutine libraries efficiently Two methods for specifying relocation Modification record (Fig. 3.4, 3.5) Relocation bit (Fig. 3.6, 3.7)

Each instruction is associated with one relocation bit These relocation bits in a Text record is gathered into bit masks

Modification Record
For complex machines Also called RLD specification Relocation and Linkage Directory

Modification record col 1: M col 2-7: relocation address col 8-9: length (halfbyte) col 10: flag (+/-) col 11-17: segment name

Program Linking
Goal Resolve the problems with EXTREF and EXTDEF from different control sections Linking 1. User, 2. Assembler, 3. Linking loader Example Program in Fig. 3.8 and object code in Fig. 3.9 Use modification records for both relocation and linking Address constant External reference

EDITORS

A text editor is a program that enables you to create and edit text files. The distinction between editors and word processors is not clear-cut, but in general, word processors provide many more formatting features. Interactive program debugging system provides programmers with facilities that aid in the testing and debugging of programs. Although the desirability of such systems has been recognized for some time, there are relatively few actual debugging systems in practical use. The interactive text editor has become an important aspect of almost any computing environment. No longer are editors thought af as tools for programmers. It is now increasingly recognised that text editor should be considered the primary interface to the computer for all types of "knowledge workers" as they compose, organise, study and manipulate computer-based information. An interactive editor is a computer program that allows a user to create and revise a target document. The term document includes objects such as computer programs, text, equation, tables linker, loader and Operating System, diagrams, line art and photographs; anything that one might find on a printed page: A text editor is a program in which the primary elements being edited are character strings of the target text. We also presented a detailed descriptive of Unix operating system. In this unit, we take up issues related to a Text Editor and a Debugging system.

Overview of the Editing Process


The document-editing process is an interactive user-computer dialogue designed to accomplish four tasks: 1) Select the part of the target document to be viewed and manipulated 2) Determine how to format this view on-line and how to display it 3) Specify and execute operations that modify the target document 4) Update the view appropriately. Editing phase involves how the target document is created or altered with a set of operations such as insert, delete, replace, move and copy. The editing functions are often specialised to operate on elements meaningful to the type of editor. For example, a manuscript-oriented editor might operate on elements such as single characters, words, lines, sentences and paragraphs. A program oriented editors might operate on keywords,identifiers and statements.

Types of Editors and User Interface

There are many types of editors, but they fall into two general categories: Line editors: A primitive form of editor that requires you to specify a specific line of text before you can make changes to it. Screen oriented editors: Also called full screen editors, these editors enable you to modify an text that appears on the display screen by moving the cursor to the desired location. The user of an interactive editor is presented with a conceptual model of the editing system. This model is an abstract framework on which the editor and the world on which it operates are based. The conceptual model, in essence provides an easily understood abstractions of the target document and its elements, with a set of guidelines describing the effects of operations on these elements. Besides the conceptual mode, the user interface is concerned with the input devices, the output devices and the interaction language of the system.

You might also like