10-06-2022, 12:44 AM (This post was last modified: 10-06-2022, 04:30 AM by eoredson.)
Yes! I could easily add a prompt to load Scrnedit file into program array.
Note however that the current editor in the interpreter is full screen and not line number based.
btw: It took 16 lines of code to LoadProgram in Scrnedit to copy edit array to program array.
I noticed Sick64d9.zip has 0 downloads. Are you looking at the most recent mods?
(10-06-2022, 12:44 AM)eoredson Wrote: btw: It took 16 lines of code to LoadProgram in Scrnedit to copy edit array to program array.
I noticed Sick64d9.zip has 0 downloads. Are you looking at the most recent mods?
I will go acquire it but a few more days could pass before I report again. Thank you.
(09-28-2022, 05:03 AM)eoredson Wrote: btw; what is "as" without any preceding variable?
I had forgotten to tell you a few days ago that a line beginning with "AS" has to be inside the definition of an UDT (User-Defined Type). This is to declare more than one field of the same type without extra typing. The same could be done with "DIM" (global) or "STATIC" (inside subprograms only) to declare multiple variables of the same type. For example:
DIM A AS INTEGER, B AS INTEGER, C AS INTEGER, D AS INTEGER
could be written as:
DIM AS INTEGER A, B, C, D
Inside an UDT, however, the "old" style forced multiple lines or colons to be used to declare multiple fields, even if they were of the same type. Consider this:
TYPE MYUDT
AS INTEGER A, B, C, D
END TYPE
instead of this:
TYPE MYUDT
A AS INTEGER
B AS INTEGER
C AS INTEGER
D AS INTEGER
END TYPE
which would have had to be typed in QuickBASIC or QBasic. The "new" style for UDT looks a bit confusing but it's meant to save time typing stuff. This is even more important if the program is subjected to "OPTION _EXPLICIT" in which every variable must be declared.
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.
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