[comp.sys.atari.st] ST ROM BIOS BUG: Reset bailout vector

apratt@atari.UUCP (Allan Pratt) (02/03/88)

I have just discovered a bug in the ST ROM BIOS (both "old ROMs" and Mega
ROMs): the system variable resvector ($42a long) is not used the
way it's defined in the Guide (or anywhere else).

This vector is supposed to be called early in system initialization,
after the memory controller has been programmed but before any memory
has been touched (in a warm boot).  Since there is no stack pointer yet
(you're still at IPL 7), the return address is passed in a6.

The bug is that a6 points to the wrong thing.  It's a stupid programmer
error: the line should have been "lea.l reset3(pc),a6" but "reset2" was
used instead.

The workaround is to check to see if (a6).w == $9bcd.  If it is, then
you should return to the ROMs with "jmp $24(a6)" and if it isn't, then
return with "jmp (a6)" as advertised. 

((a6).w will not equal $9bcd in future ROMs where the bug has been
fixed.)

So your "return to ROMs" code, after doing whatever you want to do
at reset time, should look like this:

	cmp.w	#$9bcd,(a6)		; check the instruction at (a6)
	beq.s	buggy_rom		; if eq, it's the old, buggy version
	jmp	(a6)			; return to ROMs (new version)

buggy_rom:
	jmp	$24(a6)			; return to ROMs (buggy version)

**************************************************

Brought to you by the Atari Programmer's Service Bureau (Allan Pratt,
Chief Loremaster). 

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt