Re: Detect a C128 from C64 mode

From: Greg King <greg.king5_at_verizon.net>
Date: Wed, 22 May 2013 13:32:52 -0400
Message-id: <95E2450396CA46BCAAB82DDC7C41848F@Kaiser>
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

It can't get shorter than that!

       Message was sent through the cbm-hackers mailing list
Received on 2013-05-22 19:00:02

Archive generated by hypermail 2.2.0.