However if you calculate the layout from Part 9 you will see there are 10 x 208 bytes placed in the zeropage that need to be updated, and 8 x 208 bytes from $1340-$167f, which means copying the graphics data alone takes up 10 x 208 x 5 + 8 x 208 x 6 = 20384 cycles. Each raster split takes another 12 cycles (updating $900e and $900f). So the mode with 64 splits takes 21152 cycles, not eving counting the switches in the character generator ($9005) and the JMPs into and out of the switching routines for easy addressability. A whole VIC20 PAL-picture only has 312 lines x 71 cycles = 22151 cycles. Using 256 splits with the same layout would come out to a neat 23456 cycles, too much to be displayed in one refresh of the picture.
So what was needed, was an even faster routine to update the picture in the 22152 cycles. The first idea where to get those cycles I got from the Andropolis-demo for the C128. The C128 has an MMU that can place the zeropage and stack anywhere in RAM. The Andropolis-demo uses this to always use zeropage and stack addressing when writing bytes leading to 20% speed-up because zeopage and stack addressing only takes 5 cycles instead of 6. The stack however can only be adressed fast with the PHA and PLA machine-language commands. It didn't occur to me to use these before, but since graphics-data is writting sequentially instead of using
Code: Select all
lda #$aa
sta $01ff
lda #$ab
sta $01fe
Code: Select all
lda #$aa
pha
lda #$ab
pha
After some calculations, I noticed that I can use some of the area in the zeropage and stack twice to make maximum use of the fast-adressable areas. So graphic-data can use the 208 bytes from $00-$cf or $1ff-$130 (backwards) or $12f-$60 (backwards). This lead to the following layout:
Code: Select all
Line Char Memory
0 0-25 $0000-$00cf update $0187-$0130 (88 byte) line1c
1 63-38 $0130-$01ff update $012f-$0100 (48 byte) line4a, $0000-$002f (48 byte) line7a
2 64-89 $0200-$02cf update $0030-$005f (48 byte) line7b, $00ef-$00c0 (48 byte) line4c
3 90-115 $02d0-$039f update $00bf-$0060 (96 byte) line4d
4 12-37 $0060-$012f update $01ff-$01a8 (88 byte) line8a
5 104-129 $1340-$140f update $01a7-$0188 (32 byte) line8b, $0060-$009f (64 byte) line7c
6 130-155 $1410-$14df update $00a0-$00cf (48 byte) line7d, $00ff-$00f0 (16 byte) line11b
7 0-25 $0000-$00cf update $0187-$0130 (88 byte) line8c
8 63-38 $0130-$01ff update $012f-$0100 (48 byte) line11a, $0000-$002f (48 byte) line14a
9 156-181 $14e0-$15af update $0030-$005f (48 byte) line14b, $00ef-$00c0 (48 byte) line11c
10 182-207 $15b0-$167f update $00bf-$0060 (96 byte) line11d
11 37-12 $0060-$012f update $01ff-$01a8 (88 byte) line15a
12 80-105 $1680-$174f update $01a7-$0188 (32 byte) line15b, $0060-$009f (64 byte) line14c
13 106-131 $1750-$181f update $00a0-$00cf (48 byte) line14d, $00ff-$00f0 (16 byte) line18b
14 0-25 $0000-$00cf update $0187-$0130 (88 byte) line15c
15 63-38 $0130-$01ff update $012f-$0100 (48 byte) line18a, $0000-$002f (48 byte) line21a
16 132-157 $1820-$18ef update $0030-$005f (48 byte) line21b, $00ef-$00c0 (48 byte) line18c
17 158-183 $18f0-$19bf update $00bf-$0060 (96 byte) line18d
18 37-12 $0060-$012f update $01ff-$01a8 (88 byte) line22a
19 184-209 $19c0-$1a8f update $01a7-$0188 (32 byte) line22b, $0060-$009f (64 byte) line21c
20 210-235 $1a90-$1b5f update $00a0-$00cf (48 byte) line21d, $00ff-$00f0 (16 byte) line25b
21 0-25 $0000-$00cf update $0187-$0130 (88 byte) line22c
22 63-38 $0130-$01ff update $012f-$0100 (48 byte) line25a, $0000-$002f (48 byte) line28a
23 108-133 $1b60-$1c2f update $0030-$005f (48 byte) line28b, $00ef-$00c0 (48 byte) line25c
24 134-159 $1c30-$1cff update $00bf-$0060 (96 byte) line25d
25 37-12 $0060-$012f update $01ff-$01a8 (88 byte) line29a
26 160-185 $1d00-$1dcf update $01a7-$0188 (32 byte) line29b, $0060-$009f (64 byte) line28c
27 186-211 $1dd0-$1e9f update $00a0-$00cf (48 byte) line28d, $00ff-$00f0 (16 byte) line31b
28 0-25 $0000-$00cf update $0187-$0130 (88 byte) line29c
29 63-38 $0130-$01ff update $012f-$0100 (48 byte) line31a, $00ef-$00c0 (48 byte) line31c
30 212-237 $1ea0-$1f6f update $00bf-$0060 (96 byte) line31d
31 37-12 $0060-$012f update $01ff-$01a8 (88 byte) line1a
(32) update $01a7-$0188 (32 byte) line1b
(33) update $0000-$002f (48 byte) line0a, $0030-$005f (48 byte) line0b
(34) update $0060-$009f (64 byte) line0c, $00a0-$00cf (48 byte) line0d
(35) update $00ff-$00f0 (16 byte) line4b
(36)
(37)
(38)
It took about a week of very long evenings to get this mode working in the first place and the addressing routine took about the same time after that as well.
Now the mode was finally working, but there still were no pictures for it. A friend of mine who knows more about image processing tried a few things, but the results were unsatisfactory, also he was busy finishing his own PC 4K demo for the Revision-party. In parallel I had some discussions with Mike about this mode and it's possibilities. Mike was also kind enough to make some amendments to his VFLI-converter to use on some new C128-graphic modes I came up with in March (thanks again!), however the new MFLI-mode (short for MAXIGRAFIK FLI) on the VIC was still without good demonstration pictures. Why this proved so difficult and how Mike quite brilliantly came through in the end he will hopefully tell you himself...