Introduction to computer software

Download Report

Transcript Introduction to computer software

Introduction to computer
software
Programming the computer
Program, is a sequence of instructions, written to perform a specified
task on a computer
Source code is a program written in a programming language.
A programming language is a formal constructed language designed to
communicate instructions to a machine, particularly a computer.
Programming languages can be used to create programs to control the
behavior of a machine or to express algorithms.
Object code, is what a computer compiler produces In a general sense
object code is a sequence of statements or instructions in a computer
language, usually a machine code language (i.e., binary).
Programming the computer
Initially, a programmer writes a program in a particular programming
language. This form of the program is called the source program, or
more generically, source code. To execute the program, however, the
programmer must translate it into machine language, the language
that the computer understands. The first step of this translation
process is usually performed by a utility called a compiler. The compiler
translates the source code into a form called object code. Sometimes
the object code is the same as machine code; sometimes it needs to be
translated into machine language by a utility called an assembler.
Programming Languages
• Machine Language
• Assembly Language
• High level Language
Machine Language
• In the earliest days of computers, the only programming languages
available were machine languages. Each computer had its own
machine language, which was made of streams of 0s and 1s.
• The fundamental language of the computer’s processor, also called
Low Level Language.
• All programs are converted into machine language before they can be
executed.
• Consists of combination of 0’s and 1’s that represent high and low
electrical voltage.
Assembly Language
• The next evolution in programming came with the idea of replacing
binary code for instruction and addresses with symbols or mnemonics.
Because they used symbols, these languages were first known as
symbolic languages. The set of these mnemonic languages were later
referred to as assembly languages.
Assemblers, Loaders
Assembeler Converts assembly language programs into object files.
Assembeler translates assembly instructions and pseudo-instructions
into machine instructions – Convert decimal numbers, etc. specified by
programmer into binary.
Loader: Loader is a program that loads machine codes of a program
into the system memory.
High Level Language
• Although assembly languages greatly improved programming
efficiency, they still required programmers to concentrate on the
hardware they were using. Working with symbolic languages was also
very tedious, because each machine instruction had to be individually
coded. The desire to improve programmer efficiency and to change the
focus from the computer to the problem being solved led to the
development of high-level languages.
• Computer (programming) languages that are easier to learn.
• Uses English like statements.
• Examples are C ++, Visual Basic, Pascal, Fortran and …....
Compilers and interpreters
Compiler:
During compilation the entire program is converted into executable OBJECT code. It can be
saved and reloaded several times.
This is especially useful for larger programs that have to be executed several times without
having to be modified.
Interpreter:
The source code is translated by the interpreter instruction by instruction into machine language
and immediately executed.
At every execution the translation is redone.
This is interesting to debug programs or for small programs using little mass memory.
Source code takes much less space than object code.
Compilers and Interpreters
Source code
Compiler
Interpreter
Object code
Hardware
Advantages and Disadvantages of high-level and
low-level languages
• High level languages are portable
• Low level languages take less memory therefore they are faster.
Opcode & Operand
• Opcode is the portion of a machine language instruction that specifies
the operation to be performed. What to do and How to do it.
• operand is the part of a computer instruction that specifies data that
is to be operating on or manipulated and, by extension, the data
itself.
HC11 Memory addressing
• Inherent
• Immediate
• Extended
• Direct
• Indexed
• Relative
Machine cycles
•
•
•
•
Fetch - Retrieve an instruction from the memory.
Decode - Translate the retrieved instruction into a series of computer commands.
Execute - Execute the computer commands.
Store - Sand and write the results back in memory.
HC11 Four step Machine Cycle
Flowchart Symbols
Flowchart example
Problems
Chapter questions. Pages 49,50
Problems 3,4,5,6,7,9,10,11,15,20,22,23
Chapter Problems. Page 50
Problems 1, 2