26
Unit -I System Software

Unit -I.pptx

Embed Size (px)

Citation preview

Page 1: Unit -I.pptx

Unit -ISystem Software

Page 2: Unit -I.pptx

Basic Assembler FunctionsFundamental functions of Assembler:

Translating mnemonic code to machine language.

Assigning machine address.What is mnemonic Instructions?

Load, Move,add,sub,Etc..

Page 3: Unit -I.pptx

Additional InstructionsSTART: Specify name and starting address for

program.END: End of source program and (Optionally )next

executable program.BYTE: Generate character or hexadecimal constant,

occupying as many bytes as needed to represent the constant.

WORD: Generate one word integer constant. RESB: (Bytes) Reserve the indicated number of

bytes for a data area.RESW: (Word) Reserve the indicated number of

words for a data area.

Page 4: Unit -I.pptx

Example of a SIC assembler language program.An example of a SIC assembler language

program. Reading input from F1(Input Device).Copies them to an output device. It has two subroutine.

SUB-1: RDREC(Read record into a buffer)SUB-2: WRREC (Write record from buffer to

output device.)Why Buffer?: To Synchronize I/O rates

between two device.

Page 5: Unit -I.pptx

If RD & WD used, only one character will be transferred at a time.

Each end of record marked with null character (00 hexadecimal) .

If end of record is detected, the program writes EOF.

Page 6: Unit -I.pptx
Page 7: Unit -I.pptx
Page 8: Unit -I.pptx
Page 9: Unit -I.pptx

A Simple SIC AssemblerSource to Object Translations Steps:

1. Mnemonic to machine language (STL14)2. Symbolic operands to machine

address( RETADR 1033).3. Build the machine instruction in the proper

format.4. Data constants into internal machine

representations. ( EOF 454F46).5. Write the object program and the assembly

listing.

Page 10: Unit -I.pptx
Page 11: Unit -I.pptx
Page 12: Unit -I.pptx
Page 13: Unit -I.pptx

Forward reference Forward reference:

If the symbolic constant comes in more than one time is called as forward reference.

The symbolic constant will have address by later.

So two pass is required. 1st pass assigning address space for symbolic

constant. 2nd pass remaining process.

Page 14: Unit -I.pptx

Assembler DirectiveFirst statement to be processed is called

assembler directives. Assembler directive provide instruction to

assembler itself. START specifies the starting memory address

for the object program. END To mark end of the program

Page 15: Unit -I.pptx

Object program into output The assembler must writes object code into

some output device. Then the object program will be loaded for

executions. Three types of records namely Header, Text

and End

Page 16: Unit -I.pptx

Object program format(Header, Text and End) Header:

Program name, Starting address and Length. Header Record:

Col. 1 H // column is nothing but byte. Col. 2-7 Program NameCol. 8-13 Object program starting address(In

hexadecimal).Col. 14-19 Length of object program in bytes

(In hexadecimal).

Page 17: Unit -I.pptx

Text:Machine code and data with indications of address.

Text Header:Col. 1 TCol. 2-7 Starting address for object code in this

record(In hexadecimal).Col. 8-9 Length of the object code in this record

in bytes.Col. 10-69 Object code in hexadecimal.

Page 18: Unit -I.pptx

End: Marks end of the program and next starting

addressEnd Record:

Col. 1 ECol. 2-7 Address for next executions.

Page 19: Unit -I.pptx

Conversions of Object CodePass 1: (Define Symbols):

1. Assign address to all statement in the program.

2. Save the address assigned to all labels for use in Pass-2.

3. Processing of assembler directive.

Page 20: Unit -I.pptx

Pass-2:1. Assemble instructions(translating operation

code and looking up address).2. Generate data values defined by BYTE,

WORD, etc( value fulfilling 0 into 0000).3. Processing of assembler directives not done

in pass-1.4. Write object program and the assembly

listing.

Page 21: Unit -I.pptx

Example of Object Code

Page 22: Unit -I.pptx

Assembler Algorithms and Data StructureMajor Internal Data Structure:

OPTAB Operations Code TableSYMTAB Symbol TableLOCCTR Locations Counter

Page 23: Unit -I.pptx

LOCCTRIt is a variable used to help in the

assignment of address. Initially it has the address of START address.After each source statement processed, the

length of the assembled instruction or data area to be generated is added to LOCCTR.

Thus whenever we reach a label in the source program the current value of LOCCTR gives the address to be associated with the label.

Page 24: Unit -I.pptx

OPTABIt has Mnemonic Operation Code and its

equivalent machine code.Instruction format and its length.During Pass 1: Look up and validate

operations codes in the source program(Syntax verifications).

In pass 2: Translations of op code into machine code.

It is organized as hash table (Fast retrieval with minimum of search)with mnemonic code as key.

It is static Table.

Page 25: Unit -I.pptx

SYMTABIt is used to store values(address) assigned

to labels. (Name and value pairs).Flags are used to identify duplicate label

used in source program. Types of label and length of label also

stored. (Data type and Size).During Pass 1: Label and its address(from

LOCCTR) are stored in SYMTAB.Pass 2: Assembled instruction are stored in

specified address.

Page 26: Unit -I.pptx

It is also organized as hash table. Pass 1 usually writes an intermediate file

that contains each source statement together with its assigned address, error indicators ,etc. ( for the purpose of location counter value and error flags.)

Pointer are use between OPTAB and SYMTAB.