Difference between revisions of "OSBGET"

From BeebWiki
Jump to: navigation, search
m (1 revision)
m (Added 68000.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:MOS_API]]
 
[[Category:MOS_API]]
Read (get) a byte
+
{{PageTitle|OSBGET: Read (get) a byte}}
  
 
==Specification==
 
==Specification==
{| cellpadding="0" cellspacing="0"  
+
{| cellpadding="0" cellspacing="0" border="1"
|  6502  ||  Z80  ||  6809  ||  PDP11  ||  80x86  ||  32016  ||  ARM  || align="left" | '''On entry:''' || align="left" | '''On exit:'''
+
| 6502 || Z80 || 6809 || PDP11 || 80x86 || 32016 || ARM || 68000 || RISC-V || align="left" | '''On entry:''' || align="left" | '''On exit:'''
 
|- align="center" valign="top"
 
|- align="center" valign="top"
| A || A || A || R0 || AL || R1 || R0 || align="left" | -        || align="left" | = byte read
+
| A || A || A || R0 || AL || R1 || R0 || D0 || A0 || align="left" | -        || align="left" | = byte read
 
|- align="center" valign="top"
 
|- align="center" valign="top"
| Y || H || Y || R1 || BX || R2 || R1 || align="left" | = handle || align="left" | preserved
+
| Y || H || Y || R1 || BX || R2 || R1 || D1 || A1 || align="left" | = handle || align="left" | preserved
 
|- align="center" valign="top"
 
|- align="center" valign="top"
| || || || || || || || align="left" | || align="left" | Cy=EOF status
+
| || || || || || || || || || align="left" | || align="left" | Cy=EOF status
 
|}
 
|}
  
If the byte read is after the end of file, the carry flag is set on exit and the EOF-error-flag is set. After the EOF byte has been read, the next read produces an error. An error is generated if the object is a directory or doesn't have read access.
+
If the byte read is after the end of file, the carry flag is set on exit and the EOF-error-flag is set. After the EOF byte has been read, the next read produces an error. An error is generated if the object is a directory or doesn't have read access.
  
 
==Calling from BBC BASIC==
 
==Calling from BBC BASIC==
Line 30: Line 30:
 
* PDP-11 Entry Address: EMT 9, vector &09
 
* PDP-11 Entry Address: EMT 9, vector &09
 
* ARM Entry Address: SWI &0A "OS_BGet", vector &0A
 
* ARM Entry Address: SWI &0A "OS_BGet", vector &0A
 +
* 68000 Entry Address: MOV #&0A,A0:TRAP 12
 +
* RISC-V Entry Address: ECALL &AC0009
  
 
==Implementations==
 
==Implementations==
 
All filing systems implement OSBGET.
 
All filing systems implement OSBGET.
  
 +
{{Filing}}
 
[[User:Jgharston|Jgharston]] 16:56, 6 November 2009 (UTC)
 
[[User:Jgharston|Jgharston]] 16:56, 6 November 2009 (UTC)

Latest revision as of 20:09, 17 September 2023

OSBGET: Read (get) a byte

Specification

6502 Z80 6809 PDP11 80x86 32016 ARM 68000 RISC-V On entry: On exit:
A A A R0 AL R1 R0 D0 A0 - = byte read
Y H Y R1 BX R2 R1 D1 A1 = handle preserved
Cy=EOF status

If the byte read is after the end of file, the carry flag is set on exit and the EOF-error-flag is set. After the EOF byte has been read, the next read produces an error. An error is generated if the object is a directory or doesn't have read access.

Calling from BBC BASIC

  • b%=BGET#ch calls OSBGET.

Special handles

Some systems allow BGET#0 to read from the character input stream via OSRDCH.

Entry points

  • BBC BASIC Entry Address: &FFD7
  • 6502 Entry Address: &FFD7, vectors via &0216
  • Z80 Entry Address: &FFD7, vectors via &FFD8
  • 6809 Entry Address: &FFD7, vectors via &FFD8
  • 80x86 Entry Address: INT &43, vectors via 0000:010C
  • 32000 Entry Address: SVC &0D
  • PDP-11 Entry Address: EMT 9, vector &09
  • ARM Entry Address: SWI &0A "OS_BGet", vector &0A
  • 68000 Entry Address: MOV #&0A,A0:TRAP 12
  • RISC-V Entry Address: ECALL &AC0009

Implementations

All filing systems implement OSBGET.

Filing System Calls
  • OSFILE : File and directory operations
  • OSARGS : Information on open objects
  • OSBGET : Read (get) a byte
  • OSBPUT : Write (put) a byte
  • OSGBPB : Read or write multiple bytes of data
  • OSFIND : Open or close an object
  • FSCV : Filing system control

Jgharston 16:56, 6 November 2009 (UTC)