Docsity

System software notes 10cs52(vtuplanet.com), Lecture notes of System Programming

Toggle sidebar
bg1
SYSTEM SOFTWARE 10CS52
Dept. of ISE, SJBIT
SYLLABUS
PART – A
UNIT – 1 6 Hours
Machine Architecture: Introduction, System Software and Machine Architecture,
Simplified Instructional Computer (SIC) - SIC Machine Architecture, SIC/XE Machine
Architecture, SIC Programming Examples.
UNIT – 2 6 Hours
Assemblers -1: Basic Assembler Function - A Simple SIC Assembler, Assembler Algorithm
and Data Structures, Machine Dependent Assembler Features - Instruction Formats &
Addressing Modes, Program Relocation.
UNIT – 3 6 Hours
Assemblers -2: Machine Independent Assembler Features – Literals,Symbol-Definition
Statements, Expression, Program Blocks, Control Sections and Programming Linking,
Assembler Design Operations - One- Pass Assembler, Multi-Pass Assembler,
Implementation Examples – MASM Assembler.
UNIT – 4 8 Hours
Loaders and Linkers: Basic Loader Functions - Design of an Absolute Loader, A Simple
Bootstrap Loader, Machine-Dependent Loader Features – Relocation, Program Linking,
Algorithm and Data Structures for a Linking Loader; Machine-Independent Loader Features
- Automatic Library Search, Loader Options, Loader Design Options - Linkage Editor,
Dynamic Linkage, Bootstrap Loaders, Implementation Examples - MS-DOS Linker.
PART – B
UNIT – 5 6 Hours
Editors and Debugging Systems: Text Editors - Overview of Editing Process, User
Interface, Editor Structure, Interactive Debugging Systems - Debugging Functions and
Capabilities, Relationship With Other Parts Of The System, User-Interface Criteria
UNIT – 6 8 Hours
Macro Processor: Basic Macro Processor Functions - Macro Definitions and Expansion,
Macro Processor Algorithm and Data Structures, Machine- Independent Macro Processor
Features - Concatenation of Macro Parameters, Generation of Unique Labels, Conditional
Macro Expansion, Keyword Macro Parameters, Macro Processor Design Options - Recursive
Macro
Expansion, General-Purpose Macro Processors, Macro Processing Within Language
Translators, Implementation Examples - MASM Macro Processor, ANSI C Macro Processor.
More notes & papers: www.VTUplanet.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64
Discount

On special offer

Partial preview of the text

Download System software notes 10cs52(vtuplanet.com) and more Lecture notes System Programming in PDF only on Docsity!

SYSTEM SOFTWARE 10CS

SYLLABUS

PART – A

UNIT – 1 6 Hours Machine Architecture: Introduction, System Software and Machine Architecture, Simplified Instructional Computer (SIC) - SIC Machine Architecture, SIC/XE Machine Architecture, SIC Programming Examples.

UNIT – 2 6 Hours Assemblers -1: Basic Assembler Function - A Simple SIC Assembler, Assembler Algorithm and Data Structures, Machine Dependent Assembler Features - Instruction Formats & Addressing Modes, Program Relocation.

UNIT – 3 6 Hours Assemblers -2: Machine Independent Assembler Features – Literals,Symbol-Definition Statements, Expression, Program Blocks, Control Sections and Programming Linking, Assembler Design Operations - One- Pass Assembler, Multi-Pass Assembler, Implementation Examples – MASM Assembler.

UNIT – 4 8 Hours Loaders and Linkers: Basic Loader Functions - Design of an Absolute Loader, A Simple Bootstrap Loader, Machine-Dependent Loader Features – Relocation, Program Linking, Algorithm and Data Structures for a Linking Loader; Machine-Independent Loader Features

  • Automatic Library Search, Loader Options, Loader Design Options - Linkage Editor, Dynamic Linkage, Bootstrap Loaders, Implementation Examples - MS-DOS Linker.

PART – B

UNIT – 5 6 Hours Editors and Debugging Systems: Text Editors - Overview of Editing Process, User Interface, Editor Structure, Interactive Debugging Systems - Debugging Functions and Capabilities, Relationship With Other Parts Of The System, User-Interface Criteria

UNIT – 6 8 Hours Macro Processor: Basic Macro Processor Functions - Macro Definitions and Expansion, Macro Processor Algorithm and Data Structures, Machine- Independent Macro Processor Features - Concatenation of Macro Parameters, Generation of Unique Labels, Conditional Macro Expansion, Keyword Macro Parameters, Macro Processor Design Options - Recursive Macro Expansion, General-Purpose Macro Processors, Macro Processing Within Language Translators, Implementation Examples - MASM Macro Processor, ANSI C Macro Processor.

