Re: Detect a C128 from C64 mode

From: Marko Mäkelä (
Date: 2003-02-14 08:12:25

On Thu, Feb 13, 2003 at 11:52:29PM +0100, Ullrich von Bassewitz wrote:
> I'm currently wondering if there is a really easy and reliable way for a C64
> program to detect if it is running on a C128 in C64 mode.

The $d030 register (2 MHz mode selection and test mode selection) has
already been suggested, and the fact that $d500-$d5ff is normally unconnected
on the C128 but mirrored to $d400-$d4ff on the C64.  The VDC is at $d600,
and the MMU (invisible in C64 mode) is at $d700.  If you'd like to rely on
the mirrored locations, I'd vote for $d700 (which is mirrored to $d400
on the C64), since someone could have mapped custom hardware at $d500.

Another thing you could try is the high bit of the on-chip I/O register,
which is connected to the CAPS LOCK key.  You could flip the data
direction register bit at $00 to output and then input, and see if its
state is remembered.  But beware, it may take some time until the data
written to the bit goes away, depending on the chip temperature.  Or
was it only the $01 register that behaves in this way?

You could also try switching the processor to 2 MHz mode and reading
$d012 or the CIA timer low byte ($dc04?) to see if it really is in 2 MHz
mode.  I wouldn't use the test bit, since it corrupts the video signal.


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.6.