InitModule 4.06 KB
; > InitModule
; Source for Pre_InitModule, PostInitModule im_InitModules & im_Pre_InitPodMod functions
;
; ***********************************
; ***    C h a n g e   L i s t    ***
; ***********************************
;
; Date       Who  Version       Description
; ----       ---  -------       -----------
; 13-Jun-96  BAR  0.01		Started
; 27-Jun-96  BAR  0.02		Added code to check the type of reset we
;				just had. If power-on then we can display
;				messages, else exit back.
;
;
; Provides functions to display messages for when we initiliseing the
; modules. Messages are only sent to the display adapator, if the Reset Type
; is Power On Reset. The code uses the constant ResetType, defined in
; kernel.hdr.KernelWS. This is the address of a memory location, where the
; type of reset is stored. ResetType is a sigle bit flag, in bit 0 of the
; memory location. The constant PowerOnReset is used, which is defined in
; Kernel.s.newReset. This defines the value that a power-on reset should be.
; The value of PowerOnReset should always be 1. (This corresponds to the
; value of the bit 4 of IOMD's IRQA Status register, where the Power-on
; reset status is initially stored.) The value of ResetType can vary between
; different versions of the operating system.
;
;
; im_Pre_InitModule  is called before a module is started
; im_Post_InitModule is called after a module is started, only if there was
;		     an error
; im_InitModules     is called at the start of initiliseing the modules.
; im_Pre_InitPodMod  is called when we start the podule manager.
;
; All the functions will push registers r0-r12 to the stack, check the
; poweron reset status, if power on reset, then send a message to the
; display adaptor and then pull them off at the end.
;
;
im_Pre_InitModule	ROUT
	Push	"r0-r12"			; Put r0->r12 on to stack
; Get the type of reset we had, if power-on - can use display adaptor
	LDR	r1,=ResetType		; Load r1 with address of ResetType
	LDR	r0,[r1]				; Get contents of ResetType = what type of reset
	CMPS	r0,#PowerOnReset		; Compare with PowerOnReset (1)
;if equel send message
	LDREQ	r4,[r11,#ROMModule_Name]	; Put ptr to mod name in r4
	BLEQ	ts_SendText			; Send the txt to disp adaptor
;restore the reg's.
	Pull	"r0-r12"			; Get r0->r12 from the stack

	MOV	pc,r14				; Return to caller

im_Post_InitModule	ROUT

1
	= "Module Bad",0

	Push	"r0-r12"			; Put r0->r12 on to stack
; Get the type of reset we had, if power-on - can use display adaptor
	LDR	r1,=ResetType		; Load r1 with address of ResetType
	LDR	r0,[r1]				; Get contents of ResetType = what type of reset
	CMPS	r0,#PowerOnReset		; Compare with PowerOnReset (1)
	BNE	%FT2				; IF not equal jump to 2 AKA don't send msg.

	Push	"r0"				; Put r0 in stack again
	ADR	r4, %BT1			; r4 = bad module msg
	BL	ts_SendText			; Send the txt to disp adaptor
	Pull	"r0"				; Get r0 from the stack
	ADDVC	r4,r0,#4			; If V Clr add 4 to r0 - point to err txt
	BLVC	ts_SendText			; Send the txt to disp adaptor
2
	Pull	"r0-r12"			; Get r0->r12 from the stack

	MOV	pc,r14				; Return to caller

im_InitModules	ROUT

1
	= "Init Modules :",0

	Push	"r0-r12"			; Put r0->r12 on to stack
; Get the type of reset we had, if power-on - can use display adaptor
	LDR	r1,=ResetType		; Load r1 with address of ResetType
	LDR	r0,[r1]				; Get contents of ResetType = what type of reset
	CMPS	r0,#PowerOnReset		; Compare with PowerOnReset (1)
;if equel send message
	ADREQ	r4, %BT1			; r4 = init msg
	BLEQ	ts_SendText			; Send the txt to disp adaptor
;restore the reg's.
	Pull	"r0-r12"			; Get r0->r12 from the stack

	MOV	pc,r14				; Return to caller

im_Pre_InitPodMod	ROUT

1
	= "Podule",0

	Push	"r0-r12"			; Put r0->r12 on to stack
; Get the type of reset we had, if power-on - can use display adaptor
	LDR	r1,=ResetType		; Load r1 with address of ResetType
	LDR	r0,[r1]				; Get contents of ResetType = what type of reset
	CMPS	r0,#PowerOnReset		; Compare with PowerOnReset (1)
;if equel send message
	ADREQ	r4, %BT1			; r4 = init msg
	BLEQ	ts_SendText			; Send the txt to disp adaptor
;restore the reg's.
	Pull	"r0-r12"			; Get r0->r12 from the stack

	MOV	pc,r14				; Return to caller


	END