[comp.sys.atari.st] MX2 documentation

jsm@laird.UUCP (Jeffrey McArthur) (02/29/88)

Been a while (my modem died).  But here it is, the promiced documentation
for mx2.


The spacing is as the author wrote it.
 
-------------------- cut on dotted line ----------------------------------

PAGE - 1 -                     MX2 Multitasking Kernel




**************************************************************************
*               SHAREWARE                                                *
*               To register send $20.00 to                               *
*                                                                        *
*               Fred Brooks                                              *
*               4145 44ST #5                                             *
*               San Diego CA 92105                                       *
*                                                                        *
*               You will receive the complete Modula-2 source,           *
*               updates and programming examples for JSM2 and TDI.       *
*                                                                        *
*               MX2 V1.0.0    A multitasking and multiuser               *
*               environment for ATARI ST.                                *
*               Written using TDI Modula-2 3.01a Compiler                *
*               For TOS Versions 11/20 1985 and 04/22/87                 *
*               Other Versions may not run correctly.                    *
*                                                                        *
**************************************************************************


 Intro: MX2 is a multitasking environment to aid in program development
        for the ATARI ST. It was developed in Modula-2 but can be used
        with any language such as C, BASIC, or PASCAL. Suggested system
        minimum requirements are 1 MEG of memory with a double-sided
        disk drive. A hard disk drive will greatly improve system
        performance.
































                               MX2 Multitasking Kernel


PAGE - 2 -                     MX2 Multitasking Kernel


 NOTES:

        I have tuned this kernel for use with the GULAM shell. I have 
        had no problems using it exempt with the TE communications command.
        It locks up my background xmodem routines if it is used.                           























































                               MX2 Multitasking Kernel


PAGE - 3 -                     MX2 Multitasking Kernel


SYSTEM GENERATION:

        The MX2.INF file contains the system generation parameters.
        It is an ASCII files that can be edited with the UE editor in
        GULAM or any ASCII editor This files allows you to change the
        default system boot parameters
        If this file does not exist the default values are:
                numeric values are in decimal

        Init Command              : IP CLI.PRG
        System Memory             : 32000
        Alt Program HOTKEY        : 3276800
        Normal Mouse HOTKEY       : 3211264
        Cursor Mouse HOTKEY       : 3014656
        Reboot HOTKEY             : 1245184
        Reserved Memory           : 32000

        Initialisation command is normally used to load the SHELL
        program. The CLI.PRG enables GULAM.PRG to multitask then loads
        the program. If the program is exited the kernel will respawn
        the SHELL. To change the program change to IP "name of program"

        System memory is the size of the memory reserved by MX2 to
        allocate for it's internal data structures. The default size
        should be adequate for 7 MX2 processes with workspaces of 2K.

        Reserved memory is the size of the memory that will be released
        to the alternate program is available memory drops below
        the size of the reserved memory.































                               MX2 Multitasking Kernel


PAGE - 4 -                     MX2 Multitasking Kernel


INTERFACE LIBRARIES:

        The SYSCALL module is the standard interface for user programs
        to the MX2 Multitasking system. It includes functions to starting
        ending and controling concurrent processes. The TDILIB contains
        the TDI MODULA-2 3.01a libraries and JSM2LIB contains the
        JEFFERSON SOFTWARE MODULA-2 1.00 libraries. I will include a
        portable C library as soon as I can find out how the convert
        the code over.



















































                               MX2 Multitasking Kernel


PAGE - 5 -                     MX2 Multitasking Kernel


COMMUNICATIONS:

        Also included is a no frills communications program.  
        COM.TOS without options sets the AUX port to 1200BPS. 
        COM.TOS # "where # is a number" will set the AUX port to 
        the speed according to the table.
               0      =    300BPS
               1      =    1200BPS
               2      =    2400BPS
               4      =    4800BPS
               9      =    9600BPS
               H      =    19200BPS
        Use the [Undo] key to exit back to the CLI.















































                               MX2 Multitasking Kernel


PAGE - 6 -                     MX2 Multitasking Kernel


MX2 HOTKEYS:

        Hotkeys for several functions are included. These are the default
        keys they can be changed in the MX2.INF file.

        ALT m   = Load and switch to second CLI or program, the screen and status
                  of the first cli is saved. If used after the second
                  CLI has been loaded this command will switch back and
                  forth between the two. It is recommended that this
                  command only be used in TOS programs. If a you only press
                  RETURN after the program name prompt the CLI.PRG will
                  automatically be loaded.

        ALT r   = REBOOT computer. This is the same as pressing the
                  reset button.













































                               MX2 Multitasking Kernel


