Re: Detect a C128 from C64 mode

From: silverdr_at_wfmh.org.pl
Date: Sat, 25 May 2013 11:20:31 +0200
Message-Id: <2A24B8A5-C86A-4640-8C91-8E0452D854A5@wfmh.org.pl>
On 2013-05-24, at 17:53, Greg King wrote:

> Darn!  I didn't see that.  Segher and you are right.  So, my "great" solution isn't as great as I thought it is.  :-/
> 
> A little "bloat" could fix it:
> 
> _is_c64:
>   lda $d030
>   asl $d030
>   ror $d030
>   sta $d030
>   lda #0
>   rol a
>   rts
> 
> But, I have another idea:
> 
> _is_c128:
>   inc $d030
>   lda $d030
>   dec $d030
>   eor $d030
>   rts
> 
> Does that one pass peer review?  :-)

Let's see..

a 64:
inc $d030 -> $ff
lda $d030 -> $ff
dec $d030 -> $ff    /
eor $d030 -> $00  \/ passed

128 - both bits cleared (default):
inc $d030 -> $fd
lda $d030 -> $fd
dec $d030 -> $fc    /
eor $d030 -> $01  \/ passed

128 - bit 0 set:
inc $d030 -> $fe
lda $d030 -> $fe
dec $d030 -> $fd    /
eor $d030 -> $01  \/ passed

128 - bit 1 set:
inc $d030 -> $ff
lda $d030 -> $ff
dec $d030 -> $fe    /
eor $d030 -> $01  \/ passed

128 - both bits set:
inc $d030 -> $fc
lda $d030 -> $fc
dec $d030 -> $ff  \/
eor $d030 -> $03  /\ wrong! :-))

Anyway - both approaches are impressive...

-- 
SD!


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

Archive generated by hypermail 2.2.0.