REM >resutil
REM $NetBSD: resutil,v 1.1.1.1 2002/05/09 20:03:59 jdolecek Exp $
REM
REM Copyright (c) 1995 Mark Brinicombe
REM All rights reserved
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions
REM are met:
REM 1. Redistributions of source code must retain the above copyright
REM    notice, this list of conditions and the following disclaimer.
REM 2. Redistributions in binary form must reproduce the above copyright
REM    notice, this list of conditions and the following disclaimer in the
REM    documentation and/or other materials provided with the distribution.
REM 3. All advertising materials mentioning features or use of this software
REM    must display the following acknowledgement:
REM        This product includes software developed by Mark Brinicombe.
REM 4. The name of the company nor the name of the author may be used to
REM    endorse or promote products derived from this software without specific
REM    prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
REM IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
REM OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
REM IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
REM OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
REM THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
REM DAMAGE.
REM
REM RiscBSD kernel project
REM
REM banner
REM
REM Assembly code for resource handling utils.
REM
REM Created      : 10/08/93
REM Last updated : 12/07/95
REM

REM initresources
REM deinitresources


DEF PROCresourceutils

LOCAL start%
start% = P%

[ opt pass%

.initresources
stmfd r13!, {r0, r14}
adr r0, resourcedata
swi "XResourceFS_RegisterFiles"
ldmfd r13!, {r0, pc}

.deinitresources
stmfd r13!, {r0, r14}
adr r0, resourcedata
swi "XResourceFS_DeregisterFiles"
ldmfd r13!, {r0, pc}

.resourceservice
stmfd r13!, {r0-r1, r14}
adr r0, resourcedata
mov r14, pc
mov pc, r2
ldmfd r13!, {r0-r1, pc}

.resourcedata
]
IF (pass% AND %10) <> 0 THEN
  PRINT "resourceutils";TAB(25);"Start : ";~start%;TAB(40);"Length : ";~P%-start%
ENDIF
ENDPROC


DEF PROCresourcefile(filename$, rfilename$)

LOCAL start%, file, load%, exec%, length%, attrib%

start% = P%

IF (filename$ = "") THEN
  [ OPT pass%
  equd &00000000
  ]
  ENDPROC
ENDIF

SYS "OS_File", 5, filename$ TO ,,load%, exec%, length%, attrib%

file = O%
[ opt pass%
equd &00000000
equd load%
equd exec%
equd length%
equd attrib% \AND &7f
equs rfilename$
equb &00
align
equd length% + 4
]

SYS "OS_File", 255, filename$, O%, 0

P% += length%
O% += length%
[ opt pass%
align
]

!file = (O% - file)

IF (pass% AND %10) <> 0 THEN
  PRINT filename$;TAB(25);"Start : ";~start%;TAB(40);"Length : ";~P%-start%
ENDIF
ENDPROC