INTERNAL TEST (SCHEME AND SOLUTION)

Similar documents
Gechstudentszone.wordpress.com

Chapter 1: Background

TRB-COMPUTER INSTRUCTOR COMPUTER SCIENCE UNIT IV. SYSTEM SOFTWARE 10% DISCOUNT FOR ALL PGTRB MATERIALS WITH QUESTION BANK.

Chapter 1 Background. Professor Gwan-Hwan Hwang Dept. Computer Science and Information Engineering National Taiwan Normal University

Chapter 2 Assemblers Machine-Dependent Assembler Features


Chapter 1. Introduction


DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CS2422 Assembly Language & System Programming

CS2422 Assembly Language & System Programming

Unit 2 -- Outline. Basic Assembler Functions Machine-dependent Assembler Features Machine-independent Assembler Features Assembler Design Options

Assemblers. System Software by Leland L. Beck. Chapter 2

Chapter 2. Assembler Design

UNIT II ASSEMBLERS. Figure Assembler

Gechstudentszone.wordpress.com

CS2304-SYSTEM SOFTWARE 2 MARK QUESTION & ANSWERS. UNIT I INTRODUCTION

1.Program to find factorial of a given number

System Programming. System Software: An Introduction to Systems Programming. Leland L. Beck 3rd Edition Addison-Wesley, 1997

2.1. Basic Assembler Functions:

UNIT 1: MACHINE ARCHITECTURE

Machine dependent Assembler Features

PESIT SOUTHCAMPUS 10CS52: SYSTEM SOFTWARE QUESTION BANK

UNIT I - INTRODUCTION

Chapter 3 Loaders and Linkers -- Machine-Dependent Loader Feature

PESIT Bangalore South Campus Department of MCA Course Information for. System Programming (13MCA24)

UNIT 1: MACHINE ARCHITECTURE

CSI 402 Lecture 5 (Assemblers Continued) 5 1 / 18

AS-2883 B.Sc.(Hon s)(fifth Semester) Examination,2013 Computer Science (PCSC-503) (System Software) [Time Allowed: Three Hours] [Maximum Marks : 30]

Chapter 3 Loaders and Linkers

An Assembler Written in SAS Ed Heaton, Westat, Rockville, MD

Systems Programming Assemblers Part 3-3 Program Blocks

Chapter 3 Loaders and Linkers

國立嘉義大學資訊工程學系系統程式期中考考卷

CS1203-SYSTEM SOFTWARE UNIT I-INTRODUCTION

UNIT III - LOADERS AND LINKERS

Prepared By : Ms. Sanchari Saha ( Asst. Professor) Department : Computer Science & Engineering

COMPILERS BASIC COMPILER FUNCTIONS

8.7 TM: A SIMPLE TARGET MACHINE

Assembler Design Options

System Software DCAP507

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

Chapter 2 Assemblers Assembler Design Options

Chapter 3 Loaders and Linkers

COMPUTER ORGANIZATION & ARCHITECTURE

ASSEMBLERS. Prof. S.J. Soni, SPCE, Visnagar

Systems Programming Assemblers Part 4 Control Sections

LOADERS AND LINKERS 1. BASIC LOADER FUNCTIONS 2. DESIGN OF AN ABSOLUTE LOADER 3. A SIMPLE BOOTSTRAP LOADER 4. MACHINE DEPENDENT LOADER FEATURES

COS 140: Foundations of Computer Science

EC-801 Advanced Computer Architecture

Introduction. Chapter 4 Macro Processors -- Basic Macro Processor Functions. Macro expansion. Basic macro processor functions

1 Little Man Computer

Assembly Language Programming of 8085

UNIT III LOADERS AND LINKERS

Computer Organization CS 206 T Lec# 2: Instruction Sets

Assembly Language Programming of 8085

Instruction Sets: Characteristics and Functions Addressing Modes

EC 413 Computer Organization

UNIT I. Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4. 1

CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

Binghamton University. CS-140 Fall Pippin

Compiler, Assembler, and Linker

Programming Model 2 A. Introduction

Lecture 4: Instruction Set Architecture

Instruction Set Architecture. "Speaking with the computer"

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

ISA: The Hardware Software Interface

