Re: Detect a C128 from C64 mode

From: silverdr_at_wfmh.org.pl
Date: Mon, 20 May 2013 22:50:25 +0200
Message-Id: <F277C0B0-C8B9-4F99-A279-A8B8C9CA2866@wfmh.org.pl>
> >> lda $d030 
> >> cmp #$ff 
> >> beq c64 
> 
> MM> What if the test mode and the 2 MHz mode are enabled upon 
> MM> executing that code? 
> 
> Then the machine is in a seriously fscked up state and probably 
> shouldn't be running C code anyway :) 

Probably very much right ;-)

But in case..

; 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 controlling
; "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?

P. S. What is - BTW - the "test mode" of the 128?


       Message was sent through the cbm-hackers mailing list
Received on 2013-05-20 21:00:05

Archive generated by hypermail 2.2.0.