INSTRUCTIONS AND PROGRAMS
CLICK HERE TO BUY THE CD

 
Instructions are represented by binary numbers called operational codes, or OPCODES.
They are frequently written in hexadecimal.

Different cpu's have different instructions.

To make them easier to remember they are given names called mnemonics.

Examples are

ADD     add to the contents of the accumulator.
STA      store the contents of the accumulator.
LDA      load into the accumulator.
TAX      transfer the contents of the accumulator to register X.

A program is a list of instructions, usually written using mnemonics.

Here is the sequence of events for writing programs.

Define the problem.
Produce an algorithm (a list of instructions, written in everyday language).
Produce a flow chart.
Write the program using mnemonics.
Assemble into hex opcodes. (an assembler is a program which does this).
Test by running the program.
DEBUG IT !!
 

Below is a short program

address            label       operator          operand        label          opcode
0200                 here          LDA                 FF                                A9   FF
0202                                  ADC                 01                                69   01
0204                                  JMP                                    here          4C   00   02
 

Labels can be used instead of numbers, as a temporary measure, and replaced by the number later.
 


Copyright Graham Knott 1999