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

MiNT 1.09: no bell under TOS 1.04



On TOS 1.04, when calling Bconout(2,'\a') the VDI jumps directly back
to the BIOS for ringing the bell. But the BIOS expects the register A5
to be set to zero, for checking conterm and setting internal
variables.  Now when calling Bconout directly through the vector at
0x57e and *not* through trap #13, the register A5 has undefined value,
resulting in the wrong address to be tested, or, worse, the wrong
address to be written to.

A workaround is to clear register A5 in callout2.

--- orig/inline.h	Fri Jun 25 22:17:54 1993
+++ inline.h	Sat Dec 25 14:33:26 1993
@@ -55,6 +55,10 @@
 	retvalue;				\
 })
 
+/* On TOS 1.04, wenn calling Bconout(2,'\a') the VDI jumps directly
+   back to the BIOS which expects the register A5 to be set to zero.
+   (Specifying the register as clobbered does not work.) */
+
 #define callout2(func, a, b)			\
 ({						\
 	register long retvalue __asm__("d0");	\
@@ -66,11 +70,13 @@
 	("  moveml d5-d7/a4-a6,sp@-;		\
 	    movew %3,sp@-;			\
 	    movew %2,sp@-;			\
-	    jsr %1@;				\
+	    movel %1,a0;			\
+	    subal a5,a5;			\
+	    jsr a0@;				\
 	    addqw #4,sp;			\
 	    moveml sp@+,d5-d7/a4-a6 "		\
 	: "=r"(retvalue)	/* outputs */	\
-	: "a"(_f), "r"(_a), "r"(_b) /* inputs */ \
+	: "r"(_f), "r"(_a), "r"(_b) /* inputs */ \
 	: "d0", "d1", "d2", "d3", "d4",		\
 	  "a0", "a1", "a2", "a3" /* clobbered regs */ \
 	);					\
--- orig/syscall.spp	Wed Aug 18 19:02:12 1993
+++ syscall.spp	Sat Dec 25 12:57:16 1993
@@ -429,11 +429,14 @@
 ; passing 16 bits (and since the called function will just
 ; ignore any extra arg)
 ;
+; On TOS 1.04, when calling Bconout(2,'\a') the VDI jumps directly
+; back to the BIOS which expects the register A5 to be set to zero.
 
 _callout1:
 _callout2:
 	movem.l	4(sp),a0/a1		; get function ptr & args
 	movem.l	d2-d7/a2-a6,-(sp)	; save reggies
+	suba.l	a5,a5			; kludge for TOS 1.04
 	move.l	a1,-(sp)		; push args
 	jsr	(a0)			; do function
 	addq.w	#4,sp