CliSwi - SWI Calls from the Command Line

by Jonathan Hunt

CliSwi is a relocatable module which enables you to make SWI calls from the command line. Normally it is only possible to call SWIs from within programs or from the Basic prompt. Running the CliSwi application opens a directory viewer containing the module itself, called CliSwi, and a Basic program called MakeCliSwi which contains the module source code. To install the module, just double-click on the CliSwi file.

Once the module has been installed two new star commands will have been added to the operating system: *SWI and *SYS. Both commands do the same job
(and call the same piece of code) so it doesn't matter which one you use, but Basic programmers will find it more natural to use *SYS while ARM code programmers will find *SWI preferable.

To use the facility, press F12 to get to the command line, and you can then issue SWI calls using either of the alternative new commands, with exactly the same syntax as if you were using the SYS command in Basic. You can pass strings just as with SYS, but you cannot of course pass variable names. Nor can you set up parameter blocks, so it is not possible to make calls that require data to be passed in a parameter block.

The values returned by the call in ARM registers R0-R7 are placed into the system variables R$0 to R$7. As an example of the use of the commands, suppose that you want to find out the screen size of the current screen mode. In  Basic you would do this as follows:
  SYS "OS_ReadModeVariable",-1,7 TO ,,size%
In other words, the value is returned in R2 and here allocated to size%.

Using CliSwi from the command line, the call would be very similar:
  Swi "OS_ReadModeVariable",-1,7
and you would now read the value in R2 with:
  Show R$2

The program is fully described in this month's issue of RISC User magazine. 
  
  
 Copyright RISC User 1994