Skip to main content
Home Documents NuBus ApplPrimaryInit.A
ApplPrimaryInit.A

ApplPrimaryInit.A

NuBus · A
FilenameApplPrimaryInit.a
Size0.01 MB
Subsection apple / Zorro_Coax-Twinax_Card / diag
Downloads3
Enjoying MacTrove? Anonymous downloads are free and unlimited. Create a free account to track favorites, contribute metadata corrections, and join the community chat.
Contents
;===================================================================================
;
; File:		ApplPrimaryInit.a
;
; Entry:	VendorPI
;
; Function:	Zorro initialization code 
;   {
;	for (count = loopcount; ((count >0) && (bcpTestState != DONE)); count--)  {};
;	if ((bcpTestState != DONE) || (bcpTestErr))
;	   error();
;	stop_bcp();
;	Test 8344 Data RAM locations 0x0000-0x3FFF with patterns FF, AA, 55, and 00;
;	Test 8344 address lines;
;   }
;
; Input:	D0 = Current current test state 
;		A2 = slot address
;		A3 = ptr to Slot Manager parameter block
;
; Output:	D1 = PASS or FAIL
;		($138) = 32 bit failure code if D1 == FAIL
;
; Update:	D0, A2, A3 preserved
;
; History:	12/03/87: initial version
;
;===================================================================================

	EJECT
;bcpRIC		equ	$420001			; 8344 remote interface configuration register
;bcpPC		equ	$400001			; Dummy address for writing to 8344 PC
;bcpDRAM		equ	$400001			; 8344 Data RAM address base
;bcpDMEnd	equ	$4000 * 2 + bcpDRAM	; Last data memory + 1
;RIC_DRAM	equ	$30			; Select 8344 Data RAM
;PASS		equ	0
;FAIL		equ	-1
		
VendorPI: 
	move.l	D0, -(sp)		; save test state
	move.l	A2, -(sp)		; save slot address
	move.l	A3, -(sp)		; save Slot Mgr Parameter block ptr
	move.l	D0, $150(A2)
	move.l	D1, $154(A2)
	move.l	D2, $158(A2)
	move.l	D3, $15C(A2)
	move.l	A0, $160(A2)
	move.l	A1, $164(A2)
	move.l	A2, $168(A2)
	move.l	A3, $16C(A2)
	
;
; - Test 8344 Data RAM
;

	movea.l	#bcpDRAM, A4		; point to location 0000 of data memory
	adda.l	A2, A4			; add slot address
	movea.l	#bcpDMEnd, A3		; ending location
	adda.l	A2, A3			; add slot address
	jsr	zi_RAM			; test interface area (0x0000 - 0x3FFF)
	bne.s	zi_err			; skip if error
	move.l	#PASS, D1		; no error
	bra.s	zi_rtn			; exit	

;---------------------------------------
; - Error exit
;---------------------------------------

zi_err:
	move.l	#FAIL, D1		; test failed
	
;---------------------------------------
; - Exit
;---------------------------------------

zi_rtn:
	move.l	D0, $170(A2)
	move.l	D1, $174(A2)
	move.l	D2, $178(A2)
	move.l	D3, $17C(A2)
	move.l	A0, $180(A2)
	move.l	A1, $184(A2)
	move.l	A2, $188(A2)
	move.l	A3, $18C(A2)
	move.l	(sp)+, A3		; restore Slot Mgr Parameter block ptr
	move.l	(sp)+, A2		; restore slot address
	move.l	(sp)+, D0		; restore test state
	move.l	D0, $190(A2)
	move.l	D1, $194(A2)
	move.l	D2, $198(A2)
	move.l	D3, $19C(A2)
	move.l	A0, $1A0(A2)
	move.l	A1, $1A4(A2)
	move.l	A2, $1A8(A2)
	move.l	A3, $1AC(A2)
	
	rts

	EJECT

;===================================================================================
;
; Name:		zi_RAM
;
; Function:	Test 8344 Data Memory 
;
; Input:	A4 = starting RAM address
;		A3 = ending RAM address + 1
;		A2 = slot address
;
; Output:	Z flag set   => no error
;		Z flag clear => error (D1 = data written; D2 = data read back;
;				       A4 = failed address)
;
; Update:	None
;
; History:	12/03/87: initial version
;
;===================================================================================
				
