Sharp PC-1500 : ABC mini-compiler

"ABC mini-compiler" for Sharp PC-1500 +4,8,16 KB or PC-1500A.
Author: D. Papadopoulos.

Download zipped manual and program code (2.6 MB)

ABC is a programming language – compiler, with 12 forms of commands (10 executable and 2 non executable). I firstly created it at 1985 (ver 1.0 with 7 commands). The strange thing about it is that it is implemented by the BASIC interpreter of SHARP PC-1500A !

Installation:
Enter the program.
After that you have to RUN the program to initiate it.
And then type the program and go on as mentioned in page 4 (Implementation - graph)

Requirements:
I have run all these in a SHARP PC1500A + 16KB expansion RAM. But I once tested it in a SHARP PC1500 + 4KB expansion RAM and it was OK.

Errors:
There is a disadvantage in error finding since it needs much time.
You must be very careful in typing. But if you get in an endless loop or if you generally can not stop the program then just reset it, and look at the BASIC program before. If it is OK you can continue working. If not then type new 0 and load the program from tape again.

Conclusion:
Finally, I have all these done just for fun and for all of the great programmers of SHARP PC1500 / A.
If you have any problems or recommendations I would be glad to hear and help.
E-mail me at: greektakis/at/gmail.com
Have fun
Dimitris Papadopoulos
Trikala, Greece


BASIC program.

