
STACK	=	0X800		| stack space for hbug
warmstart =	0XFE0008
|
|
|
|	main program entry
|
	.text
	.even
|
|
__warm:
	movl	#STACK,a7
	jmp	warmstart
|
| The following tests verify that the KIWI is indeed in the 
| I/O space defined by "baseadr".  The return code is placed in
| D0 so these routines can be called by C programs. The return codes are:
|	0x00 - no error
|	0x80 - byte read error
|	0x81 - byte write error
|	0x82 - word read error
|	0x83 - word write error
| 
_verMc:
	clrl	d0			| zero return register
	movl	0x08, _tmp_ex		| save exception vector
	movl	#tst_ex, 0x08		| overwrite bus error vector
	clrb	_badio			| clear error flag
	movl	#mc1, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	a0@(0x10), d1		| read data, master control
mc1:
	tstb	_badio			| test error bit
	beq	mc2
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x10)		| set to indicate bad address
	bra	mc4
mc2:
	movl	#mc3,_nxttst		| save address of next test
	movb	#0,a0@(0x10)		| write data
mc3:
	tstb	_badio			| test error bit
	beq	mc4
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x81, d0
	movb	d0, a1@(0x10)		| set to indicate bad address
mc4:	movl	#_tmp_ex,0x08		| restore bus error vector
	rts
|
|
|
_verDsp:
	clrl	d0			| zero return register
	movl	0x08, _tmp_ex		| save exception vector
	movl	#tst_ex, 0x08		| overwrite bus error vector
	clrb	_badio			| clear error flag
	movl	#dsp1, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	#0,a0@(0x11)		| write data
dsp1:
	tstb	_badio			| test error bit
	beq	dsp4
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x81, d0
	movb	d0, a1@(0x11)		| set to indicate bad address
dsp4:	movl	#_tmp_ex,0x08		| restore bus error vector
	rts
|
|
|
|
|
_verObus:
	clrl	d0			| zero return register
	movl	0x08, _tmp_ex		| save exception vector
	movl	#tst_ex, 0x08		| overwrite bus error vector
	clrb	_badio			| clear error flag
	movl	#obus1, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	a0@(0x12), d1		| read data, offline bus
obus1:
	tstb	_badio			| test error bit
	beq	obus2
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x12)		| set to indicate bad address
	bra	obus4
obus2:
	movl	#obus3,_nxttst		| save address of next test
	movb	#0,a0@(0x12)		| write data
obus3:
	tstb	_badio			| test error bit
	beq	obus4
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x81, d0
	movb	d0, a1@(0x12)		| set to indicate bad address
obus4:	movl	#_tmp_ex,0x08		| restore bus error vector
	rts
|
|
|
|
|
_verOtag:
	clrl	d0			| zero return register
	movl	0x08, _tmp_ex		| save exception vector
	movl	#tst_ex, 0x08		| overwrite bus error vector
	clrb	_badio			| clear error flag
	movl	#otag1, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	a0@(0x14), d1		| read data, offline tag
otag1:
	tstb	_badio			| test error bit
	beq	otag2
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x14)		| set to indicate bad address
	bra	otag4
otag2:
	movl	#otag3,_nxttst		| save address of next test
	movb	#0,a0@(0x14)		| write data
otag3:
	tstb	_badio			| test error bit
	beq	otag4
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x81, d0
	movb	d0, a1@(0x14)		| set to indicate bad address
otag4:	movl	#_tmp_ex,0x08		| restore bus error vector
	rts
|
|
|
|
|
_verPic:
	clrl	d0			| zero return register
	movl	0x08, _tmp_ex		| save exception vector
	movl	#tst_ex, 0x08		| overwrite bus error vector
	clrb	_badio			| clear error flag
	movl	#pic1, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	a0@(0x18), d1		| read data, Interupt controller
pic1:
	tstb	_badio			| test error bit
	beq	pic2
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x18)		| set to indicate bad address
	bra	ic
pic2:
	movl	#pic3,_nxttst		| save address of next test
	movb	#0,a0@(0x18)		| write data
pic3:
	tstb	_badio			| test error bit
	beq	ic
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x18)		| set to indicate bad address
ic:
	clrb	_badio			| clear error flag
	movl	#ic1, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	a0@(0x1A), d1		| read data, Interupt controller
ic1:
	tstb	_badio			| test error bit
	beq	ic2
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x1A)		| set to indicate bad address
	bra	endpic
ic2:
	movl	#ic3,_nxttst		| save address of next test
	movb	#0,a0@(0x1A)		| write data
ic3:
	tstb	_badio			| test error bit
	beq	endpic
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x81, d0
	movb	d0, a1@(0x1A)		| set to indicate bad address
endpic: movl	#_tmp_ex,0x08		| restore bus error vector
	rts