Blog -

Assembly Language. Prof. Dr. Antônio Augusto Fröhlich. Sep 2006

Computer Organization and Architecture (CSCI-365) Sample Final Exam

SCRAM Introduction. Philipp Koehn. 19 February 2018

Chapter 2 Assemblers. PDF created with FinePrint pdffactory Pro trial version

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

Computer Organization and Architecture, Pt. 2

THE MICROPROCESSOR Von Neumann s Architecture Model

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

17. Instruction Sets: Characteristics and Functions

Reminder: tutorials start next week!

Computer Architecture /

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Chapter 4. MARIE: An Introduction to a Simple Computer

UNIT-IV: MACRO PROCESSOR

This contains the following three processes, and they are,

Computer Organization and Technology Processor and System Structures

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Chapter 2A Instructions: Language of the Computer

Lecture 5: Instruction Set Architectures II. Take QUIZ 2 before 11:59pm today over Chapter 1 Quiz 1: 100% - 29; 80% - 25; 60% - 17; 40% - 3

Programming of 8085 microprocessor and 8051 micro controller Study material

Lecture 20: AVR Programming, Continued. AVR Program Visible State (ones we care about for now)

Computer Organization II CMSC 3833 Lecture 33

MARIE: An Introduction to a Simple Computer

Loaders. Systems Programming. Outline. Basic Loader Functions

Instruction Sets Ch 9-10

Instruction Sets Ch 9-10

Computer Organization

INSTRUCTION SET OF 8085

Transcription:

PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) Dept of MCA INTERNAL TEST (SCHEME AND SOLUTION) 1 Subject Name: System Programming Subject Code: (13MCA24) 1. a) Define system Software and it s components System software is a set of programs that manage the resources of a computer system. System Software is a collection of system programs that perform a variety of functions. Application software performs specific tasks for the computer user. Application software is a program which program written for, or, by, a user to perform a particular job Components of System software: Assembler Loader Compiler Interpreter Operating System b) Discuss the difference between system and Application software Subject Application Software System Software Definition Application software is computer software designed to help the user to perform specific tasks. System software is computer software designed to operate the computer hardware and to provide a platform for running application software. Purpose It is specific purpose software. It is general-purpose software. Classification Package Program, Time Sharing,

Resource Sharing, Client Server Batch Processing Operating System Customized Program Real time Operating System Multi-processing Operating System Multi-programming Operating System Environment Execution Time Essentiality Number Application Software performs in a environment which created by System/Operating System It executes as and when required. Distributed Operating System System Software Create his own environment to run itself and run other application. It executes all the time in computer. Application is not essential for a System software is essential for a computer computer. The number of application software The number of system software is less than is much more than system software. application software. 2. Explain the architecture of SIC/XE and mention few difference from SIC Memory: 1 word = 24 bits (3 8-bit bytes) total (SIC) = 2 15 (32,768) bytes (32Kbytes) total (SIC/XE) = 2 20 (1,048,576) bytes (1Mbyte) Registers: 10 x 24 bit registers MNEMONIC Register # Comment/note A 0 Accumulator X 1 Index register L 2 Linkage register (JSUB/RSUB) B (SIC/XE) 3 Base register

S (SIC/XE) 4 General register T (SIC/XE) 5 General register F (SIC/XE) 6 Floating Point Accumulator (48 bits) PC 8 Program Counter (PC) SW 9 Status Word (includes Condition Code, CC) Data Format: Integers - stored in 24 bit, 2's complement format Characters stored in 8-bits, in ASCII format Float (SIC/XE) stored in 48 bit signed-exponent-fraction format: s exponent {11} fraction {36} fraction range: 0..1 exponent: unsigned binary range 0..2047 s: 0=positive, 1=negative therefore, the absolute floating point number value is: f*2 (e-1024) Instruction Format: SIC: op {8} x address {15} x indicates indexed-addressing mode SIC/XE: Format 1 (1 byte):

