Apple Color Plotter: Business BASIC Chart Maker III (1 of 5)

Apple Color Plotter: Business BASIC Chart Maker III (1 of 5)

Following is the Business BASIC source code for an Apple Color Plotter
demonstration program named "Chart Maker III".  Chart Maker III allows you to
creates charts and signs that may be plotted.  To get started: just startup
your system off your Business BASIC diskette, EXEC this file, then save this
program to disk.  The sample file created by Chart Maker named
"C.DESCRIPTION" should be saved as a text file.
 
10 ON ERR GOTO 91
20 DIM txt$(10),center$(10),dent(10),size(10),bold$(10):
   DIM color(10),sl$(10)
30 GOSUB 7300
35 plr$=".RS232"
40 UCA=128:LCA=UCA+32:APPLE$=CHR$(127)
50 GOTO 1000
51 P1=E1*PI/180:P2=E2*PI/180:FOR phi=(p1-dphi) TO p2 STEP
dphi:GOSUB 55:xp=x:yp=y:GOSUB 51111:NEXT
52 IF i<>gr2 THEN PERFORM moveto(%x0,%y0):
   PERFORM lineto(%x,%y)
53 RETURN
55 xp=INT(x0)+((rad*COS(phi))):
   yp=INT(y0)+((rad*SIN(phi))):RETURN
56 XP=INT((XLEFT+(XINCREMENT/2))):
   PERFORM dotat(%xp,%yp):
   KOL=1:FOR K=GC1+1 TO GC2:KOL=KOL+1:
   XP=INT((KOL*XINCREMENT)+(XLEFT-(XINCREMENT/2))):
   PERFORM dotat(%xp,%yp):NEXT:RETURN
58 PERFORM moveto(%xp,%yp):RETURN
59 PERFORM lineto(%xp,%yp):RETURN
65 COLOR15,0:IF CMO%=0 THEN COLOR4,0
66 RETURN
69 GOSUB 65:M$=BOT$:PV=23:GOSUB 350:RETURN
70 WINDOW 2,2 TO 79,13:GOSUB 90:RETURN
71 WINDOW 2,15 TO 79,15:GOSUB 90:pv=15:RETURN
72 WINDOW 2,17 TO 79,23:GOSUB 90:M$=BOT$:pv=23:GOSUB 350:RETURN
73 WINDOW 2,17 TO 79,23:GOSUB 90:RETURN
75 PV=18:GOSUB 80:GOSUB 350:RETURN
76 PV=21:GOSUB 80:GOSUB 350:RETURN
77 WINDOW 2,18 TO 79,23:GOSUB 90:RETURN
80 WINDOW 2,PV TO 79,PV:GOSUB 90:RETURN
81 WINDOW PH,PV TO 79,PV:GOSUB 90:RETURN
82 WINDOW PH,PV TO 79,PV:GOSUB 90:RETURN
83 WINDOW 2,22 TO 79,22:GOSUB 90:RETURN
84 WINDOW 2,21 TO 79,23:GOSUB 90:RETURN
85 WINDOW 2,23 TO 79,23:GOSUB 90:RETURN
86 WINDOW 2,19 TO 79,23:GOSUB 90:RETURN
87 WINDOW 2,23 TO 79,2:GOSUB 90:RETURN
88 GOSUB 85:RETURN
89 Z=1:GOSUB 86:GOSUB 84:RETURN
90 HOME:WINDOW 1,1 TO 80,24:RETURN
91 REM
97 TEXT:HOME:
   PRINT"Apple Business BASIC -- Type 'RUN HELLO' to Restart":
   PRINT"or, 'GOTO 50' to Restart with Last Chart.":END
98 PRINT ERR, ERRLIN:END
99 VPOS=PV:HPOS=PH:RETURN
101 b$=""
102 phh=ph:i=1:a$="":GOSUB 190
103 HPOS=phh+i-1:PRINT CHR$(5);:GET a$:PRINT CHR$(6);:
    chra=ASC(a$)
104 IF chra=8 AND i>1 THEN i=i-1:GOTO 103
105 IF chra=21 AND i<=LEN(b$) THEN i=i+1:GOTO 103
106 IF chra=127 OR chra=136 OR chra=92
    THEN IF i>1 THEN b$=MID$(b$,1,i-2)+MID$(b$,i):
    GOSUB 190:i=i-1:GOTO 103:ELSE GOTO 103
107 IF(chra=201 OR chra=233) AND LEN(b$)<=sl
    THEN b$=MID$(b$,1,i-1)+" "+MID$(b$,i):
    GOSUB 190:GOTO 103
108 IF chra=13 THEN RETURN
109 IF chra=27 THEN RETURN
110 IF chra<32 OR chra>127 THEN PRINT CHR$(7);:GOTO 103
112 b$=MID$(b$,1,i-1)+a$+MID$(b$,i+1):IF i<sl THEN i=i+1
113 PRINT a$;
115 GOTO 103
190 ph=phh:GOSUB 99:
191 PRINT b$;
195 FOR j=LEN(b$)+1 TO sl:PRINT".";:NEXT
199 RETURN
201 X9=0:X8=0:H9=0:GOSUB 101:IF A$=CHR$(27) THEN RETURN:
    ELSE:IF B$="" THEN B$=CONV$(ll):PRINT b$;
202 N$=Z$+B$:FOR H=1 TO LEN(N$)
203 IF LEN(N$)=0 THEN X9=1:RETURN
204 IF ASC(MID$(N$,H,1))=46 THEN H9=H9+1:GOTO 212
205 IF ASC(MID$(N$,H,1))=45 THEN H8=H:GOTO 209
206 IF ASC(MID$(N$,H,1))<48 THEN X9=1:RETURN
207 IF ASC(MID$(N$,H,1))>57 THEN X9=1:RETURN
208 GOTO 212
209 IF H8=1 THEN 212
210 X9=1:RETURN
212 NEXT
213 X8=VAL(N$)
214 IF X8>UL THEN X9=1:RETURN
215 IF X8<LL THEN X9=1:RETURN
216 X9=2:RETURN
345 GOSUB 99:PRINT"";:RETURN
350 PH=INT(40-(LEN(M$)/2)):GOSUB 99:PRINT M$;:RETURN:
    REM print centered line
351 GOSUB 82:RETURN:REM clear a line
352 GOSUB 99:PRINT M$;:RETURN
353 PH=INT(40-(LEN(M$)/2)):GOSUB 99:PRINT M$;:RETURN:
    REM print centered linehigh
354 PV=15:PH=3:GOSUB 345:PH=5:GOSUB 99:PRINT M$;:RETURN:REM cmd
355 HOLD=PH:PH=2:GOSUB 345:PH=HOLD:RETURN
356 PH=HOLD:PV=16:GOSUB 99:PRINT"?";:RETURN
357 PV=15:PH=INT(40-(LEN(M$)/2)):GOSUB 99:
    PRINT M$;:NORMAL:RETURN:REM print centered line
358 PV=15:PH=2:GOSUB 99:PRINT" ";:RETURN
359 PV=15:PH=3:GOSUB 345:RETURN

Back