Difference between revisions of "6809 Second Processor"

From BeebWiki
Jump to: navigation, search
(Documented OS_INIT)
m (Sorted calls.)
Line 14: Line 14:
 
On exit,  A, X, Y contain returned data
 
On exit,  A, X, Y contain returned data
 
           All addresses are big-endian, except where noted
 
           All addresses are big-endian, except where noted
           When an application starts it should call OS_INIT which
+
           When an application starts it should call OSINIT which
 
           returns MI if little-endian addresses are being used.
 
           returns MI if little-endian addresses are being used.
 
</pre>
 
</pre>
=== &FFF7 - OS_CLI ===
+
=== &FFF7 - OSCLI ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
X=>command string      A=Return value
 
X=>command string      A=Return value
 
</pre>
 
</pre>
=== &FFF4 - OS_BYTE ===
+
=== &FFF4 - OSBYTE ===
 
<pre>On entry:              On exit
 
<pre>On entry:              On exit
 
A=function              A=preserved
 
A=function              A=preserved
Line 28: Line 28:
 
                         Cy=returned carry flag
 
                         Cy=returned carry flag
 
</pre>
 
</pre>
=== &FFF1 - OS_WORD ===
+
=== &FFF1 - OSWORD ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
A=function              Control block updated
 
A=function              Control block updated
Line 34: Line 34:
 
Text buffer address at X+0/1 with OSWORD 0 is big-endian
 
Text buffer address at X+0/1 with OSWORD 0 is big-endian
 
</pre>
 
</pre>
=== &FFEE - OS_WRCH ===
+
=== &FFEE - OSWRCH ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
A=character            A=preserved
 
A=character            A=preserved
 
</pre>
 
</pre>
=== &FFEC - OS_WRCR ===
+
=== &FFEC - OSWRCR ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
                         A=13
 
                         A=13
 
</pre>
 
</pre>
=== &FFE7 - OS_NEWL ===
+
=== &FFE7 - OSNEWL ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
                         A=13
 
                         A=13
 
</pre>
 
</pre>
=== &FFE3 - OS_ASCI ===
+
=== &FFE3 - OSASCI ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
A=character            A=preserved
 
A=character            A=preserved
 
</pre>
 
</pre>
=== &FFE0 - OS_RDCH ===
+
=== &FFE0 - OSRDCH ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
                         A=character
 
                         A=character
 
                         Cy=carry flag
 
                         Cy=carry flag
 
</pre>
 
</pre>
=== &FFDD - OS_FILE ===
+
=== &FFDD - OSFILE ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
A=function              A=result
 
A=function              A=result
 
X=>control block        X=preserved
 
X=>control block        X=preserved
 
Filename address at X+0/1 is big-endian
 
Filename address at X+0/1 is big-endian
Control block addresses are big-endian unless indicated by OS_INIT
+
Control block addresses are big-endian unless indicated by OSINIT
 
</pre>
 
</pre>
=== &FFDA - OS_ARGS ===
+
=== &FFDA - OSARGS ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
A=function              A=result
 
A=function              A=result
Line 68: Line 68:
 
X=>data                X=preserved
 
X=>data                X=preserved
 
                         data updated
 
                         data updated
The data word is big-endian unless indicated by OS_INIT
+
The data word is big-endian unless indicated by OSINIT
 
</pre>
 
</pre>
=== &FFD7 - OS_BPUT ===
+
=== &FFD7 - OSBPUT ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
A=byte                  A=preserved
 
A=byte                  A=preserved
 
Y=handle                Y=preserved
 
Y=handle                Y=preserved
 
</pre>
 
</pre>
=== &FFD4 - OS_BGET ===
+
=== &FFD4 - OSBGET ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
                         A=byte
 
                         A=byte
Line 81: Line 81:
 
                         Cy=carry flag
 
                         Cy=carry flag
 
</pre>
 
</pre>
=== &FFD1 - OS_GBPB ===
+
=== &FFD1 - OSGBPB ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
A=function              A=preserved
 
A=function              A=preserved
 
X=>control block        Cy=carry flag
 
X=>control block        Cy=carry flag
Control block addresses are big-endian unless indicated by OS_INIT
+
Control block addresses are big-endian unless indicated by OSINIT
 
</pre>
 
</pre>
=== &FFCE - OS_FIND ===
+
=== &FFCE - OSFIND ===
 
<pre>On entry:              On exit:
 
<pre>On entry:              On exit:
 
A=function              A=handle
 
A=function              A=handle
Line 94: Line 94:
 
</pre>
 
</pre>
  
=== &FF9B - PRSTRING ===
+
=== &FFBF - OSINIT Initialise error handler and other environment settings ===
=== &FFA1 - SCANHEX  ===
 
=== &FFA7 - OSQUIT  ===
 
