Jump to content

Colour bars/Display: Difference between revisions

m
Commodore BASIC: Converted program to lower case, which aids when copy-pasting into emulators.
m (→‎{{header|Phix}}: IupCloseOnEscape no longer needed)
m (Commodore BASIC: Converted program to lower case, which aids when copy-pasting into emulators.)
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.
 
<lang gwbasic>5 REMrem COLORcolor BARSbars PROGRAMprogram
10 PRINTprint CHRchr$(147);:DIMdim COco(17):Cc=1
20 READread COco(Cc):IFif COco(Cc)>0 THENthen Cc=Cc+1:GOTOgoto 20
25 SPsp$=" ":Hh=22:Cc=Cc-1:REMrem SPsp$=5 SPACESspaces
30 FORfor Rr=1 TOto Cc STEPstep INTint(Cc/2)
40 FORfor Hh=1 TOto 10
50 FORfor Bb=Rr TOto (Rr+INTint(Cc/2))-1
60 PRINTprint CHRchr$(18);CHRchr$(COco(Bb));SPsp$;
70 NEXTnext Bb
75 REMrem CHECKcheck IFif PALETTEpalette ISis ONLYonly 8 (VICvic-20).
76 REMrem IFif SOso, WEwe NEEDneed TOto FILLfill THEthe LASTlast TWOtwo SPACESspaces.
80 IFif Cc<=8 THENthen PRINTprint " ";
90 NEXTnext Hh:NEXTnext Rr
100 GETget Kk$:IFif Kk$="" THENthen 100
110 ENDend
280 REMrem BECAUSEbecause THEthe CONTROLcontrol CODEScodes FORfor COLORcolor AREare NONnon-SEQUENTIALsequential,
285 REMrem WEwe PUTput THEMthem INTOinto Aa SEQUENTIALsequential ARRAYarray FORfor USEuse
300 DATAdata 144,5,28,159,156,30,31,158
305 REMrem OMITomit ORor REMrem THEthe NEXTnext LINEline FORfor VICvic-20
310 DATAdata 129,149,150,151,152,153,154,155
320 DATAdata 0:REMrem DATAdata TERMINATORterminato</lang>
 
==={{header|Liberty BASIC}}===
113

edits

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