- 1.SYSTEM PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar
Rath System programming:It is the activity of programmingsystem
software. The primary distinguishing characteristic of systems
programming when compared to application programming is that
application programming aims to produce software which provides
services to the user (e.g. word processor), whereas systems
programming aims to produce software which provides services to the
computer hardware (e.g. disk defragmenter). It requires a greater
degree of hardware awareness. Types of software programs System
software helps use the operating system and computer system. It
includes diagnostic tools, compilers, servers, windowing systems,
utilities, language translator, data communication programs,
database systems and more. The purpose of system software is to
insulate the applications programmer as much as possible from the
complexity and specific details of the particular computer being
used, especially memory and other hardware features, and such
accessory devices as communications, printers, readers, displays,
keyboards, etc. 1.Application Software:Application software, also
known as an application or an "app", is computer software designed
to help the user to perform singular or multiple related specific
tasks. It helps to solve problems in the real world. Examples
include enterprise software, accounting software, office suites,
graphics software, and media players. Application software is
contrasted with system software and middleware, which manage and
integrate a computer's capabilities, but typically do not directly
apply them in the performance of tasks that benefit the user. A
simple, if imperfect, analogy in the world of hardware would be the
relationship of an electric light bulb (an application) to an
electric power generation plant (a system). The power plant merely
generates electricity, not itself of any real use until harnessed
to an application like the electric light that performs a service
that benefits the user. Spreadsheets: The spreadsheet packages are
designed to use numbers and formulas to do calculations with ease.
Examples of spreadsheets include: Budgets Payrolls Grade
Calculations Address Lists The most commonly used spreadsheet
programs are Microsoft Excel and Lotus 123. Graphic Presentations:
The presentation programs can be easier using overhead projectors.
Other uses include: Slide Shows Repeating Computer Presentations on
a computer monitor Using Sound and animation in slide shows
2. SYSTEM PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar
Rath The most recognized graphic presentation programs are
Microsoft PowerPoint and Hardware Graphics. Database Management
System (DBMS): A DBMS is a software tool that allows multiple users
to store, access, and process data into useful information.
Database programs are designed for these types of applications:
Membership lists Student lists Grade reports Instructor schedules
All of these have to be maintained so you can find what you need
quickly and accurately. Example: Microsoft Access, dBase, Oracle.
2. System software: System software is computer software designed
to operate the computer hardware and to provide maintain a platform
for running The computer application software. The most basic types
of system software are: BIOS and device firmware, which provide
basic functionality to operate and control the hardware connected
to or built into the computer. The operating system (prominent
examples being Microsoft Windows, Mac OS X and Linux), which allows
the parts of a computer to work together by performing tasks like
transferring data between memory and disks or rendering output onto
a display device. It also provides a platform to run high-level
system software and application software. Utility software, which
helps to analyze, configure, optimize and maintain the computer. In
contrast to system software, software that allows users to do
things like create text documents, play games, listen to music, or
surf the web is called application software. Specific kinds of
system software include: Loaders Linkers Utility software Desktop
environment / Graphical user interface Shells BIOS Hypervisors Boot
loaders Database Management Systems(SQL, MySQL) If system software
is stored on non-volatile memory such as integrated circuits, it is
usually termed firmware. 3. SYSTEM PROGRAMMING (1ST MODULE)
Prepared By Mr.Santosh Kumar Rath Evolution of components of a
programming system Assembler: -- An assembler is a program that
takes basic computer instructions and converts them into a pattern
of bits that the computer's processor can use to perform its basic
operations. Some people call these instructions assembler language
and others use the term assembly language. Here's how it works:
Most computers come with a specified set of very basic instructions
that correspond to the basic machine operations that the computer
can perform. For example, a "Load" instruction causes the processor
to move a string of bits from a location in the processor's memory
to a special holding place called a register. Assuming the
processor has at least eight registers, each numbered, the
following instruction would move the value (string of bits of a
certain length) at memory location 3000 into the holding place
called register 8: L 8, 3000 The programmer can write a program
using a sequence of these assembler instructions. This sequence of
assembler instructions, known as the source code or source program,
is then specified to the assembler program when that program is
started. The assembler program takes each program statement in the
source program and generates a corresponding bit stream or pattern
(a series of 0's and 1's of a given length). The output of the
assembler program is called the object code or object program
relative to the input source program. The sequence of 0's and 1's
that constitute the object program is sometimes called machine
code. The object program can then be run (or executed) whenever
desired. A utility program called an assembler is used to translate
assembly language statements into the target computer's machine
code. The assembler performs a more or less isomorphic People
Application Programming Compiler Assemblers Macro Processors
Loaders Text Editors Searching and SortingDebugging aids I/O
programs Memory Management LibrariesSchedulerFile Systems Device
Management 4. SYSTEM PROGRAMMING (1ST MODULE) Prepared By
Mr.Santosh Kumar Rath translation (a one-to-one mapping) from
mnemonic statements into machine instructions and data. This is in
contrast with high-level languages, in which a single statement
generally results in many machine instructions. An assembly
languageis a low-level programming language for computers,
microprocessors, microcontrollers, and other integrated circuits.
It implements a symbolic representation of the binary machine codes
and other constants needed to program a given CPU architecture.
This representation is usually defined by the hardware
manufacturer, and is based on mnemonics that symbolize processing
steps (instructions), processor registers, memory locations, and
other language features. An assembly language is thus specific to a
certain physical (or virtual) computer architecture. This is in
contrast to most high-level programming languages, which, ideally,
are portable. Loader: In a computer operating system , a loader is
a component that locates a given program (which can be an
application or, in some cases, part of the operating system itself)
in offline storage (such as a hard disk ), loads it into main
storage (in a personal computer, it's called random access memory
), and gives that program control of the computer (allows it to
execute its instruction s). A program that is loaded may itself
contain components that are not initially loaded into main storage,
but can be loaded if and when their logic is needed. In a
multitasking operating system, a program that is sometimes called a
dispatcher juggles the computer processor's time among different
tasks and calls the loader when a program associated with a task is
not already in main storage. (By program here, we mean a binary
file that is the result of a programming language compilation,
linkage editing, or some other program preparation process.) In
computing, a loader is the part of an operating system that is
responsible for loading programs, one of the essential stages in
the process of starting a program, it means loader is a program
that places programs into memory and prepares them for execution.
Loading a program involves reading the contents of executable file,
the file containing the program text, into memory, and then
carrying out other required preparatory tasks to prepare the
executable for running. Once loading is complete, the operating
system starts the program by passing control to the loaded program
code. All operating systems that support program loading have
loaders, apart from systems where code executes directly from ROM
or in the case of highly specialized computer systems that only
have a fixed set of specialized programs. In many operating systems
the loader is permanently resident in memories, although some
operating systems that support virtual memory may allow the loader
to be located in a region of memory that is pageable. 5. SYSTEM
PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar Rath In the
case of operating systems that support virtual memory, the loader
may not actually copy the contents of executable files into memory,
but rather may simply declare to the virtual memory subsystem that
there is a mapping between a region of memory allocated to contain
the running program's code and the contents of the associated
executable file. (See memory-mapped file.) The virtual memory
subsystem is then made aware that pages with that region of memory
need to be filled on demand if and when program execution actually
hits those areas of unfilled memory. This may mean parts of a
program's code are not actually copied into memory until they are
actually used, and unused code may never be loaded into memory at
all. Macro: In computer science is a rule or pattern that specifies
how a certain input sequence (often a sequence of characters)
should be mapped to an output sequence (also often a sequence of
characters) according to a defined procedure. The mapping processes
that instantiates (transforms) a macro into a specific output
sequence is known as macro expansion. The term originated with
macro-assemblers, where the idea is to make available to the
programmer a sequence of computing instructions as a single program
statement, making the programming task less tedious and less
error-prone. Macros often allow positional or keyword parameters
that dictate what the conditional assembler program generates and
have been used to create entire programs or program suites
according to such variables as operating system, platform or other
factors. Compiler: A compiler is a special program that processes
statements written in a particular programming language and turns
them into machine language or "code" that a computer's processor
uses. Typically, a programmer writes language statements in a
language such as Pascal or C one line at a time using an editor.
The file that is created contains what are called the source
statements. The programmer then runs the appropriate language
compiler, specifying the name of the file that contains the source
statements. When executing (running), the compiler first parses (or
analyzes) all of the language statements syntactically one after
the other and then, in one or more successive stages or "passes",
builds the output code, making sure that statements that refer to
other statements are referred to correctly in the final code.
Traditionally, the output of the compilation has been called object
code or sometimes an object module. (Note that the term "object"
here is not related to object-oriented programming .) The object
code is machine code that the processor can process or "execute"
one instruction at a time. A program that translates source code
into object code. The compiler derives its name from the way it
works, looking at the entire piece of source code and collecting
and reorganizing the instructions. Thus, a compiler differs from an
interpreter, which analyzes and executes each line of source code
in succession, without looking at the entire program. The advantage
of interpreters is that they can execute a program immediately.
Compilers require some time before 6. SYSTEM PROGRAMMING (1ST
MODULE) Prepared By Mr.Santosh Kumar Rath an executable program
emerges. However, programs produced by compilers run much faster
than the same programs executed by an interpreter. Every high-level
programming language (except strictly interpretive languages) comes
with a compiler. In effect, the compiler is the language, because
it defines which instructions are acceptable. Because compilers
translate source code into object code, which is unique for each
type of computer, many compilers are available for the same
language. For example, there is a FORTRAN compiler for PCs and
another for Apple Macintosh computers. In addition, the compiler
industry is quite competitive, so there are actually many compilers
for each language on each type of computer. More than a dozen
companies develop and sell C compilers for the PC. Linker: --
Linker performs the linking of libraries with the object code to
make the object code into an executable machine code. Formal
system: In formal logic, a formal system (also called a logical
calculus[citation needed]) consists of a formal language and a set
of inference rules, used to derive (to conclude) an expression from
one or more other premises that are antecedently supposed (axioms)
or derived (theorems). The axioms and rules may be called a
deductive apparatus. A formal system may be formulated and studied
for its intrinsic properties, or it may be intended as a
description (i.e. a model) of external phenomena. A compiler is a
computer program (or set of programs) that transforms source code
written in a programming language (the source language) into
another computer language (the target language, often having a
binary form known as object code). The most common reason for
wanting to transform source code is to create an executable
program. Each formal system has a formal language, which is
composed by primitive symbols. These symbols act on certain rules
of formation and are developed by inference from a set of axioms.
The system thus consists of any number of formulas built up through
finite combinations of the primitive symbolscombinations that are
formed from the axioms in accordance with the stated rules. Formal
systems in mathematics consist of the following elements: 1. A
finite set of symbols (i.e. the alphabet), that can be used for
constructing formulas (i.e. finite strings of symbols). 2. A
grammar, which tells how well-formed formulas (abbreviated wff) are
constructed out of the symbols in the alphabet. It is usually
required that there be a decision procedure for deciding whether a
formula is well formed or not. 3. A set of axioms or axiom
schemata: each axiom must be a wff. 4. A set of inference rules. 7.
SYSTEM PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar Rath A
formal system is said to be recursive (i.e. effective) if the set
of axioms and the set of inference rules are decidable sets or
semidecidable sets, according to context. Some theorists use the
term formalism as a rough synonym for formal system, but the term
is also used to refer to a particular style of notation, for
example, Paul Dirac's bra-ket notation Operating Systems Operating
System is software, which makes a computer to actually work. What
is OS? It is the software the enables all the programs we use. The
OS organizes and controls the hardware. Examples: An operating
system (OS) is Windows, Linux, Unix and Mac OS, etc., software,
consisting of programs and data, that runs on computers and manages
computer hardware resources[ and provides common services for
efficient execution of various application software.For hardware
functions such as input and output and memory allocation, the
operating system acts as an intermediary between application
programs and the computer hardware,although the application code is
usually executed directly by the hardware, but will frequently call
the OS or be interrupted by it. Operating systems are found on
almost any device that contains a computerfrom cellular phones and
video game consoles to supercomputers and web servers. Examples of
popular modern operating systems for personal computers are
Microsoft Windows, Mac OS X, and GNU/Linux. controlling and
allocating memory, What OS does? An operating system performs basic
tasks such as, prioritizing system requests, controlling input and
output devices, facilitating networking and Managing file systems.
8. SYSTEM PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar
Rath The structure of OS consists of 4 layers: Hardware: Hardware
consists of CPU, Main memory, I/O Devices, etc, Software (Operating
System): Software includes process management routines, memory
management routines, I/O control routines, file management
routines. System programs: This layer consists of compilers,
Assemblers, linker etc. Application programs: This is dependent on
users need. Ex. Railway reservation system, Bank database
management etc, Evolution of OS Structure of Operating System: The
evolution of operating systems went through seven major phases. Six
of them significantly changed the ways in which users accessed
computers through the open shop, batch processing,
multiprogramming, timesharing, personal computing, and distributed
systems. In the seventh phase the foundations of concurrent
programming were developed and 9. SYSTEM PROGRAMMING (1ST MODULE)
Prepared By Mr.Santosh Kumar Rath Timesharing Simultaneoususer
interaction, On- line file systems Mastics file system (1965),Unix
(1974) Concurrent Programming Hierarchical systems, Extensible
kernels, Parallel programming concepts, Secure parallel languages
RC 4000 system (1969),13 Venus system (1972),14 Boss 2 system
(1975). Personal Computing Graphic user interfaces OS 6
(1972),Pilot system (1980) Distributed Systems Remote servers WFS
file server (1979) Unix United RPC (1982)24 system . In Batch
processing same type of jobs batch (BATCH- a set of jobs with
similar needs) together and execute at a time. Batch Processing:
The OS was simple, its major task was to transfer control from one
job to the next. The job was submitted to the computer operator in
form of punch cards. At some later time the output appeared. The OS
was always resident in memory. (Ref. Fig. next slide) Common output
devices were line printers, tape drives, and card punches. Users
did not interact directly with the computer systems, but he
prepared a job (comprising of the program, the data, & some
control information). Multiprogramming is a technique to execute
number of programs simultaneously by a single processor.
Multiprogramming: In Multiprogramming, number of processes resides
in main memory at a time. The OS picks and begins to execute one of
the jobs in the main memory. Major Phases Technical Innovations
Operating Systems Open Shop The idea of OS IBM 701 open shop (1954)
Batch Processing Tape batching, First-in, first-out scheduling. BKS
system (1961) Multi- programming Processor multiplexing,
Indivisible operations, Demand paging, Input/output spooling,
Priority scheduling, Remote job entry Atlas supervisor (1961), Exec
II system (1966) 10. SYSTEM PROGRAMMING (1ST MODULE) Prepared By
Mr.Santosh Kumar Rath If any I/O wait happened in a process, then
CPU switches from that job to another job. Hence CPU in not idle at
any time. The main memory consists of 5 jobs at a time, the CPU
executes one by one. Efficient memory utilization Advantages:
Throughput increases, CPU is never idle, so performance increases
Time sharing, or multitasking, is a logical extension of
multiprogramming. Time Sharing Systems: Multiple jobs are executed
by switching the CPU between them. In this, the CPU time is shared
by different processes, so it is called as Time sharing Systems.
Time slice is defined by the OS, for sharing CPU time between
processes. Examples: Multics, Unix, etc., Operating Systems
functions: 1. Program creation The main functions of operating
systems are: 2. Program execution 3. Input/output operations 4.
Error detection 5. Resource allocation 6. Accounting 7. Protection
Single User Systems Types of OS: Operating System can also be
classified as,- Multi User Systems Provides a platform for only one
user at a time. Single User Systems: They are popularly associated
with Desk Top operating system which run on standalone systems
where no user accounts are required. Example: DOS 11. SYSTEM
PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar Rath Provides
regulated access for a number of users by maintaining a database of
known users. Multi-User Systems: Refers to computer systems that
support two or more simultaneous users. Another term for multi-user
is time sharing. Ex: All mainframes and are multi-user systems.
Example: UNIX UNIX Operating Systems It is a modified KDE desktop
operating under Linux. The Unix-like family is a miscellaneous
group of Unix Operating Systems, with several major sb-categories
including BSD, System V, and Linux. UNIX systems run on a wide
variety of machine structural designs. They are utilized heavily as
server systems in business, as well as workstations in educational
and engineering environments. Complementary software UNIX options
are Linux and BSD, are famous in these areas. Microsoft Windows
Operating Systems The Microsoft Windows family of Operating Systems
derived as append to the older MS-DOS milieu for the IBM PC.
Contemporary versions are based on the newer Windows NT core that
was initially intended for OS/2 and borrowed from VMS. Windows runs
on x86, x86-64 and Itanium processors. Previous versions also
operate on the MIPS, DEC Alpha, Fairchild Clipper and PowerPC
structural designs. Sun Solar Operating Systems One of the world's
largest on-hand inventories of fully tested, renovated Sun
Microsystems paraphernalia. Solar Systems Peripherals, Inc. is
devoted to providing user with outstanding values in Sun
Microsystems. 12. SYSTEM PROGRAMMING (1ST MODULE) Prepared By
Mr.Santosh Kumar Rath General Machine Structure The structure above
consists of - 1. Instruction Interpreter 2. Location Counter 3.
Instruction Register 4. Working Registers 5. General Register The
Instruction Interpreter Hardware is basically a group of circuits
that perform the operation specified by the instructions fetched
from the memory. The Location Counter can also be called as
Program/Instruction Counter simply points to the current
instruction being executed. The working registers are often called
as the "scratch pads" because they are used to store temporary
values while calculation is in progress. This CPU interfaces with
Memory through MAR & MBR MAR (Memory Address Register) -
contains address of memory location (to be read from or stored
into) MBR (Memory Buffer Register) - contains copy of address
specified by MAR Memory controller is used to transfer data between
MBR & the memory location specified by MAR. The role of I/O
Channels is to input or output information from memory. 13. SYSTEM
PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar Rath Memory
Register Program Count Register (PC):Also called instruction
pointer Instruction Register (IR) :Stores instruction fetched from
memory Memory Address Register (MAR) Memory Data Register (MDR)
Status Registers Status of CPU and currently executing program
Flags (one bit Boolean variable) to track condition like arithmetic
carry and overflow, power failure, internal computer error A.
Register Operations Stores values from other locations (registers
and memory) Addition and subtraction Shift or rotate data Test
contents for conditions such as zero or positive B. Operation of
Memory Each memory location has a unique address Address from an
instruction is copied to the MAR which finds the location in memory
CPU determines if it is a store or retrieval Transfer takes place
between the MDR and memory MDR is a two way register Data and
instructions Instructions and data Our CPU processes instructions
and data. It receives orders from the software. The CPU is fed a
gentle stream of binary data via the RAM. These instructions can
also be called program code. They include the commands which you
constantly via user programs send to your PC using your keyboard
and mouse. Commands to print, save, open, etc. Data is typically
user data. Think about that email you are writing. The actual
contents (the text, the letters) are user data. But when you and
your software say send, your are sending program code
(instructions) to the processor. 14. SYSTEM PROGRAMMING (1ST
MODULE) Prepared By Mr.Santosh Kumar Rath Each instruction of a
computer specifies an operation on certain data. There are various
ways of specifying address of the data to be operated on. An
addressing mode specifies how to calculate the effective memory
address of an operand by using information held in Address
Generated By IBM system 370: In System/370, a 24-bit virtual
address is generated. The address is the address of a byte but may
actually refer to one or more bytes depending on the op code. What
is a Addressing Mode? registers and/or constants contained within a
machine instruction or elsewhere. The various addressing modes that
are defined in a given instruction set architecture define how
machine language instructions in that architecture identify the
operand (or operands) of each instruction. These different ways of
specifying data are called the addressing modes. The most common
addressing modes are: Immediate addressing mode Direct addressing
mode Indirect addressing mode Register addressing mode Register
indirect addressing mode Displacement addressing mode To specify
the addressing mode of an instruction several methods are used.
Most often used are: a) Different operands will use different
addressing modes. b) One or more bits in the instruction format can
be used as mode field. The value of the mode field determines which
addressing mode is to be used. The effective address will be either
main memory address of a register. Immediate Addressing: This is
the simplest form of addressing. Here, the operand is given in the
instruction itself. This mode is used to define a constant or set
initial values of variables. The advantage of this mode is that no
memory reference other than instruction fetch is required to obtain
operand. The disadvantage is that the size of the number is limited
to the size of the address field, which most instruction sets is
small compared to word length. 15. SYSTEM PROGRAMMING (1ST MODULE)
Prepared By Mr.Santosh Kumar Rath INSTRUCTION OPERAND Direct
Addressing: In direct addressing mode, effective address of the
operand is given in the address field of the instruction. It
requires one memory reference to read the operand from the given
location and provides only a limited address space. Length of the
address field is usually less than the word length. Ex : Move P,
Ro, Add Q, Ro P and Q are the address of operand. Indirect
Addressing: Indirect addressing mode, the address field of the
instruction refers to the address of a word in memory, which in
turn contains the full length address of the operand. The advantage
of this mode is that for the word length of N, an address space of
2N can be addressed. He disadvantage is that instruction execution
requires two memory reference to fetch the operand Multilevel or
cascaded indirect addressing can also be used. Register Addressing:
Register addressing mode is similar to direct addressing. The only
difference is that the address field of the instruction refers to a
register rather than a memory location 3 or 4 bits are used as
address field to reference 8 to 16 generate purpose registers. The
advantages of register addressing are Small address field is needed
in the instruction. Register Indirect Addressing: This mode is
similar to indirect addressing. The address field of the
instruction refers to a register. The register contains the
effective address of the operand. This mode uses one memory
reference to obtain the operand. The address space is limited to
the width of the registers available to store the effective
address. Displacement Addressing: In displacement addressing mode
there are 3 types of addressing mode. They are : 1) Relative
addressing 2) Base register addressing 3) Indexing addressing. This
is a combination of direct addressing and register indirect
addressing. The value contained in one address field. A is used
directly and the other address refers to a register whose contents
are added to A to produce the effective address. 16. SYSTEM
PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar Rath
Addressing Modes Supported by IBM 360: Three basic addressing modes
are supported: immediate, register, and storage. An immediate
operand is a 1-byte value contained in some instructions. Types of
operands involved: A register operand is contained in a general
register or a floating-point register, depending on the
instruction. A storage operand is contained in virtual memory. Each
storage-operand reference consists of a 12-bit displacement and a
4-bit register identifier that designates one of the general
registers. If the register identifier is 0, it indicates that the
register is component is not to be used. General: fixed-point
arithmetic instruction, logical instruction, general register
shifting instruction, general register load & store
instructions, compare instruction, branch instructions, conversion
instructions. Instruction Types Supported : The System/370
principles of operations define five broad classes of machine
instructions: Decimal: decimal instructions Floating point:
floating-point instructions Privileged I/O: special-purpose control
instructions, privileged I/O instructions Privileged System
Control: privileged system-control instructions Base Registers in
address calculation: 1. A 32bit binary arithmetic, as described by
IBM: The System/370 uses 32bit twoscomplement signed integers. The
range of these integers is 231 to 231 1, inclusive. Now, 231 =
2,147,483,648, so the range is 2,147,483,648 through 2,
147,483,6647. Each of the sixteen generalpurpose registers contains
binary integer data. The bits in the registers are numbered left to
right. But 0 is the sign bit. It is 1 for a negative number and 0
for a nonnegative. 17. SYSTEM PROGRAMMING (1ST MODULE) Prepared By
Mr.Santosh Kumar Rath 2. A characterization of the sixteen
generalpurpose registers in the System/370. Which are really
general purposes? Addressing: The general purpose registers perform
all the addressing involved in referencing main storage. When used
for addressing, the register is called a base register. When so
used, the contents of the register are viewed as an unsigned
integer. Some System/370 systems provide only 24 bits for
addressing.Current System/390 systems use 64bit addressing. The
General Purpose Registers(Some facts): The generalpurpose registers
in the System/370 are identified by number: 0 15.Of these, only the
ten registers 3 through 12 can be used for any purpose. The other
six registers are less general purpose and should be used with
caution. Registers 0 and 1 can be used as temporary registers, but
calls to supervisor routines will destroy their contents. Register
2 can be used as a temporary and possibly as a base register. The
TRT (Translate and Test) instruction will change the value of this
register. Registers 13, 14, and 15 are used by the control programs
and subprograms. Each of the sixteen registers is identified by a
fourbit binary number, or equivalently by a single hexadecimal
digit. Suggested convention: Use either register 3 or register 12
as the single required base register. The standard prefix code
should contain the following sequence. BALR 12, 0 This uses
register 12 as a base. USING *, 12 Register Naming Conventions Note
that there are two ways of writing the part of the standard prefix
code. What we have discussed in these slides: BALR 12, 0 USING *,
12 What we have used in our labs is valid if it follows a R12 EQU
12: BALR R12, 0 USING *, R12 From this I infer that the assembler
will accept either notation in places in which the syntax expects a
register to be used. NOTE: The first line is a truncated subroutine
call. The instruction says: 1. Store the address of the next
instruction into R12 2. Branch to the address in the second
argument. Since that second address is 0, the branch is not taken
and execution continues. 18. SYSTEM PROGRAMMING (1ST MODULE)
Prepared By Mr.Santosh Kumar Rath 1. A base address, stored in a
specified base register. In general, only registers 3 through 12
should be used as base registers. Base Register Addressing: The
System/370 uses a common design feature that splits addresses into
two parts: 2. A displacement, specifying the positive offset (in
bytes) from the start of the section. The System/370 uses a 12bit
number for this displacement. The displacement value is in the
range 0 through 4095, inclusive. The format of the address in this
form is as follows: | B | D D D | where B is the single hexadecimal
digit indicating the base register, and D D D denotes the three
hexadecimal digits used to specify the offset. Suppose that
general-purpose register 3 contains the value X4500.The address
reference 3507, shown as | 3 | 507 | refers to the address X4500 +
X507 = X4A07 In hexadecimal 5 + 5 = A. NOTE: Register 0 cannot be
used as a base register. The assembler will interpret the address |
0 | D D D | as no base register being used. BALR R0, 0 USING *, R0
Any call to a system procedure will disrupt the addressing.
Options: No Base Register vs. The Default Base Register So far, we
have considered only the object code form of a typical address. We
now jump ahead a bit and look at two typical instructions that use
this address type.One type of instruction, called RS, used for
registertostorage instructions.Such an instruction has source code
of the form OP R1,R3,D2(B2).Such an instruction has object code of
the form OP R1R3 B2D2 D2D2. We look at LM, an interesting example
of this format. LM R1,R3,S2 loads multiple registers in the range
R1 R3 from the memory location specified by S2, the address of
which will be in the form | B2 | D2 D2 D2 |. We now interpret the
following code fragment. BALR R12, 0 Establish register R12 (XC)
USING *, R12 as the default base resister. LM R5,R7,S2 might have
object code 98 57 C1 00. This uses the default base register. LM
R9,R11,S3(R3) might have object code 98 9B 32 00. Object code such
as 98 9B 0E 00 would call for use of an absolute address, not
computed from a base register. For this example, it is likely to be
bad code. 19. SYSTEM PROGRAMMING (1ST MODULE) Prepared By
Mr.Santosh Kumar Rath Advantage Of Using Base Register Addressing:
It offers two advantages of base/displacement addressing. Remember
that the System/370 of the time admitted a 24bit address space,
with addresses ranging from 0 through 224 1 or 0 through
16,777,215. A full 24bit address would require 24 bits, or six
hexadecimal digits, or three bytes. The base register/displacement
method of addressing allocates 4 bits to the base register 12 bits
to the displacement In this method, an address requires 16 bits, or
two bytes. We now quote Abel on the first major advantage of
base/displacement addressing The instruction length is reduced
because each address requires only two bytes rather than three. One
might infer that some of the System/360 and System/370
installations had very little memory. Base Register/Displacement
Addressing: Relocating the Code The second major advantage of
base/displacement addressing still applies today. The system
facilitates program relocatability. Instead of assigning specific
[fixed] storage addresses, the assembler determines each address
relative to a base address. At execute time [after the program is
loaded], the base address, which may be anywhere in storage, is
loaded into a base register. The standard prefix code BALR 3, 0
USING *, 3 Not an instruction; no address assigned may be
translated as follows: Q. What is the address of the first
instruction after the USING. Load that address into register 3 and
use it as a base address in that register. Base/Displacement vs.
Indexed Addressing: Note the similarities with indexed addressing,
in which the base is given by a variable and the offset is given by
a register. Systems that use the register contents as a base do so
because the registers can store larger numbers than the bits in the
machine code. For example, the System/360 allocates only 12 bits
for the displacement, which is combined with the contents of a
register, which can be a 32bit number. Addressing Example: Here are
some more examples of addressing using an index register and a base
register. All of these examples are taken from type RX
instructions, which use indexing. length of the form OP
R1,D2(X2,B2-------4byte. The format of the object code is OP R1X2
B2D2 D2D2. Each byte contains two hexadecimal digits. We interpret
the 32bit object code as follows. OP ------8 bit operation code.
20. SYSTEM PROGRAMMING (1ST MODULE) Prepared By Mr.Santosh Kumar
Rath R1X2 ---------R1 denotes a register as the source or
destination of the operation. X2 denotes a generalpurpose register
to be used as an index register. B2 D2 D2D2 This contains the
argument address as a base register and displacement. Remember that
the displacement, given by three hexadecimal digits, is treated as
a 12bit unsigned integer. In decimal, the limit is 0 Displacement
4095. The general form by which an address is computed is Contents
(Base Register) + Contents (Index Register) + Displacement. Some
instructions do not use index register addressing. Addressing:
Example 1: Here is some object code for analysis. 58 40 C1 23 The
first thing to note is that the opcode, 58, is that for L, a
Register Load. This is a type RX instruction with object code of
the form OP R1X2 B2D2 D2D2. As noted above, OP = 58. We see that R1
= 4. It is register 4 that is being loaded from memory. We see that
X2 = 0. Indexed addressing is not used. We also note that B2D2 D2D2
= C1 23, indicating an offset of X123 from the address value stored
in generalpurpose register 12 (hexadecimal C). Suppose that the
value in generalpurpose register 12 is X2500. The effective address
for this instruction is then X2500 + X123 = X2623. Addressing:
Example 2: Here is another example of object code. 58 A7 B1 25 The
first thing to note is that the opcode, 58, is that for L, a
Register Load. This is a type RX instruction with object code of
the form OP R1X2 B2D2 D2D2. As noted above, OP = 58. The
hexadecimal digit for the register is A, indicating that register
10 is being loaded. Recall that all of the digits in the object
code are given in hexadecimal. We see that X2 = 7, indicating that
generalpurpose register 7 is being used as an index register. We
also note that B2D2 D2D2 = B1 25, indicating an offset of X125 from
the address value stored in generalpurpose register 11 (hexadecimal
B). Suppose the following: Register 11 contains X0012 4000 The
displacement is X0000 0125 Register 7 contains X0000 0300 The
address is thus X0012 4425 21. SYSTEM PROGRAMMING (1ST MODULE)
Prepared By Mr.Santosh Kumar Rath Selecting and Assigning Address
to a base register: Again, the standard prefix code handles this.
BALR 12, 0 USING *, 12 If register 12 is used as a base register,
it cannot be used for any other purpose.In other words, your code
should not reference register 12 explicitly.We have two standards
suggested for a base register SAVE (14,12) SAVE CALLER'S REGS BALR
R12,0 ESTABLISH USING *,R12 ADDRESSABILITY LA R2,SAVEAREA POINT TO
MY LOWER-LEVEL SA ST R2,8(,R13) FORWARD-CHAIN MINE FROM CALLER'S ST
R13,SAVEAREA+4 BACK-CHAIN CALLER'S FROM MINE LR R13,R2 SET 13 FOR
MY SUBROUTINE CALLS ********************** BEGIN LOGIC
*********************** NOTE that this code uses register 12 as the
base register. Introduction to Assembly Language Programming
Assembly programming is low-level programming using some basic
syntax to represent machine code for a specific CPU. An assembler
is used to translate the assembly code into the machine code for
the target computer. A program created from assembly can be more
efficient and faster than a program created with a compiler. One
example of why this occurs is because a compiler will store
intermediate values used in a calculation in memory whereas a
program written in assembly can store the intermediate values in a
register which is much faster. However, while there may be
performance benefits to programming so close to the machine level,
there is a great deal of added complexity which a high-level
programming language can remove.