The software interrupt in the 1456 object code system.

William Overington

Copyright 2000 William Overington

In designing the 1456 object code system I have been conscious that if it is to become a widely accepted type of standard system for the programming of Java applets for telesoftware and for the internet by means of including 1456 object code in parameters of an applet call on HTML pages, then it must carefully balance compactness with the potential to be able to perform a wide range of computations effectively.

The problem may be crystalized by considering the case of Bessel functions. Bessel functions are some mathematical functions that are useful in engineering mathematics for situations involving circular symmetry, such as heat transfer in cylinders. Readers may well be familiar with sine and cosine functions that are usually supplied with software systems, as they are in Java. Like sine and cosine functions, Bessel functions have the concept of providing a numerical argument to the function and receiving a numerical result. The very fact that Bessel functions are not usually supplied with software systems makes them good examples for this discussion as they well illustrate the point. For example, it would on the one hand be unfortunate if 1456 object code could never be used to program elegant graphs of Bessel functions and computations involving Bessel functions, yet on the other hand it would be unfortunate if every 1456 object code application had to have bandwidth taken up by the including of Bessel functions within the 1456 engine, when the vast majority of applications would not use them. This situation will also apply to many other functions as well.

Several possibilities arise. One possibility is that someone might write subroutines in 1456 object code that compute Bessel functions. These could be made available in an electronic library and could be copied and pasted into one or more parameter statements of an applet call in an HTML page for those 1456 object code applications that need them. Another possibility is that that 1456 object code from a library could be copied and pasted into a string in the 1456 applet landscape and the 1456 object code loaded automatically into the 1456 engine by the 1456 applet landscape when it starts running. This would be an improvement as the person programming the 1456 object code of the HTML page would not need to concern himself or herself with loading the functions into the 1456 engine, however this approach would need the cooperation of someone who were able to program in Java and were able to set up the 1456 applet landscape.

Given that the cooperation of someone who could program in Java were needed, a better approach would be for the Bessel functions to be programmed in Java within the 1456 applet landscape. The question then arises as to exactly how these functions are made available to a running 1456 object code program.

Fortunately, the desired effect can be easily achieved within the 1456 object code system by the use of the software interrupt command. The software interrupt is coded as ? and a software interrupt parameter is set as having the value of the bi1456 register when the software interrupt takes place.

This is not at all difficult to implement. In fact, an integer variable within the 1456 engine (a Java int variable) named softwareinterruptparameter is set as having the value of the bi1456 register when the software interrupt takes place and then the 1456 engine stops running, just as if an H command (that is, Halt) had been obeyed. The method obeySoftwareAtLabel is defined as

public char obeySoftwareAtLabel(Graphics screen,int entrylabel)

and the character returned is either 'z' or 'H' or '?' as appropriate. The 'z' is returned if 1456 object code at the required entrylabel has not been defined. After return of the program operating point to the software in the 1456 applet landscape, the software in the 1456 applet landscape may, if so desired, be programmed so that the value of the returned character is examined. It need not be examined if that particular 1456 applet landscape is not designed to support 1456 software interrupts. If not examined, it is just the same to the 1456 applet landscape as to whether control has been returned by an H halt or by a ? software interrupt. If the returned character is examined and it is a ? then the 1456 applet landscape should carry a software interrupt service routine, probably within the paint() function, that may, if so chosen, obtain the value of the software interrupt parameter, and take a path through Java software in the 1456 applet landscape program as desired, accessing and altering integers, doubles, characters and strings within the 1456 engine as desired by simulated direct memory access. The software interrupt service routine may also perform other activities as desired, such as displaying images from graphics files on the screen. When the Java software of the software interrupt service routine within the 1456 applet landscape has been completed and it is desired to reenter the 1456 engine at the point in the 1456 object code just after the software interrupt, the method

obeySoftwareAfterSoftwareInterrupt(Graphics screen)

can be obeyed. In fact, there are two methods provided, namely

obeySoftwareAfterSoftwareInterrupt(Graphics screen)

and

obeySoftware(Graphics screen)

which have the same effect. In fact, the method obeySoftwareAfterSoftwareInterrupt simply calls obeySoftware and passes its resulting character back through itself. The function obeySoftwareAtLabel also calls obeySoftware, though in the case of obeySoftwareAtLabel the call to obeySoftware is after a little processing to set the position of the operating point in the 1456 object code software. The obeySoftware method simply obeys from the known point, regardless of whether it has just been set up by the call to the obeySoftwareAtLabel method or whether it has been remembered from when the software interrupt occurred. It is a matter of programming style as to whether restarting the 1456 engine after a software interrupt uses the method obeySoftware or obeySoftwareAfterSoftwareInterrupt. My suggestion is to use obeySoftwareAfterSoftwareInterrupt as in that way anyone looking through the source code of the 1456 applet landscape at a later date may more easily understand what is happening.

