Difference between revisions of "Handles"

From BeebWiki
Jump to: navigation, search
m (Special cases)
m (typo!)
Line 102: Line 102:
 
: OSBGET#0 reads from OSRDCH
 
: OSBGET#0 reads from OSRDCH
 
: OSBPUT#0 writes to OSWRCH
 
: OSBPUT#0 writes to OSWRCH
: EOF#0 returns FALSE if the next OSBGET#0 or OSRDCH/GET/INKEY will return a character without waiting, if IF NOT EOF#0 THEN key%=GET
+
: 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
 
: PTR#0 returns platform-specific information
 
: EXT#0 returns platform-specific information
 
: EXT#0 returns platform-specific information

Revision as of 12:47, 6 September 2019

Summary

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

Full List

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

&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                 &F0 240 IEEEFS
&41  65 DOSFS               &A1 161 LFS                 &F1 241 IEEEFS
&42  66 DOSFS               &A2 162 LFS                 &F2 242 IEEEFS
&43  67 DOSFS               &A3 163 LFS                 &F3 243 IEEEFS
&44  68 DOSFS               &A4 164 LFS                 &F4 244 IEEEFS
&45  69 DOSFS               &A5 165 LFS                 &F5 245 IEEEFS
&46  70 DOSFS               &A6 166 LFS                 &F6 246 IEEEFS
&47  71 DOSFS               &A7 167 LFS                 &F7 247 IEEEFS
&48  72                     &A8 168 LFS                 &F8 248 IEEEFS
&49  73                     &A9 169 LFS                 &F9 249 IEEEFS
&4A  74                     &AA 170 LFS                 &FA 250 IEEEFS
&4B  75                     &AB 171 LFS                 &FB 251 IEEEFS
&4C  76                     &AC 172 LFS                 &FC 252 IEEEFS
&4D  77                     &AD 173 LFS                 &FD 253 IEEEFS
&4E  78                     &AE 174 LFS                 &FE 254 IEEEFS
&4F  79                     &AF 175 LFS                 &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  OSRDCH   OSWRCH  OSWRCH / OSRDCH  untested   untested   untested 
PDP11 CoPro  OSRDCH   OSWRCH   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 
  • Later versions

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.

References

Jgharston 22:14, 1 September 2007 (BST)