Re: VIC-registers

From: Marko Mäkelä (msmakela_at_cc.hut.fi)
Date: 1998-03-03 23:59:01

Hello Ruud,

> But my idea has one big unsolved problem yet: how can I read data? Maybe
> one of you knows how the SID behaves when you read a write-only
> register. 

Why don't you experiment yourself?  If I remember correctly, the SID is
quite special, because the write-only registers (at least some of them) 
hold the newly written value for some time.  Another possibility would be
that it returns "random" data, i.e. the same as $de00-$dfff when no device
is connected.  But I vaguely remember writing a test program that wrote
and read back the write-only SID registers.

As I said in my previous message, any register that returns $FF on read
and write access is fine.  For instance, the C128 MMU returns $FF for
addresses between $D50F and $D5FF.  I moved my memory expansion's control
registers to $D580-$D5FF, and they worked flawlessly also there.  The
data were simply ANDed with $FF for read accesses, and presumably also
for writes.

> Other question regarding the 6510: as far as I know it does drive the
> addresslines and R/W line when readin/writing $0000 and $0001. Correct?
> But when it writes, does it drive the databus as well?

No, it doesn't.  You can see this by enabling the graphics screen
(POKE53265,59 if I remember correctly) and then POKEing different values
to 0 or 1 (even the same value).  The graphics shown at the top left
corner won't agree with what you POKE to 0 or 1.  I discovered that the
value written to the memory places will be the same that would be read
from $de00-$dfff on that cycle.  On a "$de00-compatible" C64, that is the
value that was read by the video chip on the previous cycle.  Later,
Andreas Boose discovered that you can read these values from $de00-$dfff,
and wrote the first $de00 program, i.e. a program that runs in the I/O
area.  I made some further hacking and wrote a program that runs in the
color memory ($d800-$dbff).  It is quite complicated, since the low 4 bits
are affected by the program counter (they come from the color memory), and
the high 4 bits are affected by the timing (they are selected by the video
chip).  Most C64s are not $de00 compatible; they'll read somewhat random
data from unconnected address space.  Luckily I have a 100% $de00
compatible C128D, and Andreas has a $de00 compatible C64.

By the way, in the 2MHz mode of the C128 there's a better way to write a
determined value to 0 or 1, and I don't mean stack relocation of the MMU. 
With an indexed zero page access (I think it was something like STA $FF,X; 
it could be documented in 64doc), the processor would first read from e.g. 
$FF and then write to 0 or 1 (if you set X to 1 or 2).  Effectively, this
will copy the contents of $FF to 0 or 1.  But be sure that the last two
cycles of the STA instruction actually are 2MHz cycles (i.e. that no
memory refresh takes place).

BTW, does anyone know the memory addresses the TED reads while refreshing
memory?  The VIC-II and the VIC-IIe read $3F00-$3FFF.

	Marko

Archive generated by hypermail 2.1.1.