User manual
36
Address
Command
Data
Comment
03
7
7
A = A And B
04
5
4
Port = A
05
3
5
Jump –5
64 51 43 77 54 35
Listing 20:Application of the AND function
Change the programme and test other logical functions as well. The OR function (78) can be
used to generally set specific input conditions to 1: 64 51 43 78 54 35
1010 OR
0011 =
1011
Use the XOR function (exclusive-or, 79) to invert individual bits: 64 51 43 79 54 35
1010 XOR
0011 =
1001
17 Subprogrammes
When parts of a programme are to be reused, write them into a subprogramme. This often
saves memory space, and sometimes also a lot of typing. The following example shows use of a
subprogramme that is called in two places in the main programme. The subprogramme only
contains one instruction (A = A-1) and the return jump command here. This does not save
memory, but the example is only meant to demonstrate the CALL and RET commands.
Main programme:
Address
Command
Data
Comment
00
8
0
AdrHi = 0
01
D
8
Call 08
02
5
4
Output
03
2
9
Waiting 1 s
04
D
8
Call 08
05
5
4
Output
06
2
8
Waiting 0.5 s
07
3
7
Jump –7