Unit-1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 58

UNIT -1

INTRODUCTION TO SYSTEM PROGRAMMING

.
CONTENTS :-
1. Introduction
2. Components of Software System
- Text editor
- Loader
- Assembler
- Macroprocessor
- Compiler
- Debugger
- Machine Structure
- Machine Language
- Assembly Language
3. Assemblers : General design procedure
Design of assembler
INTRODUCTION TO SYSTEM PROGRAMMING

System programming involves designing and writing


computer programs that allow the computer hardware to
interface with the programmer and the user, leading to the
effective execution of application software on the computer
system.

Typical system programs include the operating system and


firmware, programming tools such as compilers, assemblers,
I/O routines, interpreters, scheduler, loaders and linkers as
well as the runtime libraries of the computer programming
languages.
In short it is a process of building system software using System
Programming Languages.
SOFTWARE HIERARCHY
The Machine Structure consist of..

➢Instruction interpreter - The Instruction Interpreter Hardware is basically a


group of circuits that perform the operation specified by the instructions
fetched from the memory

➢Location counter - The Location Counter can also be called as


Program/Instruction Counter simply points to the current instruction being
excuted.

➢Instruction register - Instruction Register simply points to the current


instruction being executed.

➢Working register - The working registers are often called as the "scratch
pads" because they are used to store temporary values while calculation is in
progress.

➢General register – Use to interface with memory.


Components of System Programming :-
It is the interface between the hardware and user
applications.
Components are :

Text editors
Loaders
Assemblers
Macro processors
Compilers
Debuggers
ELEMENTS OF ASSEMBLY LANGUAGE PROGRAMMING
Elements of Assembly Language

Assembly Language Statements :

Three Kinds of Statements :

1.Imperative Statements

1.Declaration Statements

1.Assembler Directives
•Imperative Statements : It indicates an action to be performed during the execution of
the assembled program. Each imperative statement typically translates into one machine
instruction.

•Declaration Statements : Two types of declaration statements is as follows


[Lable] DS <Constant>
[Label] DC <Value>

The DS (Declare Storage) statement reserves areas of memory and associates names with
them.
E.g. A DS 1
B DS 150
➢First statement reserves a memory of 1 word and associates the name of the memory as
A.
➢Second statement reserves a memory of 150 word and associates the name of the
memory as B.

The DC (Declare Constant) Statement constructs memory word containing constants


e.g. ONE DC ‘1’

Associates the name ONE with a memory word containing the value ‘1’
Assembler Directives :
Assembler directives instruct the assembler to perform certain actions during
the assembly of a program.
Some Assembler directives are –

START <Constant>
Indicates that the first word of the target program generated by the assembler
should be placed in the memory word with address <Constant>

END [ <operand spec>]


It Indicates the end of the source program

Some Advanced Assembler directives are –


ORIGIN – used to set LC.
ORIGIN 400

EQU – associate the symbol with address.


RESULT EQU TOTAL-Here result will get same address as total.

LTORG – Specifies where the literals should be placed during the program
execution.
Benefits of Assembly Language

➢ How programs interface with OS, processor, and BIOS

➢ How data is represented in memory and other external


devices

➢ How the processor accesses and executes instruction

➢ How instructions access and process data

➢ How a program accesses external devices.


MACHINE LANGUAGE & ASSEMBLY LANGUAGE
The assembler maintains a Location Counter to assign storage
addresses to your program statements.
Pass-1:
✓Define symbols and literals and remember them in
symbol table and literal table respectively.
✓Keep track of location counter
✓Process pseudo-operations

Pass-2:
✓Generate object code by converting symbolic op-code
into respective numeric op-code
✓Generate data for literals and look for values of
symbols
DATA STRUCTURES USED

MACHINE OPCODE TABLE

SYMBOL TABLE

LITERAL TABLE
MACHINE OPCODE TABLE
SYMBOL TABLE
Symbol Table is an important data structure created and maintained by
the compiler in order to keep track of variables
LITERAL TABLE
Contains address of literals.

In contrast with variables, the value of literals do not change. It represents a fixed value
in source code.
Intermediate Code
An intermediate representation is the data structure or code used internally by
a compiler or virtual machine to represent source code.
Pass-1:
Define symbols and literals and remember them in symbol table and
literal table respectively.
Keep track of location counter
Process pseudo-operations
Pass-2:
Generate object code by converting symbolic op-code into respective
numeric op-code
Generate data for literals and look for values of symbols
Working of Pass-2:

Pass-2 of assembler generates machine code by converting


symbolic machine-opcodes into their respective bit
configuration(machine understandable form).

It stores all machine-opcodes in MOT table (op-code table) with


symbolic code, their size and their bit configuration.
Now tables generated by pass 1 along with their LC value will go to pass-2 of
assembler for further processing of pseudo-opcodes and machine op-codes.

You might also like