Re: Detect a C128 from C64 mode

From: Greg King <greg.king5_at_verizon.net>
Date: Thu, 23 May 2013 10:17:23 -0400
Message-id: <BEA8A26FDE80408A98FC92B4ACFA8B2C@Kaiser>
From: "Segher Boessenkool"; on Wed., May 22, 2013; at 3:41 PM -0400
>
>>> Any ideas to shorten it, keeping the same functionality?
>>
>> You want it; you got it!
>> _c64_check:
>>    asl $d030
>>    ror $d030
>>    lda #0
>>    rol a
>>    rts
>> It can't get shorter than that!
>
> Uh-huh. :-)
>
> _c64_check:
>    asl $d030
>    ror $d030
>    adc #0        <-- can't work
>    rts

GIGO  (Garbage In, Garbage Out)

We can't know what would be already in the accumulator; therefore, we must set it to a known value.

>
> Or, if you return in the carry flag instead of in .A:
>
> _c64_check:
>    asl $d030
>    ror $d030
>    rts

I was thinking of a C-callable library function:
extern bool c64_check(void);

Hmm, maybe it should be renamed:
extern unsigned char is_c64(void);

>
> Unfortunately, I don't think any of these work; they all set
> the test-mode bit (bit 1) to 1 (on)?

Does that matter?  The original test bit (in $d016) crashed the system because it disabled the dynamic RAM refresh (therefore, it 
was removed).  But, the new test bit doesn't do that -- and, the change is momentary. 


       Message was sent through the cbm-hackers mailing list
Received on 2013-05-23 16:00:03

Archive generated by hypermail 2.2.0.