10-12-2022, 05:19 PM
I converted to "SIC" format a graphics program. It comes from a book called "MORE TRS-80 BASIC" by D.Inman, R.Zamora and B.Albrecht. (c)1981 "Wiley self-teaching guides".
It fakes TRS-80 Model III graphics, which was produced from CHR$(128) to CHR$(191). That's why the "SIC" code doesn't bother checking for value greater than 191 in the "GOSUB" subroutine. I purposely tried to center the graphics on a much-larger screen than the ancient one. I added the check for "S" going below one but maybe it's not necessary. I also added the delay loop and poll for escape key to press to quit the program.
The original source code is listed first but commented out. The converted code that runs follows.
It fakes TRS-80 Model III graphics, which was produced from CHR$(128) to CHR$(191). That's why the "SIC" code doesn't bother checking for value greater than 191 in the "GOSUB" subroutine. I purposely tried to center the graphics on a much-larger screen than the ancient one. I added the check for "S" going below one but maybe it's not necessary. I also added the delay loop and poll for escape key to press to quit the program.
The original source code is listed first but commented out. The converted code that runs follows.
Code: (Select All)
'20 cls
'25 s=10
'30 for n=0 to 330 step 66
'35 for r=0 to s
'40 a=rnd(2)-1
'b=rnd(2)-1
'c=rnd(2)-1
'd=rnd(2)-1
'e=rnd(2)-1
'f=rnd(2)-1
'50 if n=0 then m=0 else m=62*(n/66)
'100 ul=128+a+2*b+(2*c)^2+(2*d)^3+(2*e)^4+(2*f)^5
'110 ur=128+b+2*a+(2*d)^2+(2*c)^3+(2*f)^4+(2*e)^5
'120 ll=128+e+2*f+(2*c)^2+(2*d)^3+(2*a)^4+(2*b)^5
'130 lr=128+f+2*e+(2*d)^2+(2*c)^3+(2*b)^4+(2*a)^5
'210 print @544,chr$(191);
'print @144+n+r,chr$(ul);
'220 print @176+m-r,chr$(ur);
'print @912-m+r,chr$(ll);
'230 print @944-n-r,chr$(lr);
'235 next r
'237 s=s-1
'240 next n
'250 for wait=1 to 200: next wait
'300 goto 10
10 SCREEN 12
20 DO
30 P=544
40 Q=191
50 GOSUB 480
60 S=10
70 FOR N=0 TO 330 STEP 66
80 FOR R=0 TO S
90 A=INT(RND*2)
100 B=INT(RND*2)
110 C=INT(RND*2)
120 D=INT(RND*2)
130 E=INT(RND*2)
140 F=INT(RND*2)
150 IF N=0 THEN
160 M=0
170 ELSE
180 M=62*(N/66)
190 END IF
200 P=144+N+R
210 Q=128+A+2*B+(2*C)^2+(2*D)^3+(2*E)^4+(2*F)^5
220 GOSUB 480
230 P=176+M-R
240 Q=128+B+2*A+(2*D)^2+(2*C)^3+(2*F)^4+(2*E)^5
250 GOSUB 480
260 P=912-M+R
270 Q=128+E+2*F+(2*C)^2+(2*D)^3+(2*A)^4+(2*B)^5
280 GOSUB 480
290 P=944-N-R
300 Q=128+F+2*E+(2*D)^2+(2*C)^3+(2*B)^4+(2*A)^5
310 GOSUB 480
320 NEXT
330 S=S-1
340 IF S<1 THEN
350 EXIT FOR
360 END IF
370 NEXT
380 P=0
390 FOR Q=1 TO 10
400 PAUSE 0.05
410 IF INKEY$=CHR$(27) THEN
420 P=1
430 EXIT FOR
440 END IF
450 NEXT
460 LOOP UNTIL P=1
470 END
480 X=(MOD(P,64)+1)*8+48
490 Y=((P\64)+1)*12+120
500 LINE X,Y,STEP 7,11,0,"FB"
510 IF AND(Q,1)<>0 THEN
520 LINE X,Y,STEP 3,3,7,"FB"
530 END IF
540 IF AND(Q,2)<>0 THEN
550 LINE X+4,Y,STEP 3,3,7,"FB"
560 END IF
570 IF AND(Q,4)<>0 THEN
580 LINE X,Y+4,STEP 3,3,7,"FB"
590 END IF
600 IF AND(Q,8)<>0 THEN
610 LINE X+4,Y+4,STEP 3,3,7,"FB"
620 END IF
630 IF AND(Q,16)<>0 THEN
640 LINE X,Y+8,STEP 3,3,7,"FB"
650 END IF
660 IF AND(Q,32)<>0 THEN
670 LINE X+4,Y+8,STEP 3,3,7,"FB"
680 END IF
690 RETURN