Difference between revisions of "Handles"

From BeebWiki
Jump to: navigation, search
m (1 revision)
(XDFS provisional allocation)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Filing]]
 
[[Category:Filing]]
 
===Summary===
 
===Summary===
  CFS     &01-&02    HADFS    &19-&1D    VFS       &50-&59    BEEBITFS  &B0-&BF
+
  CFS       &01-&02    SRAMFS  &16-&18    DOSFS    &40-&47    IOFS      &80-&9F
  ROMFS  &03        LanManFS &20-&23    RAMFS     &60-&64    COPROFS  &C0-&CC
+
ROMFS    &03        HADFS    &19-&1D    VFS     &50-&59    LINKFS    &A0-&AF
  TFS    &0E-&0F    NFS      &20-&27    ARAMFS   &60-&65    IEEEFS    &F0-&FF
+
  TFS      &0E-&0F    LanManFS &20-&23    RAMFS   &60-&64    BEEBITFS  &B0-&BF
  DFS     &11-&15    ANFS    &20-&2F   HOSTFS   &80-&9F    NEXUSFS
+
  VaxHostFS &0E-&0F    NFS      &20-&27    ARAMFS   &60-&65    COPROFS  &C0-&CC
  HDFS   &12-&17    ADFS    &30-&39    IOFS      &80-&9F
+
  DFS       &11-&15    ANFS    &20-&2F   (XDFS    &70-&7A)  IEEEFS   &F0-&FF
  SRAMFS &16-&18    DOSFS    &40-&47    LINKFS    &A0-&AF
+
  HDFS     &12-&17    ADFS    &30-&39    HOSTFS  &80-&9F   NEXUSFS
 +
   
 +
  XDFS provisional allocation
  
 
===Full List===
 
===Full List===
  &00  0 No opened file    &50  80 VFS                  &B0 176 BeebItFS
+
  &00  0 No opened file    &50  80 VFS                  &B0 176 BeebItFS, BeebLink
  &01  1 CFS (in)          &51  81 VFS                  &B1 177 BeebItFS
+
  &01  1 CFS (in)          &51  81 VFS                  &B1 177 BeebItFS, BeebLink
  &02  2 CFS (out)          &52  82 VFS                  &B2 178 BeebItFS
+
  &02  2 CFS (out)          &52  82 VFS                  &B2 178 BeebItFS, BeebLink
  &03  3 ROMFS              &53  83 VFS                  &B3 179 BeebItFS
+
  &03  3 ROMFS              &53  83 VFS                  &B3 179 BeebItFS, BeebLink
  &04  4                    &54  84 VFS                  &B4 180 BeebItFS
+
  &04  4                    &54  84 VFS                  &B4 180 BeebItFS, BeebLink
  &05  5                    &55  85 VFS                  &B5 181 BeebItFS
+
  &05  5                    &55  85 VFS                  &B5 181 BeebItFS, BeebLink
  &06  6                    &56  86 VFS                  &B6 182 BeebItFS
+
  &06  6                    &56  86 VFS                  &B6 182 BeebItFS, BeebLink
  &07  7                    &57  87 VFS                  &B7 183 BeebItFS
+
  &07  7                    &57  87 VFS                  &B7 183 BeebItFS, BeebLink
  &08  8                    &58  88 VFS                  &B8 184 BeebItFS
+
  &08  8                    &58  88 VFS                  &B8 184 BeebItFS, BeebLink
  &09  9                    &59  89 VFS                  &B9 185 BeebItFS
+
  &09  9                    &59  89 VFS                  &B9 185 BeebItFS, BeebLink
  &0A  10                    &5A  80                      &BA 186 BeebItFS
+
  &0A  10                    &5A  80                      &BA 186 BeebItFS, BeebLink
  &0B  11                    &5B  91                      &BB 187 BeebItFS
+
  &0B  11                    &5B  91                      &BB 187 BeebItFS, BeebLink
  &0C  12                    &5C  92                      &BC 188 BeebItFS
+
  &0C  12                    &5C  92                      &BC 188 BeebItFS, BeebLink
  &0D  13                    &5D  93                      &BD 189 BeebItFS