Thus, should it be desired to use 1456 object code to compute using Bessel functions by using a software interrupt, then a 1456 applet landscape providing a selection of Bessel functions will be needed. The Bessel functions would be programmed in Java. Consider that one is now programming in 1456 object code in conjunction with such a 1456 applet landscape. Suppose that the programmer of the 1456 applet landscape that supplies Bessel functions has decided that, say, when the software interrupt parameter has a value of 301 then the software interrupt service routine will take a copy of the value of the contents of ad1456 by simulated direct memory access, compute the zeroth order Bessel function of the first kind of that argument value directly in Java, and then place the result value back in ad1456, replacing the value that was there previously.

The programmer of the 1456 object code being used with that particular 1456 applet landscape could compute the value of the zeroth order Bessel function of the first kind of the value that is in ad1456 by the 1456 object code

301?

which is quite straightforward to do. Please compare and contrast this with knowing that to compute the cosine of the value that is in ad1456 the code would have simply been

c

and that to compute the exponential function the command

e

would have been used.

Certainly, the 301? would only work for the particular 1456 applet landscape or landscapes that recognize a software interrupt with the software interrupt parameter having a value of 301 as being to compute a zeroth order Bessel function of the first kind, whereas the c and e command would work for all 1456 applet landscapes.

It is a matter of balance. Certainly, it may well be helpful for a document listing prefered software interrupt parameter values for implementing mathematical functions to exist as part of the infrastructure of the 1456 object code system, using numbers above 100. Please note that it is not only mathematical functions that could be produced by software control from the 1456 object code using the ? command. For example, suppose that an image from a graphics file is to be displayed only when some condition occurs in the 1456 object code. The graphic could be preloaded by the 1456 applet landscape at start up and displayed if and only if a command such as

7?

were obeyed within the 1456 object code.

Here is a list of the methods of the Engine1456 class.

// public class Engine1456

// public Engine1456()

// public void loadSoftwareFromAppletParameters
//                         (String stringofsoftwarefromparameters)
// public void loadSoftwareFromString(String stringofsoftware)
// public void loadStringFromString(int i,String stringoftext)

// public char obeySoftwareAtLabel(Graphics screen,int entrylabel)
// public char obeySoftwareAfterSoftwareInterrupt(Graphics screen)
// public char obeySoftware(Graphics screen)

// public void ad1456Set(double doublevalue)
// public double ad1456Get()
// public void double1456Set(int i,double doublevalue)
// public double double1456Get(int i)

// public void ai1456Set(int integervalue)
// public int ai1456Get()
// public void integer1456Set(int i,int integervalue)
// public int integer1456Get(int i)

// public void ac1456Set(char charvalue)
// public char ac1456Get()
// public void char1456Set(int i,char charvalue)
// public char char1456Get(int i)

// public void as1456Set(String stringvalue)
// public String as1456Get()
// public void string1456Set(int i,String stringvalue)
// public String string1456Get(int i)

// public int softwareinterruptparameterGet()

// private void loadSoftware()

Please note that the methods loadSoftwareFromAppletParameters and loadSoftwareFromString are identical in their effects, both of them calling the loadSoftware method. The two methods with different names are provided so that the software listing of a 1456 applet landscape can show clearly which software has been loaded from applet parameters and which, if any, has been provided from within strings coded into the Java source code of the 1456 applet landscape.

Please note that the method loadStringFromString is not the same as the method string1456Set as loadStringFromString processes the string that it supplies to resolve any 'u sequences whereas string1456Set does not carry out any processing to resolve any 'u sequences. Although the loadStringFromString method is intended primarily to enter strings contained in applet parameters STRING01 to STRING09 where these are used, it may also be used to enter strings ms1456[0] to ms1456[19] into the 1456 engine so that 'u processing may take place during the entering. This could be a useful approach if text is being entered in a text box by a user, as it allows the possibility that the user could enter accented characters into the text box in unicode format using a 'u sequence.

Supplementary note added on 14 October 2000.

I have altered the meaning of the ? command to the following extent. When a zero or negative value is in the bi1456 register at the time of the software interrupt, the software interrupt parameter takes the value of the ai1456 register minus the value of the bi1456 register. The result may be positive, zero or negative. The software that I have used in my own implementation of the 1456 engine is as follows.

            if (c == '?')
              {
                if (bi1456 > 0)
                  {            
                    softwareinterruptparameter=bi1456;
                  }
                else // if bi1456 is zero or negative
                  {
                    softwareinterruptparameter=ai1456 - bi1456;
                  }
              }

I am aware that, although I have previously added instructions to 1456 object code that this is the first time that, for the present 1456 object code system, that I have altered the meaning of a command after it has been published. This raises various issues. Accordingly, as well as this supplementary note added to a previously published document for the benefit of people reading this document for the first time on or after 14 October 2000, I am writing an additional new document drawing attention to this change and placing it next in the sequence of documents so that people who have already read this document before the addition of this supplementary note will become aware of the change. Issues concerning the changing of the definition of a previously published command are also mentioned as well as an explanation of the reasons for the change.

1456 object code

Copyright 2000 William Overington