PAGE - 7 -                     MX2 Multitasking Kernel


BACKGROUND TIMER:

        The background timer CRON has been implemented. When MX2
        is started the file CRONTAB is read into memory. CRONTAB lists
        the start time and frequency of the MX2 command on that line to
        be executed. To stop the CRON from running the entries in the
        CRONTAB file you can rename it or after the the CLI is running
        issue the "SYS CRON OFF" command to stop.

        All times are in minutes. You may have up to 16 entries in the
        CRONTAB file. The format of the CRONTAB file is.

        Start Time      Frequency       Command
        0               60              SYS BP DUMMY.PRG

        midnight        every hour      run the DUMMY.PRG in background












































                               MX2 Multitasking Kernel


PAGE - 8 -                     MX2 Multitasking Kernel


NETWORKING:

        MX2 has a low speed disk sharing network built in the kernel. 
        The network uses the midi port to allow a second ST that
        is also running MX2 to use the remote ST's drives. The remote
        drives can be used just like your local drives but they will of
        course be slower because of the transfer of the data through the
        midi ports. The remote drives will start as the second drive ID
        after the last drive that you have on the local ST. For example
        if you have drives A,B,C,D,E,F then the remote drives will be
                           | | | | | |
                           H,I,J,K,L,M  To use the C drive on the remote
        system simply use the J: drive on the CLI. Be sure to cross connect
        the midi cables ie... the MIDI out to the MIDI in on the other ST
        and vice verse.
                            midi in ___  ___ midi in
                  ST 1                 \/                 ST 2
                           midi out ___/\___ midi out


        The MX2NET.PRG is a standalone network driver that runs from
        the DESKTOP or another GEM program. It can be installed in an
        AUTO folder or run from the DESKTOP. It will allow disk sharing
        between ST's that are not both using the MX2 environment.




































                               MX2 Multitasking Kernel


PAGE - 9 -                     MX2 Multitasking Kernel


MISC:

        The condition of the CapsLock is indicated by an asterisk in
        the upper right corner.
























































                               MX2 Multitasking Kernel


PAGE - 10 -                    MX2 Multitasking Kernel


Known Bugs, Fixes and Improvements:

        V1.0.0  The spooler will not work with networked files.


        V1.0.0  MX2.ACC accessory will allow MX2 to multitask in some GEM
                programs. The TDI editor will allow MX2 to switch when running
                this accessory.

        V1.0.0  Some programs will start up ok but on exit cause the system to
                crash. Probably caused by Term code. If I used Term(0) to end
                a program in MODULA-2 this will cause the problem. Solution:
                just let the program END without any GEMDOS Term command.















































                               MX2 Multitasking Kernel


PAGE - 11 -                    MX2 Multitasking Kernel


MX2 Commands:
                () mandatory parameter, [] optional parameter
                priories range from 1 to 10
                Always use SYS before all commands if run from
                the CLI.























































                               MX2 Multitasking Kernel


PAGE - 12 -                    MX2 Multitasking Kernel


Program Commands:

        IP      : Run Interactive Program. This is normally only used to
                  run the mx2 CLI when the kernel first boots. The kernel
                  will respawn the program if it terminates or exits.
                  USAGE : IP [priority] (filename) [command], 
                          SYS IP [priority] (filename) [command]

        BP      : Run Background Program.
                  Background programs use the same I/O vectors as the process
                  that started it.
                  USAGE : BP [priority] (filename) [command], 
                          SYS BP [priority] (filename) [command]

        FP      : Run Foreground Program.
                  Foreground programs always use the normal ST I/O vectors.
                  It's use would be to run programs that use the ST screen and
                  keyboard from processes that have been redirected to the
                  RS232 port or MIDI port.
                  USAGE : FP [priority] (filename) [command], 
                          SYS FP [priority] (filename) [command]







































                               MX2 Multitasking Kernel


PAGE - 13 -                    MX2 Multitasking Kernel