SYSTEM SOFTWARE 10CS

UNIT – 7 6 Hours Lex and Yacc – 1: Lex and Yacc - The Simplest Lex Program, Recognizing Words With LEX, Symbol Tables, Grammars, Parser-Lexer Communication, The Parts of Speech Lexer, A YACC Parser, The Rules Section, Running LEX and YACC, LEX and Hand- Written Lexers, Using LEX – Regular Expression, Examples of Regular Expressions, A Word Counting Program, Parsing a Command Line.

UNIT – 8 6 Hours Lex and Yacc - 2 : Using YACC – Grammars, Recursive Rules, Shift/Reduce Parsing, What YACC Cannot Parse, A YACC Parser - The Definition Section, The Rules Section, Symbol Values and Actions, The LEXER, Compiling and Running a Simple Parser, Arithmetic Expressions and Ambiguity, Variables and Typed Tokens.

Text Books:

  1. Leland.L.Beck: System Software, 3rd Edition, Pearson Education, 1997. (Chapters 1.1 to 1.3, 2 (except 2.5.2 and 2.5.3), 3 (except 3.5.2 and 3.5.3), 4 (except 4.4.3))
  2. John.R.Levine, Tony Mason and Doug Brown: Lex and Yacc, O'Reilly, SPD, 1998. (Chapters 1, 2 (Page 2-42), 3 (Page 51-65))

Reference Books:

  1. D.M.Dhamdhere: System Programming and Operating Systems, 2nd^ Edition, Tata McGraw
  • Hill, 1999.

5.3 Recommended Questions

  • SYSTEM SOFTWARE 10CS
    • 1.1 Introduction. 1. Machine Architecture
    • 1.2 System Software and Machine Architecture.
    • 1.3 Simplified Instructional Computer (SIC).
      • 1.3.1 SIC Machine Architecture.
      • 1.3.2 SIC Programming Examples.
      • 1.3.3 SIC/XE Machine Architecture.
    • 1.4 Recommended Questions
    1. Assemblers -
      • 2.1 Basic Assembler Function
        • 2.1.1 A Simple SIC Assembler
        • 2.1.2Assembler Algorithm and Data Structures
      • 2.2 Machine Dependent Assembler Features
        • 2.2.1 Instruction Formats & Addressing Modes
        • 22.2. Program Relocation.
      • 2.3 Recommended Questions
    1. Assemblers -
      • 3.1 Machine Independent Assembler Features
        • 3.1.1 Literals
        • 3.1.2 Symbol-Definition Statements
        • 3.1.3 Expression, Program Blocks
        • 3.1.4 Control Sections and Programming Linking
      • 3.2 Assembler Design Operations
        • 3.2.1 One-Pass Assembler
        • 3.2.2 Multi-Pass Assembler
      • 3.3 Implementation Examples – MASM Assembler.
      • 3.4 Recommended Questions
  • 4.1 Basic Loader Functions 4. Loaders and Linkers - 4.1.1 Design of an Absolute Loader - 4.1.2 A Simple Bootstrap Loader
  • 4.2 Machine-Dependent Loader Features - 4.2.1Relocation - 4.2.2Program Linking - 4.2.3 Algorithm and Data Structures for a Linking Loader
  • 4.3 Machine-Independent Loader Features - 4.3.1 Automatic Library Search
    • SYSTEM SOFTWARE 10CS
      • 4.3.2 Loader Options
  • 4.4 Loader Design Options - 4.4.1 Linkage Editor - 4.4.2 Dynamic Linkage - 4.4.3Bootstrap Loaders
  • 4.5Implementation Examples - 4.5.1 MS-DOS Linker.
  • 4.6 Recommended Questions - 5.1 Text Editors 5. Editors and Debugging Systems - 5.1.1 Overview of Editing Process - 5.2.2 User Interface - 5.2.3 Editor Structure - 5.2 Interactive Debugging Systems - 5.2.1Debugging Functions and Capabilities - 5.2.2 Relationship with Other Parts of the System - 5.2.3User-Interface Criteria - 6.1 Basic Macro Processor Functions 6. Macro Processor - 6.1.1 Macro Definitions and Expansion - 6.1.2 Macro Processor Algorithm and Data Structures - 6.2 Machines-Independent Macro Processor Features - 6.2.1 Concatenation of Macro Parameters - 6.2.2 Generation of Unique Labels - 6.2.3 Conditional Macro Expansion - 6.2.4 Keyword Macro Parameters - 6.3 Macro Processor Design Options - 6.3.1 Recursive Macro Expansion - 6.3.2 General-Purpose Macro Processors - 6.3.3 Macro Processing Within Language Translators - 6.4 Implementation Examples - 6.5 Recommended Questions
    1. Lex and Yacc –
      • 7.1 Lex and Yacc
      • 7.2 A YACC Parser
      • 7.3 Using LEX
      • 7.4 Recommended Questions
    • SYSTEM SOFTWARE 10CS
    1. Lex and Yacc –
      • 8.1 Using YACC
      • 8.2 A YACC Parser
      • 8.3 The LEXER
      • 8.4 Compiling and Running a Simple Parser
      • 8.5 Arithmetic Expressions and Ambiguity
      • 8.6 Variables and Typed Tokens
      • 8.7 Recommended Questions