10:DIM P$(50)*10,LA$(10)*1,LA(10),V(4),L$(0)*26,V$(26)*1,LV(26)
50:GOSUB "ROM"
90:L$(0)="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
110:FOR I=0TO 25:V$(I+1)=MID$ (L$(0),I+1,1):LV(I+1)=8*I:NEXT I
150:END
200:"V":N=0
210:CLS :WAIT 0:PRINT N;"";:INPUT P$(N):IF P$(N)=" END"OR N=50END
250:N=N+1:GOTO 210
300:"B":M=0:WAIT 0:PRINT "List"
310:IF INKEY$ ="P"AND M>0LET M=M-1:GOSUB 390:GOTO 310
320:IF INKEY$ ="L"AND M 330:IF INKEY$ ="Q"END
340:IF INKEY$ ="D"INPUT P$(M):IF P$(M)=" END"OR M>49END
350:GOTO 310
390:PRINT USING "####";M;P$(M):RETURN
800:"C":P=&40C5:J=0:WAIT 0
900:W=P:FOR I=0TO N-1
910:P$=P$(I):Z$=LEFT$ (P$,1):Y$=MID$ (P$,3,1)
920:IF Z$="&"GOTO 990
930:Q=3*(Y$="O")+33*(Y$="F")+1*(Y$="E")+(Y$="T")+3*(Y$="S")
940:Q=Q+(Y$="=")*(23*(LEN P$=4)+29*(LEN P$=6))
944:Q=Q+(Y$="L")*3+(MID$ (P$,2,1)="W")*7+(Y$="R")*7
950:IF Z$<>" "LET J=J+1:LA$(J)=Z$:LA(J)=W
960:W=W+Q
990:NEXT I:PRINT W-P;" Bytes. Lines:";:IF W>19900STOP
1010:FOR I=0TO N:CURSOR 17:PRINT USING ;I;" /";N:P$=P$(I)
1020:Z$=LEFT$ (P$,1):IF Z$="&"GOTO 2000
1030:D=LEN P$
1040:IF MID$ (P$,3,1)="="AND D=4GOSUB "=4":GOTO 2000
1050:IF MID$ (P$,3,1)="="AND D=6GOSUB "=6":GOTO 2000
1060:IF MID$ (P$,2,2)="GO"AND D=4GOSUB "GO":GOTO 2000
1070:IF MID$ (P$,2,2)="IF"AND D=9GOSUB "IF":GOTO 2000
1080:IF MID$ (P$,2,4)="STOP"AND D=5GOSUB "STOP":GOTO 2000
1090:IF MID$ (P$,2,3)="RET"AND D=4GOSUB "STOP":GOTO 2000
1095:IF MID$ (P$,2,3)="CLS"AND D=4GOSUB "CLS":GOTO 2000
1097:IF MID$ (P$,2,2)="WE"AND D=3GOSUB "WE":GOTO 2000
1098:IF MID$ (P$,2,2)="PR"AND D=4GOSUB "PR":GOTO 2000
1100:IF MID$ (P$,2,2)="GS"AND D=4GOSUB "GO":GOTO 2000
1110:IF MID$ (P$,2,3)="END"AND D=4END
1500:END
2000:NEXT I:END
3000:"=4":X=0:Y=0:Y$=MID$ (P$,4,1):X$=MID$ (P$,2,1)
3050:FOR K=1TO 26
3100:IF V$(K)=X$LET X=LV(K)
3110:IF V$(K)=Y$LET Y=LV(K)
3200:NEXT K
3500:POKE P,&B5,&79,&AE,&38,&D2,&B5,X,&AE,&38,&D3,&B5,&79,AE,&38,&D0,&B5,Y
3510:POKE P+17,&AE,&38,&D1,&BE,&3A,&98
3600:P=P+23:RETURN
4000:"=6":X=0:Y=0:Z=0:X$=MID$ (P$,2,1):Y$=MID$ (P$,4,1):Z$=MID$ (P$,6,1)
4010:W$=MID$ (P$,5,1)
4200:FOR K=1TO 26
4210:IF V$(K)=X$LET X=LV(K)
4220:IF V$(K)=Y$LET Y=LV(K)
4230:IF V$(K)=Z$LET Z=LV(K)
4300:NEXT K
4400:IF W$="+"LET F=&3A,G=&BA
4401:IF W$="-"LET F=&3A,G=&F3
4402:IF W$="*"LET F=&3A,G=&FD
4403:IF W$="/"LET F=&3B,G=&07
4404:IF W$="?"LET F=&3B,G=&11:REM "?" IS THE SYMBOL OF SQUARE ROOT NOT ?
4405:IF W$="I"LET F=&3B,G=&1B
4500:POKE P,&B5,&79,&AE,&38,&D0,&AE,&38,&D2,&AE,&38,&D4
4510:POKE P+11,&B5,Z,&AE,&38,&D1,&B5,Y,&AE,&38,&D3,&B5,X,&AE,&38,&D5,&BE,F,G
4600:P=P+29:RETURN
5000:"GO":X=0:X$=RIGHT$ (P$,1)
5010:FOR H=1TO J
5020:IF LA$(H)=X$LET X=LA(H)
5040:NEXT H:IF X=0CLS :WAIT :PRINT "Label not found: ";X$:END
5100:Q=X:GOSUB "N"
5150:U=&BA*(P$="GO")+&BE*(P$="GS")
5200:POKE P,U,Y,Z
5600:P=P+3:RETURN
6000:"IF":F=0:G=0:W=0
6010:X$=MID$ (P$,4,1):Y$=MID$ (P$,6,1):Z$=MID$ (P$,5,1):W$=RIGHT$ (P$,1)
6050:FOR K=1TO 26
6060:IF V$(K)=X$LET F=LV(K)
6070:IF V$(K)=Y$LET G=LV(K)
6100:NEXT K
6200:IF Z$="="LET ZZ=4
6210:IF Z$="<"LET ZZ=1
6220:IF Z$=">"LET ZZ=2
6230:IF Z$="#"LET ZZ=0
6240:IF Z$="("LET ZZ=5
6250:IF Z$=")"LET ZZ=6
6300:FOR H=1TO J
6310:IF LA$(H)=W$LET W=LA(H)
6320:NEXT H:IF W=0CLS :WAIT :PRINT "Label not found: ";W$:END
6400:Q=W:GOSUB "N"
6500:POKE P,&B5,&79,&AE,&38,&D0,&AE,&38,&D2,&B5,F,&AE,&38,&D3,&B5,G,&AE,&38,&D1
6510:POKE P+18,&BE,&3A,&C4,&B5,ZZ,&B5,&D0,&D2,&89,2,&8E,3,&BA,Y,Z
6600:P=P+33:RETURN
7100:"CLS"
7110:POKE P,&BE,&3B,&27
7120:P=P+3
7130:RETURN
7200:"WE"
7210:POKE P,&BE,&E4,&2C,&B7,&0D,&99,&07
7220:P=P+7
7230:RETURN
7300:"PR"
7310:X=0:X$=MID$ (P$,4,1)
7320:FOR K=1TO 26
7330:IF V$(K)=X$LET X=LV(K)
7340:NEXT K
7350:POKE P,&48,&79,&4A,X,&BE,&3B,&37
7360:P=P+7
7370:RETURN
9000:"STOP":POKE P,&9A:P=P+1:RETURN
10000:"Z":BEEP 1,50,5:CALL 16581:BEEP 1,100,5:END
20000:"ROM"
21010:POKE &3A98,&A5,&38,&D0,&08,&A5,&38,&D1,&0A,&A5,&38,&D2,&18,&A5,&38,&D3,&1A
21020:POKE &3A98+16,&BE,&3A,&AC,&9A
21100:REM 8*TIN
21110:POKE &3AAC,&F5,&F5,&F5,&F5,&F5,&F5,&F5,&F5,&9A
22000:REM =6
22010:POKE &3ABA,&BE,&3A,&C4,&BE,&EF,&BA,&BE,&3A,&E3,&9A
22100:REM ---
22200:POKE &3AC4,&A5,&38,&D0,&08,&A5,&38,&D1,&0A,&58,&7A,&5A,&10,&BE,&3A,&AC
22210:POKE &3AC4+15,&A5,&38,&D2,&08,&A5,&38,&D3,&0A,&58,&7A,&5A,&00,&BE,&3A,&AC,&9A
22300:POKE &3AE3,&A5,&38,&D4,&18,&A5,&38,&D5,&1A,&48,&7A,&4A,&00,&BE,&3A,&AC,&9A
22400:POKE &3AF3,&BE,&3A,&C4,&BE,&EF,&B6,&BE,&3A,&E3,&9A
22500:POKE &3AFD,&BE,&3A,&C4,&BE,&F0,&1A,&BE,&3A,&E3,&9A
22600:POKE &3B07,&BE,&3A,&C4,&BE,&F0,&84,&BE,&3A,&E3,&9A
22700:POKE &3B11,&BE,&3A,&C4,&BE,&F0,&E9,&BE,&3A,&E3,&9A
22800:POKE &3B1B,&BE,&3A,&C4,&BE,&F5,&BE,&BE,&3A,&E3,&9A
22900:POKE &3B27,&68,&78,&6A,&4D,&FD,&62,&B5,&00,&2E,&88,&05,&6C,&77,&93,&0D,&9A
23000:"PRINTS a var
23010:POKE &3B37,&58,&7A,&5A,&00,&BE,&3A,&AC,&B5,&10,&AE,&78,&94,&BE,&D9,&CF,&A5
23020:POKE &3B47,&7A,&05,&08,&A5,&7A,&06,&0A,&A5,&7A,&07,&2A,&62,&B5,&9C,&FB,&B1
23030:POKE &3B57,&06,&88,&05,&AE,&78,&75,&FD,&6A,&A5,&7A,&07,&BE,&ED,&00,&9A
30000:RETURN
35000:"N":V=0
35010:V=V+1:R=Q:Q=INT (Q/16):R=R-Q*16:V(V)=R:IF Q>0THEN 35010
35020:Y=V(3)+16*V(4):Z=V(1)+16*V(2):RETURN


Return to the main page