Colour bars/Display: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: IupCloseOnEscape no longer needed) |
m (Commodore BASIC: Converted program to lower case, which aids when copy-pasting into emulators.) |
||
Line 271: | Line 271: | ||
This cross-compatibility is achieved by using the PETSCII control codes (CHR$(x)) for changing color, which are generally the same across all platforms, although the system palettes themselves may differ. This is combined with printing a "reverse video" space (solid block) character in the color selected. |
This cross-compatibility is achieved by using the PETSCII control codes (CHR$(x)) for changing color, which are generally the same across all platforms, although the system palettes themselves may differ. This is combined with printing a "reverse video" space (solid block) character in the color selected. |
||
<lang gwbasic>5 |
<lang gwbasic>5 rem color bars program |
||
10 |
10 print chr$(147);:dim co(17):c=1 |
||
20 |
20 read co(c):if co(c)>0 then c=c+1:goto 20 |
||
25 |
25 sp$=" ":h=22:c=c-1:rem sp$=5 spaces |
||
30 |
30 for r=1 to c step int(c/2) |
||
40 |
40 for h=1 to 10 |
||
50 |
50 for b=r to (r+int(c/2))-1 |
||
60 |
60 print chr$(18);chr$(co(b));sp$; |
||
70 |
70 next b |
||
75 |
75 rem check if palette is only 8 (vic-20). |
||
76 |
76 rem if so, we need to fill the last two spaces. |
||
80 |
80 if c<=8 then print " "; |
||
90 |
90 next h:next r |
||
100 |
100 get k$:if k$="" then 100 |
||
110 |
110 end |
||
280 |
280 rem because the control codes for color are non-sequential, |
||
285 |
285 rem we put them into a sequential array for use |
||
300 |
300 data 144,5,28,159,156,30,31,158 |
||
305 |
305 rem omit or rem the next line for vic-20 |
||
310 |
310 data 129,149,150,151,152,153,154,155 |
||
320 |
320 data 0:rem data terminato</lang> |
||
==={{header|Liberty BASIC}}=== |
==={{header|Liberty BASIC}}=== |