SYSTEM SOFTWARE 10CS

SYSTEM SOFTWARE 10CS

SYSTEM SOFTWARE 10CS

There are aspects of system software that do not directly depend upon the type of computing system, general design and logic of an assembler, general design and logic of a compiler and code optimization techniques, which are independent of target machines. Likewise, the process of linking together independently assembled subprograms does not usually depend on the computer being used.

1.3 The Simplified Instructional Computer (SIC):

Simplified Instructional Computer (SIC) is a hypothetical computer that includes the hardware features most often found on real machines. There are two versions of SIC, they are, standard model (SIC), and, extension version (SIC/XE) (extra equipment or extra expensive).

1.3.1 SIC Machine Architecture:

We discuss here the SIC machine architecture with respect to its Memory and Registers, Data Formats, Instruction Formats, Addressing Modes, Instruction Set, Input and Output

 Memory: There are 2^15 bytes in the computer memory, that is 32,768 bytes. It uses Little Endian format to store the numbers, 3 consecutive bytes form a word , each location in memory contains 8-bit bytes.

 Registers: There are five registers, each 24 bits in length. Their mnemonic, number and use are given in the following table.

SYSTEM SOFTWARE 10CS

Mnemonic Number Use A 0 Accumulator; used for arithmetic operations X 1 Index register; used for addressing L 2 Linkage register; JSUB PC 8 Program counter SW 9 Status word, including CC  Data Formats: Integers are stored as 24-bit binary numbers. 2’s complement representation is used for negative values, characters are stored using their 8-bit ASCII codes.No floating-point hardware on the standard version of SIC.

 Instruction Formats: Opcode(8) x Address (15) All machine instructions on the standard version of SIC have the 24-bit format as shown above

 Addressing Modes:

Mode Indication Target address calculation

Direct x = 0 TA = address

Indexed x = 1 TA = address + (x)

SYSTEM SOFTWARE 10CS

1.3.2Example Programs (SIC):

Example 1: Simple data and character movement operation LDA FIVE STA ALPHA LDCH CHARZ STCH C

ALPHA RESW 1

FIVE WORD 5

CHARZ BYTE C’Z’

C1 RESB 1

Example 2: Arithmetic operations

LDA ALPHA ADD INCR SUB ONE STA BETA …….. …….. ……..

ONE WORD 1

ALPHA RESW 1

BEETA RESW 1

INCR RESW 1

SYSTEM SOFTWARE 10CS

Example 3: Looping and Indexing operation

LDX ZERO ; X = 0

MOVECH LDCH STR1, X ; LOAD A FROM STR STCH STR2, X ; STORE A TO STR TIX ELEVEN ; ADD 1 TO X, TEST JLT MOVECH . . .

STR1 BYTE C ‘HELLO WORLD’

STR2 RESB 11

ZERO WORD 0

ELEVEN WORD 11

Example 4: Input and Output operation

INLOOP TD INDEV : TEST INPUT DEVICE

JEQ INLOOP : LOOP UNTIL DEVICE IS READY RD INDEV : READ ONE BYTE INTO A STCH DATA : STORE A TO DATA . .

OUTLP TD OUTDEV : TEST OUTPUT DEVICE

SYSTEM SOFTWARE 10CS

1.3.3SIC/XE Machine Architecture:

 Memory Maximum memory available on a SIC/XE system is 1 Megabyte (2^20 bytes).  Registers Additional B, S, T, and F registers are provided by SIC/XE, in addition to the registers of SIC.

Mnemonic Number Special use

B 3 Base register

S 4 General working register

T 5 General working register

F 6 Floating-point accumulator (48 bits)

 Floating-point data type: There is a 48-bit floating-point data type, F*2(e-1024)

