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 REM COLOR BARS PROGRAM
<lang gwbasic>5 rem color bars program
10 PRINT CHR$(147);:DIM CO(17):C=1
10 print chr$(147);:dim co(17):c=1
20 READ CO(C):IF CO(C)>0 THEN C=C+1:GOTO 20
20 read co(c):if co(c)>0 then c=c+1:goto 20
25 SP$=" ":H=22:C=C-1:REM SP$=5 SPACES
25 sp$=" ":h=22:c=c-1:rem sp$=5 spaces
30 FOR R=1 TO C STEP INT(C/2)
30 for r=1 to c step int(c/2)
40 FOR H=1 TO 10
40 for h=1 to 10
50 FOR B=R TO (R+INT(C/2))-1
50 for b=r to (r+int(c/2))-1
60 PRINT CHR$(18);CHR$(CO(B));SP$;
60 print chr$(18);chr$(co(b));sp$;
70 NEXT B
70 next b
75 REM CHECK IF PALETTE IS ONLY 8 (VIC-20).
75 rem check if palette is only 8 (vic-20).
76 REM IF SO, WE NEED TO FILL THE LAST TWO SPACES.
76 rem if so, we need to fill the last two spaces.
80 IF C<=8 THEN PRINT " ";
80 if c<=8 then print " ";
90 NEXT H:NEXT R
90 next h:next r
100 GET K$:IF K$="" THEN 100
100 get k$:if k$="" then 100
110 END
110 end
280 REM BECAUSE THE CONTROL CODES FOR COLOR ARE NON-SEQUENTIAL,
280 rem because the control codes for color are non-sequential,
285 REM WE PUT THEM INTO A SEQUENTIAL ARRAY FOR USE
285 rem we put them into a sequential array for use
300 DATA 144,5,28,159,156,30,31,158
300 data 144,5,28,159,156,30,31,158
305 REM OMIT OR REM THE NEXT LINE FOR VIC-20
305 rem omit or rem the next line for vic-20
310 DATA 129,149,150,151,152,153,154,155
310 data 129,149,150,151,152,153,154,155
320 DATA 0:REM DATA TERMINATOR</lang>
320 data 0:rem data terminato</lang>


==={{header|Liberty BASIC}}===
==={{header|Liberty BASIC}}===