OSGBPB - Read or write multiple bytes of data
BBC->FAQ->API->OSGBPB Search

 6502  Z80  PDP11  80x86  31016  ARM On entry: On exit:
A A R0 AL R1R0function code  preserved if function unsupported
XY HL R1 BX control block  preserved, control block updated
ctrl?&00 R2R1channel or pointer to directory name  Cycle number
ctrl!&01 R3R2Data Address  updated Data Address
ctrl!&05 R4R3Number to transfer  updated Number to transfer
ctrl!&09 R5R4Pointer to used for transfer  updated Pointer

Function  
1 Write bytes using new pointer
2 Write bytes ignoring new pointer
3 Read bytes using new pointer
4 Read bytes ignoring new pointer
5 Get media title of CSD disk and boot option
6 Get currently selected directory name
7 Get current library name.
8 Read filenames from current directory
9 Reads work/login filename, command line tail or entries from specified directory
10 Read entries and information from specified directory
11 Read entries and extended information from specified directory


Functions

Write bytes using new pointer
Write bytes ignoring new pointer
Read bytes using new pointer
Read bytes ignoring new pointer
 With functions &01 and &03 the PTR is first set to the supplied value before transfering data.

On exit the 'number of bytes' field holds the number of bytes not transfered. The 'data address' field is updated to point to the next location for data transfer.

The PTR for the file is updated by the number of bytes transfered and placed in the 'PTR' field. The carry flag is returned set if EOF was met. The EOF-error-flag is reset. An error occurs if the object is not a file or does not have the correct access.

If the channel is 0, action is undefined. Some systems allow multiple bytes to be written to OSWRCH or read from OSRDCH if the channel is 0.

Get media title of CSD disk and boot option into data block:
&00  length of title (n)
&01  title in ASCII characters
&01+n  startup option
&02+n  drive number
&03+n  
Get currently selected directory name into data block:
&00  length of drive identity (n)
&01  ASCII drive identity (drive number)
&01+n  length of directory name (m)
&02+n  directory name in ASCII characters
&02+n+m  ownership: &00 - owner, &FF - public
&03+n+m  
Get current library name into data block:
&00  length of drive identity (n)
&01  ASCII drive identity (drive number)
&01+n  length of library name (m)
&02+n  library name in ASCII characters
&02+n+m  ownership: &00 - owner, &FF - public
&03+n+m  
Read filenames from current directory into data block:
&00  length of filename 1 (n)
&01  filename 1 in ASCII characters
&01+n  length of filename 2 (m)
&02+n  filename 2 in ASCII characters
&02+n+m  etc...
The first call to function &08 should be made with the directory pointer set to zero. This will read the first filename, and the pointer will be updated so that the next call will read the next filename. When no filenames are left, the call returns with the 'number of filenames' left unchanged and the carry flag set.

Reads work/login filename, command line tail or entries from specified directory.

If the channel is zero, the work/login filename or command tail is read into the data block:
&00  length of drive identity or command line tail (n)
&01  ASCII drive identity (drive number) or comand line tail
&01+n  length of work/login filename (m)
&02+n  work/login filename
&02+n+m  
If the channel is the channel number of an open directory, reads a null- terminated list of directory entries. The function is called as for OSGBPB 8, but 'number of filenames' returns the number of filenames actually read, not the number unread.

10 Reads entries and information from the opened directory whose channel number is in XY+0. This function is called as for OSGBPB 9. Each record is a whole multiple of four bytes long:
&00  Load address
&04  Execution address
&08  Length
&0C  Attributes
&10  Object type (1=file, 2=directory, 3=image file, 4=unresolved symbolic link)
&14  Object name, null terminated
&xx  next record
11 Reads entries and extended information from the opened directory whose channel number is in XY+0. This function is called as for OSGBPB 9. Each record is a whole multiple of four bytes long:
&00  Load address
&04  Execution address
&08  Length
&0C  Attributes
&10  Object type (1=file, 2=directory, 3=image file, 4=unresolved symbolic link)
&14  Sector start address (System Internal Name)
&18  Five zeros or centisecond time since 1900
&1D  Object name, null terminated
&xxx  next record

12 Reads entries and information from the opened directory whose channel number is in XY+0. This function is called as for OSGBPB 9. Each record is a whole multiple of four bytes long:
&00  Load address
&04  Execution address
&08  Length
&0C  Attributes
&10  Object type (1=file, 2=directory, 3=image file, 4=unresolved symbolic link)
&14  Object filetype (b8-b19 of load address)
&18  Object name, null terminated
&xx  next record

Notes

Many filing systems do not return Carry consistantly. The only consistant way of telling of the end of file has been reached is to check the contents of XY!1.

Calling from BBC BASIC

BBC BASIC does not call OSGBPB directly.

Entry points

  • BBC BASIC Entry Address: 
  • &FFDD
  • 6502 Entry Address:  
  • &FFDD, vectors via &02
  • Z80 Entry Address:  
  • &FFDD, vectors via &FFDE
  • 6809 Entry Address:  
  • &FFDD, vectors via &FFDE
  • 80x86 Entry Address:  
  • INT &41, vectors via 0000:0104
  • 32000 Entry Address:  
  • SVC &0F
  • PDP-11 Entry Address:  
  • EMT 11, vector &0B
  • ARM Entry Address:  
  • SWI "OS_GBPB", vector &0C



    This page last updated 12-Sep-2008