Difference between revisions of "OSRDSC"

From BeebWiki
Jump to: navigation, search
m (Specification)
m (Results in Y register)
Line 6: Line 6:
 
| colspan="2" | '''On entry:'''
 
| colspan="2" | '''On entry:'''
 
|-
 
|-
| valign="top" | Y || = Slot number of ROM to be paged in
+
| valign="top" | Y      || = Slot number of ROM to be paged in
 
|-
 
|-
| valign="top" | ?&F6 || = LSB of address to be read
+
| valign="top" | ?&F6   || = LSB of address to be read
 
|-
 
|-
| valign="top" | ?&F7 || = MSB of address to be read
+
| valign="top" | ?&F7   || = MSB of address to be read
 
|}
 
|}
  
Line 16: Line 16:
 
| colspan="2" | '''On exit:'''
 
| colspan="2" | '''On exit:'''
 
|-
 
|-
| valign="top" | A || = contents of address
+
| valign="top" | A      || = contents of address
 
|-
 
|-
| valign="top" | X,Y,C || undefined (all implementations: X=current ROM, Y=&00)
+
| valign="top" | X,Y,C   || = undefined (all implementations: X=current ROM, Y=&00 (BBC/Electron) Y=preserved (Master))
 
|}
 
|}
  

Revision as of 11:56, 23 August 2015

Fetches a byte from paged ROM or display memory.

Specification

On entry:
Y   = Slot number of ROM to be paged in
 ?&F6   = LSB of address to be read
 ?&F7   = MSB of address to be read
On exit:
A   = contents of address
X,Y,C   = undefined (all implementations: X=current ROM, Y=&00 (BBC/Electron) Y=preserved (Master))

Fetches a byte from an address in paged ROM or the current display memory (in main or shadow RAM) and returns it in A. The address to be read is given in locations &F6 (low byte) and &F7 (high byte), and the paged ROM slot to read from is given in Y. If the address lies outside the paged ROM space then the value of Y is irrelevant.

When a paged ROM receives service call &0E, locations &F6 and &F7 are already set up with an appropriate address, and the ROM slot number can be derived from location &F5. If Y=&FF on entry to service call &0E then the operating system provides OSRDRM, so RFS ROMs can quickly serve data bytes on one another's behalf by calling OSRDRM as long as the MOS supports it.

MOS 2.00 introduces a counterpart routine, OSWRSC, to write a byte to the screen.

Calling from BBC BASIC

  • BASIC does not call OSRDSC

Entry points

  • BBC BASIC Entry Address: none
  • 6502 Entry Address: &FFB9
  • Z80 Entry Address: none
  • 6809 Entry Address:
  • 80x86 Entry Address: none
  • 32000 Entry Address: none
  • PDP-11 Entry Address: none
  • ARM Entry Address: none

Implementation

The call is absent in MOS 0.10 and MOS 1.00 and service call &0E enters paged ROMs with Y<>&FF. The entry point exists in MOS 1.20 and is known as OSRDRM but is undocumented, and accesses paged ROMs and main memory only. It is documented in MOS 2.00 as OSRDSC and reads from the specified paged ROM/SRAM and the currently displayed screen memory. On the Master series the call reads from whichever screen memory is being accessed by the VDU.

OSRDRM/OSRDSC is not implemented on non-6502 platforms and BBC BASIC does not emulate its entry point.

Coding

The function FNrm(), if used on the I/O processor, will read a byte from any banked memory, except the hidden MOS ROM at &FC00-FEFF.

   DEFFNrm(!&F6):LOCAL Y%:Y%=?&F8+&40:IFY%>&BF:IF?&F7>&BF:?&F9=0
   IF!&F6<0:IF?&F7>&7F OR Y%=&3E:=(USR&FFB9)AND&FF ELSE =?!&F6

The passed address reads the following memory:

 Address    &0000-&2FFF  &3000-&7FFF  &8000-&8FFF  &9000-&BFFF  &C000-&DFFF  &E000-&FFFF
<&FFxxxxxx  main memory  main memory  current ROM  current ROM    FS RAM       MOS ROM 
 &FF0rxxxx  main memory  main memory  SROM/SRAM r  SROM/SRAM r    MOS ROM      MOS ROM
 &FF4rxxxx  main memory  main memory  VDU RAM      SROM/SRAM r    MOS ROM      MOS ROM
 &FF8rxxxx  main memory  main memory  VDU RAM      SROM/SRAM r    FS RAM       MOS ROM
 &FFFrxxxx  main memory  main memory  SROM/SRAM r  SROM/SRAM r    MOS ROM      MOS ROM
 &FFFExxxx  main memory  display mem  SROM/SRAM r  SROM/SRAM r    MOS ROM      MOS ROM
 &FFFFxxxx  main memory  main memory  SROM/SRAM r  SROM/SRAM r    MOS ROM      MOS ROM

-- beardo 23:20, 5 October 2007 (BST) Jgharston (talk) 04:25, 29 March 2015 (UTC)