USERV

From BeebWiki
Jump to: navigation, search

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