Title: Programs Data Algorithms
1Programs Data Algorithms
2Z80 Assembly Language Programming
Requires knowledge of 1. Z80 Instruction Set 2.
Z80 Addressing Modes 3. Z80 Register Set 4. Z80
System Memory Map To be discussed later
3Software Development Process 1. Problem
Specification 2. Program Design 3. Program
Coding 4. Debugging 5. Testing 6.
Documentation 7. Maintenance and Redesign
4Problem Specification (definition) The nature of
a problem to which a solution is being sought
must be clearly defined. Produce a program
requirements specification 1. State precisely
what functions the program perform. 2. List exact
numbers of inputs and outputs required 3. State
any constraints regarding speed of operation,
accuracy, memory requirements etc. 4.action to
take if errors occur.
5Program Design Program Design is the outline of
the computer program which will perform the tasks
that have been defined. Tasks to be performed are
described in that can easily be transformed into
a computer programming language using techniques
such Algorithms, Flowchart, Pseudo Code, Top
Down Design, Structured Programming, Structure
Charts.
6Coding Coding or writing the program in a form
that the computer can directly use or
translate. The form may be machine code, assembly
lang. Or a high level language (C). Encoding
the program design using the Z80 Instructions.
7Debugging Refers to tracking down and elimination
of errors (bugs) in the program. For machine
code and assembly language programs techniques
such as trace-tables and breakpoints will be
used. Z80 Simulators S/W tools will also be used.
8Testing Test specification derive from program
specification and program design. Methodical
test procedure to ensure the program does what is
supposed to do. Checking Register values and
Memory Locations, Pre-loading Memory, Single
Stepping, Recording Results.
9Documentation This will include the problem
definition and details of the program design aid
used. (Algorithm, Flowchart, Pseudo-code,
Structure Chart etc.) Coding Sheets, Details of
test Results and a users guide (if appropriate
should be included).
10Maintenance Maintenance and redesign refer to
servicing, improvement or upgrading and extension
of the program (NT SP5) May include new
requirements
11Algorithms Consists of a sequence of actions
which define a method of solving a particular
problem. It is of course possible to have more
than one solution and algorithm
12Flowcharts A graphical description of a program
or system. A Flowchart consists of graphical
symbols connected together by straight lines
which indicate sequence of operation or flow of
data
Decision
Input/Output
Process
13Flowcharts do not show structure of the
program Approach to Program Design Top Down
Design - Break problem into a series of smaller
sub-problems. Further decompose
these sub-problems until implementation
becomes straight forward. This hierarchy reflects
the program Structure. Make use of Structure
Programming.
14Structured Programming (SP) Structured
programming is a S/W design method consisting of
a basic set of principles and techniques that
enables correct programs to be produced. Several
methods of SP exists (JSP) All are based on two
fundamental principles 1. Stepwise refinement
(Top down design) 2. Three basic program control
constructs
15Three Control Constructs are. All programs
are made up from these 1.Sequence 2. Selection
(Choice /Decision) 3. Repetition (Iteration /
Loop)
16Z80 Assembly Language Format LABEL OPCODE OPERAND
S COMMENT ORG 1800H START LD HL,1850H
HL lt 1850
17Software Coding Sheet Use to write machine
code / assembly lang. Programs.
18Problem (Use Program Coding Sheet) The number 04H
is stored at location 1850H Using the instruction
CPL , complement the accumulator which obtains a
1s complement of the number in the
accumulator.Obtain the 2s complement of the
number and store the result at location
1852H. Your program should start at address
1800H Use pages 57 through 61 for reference
19Pseudo Code 1. LD accumulator with contents of
1850 2. Complement the accumulator 3. Add one to
the accumulator 2s complement 1s
complement 1 4. Store the result at address
1852 5. Stop program
20 This is only one solution