+
  &0D  13                    &5D  93                      &BD 189 BeebItFS, BeebLink
  &0E  14 TFS               &5E  94                      &BE 190 BeebItFS
+
  &0E  14 TFS, VaxHostFS    &5E  94                      &BE 190 BeebItFS, BeebLink
  &0F  15 TFS               &5F  95                      &BF 191 BeebItFS
+
  &0F  15 TFS, VaxHostFS    &5F  95                      &BF 191 BeebItFS, BeebLink
 
   
 
   
 
  &10  16                    &60  96 Acacia RAMFS, RAMFS  &C0 192 COPROFS
 
  &10  16                    &60  96 Acacia RAMFS, RAMFS  &C0 192 COPROFS
Line 77: Line 79:
 
  &3F  63                    &9F 159 IOFS, HostFS        &EF 239
 
  &3F  63                    &9F 159 IOFS, HostFS        &EF 239
 
   
 
   
  &40  64 DOSFS              &A0 160 LFS                 &F0 240 IEEEFS
+
  &40  64 DOSFS              &A0 160 LFS, BeebLink*      &F0 240 IEEEFS
  &41  65 DOSFS              &A1 161 LFS                 &F1 241 IEEEFS
+
  &41  65 DOSFS              &A1 161 LFS, BeebLink*      &F1 241 IEEEFS
  &42  66 DOSFS              &A2 162 LFS                 &F2 242 IEEEFS
+
  &42  66 DOSFS              &A2 162 LFS, BeebLink*      &F2 242 IEEEFS
  &43  67 DOSFS              &A3 163 LFS                 &F3 243 IEEEFS
+
  &43  67 DOSFS              &A3 163 LFS, BeebLink*      &F3 243 IEEEFS
  &44  68 DOSFS              &A4 164 LFS                 &F4 244 IEEEFS
+
  &44  68 DOSFS              &A4 164 LFS, BeebLink*      &F4 244 IEEEFS
  &45  69 DOSFS              &A5 165 LFS                 &F5 245 IEEEFS
+
  &45  69 DOSFS              &A5 165 LFS, BeebLink*      &F5 245 IEEEFS
  &46  70 DOSFS              &A6 166 LFS                 &F6 246 IEEEFS
+
  &46  70 DOSFS              &A6 166 LFS, BeebLink*      &F6 246 IEEEFS
  &47  71 DOSFS              &A7 167 LFS                 &F7 247 IEEEFS
+
  &47  71 DOSFS              &A7 167 LFS, BeebLink*      &F7 247 IEEEFS
  &48  72                    &A8 168 LFS                 &F8 248 IEEEFS
+
  &48  72                    &A8 168 LFS, BeebLink*      &F8 248 IEEEFS
  &49  73                    &A9 169 LFS                 &F9 249 IEEEFS
+
  &49  73                    &A9 169 LFS, BeebLink*      &F9 249 IEEEFS
  &4A  74                    &AA 170 LFS                 &FA 250 IEEEFS
+
  &4A  74                    &AA 170 LFS, BeebLink*      &FA 250 IEEEFS
  &4B  75                    &AB 171 LFS                 &FB 251 IEEEFS
+
  &4B  75                    &AB 171 LFS, BeebLink*      &FB 251 IEEEFS
  &4C  76                    &AC 172 LFS                 &FC 252 IEEEFS
+
  &4C  76                    &AC 172 LFS, BeebLink*      &FC 252 IEEEFS
  &4D  77                    &AD 173 LFS                 &FD 253 IEEEFS
+
  &4D  77                    &AD 173 LFS, BeebLink*      &FD 253 IEEEFS
  &4E  78                    &AE 174 LFS                 &FE 254 IEEEFS
+
  &4E  78                    &AE 174 LFS, BeebLink*      &FE 254 IEEEFS
  &4F  79                    &AF 175 LFS                 &FF 255 IEEEFS
+
  &4F  79                    &AF 175 LFS, BeebLink*      &FF 255 IEEEFS
  
 
===Special cases===
 
===Special cases===
Some systems allow reading and writing to channel 0 to read and write to
+
When reading PTR and EXT from 8-bit BASIC, the data parameter is BASIC's integer store, which will be set to the channel as the last item evaluated. That means that PTR#0 and EXT#0 pass a data value of zero; OSARGS 0,0 and OSARGS 2,0 do not change the data word; this means that in 8-bit BASICs PTR#0 and EXT#0 return zero, being the unchanged data word set to the channel.
OSRDCH and OSWRCH. Some C compilers direct reading from channel 0 to STDIN
+
 
(via OSRDCH) and writing to channels 1 and 2 to STDOUT and STDERR (via
+
This means that other BASICs have the ability to use PTR#0 and EXT#0 to return information specific to that implementation. Some BASICs or operating systems allow other special handles to return specific information.
OSWRCH).
+
 
 +
* The most common case is that channel 0 references the console, ie the keyboard and VDU:
 +
: OSBGET#0 reads from OSRDCH
 +
: OSBPUT#0 writes to OSWRCH
 +
: EOF#0 returns TRUE if the next OSBGET#0 or OSRDCH/GET/INKEY will not return a character without waiting, ie <code>IF NOT EOF#0 THEN key%=GET</code>
 +
: PTR#0 returns platform-specific information
 +
: EXT#0 returns platform-specific information
 +
 
 +
* Some C compilers implement C console handles:
 +
: Reading from channel 0 reads from STDIN (via OSRDCH)
 +
: Writing to channel 1 writes to STDOUT (via OSWRCH)
 +
: Writing to channel 2 writes to STDERR (via OSWRCH).
 +
 
 +
====Known implementations====
 +
 
 +
{| class="wikitable"
 +
! style="text-align:left;" | Implemented at the<br> operating system layer || &nbsp;BGET#0&nbsp; || &nbsp;BPUT#0&nbsp; || &nbsp;OSGBPB#0&nbsp; || &nbsp;EOF#0&nbsp; || &nbsp;PTR#0&nbsp; || &nbsp;EXT#0&nbsp;
 +
|- align="center" valign="top"
 +
| style="text-align:left;" | BBC MOS and CoPros || &nbsp;untested&nbsp; || &nbsp;untested&nbsp; || || &nbsp;error or -1&nbsp; || &nbsp;0&nbsp; || &nbsp;0&nbsp;
 +
|- align="center" valign="top"
 +
| style="text-align:left;" | ARM Development System[1] || &nbsp;<s>OSRDCH</s>&nbsp; || &nbsp;<s>OSWRCH</s>&nbsp; || <s>OSWRCH / OSRDCH</s> || &nbsp;untested&nbsp; || &nbsp;untested&nbsp; || &nbsp;untested&nbsp;
 +
|- align="center" valign="top"
 +
| style="text-align:left;" | PDP11 CoPro || &nbsp;OSRDCH[2]&nbsp; || &nbsp;OSWRCH[2]&nbsp; || || &nbsp;untested&nbsp; || &nbsp;untested&nbsp; || &nbsp;untested&nbsp;
 +
|- align="center" valign="top"
 +
| style="text-align:left;" | TubeHost || OSRDCH || OSWRCH || || 0 if keypress pending || &nbsp;untested&nbsp; || &nbsp;untested&nbsp;
 +
|- align="center" valign="top"
 +
! style="text-align:left;" | Implemented&nbsp;by&nbsp;BASIC || &nbsp;BGET#0&nbsp; || &nbsp;BPUT#0&nbsp; || || &nbsp;EOF#0&nbsp; || &nbsp;PTR#0&nbsp; || &nbsp;EXT#0&nbsp;
 +
|- align="center" valign="top"
 +
| style="text-align:left;" | Windows BASIC || &nbsp;untested&nbsp; || &nbsp;untested&nbsp; || || &nbsp;untested&nbsp; || &nbsp;untested&nbsp; || &nbsp;untested&nbsp;
 +
|- align="center" valign="top"
 +
| style="text-align:left;" | Brandy Basic || || || || || ||
 +
|- align="center" valign="top"
 +
! style="text-align:left;" | Others || &nbsp;BGET#-1&nbsp; || &nbsp;BPUT#-1&nbsp; || || &nbsp;EOF#-1&nbsp; || &nbsp;PTR#-1&nbsp; || &nbsp;EXT#-1&nbsp;
 +
|- align="center" valign="top"
 +
| style="text-align:left;" | Sinclair Z88 || &nbsp;untested&nbsp; || &nbsp;untested&nbsp; || || &nbsp;0=unexpanded, -1=expanded&nbsp; || b0-b15=ROM version, b16=b31=number of<br> handles remaining || &nbsp;amount of free system memory&nbsp;
 +
|}
 +
