readme upd
This commit is contained in:
@@ -16,6 +16,8 @@ POSIXLY_CORRECT=1 awk -f lvtl-x.awk -- [/path/to/your/vtl/program.vtl] -
|
||||
|
||||
If running without a wrapper and specifying a program to preload, don't forget to put another `-` after it.
|
||||
|
||||
See some of the example programs in the [examples](examples/) subdirectory to get some ideas of what can be done with the language.
|
||||
|
||||
## Differences from the Altair original
|
||||
|
||||
LVTL-X stands out from other LVTL versions by being closer to the original VTL-2, but still has some important differences that shouldn't be ignored:
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
10 B=99
|
||||
20 #=200
|
||||
30 ?=" of beer on the wall,"
|
||||
40 #=200
|
||||
50 ?=" of beer,"
|
||||
60 ?="Take ";
|
||||
70 #=B=1*100
|
||||
80 ?="one";
|
||||
90 #=110
|
||||
100 ?="it";
|
||||
110 ?=" down and pass it around,"
|
||||
120 B=B-1
|
||||
130 #=200
|
||||
140 ?=" of beer on the wall!"
|
||||
150 ?=""
|
||||
160 #=B=0=0*20
|
||||
170 #=999
|
||||
200 L=!
|
||||
210 #=B=0*270
|
||||
220 ?=B
|
||||
230 ?=" bottle";
|
||||
240 #=B=1*L
|
||||
250 ?="s";
|
||||
260 #=L
|
||||
270 ?="No more";
|
||||
280 #=!+10
|
||||
@@ -0,0 +1,72 @@
|
||||
10 ?="BF-VTL BY LUXFERRE"
|
||||
11 ?="CREATED in 2023, PUBLIC DOMAIN"
|
||||
12 L=*-&) memory limit
|
||||
13 L=L>30000*30000) hard limit to 30k
|
||||
15 I=0) start pre-clearing the memory
|
||||
16 :I)=0
|
||||
17 I=I+1
|
||||
18 #=I<L*16) repeat until reaching the memory limit
|
||||
20 ?=""
|
||||
21 ?="BF CODE (END WITH # OR EOF): ";
|
||||
30 I=0) mem cell index
|
||||
40 P=0) program index
|
||||
50 M=0) mem start track
|
||||
60 C=$) input cmd char
|
||||
70 #=C-43<5*81) 43 + 44 , 45 - 46 .
|
||||
72 #=C=60*81) 60 <
|
||||
74 #=C=62*81) 62 >
|
||||
76 #=C=91*81) 91 [
|
||||
77 #=C=35*90) EOC with #
|
||||
78 #=C=93*81) 93 ]
|
||||
79 #=C=4*90) EOC with Ctrl+D
|
||||
80 #=60) skip
|
||||
81 :P)=C
|
||||
82 P=P+1
|
||||
84 #=60) input next char
|
||||
90 :P)=65535) set end of code marker
|
||||
91 ?=""
|
||||
92 ?="EXEC"
|
||||
96 M=P+1) set memory start
|
||||
100 P=0) start execution
|
||||
110 I=M) reset mem cell index
|
||||
120 C=:P)) loop start
|
||||
130 #=C=43*250) call + routine
|
||||
140 #=C=45*270) call - routine
|
||||
150 #=C=44*290) call , routine
|
||||
160 #=C=46*310) call . routine
|
||||
170 #=C=60*330) call < routine
|
||||
180 #=C=62*360) call > routine
|
||||
190 #=:I)=0*(C=91)*400) call [ routine if cell=0
|
||||
200 #=1-(:I)=0)*(C=93)*430) call ] routine if cell>0
|
||||
210 #=C=65535*240) exit code loop
|
||||
220 P=P+1) go to the next cmd
|
||||
230 #=120) process next cmd
|
||||
240 #=15) return to the start
|
||||
250 :I)=:I)+1/256*0+%) 8-bit wrap
|
||||
260 #=!
|
||||
270 :I)=:I)-1/256*0+%) 8-bit wrap
|
||||
280 #=!
|
||||
290 :I)=$) getchar
|
||||
300 #=!
|
||||
310 $=:I)) putchar
|
||||
320 #=!
|
||||
330 I=I-1) pointer decrement
|
||||
340 I=I<M*(L-M)+I) wrap around mem limit
|
||||
350 #=!
|
||||
360 I=I+1) pointer increment
|
||||
370 I=I-((I>L)*(L-M))) wrap around mem limit
|
||||
380 #=!
|
||||
400 D=1) set the direction to find the ]
|
||||
410 X=93) set the ] code to decrease BL
|
||||
415 Y=91) set the [ countercode to increase BL
|
||||
420 #=450) jump to the common part
|
||||
430 D=65535) set the direction to find the [
|
||||
440 X=91) set the [ code to decrease BL
|
||||
445 Y=93) set the ] countercode to increase BL
|
||||
450 B=1) starting bracket level
|
||||
460 R=P) start with current program pointer
|
||||
470 R=R+D) move along the program tape
|
||||
480 B=B+(:R)=Y)-(:R)=X)) update the bracket level
|
||||
490 #=470*(1-(B=0))) proceed while B>0
|
||||
500 P=R+1) update the program pointer
|
||||
510 #=120) restart processing loop
|
||||
@@ -0,0 +1,53 @@
|
||||
10 I=1
|
||||
20 J=1
|
||||
30 :I)='/10*0+%
|
||||
40 #=:I)=0*30+(0<:I)*70)
|
||||
50 #=:I)=:J)*20
|
||||
60 J=J+1
|
||||
70 #=J<I*50
|
||||
80 I=I+1
|
||||
90 #=4>I*20
|
||||
100 ?="BULLS AND COWS"
|
||||
110 ?="--------------"
|
||||
120 ?=""
|
||||
125 T=0
|
||||
130 T=T+1
|
||||
140 ?="GUESS? ";
|
||||
150 G=?
|
||||
160 #=G<1234+(G>9877)*510
|
||||
170 I=8
|
||||
180 G=G/10
|
||||
190 :I)=%
|
||||
200 I=I-1
|
||||
210 #=4<I*180
|
||||
220 #=:5)*:6)*:7)*:8)=0*510
|
||||
230 I=6
|
||||
240 J=5
|
||||
250 #=:I)=:J)*510
|
||||
260 J=J+1
|
||||
270 #=J<I*250
|
||||
280 I=I+1
|
||||
290 #=I<9*240
|
||||
300 B=0
|
||||
310 C=0
|
||||
320 I=1
|
||||
330 B=:I)=:I+4)+B
|
||||
340 J=1
|
||||
350 C=(I=J=0)*(:I)=:J+4))+C
|
||||
360 J=J+1
|
||||
370 #=4>J*350
|
||||
380 I=I+1
|
||||
390 #=4>I*330
|
||||
400 ?="BULLS: ";
|
||||
410 ?=B
|
||||
420 ?=", COWS: ";
|
||||
430 ?=C
|
||||
440 ?=""
|
||||
450 #=B<4*130
|
||||
460 ?=""
|
||||
470 ?="YOU GOT IT IN ";
|
||||
480 ?=T
|
||||
490 ?=" TRIES!"
|
||||
500 #=1000
|
||||
510 ?="BAD GUESS - GUESS NEEDS TO BE 4 UNIQUE DIGITS WITHOUT ZEROES"
|
||||
520 #=140
|
||||
@@ -0,0 +1,61 @@
|
||||
10 T=0
|
||||
20 L=0
|
||||
30 ?="DON'T LOSE YOUR 'AT'"
|
||||
40 X='/9*0+%+1
|
||||
50 Y='/9*0+%+1
|
||||
60 #=X=Y*40
|
||||
70 Z='/9*0+%+1
|
||||
80 #=X=Z*40
|
||||
90 #=Y=Z*40
|
||||
100 ?="I'VE GOT A NUMBER."
|
||||
105 L=L+1
|
||||
110 P=10000
|
||||
120 ?=""
|
||||
130 ?="YOU HAVE ";
|
||||
140 ?=P/100
|
||||
150 ?=".";
|
||||
160 ?=%/10
|
||||
170 ?=%
|
||||
180 ?=" POINTS LEFT"
|
||||
190 ?=""
|
||||
200 ?="WHAT'S YOUR GUESS? -- ";
|
||||
210 G=?
|
||||
220 A=G/100
|
||||
230 B=%/10
|
||||
240 C=%
|
||||
260 S=600
|
||||
270 #=A=Y*S
|
||||
280 #=A=Z*S
|
||||
290 #=B=X*S
|
||||
300 #=B=Z*S
|
||||
310 #=C=X*S
|
||||
320 #=C=Y*S
|
||||
330 K=0
|
||||
340 S=620
|
||||
350 #=A=X*S
|
||||
360 #=B=Y*S
|
||||
370 #=C=Z*S
|
||||
380 #=K<3*580
|
||||
390 ?=""
|
||||
400 ?="YOU WIN ";
|
||||
410 ?=P/100
|
||||
420 ?=".";
|
||||
430 ?=%/10
|
||||
440 ?=%
|
||||
450 ?=" POINTS FOR A TOTAL OF ";
|
||||
460 T=T+P
|
||||
490 ?=T/100
|
||||
500 ?=".";
|
||||
510 ?=%/10
|
||||
520 ?=%
|
||||
540 ?=" POINTS IN ";
|
||||
550 ?=L
|
||||
560 ?=" GAMES."
|
||||
570 #=30
|
||||
580 P=P/20*19
|
||||
590 #=120
|
||||
600 ?="IT ";
|
||||
610 #=!
|
||||
620 ?="AT ";
|
||||
630 K=K+1
|
||||
640 #=!
|
||||
@@ -0,0 +1,37 @@
|
||||
10 A=1
|
||||
20 L=2
|
||||
30 :1)=1
|
||||
40 I=2
|
||||
50 :I)=0
|
||||
60 I=I+1
|
||||
70 #=L>I*50
|
||||
80 ?=""
|
||||
90 ?=""
|
||||
100 ?=A
|
||||
110 ?="! ="
|
||||
120 ?=""
|
||||
130 I=L+1
|
||||
140 I=I-1
|
||||
150 #=:I)=0*140
|
||||
160 ?=:I)
|
||||
170 I=I-1
|
||||
180 #=I=0*220
|
||||
190 ?=:I)/10
|
||||
200 ?=%
|
||||
210 #=170
|
||||
220 A=A+1
|
||||
230 I=1
|
||||
240 C=0
|
||||
250 X=:I)
|
||||
260 :I)=A*X
|
||||
270 #=:I)<X*320
|
||||
280 :I)=:I)+C
|
||||
290 C=:I)/100
|
||||
300 :I)=%
|
||||
310 I=I+1
|
||||
320 #=L>I*250
|
||||
330 #=C=0*80
|
||||
340 L=L+1
|
||||
350 #=*-&/2<L*380
|
||||
360 :I)=C
|
||||
370 #=290
|
||||
@@ -0,0 +1,41 @@
|
||||
10 ?="NUMBER? ";
|
||||
20 N=?
|
||||
30 X=N
|
||||
40 $=27
|
||||
45 ?="[2J";
|
||||
50 ?=N
|
||||
60 ?=" IS ";
|
||||
70 #=N/2*0+%=0*140
|
||||
80 D=3
|
||||
90 Q=N/D
|
||||
100 #=%=0*160
|
||||
110 #=D>Q*300
|
||||
120 D=D+2
|
||||
130 #=90
|
||||
140 ?="EVEN."
|
||||
150 #=10
|
||||
160 ?=""
|
||||
170 ?=D
|
||||
180 N=Q
|
||||
190 Q=N/D
|
||||
200 #=%=0*220
|
||||
210 #=120
|
||||
220 ?="^";
|
||||
230 P=1
|
||||
240 N=Q
|
||||
250 Q=N/D
|
||||
260 P=P+1
|
||||
270 #=%=0*240
|
||||
280 ?=P
|
||||
290 #=120
|
||||
300 #=N=1*340
|
||||
310 #=N=X*390
|
||||
320 ?=""
|
||||
330 ?=N
|
||||
340 ?=""
|
||||
350 ?="DONE"
|
||||
370 ?=""
|
||||
380 #=10
|
||||
390 ?="PRIME."
|
||||
400 ?=""
|
||||
410 #=340
|
||||
@@ -0,0 +1,15 @@
|
||||
10 N=1
|
||||
20 #=30
|
||||
30 #=N/3*0+%=0*110
|
||||
40 #=N/5*0+%=0*130
|
||||
50 #=!+30
|
||||
60 ?=N
|
||||
70 ?=""
|
||||
80 N=N+1
|
||||
90 #=100>N*20
|
||||
100 #=999
|
||||
110 ?="Fizz";
|
||||
120 #=!
|
||||
130 ?="Buzz";
|
||||
140 #=!
|
||||
180 #=70
|
||||
@@ -0,0 +1,51 @@
|
||||
1000 N=4
|
||||
1010 F=1
|
||||
1020 T=2
|
||||
1030 V=3
|
||||
1040 S=0
|
||||
1050 #=2000
|
||||
1060 #=9999
|
||||
2000 R=!
|
||||
2010 #=N<1*2210
|
||||
2020 #=4000
|
||||
2030 N=N-1
|
||||
2040 A=T
|
||||
2050 T=V
|
||||
2060 V=A
|
||||
2070 #=2000
|
||||
2080 #=5000
|
||||
2090 ?="Move disk from peg: ";
|
||||
2100 ?=F
|
||||
2110 ?=" to peg: ";
|
||||
2120 ?=T
|
||||
2130 ?=""
|
||||
2140 #=4000
|
||||
2150 N=N-1
|
||||
2160 A=F
|
||||
2170 F=V
|
||||
2180 V=A
|
||||
2190 #=2000
|
||||
2200 #=5000
|
||||
2210 #=R
|
||||
4000 S=S+1
|
||||
4010 :S)=R
|
||||
4020 S=S+1
|
||||
4030 :S)=N
|
||||
4040 S=S+1
|
||||
4050 :S)=F
|
||||
4060 S=S+1
|
||||
4070 :S)=V
|
||||
4080 S=S+1
|
||||
4090 :S)=T
|
||||
4100 #=!
|
||||
5000 T=:S)
|
||||
5010 S=S-1
|
||||
5020 V=:S)
|
||||
5030 S=S-1
|
||||
5040 F=:S)
|
||||
5050 S=S-1
|
||||
5060 N=:S)
|
||||
5070 S=S-1
|
||||
5080 R=:S)
|
||||
5090 S=S-1
|
||||
5100 #=!
|
||||
@@ -0,0 +1,48 @@
|
||||
100 ?=""
|
||||
110 ?="A HURKLE IS HIDING ON A"
|
||||
120 ?="10 BY 10 GRID. HOMEBASE"
|
||||
130 ?="ON THE GRID IS POINT 00"
|
||||
140 ?="AND A GRIDPOINT IS ANY"
|
||||
150 ?="PAIR OF WHOLE NUMBERS"
|
||||
160 ?="TRY TO GUESS THE HURKLE'S"
|
||||
170 ?="GRIDPOINT. YOU GET 5 GUESSES"
|
||||
180 ?=""
|
||||
190 R='/100*0+%
|
||||
200 A=R/10
|
||||
210 B=%
|
||||
220 K=1
|
||||
230 ?="GUESS #";
|
||||
240 ?=K
|
||||
250 ?=" ?";
|
||||
260 X=?/10
|
||||
270 Y=%
|
||||
280 ?=""
|
||||
290 #=X*10+Y=R*540
|
||||
300 K=K+1
|
||||
310 #=K=6*440
|
||||
320 ?="GO ";
|
||||
330 #=Y=B*370+(Y<B*360)
|
||||
340 ?="SOUTH";
|
||||
350 #=370
|
||||
360 ?="NORTH";
|
||||
370 #=X=A*410+(X<A*400)
|
||||
380 ?="WEST";
|
||||
390 #=410
|
||||
400 ?="EAST";
|
||||
410 ?=""
|
||||
420 ?=""
|
||||
430 #=230
|
||||
440 ?=""
|
||||
450 ?="SORRY THAT'S 5 GUESSES"
|
||||
460 ?="THE HURKLE IS AT ";
|
||||
470 ?=A
|
||||
480 ?=B
|
||||
490 ?=""
|
||||
500 ?=""
|
||||
510 ?="LETS PLAY AGAIN."
|
||||
520 ?="HURKLE IS HIDING"
|
||||
530 #=180
|
||||
540 ?="YOU FOUND HIM IN ";
|
||||
550 ?=K
|
||||
560 ?=" GUESSES"
|
||||
570 #=490
|
||||
@@ -0,0 +1,19 @@
|
||||
10 N=0
|
||||
20 :N+1)=0
|
||||
30 N=N+1
|
||||
40 #=100>N*20
|
||||
50 A=0
|
||||
60 B=A
|
||||
70 C=B
|
||||
80 :C+1)=160
|
||||
90 C=C+20
|
||||
100 #=100>C*80
|
||||
110 B=B+9
|
||||
120 #=100>B*70
|
||||
130 A=A+6
|
||||
140 #=100>A*60
|
||||
150 N=101
|
||||
160 N=N-1
|
||||
170 #=:N+1)
|
||||
180 ?="Largest non-McNuggets number: ";
|
||||
190 ?=N
|
||||
@@ -0,0 +1,55 @@
|
||||
10 A=0
|
||||
20 ?="MEMORY SIZE? ";
|
||||
30 B=?
|
||||
40 A=A+257
|
||||
50 C=A
|
||||
60 I=0
|
||||
70 I=I+1
|
||||
80 :I)=C
|
||||
90 C=C+769
|
||||
95 ?="";
|
||||
100 #=I*2+&<B*70
|
||||
110 C=A
|
||||
120 I=0
|
||||
130 I=I+1
|
||||
140 D=:I)
|
||||
145 #=D=C=0*170
|
||||
150 C=C+769
|
||||
155 ?="";
|
||||
160 #=130
|
||||
170 E=C/256
|
||||
180 F=%
|
||||
190 G=D/256
|
||||
200 H=%
|
||||
210 J=E=G
|
||||
220 P=I*2+&+J
|
||||
230 #=P<B*300
|
||||
240 ?="TEST # ";
|
||||
250 ?=A/256
|
||||
260 ?=" COMPLETE"
|
||||
270 #=A<65535*40
|
||||
280 ?="DONE"
|
||||
290 #=999
|
||||
300 ?="ERROR AT BYTE #";
|
||||
305 ?=P
|
||||
310 ?=""
|
||||
320 #=J*342
|
||||
330 F=E
|
||||
340 H=G
|
||||
342 ?=" TEST BYTE WAS ";
|
||||
344 ?=F
|
||||
345 ?=""
|
||||
346 ?="ERROR BYTE WAS ";
|
||||
348 ?=H
|
||||
349 ?=""
|
||||
350 L=0
|
||||
360 F=F/2
|
||||
370 M=%
|
||||
380 H=H/2
|
||||
390 N=%
|
||||
400 #=M=N=0*430
|
||||
410 L=L+1
|
||||
420 #=L<8*360
|
||||
430 ?="BIT IN ERROR IS #";
|
||||
440 ?=L
|
||||
450 ?=""
|
||||
Reference in New Issue
Block a user