pifdebug2.s 2.31 KB
#include "sys/regdef.h"
#include "sys/asm.h"

        .text
        .set noat			# allows us to use register $1 ($at)
        .set noreorder	

LEAF (Boot)                       	# Address = 0xbfc00000.

 #
 # Rom entry point; on reset, the R4300 fetches instructions starting at 
 # address 0xbfc00000; we loop, telling the R4300 to read 1K''s worth of data 
 # from the start of ramrom (which should be pre-initialized by the Indy host),
 # and write these 1K words (read, written one at a time) to the second 1K of
 # ramrom.  The host should then reset the game, wait a bit, re-assert reset,
 # then go and read the second 1K to verify that the data was read and written 
 # correctly by the R4300.  There''s no easy way to distinguish read errors from
 # write errors, unfortunately (other than a logic analyzer).
 # 

entry:	lui	s0, 0xb000	# Initialize our read pointer,
	lui	s1, 0xb000	# our write pointer,
	addiu	s1, 0x400
	lui	s2, 0xb000	# and our comparator (to terminate the loop)
	addiu	s2, 0x400

wrloop:	lw	t1, 0x0(s0)	# read from first kilobyte,
	nop
	sw	t1, 0x0(s1)	# and write to second kilobyte.

	addiu	s0, s0, 0x4	# bump read/write pointers up to next word
	addiu	s1, s1, 0x4

	beq	s0, s2, entry
	j	wrloop		# when we've read/written 1K's worth, repeat.

 #
 # Now prepare a default interrupt exception vector table.  There are three 
 # types of exceptions in all, user tlb miss, extended address tlb miss,
 # and all others.  The condition codes in the CAUSE register will be set.
 #
 # Each exception will simply spin forever, jumping back to its entry point
 # (making it easy to capture which exception was triggered by looking at the
 # memory bus address on a logic analyzer).
 #

        .align      9                   # Align to start of the vector table.
	                                # Address = 0xbfc00200.
	lui	s0, 0xbfc0
	add	s0, 0x200		# Spin forever at 0xbfc00200
	j	s0			# utlbmiss boot exception vector

        .align      7                   # Align to next exception vector
					# Address = 0xbfc00280.
	lui	s0, 0xbfc0
	add	s0, 0x280		# Spin forever at 0xbfc00280
	j	s0			# xutlbmiss boot exception vector

        .align      8                   # Align to next exception vector
					# Address = 0xbfc00380.
	lui	s0, 0xbfc0
	add	s0, 0x380		# Spin forever at 0xbfc00380
	j	s0			# "Others" (all other exceptions)

END (Boot)