[1] I'm sure there is an ARM system that does this, needs further investigation<br>
 +
[2] Build option
  
 
===Notes===
 
===Notes===
Line 113: Line 152:
  
 
LanManFS clashes with NFS/ANFS, but the hardware cannot be present at the
 
LanManFS clashes with NFS/ANFS, but the hardware cannot be present at the
same time and the LanManFS Ethernet card plugs into the Econet card sockets.
+
same time as the LanManFS Ethernet card plugs into the Econet card sockets.
 +
 
 +
BeebLink* entries are used by the BeebLink Test FS ROM, which can coexist
 +
with the ordinary BeebLink ROM while testing.
  
 
===References===
 
===References===

Latest revision as of 01:33, 4 September 2023

Summary

CFS       &01-&02    SRAMFS   &16-&18    DOSFS    &40-&47    IOFS      &80-&9F
ROMFS     &03        HADFS    &19-&1D    VFS      &50-&59    LINKFS    &A0-&AF
TFS       &0E-&0F    LanManFS &20-&23    RAMFS    &60-&64    BEEBITFS  &B0-&BF
VaxHostFS &0E-&0F    NFS      &20-&27    ARAMFS   &60-&65    COPROFS   &C0-&CC
DFS       &11-&15    ANFS     &20-&2F   (XDFS     &70-&7A)   IEEEFS    &F0-&FF
HDFS      &12-&17    ADFS     &30-&39    HOSTFS   &80-&9F    NEXUSFS

XDFS provisional allocation

Full List

&00   0 No opened file     &50  80 VFS                  &B0 176 BeebItFS, BeebLink
&01   1 CFS (in)           &51  81 VFS                  &B1 177 BeebItFS, BeebLink
&02   2 CFS (out)          &52  82 VFS                  &B2 178 BeebItFS, BeebLink
&03   3 ROMFS              &53  83 VFS                  &B3 179 BeebItFS, BeebLink
&04   4                    &54  84 VFS                  &B4 180 BeebItFS, BeebLink
&05   5                    &55  85 VFS                  &B5 181 BeebItFS, BeebLink
&06   6                    &56  86 VFS                  &B6 182 BeebItFS, BeebLink
&07   7                    &57  87 VFS                  &B7 183 BeebItFS, BeebLink
&08   8                    &58  88 VFS                  &B8 184 BeebItFS, BeebLink
&09   9                    &59  89 VFS                  &B9 185 BeebItFS, BeebLink
&0A  10                    &5A  80                      &BA 186 BeebItFS, BeebLink
&0B  11                    &5B  91                      &BB 187 BeebItFS, BeebLink
&0C  12                    &5C  92                      &BC 188 BeebItFS, BeebLink
&0D  13                    &5D  93                      &BD 189 BeebItFS, BeebLink
&0E  14 TFS, VaxHostFS     &5E  94                      &BE 190 BeebItFS, BeebLink
&0F  15 TFS, VaxHostFS     &5F  95                      &BF 191 BeebItFS, BeebLink

