Difference between revisions of "USERV"

From BeebWiki
Jump to: navigation, search
(Programming considerations)
m (Corrected &00/&01.)
 
Line 3: Line 3:
 
This vector is called to extend the MOS in various ways.
 
This vector is called to extend the MOS in various ways.
 
   On entry:
 
   On entry:
     A=&00    *LINE, XY=>command line
+
     A=&00    OSBYTE &88 (called by *CODE)
     A=&01    OSBYTE &88 (called by *CODE)
+
     A=&01    *LINE, XY=>command line
 
     A=&02-&DF reserved
 
     A=&02-&DF reserved
 
     A=&E0-&FF OSWORD &E0-&FF
 
     A=&E0-&FF OSWORD &E0-&FF
Line 11: Line 11:
  
 
===Programming considerations===
 
===Programming considerations===
When USERV is called with A=1 or A=&E0+ it will have been called from the OSBYTE or OSWORD handler:
+
When USERV is called with A=&00 or A=&E0+ it will have been called from the OSBYTE or OSWORD handler:
 
* X and Y will already have been stored in the MOS register store at &F0 and &F1, so (&F0),Y addressing can be used to access the OSWORD control block. Note that if your code calls OSBYTE/OSWORD then &F0/&F1 will be overwritten.
 
* X and Y will already have been stored in the MOS register store at &F0 and &F1, so (&F0),Y addressing can be used to access the OSWORD control block. Note that if your code calls OSBYTE/OSWORD then &F0/&F1 will be overwritten.
 
* Interupts will be disabled, and will be restored on return from the USERV code. If your code takes a significant amount of time it must turn interupts on to allow clocks, etc. to continue.
 
* Interupts will be disabled, and will be restored on return from the USERV code. If your code takes a significant amount of time it must turn interupts on to allow clocks, etc. to continue.

Latest revision as of 10:03, 20 December 2024

Specification

This vector is called to extend the MOS in various ways.

 On entry:
   A=&00     OSBYTE &88 (called by *CODE)
   A=&01     *LINE, XY=>command line
   A=&02-&DF reserved
   A=&E0-&FF OSWORD &E0-&FF
 On exit:
   All registers can be trashed by the handler

Programming considerations

When USERV is called with A=&00 or A=&E0+ it will have been called from the OSBYTE or OSWORD handler:

  • X and Y will already have been stored in the MOS register store at &F0 and &F1, so (&F0),Y addressing can be used to access the OSWORD control block. Note that if your code calls OSBYTE/OSWORD then &F0/&F1 will be overwritten.
  • Interupts will be disabled, and will be restored on return from the USERV code. If your code takes a significant amount of time it must turn interupts on to allow clocks, etc. to continue.
  • A will be restored on return from the USER code, so your code does not need to save and restore it.
  • X and Y are undefined on return from OSWORD, so the USERV code does not need to restore them.

Extensions

Calling USERV with A=&02-&DF can be used for application-specific extensions, but should be treated as "private" to that application usage.

Examples