zi_RAM:
	movea.l	#bcpRIC, A1	; address of 8344 RIC
	adda.l	A2, A1		; NuBus address
	move.l	A4, D3		; save starting location
	moveq	#RIC_DRAM, D0	; select Data memory
	move.b	D0, (A1)	;
	move.b	#$FF,D1		; data pattern
@1:
	move.b	D1, (A4)	; write to memory
	cmp.b	(A4), D1	; read it back check
	bne.s	@90		; jump if errror
				
	addq.l	#2, A4		; addr.ptr++
	cmp.l	A3, A4		; check if reached end
	bne.s	@1
				
	movea.l	D3, A4		; reset pointer to where it started
	moveq	#$55,D1		; data pattern
@2:
	move.b	D1, (A4)	; write to memory
	cmp.b	(A4), D1	; read it back check
	bne.s	@90		; jump if errror
				
	addq.l	#2, A4		; addr.ptr++
	cmp.l	A3, A4		; check if reached end
	bne.s	@2
					
	movea.l	D3, A4		; reset pointer to where it started
	move.b	#$AA,D1		; data pattern
@3:
	move.b	D1, (A4)	; write to memory
	cmp.b	(A4), D1	; read it back check
	bne.s	@90		; jump if errror
				
	addq.l	#2, A4		; addr.ptr++
	cmp.l	A3, A4		; check if reached end
	bne.s	@3
				
	movea.l	D3, A4		; reset pointer to where it started
	moveq	#$00,D1		; data pattern
@4:
	move.b	D1, (A4)	; write to memory
	cmp.b	(A4), D1	; read it back check
	bne.s	@90		; jump if errror
				
	addq.l	#2, A4		; addr.ptr++
	cmp.l	A3, A4		; check if reached end
	bne.s	@4
	
	rts			; good return
@90:
	move.b	(A4), D2	; D2 = data read back
	move.b	#1, D3		; insure Z = 0
	rts			; return
	
	
;===================================================================================
; Entry:	(Status indicator routines)
;
; Function:	
;	When execution of primary init begins, ShowInProgress (which could turn on all LEDs)
;	is called, indicating that the test is in progress.  if primary init crashes
;	it will then be evident that testing did not complete.  If any tests fail,
;	the routine ShowFail is called (perhaps to leave on a red LED), and if all 
;	self-tests pass, the routine ShowPass is called (perhaps to leave on a red LED). 
;	ShowOff is called to turn off all indicator status.
;   
; 	Remember that the following routines are executed across NuBus, and therefore
;	32 bit NuBus addressing must be used.
;===================================================================================

ShowInProgress:			;turn on red & green LED or do whatever to indicate test running
				;Reg A2 contains the 32 bit base address of the card
	move.l	d1, -(sp)	;save & restore any registers changed
	move.l	#$600001, d1	;currently defined Zorro LED control register
	move.b	#$3, (a2, d1.l) ;write to LED control register (turn on red & green)
	move.l	(sp)+, d1
	rts			
	
ShowPass:			;turn on green LED or do whatever to indicate good status
				;Reg A2 contains the 32 bit base address of the card
	move.l	d1, -(sp)	;save & restore any registers changed
	move.l	#$600001, d1	;currently defined Zorro LED control register
	move.b	#$1, (a2, d1.l) ;write to LED control register (turn on green only)
	move.l	(sp)+, d1
	rts			
	
ShowFail:			;turn on red LED
				;Reg A2 contains the 32 bit base address of the card
	move.l	d1, -(sp)	;save & restore any registers changed
	move.l	#$600001, d1	;currently defined Zorro LED control register
	move.b	#$2, (a2, d1.l) ;write to LED control register (turn on red only)
	move.l	(sp)+, d1
	rts			
	
ShowOff:			;turn off green & red LED
				;Reg A2 contains the 32 bit base address of the card
	move.l	d1, -(sp)	;save & restore any registers changed
	move.l	#$600001, d1	;currently defined Zorro LED control register
	move.b	#$0, (a2, d1.l) ;write to LED control register (turn off green & red)
	move.l	(sp)+, d1
	rts			
	
	EJECT
mp.ls