ReadCMOSIP 1.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
; Copyright 1998 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
	AREA	|ObjAsm$$Code|,CODE,READONLY

XOS_Byte	*	&20006
OSByte_ReadCMOS	*	161
CMOS_IPAddress0 *	108
CMOS_IPAddress1 *	109
CMOS_IPAddress2 *	110
CMOS_IPAddress3 *	0
XOS_SetVarVal	*	&20024
XOS_ConvertCardinal1 *	&200D5

	ENTRY
ReadCMOSIP
	MOV	R0,#OSByte_ReadCMOS
	MOV	R1,#CMOS_IPAddress0
	SWI	XOS_Byte
	MOVVS	PC,LR
	MOV	R4,R2

	MOV	R1,#CMOS_IPAddress1
	SWI	XOS_Byte
	MOVVS	PC,LR
	MOV	R5,R2

	MOV	R1,#CMOS_IPAddress2
	SWI	XOS_Byte
	MOVVS	PC,LR
	MOV	R6,R2

	MOV	R1,#CMOS_IPAddress3
	SWI	XOS_Byte
	MOVVS	PC,LR
	MOV	R7,R2

	; If the address is 0.0.0.0 don't do anything
	; If it's 0.0.0.x then treat as 10.0.0.x
Kevin Bracey's avatar
Kevin Bracey committed
51
	CMPS	R4,#0           ; clears V
52 53 54 55
	TEQEQS	R5,#0
	TEQEQS	R6,#0
	MOVEQ	R4,#10
	TEQEQS	R7,#0
Kevin Bracey's avatar
Kevin Bracey committed
56
	MOVEQ	PC,LR
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

	MOV	R0,R4
	MOV	R1,R12
	MOV	R2,#512
	SWI	XOS_ConvertCardinal1
	MOVVS	PC,LR
	MOV	R0,#"."
	STRB	R0,[R1],#1

	MOV	R0,R5
	SWI	XOS_ConvertCardinal1
	MOVVS	PC,LR
	MOV	R0,#"."
	STRB	R0,[R1],#1

	MOV	R0,R6
	SWI	XOS_ConvertCardinal1
	MOVVS	PC,LR
	MOV	R0,#"."
	STRB	R0,[R1],#1

	MOV	R0,R7
	SWI	XOS_ConvertCardinal1
	MOVVS	PC,LR

	SUB	R2,R1,R12
	ADR	R0,VarName
	MOV	R1,R12
	MOV	R3,#0
	MOV	R4,#0
	SWI	XOS_SetVarVal
	MOV	PC,LR

VarName
	= "Inet$CMOSIPAddr", 0

Kevin Bracey's avatar
Kevin Bracey committed
93
	= "ReadCMOSIP 1.01 (27 Apr 2000)"
94 95

	END