|
|
_verDld:
	clrl	d0			| zero return register
	movl	0x08, _tmp_ex		| save exception vector
	movl	#tst_ex, 0x08		| overwrite bus error vector
	clrb	_badio			| clear error flag
	movl	#dld1, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	a0@(0x16), d1		| read data, Interupt controller
dld1:
	tstb	_badio			| test error bit
	beq	dld2
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x16)		| set to indicate bad address
	bra	enddld
dld2:
	movl	#dld3,_nxttst		| save address of next test
	movb	#0,a0@(0x16)		| write data
dld3:
	tstb	_badio			| test error bit
	beq	dld4
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x81, d0
	movb	d0, a1@(0x16)		| set to indicate bad address
	bra	enddld
dld4:
	movl	#dld5, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	a0@(0x17), d1		| read data, Interupt controller
dld5:
	tstb	_badio			| test error bit
	beq	dld6
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x17)		| set to indicate bad address
	bra	enddld
dld6:
	movl	#dld7,_nxttst		| save address of next test
	movb	#0,a0@(0x17)		| write data
dld7:
	tstb	_badio			| test error bit
	beq	dld8
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x81, d0
	movb	d0, a1@(0x17)		| set to indicate bad address
dld8:
	movl	#dld9, _nxttst		| save address of next test
	movl	_baseadr, a0		| calculate address
	movb	a0@(0x17), d1		| read data, Interupt controller
dld9:
	tstb	_badio			| test error bit
	beq	enddld
	movl	_vreg, a1		| get pointer to valid register map
	movl	#0x80, d0
	movb	d0, a1@(0x17)		| set to indicate bad address
enddld: movl	#_tmp_ex,0x08		| restore bus error vector
	rts
|
|
|
|
|
_verRa:
	clrl	d0			|clear return code
	movl	#0,d2			|index
	clrb	_badio
loop:
	movl	_baseadr,d4
	movl	_vreg,d1
	addl	d2,d1
	addl	d2,d4
	movl	d4,a0			|baseaddr + index
	movl	d1,a1			|vreg + index
	movl	#jp1r,_nxttst		|save addr of next test
	movb	a0@,d3			|read data, byte
	movl	#jp1w,_nxttst		|save addr of next test
	movb	#0,a0@			|writ data, byte
	movl	#jp2r,_nxttst		|save addr of next test
	movw	a0@,d3			|read data, word
	movl	#jp2w,_nxttst		|save addr of next test
	movw	#0,a0@			|writ data, word
	tstb	a0@+
	tstb	a1@+
	movl	#jp1r,_nxttst		|save addr of next test
	movb	a0@,d3			|read data, byte
	movl	#jp1r,_nxttst		|save addr of next test
	movb	#0,a0@			|writ data, byte
	addql	#2,d2
	cmpb	#16,d2
	bne	loop
raend:
	movl	#_tmp_ex,0x08		| restore bus error vector
	rts
|
jp1r:
	movb	#0x80,d0
	movb	#1,a1@
	bra	raend
jp1w:
	movb	#0x81,d0
	movb	#1,a1@
	bra	raend
jp2r:
	movb	#0x82,d0
	movb	#1,a1@
	bra	raend
jp2w:
	movb	#0x83,d0
	movb	#1,a1@
	bra	raend
|
tst_ex:
|	movw	sr,d6
|	bset	#15,d6
|	movw	d6,sr
	movb	#0x01,_errflag
	movw	a7@+,_ex_code		| save exception code
	movl	a7@+,_ex_addr		| save access address
	movw	a7@+,_ex_ir		| save instruction register
	movb	#1,_badio		| set bad io flag
	movl	_nxttst,a7@(2)		| point to next test
	rte
errvect:
	movw	a7@+,_ex_code		| save exception code
	movl	a7@+,_ex_addr		| save access address
	movw	a7@+,_ex_ir		| save instruction register
| save some more stuff and output error message.
	rte
|
_bus_ex:
	movb	#0x01,_errflag		| error 2
	jmp	errvect
_pri_ex:
	movb	#0x02,_errflag		| error 2
	jmp	errvect
_ili_ex:
	movb	#0x03,_errflag	
	jmp	errvect
_nmi_ex:
	movb	#0x04,_errflag
	jmp	errvect
_ila_ex:
	movb	#0x05,_errflag
	jmp	errvect
|
|
|
|
	.globl	_errflag
	.globl	_ex_code
	.globl	_ex_addr
	.globl	_ex_ir
	.globl	_nxttst
	.globl	_baseadr
	.globl	_badio
	.globl	_vreg
	.globl	_tmp_ex
	.globl 	_bus_ex
	.globl	_pri_ex
	.globl	_ili_ex
	.globl	_nmi_ex
	.globl	_ila_ex
	.globl	_verMc:
	.globl	_verRa:
	.globl	_verDsp:
	.globl	_verObus:
	.globl	_verOtag:
	.globl	_verDld:
	.globl	_verPic:
/*  */                                                                                                                                                                                                                           