32016 Second Processor

From BeebWiki
Jump to: navigation, search

A second processor for the BBC/Master or Acorn Cambridge Workstation containing a National Semiconductor 32016. The "cheese wedge" second processor contains 1M of RAM and was marketed as the Cambridge CoProcessor. The Acorn Cambridge Workstation contained a 32016 CoProcessor with 4M of RAM.

The 32016 client MOS is called Pandora and provides the basic system required to communicate with the host computer. Disk-based software provides an operating system called Panos, very similar to Unix in appearance. Panos also has a lot of internal similarities with ARM Arthur and shows Arthur's programming heritage.

ROM images and system disks for the 32016 CoProcessor are available at mdfs.net and elsewhere.

MOS API Calls

Programs communicate with the kernal and MOS via the SVC Supervisor Call opcode. Parameters are passed in registers R1 onwards. Register R0 is not used by API calls other than OS_INDIR.

On entry, R0-R7 contain values to pass to SVC call
On exit,  R0-R7 contain returned data
          F=0 - no error occured
          F=1 - error occured, R1=error number

SVC &00 - OS_INDIR

On entry:           On exit:
R0=SVC number
R1-R7=as called SVC  R1-R7=as called SVC

SVC &01 - OS_WRCH

On entry:           On exit:
R1=character        R1=preserved

SVC &02 - OS_STRING - Print String

On entry:           On exit
R1=>text            R1=preserved
R2=length           R2=preserved

SVC &03 - OS_ASCI

On entry:           On exit:
R1=character        R1=preserved

SVC &04 - OS_NEWL

SVC &05 - OS_RDCH

On entry:           On exit:
                    R1=character
                    Cy=carry flag

SVC &06 - OS_BYTE

On entry:           On exit:
R1=function         R1=preserved
R2=first parameter  R2=returned word
R3=second parameter R3=returned word DIV 256
                    Cy=returned carry flag

SVC &07 - OS_WORD

On entry:           On exit:
R1=function         Control block updated
R2=>control block

SVC &08 - OS_CLI

On entry:
R1=>command string
R2=max string length

SVC &09 - UNUSED

SVC &0A - OS_FILE

On entry:            On exit:
R1=function          R1=result
R2=>filename         R2=undefined
R3=max name length   R3=undefined
R4=load              R4=load
R5=exec              R5=exec
R6=length/start      R6=length
R7=attrs/end         R7=attrs

SVC &0B - OS_FIND

On entry:            On exit:
R1=function          R1=handle
R2=>string or handle
R3=max string length

SVC &0C - OS_ARGS

On entry:            On exit:
R1=function          R1=result
R2=handle            R2=preserved
R3=data              R3=data

SVC &0D - OS_BGET

On entry:            On exit:
                     R1=byte
R2=handle            Cy=carry flag

SVC &0E - OS_BPUT

On entry:            On exit:
R1=byte              R1=preserved
R2=handle            R2=preserved

SVC &0F - OS_GBPB

On entry:           On exit:
R1=function         R1=result
R2=channel          R2=channel
R3=address          R3=address
R4=number           R4=number
R5=pointer          R5=pointer
                    Cy=carry flag

SVC &10 - UNUSED

SVC &11 - OS_EXIT

SVC &12 - OS_DEBUG

SVC &13 - UNUSED

SVC &14 - OS_ESCAPE - Read Escape flag

                    On exit:
                    F flag=1 - Escape state set

SVC &15 - OS_INLINE - Print inline text

The SVC &15 opcode is followed by a single length byte and the string to be
printed.

SVC &16 to &1D - UNUSED

SVC &1E - OS_HANDLER - Set event handler

On entry:  On exit:
R1=event number      R1=preserved
R2=offset/module     R2=preserved
   procedure descriptor

SVC &1F - OS_ERROR - Read last error

On entry:              On exit:
R1=>buffer             R1=preserved
R2=max size of buffer  R2=length of error
                       R3=error number

SVC &20 - OS_SVR - Enter supervisor mode

SVC &21 - OS_ABORT - Jump through ABORT vector

SVC &22 to &27 - UNUSED

SVC &28 - OS_SETVDT - Set Virtual Dispatch Table address

On entry:            On exit:
R1=new VDT address   R1=preserved

SVC &29 to &31 - UNUSED

SVC &32 - OS_SPLIT

SVC &33 - OS_ENTRY - Set Control Program Entry

On entry:            On exit:
R1=Entry address     R1=preserved

SVC &34 - OS_VERSION - Get version

On entry:            On exit:
no parameters        R1=version*256, eg &200 for 2.00

SVC &35 - OS_SETVDU - Set VDU handler

On entry:            On exit:
R1<256 - Handler ID  R1=previous handler
R1>255 - =>handler

SVC &36 (54) - OS_CONFIG - Read config setting

On entry:            On exit:
no parameters        R1.b0=FPU present
                     R1.b1=MMU present

SVC &37 (55) - OS_PRIV - Enable/Disable Pandora SVCs

On entry:                                On exit:
R1=SVC call number                       R1=preserved
R2.b0=0 - This SVC passed on to VDT      R2=previous state
R2.b0=1 - This SVC performed by Kernel

SVC &38 (56) - OS_NOLOAD - No OSCLI Load

On entry:                                On exit:
R1.b0=0 - disable LOADs from OSCLI       R1=previous state
R1.b0=1 - enable LOADs from OSCLI

SVC &39 (57) - OS_CONTROL - Enable/Disable event

On entry:                  On exit
R1=event number &FB..&FE   R1=preserved
R2.b0=0 - disable          R2=previous state
R2.b0=1 - enable

SVC &3A to &3F - UNUSED

See also

Jgharston 17:30, 12 December 2007 (UTC)