Transcript Lecture 11

D75P 34 – HNC Computer
Architecture
Week 11
A Brief History Of Software.
© C Nyssen/Aberdeen College 2003
All images © C Nyssen/Aberdeen College except where stated
Prepared 25/11/03
In the very early days of computing, all programming
could only be done in binary.
Even very junior
programmers
were highly
qualified
mathematicians
and engineers.
Photo courtesy and © US Army
Archives
Coding programs in binary was slow, complex and errorprone and is seldom undertaken nowadays.
Because computer programming was so specialised, a
method had to be found to make it more accessible.
Newly-invented computer “languages” enabled the
programmer to write in more user-friendly code.
Compilers had to be
developed to turn this
code into machinereadable binary.
Photograph courtesy and © Micro Instrumentation and
Telemetry Systems Corp
How does a Pascal
program run?
In 1960, mathematicians at
the Pentagon helped
develop the COBOL
programming language.
This was one of the very first
“high-level” languages,
which is still in common use
today.
Photo© and by permission of Hewlett-Packard Ltd.
But how does a text file of source code become a running
program?
Programmer transfers the
design into appropriate
programming language
Compiler checks the code for
errors
If code is correct, compiler
then creates a map and an
object file
The object file is then linked,
i.e. converted into machinereadable binary
Program can then be run!
There are many programming languages available
today. These vary in complexity and how close they are
to human speech.
As a general rule, the closer
a language is to English, the
further away it gets from the
native language of the
computer – binary.
As languages move further
and further away from binary,
the computer has to work
even harder to figure out
what it is supposed to do!
Some popular programming
languages-
COBOL (1960)
Pascal (1970)
Basic (1975)
Visual Basic (1983)
Java (1995)
C# (C-sharp) (2000)
-and the degree of difficulty
involved for each party!
.MODEL SMALL
.STACK 200H
.CODE
START:
mov ax, 0003h
int 10h
mov bx, 0b800h
mov es, bx
mov bx,0
mov ah, 1
mov es:[bx], ah
mov ax, 0100h
int 21h
mov ax, 4c00h
int 21h
END START
As part of Outcome 3, we
will analyse some source
code written in a very “lowlevel” language – one that
is very close to machine
code.
This language is often
called “Assembly
Language” or more
commonly, just
“Assembler”.
Before high-level languages were developed, computers
could only be programmed in binary or assembler.
Assembly code programmers are still much sought after,
however, for various reasons…
US Army lady programmers at
the decommissioning of ENIAC
in 1955.
Photo © and courtesy US Army.
Legacy programs – many large organisations still use
huge software systems originally developed in
assembly code
Compilers – high level languages have to be converted
to machine-code at some point, so compilers are often
written in assembly code
Device drivers – assembly code provides a high degree
of control over the CPU and hardware, as the
programmer can manipulate registers and RAM directly.
Assembly code is very, very
fast compared to high level
languages. It also gives a
high degree of control over
resources, so these can be
directly diverted to the
graphics and sound cards.
Games programs are often
written in high-level code
such as C++ or Java, with
sections of assembly code
embedded in, to take full
advantage of hardware
control.
This has been written in an object language
such as C++ with chunks of 80x86 thrown in.
High level languages are
compiler-dependent. A Pascal or
Java program will run on any
platform, provided there is a
compatible compiler installed.
Low level languages are
processor-dependent. Assembly
code written to run specifically on
a Pentium, will not run on a Mac
or StrongARM, as all processors
use their own versions of
assembly code.
You will sometimes see software marketed as being “For PC
only”, as these usually contain Intel-derived code which will
only run on a PC.
Every model of processor has it’s own list of assembly
code instructions, that it can understand and respond
to. This is called its Instruction Set.
There are two main types of processors available –
those with a large set of complex instructions, and
those with a smaller, more compact set. These two
groups are called
CISC (Complex
Instruction Set)
and
RISC (Reduced
Instruction Set).
All Intel Pentiums, clones and derivatives use an Intel
80x86 instruction set. Apple computers are based on a
Motorola 68000 processor. Both of these are CISCs.
The Acorn-3000 series, Sun Sparcs and the latest
StrongARM processors all use RISC chips.
The very newest
processors, e.g. the
Pentium 4, now
incorporate elements of
both architectures, and
are often called CRISC
chips.
Both CISC and RISC instruction sets use certain “groups”
of commands –
Load or Move - moves data into a specific register
Arithmetic - adding
and subtracting
Compare works like a
Pascal “if” statement
Branch or Jump - for
a loop structure
Interrupt - hands back
control of the
processor
#source code#
la $t1, stringdata
xor $sp, $sp, $sp
loop:
lb $t0, ($t1)
beqz $t0
sub $sp, $sp, 4
sw $t0, ($sp)
add $t1,$t1,1
j loop
end:
#and continue rest of program
#data#
stringdata :asciiz "Hello_Mum"
When a program is about to be run, it first loads into
RAM. The CPU then fetches each instruction in turn,
analyses and executes it.
This is called the Fetch-Execute Cycle.
How Windows Loads...
The BIOS boots up and does the POST.
 The BIOS then locates an operating system (usually on the
C:\ drive).
 The OS then gets loaded from the hard drive into the RAM.
 The CPU then starts to execute the OS program by
carrying out each instruction in turn.

Summary [1]
 Programming languages can be High Level or Low
Level.
 High Level languages are closer to the language of
the programmer.
 Low Level languages are closer to the language of
the processor.
 Each model of processor has its own instruction set.
 The assembly code used depends on which model of
processor will be used to run the program.
Summary [2]
 High level languages are compiler-dependent.
 Low level languages are processor-dependent.
 Processors fall into two main groups – those using a
Complex, and those using a Reduced, instruction set.
 Programs about to be run are loaded into RAM.
 The CPU then retrieves each instruction in turn,
analyses and runs it.