Re: Stashing data at $ff00-$ff04 in 128 mode?

From: Marko Mäkelä (msmakela_at_cc.hut.fi)
Date: 2001-07-27 08:58:53

On Thu, 26 Jul 2001, eyethian wrote:

> I like the idea. I was wondering if the zero page relocation register would
> work for $00 and $01 of the $ff00/$ff01 registers?

Not so easily, because the CPU tristates the data lines whenever it
accesses the addresses 0 and 1.  Using different addressing modes does not
help.  But it does not tristate the address bus or the R/-W line (unless
my memory has failed badly).

So, if you keep the computer in the 2 MHz mode and make sure that it won't
be dropped to 1 MHz mode e.g. for RAM refresh (by waiting for a $d012
change), you can utilize the "open address space" trick if your C128 is
"$de00 compatible".  (This technique was found by me and Andreas Boose in
early 1994, when we wanted to read $0 and $1 on the C64 without using
slow tricks like the sprite-to-background collision register.  We also
found that it's possible to execute program code in the $de00-$dfff area
with nothing connected there, and also in the color memory $d800-$dbff,
although the 4 most significant bits are unconnected.)

I remember that I once wrote a test program that ensures 2 MHz operation
and does sta $ff,x (that was the instruction unless I'm mistaken). When
executing this instruction, the processor reads data from $ff while it is
computing the 8-bit addition $ff+x.  Load x with 1 or 2, and you can copy
the contents of $ff to $00 or $01.  But this is an unreliable technique.
Not all computers are $de00 compatible, meaning that the data lines will
change to a more or less random value already on the first bus clock cycle
when they are left floating.

> If that doesn't work, then the relocatable stack should work in accessing
> the ram underneath $ff00-$ff04.

Yes, that is the best method.

	Marko


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.1.