Greyscale bars/Display: Difference between revisions

{{header|ZX Spectrum Basic}}
(initial content)
 
({{header|ZX Spectrum Basic}})
Line 8:
 
Halfway down the display, we start with black, and produce 32 bars, ending in white, and for the last quarter, we start with white and step through 62 shades of grey, before finally arriving at black in the bottom right hand corner, producing a total of 64 bars for the bottom quarter.
 
=== {{header|ZX Spectrum Basic}} ===
 
ZX Spectrum Basic cannot natively produce greyscale. However, the colours have been
cleverly arranged, so that the monochrome signals are in sequential order of brightness. Wind the colour down, or use a black and white television
and we have a set of 8 bars:
 
<lang basic>
10 REM wind the colour down or use a black and white television to see greyscale bars
20 REM The ZX Spectrum display is 32 columns wide, so we have 8 columns of 4 spaces
30 FOR r=0 TO 20: REM There are 21 rows
40 FOR c=0 TO 7: REM We use the native colour sequence here
50 PRINT " ";: REM four spaces, the semicolon prevents newline
60 NEXT c
70 REM at this point the cursor has wrapped, so we don't need a newline
80 NEXT r
</lang>
 
[[Category:Test card]]