Commit ad049d99 authored by Neil Turton's avatar Neil Turton
Browse files

Import from cleaned 360 CD

parents
hdr/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
s/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
FS_Entry reason codes:
0 - NoOp - Just return.
1 - Get device name
r0 - 1 (Reason code)
r1 - FS number.
r2 -> Buffer.
r3 -> device name / id.
Exit:
r0 - length of name
r1 - preserved.
r2 - preserved.
r3 - preserved.
2 - Get free space for device.
r0 - 2 (Reason code)
r1 - FS number.
r2 -> Buffer
r3 -> Device name / id .
Exit:
Registers preserved.
[r2] - Total size of device.
[r2+4] - Free space on device.
[r2+8] - Used space on device.
OR
r2 = 0 if size unchanged from last time read.
3 - Compare device.
r0 - 3 (Reason code)
r1 - FS number.
r2 -> filename.
r3 -> Device id.
r6 -> Special field.
Exit:
Registers preserved.
Z set if r2 & r6 result in a file on the device pointed to by r3.
This call can simply return with Z set if the filing system is a FAST
filing system (E.G. RAMFS).
The FreeSpace module provides two SWIs:
Free_Register
Entry:
r0 - Filing system number
r1 - Address of routine to call to get free space info (see below)
r1 - r12 on entry to the above routine.
Exit:
Registers preserved.
This must be called in order for the free space module to provide an interactive free space display for a filing system (it is done automatically by the free space module for the following filing systems: ADFS RAMFS NETFS NFS SCSIFS).
Free_Deregister
r0 - Filing system number.
This removes the filing system from the list of known filing systems.
FS_Entry reason codes: (On entry to routine pointed to by r1 in above SWI)
0 - NoOp - Just return.
1 - Get device name
r0 - 1 (Reason code)
r1 - FS number.
r2 -> Buffer.
r3 -> device name / id.
Exit:
r0 - length of name
r1 - preserved.
r2 - preserved.
r3 - preserved.
2 - Get free space for device.
r0 - 2 (Reason code)
r1 - FS number.
r2 -> Buffer
r3 -> Device name / id .
Exit:
Registers preserved.
[r2] - Total size of device.
[r2+4] - Free space on device.
[r2+8] - Used space on device.
OR
r2 = 0 if size unchanged from last time read.
3 - Compare device.
r0 - 3 (Reason code)
r1 - FS number.
r2 -> filename.
r3 -> Device id.
r6 -> Special field.
Exit:
Registers preserved.
Z set if r2 & r6 result in a file on the device pointed to by r3.
This call can simply return with Z set if the filing system is a FAST
filing system (E.G. RAMFS).
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
| Copyright 1996 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.
|
RMLoad &.RM.Free
WimpTask Desktop
# Copyright 1996 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.
#
# Makefile for FreeSpace
#
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# Date Name Description
# ---- ---- -----------
# 25-May-94 AMcC Created.
#
#
# Paths
#
EXP_HDR = <export$dir>
#
# Generic options:
#
MKDIR = cdir
AS = aasm
CP = copy
RM = remove
CCFLAGS = -c -depend !Depend -IC:
ASFLAGS = -depend !Depend -Stamp -quit -module
CPFLAGS = ~cfr~v
#
# Program specific options:
#
COMPONENT = Free
SOURCE = s.Free
TARGET = rm.Free
EXPORTS = ${EXP_HDR}.Free
#
# Generic rules:
#
rom: ${TARGET}
@echo ${COMPONENT}: rom module built
install_rom: ${TARGET}
${CP} ${TARGET} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom module installed
clean:
${RM} ${TARGET}
@echo ${COMPONENT}: cleaned
export: ${EXPORTS}
@echo ${COMPONENT}: export complete
resources:
${MKDIR} ${RESDIR}.${COMPONENT}
${CP} Resources.${LOCALE}.Messages ${RESDIR}.${COMPONENT}.Messages ${CPFLAGS}
${CP} Resources.${LOCALE}.Templates ${RESDIR}.${COMPONENT}.Templates ${CPFLAGS}
@echo ${COMPONENT}: resource files copied
${TARGET}: ${SOURCE}
${AS} ${ASFLAGS} -To $@ -From ${SOURCE}
${EXP_HDR}.Free: hdr.Free
${CP} hdr.Free $@ ${CPFLAGS}
# Dynamic dependencies:
| Copyright 1996 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.
|
Dir <Obey$Dir>
amu_machine clean
| Copyright 1996 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.
|
Dir <Obey$Dir>
amu_machine rom
File added
File added
File added
; > Version
GBLA Version
GBLS VString
GBLS Date
Version SETA 030 ; 001
VString SETS "0.30" ; "0.01"
Date SETS "26 Jan 1995" ; "09 Sep 1990"
END
; Copyright 1996 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.
;
SUBT Exported Free constants
OldOpt SETA {OPT}
OPT OptNoList+OptNoP1List
; ***********************************
; *** C h a n g e L i s t ***
; ***********************************
;
; Date Name Description
; ---- ---- -----------
; 19-May-94 AMcC Created
SWIClass SETS FreeSWI_Name
^ FreeSWI_Base
AddSWI Register ; &444C0
AddSWI DeRegister ; &444C1
OPT OldOpt
END
*
!.gitignore
; Copyright 1996 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.
;
;-------------------------------------------------------------------------
;
; adfs_entry
;
; Entry point for adfs discs.
adfs_entry
TEQ r0,#FreeReason_GetName
BEQ adfs_GetName
TEQ r0,#FreeReason_GetSpace
BEQ adfs_GetSpace
TEQ r0,#FreeReason_ComparePath
BEQ adfs_ComparePath
TEQ r0,#FreeReason_GetSpace64
BEQ adfs_GetSpace64
Pull "PC"
;-----------------------------------------------------------------------
; adfs_GetName
;
; Put the name of the drive specified in r3 into the buffer at r2
;
adfs_GetName
Push "r1-r3"
Debug xx,"Get name"
MOV r0,r3
ADR r1,disc_desc
SWI XADFS_DescribeDisc
Pull "r1-r3,PC",VS
Debug xx,"Get name- SWI OK"
ADD r4,r1,#22
[ Version >= 4 ; Cope with unnamed discs
LDRB r14,[r4]
CMP r14,#" "
MOVLE r14,#":"
STRLEB r14,[r2],#1
MOVLE r4,r3
]
MOV r0,r2
[ Version >= 4
MOV r3,#10 ; Max length
BL copy_r0r4r3_space ; Copy name to buffer
|
BL copy_r0r4_null ; Copy name to buffer
]
MOV r0,#11 ; Name is 10 chars + terminator.
Debug xx,"r0 set ",r0
Pull "r1-r3,PC"
;-----------------------------------------------------------------------
; adfs_GetSpace
;
; Put the free space on the drive specified in r3 into the buffer at r2
;
adfs_GetSpace
Push "r1-r3"
Debug xx,"Get space"
MOV r0,r3
ADR r1,disc_desc
SWI XADFS_DescribeDisc
Pull "r1-r3,PC",VS
LDR r0,[r1,#16] ; Store disc size in buffer.
STR r0,[r2]
MOV r0,r3
SWI XADFS_FreeSpace
Pull "r1-r3,PC",VS
STR r0,[r2,#4] ; Free space
LDR r1,[r2]
SUB r1,r1,r0
STR r1,[r2,#8] ; used space
Pull "r1-r3,PC"
;-----------------------------------------------------------------------
; adfs_GetSpace64
;
; Put the free space on the drive specified in r3 into the buffer at r2
;
adfs_GetSpace64
Push "r1-r5"
Debug xx,"Get space64"
MOV r0,r3
ADR r1,disc_desc
SWI XADFS_DescribeDisc
Pull "r1-r5,PC",VS
LDR r0,[r1,#16] ; Store disc size in buffer.
STR r0,[r2]
LDR r0,[r1,#36] ; and the high word
STR r0,[r2,#4]
MOV r0,r3
MOV r5,r2 ; save the buffer pointer
SWI XADFS_FreeSpace64
; if this errors we return with V CLEAR, since the error is anticipated
; and we then fall back to trying _FreeSpace
BVS %FT02
STR r0,[r5,#8] ; free space (low)
STR r1,[r5,#12] ; free space (high)
LDR r3,[r5] ; disc size (low)
LDR r4,[r5,#4] ; disc size (high)
mextralong_subtract r0,r1,r3,r4,r0,r1
STR r0,[r5,#16] ; used space (low)
STR r1,[r5,#20] ; used space (high)
MOV r0,#0 ; indicate that we handled the new reason code
02
CLRV
Pull "r1-r5,PC"
;-------------------------------------------------------------------------
; adfs_ComparePath
;
;
adfs_ComparePath
Push "r0-r9"
Debug xx,"ADFS compare path"
ADR r1,dataarea
01
LDRB r0,[r2],#1
CMP r0,#"."
Debug xx,"Copy ",r0
MOVEQ r0,#0
STRB r0,[r1],#1
CMP r0,#0
BNE %BT01 ; Copy to first "."
ADR r3,dataarea
MOV r2,r3
Push "PC"
B adfs_GetName
MOV r0,r0
Debug xx,"Got name ",r0
ADR r2,dataarea
LDR r3,[sp,#3*4]
CMPSTR r2,r3
Pull "r0-r9,PC"
LNK s.RAMFS
; Copyright 1996 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.
;
; > s.Front
;;-----------------------------------------------------------------------------
;; Wimp utility: FreeSpace
;;
;; Change list
;; 09-Sep-90 0.01 Started.
;; 01-Nov-90 0.02 Centre window on mouse.
;; 12-Dec-90 0.03 Fixed bug, svc_reset didn't preserve r1.
;; 17-Mar-91 0.04 Fixed bug - svc_reset freed list of known Filing systems.
;; Fixed bug - Name legth is no longer than 10 on ADFS / SCSI /RAMFS
;; Fixed bug - ADFS / SCSI now cope with unnamed discs.
;; 08-Apr-91 0.05 Added Messages list and pass 300 to Wimp_Initialise
;; 20-May-91 0.06 Fixed bug, pull "r1-r3,pc on error from adfs/scsifs/ramfs_freespace
;; Fixed bug, was unable to cope with 10 character names.
;; 22-Jul-91 0.07 Free space on Econet is now smaller of User free space and disc free space.
;; 28-Jul-91 0.08 Fixed bug, lost station & net number in some Econet cases.
;; Fixed bug, opened window with wrong info if got an error while reading space.
;; 28-Aug-91 0.09 Removed ADFS alias setting.
;; 05-Sep-91 0.10 Doesn't free workspace on die.
;; 29-Oct-91 0.12 Templates now help in Messages module, no longer need ResourceFS.
;; 12-Dec-91 0.13 Errors mow held in Messages module and looked up using MessageTrans.
;; 21-Feb-92 0.16 Changed upcall handler to work with reason 512 (extending file)
;; 27-Feb-92 0.17 Fixed internationalisation bug (used wrong title length)
;; 11-Apr-92 0.21 Fixed handling of UpCall close and extend files to construct name
;; from file handle. Avoids embarasing requests for dodgy disc names
;; and keeps free space updated correctly.
;; 14-Jul-92 0.22 OSS Changed Wimp_CloseWindow to Wimp_DeleteWindow.
;; 22-Jul-93 0.23 ECN Look up "Unknown Free SWI" message
;; 17-Sep-93 0.24 TMD Changed computation of bar sizes to use floating point, to avoid overflow bug.
;; 01-Nov-94 0.27 amg Convert to handle 64 bit disc size throughout, and start using
;; _FreeSpace64 for ADFS & SCSIFS. Bar calculation no longer FP.
;; 17-Nov-94 0.28 amg Sort out some bad coding in SCSIFS (doesn't return 'SWI not known'!)
;;-----------------------------------------------------------------------------
;; Wish list
;;-----------------------------------------------------------------------------
Module_BaseAddr
GET Hdr:ListOpts
GET Hdr:Macros
GET Hdr:System
GET Hdr:ModHand
GET Hdr:Services
GET Hdr:VduExt
GET Hdr:FSNumbers
GET Hdr:HighFSI
GET Hdr:NewErrors
GET Hdr:Variables
GET Hdr:Proc
GET Hdr:Sprite
GET Hdr:Wimp
GET Hdr:WimpSpace
GET Hdr:Messages
GET Hdr:FilerAct
GET Hdr:CMOS
GET Hdr:MsgTrans
GET Hdr:MsgMenus
GET Hdr:ResourceFS
GET Hdr:ColourTran
GET Hdr:Hourglass
GET Hdr:ADFS
GET Hdr:RamFS
GET Hdr:SCSIFS
GET Hdr:Econet
GET Hdr:UpCall
GET Hdr:HostFS
GET Hdr:NdrDebug
GET Hdr:ExtraLong
GET Version
GBLL debugxx
GBLL debugmsg ; Message lookup.
GBLL hostvdu
debug SETL false
debugxx SETL false ; General tracing.
debugmsg SETL false
hostvdu SETL true
; ----------------------------------------------------------------------------------------------------------------------
MACRO
$label ALIGNHASH $o,$m
[ ((@-$o):AND:($m-1))<>0
$label # $m-((@-$o):AND:($m-1))
|
$label # 0
]
MEND
;-----------------------------------------------------------------------------------------------------------------------
MACRO
CMPSTR $a,$b
Push "r0,r1,LR"
MOV r0,$a
MOV r1,$b
BL cmpstr
Pull "r0,r1,LR"
MEND
; Linked window block structure (active and buffered)
^ 0
next_ptr # 4 ; Pointer to next in chain ( <= 0 if none)
prev_ptr # 4 ; Pointer to previous entry in chain ( <= 0 if none)
window_handle # 4 ; Window handle for this window.
window_fs # 4 ; Filing system for this window.
window_size_lo # 4 ; Total space on the disc (low word).
window_size_hi # 4 ; Total space on the disc (high word).
window_free_lo # 4 ; Free space on the disc (low word).
window_free_hi # 4 ; Free space on the disc (high word).
window_used_lo # 4 ; Space used on the disc (low word).
window_used_hi # 4 ; Space used on the disc (high word).
window_device # 4 ; Pointer to Device ID for this window.
window_update # 4 ; Flag to show that the window is out of step
window_discname # 4 ; Pointer to device name.
no_change # 4 ; flag to indicate whether I need to rewrite the textual fields
size_ascii # 4 ; value for the textual field
used_ascii # 4 ; value for the textual field
free_ascii # 4 ; value for the textual field
window_namelength # 4 ; Length of name.
ASSERT next_ptr=0
window_block_size * (@-next_ptr)
; Linked block structure for FS entry points.
^ 0
fs_next # 4 ; Pointer to next in chain ( <= 0 if none)
fs_prev # 4 ; Pointer to previous entry in chain ( <= 0 if none)
fs_number # 4 ; FS number.
fs_entry # 4 ; Entry point address
fs_r12 # 4 ; R12 on entry.
ASSERT fs_next=0
fs_block_size * (@-fs_next)
; Workspace layout
indirected_space * 512
workspace RN R12
^ 0,workspace
wsorigin # 0
mytaskhandle # 4 ; put here so we know where it is
windows_ptr # 4 ; head of list of buffered files
poll_word # 4 ; To let forground task know about service calls.
full_bar # 4 ; Size of 100% bar.
fs_list # 4 ; List of FS entry points
disc_name # 4 ; Disc name for filecore
disc_desc # 64 ; Disc descriptor for filecore
message_fblock # 16 ; MessageTrans file descriptor block
message_fopen # 4 ; Message file open flag
indirected_data_offset * (@-wsorigin)
indirected_data # indirected_space ; Data area for indirected data from the template file
ALIGNHASH wsorigin,16
dataarea # &100 ; wimp data block
windowarea # &300 ; Place to store window template.
stackbot # &200 ; stack at most 512 bytes long
stacktop # 0
max_running_work * (@-wsorigin)
; ---------------------------------------------------------------------------------------------------------------------
; Icon values in template
icon_Size * 8
icon_SizeBar * 5
icon_Free * 7
icon_FreeBar * 6
icon_Used * 1
icon_UsedBar * 4
; ----------------------------------------------------------------------------------------------------------------------
LNK s.ModHead
; Copyright 1996 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.
;
; > s.Messages
; Received a recorded message
message_received_ack
; ----------------------------------------------------------------------------------------------------------------------
; Received an unrecorded message
message_received
Push "LR"
LDR r0, [r1,#ms_action]
TEQ r0, #Message_Quit
BEQ quit_routine
Pull "PC"
LTORG
; ----------------------------------------------------------------------------------------------------------------------
copy_r0r4_null
01
LDRB r6, [r4], #1
STRB r6, [r0], #1
CMP r6, #0
BNE %BT01
SUB r0, r0, #1
MOV PC, LR
; ----------------------------------------------------------------------------------------------------------------------
; CLose all icons windows
quit_routine
ADR r2, windows_ptr
BL free_list
LDR r1, task_storev2
LDR r0, mytaskhandle
SWI XWimp_CloseDown
MOV r0, #0
STR r0, mytaskhandle
SWI OS_Exit
task_storev2
DCB "TASK"
; ----------------------------------------------------------------------------------------------------------------------
LNK s.ADFS
; Copyright 1996 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.
;
; > s.ModHead
LEADR Module_LoadAddr
ASSERT (.=Module_BaseAddr)
MySWIBase * Module_SWISystemBase + FreeSWI * Module_SWIChunkSize
DCD Start - Module_BaseAddr
DCD Init - Module_BaseAddr
DCD Die - Module_BaseAddr
DCD Service - Module_BaseAddr
DCD Title - Module_BaseAddr
DCD Helpstr - Module_BaseAddr
DCD Helptable - Module_BaseAddr
DCD MySWIBase
DCD Free_SWIdecode - Module_BaseAddr
DCD Free_SWInames - Module_BaseAddr
DCD 0
[ International_Help <> 0
DCD message_filename - Module_BaseAddr
|
DCD 0
]
; ----------------------------------------------------------------------------------------------------------------------
Title DCB "Free",0
Helpstr DCB "Free",9,9,"$VString ($Date)",0
ALIGN
Taskid DCB "TASK"
ALIGN
; ----------------------------------------------------------------------------------------------------------------------
; Handle *Desktop_Free - only enter modules if after a Service_StartWimp
Desktop_Free_Code
Push "LR"
LDR r12, [r12]
LDR r14, mytaskhandle
CMP r14, #-1
MOVEQ r2, r0 ; r2 --> command tail
MOVEQ r0, #ModHandReason_Enter
ADREQ r1, Title
SWIEQ XOS_Module
01
ADR r0, ErrorBlock_CantStartFree
ADR r1, Title
BL LookupError
Pull "PC"
; ----------------------------------------------------------------------------------------------------------------------
; Error block for use of *Desktop_Free
ErrorBlock_CantStartFree
DCD 0
DCB "UseDesk",0
ALIGN
; ----------------------------------------------------------------------------------------------------------------------
Helptable
; ----------------------------------------------------------------------------------------------------------------------
Freecommand
Command Desktop_Free,0,0,International_Help
Command ShowFree,3,3,International_Help
DCB 0
; ----------------------------------------------------------------------------------------------------------------------
[ International_Help=0
Desktop_Free_Help
DCB "The Free utility displays free space information for the desktop filers"
DCB 13,10
DCB "Do not use *Desktop_Free use *Desktop instead."
DCB 0
Desktop_Free_Syntax
DCB "Syntax: *Desktop_Free",0
ALIGN
; ----------------------------------------------------------------------------------------------------------------------
ShowFree_Help
DCB "*ShowFree shows the amount of free space on devices.",0
ShowFree_Syntax
DCB "Syntax: *ShowFree -FS <Filing system name> <Device>",0
|
Desktop_Free_Help DCB "HFREDFR", 0
Desktop_Free_Syntax DCB "SFREDFR", 0
ShowFree_Help DCB "HFRESHF", 0
ShowFree_Syntax DCB "SFRESHF", 0
]
ShowFreeArgs
DCB "FS/A/K,Device",0
ALIGN
ErrorBlock_UnknownFileSystem
DCD 0
DCB "UnkFS",0
ALIGN
ErrorBlock_NotStarted
DCD 0
DCB "NotRun",0
ALIGN
; ----------------------------------------------------------------------------------------------------------------------
ShowFree_Code
Push "LR"
LDR r12,[r12]
CMP r12,#0
Pull "PC",LE
LDR r14,mytaskhandle
CMP r14,#0
ADRLE r0,ErrorBlock_NotStarted
MOVLE r1,#0
BLLE LookupError
Pull "PC",VS
MOV r1,r0
ADR r0,ShowFreeArgs
ADR r2,dataarea
MOV r3,#&100
SWI XOS_ReadArgs ; Get arguments
Pull "PC",VS
MOV r5,r2
LDR r1,[r2] ; Pointer to FS name.
DebugS xx,"FSName is ",r1
MOV r2,#0
MOV r0,#13
SWI XOS_FSControl ; Get filing system number.
CMP r2,#0
ADREQ r0,ErrorBlock_UnknownFileSystem
MOVEQ r1,#0
BLEQ LookupError
Pull "PC",VS
Debug xx,"Filing system number ",r1
LDR r3,[r5,#4] ; Pointer to device ID.
MOV r0,#FreeReason_GetName
ADR r2,dataarea
BL CallEntry ; [r2] -> Name r0 = length of name.
Pull "PC",VS
MOV r5,r0 ; Save length.
; See if we already have a window open for this device.
ADR r0,windows_ptr
01
LDR r0,[r0,#next_ptr]
CMP r0,#0
BEQ create_window
LDR r14,[r0,#window_fs]
CMP r14,r1
BNE %BT01
LDR r14,[r0,#window_device]
CMPSTR r14,r2
BNE %BT01
Debug xx,"Window found"
MOV r14,#1 :SHL: 31
STR r14,[r0,#window_update] ; Mark window for update & open at front.
STR r14,poll_word ; Set poll word
Pull "PC" ; Return.
create_window ; Window not found, create new window block.
MOV r3,#window_block_size
ADD r3,r3,r5 ; Plus length of name.
MOV r0,#6
SWI XOS_Module ; Claim block.
Pull "PC",VS
LDR r0,windows_ptr
STR r0,[r2,#next_ptr]
CMP r0,#0
STRGT r2,[r0,#prev_ptr]
MOV r0,#0 ; link to start of list.
STR r0,[r2,#prev_ptr]
STR r2,windows_ptr
MOV r0,#-1
STR r0,[r2,#window_handle] ; Not created yet
MOV r0,#1:SHL:31
STR r0,[r2,#window_update] ; Needs update.
STR r0,poll_word ; Set poll word.
STR r1,[r2,#window_fs] ; FS number
STR r5,[r2,#window_namelength] ; length of device ID.
ADD r5,r2,#window_block_size
STR r5,[r2,#window_device] ; Device name.
MOV r0,r5
ADR r4,dataarea
BL copy_r0r4_null
Pull "PC" ; Return.
; ----------------------------------------------------------------------------------------------------------------------
; Module initialisation point
Init Entry
[ debugmsg
ADR r0, resourcefiles
SWI XResourceFS_RegisterFiles ; ignore errors
]
LDR r2, [r12]
CMP r2, #0 ; clears V
BNE %FT01
MOV r0, #6
MOV r3, #max_running_work
SWI XOS_Module
EXIT VS
STR r2, [r12]
01
MOV r12, r2
MOV r0, #0
STR r0, windows_ptr
STR r0, mytaskhandle
STR r0, fs_list
STR r0, message_fopen
; Claim UpCallV
MOV r0,#UpCallV
ADR r1,UpCall_handler
MOV r2,r12
SWI XOS_Claim
; Add entry points that are in this module
MOV r2,r12
ADRL r0,adfs_entry ; ADFS
MOV r1,#8
BL AddEntry
ADRL r0,RamFS_entry ; RamFS
MOV r1,#23
BL AddEntry
ADRL r0,SCSIFS_entry ; SCSI
MOV r1,#26
BL AddEntry
ADRL r0,NETFS_entry ; Econet
MOV r1,#5
BL AddEntry
ADRL r0,NFS_entry ; NFS
MOV r1,#33
BL AddEntry
; initialise Free$Path if not already done
ADR R0, Path
MOV R2, #-1
MOV R3, #0
MOV R4, #VarType_Expanded
SWI XOS_ReadVarVal ; returns R2=0 if doesn't exist
CMP R2, #0 ; clears V as well!
ADREQ R0, Path
ADREQ R1, PathDefault
MOVEQ R2, #?PathDefault
MOVEQ R3, #0
MOVEQ R4, #VarType_String
SWIEQ XOS_SetVarVal
EXIT
Path DCB "Free$Path"
DCB 0
PathDefault DCB "Resources:$.Resources.Free."
DCB 0
ALIGN
; ----------------------------------------------------------------------------------------------------------------------
; Module service entry point
Service
TEQ r1, #Service_StartWimp
TEQNE r1, #Service_StartedWimp
TEQNE r1, #Service_Reset
TEQNE r1, #Service_MemoryMoved
[ debugmsg
TEQNE r1, #Service_ResourceFSStarting
]
MOVNES pc, lr
LDR R12, [R12]
TEQ R1,#Service_StartWimp
BEQ svc_startwimp
TEQ R1,#Service_StartedWimp
BEQ svc_startedwimp
TEQ R1,#Service_Reset
BEQ svc_reset
TEQ R1,#Service_MemoryMoved
BEQ svc_memorymoved
[ debugmsg
TEQ R1,#Service_ResourceFSStarting
BEQ svc_resourcefsstarting
]
MOV PC,LR
; ----------------------------------------------------------------------------------------------------------------------
; Wimp call to ask task to start up. Claimed by setting task_handle to -1, but only if 0 to start with
svc_startwimp Entry
LDR r14, mytaskhandle
TEQ r14, #0
MOVEQ r14, #-1
STREQ r14, mytaskhandle
ADREQL r0, Freecommand
MOVEQ R1, #0
EXIT
; ----------------------------------------------------------------------------------------------------------------------
; Wimp has finished starting the tasks. If task handle=-1 then start up failed, so reset to 0.
svc_startedwimp Entry
; Test task handle to see if in starting sequence, or if started succesfully
LDR r14, mytaskhandle
CMP r14, #-1
MOVEQ r14, #0 ; unset flag (so user can retry)
STREQ r14, mytaskhandle
EXIT
LTORG
; ----------------------------------------------------------------------------------------------------------------------
; Reset button pressed. Wimp has shut down. Reset task handle to 0. Release linked lists of icons.
svc_reset Entry "r0-r3"
Debug xx,"FREE - RESET"
ADR r2, windows_ptr
BL free_list ; Free buffered list
[ Version < 4 ; Don't forget about Filing systems we know.
ADR r2, fs_list
BL free_list ; Free buffered list
]
MOV r0, #0 ; Clear task handle
STR r0, mytaskhandle
; Claim UpCallV
MOV r0,#UpCallV
ADR r1,UpCall_handler
MOV r2,r12
SWI XOS_Claim
EXITS
[ debugmsg
; ----------------------------------------------------------------------------------------------------------------------
; ResourceFS is restarting - we need to re-register our resource files
svc_resourcefsstarting Entry "r0"
ADR R0, resourcefiles
MOV LR, PC ; LR -> return address
MOV PC, R2 ; R2 -> code to call (R3 = workspace ptr)
EXITS
]
; ----------------------------------------------------------------------------------------------------------------------
; Memory moved , check if RAM disc removed.
svc_memorymoved Entry "r0-r1"
MOV r0,#5
SWI XOS_ReadDynamicArea
Debug xx,"RAM disc size is ",r1
ADR r0,windows_ptr
01
LDR r0,[r0,#next_ptr]
CMP r0,#0
BEQ %FT02
LDR r14,[r0,#window_fs]
CMP r14,#23 ; RAMFS ?
BNE %BT01
Debug xx,"RAMFS window found."
CMP r1,#0
MOVEQ r14,#1 :SHL: 30 ; Mark for delete.
MOVNE r14,#1
STR r14,[r0,#window_update]
STR r14,poll_word
B %BT01
02
EXITS
; ----------------------------------------------------------------------------------------------------------------------
; RMKill'ing the module
Die Entry "r7-r11"
LDR r12, [r12]
; Close down the wimp end
LDR r0, mytaskhandle
CMP r0, #0
LDRGT r1, Taskid
SWIGT XWimp_CloseDown
; Release UpCallV
MOV r0,#UpCallV
ADR r1,UpCall_handler
MOV r2,r12
SWI XOS_Release
; Delete lists of icons
ADR r2, windows_ptr
BL free_list ; Free buffered list
ADR r2, fs_list
BL free_list ; Free buffered list
; Close messages file
LDR r0, message_fopen
TEQ r0, #0
SWINE XMessageTrans_CloseFile
[ Version < 10
; Release all workspace (dealt with by OS_Module)
MOV r2, r12
MOV r0, #ModHandReason_Free
SWI XOS_Module
]
[ debugmsg
; Deregister ResourceFS files
ADR r0, resourcefiles
SWI XResourceFS_DeregisterFiles
]
EXITS ; don't refuse to die
; ----------------------------------------------------------------------------------------------------------------------
; On UpCall 3, mark all related windows as needing update.
UpCall_handler ROUT
TEQ r0, #UpCall_ModifyingFile
MOVNES pc, lr
Push "LR"
[ {FALSE}
SWI XOS_WriteI+'?'
]
; Check for the right modifying file reason
TEQ r9, #upfsfile_Save
TEQNE r9, #upfsfile_Delete
TEQNE r9, #upfsfile_Create
TEQNE r9, #upfsfile_CreateDir
LDRNE r14, =upfsopen_CreateUpdate
TEQNE r9, r14
LDRNE r14, =upfsclose
TEQNE r9, r14
TEQNE r9, #upfsargs_EnsureSize
Pull "PC",NE,^
; Reason code's right - save the registers and start looking..
Push "r0-r11"
MOV r10, sp ; frame pointer
[ {FALSE}
SWI XOS_WriteI+'U'
TEQ r9,#upfsfile_Save
SWIEQ XOS_WriteI+'0'
TEQ r9,#upfsfile_Delete
SWIEQ XOS_WriteI+'1'
TEQ r9,#upfsfile_Create
SWIEQ XOS_WriteI+'1'
TEQ r9,#upfsfile_CreateDir
SWIEQ XOS_WriteI+'2'
TEQ r9,#upfsargs_EnsureSize
SWIEQ XOS_WriteI+'3'
LDR r14,=upfsopen_CreateUpdate
TEQ r9,r14
SWIEQ XOS_WriteI+'4'
LDR r14,=upfsclose
TEQ r9,r14
SWIEQ XOS_WriteI+'5'
]
; Close or Ensure size then we want to get the filename for the file
TEQ r9, #upfsargs_EnsureSize
LDRNE r14, =upfsclose
TEQNE r9, r14
BNE %FT10
; Read buffer size and round up to a word
MOV r0, #OSArgs_ReadPath
MOV r2, #ARM_CC_Mask
MOV r5, #0
SWI XOS_Args
BVS %FT05
RSB r5, r5, #3+1
BIC r5, r5, #3
SUB sp, sp, r5
; Read the filename
MOV r0, #OSArgs_ReadPath
MOV r2, sp
SWI XOS_Args
BVS %FT05
MOV r1, sp
; Skip past the 1st ':' in <FS>::<disc>.$.....
01
LDRB r14, [r1], #1
TEQ r14, #':'
BNE %BT01
10
AND r8, r8, #&ff
MOV r2, r1
[ {FALSE}
MOV r0,r1
SWI XOS_Write0
SWI XOS_NewLine
]
ADR r11, windows_ptr
B %FT04
03
; If window's fs is right, window hasn't already been marked for update,
; and the window's path matches ours then mark for update
LDR r14, [r11,#window_fs]
CMP r14, r8
LDREQ r14, [r11,#window_update]
TEQEQ r14, #0
LDREQ r3, [r11, #window_device]
MOVEQ r0, #FreeReason_ComparePath
MOVEQ r1, r8
BLEQ CallEntry
BVS %FT05
; Match - mark window needing update and set poll_word
STREQ r11, [r11, #window_update]
STREQ r11, poll_word
04
LDR r11, [r11, #next_ptr]
CMP r11, #0
BNE %BT03
05
MOV sp, r10
Pull "r0-r11,PC",,^
; ----------------------------------------------------------------------------------------------------------------------
[ debugmsg
resourcefiles
ResourceFile Templates.Templates, Resources.Free.Templates
ResourceFile Messages, Resources.Free.Messages
DCD 0
]
ALIGN
LNK s.StartLoop
; Copyright 1996 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.
;
;-------------------------------------------------------------------------
;
; NETFS_entry
;
; Entry point for NETFS discs.
NETFS_entry
TEQ r0,#FreeReason_GetName
BEQ NETFS_GetName
TEQ r0,#FreeReason_GetSpace
BEQ NETFS_GetSpace
TEQ r0,#FreeReason_ComparePath
BEQ NETFS_ComparePath
Pull "PC"
;-----------------------------------------------------------------------
; NETFS_GetName
;
; Put the name of the drive specified in r3 into the buffer at r2
;
NETFS_GetName
Push "r1-r3"
Debug xx,"Get NETFS name"
ADD r3,r3,#1 ; Skip ':'
MOV r1,r3
01
LDRB r0,[r1],#1
CMP r0,#32
MOVLT r0,#0
STRB r0,[r2],#1 ; Copy to buffer
BGE %BT01
SUB r0,r1,r3 ; Length of string + terminator.
Pull "r1-r3,PC"
;-----------------------------------------------------------------------
; NETFS_GetSpace
;
; Put the free space on the drive specified in r3 into the buffer at r2
;
NETFS_GetSpace
Push "r1-r6"
MOV r5,r3
MOV r14,r2
Debug xx,"NETFS Get space - Enumerate File servers."
DebugS xx,"looking for ",r3
MOV r0,#0
01
ADR r1,dataarea
MOV r2,#&100
MOV r3,#1
SWI XNetFS_EnumerateFSList
Pull "r1-r6,PC",VS
ADD r2,r1,#3
CMPSTR r2,r5 ; Is this the disc we are looking for ?
BEQ %FT02
CMP r0,#-1
BNE %BT01
ADR r0,ErrorBlock_NotLoggedOn ; Not found.
MOV r1,#0
BL LookupError
Pull "r1-r6,PC"
02
Debug xx,"Found server"
SUB r6,r0,#1 ; Server number.
MOV r0,#FileServer_ReadDiscFreeSpace ; Get Disc free space
ADD r1,r1,#3 ; Pointer to FS name
MOV r2,r1 ; Compute disc name.
77 LDRB r3,[r2],#1
CMP r3,#32
MOVLE r3,#&0D
STRLEB r3,[r2,#-1] ; Put CR at end !!!!!!!!!
BGT %BT77
SUB r2,r2,r1 ; Get length.
MOV r3,#&100 ; Size of buffer.
LDRB r4,[r1,#-3] ; Station number
LDRB r5,[r1,#-2] ; Net number
Debug xx,"r4 r5",r4,r5
SWI XNetFS_DoFSOpToGivenFS
Pull "r1-r6,PC",VS
Debug xx,"r4 r5",r4,r5
Debug xx,"Read free disc space & disc size."
LDRB r0,[r1,#2] ; Store disc size in buffer.
LDRB r2,[r1,#1]
ADD r0,r2,r0,ASL #8
LDRB r2,[r1,#0]
ADD r0,r2,r0,ASL #8 ; r0 = free disc space
MOV r0,r0,ASL #8
LDRB r3,[r1,#5] ; Store disc size in buffer.
LDRB r2,[r1,#4]
ADD r3,r2,r3,ASL #8
LDRB r2,[r1,#3]
ADD r3,r2,r3,ASL #8 ; r3 = Total disc space
MOV r3,r3,ASL #8
STR r3,[r14] ; Store size
SUB r3,r3,r0
STR r3,[r14,#8] ; Used space.
; MOV r0,r6;
ADR r1,dataarea+40
; MOV r2,#&100
; MOV r3,#1
; SWI XNetFS_EnumerateFSList
; Pull "r1-r6,PC",VS
MOV r2,#1 ; Send <CR>
MOV r3,#&100 ; Size of buffer.
; LDRB r4,[r1] ; Station number
; LDRB r5,[r1,#1] ; Net number
MOV r0,#&0d
STRB r0,[r1]
MOV r0,#FileServer_ReadUserFreeSpace ; Get user free space
Debug xx,"Read free space from n,s",r5,r4
SWI XNetFS_DoFSOpToGivenFS
Pull "r1-r6,PC",VS
LDR r0,[r1]
Debug xx,"Read user free space.",r0
STR r0,[R14,#4]
[ Version >= 6 ; Free space cannot be more than disc size.
LDR r1,[r14]
LDR r2,[r14,#8] ; Used space
SUB r1,r1,r2 ; r1 = free disc space
CMP r0,r1 ; if greater
STRCS r1,[R14,#4] ; store disc size as free space.
CLRV
]
Pull "r1-r6,PC"
;-------------------------------------------------------------------
ErrorBlock_NotLoggedOn
DCD 0
DCB "NotLogd",0
ALIGN
;-------------------------------------------------------------------------
; NETFS_ComparePath
;
;
NETFS_ComparePath
Debug xx,"NETFS compare path"
CMP r6,#0
Pull "PC",EQ
CMPSTR r3,r6
Pull "PC"
LNK s.NFS
; Copyright 1996 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.
;
NFS_FreeSpace * &410c5
XNFS_FreeSpace * NFS_FreeSpace :OR: Auto_Error_SWI_bit
;-------------------------------------------------------------------------
;
; NFS_entry
;
; Entry point for NFS discs.
NFS_entry
TEQ r0,#FreeReason_GetName
BEQ NFS_GetName
TEQ r0,#FreeReason_GetSpace
BEQ NFS_GetSpace
TEQ r0,#FreeReason_ComparePath
BEQ NFS_ComparePath
Pull "PC"
;-----------------------------------------------------------------------
; NFS_GetName
;
; Put the name of the drive specified in r3 into the buffer at r2
;
NFS_GetName
Push "r1-r3"
Debug xx,"Get NFS name"
MOV r1,r3
LDRB r0,[r1]
CMP r0,#":"
ADDEQ r1,r1,#1
01
LDRB r0,[r1],#1
STRB r0,[r2],#1
CMP r0,#0
BNE %BT01
SUB r0,r1,r3 ; Length of string + terminator.
Pull "r1-r3,PC"
;-----------------------------------------------------------------------
; NFS_GetSpace
;
; Put the free space on the drive specified in r3 into the buffer at r2
;
NFS_GetSpace
Push "r1-r3"
Debug xx,"NFS Get space"
MOV r14,r2
MOV r1,r3
SWI XNFS_FreeSpace
Pull "r1-r3,PC",VS
STR r2,[r14]
STR r0,[r14,#4] ; Free space
SUB r2,r2,r3
STR r2,[r14,#8] ; used space
Pull "r1-r3,PC"
;-------------------------------------------------------------------------
; NFS_ComparePath
;
;
NFS_ComparePath
Push "r0-r9"
Debug xx,"NFS compare path"
ADD r2,r2,#1
ADR r1,dataarea
01
LDRB r0,[r2],#1
CMP r0,#"."
Debug xx,"Copy ",r0
MOVEQ r0,#0
STRB r0,[r1],#1
CMP r0,#0
BNE %BT01 ; Copy to first "."
ADR r2,dataarea
CMPSTR r2,r3
Pull "r0-r9,PC"
LNK s.SWIs
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment