** New Frontiers in VIC-Hires-Graphics, Part 6 (sort of)

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Post by tokra »

Ok, I've been busy today. Here is:

208x248

Although just another 8 lines were added this was probably the most complicated I've done yet, although it uses all the same already known principles.

How does it work? It always bugged me a little that the lower 1K wasn't used to full potential in 208x240: A full 128 byte were unused from $0380-$03ff. So I thought it may be possible to use the available space for character defintions and fill the rest "actively" with correct raster timing. This comes down to the following memory layout:

Code: Select all

; Video-Ram Top: 4096-4433 = 338 double height chars
; Char-Ram  Top: 4448-8191 ($1160-$1fff) = 3744 Byte = 29952 pixels (208 * 144 res)
; Swap-Char-Ram Bottom1: 4448-6111 ($1160-$17df) = 1664 Byte = 13312 pixels (208 * 64 res)
; Low 1K Video-Ram: 338-389 ($0152-$0185) = 52 double height chars
; Low 1k Char-Ram: 0-335 (Char 0-20) ($0000-014f), 416-911 (Char 26-56) ($01a0-$038f)
; Extra Line 1K Video-Ram 390-415 ($0186-$019f) = 26 standard height chars
; Extra Line 1K Char-Ram 1 912-1023 (Char 57-70) ($0390-$03ff)
; Extra Line 1K Char-Ram 2 0-95
; mapped to ($2000-$240f) = (8192-9231)
This way only 96 bytes have to be provided to the VIC actively, I could even use the standard lda-sta-memory copy routine providing for an easier addressing mode - it fits into the available raster time nicely.

Altogether the VIC does the following with its raster time
1664 * 2 * 6 for switching the top and lower 208x64 res = 19968 cycles
96 * 2 * 8 for switching the 12 chars in the lower 1K = 1536 cycles
for a total of 21504 cycles. Not counted are the graphics-mode switches and JMPs - another 50-100 cycles probably leaving just a few hundred cycles left to the 22152 it takes the VIC to display a full picture.

Binary: http://www.tokra.de/vic/208248-24k.prg
Source: http://www.tokra.de/vic/208248-24k.asm

Classic BASIC-example:

Code: Select all

10 sys10262:rem clear graphic
20 fori=0to1663:poke10888+5*i,rnd(1)*256:next
30 sys10259:rem clear color ram only
40 sys10256:rem show graphic, wait for keypress, turn off graphic
41 print "hello"
50 fori=0to2079:poke6112+i,rnd(1)*256:next
60 sys10259
70 sys10256
80 print "hello again"
90 fori=0to1663:poke19208+5*i,rnd(1)*256:next
100 sys10259
110 sys10256
120 print "hello three"
130 fori=0to831:poke8192+i,rnd(1)*256:next
140 sys10259
150 sys10256
160 print "hello four"
170 fori=832to1039:poke8192+i,rnd(1)*256:next
180 sys10259
190 sys10256
200 print "bye"
Line-drawing example (does window roses - try entering numbers between 4 and 30)

http://www.tokra.de/vic/fensterrose.prg
Post Reply