home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
security
/
login_1
/
s
/
readonly
next >
Wrap
Text File
|
1995-08-29
|
1KB
|
60 lines
; vi:ts=8:sw=8:nosi:ai
;
; Copyright (C) 1994 Alun Jones, auj@aber.ac.uk
;
; This source code is freeware.
;
; readonly.s - Makes a variable read-only. The value of the variable
; is read and a code variable of the same name is created.
; The value is then stored in this variable, whose write
; function is disallowed.
; Usage: readonly variable$name
;
.ABSOLUTE
.PROC main
MOV R0, R1 ; Variable name ptr
ADR R1, buffer
MOV R2, #100
MOV R3, #0
MOV R4, #3
SWI XOS_ReadVarVal
MOVVS PC, R14
ADR R1, code
ADR R1, code ; Code start ptr
ADR R3, endcode
SUB R3, R3, R1 ; Code length
ADD R2, R2, R3 ; Code + buffer length
MOV R3, #0 ; Context ptr
MOV R4, #10 ; Code variable
SWI XOS_SetVarVal
MOV PC, R14
code B write ; Branch to code write
read STMFD R13!, {R1,R3, R14}
ADR R0, buffer
MOV R2, R0
count LDRB R1, [R2], #1
CMP R1, #" "
BGE count
SUB R2, R2, #1
SUB R2, R2, R0
LDMFD R13!, {R1,R3, PC}
write
ORR R14, R14, #10000000
ADR R0, ErrMess
MOVS PC, R14
LDMFD R13!, {PC}
ErrMess .WORD 0
.STRING "Variable is readonly"
endcode
buffer .BLOCK 100, 0
.ALIGN
.END