XMODEM COMMANDS:

        XR      : Receive an XMODEM file from remote computer.
                  USAGE : XR (filename), SYS XR (filename)
                        This command will start a background process to
                        download a file. If the download is complete a single
                        bell will sound at the console. If the download
                        aborted for some reason four bells will sound.

        XT      : Send an XMODEM file to a remote computer.
                  USAGE : XT (filename), SYS XT (filename)
                        This command will start a background process to
                        upload a file. If the upload is complete a single
                        bell will sound at the console. If the upload
                        aborted for some reason four bells will sound.

        XA      : Abort XMODEM transfers.
                  USAGE : XA, SYS XA
                        This command will abort all xmodem background
                        processes.

        XS      : XMODEM Status.
                  USAGE : XS, SYS XS
                        This command will display the current status of a
                        xmodem up or download.

        XCRC    : XMODEM crc MODE.
                  USAGE : XCRC, SYS XCRC
                        This command will set xmodem transfers to
                        Cyclic Redundancy Code error detection  method.

        XCKS    : XMODEM checksum MODE.
                  USAGE : XCKS, SYS XCKS
                        This command will set xmodem transfers to
                        Checksum error detection method.

























                               MX2 Multitasking Kernel


PAGE - 14 -                    MX2 Multitasking Kernel


PROCESS PRIORITY:

        NICE    : Change Process Priority.
                  USAGE : NICE (priority) [pid], SYS NICE (priority) [pid]
                        If NICE is called without a pid the current process
                        will be used.






















































                               MX2 Multitasking Kernel


PAGE - 15 -                    MX2 Multitasking Kernel


PROCESS COMMANDS:

        HP      : Halt Process.
                  USAGE : HP (pid), SYS HP (pid)
                        Pid is the process id number of the process you
                        wish to Halt. To start up a halted process use
                        the WP command. The HP command takes a process out
                        of the ready list and removes it from the CPU but
                        NOT from memory.

        WP      : Wakeup Process.
                  USAGE : WP (pid), SYS WP (pid)
                        Pid is the process id number of the halted process
                        you wish to Wakeup. The WP command puts the process
                        back into the ready list to be run in it's time
                        slot.

        PID     : Process Identifier.
                  USAGE : PID, SYS PID
                        Returns the Process Identifier of the current
                        process.







































                               MX2 Multitasking Kernel


PAGE - 16 -                    MX2 Multitasking Kernel


SPOOLER COMMANDS:

        SP      : Background file Spooler.
                  USAGE : SP (filename), SYS SP (filename)
                        puts file in process list to be printed. Unless
                        the path in included it will use the current dir.

        ASP     : Abort Spool.
                  USAGE : ASP, SYS ASP
                        Will terminated the current spool process and
                        allow the next to start if present.

















































                               MX2 Multitasking Kernel


PAGE - 17 -                    MX2 Multitasking Kernel


PROCESS STATUS COMMANDS:

        PS      : Process Status.
                  USAGE : PS, SYS PS
                        Display description of all system processes.

        PSL     : Process Status Log.
                  USAGE : PSL [filename], SYS PSL [filename]
                        Write to SYS.LOG file the description of all
                        system processes. If a filename is given the
                        description will be written to that file if
                        possible or else it will default back to SYS.LOG.

        ZS      : Zombie Process Status.
                  USAGE : ZS, SYS ZS
                        Display description of all inactive system 
                        processes.

        ZSL     : Zombie Process Status Log.
                  USAGE : ZSL [filename], SYS ZSL [filename]
                        Write to SYS.LOG file the description of all
                        inactive system processes. If a filename is 
                        given the description will be written to that file if
                        possible or else it will default back to SYS.LOG.




































                               MX2 Multitasking Kernel


PAGE - 18 -                    MX2 Multitasking Kernel


BACKGROUND TIMER COMMANDS:

        CRON    : Background Scheduler Timer.
                  USAGE : SYS CRON [ON OFF]
                        CRON with no options will display the current
                        timer table entries. CRON OFF disables the timer.
                        CRON ON read the CRONTAB file, reloads the timer
                        table then enables the timer.




















































                               MX2 Multitasking Kernel


PAGE - 19 -                    MX2 Multitasking Kernel


NETWORK COMMANDS:

        NETOFF  : Turn off MX2 network.
                  USAGE : NETOFF, SYS NETOFF

        NETON   : Turn on MX2 network.
                  USAGE : NETON, SYS NETON





















































                               MX2 Multitasking Kernel


PAGE - 20 -                    MX2 Multitasking Kernel


MX2 UTILITY PROGRAMS:

        SP.TOS          Same as the MX2 SP command except it runs
                        directly from the CLI.

        PS.PRG          Same as the MX2 PS command except it runs
                        directly from the CLI.

        ZS.PRG          Same as the MX2 ZS command except it runs
                        directly from the CLI.

        REDIR.PRG       Program to redirect screen and keyboard I/O to
                        the RS232 port. 

        COM.TOS         Program to communicate thru the RS232.

      SUBMIT.TOS [cmd]  Program to send string on the command line to the
                        keyboard buffer.
      SUBMITA.TOS [cmd] send string to RS232 buffer.

      MX2.ACC           Desk accessory to allow MX2 to multitask in
                        some GEM programs.






































                               MX2 Multitasking Kernel


PAGE - 21 -                    MX2 Multitasking Kernel


SYS.PRG  USAGE:

        The SYS.PRG reads it's command line and submits the command the
        the MX2 kernel. It's use to to give MX2 commands from another
        program such at GULAM. Example "SYS BP LOOP.PRG" will load
        and run LOOP.PRG as a background process. All MX2 commands
        can be used. To get a process status enter "SYS PS"        





















































                               MX2 Multitasking Kernel


PAGE - 22 -                    MX2 Multitasking Kernel


DESIGN and IMPLEMENTATION:

        MX2 is not a CLI shell. It provides a platform for system
        services for a CLI or programs. When MX2 boots it looks for 
        CLI.PRG in its directory. If it exists it will be run as an 
        Interactive Process as the command shell. 

        These are examples for use of the amulti kernel make use of the
        trap 15 interface. This makes it possible to use kernel services
        in other languages that allow inline assembly or code.

#1                              format for commands that require a string
        pea     buffer
        move.w  #8,-(sp) function number for sp
        trap    #15
        add     #6,sp
        .               
        buffer:
                .dc.b   'test.mod',0


                                format for commands that need only function #
#2      move.w  #11,-(sp) function number for pid
        trap    #15       display pid on stdout
        add     #2,sp
                          result in D0

#3                              format for vfork
        move.l  #subaddress,-(sp)                subroutine address
        move.l  #2000,-(sp)                      workspace size
        move.w  #23,-(sp)  function number for vfork of subroutine
        trap    #15
        add     #10,sp



























                               MX2 Multitasking Kernel


PAGE - 23 -                    MX2 Multitasking Kernel


DESIGN and IMPLEMENTATION:

           function     name         trap type

             0          off             #2
             1          st              #2
             2          ps              #2
             3          stl             #1
             4          psl             #1
             5          ip              #1
             6          bp              #1
             7          fp              #1
             8          sp              #1
             9          asp             #2
             10         cron            #1
             11         pid             #2
             12         neton           #2
             13         netoff          #2
             14         nice            #1
             15         hp              #1
             16         wp              #1
             17         xr              #1
             18         xt              #1
             19         xa              #2
             20         xs              #2
             21         xcrc            #2
             22         xcks            #2
             23         vfork           #3      runs a subroutine as a
                                                concurrent process. A
                                                RTS terminates the process.
             24         info            #2      returns a pointer the 
                                                current process descriptor
                                                in D0.
             25         rpid            #2      return the process id number
                                                in D0.
             26         tick            #2      force context switch
























                               MX2 Multitasking Kernel


PAGE - 24 -                    MX2 Multitasking Kernel


SETUP:
        
        Unarc the files and place them all in the same dir. You
        MUST have a copy of GULAM.PRG for the SHELL.
        Run MX2.PRG and the CLI.PRG will load and be ready for input.
        I have included a few batch files to set up and to help run a
        CLI in background to the RS232 port.


        Please let me know of any fixes that you come up with or
        improvements.

        HOME PHONE 619-584-0281 San Diego CA.   5PM-10PM Please.















































                               MX2 Multitasking Kernel

-------------------- cut on dotted line ----------------------------------


Jeffrey McArthur,     Laird Telemedia Inc.
                      2424 S. 2570 W.
                      Salt Lake City, Utah  84119
                      (801) 972-5900
{ihnp4,decvax,seismo!ut-sally}!utah-cs!utah-gr!uplherc!sp7040!laird!jsm

Gateway BBS
    (801) 562-1587
    running STadel 3.1g
    300/1200/2400/19200 (Telebit Trailblazer)
    24 hours
    106 Meg