Here's a program to display a bitmap of 320x200 pixels in 4 colours on the VIC-20 (download):
Code: Select all
10 AD=PEEK(55)+256*PEEK(56):IFAD<>12376THENPOKE55,88:POKE56,48:CLR
11 IFAD=0THENFORT=12376TO12700:READA:POKET,A:NEXT:SYS12376:AD=12376
12 DN=PEEK(186):INPUT"FILE";N$:OPEN2,DN,2,N$+",S,R":GET#2,A$,B$:CLOSE2
13 A=ASC(A$+CHR$(.)):SYS57809N$+",S",DN,0:POKE780,0:POKE781,88:POKE782,48:SYS65493
14 POKE646,AAND15:POKE36878,AAND240:POKE36879,ASC(B$+CHR$(.)):@ON:@CLR:X=0:Y=0:P=-1
15 IFPTHENP=0:POKE251,ADAND255:POKE252,AD/256:SYS1024
16 GETA$:IFA$=""THEN16
17 IFA$="{LEFT}"ANDX>0THENX=X-1:AD=AD-200:P=-1
18 IFA$="{RIGHT}"ANDX<60THENX=X+1:AD=AD+200:P=-1
19 IFA$="{UP}"ANDY>0THENY=Y-1:AD=AD-4:P=-1
20 IFA$="{DOWN}"ANDY<34THENY=Y+1:AD=AD+4:P=-1
21 IFA$="S"THENOPEN15,DN,15,"S0:SCRAPFILE":CLOSE15:@SAVE"SCRAPFILE",DN
22 IFA$=" "THEN:@RETURN:END
23 GOTO15
24 :
25 DATA 169,0,141,146,49,133,251,169,64,141,147,49,169,17,133,252,162,20,169,160,32,145
26 DATA 49,169,0,32,145,49,160,64,169,177,32,145,49,169,251,32,145,49,169,200,32,145,49
27 DATA 169,141,32,145,49,165,251,32,145,49,165,252,32,145,49,32,138,49,169,141,32,145
28 DATA 49,165,251,32,145,49,165,252,32,145,49,32,138,49,169,141,32,145,49,165,251,32
29 DATA 145,49,165,252,32,145,49,32,138,49,136,208,184,169,24,32,145,49,169,165,32,145
30 DATA 49,169,251,32,145,49,169,105,32,145,49,169,200,32,145,49,169,133,32,145,49,169
31 DATA 251,32,145,49,169,165,32,145,49,169,252,32,145,49,169,105,32,145,49,169,0,32
32 DATA 145,49,169,133,32,145,49,169,252,32,145,49,202,240,3,76,106,48,169,0,133,251
33 DATA 169,64,133,252,169,0,133,253,169,4,133,254,162,252,160,15,32,110,49,169,76,141
34 DATA 252,15,169,216,141,253,15,169,110,141,254,15,169,33,133,251,169,93,133,252,169
35 DATA 0,133,253,169,160,133,254,162,254,160,191,32,110,49,169,96,141,254,191,169,252
36 DATA 133,251,169,75,133,252,169,216,133,253,169,110,133,254,162,253,160,127,32,110
37 DATA 49,169,76,141,253,127,169,0,141,254,127,169,160,141,255,127,96,152,72,160,0,177
38 DATA 251,32,138,49,145,253,230,253,208,2,230,254,104,168,228,253,208,233,196,254,208
39 DATA 229,96,230,251,208,2,230,252,96,141,255,255,238,146,49,208,3,238,147,49,96
40 :
41 REM ** CGA PAN VIEWER WRITTEN 2016-11-16 BY MICHAEL KIRCHER
+35K RAM are required: yes, that means +24K in BLK1..3, +8K in BLK5 *and* +3K in RAM1..3! Decompress the *.zip archive and run the file "BOOT". The program lets you pan a view into the whole picture with the cursor keys. The display is zoomed, so the pixels do have a square aspect ratio (about perfect for NTSC, only slightly elongated for PAL). With "S", the current view is saved as MINIGRAFIK/MINIPAINT picture file. SPACE returns you to BASIC.
I have included two example pictures, PCPAINT1 and CECILE. Just enter their name in the "FILE?" prompt. These files are 16002 bytes in size, the first 2 bytes hold palette information, the following 16000 bytes contain the bitmap in column-major order. The payload then is loaded to address $3058 in RAM.
This is still a work in progress, and a converter from 4 colour *.ppm files is in the works.
Enjoy!
Michael