op {8} Format 2 (2 bytes): op {8} r1 {4} r2 {4} Format 3 (3 bytes): op {8} n i x b p e displacement {12} Format 4 (4 bytes): op {8} n i x b p e address {20} Formats 3 & 4 introduce addressing mode flag bits: (note I will use TA for "target address" & disp for "displacement") flags n & i: n=0 & i=1 immediate addressing - TA is used as an operand value (no memory reference) n=1 & i=0 indirect addressing - word at TA (in memory) is fetched & used as an address to fetch the operand from n=0 & i=0 simple addressing TA is the location of the operand n=1 & i=1 simple addressing same as n=0 & i=0 flag x: x=1 indexed addressing add contents of X register to TA calculation flag b & p (Format 3 only): b=0 & p=0 direct addressing displacement/address field contains TA (note Format 4 always uses direct addressing) b=0 & p=1 PC relative addressing - TA=(PC)+disp (-2048<=disp<=2047)* b=1 & p=0 Base relative addressing - TA=(B)+disp (0<=disp<=4095)** * note - in PC relative, disp is interpreted as a 12 bit signed integer in 2's complement

** note - in Base relative, disp is interpreted as a 12 bit unsigned integer flag e: e=0 use Format 3 e=1 use Format 4 Addressing Mode Table Instructions: SIC provides 26 instructions, SIC/XE provides an additional 33 instructions (59 total) SIC has 6 categories of instructions: load/store registers (LDA, LDX, LDCH, STA, STX, STCH, etc.) integer arithmetic operations (ADD, SUB, MUL, DIV) these will use register A and a word in memory, results are placed into register A compare (COMP) compares contents of register A with a word in memory and sets CC (Condition Code) to <, >, or = conditional jumps (JLT, JEQ, JGT) - jumps according to setting of CC subroutine linkage (JSUB, RSUB) - jumps into/returns from subroutine using register L input & output control (RD, WD, TD) - see next section SIC/XE has additional instructions available in each of the above mentioned categories, plus, it has 3 additional categories of instructions: floating point arithmetic operations (ADDF, SUBF, MULF, DIVF) register manipulation, operands-from-registers, and register-to-register arithmetics (RMO, RSUB, COMPR, SHIFTR, SHIFTL, ADDR, SUBR, MULR, DIVR, etc) Input and Output (I/O): 2 8 (256) I/O devices may be attached, each has its own unique 8-bit address 1 byte of data will be transferred to/from the rightmost 8 bits of register A

3 I/O instructions are provided: RD Read Data from I/O device into A WD Write data to I/O device from A TD Test Device determines if addressed I/O device is ready to send/receive a byte of data. The CC (Condition Code) gets set with results from this test: < device is ready to send/receive = device isn't ready SIC/XE Has capability for programmed I/O (I/O device may input/output data while CPU does other work) - 3 additional instructions are provided: SIO Start I/O HIO Halt I/O TIO Test I/O Write SIX and SIC/XE program for the following instruction (ALPHA+INCR-1) stores in BETA (GAMMA+INCR-1) in DELTA (ALPHA+INCR-1) Stores in BETA and the value (GAMMA+INCR-1) in DELTA... LDA ALPHA ADD INCR SUB ONE STA BETA LDA GAMMA ADD INCR SUB ONE STA DELTA ONE WORD 1 one-word constant ALPHA RESW 1 one-word variables BETA RESW 1

GAMMA RESW 1 DELTA RESW INCR RESW 4. Write an Algorithm for pass-1 of assembler Begin, Read first input line If OPCODE = START Then Begin save # [OPERAND] as starting address Initialize LOCCTR as starting address read next input line end {if START} Else initialize LOCCTR to 0 While OPCODE =/ END do Begin IF there is not a comment line then begin IF there is a symbol in the LABEL field then begin search SYMTAB for LABEL if found then

begin if symbol value as null set symbol value as LOCCTR and search the linked list with the corresponding operand PTR addresses and generate operand addresses as corresponding operand set symbol value as LOCCTR in symbol table and delete the linked list End Else insert (LABEL, LOCCTR) into SYMTAB end search OPTAB for OPCODE if found then begin search SYMTAB for OPERAND address if found then if symbol value not equal to null then store symbol value as OPERAND address else insert (symbol name, null ) add 3 to LOCCTR end

