johncl wrote:My aim is really to see what I can do on an unexpanded Vic20, and from what I have learned it has 5kb of RAM. I know that I can use these areas of the memory: [...][/code]
You can use the entire (internal) RAM as long as you would want to program on the bare metal.
The KERNAL and BASIC need most of the zeropage though to operate properly. As the zeropage is necessary for indirect-Y address modes, you'd need at least some addresses in the ZP which aren't used (that often). $FB..$FE and $03..$06 are unused by the OS. Furthermore, there are some addresses shared between tape and RS232 operations. As long as neither of these two operate, you can use those for own programs. They're initialised by the OS to working values as soon as tape or RS232 operations are started, so you don't necessarily have to store the old values away, either.
I also wonder if I can basically use most of zero page as well as more of the memory between 0200-0400 or if I need to turn off some features of the Vic20 somehow?
You can't literally turn off features, rather just not use them.
For the C64 you can easily turn off Kernal and basically free up almost all memory for your own programs. If you can turn off the Kernal on the Vic20, [...]
Simply put, you can't. KERNAL and BASIC are always mapped to $C000..$FFFF on the VIC-20.
Screen memory will be used for the screen ofc, I know I can store data there too though as long as they are same colour as the background.
- There is only some 6 bytes left at the end.
Unlike the C64, the VIC in the VIC-20 can change the screen dimensions. So the 506 bytes of the 22x23 screen layout isn't really fixed. And the remaining 6 bytes of the standard setup come handy to
display the TI$ clock.
I have thought about detecting a 3kb expansion (at 0400-0FFF) though (as that is so easy to accommodate due to screen and stuff not being relocated) and load an extra 3kb of data off the tape, perhaps some music + an attract screen with better graphics or something (perhaps using 1kb as charset to make a nice bitmap part). [...]
The VIC chip cannot access anything at the expansion port. Especially an external +3K RAM expansion is *not* visible for the VIC. This has been discussed at various places here in the forum.
Also I guess I would need to learn raster interrupts if I want to swap charsets mid-screen. Any pointers to this info that is good? Or do you just add loops that test for raster position?
If you want to do bitmapped graphics, 160x192 is the maximum resolution feasible. This mode uses double-height characters, 'text' screen and character base both mapped to $1000. 240 bytes are used by the text screen, the first usable 'character' is 'P' and the bitmap then starts at $1100. This is the graphics mode implemented by
MINIGRAFIK.
Changing the character set mid-screen is only necessary if you want to go beyond that resolution. That has been extensively been featured in the series '
New Frontiers in VIC-Hires-Graphics'.
'Raster' interrupts can be used for other things, though, like changing the background colour register, etc. They are usually set up with VIA timers, and synchronising once to the raster register in the VIC chip. In the thread '
QUIKMAN 2008 for the unexpanded VIC 20' you'll find an example being constructed (and before that, a remark how *not* to synchronise game action with screen refresh, and why).
Finally, there's not anything gained (of fame, etc.) by restricting oneselves to unexpanded RAM on the VIC-20. You can safely assume, that all people still concerned with the VIC-20 do have a memory expansion available. And some things are, if not downright impossible, but at least rather infeasible to implement: like the aforementioned bitmapped graphics. When the display fills up the entire internal memory (save for the OS workspace in $0000 to $03FF) then you have nothing else to put a program - unless you use a RAM expansion.