Difference between revisions of "OSRDCH"

From BeebWiki
Jump to: navigation, search
m (1 revision)
(Added RISC-V)
Line 4: Line 4:
 
==Specification==
 
==Specification==
 
{| cellpadding="0" cellspacing="0"  
 
{| cellpadding="0" cellspacing="0"  
|  6502  ||  Z80  ||  6809  ||  PDP11  ||  80x86  ||  32016  ||  ARM  || align="left" | '''On entry:''' || align="left" | '''On exit:'''
+
| 6502 || Z80 || 6809 || PDP11 || 80x86 || 32016 || ARM || 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 || A0 || align="left" | -        || align="left" | = byte read
 
|- align="center" valign="top"
 
|- align="center" valign="top"
| || || || || || || || align="left" | || align="left" | Cy=Error status
+
| || || || || || || || || align="left" | || align="left" | Cy=Error status
 
|}
 
|}
  
If an error occured (usually, Escape being pressed), then the carry flag is set on exit. If the error was Escape, then A will be &1B.
+
If an error occured (usually, Escape being pressed), then the carry flag is set on exit. If the error was Escape, then A will be &1B regardless of the defined Escape character.
  
 
==Calling from BBC BASIC==
 
==Calling from BBC BASIC==
Line 24: Line 24:
 
* 80x86 Entry Address: INT &46, vectors via 0000:0118
 
* 80x86 Entry Address: INT &46, vectors via 0000:0118
 
* 32000 Entry Address: SVC &05
 
* 32000 Entry Address: SVC &05
* PDP-11 Entry Address: EMT 5, vector &05
+
* PDP11 Entry Address: EMT 5, vector &05
 
* ARM Entry Address: SWI &04 "OS_ReadC", vector &04
 
* ARM Entry Address: SWI &04 "OS_ReadC", vector &04
 +
* RISC-V Entry Address: ECALL &AC0005
  
 
==Implementations==
 
==Implementations==

Revision as of 20:20, 10 September 2023

Waits for a character from the current input stream.

Specification

6502 Z80 6809 PDP11 80x86 32016 ARM RISC-V On entry: On exit:
A A A R0 AL R1 R0 A0 - = byte read
Cy=Error status

If an error occured (usually, Escape being pressed), then the carry flag is set on exit. If the error was Escape, then A will be &1B regardless of the defined Escape character.

Calling from BBC BASIC

  • b%=GET calls OSRDCH.
  • b$=GET$ calls OSRDCH.

Entry points

  • BBC BASIC Entry Address: &FFE0
  • 6502 Entry Address: &FFE0, vectors via &0210
  • Z80 Entry Address: &FFE0, vectors via &FFE1
  • 6809 Entry Address: &FFE0, vectors via &FFE1
  • 80x86 Entry Address: INT &46, vectors via 0000:0118
  • 32000 Entry Address: SVC &05
  • PDP11 Entry Address: EMT 5, vector &05
  • ARM Entry Address: SWI &04 "OS_ReadC", vector &04
  • RISC-V Entry Address: ECALL &AC0005

Implementations

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

Jgharston 17:02, 6 November 2009 (UTC)