else if OPCODE = WORD then add 3 to LOCCTR else if OPCODE = RESW then Add 3 # [OPERAND] to LOCCTR Else if OPCODE = RESB then Add # [operand] to LOCCTR Else if OPCODE = BYTE then begin find the length of constant in bytes and length to LOCCTR convert constant to object code end If object code will not fit in to current text record then Begin write text record to object program initialize new text record End add object code to text record End write listing line read next input line

end Write last text record to object program Write End record to object program Write last listing line END { Pass 1} 5. Explain the following assembler directives START: specify name & starting address END: end of source program, specify the first execution instruction BYTE and BYTE: instructs the Assembler to ganarate constant as part of assembly code RESB and RESW: instruct the Assember to reserve the specifed amount of space for execution 6. write a note on machine independent assembler features Program Blocks Programs assembled was treated as a unit. The source programs logically contained subroutines, data areas, etc. However, they were handled by the assembler as one entity, resulting in a single block of object code. Some machines generate instructions and data to appear in the object program in a different order from source statements. Other machines results in creation of several independent parts of the object program.

These parts maintain their identity and are handled separately by the loader. Although the source program logically contains subroutines, data area, etc, they were assembled into a single block of object code in which the machine instructions and data appeared in the same order as they were in the source program. To provide flexibility: Program blocks Segments of code that are rearranged within a single object program unit Control sections Why Program Blocks? Segments of code that are translated into independent object program units To satisfy the contradictive goals: Separate the program into blocks in a particular order Large buffer area is moved to the end of the object program Using the extended format instructions or base relative mode may be reduced. (lines 15, 35, and 65) Placement of literal pool is easier: simply put them before the large data area, CDATA block. (line 253) Data areas are scattered

Program readability is better if data areas are placed in the source program close to the statements that reference them Literals

Let programmers to be able to write the value of a constant operand as a part of the instruction that uses it. This avoids having to define the constant elsewhere in the program and make up a label for it. Such an operand is called LITERAL. Value is stated literally in the instruction. A literal is identified with a prefix =. Literal is equivalent to: Define a constant explicitly and assign an address label for it Use the label as the instruction operand Why use literals: To avoid defining the constant somewhere and making up a label for it Instead, to write the value of a constant operand as a part of the instruction How to use literals: A literal is identified with the prefix =, followed by a specification of the literal value Example e.g. 45 001A ENDFIL LDA =C EOF 032010 Specifies a 3-byte operand whose value is the character string EOF. 93 LTORG 002D * =C EOF 454F46 e.g. 215 1062 WLOOP TD =X 05 E32011 Specifies a 1-byte literal with the hexadecimal value 05.

Literal - Implementation Assembler handles literal operands using literal table-littab Pass 1 Pass 2 Program Relocation literal name, the operand value and length, the address assigned to the operand build LITTAB with literal name, operand value and length, leaving the address unassigned when LTORG statement is encountered, assign an address to each literal not yet assigned an address search LITTAB for each literal operand encountered generate data values using BYTE or WORD statements generate modification record for literals that represent an address in the program It is often desirable to have more than one program at a time sharing the memory and other resources of the machine. Most of the time it is not practical to plan program execution this closely. We do not know exactly when jobs will be submitted, exactly how long they will run. In such situation the actual starting address of the program is not known until load time. 3. Explain and Generate an object code for below program

0000 COPY START 0 0000 FIRST STL RETADR 17202D 0003 LDB #LENGTH 69202D BASE 0006 CLOOP +JSUB RDREC 4B101036 000A LDA LENGTH 032026 000D COMP #0 290000 0010 JEQ ENDFIL 332007 0013 +JSUB WREC 4B10105D 0017 J CLOOP 3F2FEC 001A ENDFIL LDA EOF 032010 001D STA BUFFER 0F2016 0020 LDA #3 010003 0023 STA LENGTH 0F200D 0026 +JSUB WREC 4B10105D 002A J @RETADR 3E2003 002D EOF BYTE C EOF 454F46 0030 RETADR RESW 1 0033 LENGTH RESW 1 0036 BUFFER RESB 4096.. 1036 RDREC CLEAR X B410.. 105D WREC CLEAR X B410 ---------------- OPCODES STL = 14, LDB=68, JSUB=48, LDA=00, STA=0C, J=3C, CLEAR=B4