Jump to content

Greyscale bars/Display: Difference between revisions

m
ANSI Standard BASIC, BASIC256, and BBC BASIC moved to the BASIC section.
m (ANSI Standard BASIC, BASIC256, and BBC BASIC moved to the BASIC section.)
Line 165:
RET
</syntaxhighlight>
 
=={{header|ANSI Standard BASIC}}==
 
{{trans|BBC BASIC}}
 
<syntaxhighlight lang="ansi standard basic">100 SET WINDOW 0,1279,0,1023
110 REM (0,0) is the bottom left of the display
120 SET AREA COLOR 1 ! Select color one for drawing
130 FOR row=1 TO 4
140 LET n=IP(2^(row+2))
150 LET w=IP(1280/n)
160 LET py=IP(256*(4-row))
170 FOR b=0 TO n-1
180 LET g=b/(n-1)
190 IF n=16 OR n=64 THEN LET g=1-g
200 SET COLOR MIX(1) g,g,g ! Reprogram color 1 to the gray we want
210 PLOT AREA: w*b,py; w*b+w,py; w*b+w,py+256; w*b,py+256
220 NEXT b
230 NEXT row
240 END</syntaxhighlight>
 
=={{header|AutoHotkey}}==
Line 274 ⟶ 254:
</syntaxhighlight>
 
=={{header|BASIC256BASIC}}==
==={{header|ANSI Standard BASIC}}===
{{trans|BBC BASIC}}
<syntaxhighlight lang="ansi standard basic">100 SET WINDOW 0,1279,0,1023
110 REM (0,0) is the bottom left of the display
120 SET AREA COLOR 1 ! Select color one for drawing
130 FOR row=1 TO 4
140 LET n=IP(2^(row+2))
150 LET w=IP(1280/n)
160 LET py=IP(256*(4-row))
170 FOR b=0 TO n-1
180 LET g=b/(n-1)
190 IF n=16 OR n=64 THEN LET g=1-g
200 SET COLOR MIX(1) g,g,g ! Reprogram color 1 to the gray we want
210 PLOT AREA: w*b,py; w*b+w,py; w*b+w,py+256; w*b,py+256
220 NEXT b
230 NEXT row
240 END</syntaxhighlight>
 
==={{header|BASIC256}}===
<syntaxhighlight lang="text">
h=ceil(graphheight/4)
Line 288 ⟶ 287:
</syntaxhighlight>
 
==={{header|BBC BASIC}}===
<syntaxhighlight lang="bbcbasic">MODE 8:REM 640 x 512 pixel display mode: BBC BASIC gives 2 graphics points per pixel
REM (0,0) is the bottom left of the display
512

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.