Re: VIC-II initialization.

From: Segher Boessenkool <segher_at_kernel.crashing.org>
Date: Sat, 29 May 2021 14:33:33 -0500
Message-ID: <20210529193333.GE3085_at_gate.crashing.org>
On Sat, May 29, 2021 at 12:45:32PM -0500, tokafondo wrote:
> I've been studying the VIC-II datasheet and how the C64 initializes it when
> booting.
> 
> The only thing I've seen while booting is
> 
> LDX $#FF
> [...]
> STX $D016
> 
> that I think is a kind of "enable 40 columns text mode". Then, I think that
> things like the base memory address and foreground and back colours are also
> needed to be set, and that's it, isn't it? Because once set, the VIC-II just
> reads memory and renders the data it finds there, leaving up to the KERNAL,
> BASIC or whatever is running in the machine to generate that data.
> 
> What do you think?

You need to set up at least $11, $15, $16, $18, $20, $21.  Nothing is
initialised to 0 (or whatever) at reset, but many are unimportant (if
you set the other registers "as usual").

$11 should be set the $1b (ECM=0 BMM=0 DEN=1 RSEL=1 YSCROLL=3, top bit
doesn't matter).
$15 should be set to 0 (all sprites off).  You do not need any other
sprite config with that set.
$16 should be set to $08 (MCM=0 CSEL=1 XSCROLL=0, top 3 bits do not
matter).
$18 is the base of the screen and character matrix used.

You probably should initialise $1a to 0 as well (no interrupts), and ack
anything (spuriously) set in $19 (after clearing $1a, read $19 and write
that value back to $19).  Although you should be able to handle spurious
interrupts at boot time anyway :-)


Segher
Received on 2021-05-29 23:00:03

Archive generated by hypermail 2.3.0.