Difference between revisions of "OSBYTE &8F"

From BeebWiki
Jump to: navigation, search
(presence of result not contingent on claim; preservation of Y relies on ROMs cooperating)
(Side effect: new section)
Line 19: Line 19:
 
Certain [[service calls]] such as &01 and &02 return a result in Y without claiming the call.<br>
 
Certain [[service calls]] such as &01 and &02 return a result in Y without claiming the call.<br>
 
Other unclaimed calls preserve Y, provided that all paged ROMs behave correctly.
 
Other unclaimed calls preserve Y, provided that all paged ROMs behave correctly.
 +
 +
===Side effect===
 +
On exit ROMSEL is left set to the current sideways ROM slot number stored in
 +
location &F4.  J.G.Harston
 +
[https://stardot.org.uk/forums/viewtopic.php?p=345669#p345669 points out]
 +
that any program may page in a sideways ROM by storing the desired slot
 +
number there and immediately calling [[OSRDSC]], but it is also possible to
 +
combine a service call issue with a bank switch using the same technique:
 +
 +
    \A contains ROM slot number to switch to
 +
    LDY #&FF \service call parameter = &FF, indicate OSRDSC available
 +
    LDX #&0E \service call number = &0E, RFS data poll
 +
    STA &F4 \set new current ROM number
 +
    LDA #&8F \OSBYTE call number = &8F, issue service call
 +
    JSR OSBYTE \issue service call
 +
    \slot number in A on entry is now selected
 +
 +
The OS call encapsulates differences between platforms (particularly on the
 +
Electron) and improves ''revolving bookcase'' routines within sideways ROMs,
 +
which no longer need to wait for the chip select lines to stabilise after
 +
switching banks.  Note that in such routines, after location &F4 has been
 +
updated, an interrupt service may switch banks early and so all instructions
 +
between <code>STA &F4</code> and <code>JSR OSBYTE</code> inclusive must be
 +
the same in the source and destination banks.
  
 
==See Also==
 
==See Also==

Revision as of 19:58, 20 January 2022

OSBYTE &8F (143) - Issue SWR Service Request (on exit Y=response to request if appropriate)

   X=request number
   Y=parameter to pass (varies depending on the request number)

Specification

 6502  On entry: On exit:
A =&8F preserved
X Service request code =0 service call claimed
<>0 service call not claimed
Y Parameter to service call Result from service call
Note

Certain service calls such as &01 and &02 return a result in Y without claiming the call.
Other unclaimed calls preserve Y, provided that all paged ROMs behave correctly.

Side effect

On exit ROMSEL is left set to the current sideways ROM slot number stored in location &F4. J.G.Harston points out that any program may page in a sideways ROM by storing the desired slot number there and immediately calling OSRDSC, but it is also possible to combine a service call issue with a bank switch using the same technique:

   		\A contains ROM slot number to switch to
   LDY #&FF	\service call parameter = &FF, indicate OSRDSC available
   LDX #&0E	\service call number = &0E, RFS data poll
   STA &F4	\set new current ROM number
   LDA #&8F	\OSBYTE call number = &8F, issue service call
   JSR OSBYTE	\issue service call
   		\slot number in A on entry is now selected

The OS call encapsulates differences between platforms (particularly on the Electron) and improves revolving bookcase routines within sideways ROMs, which no longer need to wait for the chip select lines to stabilise after switching banks. Note that in such routines, after location &F4 has been updated, an interrupt service may switch banks early and so all instructions between STA &F4 and JSR OSBYTE inclusive must be the same in the source and destination banks.

See Also

Jgharston 21:26, 26 May 2009 (UTC)