=== &FFAA - PRHEX    ===
 
=== &FFAD - PR2HEX  ===
 
=== &FFB0 - USERINT  ===
 
=== &FFB3 - PRTEXT  ===
 
=== &FFB9 - CLICOM  ===
 
=== &FFBC - ERRJMP  ===
 
=== &FFBF - OS_INIT Initialise error handler and other environment settings ===
 
 
<pre>                On entry, A=0 to become the current program
 
<pre>                On entry, A=0 to become the current program
 
                           A=$FF to just read the current settings
 
                           A=$FF to just read the current settings
Line 116: Line 107:
 
                 as they can be anywhere in memory.
 
                 as they can be anywhere in memory.
 
</pre>
 
</pre>
 +
 +
=== &FFBC - ERRJMP  ===
 +
=== &FFB9 - CLICOM  ===
 +
=== &FFB3 - PRTEXT  ===
 +
=== &FFB0 - USERINT  ===
 +
=== &FFAD - PR2HEX  ===
 +
=== &FFAA - PRHEX    ===
 +
=== &FFA7 - OSQUIT  ===
 +
=== &FFA1 - SCANHEX  ===
 +
=== &FF9B - PRSTRING ===
 +
  
 
== See also ==
 
== See also ==

Revision as of 01:48, 10 February 2022

A second processor for the BBC/Master containing a Motorola 6809.

The 6809 client MOS provides the basic system required to communicate with the host computer. The BBC MOS entry block is implemented by using the BA/BS signals to remap the hardware vectors to from &FFF0 to &FEF0.

MOS API Calls

Programs communicate with the kernal and MOS via an entry block at &FF80-&FFFF. Parameters are passed in the A, X and Y registers.

On entry, A, X, Y contain values to pass to system call
On exit,  A, X, Y contain returned data
          All addresses are big-endian, except where noted
          When an application starts it should call OSINIT which
          returns MI if little-endian addresses are being used.

&FFF7 - OSCLI

On entry:               On exit:
X=>command string       A=Return value

&FFF4 - OSBYTE

On entry:               On exit
A=function              A=preserved
X=first parameter       X=returned word
Y=second parameter      Y=returned word DIV 256
                        Cy=returned carry flag

&FFF1 - OSWORD

On entry:               On exit:
A=function              Control block updated
X=>control block        Y=returned line length for OSWORD 0
Text buffer address at X+0/1 with OSWORD 0 is big-endian

&FFEE - OSWRCH

On entry:               On exit:
A=character             A=preserved

&FFEC - OSWRCR

On entry:               On exit:
                        A=13

&FFE7 - OSNEWL

On entry:               On exit:
                        A=13

&FFE3 - OSASCI

On entry:               On exit:
A=character             A=preserved

&FFE0 - OSRDCH

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

&FFDD - OSFILE

On entry:               On exit:
A=function              A=result
X=>control block        X=preserved
Filename address at X+0/1 is big-endian
Control block addresses are big-endian unless indicated by OSINIT

&FFDA - OSARGS

On entry:               On exit:
A=function              A=result
Y=handle                Y=preserved
X=>data                 X=preserved
                        data updated
The data word is big-endian unless indicated by OSINIT

&FFD7 - OSBPUT

On entry:               On exit:
A=byte                  A=preserved
Y=handle                Y=preserved

&FFD4 - OSBGET

On entry:               On exit:
                        A=byte
Y=handle                Y=preserved
                        Cy=carry flag

&FFD1 - OSGBPB

On entry:               On exit:
A=function              A=preserved
X=>control block        Cy=carry flag
Control block addresses are big-endian unless indicated by OSINIT

&FFCE - OSFIND

On entry:               On exit:
A=function              A=handle
X=>string or
Y=handle

&FFBF - OSINIT Initialise error handler and other environment settings

                 On entry, A=0 to become the current program
                           A=$FF to just read the current settings
                 Returns X=>BRKV, Y=>ESCFLG, DP=>Direct Page, A,B=various
                         CC set from contents of A on return
                         A.b7=1: little-endian filing system calls (CC=MI)
                         A.b7=0: big-endian filing system calls (CC=PL)

                 This must be called by application code as part of its
                 startup, before writing anything to memory. Before making
                 this call, code does not known where BRKV and ESCFLG are,
                 as they can be anywhere in memory.

&FFBC - ERRJMP

&FFB9 - CLICOM

&FFB3 - PRTEXT

&FFB0 - USERINT

&FFAD - PR2HEX

&FFAA - PRHEX

&FFA7 - OSQUIT

&FFA1 - SCANHEX

&FF9B - PRSTRING

See also

External links

Jgharston 16:53, 6 November 2009 (UTC) Jgharston (talk) 23:41, 30 January 2016 (UTC) Jgharston (talk) 00:44, 10 February 2022 (CET)