MODULE 1
System Software
–System Software consists of a variety of programs that support the operation of a
computer. System software is used for operating computer hardware.
–The programs implemented in either software and (or) firmware that makes the
computer hardware usable.
–The software makes it possible for the users to focus on an application or other
problem to be solved, without needing to know the details of how the machine
works internally
.–Example: BIOS (Basic Input Output System
Application software deals with the specific tasks for the user. These are created
to solve various types of computing problems. Application software includes
packaged software like word processing, programming languages such as BASIC,
COBOL, C, Visual Basic, and other commercial and custom software.
Basis for
System Software Application Software
Comparison
System Software manages system Application Software, when
Basic resources and provides a platform run, perform specific tasks, they
for application software to run. are designed for.
System Software is written in a Application Software is written
Language low-level language, i.e. assembly in a high-level language like
language. Java, C++, .net, VB, etc.
System Software starts running
Application Software runs as
Run when the system is turned on, and
and when the user requests.
runs till the system is shut down.
Application software is even
A system is unable to run without
Requirement not required to run the system;
system software.
it is user specific.
System Software is Application Software is
Purpose
general-purpose. specific-purpose.
Microsoft Office, Photoshop,
Examples Operating system.
Animation Software, etc.
Compiler:
is a program whose task is to accept as input a source program written in a certain
high-level language and to produce as output an object code or assembly code.
•Interpreter:
is a program that ultimately performs the same function as a compiler, but in a
different manner. It works by scanning through the source program instruction by
instruction. As each instruction is encountered, the interpreter translates it into
machine code and executes it directly.
•Assembler:
is a program that automatically translates the source program written in assembly
language and to produce as output an object code written in binary machine code.
•Linker:
The Assembler generates the object code of a source program and hands it over to
the linker. The linker takes this object code and generates the executable code for
the program, and hand it over to the Loader.
Linking loader: Performs all linking and relocation operations.
Linkage editor: Produces a linked version of the program, which is
normally written to a file or library for later execution.
Dynamic Linker :Dynamic linker performs dynamic loading or load on call.
•Loader:
(is a routine that) loads an object program into memory of the processor and
prepares it for execution. It calculates the size of a program (instructions and data)
and create memory space for it. It initializes various registers to initiate execution.
▪ Macro Processor
A macro processor is a program that copies a stream of text from one place to
another, making a systematic set of replacements as it does so. Macro processors
are often embedded in other programs, such as assemblers and compilers.
#define pi 3.14
Two new assembler directives are used in macro definition
▪ MACRO: identify the beginning of a macro definition
▪ MEND:identify the end of a macro definition
▪ Debuggers
A debugger is a computer program used by programmers to test and debug a target
program. Debuggers may use instruction-set simulators, rather than running a
program directly on the processor to achieve a higher level of control over its
execution. This allows debuggers to stop or halt the program according to specific
conditions.
▪ Device Driver
A device driver is a program that controls a particular type of device that is
attached to your computer. There are device drivers for printers, displays,
CD-ROM readers, diskette drives, and so on.
The Simplified Instructional Computer (SIC)
▪ SIC is a hypothetical computer that includes the hardware features most
often found on real machines.
▪ Designed to be similar to real computers
▪ Is a virtual machine
Two versions of SIC
▪ standard model (SIC)
▪ extension version (SIC/XE)
▪ Upward compatible- Programs for SIC can run on SIC/XE
Characteristics of SIC -SIC Architecture
1. Memory
▪ 215 (32,768) bytes in the computer memory
▪ 3 consecutive bytes form a word
▪ Memory consists of 8-bit bytes
▪ Any 3 consecutive bytes form a word (24 bits)
2. Registers
▪5 registers
▪Each a full word ( 24-bits) registers
3. Data Formats
▪ Integers are stored as 24-bit binary number
▪ 2’s complement representation for negative values
▪ Characters are stored using 8-bit ASCII codes
▪ No floating-point hardware on the standard SIC
4. Instruction Formats
x: indicate indexed-addressing mode
5. Addressing Modes
(X): the contents of register X
6. Instruction Set
a)Load and store registers
LDA, LDX, STA, STX, etc.
b)Integer arithmetic operations
ADD, SUB, MUL, DIV
All arithmetic operations involve register A and a word in
memory, with the result being left in A.
c)COMP
COMP – compares A with a word in memory
Sets the CC in the SW
d)Jump instructions
JLT – Jump Less Than
JGT – Jump Greater Than
JEQ– Jump Equal to
These instructions test the setting of CC (as set by COMP) and jump
accordingly
7. Subroutine linkage
▪ JSUB - jumps to the subroutine, placing the return
address in register L
▪ RSUB - returns by jumping to the address contained in
register L
8. Input/Output
▪ Test Device instruction (TD) The Test Device (TD) instruction
tests whether the addressed device is ready to send or receive a
byte of data.
o CC of < means device is ready
o CC of = means device is not ready
▪ Read Data (RD) – read data, when the device is ready
▪ Write Data (WD) write data
Input and output are performed by transferring 1 byte at a time to
or from the rightmost 8 bits of register A
1.SIC Programming Examples -- Data movement
LDA FIVE Load 5 into register A
STA ALPHA Store A into ALPHA
LDCH CHARZ Load character ‘Z’ into A
STCH C1 Store into C1
.
.
ALPHA RESW 1 one word variable
FIVE WORD 5 one word constant
CHARZ BYTE C’Z’ one byte constant
C1 RESB 1 one byte variable
2. SIC Programming Example-- Arithmetic operation
BETA=ALPHA+INCR-ONE
DELTA=GAMMA+INCR-ONE
All arithmetic operations are performed using register A, with the result
being left in register A.
3. SIC Programming Example -- Looping and indexing
4. SIC Programming Example -Input and output
SIC/XE Machine Architecture
1. Memory
▪ 220 (1MB) in the computer memory
▪ 3 consecutive bytes form a word
▪ Byte Addressable
▪ Any 3 consecutive bytes form a word (24 bits)
2. Registers
▪5 registers of SIC + 4 additional
▪Each a full word
▪Each a full word ( 24-bits) registers
3. Data Formats
▪ Integers are stored as 24-bit binary number
▪ 2’s complement representation for negative values
▪ Characters are stored using 8-bit ASCII codes
▪ Floating point – 48 bit floating point
Floating point
▪ the exponent is e and the fraction is f
▪ The number is f * 2 (e+1024)
▪ frac: 0~1
▪ exp: 0~2047
4. Instruction Formats
● Format 2 – 16 bit (2 bytes)
ADDR T,A
▪ Bits x,b,p,e: how to calculate the target address
▪ relative, direct, and indexed addressing modes
▪ Bits i and n: how to use the target address (TA)
▪ i=1, n=0: immediate addressing
▪ TA is used as the operand value, no memory reference
▪ i=0, n=1: indirect addressing
▪ The word at the TA is fetched
▪ Value in this word is taken as the address of the operand
value
▪ i=0, n=0 (in SIC), or
▪ i=1, n=1 (in SIC/XE): simple addressing
▪ TA is taken as the address of the operand value
▪ Any of these addressing modes can also be combined with indexed
addressing.
5. Addressing Modes
6. Instruction Set
▪ RMO S,B
▪ Register S content is moved to Register B
▪ ADDR S,B
▪ Add value of S with B and store in Register B
▪ IO channels
▪ Perform IO while CPU is executing other instructions
▪ Three instructions:
▪ SIO: start the operation of IO channel
▪ TIO: test the operation of IO channel
▪ HIO: halt the operation of IO channel
SIC/XE Programming Example
ASCI Value of ‘Z’ 90
Addition and Subtraction in SIC\XE
SIC/XE Subroutine Example
SIC/XE Input and Output Operation
SIC Program to swap the values of ALPHA and BETA
Write a sequence of instructions for SIC to ALPHA equal to the
product of BETA and GAMMA.
Assembly Code:
LDA BETA
MUL GAMMA
STA ALPHA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
Write a sequence of instructions for SIC to set ALPHA equal to the
integer portion of BETA ÷ GAMMA
Assembly Code:
LDA BETA
DIV GAMMA
STA ALPHA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
Write a sequence of instructions for SIC/XE to divide BETA by
GAMMA, setting ALPHA to the integer portion of the quotient and
DELTA to the remainder. Use register-to-register instructions to
make the calculation as efficient as possible.
Assembly Code:
LDA BETA
LDS GAMMA
DIVR S, A
STA ALPHA
MULR S, A
LDS BETA
SUBR A, S
STS DELTA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
DELTA RESW 1
Write a sequence of instructions for SIC/XE to set ALPHA equal to
4*BETA – 9.
LDABETA
LDS #4
MULR S,A
SUB#9
STA ALPHA
ALPHA RESW 1
Write a sequence of instructions for SIC/XE to clear a 20-byte string
to all blanks.
Assembly Code:
LDX ZERO
LOOP LDCH BLANK
STCH STR1,X
TIX TWENTY
JLT LOOP
:
:
STR1 RESW 20
BLANK BYTE C ‘ ‘
ZERO WORD 0
TWENTY WORD 20
Assembler directives
▪ Assembler directives are instructions that direct the assembler to
do something.
▪ Directives do many things; some tell the assembler to set aside
space for variables, others tell the assembler to include additional
source files, and others establish the start address for your
program.
▪ SIC Assembler Directive:
– START: Specify name & starting address.
– END: End of the program, specify the first execution instruction.
– BYTE, WORD, RESB, RESW
▪ These statements are not translated into machine instructions.
▪ Instead, they provide instructions to the assembler itself.