&10  16                    &60  96 Acacia RAMFS, RAMFS  &C0 192 COPROFS
&11  17 DFS                &61  97 Acacia RAMFS, RAMFS  &C1 193 COPROFS
&12  18 DFS, HDFS          &62  98 Acacia RAMFS, RAMFS  &C2 194 COPROFS
&13  19 DFS, HDFS          &63  99 Acacia RAMFS, RAMFS  &C3 195 COPROFS
&14  20 DFS, HDFS          &64 100 Acacia RAMFS, RAMFS  &C4 196 COPROFS
&15  21 DFS, HDFS          &65 101 Acacia RAMFS         &C5 197 COPROFS
&16  22 Sprow RAMFS, HDFS  &66 102                      &C6 198 COPROFS
&17  23 Sprow RAMFS, HDFS  &67 103                      &C7 199 COPROFS
&18  24 Sprow RAMFS         ..                          &C8 200 COPROFS
&19  25 HADFS               ..                          &C9 201 COPROFS
&1A  26 HADFS              &7A 122                      &CA 202 COPROFS
&1B  27 HADFS              &7B 123                      &CB 203 COPROFS
&1C  28 HADFS              &7C 124                      &CC 204 COPROFS
&1D  29 HADFS              &7D 125                      &CD 205 
&1E  30                    &7E 126                      &CE 206 
&1F  31                    &7F 127                      &CF 207 

&20  32 NFS, ANFS, LanManFS &80 128 IOFS, HostFS        &D0 208
&21  33 NFS, ANFS, LanManFS &81 129 IOFS, HostFS        &D1 209
&22  34 NFS, ANFS, LanManFS &82 130 IOFS, HostFS        &D2 210
&23  35 NFS, ANFS, LanManFS &83 131 IOFS, HostFS        &D3 211
&24  36 NFS, ANFS           &84 132 IOFS, HostFS        &D4 212
&25  37 NFS, ANFS           &85 133 IOFS, HostFS        &D5 213
&26  38 NFS, ANFS           &86 134 IOFS, HostFS        &D6 214
&27  39 NFS, ANFS           &87 135 IOFS, HostFS        &D7 215
&28  40 ANFS                &88 136 IOFS, HostFS        &D8 216
&29  41 ANFS                &89 137 IOFS, HostFS        &D9 217
&2A  42 ANFS                &8A 138 IOFS, HostFS        &DA 218
&2B  43 ANFS                &8B 139 IOFS, HostFS        &DB 219
&2C  44 ANFS                &8C 140 IOFS, HostFS        &DC 220
&2D  45 ANFS                &8D 141 IOFS, HostFS        &DD 221
&2E  46 ANFS                &8E 142 IOFS, HostFS        &DE 222
&2F  47 ANFS                &8F 143 IOFS, HostFS        &DF 223

&30  48 ADFS                &90 144 IOFS, HostFS        &E0 224
&31  49 ADFS                &91 145 IOFS, HostFS        &E1 225
&32  50 ADFS                &92 146 IOFS, HostFS        &E2 226
&33  51 ADFS                &93 147 IOFS, HostFS        &E3 227
&34  52 ADFS                &94 148 IOFS, HostFS        &E4 228
&35  53 ADFS                &95 149 IOFS, HostFS        &E5 229
&36  54 ADFS                &96 150 IOFS, HostFS        &E6 230
&37  55 ADFS                &97 151 IOFS, HostFS        &E7 231
&38  56 ADFS                &98 152 IOFS, HostFS        &E8 232
&39  57 ADFS                &99 153 IOFS, HostFS        &E9 233
&3A  58                     &9A 154 IOFS, HostFS        &EA 234
&3B  59                     &9B 155 IOFS, HostFS        &EB 235
&3C  60                     &9C 156 IOFS, HostFS        &EC 236
&3D  61                     &9D 157 IOFS, HostFS        &ED 237
&3E  62                     &9E 158 IOFS, HostFS        &EE 238
&3F  63                     &9F 159 IOFS, HostFS        &EF 239

