HF Low Level Programming (Half)
HF Low Level Programming (Half)
Pep/8’s
FFFE
FFFF
Pep/8 Registers & Status Bits
◦ The program counter (PC) (contains the address
of the next instruction to be executed)
◦ The instruction register (IR)
(contains a copy of the instruction being
executed)
◦ The accumulator (A register)
◦ Status bit N (1 if register A is negative; 0
otherwise)
◦ Status bit Z (1 if the register A is 0; and 0
otherwise)
The memory unit is made up of 65 536 (164) bytes
` Specify the OPERATION required e.g.
◦ STOP the program
◦ ADD values
◦ STORE a value in memory
◦ FIND something in memory
` Specify WHERE the action is to take place e.g.
◦ Which register
` Specify WHERE the value is to be found or
stored in memory…or specify the value itself.
WHAT to do
WHERE or WHAT it is
WHAT to do
WHERE or WHAT it is
Operation code
Specifies which instruction is to be carried
out
Register specifier
Specifies which register is to be used (we
only use A)
Addressing-mode specifier
Says how to interpret the operand part of the
instruction
0 0 0
0 0 1
0000
1100
1110
0111
1000
01001
01010
0000 STOP EXECUTION 0 0 0 0 0 0 0 0
Operand specifier: 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
What happens?
` Direct addressing case:
Instruction specifier: 1 1 0 0 0 0 0 1
Operand specifier: 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1
0 1 1 1 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0000
1100
What do these 1110
0111
Instructions do? 1000
01001
01010
1 1 1 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
0000
1100
What do these 1110
0111
Instructions do? 1000
01001
01010
0 1 0 0 1 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
0 1 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
0 1 0 0 1 0 0 1
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
A Program to 0000
ask for 1100
1110
Help! 0111
1000
01001
01010
0 1 0 1 0 0 0 0 50
0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 00 48
0 1 0 1 0 0 0 0
50
0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 00 65
0 1 0 1 0 0 0 0 50
0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 00 6C
0 1 0 1 0 0 0 0 50
0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 00 48
0 1 0 1 0 0 0 0 50
0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 00 65
0 1 0 1 0 0 0 0 50
0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 00 6C
0 1 0 1 0 0 0 0 50
0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 1 00 70
0 1 0 1 0 0 0 0
50
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 00 21
0 0 0 0 0 0 0 0 00
Pep/8 Simulator
A program that behaves just like the Pep/8 virtual
machine behaves
To run a program
Enter the hexadecimal code, byte by byte with blanks
between each
Terminate by inserting zz
` http://code.google.com/p/pep8-1/
` Pep813Win.zip
1 1 0 0 0 0 0 0 C0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 00
0 0 1 1 0 0 0 1
31
0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 00 12
0 1 1 1 0 0 0 1 71
0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 00 12
1 1 0 0 0 0 0 0 C0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 00
0 0 1 1 0 0 0 1 31
0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 00 12
0 1 1 1 0 0 0 1 71
0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 00 12
0 0 1 1 0 0 0 1 31
0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 00 14
0 1 1 1 0 0 0 1 71
0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 00 14
1 1 1 0 0 0 0 1 E1
0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 00 16
0 0 1 1 1 0 0 1 39
0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 00 16
0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 C0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 00
0 0 1 1 0 0 0 1 31
0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 00 30
0 1 1 1 0 0 0 1 71
0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 00 30
0 0 1 1 0 0 0 1 31
0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 00 38
0 1 1 1 0 0 0 1 71
0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 00 38
1 1 1 0 0 0 0 1 E1
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 00 40
0 0 1 1 1 0 0 1 39
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 00 40
0 0 0 0 0 0 0 0