home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
genie-commodore-file-library
/
C64Demos
/
RPL&UNO.SDA
/
COMPILER
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
4KB
|
152 lines
0 REM RPL PROGRAM COMPILER (C)1989
5 OPEN15,8,15:INPUT#15,A$:CLOSE15
10 REM * TITLE SCREEN *
15 POKE53280,12:POKE53281,12
20 PRINT "[147][144] RASTER PROGRAMMING LANGUAGE V1.0"
25 PRINT " PROGRAM COMPILER (C)1989 BY SHAWN ORT"
30 REM * SET UP VARIABLES *
40 SA = 49475 : REM * MUST BE CHANGED *
50 B = 1 : REM * CURRENT BREAK *
60 POKE 49183,0:POKE49184,0
100 REM * GET FILENAME AND OPEN FILE *
110 PRINT "ENTER THE NAME OF THE FILE YOU WISH"
115 PRINT "TO COMPILE."
120 PRINT "ENTER [155]@[144] TO RETURN TO THE MAIN MENU."
130 F$="":PRINT:OPEN1,0:INPUT#1,F$:CLOSE1:IF F$ = ""THEN 20
135 IF F$ = "@" THENCLR:LOAD"RPL.BOOT",8:END
140 PRINT:PRINT "LOADING..."
150 OPEN2,8,2,F$+".S,S,R"
160 INPUT#2,TL
170 DIM L$(TL)
180 FORX=1TOTL:INPUT#2,L$(X):NEXTX
190 CLOSE2:IFST<>64 THEN CLR:RUN
200 PRINT""
210 FOR X = 1 TO TL
220 PRINT "[145]COMPILING LINE: ";X
230 A$ = L$(X): AS = SA
240 IF LEFT$(A$,1) = "*" THEN 360
250 AA$ = LEFT$(A$,8)
260 IF AA$ = "INCREASE" THEN GOSUB 2000
270 IF AA$ = "DECREASE" THEN GOSUB 2100
280 IF MID$(A$,13,2)<>"AT"AND LEFT$(A$,5)="STORE"THEN GOSUB 2200
290 IF LEFT$(A$,3) = "SYS" THEN GOSUB 2300
300 IF MID$(A$,11,4) = "WITH" AND LEN(A$) < 19 THEN GOSUB 2400
310 IF MID$(A$,11,4) = "WITH" AND LEN(A$) = 20 THEN GOSUB 2500
320 IF MID$(A$,13,2) = "AT" THEN GOSUB 2700
330 IF A$ = "END" THEN GOSUB 3100:GOTO380
340 IF LEFT$(A$,5) = "BREAK" THEN GOSUB 2800
350 IF SA = AS THEN PRINT "UNRECOGNIZED COMMAND IN LINE:";X;""
360 NEXTX
370 GOSUB 3100
380 PRINT "COMPILING DONE."
390 PRINT "PROGRAM SIZE -";SA-49152;" BYTES."
400 PRINT "ENTER THE NAME UNDER WHICH YOU WISH TO SAVE YOUR COMPILED PROGRAM"
420 PRINT:OPEN1,0:INPUT#1,F$:CLOSE1:IFF$=""THEN420
440 PRINT:PRINT "SAVING..."
445 OPEN15,8,15,"I0":CLOSE15
450 SYS57812F$,8,1
460 POKE193,0:POKE194,192
470 A=SA+1:GOSUB3000
480 POKE174,LO:POKE175,HI
485 CLR
490 SYS 62957
500 PRINT "PROGRAM SAVED."
510 PRINT "PRESS ANY KEY TO CONTINUE."
520 GETA$:IFA$=""THEN520
530 RUN
2000 REM * INCREASE $$$$$
2010 A = VAL(MID$(A$,9,LEN(A$)))
2020 POKE SA,238:SA = SA + 1
2030 GOSUB 3000
2040 POKE SA,LO:SA = SA + 1
2050 POKE SA,HI:SA = SA + 1
2060 RETURN
2100 REM * DECREASE $$$$$
2110 A = VAL(MID$(A$,9,LEN(A$)))
2120 POKE SA,206:SA = SA + 1
2130 GOSUB 3000
2140 POKE SA,LO:SA = SA + 1
2150 POKE SA,HI:SA = SA + 1
2160 RETURN
2200 REM * STORE ### AT $$$$$
2210 POKE SA,169:SA = SA + 1
2220 A = VAL(MID$(A$,7,3))
2230 POKE SA,A:SA = SA + 1
2240 POKE SA,141:SA = SA + 1
2250 A = VAL(MID$(A$,13,LEN(A$)))
2260 GOSUB 3000
2270 POKE SA,LO:SA = SA + 1
2280 POKE SA,HI:SA = SA + 1
2290 RETURN
2300 REM * SYS $$$$$
2310 A = VAL(MID$(A$,4,LEN(A$)))
2320 POKE SA,32:SA = SA + 1
2330 GOSUB 3000
2340 POKE SA,LO:SA = SA + 1
2350 POKE SA,HI:SA = SA + 1
2360 RETURN
2400 REM * AND $$$$$ WITH ###
2410 A = VAL(MID$(A$,5,5))
2420 GOSUB 3000
2430 POKE SA,173:SA = SA + 1
2440 POKE SA,LO:SA = SA + 1
2450 POKE SA,HI:SA = SA + 1
2460 POKE SA,41:SA = SA + 1
2470 POKE SA,VAL(MID$(A$,16,LEN(A$))):SA = SA + 1
2480 POKE SA,141:SA = SA + 1
2485 POKE SA,LO:SA = SA + 1
2490 POKE SA,HI:SA = SA + 1
2495 RETURN
2500 REM * AND $$$$$ WITH $$$$$
2510 A = VAL(MID$(A$,5,5))
2520 GOSUB 3000
2530 POKE SA,173:SA = SA + 1
2540 POKE SA,LO:SA = SA + 1
2550 POKE SA,HI:SA = SA + 1
2560 POKE SA,45:SA = SA + 1
2570 A = VAL(MID$(A$,16,LEN(A$)))
2580 GOSUB 3000
2585 POKE SA,LO:SA = SA + 1
2590 POKE SA,HI:SA = SA + 1
2600 POKE SA,141:SA = SA + 1
2610 A = VAL(MID$(A$,5,5))
2620 GOSUB 3000
2630 POKE SA,LO:SA = SA + 1
2640 POKE SA,HI:SA = SA + 1
2650 RETURN
2700 REM * STORE $$$$$ AT $$$$$
2710 A = VAL(MID$(A$,7,5))
2720 GOSUB 3000
2730 POKE SA,173:SA = SA + 1
2740 POKE SA,LO:SA = SA + 1
2750 POKE SA,HI:SA = SA + 1
2760 A = VAL(MID$(A$,16,5))
2770 GOSUB 3000
2780 POKE SA,141:SA = SA + 1
2785 POKE SA,LO:SA = SA + 1
2790 POKE SA,HI:SA = SA + 1
2795 RETURN
2800 REM * BREAK AT ###
2810 REM * END LAST BREAK
2820 POKE SA,76:SA = SA + 1
2830 POKE SA,20:SA = SA + 1
2840 POKE SA,193:SA = SA + 1
2850 POKE 49184,PEEK(49184)+1
2860 A = VAL(MID$(A$,9,LEN(A$)))
2870 POKE 49184+B,A
2880 A = SA:GOSUB 3000
2890 POKE 49366 + (B*3),LO
2900 POKE 49367 + (B*3),HI
2910 B = B + 1
2920 RETURN
3000 REM * RETURN HI AND LO BYTES OF
3010 REM * LOCATION FOUND IN 'A'
3020 HI=INT(A/256)
3030 LO=A-(HI*256)
3040 RETURN
3100 REM * END
3110 POKE SA,76:SA = SA + 1
3120 POKE SA,180:SA = SA + 1
3130 POKE SA,192:SA = SA + 1
3140 RETURN