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 0200 0202 0204 | label here |
operator LDA ADC JMP | operand FF 01 |
label
here
|
opcode A9 FF 69 01 4C 00 02 |
Labels can be used instead of numbers, as a temporary measure, and replaced by the number later. |