mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-12-04 11:49:51 +00:00
229 lines
9.5 KiB
Plaintext
229 lines
9.5 KiB
Plaintext
0 rem VECTOR FONT by Golden Child
|
|
1 rem enter a message, it will render the text, hit space to enter a new message
|
|
|
|
2 gosub 10000 : hgr : a$="":for i=32 to 127:a$=a$+chr$(i):next:de$="Apple Soft Basic"
|
|
|
|
10 gosub 5000 : GOSUB 7000
|
|
|
|
15 INPUT "Message?";a$ : if a$="" then a$=de$
|
|
|
|
20 sz=16:xo=5:yo=0:x9=139:y9=80:
|
|
21 rem for sz=2 to 8 step .5:for an=0 to 350 step 15 : REM ? an,an/180*3.1415
|
|
22 for w=0 to 24 : sz=(8-2)*w/24+2 : an=w*360/24
|
|
23 xo=-len(a$)/2*4:xp=-2*4:xo=xp:yo=0:for i=1 to len(a$):
|
|
24 c1= asc(mid$(a$,i,1)) : if (c1>=asc(" ")) and (c1<=127) then c=c1-asc(" ")+1:rem ?C;" ";i;" ";CHR$(C1) : rem ? c1,c
|
|
|
|
25 x2=-999:for pt=1 to l(c,0,0): x1=l(c,pt,1):y1=l(c,pt,2) :rem ? c,pt
|
|
26 a=an/180*3.14159265359:x3=x9+(xo+x1)*sz*cos(a)-(yo+y1)*sz*sin(a):y3=y9-(yo+y1)*sz*cos(a)-(xo+x1)*sz*sin(a):rem ? x1","y1" ("x2","y2")"
|
|
|
|
|
|
28 REM s2=1.75:a2=340/180*3.14:x8=120:y8=120:x5=xo:y5=yo:x6=x8+(x5+x1)*s2*cos(a2)-(y5+y1)*s2*sin(a2):y6=y8-(y5+y1)*s2*cos(a2)-(x5+x1)*s2*sin(a2):rem ? x1","y1" ("x2","y2")"
|
|
|
|
29 rem if (x2<>-999) and (x1<>-999) then hcolor=6: if x6>0 and x6 < 280 and y6>0 and y6<160 and x7>0 and x7<280 and y7>0 and y7<160 then hplot x6,y6 to x7,y7 : rem hplot x1*sz+xo,-(y1*sz)+yo to x2*sz+xo,-(y2*sz)+yo
|
|
35 rem if (x2<>-999) and (x1<>-999) then hcolor=5: if x6>0 and x6 < 280 and y6>0 and y6<160 and x7>0 and x7<280 and y7>0 and y7<160 and x3 < 280 and y3>0 and y3<160 and x4>0 and x4<280 and y4>0 and y4<160 then hplot x3,y3 to x6,y6 : HPLOT x4,y4 to x7,y7
|
|
36 if (x2<>-999) and (x1<>-999) then hcolor=3: if x3>0 and x3 < 280 and y3>0 and y3<160 and x4>0 and x4<280 and y4>0 and y4<160 then s1=x1:s2=y2:s3=x2:s4=y2:x1=x3:x2=x4:y1=y3:y2=y4:co=3:gosub 5100:GOSUB 7100:x1=s1:y2=s2:x2=s3:y2=s4:rem hplot x3,y3 to x4,y4 :
|
|
|
|
37 x7=x6:y7=y6
|
|
38 x2=x1:y2=y1:x4=x3:y4=y3:next: xo=xo+4: if xo > 8*4 OR C=1 then xo=xp:yo=yo-5
|
|
|
|
39 next
|
|
|
|
40 gosub 5500 : GOSUB 7500 : rem ? an
|
|
50 next
|
|
60 rem next
|
|
70 GOSUB 7900
|
|
71 IF PEEK(49152)>128 THEN GOTO 15
|
|
75 PRINT "loop. hit space for new message":GOTO 70
|
|
|
|
99 end
|
|
|
|
|
|
5000 rem init display list : rem SC = screen to draw
|
|
5001 IF NOT (dk) then dim dl(2,100,5) : dk=1
|
|
5002 hgr2:hgr
|
|
5003 SC=0 : DL(0,0,0)=0 : DL(1,0,0)=0 :gosub 5500: rem DL(X,0,0) = NUM OF POINTS
|
|
5004 return
|
|
|
|
5100 rem draw line on other screen
|
|
5110 poke 230,(SC+1) * 32
|
|
5111 if not(x1>=0 and x1 <=279 and x2 >=0 and x2<=279 and y1>=0 and y1 <=159 and y2>=0 and y2<=159) then return
|
|
5120 SP = DL(SC,0,0) + 1 : DL(SC,0,0)=SP : rem ? sp
|
|
5130 DL(SC,SP,0)=CO
|
|
5131 DL(SC,SP,1)=X1
|
|
5132 DL(SC,SP,2)=Y1
|
|
5133 DL(SC,SP,3)=X2
|
|
5134 DL(SC,SP,4)=Y2
|
|
5140 HCOLOR=CO : HPLOT X1,Y1 TO X2,Y2
|
|
5190 RETURN
|
|
|
|
5400 rem erase lines
|
|
5410 for SP = 1 TO DL(SC,0,0) : HCOLOR=0
|
|
5411 HPLOT DL(SC,SP,1),DL(SC,SP,2) TO DL(SC,SP,3),DL(SC,SP,4) : NEXT
|
|
5412 DL(SC,0,0)=0 : rem clear the list after erasing
|
|
5420 RETURN
|
|
|
|
5500 rem swap screens
|
|
5510 SC = NOT SC
|
|
5511 POKE 49236+(NOT SC),0 : rem select visible page that we're not drawing to
|
|
5515 poke 230,32*(sc+1):gosub 5400 : rem switch drawing page and erase lines
|
|
5520 RETURN
|
|
|
|
8032 data 0,0,-998 : rem space
|
|
8033 data 1.5,4,1.5,1.5,-999,1.25,0,1.25,.5,1.75,.5,1.75,0,1.25,0,-998 : rem !
|
|
8034 DATA 1,4,1,3,-999,2,4,2,3,-998 : REM "
|
|
8035 data 1,4,1,0,-999,2,4,2,0,-999,0,1.5,3,1.5,-999,0,2.5,3,2.5,-998: rem #
|
|
8036 data 3,3.5,2.5,4,.5,4,0,3.5,0,2.5,.5,2,2.5,2,3,1.5,3,.5,2.5,0,.5,0,0,.5,-999,1.0,0,1.0,4,-999,2,0,2,4,-998 : rem $
|
|
8037 data 0,0,3,4,-999,0,3,1,3,1,4,0,4,0,3,-999,2,0,2,1,3,1,3,0,2,0,-998 : rem %
|
|
|
|
8038 data 3,2,1.5,0,.5,0,0,1,0,2,1.5,3,1.5,3.5,1,4,.5,4,0,3.5,0,3,3,0,-998 : rem &
|
|
|
|
8039 data 1.5,4,1.5,3,-998 : rem '
|
|
8040 data 2,4,1,3,1,1,2,0,-998 : rem (
|
|
8041 data 1,4,2,3,2,1,1,0,-998 : rem )
|
|
8042 data 1.5,.5,1.5,3.5,-999,0,2,3,2,-999,0,1,3,3,-999,0,3,3,1,-998 : rem *
|
|
8043 data 1.5,.5,1.5,3.5,-999,0,2,3,2,-998 : rem +
|
|
8044 data 1.25,.5,1.25,1,1.75,1,1.75,.5,1.5,0,1,0,1.5,0,1.5,.5,1.25,.5,-998 : rem ,
|
|
8045 data 0,2,3,2,-998 : rem -
|
|
8046 data 1.25,.5,1.25,1,1.75,1,1.75,.5,1.25,.5,-998 : rem .
|
|
8047 data 0,0,3,4,-998 : rem /
|
|
|
|
|
|
8048 DATA 0,0,0,4,3,4,3,0,0,0,3,4,-998 : REM 0
|
|
8049 DATA 3,0,3,4,-998 : REM 1
|
|
8050 DATA 0,4,3,4,3,2,0,2,0,0,3,0,-998 : REM 2
|
|
8051 DATA 0,4,3,4,3,2,0,2,3,2,3,0,0,0,-998 : REM 3
|
|
8052 DATA 0,4,0,2,3,2,3,4,3,0,-998 : REM 4
|
|
8053 DATA 3,4,0,4,0,2,3,2,3,0,0,0,-998 : REM 5
|
|
8054 DATA 3,4,0,4,0,0,3,0,3,2,0,2,-998 : REM 6
|
|
8055 DATA 0,4,3,4,3,0,-998 : REM 7
|
|
8056 DATA 0,0,3,0,3,4,0,4,0,0,-999,0,2,3,2,-998 : REM 8
|
|
8057 DATA 0,0,3,0,3,4,0,4,0,2,3,2,-998 : REM 9
|
|
|
|
8058 data 1.25,.5,1.25,1,1.75,1,1.75,.5,1.25,.5,-999,1.25,2,1.25,2.5,1.75,2.5,1.75,2,1.25,2,-998 : rem :
|
|
8059 data 1.25,.5,1.25,1,1.75,1,1.75,.5,1.5,0,1,0,1.5,0,1.5,.5,1.25,.5,-999,1.25,2,1.25,2.5,1.75,2.5,1.75,2,1.25,2,-998 : rem ;
|
|
|
|
8060 data 3,4,0,2,3,0, -998 : rem <
|
|
8061 data 0,2.5,3,2.5,-999,0,1.5,3,1.5,-998 : rem =
|
|
8062 data 0,4,3,2,0,0, -998 : rem >
|
|
8063 data 0,3.5,.5,4,2.5,4,3,3.5,3,2.5,2.5,2,1.5,2,1.5,1.5,-999,1.25,.5,1.25,1,1.75,1,1.75,.5,1.25,.5,-998 : rem ?
|
|
8064 data 2,2.5,1,2.5,1,1.5,2,1.5,2,2.5,2,1.5,3,2,3,3,2,4,1,4,0,3,0,1,1,0,2,0,-998 : rem @
|
|
|
|
9000 DATA 0,0,0,3.5,0.5,4,2.5,4,3,3.5,3,0,-999,0,2,3,2,-998 : rem a
|
|
9001 data 0,0,0,4,2.5,4,3,3.5,3,2.5,2.5,2,0,2,-999,2.5,2,3,1.5,3,.5,2.5,0,0,0,-998 : rem b
|
|
9002 data 3,.5,2.5,0,.5,0,0,.5,0,3.5,.5,4,2.5,4,3,3.5,-998 : rem c
|
|
9003 data 0,0,0,4,2.5,4,3,3.5,3,.5,2.5,0,0,0,-998 : rem d
|
|
9004 DATA 3,4,0,4,0,0,3,0,-999,0,2,3,2,-998 : rem e
|
|
9005 DATA 0,0,0,4,3,4,-999,0,2,2,2,-998 : rem f
|
|
9006 DATA 3,3.5,2.5,4,.5,4,0,3.5,0,.5,.5,0,2.5,0,3,.5,3,2,1.5,2,-998 : rem g
|
|
9007 DATA 0,0,0,4,-999,3,0,3,4,-999,0,2,3,2,-998 : rem h
|
|
9008 DATA 1.5,0,1.5,4,-998 : rem i
|
|
9009 DATA 3,4,3,.5,2.5,0,.5,0,0,.5,-998 : rem j
|
|
|
|
9011 DATA 0,0,0,4,-999,0,2,1,2,3,4,-999,1,2,3,0,-998 : rem k
|
|
9012 DATA 0,4,0,0,3,0,-998 : rem L
|
|
9013 data 0,0,0,4,1.5,2.5,3,4,3,0,-998 : rem m
|
|
9014 data 0,0,0,4,3,0,3,4,-998 : rem n
|
|
9015 data 3,.5,2.5,0,.5,0,0,.5,0,3.5,.5,4,2.5,4,3,3.5,3,.5,-998 : rem o
|
|
9016 DATA 0,0,0,4,2.5,4,3,3.5,3,2.5,2.5,2,0,2,-998 : rem p
|
|
9017 data 3,.5,2.5,0,.5,0,0,.5,0,3.5,.5,4,2.5,4,3,3.5,3,.5,-999,3,0,1.5,1.5,-998 : rem q
|
|
9010 DATA 0,0,0,4,2.5,4,3,3.5,3,2.5,2.5,2,0,2,-999,1,2,3,0,-998 : rem r
|
|
9019 data 3,3.5,2.5,4,.5,4,0,3.5,0,2.5,.5,2,2.5,2,3,1.5,3,.5,2.5,0,.5,0,0,.5,-998 : rem s
|
|
9020 data 0,4,3,4,-999,1.5,0,1.5,4,-998 :rem T
|
|
9021 data 0,4,0,.5,.5,0,2.5,0,3,.5,3,4,-998 :rem u
|
|
9022 data 0,4,0,1.5,1.5,0,3,1.5,3,4,-998 :rem v
|
|
9023 data 0,4,0,0,1.5,1.5,3,0,3,4,-998 :rem w
|
|
9024 data 0,4,0,3,3,1,3,0,-999,3,4,3,3,0,1,0,0,-998 :rem x
|
|
9025 data 0,4,0,3,1.5,2,3,3,3,4,-999,1.5,2,1.5,0,-998: rem y
|
|
9026 data 0,4,3,4,3,3,0,1,0,0,3,0,-998: rem z
|
|
|
|
9091 data 2,4,1,4,1,0,2,0,-998 : rem [
|
|
9092 data 0,4,3,0,-998 : rem \
|
|
9093 data 1,4,2,4,2,0,1,0,-998 : rem ]
|
|
9094 data 0,2.5,1.5,4,3,2.5,-998 : rem ^
|
|
9095 data 0,0,3,0,-998 : rem _
|
|
|
|
9096 data 1,4,2,3, -998 : rem `
|
|
9097 data 0,2.5,3,2.5,3,0,0,0,0,1.5,3,1.5, -998 : rem a lowercase
|
|
9098 data 0,4,0,0,3,0,3,2.5,0,2.5,-998 : rem b
|
|
9099 data 3,2.5,0,2.5,0,0,3,0,-998 : rem c
|
|
9100 data 3,4,3,0,0,0,0,2.5,3,2.5, -998 : rem d
|
|
9101 data 0,1.5,3,1.5,3,2.5,0,2.5,0,0,3,0,-998 : rem e
|
|
9102 data 3,2.5,.5,2.5,0,2,0,1.5,2,1.5,0,1.5,0,0, -998 : rem f
|
|
|
|
9103 data 3,1.5,0,1.5,0,2.5,3,2.5,3,0,0,0,-998 : rem g
|
|
9104 data 0,4,0,0,0,2.5,3,2.5,3,0,-998 : rem h
|
|
9105 data 1.5,0,1.5,2,-999,1.5,2.5,1.5,3,-998 : rem i
|
|
9106 data 3,2,3,0,0,0,-999,3,2.5,3,3,-998 : rem j
|
|
9107 data 0,4,0,0,0,1.5,3,2.5,0,1.5,3,0, -998 : rem k
|
|
9108 data 1.5,0,1.5,4,1.0,4,-998 : rem l
|
|
9109 data 0,0,0,2.5,1.5,2.5,1.5,0,-999,1.5,2.5,3,2.5,3,0,-998 : rem m
|
|
9110 data 0,0,0,2.5,2.5,2.5,3,2.0,3,0,-998 : rem n
|
|
9111 data 0,0,0,2.5,3,2.5,3,0,0,0,-998 : rem o
|
|
9112 data 0,0,0,2.5,3,2.5,3,1.5,0,1.5,-998 : rem p
|
|
9113 data 3,0,3,2.5,0,2.5,0,1.5,3,1.5,-998 : rem q
|
|
9114 data 0,0,0,2,.5,2.5,3,2.5,-998 : rem r
|
|
9115 data 3,2.5,0,2.5,0,1.5,3,1.5,3,0,0,0,-998 : rem s
|
|
9116 data 0,2.5,3,2.5,-999,1.5,4,1.5,0,-998 : rem t
|
|
9117 data 0,2.5,0,.5,.5,0,3,0,3,2.5,-998 : rem u
|
|
9118 data 0,2.5,0,1.5,1.5,0,3,1.5,3,2.5,-998 : rem v
|
|
9119 data 0,2.5,0,0.5,.5,0,1.5,0,1.5,2.5,-999,1.5,0,3,0,3,2.5,-998 : rem w
|
|
9120 data 0,2.5,3,0,-999,3,2.5,0,0,-998 : rem x
|
|
9121 data 0,2.5,0,1.5,3,1.5,3,2.5,3,0,0,0,-998 : rem y
|
|
9122 data 0,2.5,3,2.5,0,0,3,0,-998 : rem z
|
|
9123 data 2,4,1,3,1,2.5,.5,2,1,1.5,1,1,2,0,-998 : rem {
|
|
9124 data 1.5,4,1.5,0,-998 : rem |
|
|
9125 data 1,4,2,3, 2,2.5, 2.5,2, 2,1.5,2,1,1,0,-998 : rem }
|
|
9126 data 0,3,1,4,2,3,3,4,-998 : rem ~
|
|
9127 data 0,3,1,4,-999,0,2,2,4,-999,0,1,3,4,-999,0,0,3,3,-999,1,0,3,2,-999,2,0,3,1,-999,0,0,0,4,3,4,3,0,0,0,-998 : rem del
|
|
9128 data -997
|
|
|
|
|
|
|
|
|
|
10000 dim l(128,24,2) : rem 5,0,0 is number of points
|
|
10005 nm=1
|
|
10010 pt=0
|
|
10020 read n :
|
|
10025 if n = -997 then return
|
|
10030 if n = -998 then nm=nm+1 : goto 10010
|
|
10040 ? "nm="nm" pt="pt" ";:pt=pt+1:l(nm,pt,1)=n : l(nm,0,0)=pt
|
|
10050 if n<>-999 then read n
|
|
10060 l(nm,pt,2)=n
|
|
10065 ? l(nm,pt,1)","l(nm,pt,2)
|
|
10070 goto 10020
|
|
|
|
|
|
6000 rem converge 1,2, current value of x,y 3,4, target 56 distance 7 maxspeed 8 maxdist
|
|
6100
|
|
|
|
7000 dim FL(2000,100,6) : F = 1 : REM FRAMELIST F
|
|
7001 return
|
|
|
|
7100 rem draw line on frame
|
|
7111 if not(x1>=0 and x1 <=279 and x2 >=0 and x2<=279 and y1>=0 and y1 <=159 and y2>=0 and y2<=159) then return
|
|
7120 FP = FL(F,0,0) + 1 : FL(F,0,0)=FP : rem ? FP FRAME POINT, F=FRAME NUMBER
|
|
7130 FL(F,FP,0)=CO
|
|
7131 FL(F,FP,1)=X1
|
|
7132 FL(F,FP,2)=Y1
|
|
7133 FL(F,FP,3)=X2
|
|
7134 FL(F,FP,4)=Y2
|
|
7140 REM HCOLOR=CO : HPLOT X1,Y1 TO X2,Y2
|
|
7199 RETURN
|
|
|
|
7500 rem swap screens and return
|
|
7501 F=F+1
|
|
7599 return
|
|
|
|
7900 FC=F: REM GOSUB 5000:
|
|
7905 FOR F=1 TO FC-1
|
|
7910 for FP = 1 TO FL(F,0,0) : CO=FL(F,FP,0)
|
|
7911 X1=FL(F,FP,1) : Y1=FL(F,FP,2) :X2=FL(F,FP,3):Y2=FL(F,FP,4) : GOSUB 5100
|
|
7915 NEXT : GOSUB 5500 : NEXT : F = FC
|
|
|
|
7925 FC=F : FOR F=FC-1 TO 1 STEP -1
|
|
7930 for FP = 1 TO FL(F,0,0) : CO=FL(F,FP,0)
|
|
7941 X1=FL(F,FP,1) : Y1=FL(F,FP,2) :X2=FL(F,FP,3):Y2=FL(F,FP,4) : GOSUB 5100
|
|
7955 NEXT : GOSUB 5500 : NEXT : F = FC
|
|
|
|
7960 RETURN
|