PDP-11 Second Processor
From BeebWiki
An emulated Second Processor for the BBC/Master containing a DEC PDP-11.
The PDP-11 client MOS provides the basic system required to communicate with the host computer as well as a cut-down set of PDP-11 Unix functions.
Software and documentation for the PDP-11 CoProcessor are available at mdfs.net.
MOS API Calls
Programs communicate with the kernal and MOS via the EMT trap instruction. Parameters are passed in registers R0 onwards.
On entry, R0-R7 contain values to pass to EMT call
On exit, R0-R7 contain returned data
V=0 - no error occured
V=1 - error occured, R0=>error block
EMT &00 - OS_QUIT
On entry: On exit: R0=Return value
EMT &01 - OS_CLI
On entry: On exit: R0=>command string R0=Return value
EMT &02 - OS_BYTE
On entry: On exit
R0=function R0=preserved
R1=first parameter R1=returned word
R2=second parameter R2=returned word DIV 256
Cy=returned carry flag
EMT &03 - OS_WORD
On entry: On exit: R0=function Control block updated R1=>control block R1=returned line length for OSWORD 0
EMT &04 - OS_WRCH
On entry: On exit: R0=character R0=preserved
EMT &05 - OS_NEWL
On entry: On exit:
R1=13
EMT &06 - OS_RDCH
On entry: On exit:
R0=character
Cy=carry flag
EMT &07 - OS_FILE
On entry: On exit: R0=function R0=result R1=>control block R1=preserved
EMT &08 - OS_ARGS
On entry: On exit: R0=function R0=result R1=handle R1=preserved R2=>data R2=data
EMT &09 - OS_BGET
On entry: On exit:
R0=byte
R1=handle R1=preserved
Cy=carry flag
EMT &0A - OS_BPUT
On entry: On exit: R0=byte R0=preserved R1=handle R1=preserved
EMT &0B - OS_GBPB
On entry: On exit:
R0=function
R1=>control block R1=preserved
Cy=carry flag
EMT &0C - OS_FIND
On entry: On exit: R0=function R0=handle R1=>string or handle
EMT &0D - OS_SYST
On entry:
R0=0 - Loads and enters BASIC
R1=0 or R1=>parameters
R0=1 - Reinitialises vectors, handlers and EMT dispatch table
R0=2 - Reinitialises handlers and EMT dispatch table only
On exit:
All preserved
EMT &0E - OS_HANDLER
On entry: On exit: R0=EMT or handler number R0=preserved R1=handler or 0 to read R1=previous handler R2=buffer or 0 to read R2=previous buffer If R0>=0, the call redirects the specified EMT call, returning the previous handler If R0<0, the call sets and reads the following environment handlers: R0 R1 R2 -1 Exit handler -2 Escape handler Escape flag -3 Error handler Error buffer -4 Event handler -5 Unknown IRQ handler -6 ignored EMT dispatch table
EMT &0F - OS_ERROR
EMT &0F is followed by the error block in memory: EMT 15 EQUB error EQUS "error string" EQUB 0
See also
Jgharston 18:31, 11 September 2008 (BST)

