Je pense que ça ca peut t'aider :
GrayOn: movem.l %d3-%d7/%a2-%a6,-(%a7) bsr.s __gray_check_hw_version lea (__switch_cnt,%pc),%a0 /* reset switch_cnt */ move.l #0,(%a0) lea (__gray_hw_type,%pc),%a0 move.w %d0,(%a0) bsr __gray_init_mem movem.l (%a7)+,%d3-%d7/%a2-%a6 move.l (__gray_handle,%pc),%d0 bne __gray_init_handler __gray_fail: moveq #0x0,%d0 rts /*===========================================================================*/ /* checks for HW version VTI is treated as HW1 !!! */ /* returns 0 in d0.w if HW1 and 1 in d0.w if HW2 */ /*===========================================================================*/ __gray_check_hw_version: move.l 0xc8,%d0 and.l #0x600000,%d0 /* get the ROM base */ move.l %d0,%a0 moveq #0,%d0 move.l 260(%a0),%a1 /* get the pointer to the hardware parameter block */ add.l #0x10000,%a0 cmp.l %a0,%a1 /* check if the HW parameter block is near enough */ bcc.s __gray_patches_for_hw1 /* if it is too far, it is HW1 */ cmp.w #22,(%a1) /* check if the parameter block contains HW */ bls.s __gray_patches_for_hw1 /* if it is too small, it is HW1 */ cmp.l #2,22(%a1) /* check the hardware version */ bne.s __gray_patches_for_hw1 /* if not 2, it is HW1 (or an unknown HW) */ /*-------------------------------------------------------------------------*/ /* check for VTI (trick suggested by Julien Muchembled) */ /*-------------------------------------------------------------------------*/ trap #12 /* enter supervisor mode. returns old (%sr) in %d0.w */ move.w #0x3000,%sr /* set a non-existing flag in %sr (but keep s-flag) */ swap %d0 /* save %d0.w content in upper part of %d0 */ move.w %sr,%d0 /* get %sr content and check for non-existing flag */ btst #12,%d0 /* this non-existing flag can only be set on the VTI */ beq.s __gray_hw2type_detected /* flag not set -> no VTI */ /*===========================================================================*/ /* HW1 detected */ /*===========================================================================*/ swap %d0 /* restore old %sr content and return 0 */ move.w %d0,%sr