Re: Detect a C128 from C64 mode

From: silverdr_at_wfmh.org.pl
Date: Wed, 22 May 2013 21:09:05 +0200
Message-Id: <D3D36432-9E6E-47C0-B65E-179776C2B4D5@wfmh.org.pl>
On 2013-05-22, at 19:32, Greg King wrote:

> From: <silverdr; on Monday, May 20, 2013; at 4:50 PM -0400
>> 
>> ; Checks for the output of the additional C128 VIC register
>> ; at $d030. In a 64, it reads $ff. In a C128 in 64 mode,
>> ; it outputs other values, as it has the two bits controling
>> ; "test" and "clock speed" modes.
>> ;
>> ; INPUTS: none
>> ; RETURNS: C128 flag in .A
>> ; REGISTERS AFFECTED: .A
>> 
>> _c128_check:
>> lda $d030
>> cmp #$ff
>> beq c64
>> bne done_c128
>> c128:
>> lda #$ff
>> sta $d030
>> done_c128:
>> lda #$01
>> rts
>> 
>> c64:
>> lda #$fc
>> sta $d030
>> eor $d030
>> beq c128
>> done_c64:
>> lda #$00
>> rts
>> 
>> 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

Wow!! Now - that's a show-off (in the most positive meaning of the word).. max respect, Greg!

It reverses the meaning of the flag but.. no, I am all fine with this!
-- 
SD!
       Message was sent through the cbm-hackers mailing list
Received on 2013-05-22 20:00:04

Archive generated by hypermail 2.2.0.