MTermRX external tasks

Considerations for operation

INTRODUCTION:

The first thing that should be noted about an MTermRX external task is the sheer hackiness of the system.

But fear not, there is a reason for this.

The MTermRX terminal window in implemented by redirecting the VDU output into the terminal sprite. Then when your external task is executed, it does anything necessary to the terminal sprite to provide "enhancements". However, when your task is executed, MTermRX and therefore the terminal sprite get paged out. All RiscOS applications believe that they start at &8000 in memory and are the only task running...

The way around this was seem as simply dumping the sprite to disc, and expecting you to load it and deal with it. The biggest con with this system is the sheer complication of the loading and redirecting code. The pros, however, outweight the cons because you can how manipulate the sprite in any way you see fit... Even as weird as doing a binary sort on it!

Provided with MTermRX are C and BASIC sources to programs that will basically load the terminal sprite, do something to it (like plot a bunch of random lines) and save the sprite for MTermRX to reload.
Simple and relatively pointless, but it does illustrate the code required. Just paste the code segments into your own application, and go from there.

You should not assume anything about the spritefile, other than the presence of a sprite called "angelachase", with the following specifications:

MTerm does have partial support for a MODE 20 (hi-res) terminal window. However, as the MTermRX text routines cannot yet handle this, you are unlikely to meet the MODE 20 sprites.
It is, however, a good idea to support them...to future-proof your external task. So below is the dimensions of the MODE 20 sprite:

You cannot look at the size of the spritefile to guess the MODE, MTermRX currently saves ALL of its 'private sprites' (of which "angelachase" is only one of). The simplest way would be to:
  1. Find out the size of the sprite file.
  2. Dimension enough memory to load it.
  3. Set that memory up as a sprite area.
  4. Load the sprite file into the sprite area.
  5. Examine the statistics of the "angelachase" sprite.
...and from there you can do process the sprite as you need.

 

 

 

 

 

  This is an example of the Rbiorhythm task:

MTerm task; GIF 12K

 

 

 

 

 

 

WHAT REALLY HAPPENS?

Briefly, what happens is:

Sure, it is contrived... But on the other hand you can do any sprite operations you like, even replacing the sprite with another!

As long as the output sprite is physically IDENTICAL to the original, you can do pretty much anything.

ERK! THAT SOUNDS DIFFICULT!

A commented C example is given. The code is written with the minimum of extra libraries and should be quite easy to port to other languages as necessary.

Feel free to plagarise the code for your own purposes. It's a reasonably useless task that takes one CLI parameter and draws that value of random lines on the screen (min = 10, max = 250).

When your program is run, the entire command line passed as a SYS_ENQ parameter will be sent to run the task.

WHAT EXAMPLES ARE PROVIDED?

Rbiorhythm
Draws Richard Murray's biorhythm. A little example written in BASIC. Soon it will be expanded to offer the ability to draw YOUR biorhythm.
drawgraph
A simple graph plotting routine. Tasks settings as CLI parameters.
lines
An example of writing a simple external task. Source supplied.

IMPORTANT NEW ADDITION

The specifications have been updated so that MTermRX sets the system variable 'MTerm$SysEnq$Disable' to "No" before calling your task.
Your task should check this, and if it is set to "Yes", then your task should shut down without doing anything.
This is to allow some external software to control what (if any) tasks are allowed. The external software may implement your task within itself, or it may decide to override a newly downloaded task.
At time of writing, this method has not been fully coded - the system variable will always read "No". However this has been fixed in the next version of MTermRX.


Back to the MTerm index


Copyright © 1999 Richard Murray