[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] CPU detection broken



Konrad M. Kokoszkiewicz wrote:
Differentiating 68000 from 68020+ is rather simple task:

check_cpu:
    moveq #$01,d0
    lea table-1,a0
    move.b (a0,d0.w*2),d0
    rts

table:    dc.b 0,1

After calling that, the d0 register contains 0 if the CPU is 68000 or 1 if 68020 or higher. For ColdFire I don't know.

Thanks, I didn't know the 68020+ was not 100% retrocompatible with the 68000 user code.

For information, the following example can be used to differentiate between 680x0 and ColdFire (thanks to Didier Méquignon remarks).

	move.l	sp,d0		| backup the stack pointer
	clr.b	-(sp)		| push one byte
	sub.l	sp,d0		| calculate the stack offset
	add.l	d0,sp		| restore the stack

On ColdFire d0 is 1 instead of 2 on 680x0.

But since CPU detection is the job of the kernel, we should probably continue to use the cookies in the MiNTLib. My job is nearly finished, I'm going to post it soon.

--
Vincent Rivière