home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / Z280 / RPM-TOUR.INF < prev    next >
Text File  |  2000-06-30  |  33KB  |  803 lines

  1. A cook's tour of the RP/M O/S:
  2.  
  3. Note: this document is not intended to replace the full RP operation
  4. manual.
  5.  
  6. The fundamental concept of rp is it's management of "remote partitions"
  7. to run application programs.  To understand this, we'll take a look at
  8. the standard CP/M run concept.  All operating systems owe to the concept
  9. of a program that is continually resident in the system, providing both
  10. an interactive program to allow user control of the running of
  11. application programs, and a set of "system services" designed to
  12. simplify program construction.  In CP/M, the system occupies the top
  13. portion of memory, and the application program the lower half.  This
  14. scheme has the characteristics:
  15.  
  16.     1.  The O/S and the applications program are mutually exclusive;
  17.         the space occupied by the system is unavailable to the applications
  18.         program, and vice - versa.
  19.  
  20.     2.  The applications program is not prevented from direct access to
  21.         O/S code, and therefore may "crash" the system by corrupting
  22.         the O/S code.
  23.  
  24.     3.  The system relies on "good conduct" of the applications program
  25.         in calling system services.
  26.  
  27. In any system, the reality is that the O/S and application must make use
  28. of the same memory, and the same processor.  However, two basic hardware
  29. aids can advance the level of the system considerably.  These are a good
  30. system memory management scheme and the use of hardware timers with
  31. interrupts.
  32.  
  33. Memory management allows the O/S and/or the application to see their own
  34. "virtual space", which allows the program to forget about the other
  35. programs running in the same processor, and makes "relocation"
  36. unnecessary.  The programs can be protected from each other either
  37. implicitly, such as a trap generated by the memory management system if
  38. a program tries to access.
  39.  
  40. Protection can also be inherent; if the memory management defines all
  41. available program memory without including the other program, the
  42. application simply does not have a means to damage the O/S.
  43.  
  44. Finally, a hardware timer allows the system to set a maximum "time
  45. limit" for the execution of a program; if the program is crashed or
  46. simply uncooperative, it cannot permanently hold the CPU.
  47.  
  48. A side benefit of the memory management for an address limited CPU such
  49. as the Z80 is that the program may have a full (64kb) partition or
  50. "virtual address space" to itself.   Both the operating system and the
  51. application program can make use of the full address space available.
  52.  
  53. The Z280 provides advanced abilities to set up partitions.  Also present
  54. are tools for the system to transfer bytes in and out of the partition
  55. (but not allow program access to the O/S!), and for an organized exit
  56. back to the system from a partition.
  57.  
  58. Besides the various traps and error conditions, the program obtains
  59. system services by the "SC" (system call) instruction.  65536 possible
  60. system calls are possible, but in reality a system call is one call, to
  61. one location, in the O/S.  This simplifies the work of keeping track of
  62. the application considerably.
  63.  
  64. The existence of a system call allows the program to make full use of
  65. it's memory space, without the problems associated with CP/M.  It may
  66. start at address 0 (vs.  $100), and use all the memory space it requires
  67. up until the end of memory at $ffff.
  68.  
  69. This is indeed how the "native" service system for rp works.  This will
  70. be discussed at the end of this tour.
  71.  
  72. O/S emulation:
  73.  
  74. With enough effort, there probably isn't any previous Z80 O/S
  75. environment that can't be emulated.  The Z280 can simulate any memory
  76. arrangement, even trap and emulate I/O instructions.  How much trouble
  77. it is, however, is another story.  Fortunately, CP/M was constructed
  78. according to a few basic rules which make things simpler (and in my
  79. option had a lot to do with CP/M's portability):
  80.  
  81.     1.  The system calls all occur through a single "vector"
  82.         (the BDOS jump).
  83.  
  84.     2.  No direct access to system data is allowed.
  85.  
  86.     3.  No specific location of the O/S was ever set.
  87.  
  88. Of course, that's the way CP/M started out!  Since then, two basic
  89. violations of these rules have become standard practice.  Programs
  90. directly access the set of BIOS vectors, and directly setting the I/O
  91. connection byte (iobyte) before making a system call.  This is done even
  92. by the original CP/M utility "pip".  By and large, however, CP/M is a
  93. very reasonable target for emulation.  The common example of running
  94. under coprocessors on an Apple or IBM - PC is proof of that.
  95.  
  96. All right, so how do we emulate CP/M under rp/m? looking at the basic
  97. layout of a CP/M partition:
  98.  
  99.                      -----------------
  100.                      | System page   | --> WBOOT vector
  101.                      |               | --> BDOS vector
  102.                      -----------------
  103.                      | TPA           |
  104.                      |               |
  105.                      |               |
  106.  
  107.                      |               |
  108.                      |               |
  109.                      -----------------
  110.                      | System        |
  111.                      |               |
  112.                      -----------------
  113.  
  114. Several assumptions are standard.  The BDOS vector both points to the
  115. entrance to the system services package, and also defines the last
  116. usable TPA byte plus one.  The WBOOT vector points to the entrance to
  117. the warm boot routine, and incidentally indexes the BIOS vector table +
  118. 3.  In the system page are defined several standard pieces of data,
  119. including current drive, user, I/O connection, and the command line and
  120. parameters passed to the program.
  121.  
  122. The layout for RP looks like this:
  123.  
  124.          ---------------                   ------------------
  125.          | RP          |                   | System page    |
  126.          |             |                   ------------------
  127.          |             |                   | TPA            |
  128.          |             |                   |                |
  129.          |             |                   |                |
  130.  
  131.          |             |                   |                |
  132.          |             |                   |                |
  133.          |             |                   ------------------
  134.          |             | <<------------->> | System         |
  135.          |             |                   | Communications |
  136.          |             |                   | Area (SCA)     |
  137.          ---------------                   ------------------
  138.  
  139. First of all, the applications program runs in an entirely different
  140. partition from the system.  It's only method of getting back to the
  141. system partition is by a system call, or by tripping some error
  142. condition, such as execution of an illegal instruction, access or other
  143. violation.
  144.  
  145. The system page is simply an emulation of the normal CP/M system page.
  146.  
  147. The current drive, user, iobyte and command parameters are all updated
  148. by the O/S.  The WBOOT and BDOS jumps index areas in the SCA for
  149. emulation.
  150.  
  151. The SCA totally replaces the BDOS and BIOS sections in a CP/M system.
  152.  
  153. Basically, all BDOS and BIOS function calls are turned into system calls
  154. here.  There is, then, only the one entry back to the system: the SC
  155. instruction.  When rp receives a system call, it emulates the CP/M
  156. action of the associated function.
  157.  
  158. MULTIPLE TASK:
  159.  
  160. Going from this to a multiple task situation only requires that instead
  161. of just one program partition, we implement N many partitions, each with
  162. their own CP/M compatible environment.  Rp must "traffic" the system
  163. requests to and from each partition, simultaineously with other
  164. partition calls.
  165.  
  166. Internally to rp, there are only "tasks", the number of which is only
  167. limited by the system memory available:
  168.  
  169.         --------------------
  170.         | rp               |
  171.         |                  |
  172.         |  --------------  |
  173.         |  | Task       |  |
  174.         |  | Control    |  |
  175.         |  | Block      |  |
  176.         |  --------------  |
  177.         |                  |
  178.         |  --------------  |         -----------------
  179.         |  | TCB        |----------->| Partition     |
  180.         |  --------------  |         -----------------
  181.         |                  |
  182.         |  --------------  |         -----------------
  183.         |  | TCB        |----------->| Partition     |
  184.         |  --------------  |         -----------------
  185.         |                  |
  186.         --------------------
  187.  
  188. Tasks executed in parallel by rp may execute entirely within the O/S
  189. partition, or they may be allocated an applications partition, and
  190. therefore run a CP/M application.
  191.  
  192. THE RP MONITOR:
  193.  
  194. The users view of the system usually is via the rp built - in monitor.
  195.  
  196. All the commands found in CP/M, plus a few more, are implemented.
  197.  
  198. The basic command line for rp appears as:
  199.  
  200.      <command> <parameters> {[;/&] <command> <parameters>}
  201.  
  202. Much as a standard CP/M command line, except that any number of commands
  203. may be entered on a line, separated by either ";" or "&".  Separation of
  204. commands by ";" causes each command to be executed, in turn, with rp
  205. waiting for the last one to complete before starting the next.
  206.  
  207. Separation of commands by "&" means that rp will not wait for the last
  208. command to complete, but go on to start the next one (in parallel).
  209.  
  210. commands are one of the following:
  211.  
  212.     1.  Aliases.  If the command given matches an alias name,
  213.         that is executed.
  214.  
  215.     2.  Built - in.  If the command given matches an internal
  216.         command, that is executed
  217.  
  218.     3.  Submit.  If a file by the name command.sub exists, that
  219.         is interpreted under the rules for an exec file.
  220.  
  221.     4.  Application program.  If a file by the name of command.com
  222.         or command.pgm exists, that is given it's own partition
  223.         and executed.
  224.  
  225. Note that these command types are executed in the order given.  If an
  226. alias is defined with the same name as a application program, the alias
  227. is executed first.  The search mechanism can be circumvented by directly
  228. specifying what type of command is meant.  Therefore command.com can
  229. only be a CP/M command, command.sub can only be a submit, d0:command can
  230. only be an application or submit, etc.
  231.  
  232. ALIASES AND SUBMITS:
  233.  
  234. An alias is defined by the alias command:
  235.  
  236.      alias command <line of text for the alias>
  237.  
  238. All the text following the alias name is entered into the alias
  239. definition.
  240.  
  241. When the alias is invoked, the contents of the alias are executed.
  242.  
  243. Note that ALL the remaining line past the alias command is entered into
  244. the alias definition, including any ";" or "&" characters (therefore
  245. nothing further is executed after the alias definition).  The current
  246. aliases defined may be listed out via the lalias command.
  247.  
  248. In the case of a submit, the submit file is executed.
  249.  
  250. Both the contents of an alias and a submit are the same command lines as
  251. can be executed directly.
  252.  
  253. When a submit or alias is executed, each line will be printed out before
  254. it is executed, along with the name of the alias/submit, and the number
  255. of the line being executed.
  256.  
  257. If printout is not desired, the commands noshowsubmit, or noshowalias
  258. will turn this off.  The commands showsubmit, or showalias will turn the
  259. print back on again.
  260.  
  261. Aliases and submits can be executed within other aliases or submits,
  262. with out any limit on the nesting level.
  263.  
  264. STANDARD ALIASES:
  265.  
  266. You have probably noticed that the built - commands are somewhat
  267. verbose.
  268.  
  269. This is intentional.  The long form command names are better for
  270. insertion in a alias or submit, to make them self - documenting, and
  271. they are less likely to conflict with the names of applications
  272. programs.  Finally, new names for built - in commands can be created to
  273. your heart's content using the alias mechanism.  For the rest of this
  274. tour, we will place the aliases we use for commands after the proper
  275. name as command (alias).
  276.  
  277. Some of the commands already discussed are: showsubmit (shows),
  278. noshowsubmit (noshows), showalias (showa), noshowalias (noshowa).
  279.  
  280. FILE SPECIFICATION:
  281.  
  282. Files under rp consist of a file name, with optional extension.  Where
  283. allowed, The characters "*" and "?" can be used to match multiple
  284. filenames.  Otherwise, the characters "a" - "z", the digits, and the
  285. character "_".  Note that rp does not allow ANY character to appear in a
  286. filename as was the case in CP/M.
  287.  
  288. This is enforced in exchange for the advanced command processor.  For
  289. the disk area prefix, all of the following are valid:
  290.  
  291.      d:    - Drive.
  292.  
  293.      d0:   - Drive/user.
  294.  
  295.      name: - Directory name.
  296.  
  297. PATHS:
  298.  
  299. Three paths may be set by command.  commandpath (cpath) sets the search
  300. path for commands, submitpath (spath) sets the search path for submits,
  301. and helppath (hpath) sets the path for help files.  The form is:
  302.  
  303.      cpath a0: b: command:
  304.  
  305. Any number of valid area names may be specified.
  306.  
  307. MACRO SUBSITUTION:
  308.  
  309. Macros are character sequences that are expanded in each line before
  310. execution.  They are introduced by the "!" character.  The macros
  311. available are:
  312.  
  313.      !! - The character "!".
  314.  
  315.      !<digit> - A word from the calling line, from the 1st to the ninth.
  316.  
  317.      !<name>  - A string variable.
  318.  
  319.      !(<expression>) - A string expression.
  320.  
  321.      !$ - The current time/date.
  322.  
  323.      !# - The current drive, in lower case.
  324.  
  325.      !% - The current drive, in upper case.
  326.  
  327.      !^ - The current drive/user, in lower case.
  328.  
  329.      !& - The current drive/user, in upper case.
  330.  
  331.      !* - The current directory label.
  332.  
  333.      !~ - The entire calling command line.
  334.  
  335. The typical use of macros is to get parameters from the calling line for
  336. an alias or submit.  The usual "0" - "9" is available, but the entire
  337. line can be processed to recover parameters past the ninth.
  338.  
  339. EXPRESSIONS:
  340.  
  341. A full expression processor is built in to rp.  The key to understanding
  342. rp expressions is to realize that the only "type" operated on is the
  343. string.
  344.  
  345. When a number is given, it is checked for proper numeric format, but
  346. actually entered as a string.  When a math operator is given, the
  347. strings given as operands are converted to a value, the operation
  348. performed, then the result converted back to a string.  The point of
  349. this is to dispense with the need for string conversion operators.  This
  350. gives the expression processor the type freedom as found in the "snobol"
  351. language.  The basic objects that can be operated on are:
  352.  
  353.     1.  'constant' - Any quoted sequence of characters is a string.
  354.  
  355.         the " character is the same as any other character.  Two
  356.         quotes back - to - back are interpreted as a single quote.
  357.  
  358.         The character "\" is used to "force" the next character,
  359.         including a quote or "\".  Additionally, a standard ascii
  360.         control mnemonic such "\eot", or "\cr" may appear, or
  361.         if followed by a number, the ascii equivalent will be
  362.         entered.
  363.  
  364.     2.  <number> - Numbers, in the range 0 - 65535 may be entered.
  365.  
  366.         These may be preceded by "$" (hex), "@" (octal), "%" (binary).
  367.  
  368.     3.  <variable> - A character sequence beginning with a letter or "_",
  369.         and followed by any sequence of letters, digits or "_" is a
  370.         string variable.
  371.  
  372. Note that macros can be used in expressions, as: '!1' would be a string
  373. containing the first caller parameter.
  374.  
  375. The operators, in precedence order are:
  376.  
  377.      <a> = <b>     - Numeric equality.
  378.  
  379.      <a> == <b>    - String equality.
  380.  
  381.      <a> # <b>     - Numeric inequality.
  382.  
  383.      <a> ## <b>    - String inequality.
  384.  
  385.      <a> < <b>     - Numeric less than.
  386.  
  387.      <a> << <b>    - String less than.
  388.  
  389.      <a> > <b>     - Numeric greater than.
  390.  
  391.      <a> >> <b>    - String greater than.
  392.  
  393.      <a> <= <b>    - Numeric less than or equal.
  394.  
  395.      <a> <<= <b>   - String less than or equal.
  396.  
  397.      <a> => <b>    - Numeric greater than or equal.
  398.  
  399.      <a> =>> <b>   - String greater than or equal.
  400.  
  401.      <a> + <b>     - Addition.
  402.  
  403.      <a> ++ <b>    - Concatenation.
  404.  
  405.      <a> - <b>     - Subtraction
  406.      <a> or <b>    - Logical "or".
  407.  
  408.      <a> * <b>     - multiplication.
  409.  
  410.      <a> ** <b>    - String a replicated b times.
  411.  
  412.      <a> / <b>     - Division.
  413.  
  414.      <a> mod <b>   - Modulo.
  415.  
  416.      <a> xor <b>   - Logical "xor".
  417.  
  418.      <a> shl <b>   - Value a shifted left b times.
  419.  
  420.      <a> shr <b>   - Value a shifted right b times.
  421.  
  422.      <a>[<b>]      - The bth character of string a.
  423.  
  424.      <a>[<b>,<c>]  - The characters in string a from position b
  425.                      to position c.
  426.  
  427.      <a>[~<b>]     - The bth word of string a.
  428.  
  429.      <a>[~<b>,<c>] - The words in string a from position b
  430.                      to position c.
  431.  
  432.      +<a>          - The positive value of a.
  433.  
  434.      -<a>          - The negative value of a.
  435.  
  436.      not <a>       - The logical "not" of a.
  437.  
  438.      $$<a>         - The hexadecimal conversion of a.
  439.  
  440.      @@<a>         - The octal conversion of a.
  441.  
  442.      %%<a>         - The binary conversion of a.
  443.  
  444.      ^<a>          - The number of characters in string a.
  445.  
  446.      ~<a>          - The number of words in string a.
  447.  
  448.      ?<a>          - A string containing the files matching the file
  449.                      specification a.
  450.  
  451. Typical expressions:
  452.  
  453.      2+2                     - The single character string '3'.
  454.  
  455.      2++2                    - The string '22'.
  456.  
  457.      2+'4'                   - The string '6'.
  458.  
  459.      2++'4'                  - The string '24'.
  460.  
  461.      ~'the rain in spain'    - The string '4'.
  462.  
  463.      'hi'**5                 - The string 'hihihihihi'.
  464.  
  465.      'special'[5]            - The string 'i'.
  466.  
  467.      'the rain in spain'[~3] - The string 'in'.
  468.  
  469.      $$10                    - The string '$a'.
  470.  
  471.      5 < 10                  - The string '65535'.
  472.  
  473.      10 < 5                  - The string '0'.
  474.  
  475.      ?'test.*'               - A string containing all files 'test' of any
  476.                                extension.
  477.  
  478. COMMON COMMANDS:
  479.  
  480. The directory (dir) (ls) (files) (cat) command will list the directory
  481. of the current disk area, or any given area(s).  The type command types
  482. out the contents of the given files(s).  The directories (pwd) (map)
  483. command will print all disk areas (that are named) available for use.
  484. The erase (era) (scratch) command will erase the given files.  copy will
  485. copy file(s) from anywhere to anywhere, and will also concatenate a
  486. group of files into one, or move multiple files, or even move files and
  487. change the names of the files at the same time.  move is similar to
  488. copy, except the source will be deleted if the move is successful.  The
  489. help command without parameters gives a list of helps available, and
  490. given a subject, will type out the help file for that.
  491.  
  492. Echo types a line of text, and calculate (calc) types the result of a
  493. string expression.  The comment (c) command causes the rest of the line
  494. after the command to be ignored.  The prompt command sets the current
  495. command prompt.
  496.  
  497. Assign assigns the value of a string variable, and input inputs a string
  498. from the console to a string variable.  time prints or sets the current
  499. system time.  Clock prints the system CPU clock speed, and tick prints
  500. the multiprocessor tick time.
  501.  
  502. Mount and unmount cause a disk to be either placed on line, or taken off
  503. line.
  504.  
  505. Rp is a strictly mount oriented system; all disks, even floppys, must be
  506. specifically mounted and unmounted to prevent malfunction.  Although
  507. this may seem a rather painful restriction, it speeds O/S operations,
  508. because the disk does not have to be continually "checksummed" to see if
  509. it has been changed, and disk sectors may be buffered to and from the
  510. disk.
  511.  
  512. The connect statement allows the connection of logical to physical
  513. devices, as:
  514.  
  515.      connect lst:=lpt: - Connect logical list to lpt:
  516.      connect con:=crt: - Connect logical console to crt:
  517.  
  518. For more information on these commands, use the help function under rp.
  519.  
  520. RUNNING APPLICATIONS PROGRAMS:
  521.  
  522. Besides just running an application program, several controls are
  523. available.
  524.  
  525. Normally, CP/M translates the command line given the program to upper
  526. case.
  527.  
  528. This causes many programs problems, such as find, which can't be used in
  529. a straight - forward way to look for lower case.  nouppercase will allow
  530. lower case command lines to be passed to the program, and uppercase
  531. reverses this.  Whether or not an application can perform direct I/O
  532. (execute an "in" or "out" instruction is controlled by the directio and
  533. nodirectio commands.
  534.  
  535. If it is not desired to allow the program to access the disk directly
  536. via BIOS sector calls, the commands readdirect, noreaddirect,
  537. writedirect, and nowritedirect will allow/disallow this.  Whether or not
  538. the program can set the attributes of a file (and thus, say, set a read
  539. only file back to read/ write) is controlled via the setattribute and
  540. nosetattribute commands.
  541.  
  542. PROTECTIONS:
  543.  
  544. In a multi - user environment, it is necessary to provide a means to
  545. disallow access to given disk areas/privileges/devices.  All such
  546. permissions have only an exclude command to disallow them.  This is an
  547. extra protection feature; once lost, there is nothing a program or user
  548. can do to get them back.  The exclude command is used to exclude access
  549. to a given drive, drive/user, or device:
  550.  
  551.      exclude d: - Disallows access to drive d:.
  552.  
  553.      exclude command: - Disallows access to the command directory.
  554.  
  555.      exclude d1: - Disallows access to drive d:, user 1.
  556.  
  557.      exclude lpt: - Disallows access to the lpt: device.
  558.  
  559. Excludedirect excludes the ability to perform direct disk reads and
  560. writes, and also excludes the permission to change that mode.  Excludeio
  561. eliminates the ability to perform direct I/O.  Excludemount takes away
  562. the ability to mount and unmount disks.  Excludeattribute eliminates
  563. attribute set ability.
  564.  
  565. excludetimeset disallows setting of the system time.
  566.  
  567. FLOW OF CONTROL:
  568.  
  569. A full set of flow - of - control commands are resident in rp.  Together
  570. with the full expression ability, the exec "language" of rp is quite
  571. capable, and in fact, quite reasonable programs can be written in it.
  572.  
  573. The prime limitation is simply speed.  Running a program off disk will
  574. by definition not be fast.  The statements if, else, elseif, and endif
  575. provide conditional execution.  The repeat, until, while and endwhile
  576. commands provide looping control, and the command break will abort any
  577. loop.
  578.  
  579. Finally, the label and goto commands allow completely arbitrary flow of
  580. control, to any point in the program, using standard alphanumeric
  581. labels.
  582.  
  583. There is no limit whatever on where the flow - of - control commands may
  584. be executed.  They may be used equally well immediately from the
  585. console, in an alias, or in a submit.  No limit exists on how far a goto
  586. will jump, or how many repeat or while loops may be nested.
  587.  
  588. A good example of general program construction is given by bbs.sub, the
  589. exec file that runs the bbs (temporarily, until we get a hardcoded bbs
  590. in).
  591.  
  592. MULTITASKING/MULTIUSER:
  593.  
  594. As stated, any number of tasks may be run under rp, and any number of
  595. users. The only limit is the available system memory used to keep track
  596. of these tasks.  The current list of tasks running is given by the
  597. taskstatus (tstat) (ts) command.  Several statistics will be given on
  598. each task, including the number of task (numbered from 0, the first task
  599. to be started in rp, to whatever task was started last), the name of the
  600. program running, whether the task is running or stopped, if it is
  601. attached to the console, what console it is attached to, the number of
  602. open files, the home disk directory, the time it was started and how
  603. long it has been running.  Tasks may be killed with the kill command, or
  604. stopped with stop, or resumed with resume.
  605.  
  606. A task may be detached from the console with detach, or reattached with
  607. attach.  This is done if, say, you are going to use a full screen editor
  608. and do not want the printout from the task to disturb your work.
  609.  
  610. The command excludeglobaltask (yes, that is the longest built - in
  611. command name) will eliminate access to tasks not connected to the
  612. present terminal.
  613.  
  614. They will not appear in the task status, nor is any control over them
  615. allowed.
  616.  
  617. As we have said, ANY built in command, alias, submit or application can
  618. be run either as a "foreground" or "background" task.  Additionally, the
  619. execution processor that receives and executes user commands is itself a
  620. task under rp.  The execute (exec) command causes a new executive to be
  621. branched off (an exec always runs in parallel).  The exec command is the
  622. key to multiple user work:
  623.  
  624.      exec connect con:=crt:
  625.  
  626. If the main system is running under, say, tty:, and another terminal
  627. (user) is available under crt:, the above statement would "start up" an
  628. executive for that terminal.  The command:
  629.  
  630.     exec startup
  631.  
  632. Would do the same, but cause the submit file startup.sub to be executed
  633. first, before allowing the user on that terminal to execute direct lines
  634. from the console.  Typically, the startup file would have statements
  635. setting the console that is to be used, the home disk area, and the
  636. standard aliases used.  Also, exclude statementsthe bbs terminal on this
  637. system.
  638.  
  639. If multiple tasks are allowed to run on a single terminal, the result
  640. typically is chaos; tasks fight over the characters coming from the
  641. keyboard, and the outputs of the two tasks mix on output.  To provide
  642. control for this situation, you can enable a multiple task "contention"
  643. handler for the console.  The buffer and nobuffer statements enable and
  644. disable this mode.
  645.  
  646. In buffered mode, each task has it's own input and output line buffer,
  647. and can output characters even when not currently being displayed on the
  648. console.
  649.  
  650. If any task completes it's line (with cr/lf), the whole line is printed
  651. on the console, and whatever task was "interrupted" by this is
  652. reprinted.  In other words, lines are allowed to mix on the console, but
  653. not characters.
  654.  
  655. All the tasks currently running under the console act as if arranged in
  656. a circle.  If console controls are enabled (discussed in a bit), the
  657. CTL-R character will cause the next task in the circle to be displayed
  658. on the console.  The task being displayed is the one that gets the input
  659. from the console, and can be controlled by console characters.
  660.  
  661. The controls and nocontrols commands enable or disable the console
  662. control characters.  These are:
  663.  
  664.      CTL-R - Rotate to next console task.
  665.  
  666.      CTL-W - Stop presently displayed task (whether it wants to or not).
  667.  
  668.      CTL-E - Resume a task stopped by CTL-W.
  669.  
  670.      CTL-T - Terminate a task (whether it likes it or not).
  671.  
  672.      CTL-Y - Flush input queue (dispose of all waiting characters).
  673.  
  674. These characters are deliberately picked to avoid the usual controls for
  675. a program, such as CTL-S (stop), CTL-Q (resume), CTL-C (cancel).  The
  676. console control characters are processed without knowledge or permission
  677. from the application running; CTL-T will terminate even a crashed
  678. program.
  679.  
  680. A 256 byte input queue may be enabled for each console on the system.
  681. The queue and noqueue commands enable or disable the queue.  Characters
  682. will be saved in the input queue whether or not the program running is
  683. accepting them.
  684.  
  685. This provides the "type ahead" function usually implemented in multitask
  686. systems.  The CTL-Y character will cause any characters in the queue to
  687. be disposed of.
  688.  
  689. If a task not being displayed requires input from the console, the
  690. command demand will allow the console display to be automatically
  691. shifted to that task.  The nodemand command disables this mode.
  692.  
  693. Experience with the multiple display system is best gained by actual
  694. use.
  695.  
  696. THIS WAY OUT:
  697.  
  698. With such a diverse environment as that of the Z80, rp was built with
  699. the intention of support for for multiple operating systems interfaces
  700. and file formats.  Thus in the future, support for systems on the Z80
  701. will be expanded.
  702.  
  703. The systems on Z80 include CP/M 2.2, CP/M 3.0, ZCPR, MP/M, Concurrent
  704. CP/M, and OASIS being the most popular.  With the notable exception of
  705. ZCPR, these systems all share one rather depressing characteristic;
  706. support by the original programmers has been suspended, and that support
  707. has not been carried on by others.  It strikes this programmer that the
  708. attitude of both terminating support on a large piece of code AND
  709. refusing to properly pass on the source to others smacks of a "take your
  710. bat and ball and go home" attitude.  In designing a new O/S interface, I
  711. think it helps to consider that you are creating a virtual standard.  A
  712. list of calls should not be simply a random list of features, with more
  713. features dumped at the end of the list to add function, or often to
  714. correct deficiencies of the preceding calls.  Creating a system
  715. interface that is regular enough to be easily ported to other systems is
  716. the greatest favor an O/S programmer can do for applications writers,
  717. and an acknowledgement that the applications are far more important than
  718. the O/S itself.
  719.  
  720. Why design a custom interface for rp at all ? Starting with a clean
  721. slate enables us to cleanly and clearly support the new features of both
  722. rp and the Z280.  I also believe that no microprocessor interface to
  723. date with the exception of UNIX (which did not start out on a
  724. microprocessor) displays good quality and careful design.  Obviously,
  725. however, each new O/S designer has come to that conclusion, accounting
  726. for the interface to each new O/S being incompatible with others.
  727.  
  728. Rp compensates (but does not ultimately correct !) for this situation by
  729. providing an organized solution for foreign interface support.  These
  730. modules internal to rp are call Foreign Operating Systems, or FOS
  731. modules.
  732.  
  733. A FOS under rp intercepts all system calls, traps and other exceptions
  734. from a target program.  For the present version, two FOS modules are
  735. built in to rp; the CP/M fos and the RP fos.
  736.  
  737. RP NATIVE INTERFACE:
  738.  
  739. Calls to rp are performed directly by the Z280 "sc" instruction.  Each
  740. system call number corresponds to a different system function.  A
  741. standard set of system error codes is returned in a (with 0 meaning no
  742. error), and all parameters being passed in registers.  If an invalid or
  743. unsupported system call is used, and error for that will be returned.
  744.  
  745. The system calls used are quite simple and logical.  File names are
  746. passed as strings, and the required parsing of file names is carried out
  747. by the O/S.
  748.  
  749. The program is not required to keep or maintain "fcb's" in it's own
  750. memory.
  751.  
  752. Files are kept track of using small logical file numbers.
  753.  
  754. Files under rp are universal; the file string specified for opening can
  755. be the name of a file, an I/O device, or even a logical file/device
  756. name.
  757.  
  758. Devices can be read or written the same way as ordinary files.
  759.  
  760. Files under rp are blockless; the program can specify any number of
  761. bytes to be read or written from 1 to 65535, without any need to perform
  762. blocking or deblocking.
  763.  
  764. The system calls currently available under rp fos are:
  765.  
  766.      terminate - Terminates the program run.  Will also accept an
  767.                  error code, and print the message corresponding
  768.                  to the standard error.
  769.  
  770.      open      - Accepts a file name string, and mode flags.
  771.  
  772.                  The given file or device is opened, and
  773.                  a logical file number from 1 to 255 is returned.
  774.  
  775.      close     - Closes a file by the logical file number.
  776.  
  777.      read      - From 1 to 65535 bytes are read from the given file
  778.                  to program memory.
  779.  
  780.      write     - From 1 to 65535 bytes are written to the file
  781.                  from program memory.
  782.  
  783.      location  - The current byte location in the file is returned.
  784.  
  785.      position  - The file position is moved to the given location.
  786.  
  787.      length    - The number of bytes in a file are returned.
  788.  
  789.      size      - The number of bytes in a file are set (the file
  790.                  is truncated).
  791.  
  792.      copy      - A file by a given string is copied to the file
  793.                  given in a destination string.
  794.  
  795.      move      - A file by a given string is moved to the file
  796.                  given in a destination string.
  797.  
  798.      time      - Returns the current time and date.
  799.  
  800.      schedule  - Accepts a time and date, and stops the program
  801.                  until PAST that time and date (if the date given
  802.                  has already past, return is immediate).
  803.