10     GOSUB 10000
20    D=030H :  GOSUB 9000
30     GOSUB 10000
40    D=030H :  GOSUB 9000
50     GOSUB 10000
60    D=030H :  GOSUB 9000
70     GOSUB 9400
80    D=038H :  GOSUB 9000
90     GOSUB 9400
100   D=08H :  GOSUB 9000
110    GOSUB 9400
120   D=0CH :  GOSUB 9000
130    GOSUB 9400
140   D=06H :  GOSUB 9000
150    GOSUB 9400
160   D=01H :  GOSUB 9000
170    GOSUB 9400
180   C=GET
190    IF C=0 GOTO 180
200    IF C<>27 THEN D=C :  GOSUB 9200 :  GOSUB 9400 :  GOTO 180
210    PRINT "select one of the following possibilities:"
220    PRINT "1 = issue a command         a = cur. home"
230    PRINT "2 = set address counter     b = cur. on"
240    PRINT "3 = read the cursor address c = cur. blink"
250    PRINT "4 = read data               d = cur. off "
260    PRINT "5 = clear the display"
270    PRINT "6 = write special character"
290    REM hier wat ruimte voor uitbreiding
300   K=GET :  IF K=0 GOTO 300
305    IF K=ASC(1) GOTO 400
310    IF K=ASC(2) GOTO 500
315    IF K=ASC(3) GOTO 600
320    IF K=ASC(4) GOTO 1200
325    IF K=ASC(5) GOTO 1100
330    IF K=ASC(6) GOTO 1300
335    IF K=061H GOTO 700
340    IF K=062H GOTO 800
345    IF K=063H GOTO 900
350    IF K=064H GOTO 1000
390    GOTO 180
400    INPUT "enter the command in decmal or HEX (0xxH) format ",D
410    GOSUB 9000 :  GOSUB 9400 :  GOTO 180
500    INPUT "enter  address 0 < adr < 128 ",D
510   D=D.AND.07FH : D=D.OR.080H :  GOSUB 9000 :  GOSUB 9400 :  GOTO 180
600    GOSUB 9100 : D=D.AND.07FH
610    PRINT "cursor address: ",D
620    GOTO 180
700   D=02H :  GOSUB 9000 :  GOSUB 9400 :  GOTO 180
800   D=0EH :  GOSUB 9000 :  GOSUB 9400 :  GOTO 180
900   D=0FH :  GOSUB 9000 :  GOSUB 9400 :  GOTO 180
1000  D=0CH :  GOSUB 9000 :  GOSUB 9400 :  GOTO 180
1100  D=01H :  GOSUB 9000 :  GOSUB 9400 :  GOTO 180
1200   GOSUB 9300 : S=D :  GOSUB 9400
1210   PH0. "data on this location: ",S," /  ",CHR(S)
1220   GOTO 180
1300   INPUT "enter the data in hex format: ",D
1310   GOSUB 9200 :  GOSUB 9400 :  GOTO 180
9000   REM schrijf een opdracht
9010  RDSFR(0B0H)X : X=X.AND.0CFH : WRSFR(0B0H)X
9020  RDSFR(0B0H)X : X=X.OR.04H : WRSFR(0B0H)X
9030  PORT1=D
9040  RDSFR(0B0H)X : X=X.AND.0FBH : WRSFR(0B0H)X
9050  RDSFR(0B0H)X : X=X.OR.04H : WRSFR(0B0H)X
9060   RETURN 
9100   REM lees een opdracht
9110  RDSFR(0B0H)X : X=X.AND.0DFH : WRSFR(0B0H)X
9120  RDSFR(0B0H)X : X=X.OR.014H : WRSFR(0B0H)X
9130  RDSFR(0B0H)X : X=X.AND.0FBH : WRSFR(0B0H)X
9140  D=PORT1
9150  RDSFR(0B0H)X : X=X.OR.04H : WRSFR(0B0H)X
9160   RETURN 
9200   REM schrijf data
9210  RDSFR(0B0H)X : X=X.AND.0EFH : WRSFR(0B0H)X
9220  RDSFR(0B0H)X : X=X.OR.024H : WRSFR(0B0H)X
9230  PORT1=D
9240  RDSFR(0B0H)X : X=X.AND.0FBH : WRSFR(0B0H)X
9250  RDSFR(0B0H)X : X=X.OR.04H : WRSFR(0B0H)X
9260   RETURN 
9300   REM lees data
9310  RDSFR(0B0H)X : X=X.OR.034H : WRSFR(0B0H)X
9320  RDSFR(0B0H)X : X=X.AND.0FBH : WRSFR(0B0H)X
9330  D=PORT1
9340  RDSFR(0B0H)X : X=X.OR.04H : WRSFR(0B0H)X
9350   RETURN 
9400   GOSUB 9100
9405  A=D.AND.07FH
9410  D=D.AND.080H
9420   IF D=0 THEN  RETURN 
9430   PRINT "LCD is busy !"
9440   GOTO 9400
10000  FOR I=1 TO 10 :  NEXT I
10010  RETURN 
