Draw a pixel: Difference between revisions

Applesoft BASIC
m (Add comments to the code so it is easier to understand.)
(Applesoft BASIC)
Line 638:
 
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
<syntaxhighlight lang="basic"> 100 WIDTH = 320
110 HEIGHT = 240
120 C = 1: REM RED
130 X = 100
140 Y = 100
150 DEF FN X(X) = INT ((X - 1) / 14)
160 DEF FN Y(Y) = INT ((Y - 1) / 8)
170 W = FN X(WIDTH)
180 H = FN Y(HEIGHT)
190 WX = INT ( RND (1) * (40 - W))
200 WY = INT ( RND (1) * (40 - H))
210 C$ = "0123456789:;<=>?"
220 C$ = MID$ (C$,C,I) + MID$ (C$,C + 2, LEN (C$) - C - 1)
230 I = INT ( RND (1) * LEN (C$))
240 COLOR= ASC ( MID$ (C$,I + 1)) - 48
250 C$ = MID$ (C$,1,I) + MID$ (C$,I + 2, LEN (C$) - I - 1)
260 A = PEEK (49234) + PEEK (49240) + PEEK (49232)
270 FOR I = 0 TO 39
280 VLIN 0,47 AT I
290 NEXT
300 COLOR= ASC ( MID$ (C$, INT ( RND (1) * LEN (C$)) + 1)) - 48
310 FOR I = WX TO WX + W
320 VLIN WY,WY + H AT I
330 NEXT
340 COLOR= C
350 PLOT WX + FN X(X),WY + FN Y(Y)
360 WAIT 49152,128
370 TEXT
380 HOME</syntaxhighlight>
 
==={{header|BASIC256}}===
It seems that the program should be this. And the BASIC256 tutorial programs work on my ubuntu system. This program neither draws the pixel nor resizes the window. Can't see anything when I plot many spots. Oh well. I've tried the rgb(255,0,0) function as well as the fastgraphics/refresh statements.
413

edits