28Fermer30
FarewellLe 22/07/2009 à 21:00
Voilà ce que ça donnerait :
--- Vectors.asm.old	2009-07-16 20:41:31.000000000 +0200
+++ Vectors.asm	2009-07-22 18:59:17.512566027 +0200
@@ -150,8 +150,9 @@
 	move.w	(sp)+,d1		; Get Old SR
 	move.l	(sp)+,a0		; Get Address of the 'crash'
 	move.w	(a0)+,d0		; We get the instruction and a0 ->next instruction
-	subi.w	#$F800,d0		; Is it > $F800 ? 
+	cmpi.w	#$F800,d0
 	bls.s	\no			; No, so it is a crash (First_Window isn't a ROM_CALL)
+		subi.w	#$F800,d0
 		move.l	a0,a1		; Jsr/Jmp with a 32 bits offset	
 		cmp.w	#$FFF0-$F800,d0
 		bne.s	\NoRelJsr
@@ -175,10 +176,30 @@
 \Jump			move.w	d1,SR		; Restore SR
 			pea	(a0)		; Push return address
 			jmp	(a1)		; Jump to Rom_call function
-\no:	lea	Line1111_str(Pc),a0
+\no:	subi.w	#$F000,d0				; Clear data of exception
+	cmpi.w	#MAX_RAMCALL,d0				; Valid ramcall ?
+	bcc.s	\error					; No, throw an error
+		move.w	d1,SR				; Restore previous SR
+		pea	(a0)				; Push return adress
+		move.b	RAM_TABLE_TYPE(pc,d0.w),d1	; Red type of ramcall (table of bytes)
+		add.w	d0,d0				; Table of longwords
+		add.w	d0,d0
+		lea.l	RAM_TABLE(pc),a0		; Read the ramcall table ptr
+		adda.w	d0,a0				; Add offset : a0 now points to the ramcall
+		movea.l	(a0),a0				; Read it
+		tst.b	d1				; Read its type
+		bmi.s	\ReturnPtr			; -1 : return a ptr in a0
+		beq.s	\ReturnData			; 0  : return data in d0
+			jmp	(a0)			; 1  : else jump to the function
+\ReturnData:	move.l	a0,d0				; Data must be in a0
+\ReturnPtr:	rts					; Else it's already set
+\error:	lea	Line1111_str(Pc),a0
 	bra	FATAL_ERROR
 
-	
+RAM_TABLE_TYPE					; -1 : ptr. 0 : data. +1 : routine
+	dc.b	-1,0,0,-1,0,0,0,0,0,0,0,0,0,-1,-1,0,-1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,-1,-1,-1,1,0,0,0,0,0,1,1,1,1,-1,-1,-1
+
+
 Trap_7:
 Trap_8:
 Trap_10:		; Enter self test

A vérifier si c'est intégré : la table des types. Ca compile, mais j'ai pas encore essayé, j'attends d'abord le verdict. grin