8.
1 Input methods
It involves getting data from the user to the computer.
Some input can go directly to the computer for processing e.g bar codes, speech through
microphone and data entered by means of a device that converts motions to on-screen action.
Some input goes through a good deal of intermediate handling e.g from source to magnetic disk.
The goal however is to gather data to be processed by the computer i.e raw data and convert it into
some form the computer can understand.
Input devices include:
i. Keyboard
ii. Mouse
iii. Trackball
iv. Light pen joystick
v. Trackball
vi. Touch screen
vii. Touch pad, etc
8.2 Source data automation
It involves use of special equipment to collect data at the source as a by-product of the activity that
generates the data and send it directly to the computer.
Source data automation eliminates keying, thereby reducing costs and opportunities for human-
introduced mistakes. It also improves the speed of the input operation.
It reduces the number of intermediate steps required between the origination of data and its
processing e.g the barcode.
Data automation devices include:
i. Scanner
ii. Magnetc-Ink Character recognition
iii. Optical mark recognition
iv. Bar-codes
8.3 Output methods
It provides information for the user.
This method takes the form of screen or printer output, voice, graphics, microfilm. Etc.
Output devices include:
i. Speakers
ii. Headphones
iii. Screen
iv. Printer
v. Plotter
8.4 Assembly Language
Assembly language is a type of low-level language for programming computer, micro-processors
and micro-controllers and integrated circuits.
Assembly language uses mnemonics, instructions and operands to represent machine code. E.g.
MOV-10110000
Assembly language is the most basic programming language available for any processor. Each
processor has its own assembly language. A programmer works only with operations implemented
directly on the physical CPU.
Assembly language is not portable between various families of processors. Every computer
architecture has its own machine language therefore its own assembly language.
While all general purpose computers are able to carry out essentially the same functionality, the
way they do it differs and the corresponding assembly language must reflect these differences.
Instructions in assembly language are generally very simple unlike in a high level language. An
assembler is used to translate assembly language into target computer machine code. Multiple sets
of assembly language syntax may exist for a single instruction set.
Assembly language consists of 3 types of instruction statements which are used to define the
program operations.
1. Opcode mnemonics
Mnemonics is a symbolic name for a single executable machine language instruction
(opcode)
There is at least one opcode mnemonic defined for each machine language instruction.
Each instruction consists of an opcode plus operands (one byte values address of data
located elsewhere)
2. Data sections
There are instructions used to define data elements to hold data variables. They define the
type of data, the length and the alignment of data. These instructions also define whether
the data is available to outside programs or only to the program in which the data section
is defined.
3. Assembly directives
Are instructions executed by the assembler at assembly time not by CPU at run time. They
depend on parameters input by the programmer to assemble a program. They also can be
used to manipulate presentation of the program to make it easier for the programmer to
read and maintain.
Most amblers provide flexible symbol management, allowing programmers to manage
namespaces, calculate offsets within data structures and assign labels that refer to literal values or
result of simple computations. Assembly language allows comments to be added to assembly
source code but are ignored by assembler.
8.5 Usage of assembly language
i. Interacting directly with the hardware e.g. device drivers and interrupt handlers
ii. Using processor-specific instructions not exploited by the compiler e.g. encryption
algorithms
iii. A system with severe resource constraints (embedded system) must be hand-coded to
maximize the use of limited resources
iv. Writing real-time programs that need precise timing and responses e.g. medical equipments
v. Writing computer viruses, bootloaders, device drivers
vi. Writing games
vii. Writing compiler software
viii. Writing cryptographic algorithms
Example of an Assembly language:
MOV AX 47104 // Copy 47104 into location AX
MOV DS, AX // Copy AX into location AX
MOV [ 3998], 36 // Put 36 into memory location 3998
INT 32 // exits the program by returning to the operating system
8.6 Developing an Assembly Language
Steps:
Analyzing the problem and producing a specification for both hardware hardware and
software.
Developing the overall structure of the program, defining the individual elements and modules
within it.
Coding each module required using Assembly language
Assembling each source code module to produce an intermediate relocatable object code file (
using assembler)
Linking modules in order to produce a complete executable program
Testing, debugging and documenting the final program
Tools
ASCII text editor
Macro assembler
A linker
Library manager
The assembly process
Assembly is the process of translating the symbolic assembly code into machine code.
A two-pass assembler is used where one assembly language instruction maps to one machine
instruction.
Pass-one
1. Main job is to build the symbol table
Table 8.1: Symbol Table
BINARY MNEMONIC NAME
0000xxxx LODD Load Direct
0001xxxx STOD Store Direct
0010xxxx ADDD Add Direct
2. Go through the program to be translated and build the instruction location counteters
3. Translate from symbolic opcode to numeric
4. Add the label symbols
e.g symbol value
a0 500
a1 501 etc
Pass-two
Completes the translation by filling in the operand fields.
8.7 Linking and Loading
Programs are made up from more than one module and the results of each module translation
must be linked together to produce an executable program.
In linking and loading, the main jobs are:-
1. Resolve references to external objects/symbols for which there is no value after pass-
2 i.e. reference from one subprogram to another
2. Relocate relative addresses to yield absolute address i.e assigning load addresses to the
various parts of the program; adjusting the code and data in the program to reflect the
assigned addresses
3. Copy a program from secondary storage into main memory so its ready to run
Revision questions
1. What input devices are used in a computer system
2. Define an assembly language
3. What are the functions of an assembly language?
4. How is linking and loading achieved in a computer system?