&40  64 DOSFS               &A0 160 LFS, BeebLink*      &F0 240 IEEEFS
&41  65 DOSFS               &A1 161 LFS, BeebLink*      &F1 241 IEEEFS
&42  66 DOSFS               &A2 162 LFS, BeebLink*      &F2 242 IEEEFS
&43  67 DOSFS               &A3 163 LFS, BeebLink*      &F3 243 IEEEFS
&44  68 DOSFS               &A4 164 LFS, BeebLink*      &F4 244 IEEEFS
&45  69 DOSFS               &A5 165 LFS, BeebLink*      &F5 245 IEEEFS
&46  70 DOSFS               &A6 166 LFS, BeebLink*      &F6 246 IEEEFS
&47  71 DOSFS               &A7 167 LFS, BeebLink*      &F7 247 IEEEFS
&48  72                     &A8 168 LFS, BeebLink*      &F8 248 IEEEFS
&49  73                     &A9 169 LFS, BeebLink*      &F9 249 IEEEFS
&4A  74                     &AA 170 LFS, BeebLink*      &FA 250 IEEEFS
&4B  75                     &AB 171 LFS, BeebLink*      &FB 251 IEEEFS
&4C  76                     &AC 172 LFS, BeebLink*      &FC 252 IEEEFS
&4D  77                     &AD 173 LFS, BeebLink*      &FD 253 IEEEFS
&4E  78                     &AE 174 LFS, BeebLink*      &FE 254 IEEEFS
&4F  79                     &AF 175 LFS, BeebLink*      &FF 255 IEEEFS

Special cases

When reading PTR and EXT from 8-bit BASIC, the data parameter is BASIC's integer store, which will be set to the channel as the last item evaluated. That means that PTR#0 and EXT#0 pass a data value of zero; OSARGS 0,0 and OSARGS 2,0 do not change the data word; this means that in 8-bit BASICs PTR#0 and EXT#0 return zero, being the unchanged data word set to the channel.

This means that other BASICs have the ability to use PTR#0 and EXT#0 to return information specific to that implementation. Some BASICs or operating systems allow other special handles to return specific information.

  • The most common case is that channel 0 references the console, ie the keyboard and VDU:
OSBGET#0 reads from OSRDCH
OSBPUT#0 writes to OSWRCH
EOF#0 returns TRUE if the next OSBGET#0 or OSRDCH/GET/INKEY will not return a character without waiting, ie IF NOT EOF#0 THEN key%=GET
PTR#0 returns platform-specific information
EXT#0 returns platform-specific information
  • Some C compilers implement C console handles:
Reading from channel 0 reads from STDIN (via OSRDCH)
Writing to channel 1 writes to STDOUT (via OSWRCH)
Writing to channel 2 writes to STDERR (via OSWRCH).

Known implementations

Implemented at the
operating system layer
 BGET#0   BPUT#0   OSGBPB#0   EOF#0   PTR#0   EXT#0 
BBC MOS and CoPros  untested   untested   error or -1   0   0 
ARM Development System[1]  OSRDCH   OSWRCH  OSWRCH / OSRDCH  untested   untested   untested 
PDP11 CoPro  OSRDCH[2]   OSWRCH[2]   untested   untested   untested 
TubeHost OSRDCH OSWRCH 0 if keypress pending  untested   untested 
Implemented by BASIC  BGET#0   BPUT#0   EOF#0   PTR#0   EXT#0 
Windows BASIC  untested   untested   untested   untested   untested 
Brandy Basic
Others  BGET#-1   BPUT#-1   EOF#-1   PTR#-1   EXT#-1 
Sinclair Z88  untested   untested   0=unexpanded, -1=expanded  b0-b15=ROM version, b16=b31=number of
handles remaining
 amount of free system memory 

[1] I'm sure there is an ARM system that does this, needs further investigation
[2] Build option

Notes

CoProFS is documented as using &C0-&C4, but actually will use as many as its workspace allows, up to &C0-&CC.

RetroClinic RAMFS uses &60-&64, Acacia RAMFS uses &60-&65.

Early versions of HADFS used &05-&0A and &85-&8A to read/write control information, later versions use &19-&1D to access this control information.

IOFS in BBCTerm uses handles &80-&9F but its OSFSC entry reports that it uses &80-&A0. IOFS also incorrectly reports its filing system number as &00.

LanManFS clashes with NFS/ANFS, but the hardware cannot be present at the same time as the LanManFS Ethernet card plugs into the Econet card sockets.

BeebLink* entries are used by the BeebLink Test FS ROM, which can coexist with the ordinary BeebLink ROM while testing.

References

Jgharston 22:14, 1 September 2007 (BST)