1 11 36

s exponent fraction

 Instruction Formats: The new set of instruction formats fro SIC/XE machine architecture are as follows.

 Format 1 (1 byte): contains only operation code (straight from table).

SYSTEM SOFTWARE 10CS

 Format 2 (2 bytes): first eight bits for operation code, next four for register 1 and following four for register 2. The numbers for the registers go according to the numbers indicated at the registers section (ie, register T is replaced by hex 5, F is replaced by hex 6).  Format 3 (3 bytes): First 6 bits contain operation code, next 6 bits contain flags, last 12 bits contain displacement for the address of the operand. Operation code uses only 6 bits, thus the second hex digit will be affected by the values of the first two flags (n and i). The flags, in order, are: n, i, x, b, p, and e. Its functionality is explained in the next section. The last flag e indicates the instruction format (0 for 3 and 1 for 4).  Format 4 (4 bytes): same as format 3 with an extra 2 hex digits (8 bits) for addresses that require more than 12 bits to be represented.

Format 1 (1 byte)

8

op

Format 2 (2 bytes)

8 4 4

op r1 r

Formats 1 and 2 are instructions do not reference memory at all

Format 3 (3 bytes)

6 1 1 1 1 1 1 12

op n i x b p e disp

SYSTEM SOFTWARE 10CS

Bits x,b,p : Used to calculate the target address using relative, direct, and indexed addressing Modes.

Bits i and n: Says, how to use the target address

b and p - both set to 0, disp field from format 3 instruction is taken to be the target address. For a format 4 bits b and p are normally set to 0, 20 bit address is the target address

x - x is set to 1, X register value is added for target address calculation

i=1, n=0 Immediate addressing, TA : TA is used as the operand value, no memory reference

i=0, n=1 Indirect addressing, ((TA)) : The word at the TA is fetched. Value of TA is taken as the address of the operand value

i=0, n=0 or i=1, n=1 Simple addressing, (TA) :TA is taken as the address of the operand value

Two new relative addressing modes are available for use with instructions assembled using format 3.

Mode Indication Target address calculation

Base relative b=1,p=

TA=(B)+ disp

(0disp 4095)

Program-counter relative b=0,p=

TA=(PC)+ disp (-2048disp 2047)

 Instruction Set: SIC/XE provides all of the instructions that are available on the standard version. In addition we have, Instructions to load and store the new registers LDB, STB, etc, Floating- point arithmetic operations, ADDF, SUBF, MULF, DIVF, Register move instruction : RMO,

SYSTEM SOFTWARE 10CS

Register-to-register arithmetic operations, ADDR, SUBR, MULR, DIVR and, Supervisor call instruction : SVC.

 Input and Output: There are I/O channels that can be used to perform input and output while the CPU is executing other instructions. Allows overlap of computing and I/O, resulting in more efficient system operation. The instructions SIO, TIO, and HIO are used to start, test and halt the operation of I/O channels.

Example Programs (SIC/XE)

Example 1: Simple data and character movement operation

LDA # STA ALPHA LDA # STCH C . . ALPHA RESW 1 C1 RESB 1

Example 2: Arithmetic operations

LDS INCR LDA ALPHA

SYSTEM SOFTWARE 10CS

RECOMMENDED QUESTIONS:

  1. Bring out the differences b/w System software and Application software.( 5)
  2. Give the SIC machine architecture with all options? (10)
  3. Suppose alpha is an array of 100 words. Write a sequence of instructions for SIC\XE to set all 100 elements to 0. (6)
  4. Write a sequence of instructions for SIC to clear a 20 byte string to all blanks.(6)
  5. Give the machine architecture of SIC/XE? (10)
  6. With an example, explain simple I/O operation of SIC/XE? (5)

SYSTEM SOFTWARE 10CS

CHAPTER -

ASSEMBLERS-

2.1 Basic Assembler Functions:

The basic assembler functions are:

 Translating mnemonic language code to its equivalent object code.  Assigning machine addresses to symbolic labels.

  • The design of assembler can be to perform the following:
    • Scanning (tokenizing)
    • Parsing (validating the instructions)
    • Creating the symbol table
    • Resolving the forward references
    • Converting into the machine language

 SIC Assembler Directive:

  • START: Specify name & starting address.
  • END: End of the program, specify the first execution instruction.
  • BYTE, WORD, RESB, RESW
  • End of record: a null char(00) End of file: a zero length record
  • The design of assembler in other words:
  • Convert mnemonic operation codes to their machine language equivalents

SOURCE PROGRAM

ASSEMBLER OBJECT CODE