OSARGS
From BeebWiki
Read or write information on open objects or the filing system
Contents |
Specification
| On entry: | |
| A | = function code |
| X | =>zero page data block |
| Y | = handle |
| On exit: | |
| A | = &00 or return value, or preserved if function not supported. Some filing systems always preserve A except when returning the filing system number. |
| X | preserved |
| Y | preserved |
| zero page data block updated | |
| Functions, handle=0 | |
| &FD | Return filing system information to zero page. |
| &FE | Return last drive used to zero page. |
| &FF | Update all files to media. |
| &00 | Return filing system number in A:
0 No current filing system 20 RawKbd: 1 1200 baud cassette filing system 21 DeskFS: 2 300 baud cassette filing system 22 Computer Concepts RomFS: 3 ROM filing system 23 RamFS: 4 Disk filing system 24 RISCiXFS: 5 Econet network filing system 25 Streamer: 6 Teletext/Prestel telesoftware 26 SCSIFS: 7 IEEE filing system 27 Digitiser: 8 Acorn ADFS 28 Scanner: 9 Host filing system 29 MultiFS: 10 Videodisk filing system 11 33 NFS: 12 RAM filing system NetPrint: 37 CDFS: 13 Null: 43 DOSFS: 14 Printer: 46 ResourceFS: 15 Serial: 47 PipeFS: 16 Harston ADFS 17 Vdu: 53 DeviceFS: 18 RawVdu: 54 Parallel: 19 Kbd: |
| &01 | Return address of any parameters after a filename (command line tail) to zero page. The character at the address is the first non-space character after the name of the command (for example the 2 in *FORM80 2.) |
| &02 | Return version number in A. |
| &03 | Return libfs number in A. |
| &04 | Return disk space used to zero page. |
| &05 | Return disk free space to zero page. |
| Functions, handle<>0 | |
| &80 | Read information on handle. |
| &FD | Read or write filing system information. |
| &FE | RISC OS: Read info on file handle. |
| &FF | Update file on channel Y to media. |
| &00 | Read PTR for channel Y to zero page. |
| &01 | Write PTR for channel Y from zero page. If PTR is moved past the end of an output file, the file is extended with zeroes and zero returned in A, otherwise A = &FF on exit. Some filing systems do not write zeroes; the contents of the new part of the file are undefined. If PTR is moved past the end of an input file, an error is generated, either then or on the 2nd subsequent read. The EOF-error-flag is cleared. |
| &02 | Read EXT for channel Y to zero page. |
| &03 | Write EXT for channel Y. If the length of the file is reduced, the end disappears. If the length is increased, the file is extended as with &01 and zero is returned in A, otherwise A = &FF on exit. The EOF-error-flag is cleared. |
| &04 | Read size allocated to file on channel Y to zero page. |
| &05 | Read EOF status for channel Y. If PTR=EXT then zero page is set to -1, else zero page is set to 0. |
| &06 | Ensure file size of at least the value in zero page. Actual size allocated is returned in zero page. |
| &07 | RISC OS: Convert file handle to filename. R0 = 7, R1 contains the file handle, and R2 points to a buffer, the size of which is given in R5. On exit the buffer contains the filename as a NUL-terminated string, R2
is preserved, and R5 is decreased by the number of characters in the filename excluding the NUL. The NUL is addressed by R2 + R5entry - R5exit. |
| &08 | RISC OS: Informs of change in image stamp. |
If zero page is not used, then it is ignored and so X may be left set to anything on entry.
Calling from BBC BASIC
-
ptr=PTR#chcalls OSARGS 0,ch -
PTR#chn,ptrcalls OSARGS 1,ch -
ptr=EXT#chcalls OSARGS 2,ch -
EXT#ch=ptrcalls OSARGS 3,ch -
=EOF#chcalls OSBYTE 127 on 8-bit systems, which vectors via FSCV. Otherwise,=EOF#chcalls OSARGS 5,ch.
Special handles
Z88 allows:
Entry points
- BBC BASIC Entry Address: &FFDA
- 6502 Entry Address: &FFDA, vectors via &0214
- Z80 Entry Address: &FFDA, vectors via &FFDB
- 6809 Entry Address:
- 80x86 Entry Address: INT &44, vectors via 0000:0110
- 32000 Entry Address: SVC &0C
- PDP-11 Entry Address: EMT 8, vector &08
- ARM Entry Address: SWI &09 "OS_Args", vector &09
Implementations
CFS
Not implemented, simply returns with an RTS instruction {check Master}.
ROMFS
Not implemented, simply returns with an RTS instruction {check Master}.
DFS
Acorn DFS 0.xx and 1.xx implements &FF to &02. DFS 2.xx and later also implement &03.
HDFS
Andrew Duggan's Hierarchial DFS implements OSARGS &03,Y as 'Read allocated space' instead of 'Write extent'.
Watford DFS
Implements &FE to &02. OSARGS &FE preserves A, so zero page has to be examined to see if the call has been acted on with code such as:
drive%=FNargs(&FE,-1)AND&FF
drive% will be &FF if not supported, or the drive number if it is.
NFS
NFS 3.34 returns the command line address incorrectly. It points to the first non-'*' character of the command, not the first character of the parameters. NFS 3.60 and later return the command line address correctly. NFS 3.60 and later return A<>2 from OSARGS 2,0 to indicate this.
ADFS
HADFS
Implements &FD to &06.
Notes
OSARGS &FE returns to zero page, not to A.
Jgharston 10:53, 2 September 2008 (BST)

