Derek_Stewart wrote:
First attempt:
I think you missed a Plot command - and a close#ch
I do not understand why you used Line_R in plot procedure - ZX81 Plot only puts a pixel on screen, afaik.
I changed a bit your code and this is what I got:
I dropped the For command and used a Repeat loop instead, as 200 to 400 points on screen were too few to look interesting on the large QL screen
I addded line 260 - randmly change ink from black to white to prevent the screen getting all black
I added line 270 - pressing Space will end the program
#1 - 2x2 zones on screen
The output is not interesting enough, as the simetry is only visible in the center of the screen. Also it takes ages on QL speed! But on emulator, fast speed, the screen gets black quite fast, so I added some randon ink change
If you run it on unexpanded QL then comment line 260
Code: Select all
100 REMark ZX81 programme: Kaleidoscope
110 REMark Sinclair QL version #1, 2x2 areas
120 :
130 setup_screen
140 :
150 REPeat loop
160 LET v =INT (RND(127))
170 LET h = INT (RND(255))
180 LET rv = 128+(127-v)
190 LET rh = 256+(255-h)
200 PLOT h,v
210 PLOT rh,v
220 PLOT rh,rv
230 PLOT h,rv
240 IF RND>.97 THEN ik=(ik+7)MOD 14: INK#ch, ik : END IF
250 IF KEYROW(1) && 64 THEN EXIT loop
260 END REPeat loop
270 CLOSE#ch
280 :
290 REMark Emulate ZX81 PLOT command
300 :
310 DEFine PROCedure PLOT(x,y)
320 POINT #ch,x*.7375,y
330 END DEFine PLOT
340 :
350 REMark setup screen
360 :
370 DEFine PROCedure setup_screen
380 ch=FOPEN("scr_512x256a0x0")
390 PAPER #ch;7
400 ik=0: INK #ch,ik
410 CLS #ch
420 SCALE #ch;255,0,0
430 RANDOMISE (DATE)
440 END DEFine setup_screen
#1 - 2x2 zones on screen but the "pixels" are now 4x4 blocks and the resolution is lowerd to 128x64 "pixels"
Probably mimics the ZX81 better
Code: Select all
100 REMark ZX81 programme: Kaleidoscope
110 REMark Sinclair QL version #2 - 2x2 areas, 4x4pixels
120 :
130 setup_screen
140 :
150 LET n=INT(RND*250)+2000
160 REPeat loop
170 LET v =INT (RND(31))
180 LET h = INT (RND(63))
190 LET rv = 32+(31-v)
200 LET rh = 64+(63-h)
210 PLOT h,v
220 PLOT rh,v
230 PLOT rh,rv
240 PLOT h,rv
250 IF RND>.97 THEN ik=(ik+7)MOD 14: END IF
260 IF KEYROW(1) && 64 THEN EXIT loop
270 END REPeat loop
280 CLOSE#ch
290 :
300 REMark Emulate ZX81 PLOT command
310 :
320 DEFine PROCedure PLOT(x,y)
330 BLOCK#ch, 4,4, x*4,y*4, ik
340 END DEFine PLOT
350 :
360 REMark setup screen
370 :
380 DEFine PROCedure setup_screen
390 ch=FOPEN("scr_512x256a0x0")
400 PAPER #ch;7
410 ik=0
420 CLS #ch
430 RANDOMISE(DATE)
440 END DEFine setup_screen
#3 8x4 zones, so we have more zones where the symetry is observable.
It generates the most interesting images (well, interesting as far as random pixels can be)
For best impression run it at GC or SGC speed.
Code: Select all
100 REMark ZX81 programme: Kaleidoscope
110 REMark Sinclair QL version #3 - 8x4
120 :
130 setup_screen
140 :
150 REPeat loop
160 v =INT (RND(63))
170 h = INT (RND(63))
180 FOR j=0 TO 1
190 FOR i=0 TO 3
200 PLOT h+i*128,v+j*128
210 PLOT 127+i*128-h,v+j*128
220 PLOT h+i*128,127+j*128-v
230 PLOT 127+i*128-h,127+j*128-v
240 NEXT i
250 NEXT j
260 IF RND>.97 THEN ik=(ik+7)MOD 14: INK#ch, ik : END IF
270 IF KEYROW(1) && 64 THEN EXIT loop
280 END REPeat loop
290 CLOSE#ch
300 :
310 REMark Emulate ZX81 PLOT command
320 :
330 DEFine PROCedure PLOT(x,y)
340 POINT #ch,x*.7375,y
350 END DEFine PLOT
360 :
370 REMark setup screen
380 :
390 DEFine PROCedure setup_screen
400 ch=FOPEN("scr_512x256a0x0")
410 PAPER #ch;7
420 ik=0: INK #ch,ik
430 CLS #ch
440 SCALE #ch;255,0,0
450 RANDOMISE (DATE)
460 END DEFine setup_screen