Difference between revisions of "OSBYTE &8F"

From BeebWiki
Jump to: navigation, search
m (1 revision)
m (Side effect: ~)
 
(7 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
     X=request number
 
     X=request number
 
     Y=parameter to pass (varies depending on the request number)
 
     Y=parameter to pass (varies depending on the request number)
 +
 +
==Specification==
 +
{| cellpadding="0" cellspacing="0"
 +
|  6502  || align="left" | '''On entry:''' || align="left" | '''On exit:'''
 +
|- align="center" valign="top"
 +
| A || align="left" | =&8F || align="left" | preserved
 +
|- align="center" valign="top"
 +
| X || align="left" | Service request code || align="left" | =0 service call claimed<br>&lt;&gt;0 service call not claimed
 +
|- align="center" valign="top"
 +
| Y || align="left" | Parameter to service call || align="left" | Result from service call
 +
|}
 +
 +
;Note
 +
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.
 +
 +
===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
 +
 +
OSBYTE &8F provides pure ROM paging in OS 1.00, where OSRDSC is not
 +
available:
 +
 +
    \Y contains ROM slot number to switch to
 +
    LDX #&00 \service call number = &00, null call
 +
    LDA #&8F \OSBYTE call number = &8F, issue service call
 +
    STY &F4 \set new current ROM number
 +
    JSR OSBYTE \issue service call
 +
    \slot number in Y 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==
* [[Paged ROM service calls]]
+
* [[Service calls]]
 
* http://mdfs.net/Docs/Comp/BBC/Osbyte80
 
* http://mdfs.net/Docs/Comp/BBC/Osbyte80
  
 
[[User:Jgharston|Jgharston]] 21:26, 26 May 2009 (UTC)
 
[[User:Jgharston|Jgharston]] 21:26, 26 May 2009 (UTC)

Latest revision as of 20:47, 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

OSBYTE &8F provides pure ROM paging in OS 1.00, where OSRDSC is not available:

   		\Y contains ROM slot number to switch to
   LDX #&00	\service call number = &00, null call
   LDA #&8F	\OSBYTE call number = &8F, issue service call
   STY &F4	\set new current ROM number
   JSR OSBYTE	\issue service call
   		\slot number in Y 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)