The 1456 object code system.

William Overington

Copyright 2000 William Overington

This document introduces 1456 object code, (in speech, please say "fourteen fifty-six object code") and its applications.

The 1456 object code system provides a method of programming Java applet quality output on screen without the programmer needing to program in Java. The programmer programs in 1456 object code, within param statements of an applet call, using an ordinary text editor, such as Notepad. In order to produce a 1456 application a programmer sets up an HTML page and includes a call to a Java applet chosen from the range of applets that are available for producing 1456 applications, and includes 1456 object code in one or more param statements.

For example, a minimal program.

<applet code="Applet1456.class" width=300 height=500>
<param name="SOFTWARE01" value="1:H">
</applet>

Here the applet chosen is Applet1456 which is a plain background with no user input capabilities and with drawing of lines, shapes and text, including numbers, as the only output of the applet. The Applet1456 applet might be used where it is desired to produce a curve such as the sine function as a diagram. There are a collection of applets available for producing 1456 applications. These are known as 1456 applet landscapes. For example, one of them has two buttons, each of which can be programmed using 1456 object code. Another has four buttons and four text boxes. The 1456 programmer simply chooses the 1456 applet landscape that best suits his or her needs from the collection available, then programs using 1456 object code, thus customizing the 1456 applet landscape for the required use. Each of the 1456 applet landscapes uses the same 1456 engine, which is in a file named Engine1456.class.

In the program above, the 1456 object code consists of the three characters 1, : and H. This is a very minimal program. Useful 1456 programs will consist of more characters, maybe hundreds of characters, but useful programs can be produced using less than one hundred characters.

The 1:H program is characteristic of all 1456 programs in that it is produced entirely using 7 bit ascii printing characters. 1456 object code is unlike many object codes in that it is expressed using 7 bit ascii printing characters. 1456 object code sits balanced between being in some ways like an assembler code, in some ways like a programmable calculator code and in some ways like a high level language. It is designed specifically for its task, namely of providing a method of producing portable software for distance education applications both over the internet and by telesoftware broadcasts where the programmer does not need to be a Java programmer, nor need to have available Java facilities, yet wishes to produce Java quality results.

In the 1:H program, the 1: defines label 1 and the H means halt. In running a 1456 program, the program starts to run at the instruction immediately after label 1 and continues to run until an H command is reached. In this minimal program, the H is the command immediately after label 1, so the program immediately finishes, just after it has started. 1456 object code consists of a sequence of characters, but the 1456 engine regards some characters as being in pairs so as to produce one command. For example, where a & character is encountered, then the & character and the next character are considered as one command; likewise a ! character and the next character are considered as one command, and a $ character and the next character are considered as one command. In speech, the command !J is said as "super J". The use of two character commands allows more commands to be available than if just single character commands had been used, however, in addition, the opportunity has been taken to use the first character of the two character commands to have meaning. For example, the 1456 object code system uses typed variables, in that there are integers and floating point numbers. Numbers in either format can be added. The + command is used to add two floating point numbers and the &+ command is used to add two integers. 1456 floating point numbers are implemented using the Java double type, that is double precision floating point numbers. In general & commands are used for integers, for example, &+ &- &* &/ and &w.

The 1456 engine has the following registers for arithmetic.

There are an a register and a b register for integers, namely ai1456 and bi1456.

There are an a register and a b register for floating point numbers, namely ad1456 and bd1456.

There is also an array of memory locations for integers, mi1456 from mi1456[0] to mi1456[99], and an array of memory locations for floating point numbers, md1456, from md1456[0] to md1456[99].

When 1456 object code is entered into the 1456 engine the code is scanned for labels, signified by a : command, and the address immediately after each label is stored in an array of label addresses. No other operation takes place at load time. At run time, if a : command is reached, it is treated as a no operation character, as it is only there to designate a place in the code and the designation information has already been acted on at load time. The : character reached at run time needs to reset the 1456b registers to zero and prepare to receive digits correctly. This need be of no concern to a person programming in 1456 object code and using a ready prepared 1456 applet landscape as this reseting of registers is carried out automatically by the 1456 engine that the 1456 applet landscape is using.

Comments may be placed within 1456 code. Any characters between a { character and a } character are ignored. Comments can be useful to the programmer. A comment counts as an instruction and so must not be between a label number and a : character or between two instructions involving the use of either or both of the b registers.

Consider the 1456 object code program below.

1:342&wH

This program simply loads the number 342 into the ai1456 register. At load time the place immediately after the : is stored as the location of label 1, so upon running the program the 1456 engine needs to process in turn the characters 3, 4, 2, &, w and H in that order. At commencement the ai1456, bi1456, ad1456 and bd1456 registers are all set to zero.

The character 3 is considered. The value of bi1456 is multiplied by 10 and 3 added. The value of bd1456 is multiplied by 10.0 and 3.0 is added. Thus bi1456 contains 3 and bd1456 has 3.0 in it.

The character 4 is considered. The value of bi1456 is multiplied by 10 and 4 added. The value of bd1456 is multiplied by 10.0 and 4.0 is added. Thus bi1456 contains 34 and bd1456 has 34.0 in it.

The character 2 is considered. The value of bi1456 is multiplied by 10 and 2 added. The value of bd1456 is multiplied by 10.0 and 2.0 is added. Thus bi1456 contains 342 and bd1456 has 342.0 in it.

The & and the w are considered together. The &w command loads the content of bi1456 into ai1456, overwriting whatever was there previously.

The H causes the program to halt.

Consider the 1456 object code program below.

1:342.7&wH

This program simply loads the number 342 into the ai1456 register. At load time the place immediately after the : is stored as the location of label 1, so upon running the 1456 engine needs to process in turn the characters 3, 4, 2, ., 7, &, w and H in that order. At commencement the ai1456, bi1456, ad1456 and bd1456 registers are all set to zero.

The character 3 is considered. The value of bi1456 is multiplied by 10 and 3 added. The value of bd1456 is multiplied by 10.0 and 3.0 is added. Thus bi1456 contains 3 and bd1456 has 3.0 in it.

The character 4 is considered. The value of bi1456 is multiplied by 10 and 4 added. The value of bd1456 is multiplied by 10.0 and 4.0 is added. Thus bi1456 contains 34 and bd1456 has 34.0 in it.

The character 2 is considered. The value of bi1456 is multiplied by 10 and 2 added. The value of bd1456 is multiplied by 10.0 and 2.0 is added. Thus bi1456 contains 342 and bd1456 has 342.0 in it.

The . character is considered. This does not alter any values in the registers, but a note is made by the 1456 engine that future digits are behind the decimal point.

The character 7 is considered. The bi1456 register is unaltered. The bd1456 register has 342.7 in it.

The & and the w are considered together. The &w command loads the content of bi1456 into ai1456, overwriting whatever was there previously.

The H causes the program to halt.

As written, the two programs each load the number 342 into the ai1456 register.

The program

1:342.7wH

would cause the value 342.7 to be loaded into the ad1456 register. Please note that w is used for the floating point load, whereas &w is used for the integer load.

In order to load a negative number, the !- command must be used. This is because the - character on its own is used for subtraction of floating point numbers. Thus to enter a number -5 as an integer into the ai1456 register, the code is as follows. This is a little unfortunate aesthetically, but is the price of the ease with which 1456 code can be easily entered using 7 bit ascii characters and is no great problem once one gets used to it and remembers to include the ! character.

!-5&w

Consider now the program

1:2&w3&+H

Space characters that are between 1456 object code instructions are ignored by the 1456 engine. The ignoring is when the first or only character for interpretation of a 1456 object code instruction is being obtained from memory: if a space is found the next character is fetched, this being repeated as many times as is necessary until a character that is not a space is found. This means that this piece of software could also be written as below, though for completeness it is here stated that spaces should not be placed between the individual characters of a two character instruction.

1: 2&w 3&+ H

That is, 1: is the label definition.

The 2&w loads 2 into the ai1456 register.

The 3&+ adds 3 into the ai1456 register.

The H character halts the program.

For this particular program, the ai1456 register contains the value 5 at the end of the program.

Please consider the program below.

1:2w3+H

As space characters are, subject to the rules mentioned above, ignored, this piece of software could also be written as below.

1: 2w 3+ H

That is, 1: is the label definition.

The 2w loads 2.0 into the ad1456 register.

The 3+ adds 3.0 into the ad1456 register.

The H character halts the program.

For this particular program, the ad1456 register contains the value 5.0 at the end of the program.

The commands w + - * / are available for floating point arithmetic.

The w is for loading, + is for addition, - is for subtraction, * is for multiplication and / is for division.

The commands &w &+ &- &* &/ &% are available for integer arithmetic.

The &w is for loading, &+ is for addition, &- is for subtraction, &* is for multiplication, &/ is for division and &% is for modulus.

A number in the b registers must be used immediately, either as an integer or as a floating point number. It cannot be used as both, it is one or the other, and only immediately: after an instruction the contents of the b registers will be replaced by 0 and 0.0 ready for any possible incoming digit from the 1456 code, which is interpreted character by character as the program runs.

The memory is accessed as follows.

Storage into memory is performed by the index number of the memory location followed by the store command. For example 7&> will store whatever is in ai1456 into mi1456[7]. For example, 8> will store whatever is in ad1456 into md1456[8].

It is interesting to note that the 7 and the 8 in the above will have been loaded into both the bi1456 and bd1456 registers as, at the time, the 1456 engine did not know whether the 7 and the 8 were addresses of memory locations or numbers to be loaded or added or multiplied or whatever.

Retrieval from memory is performed by the get command. For example 7&< will make a copy of whatever is in mi1456[7] and place it in the bi1456 register. For example, 8< will make a copy of whatever is in md1456[8] and place it in the bd1456 register.

Please note, that storage is from the a register, retrieval is to the b register.

Once a retrieved number is in the b register it can be loaded into the corresponding a register or added onto whatever is already in the corresponding a register, or subtracted or whatever.

Please note in particular that whereas when a number is entered into the b registers directly in the 1456 code, there is a valid number in each b register, yet when a number is retrieved from memory there is only a number in the b register corresponding to the type of variable(that is, integer or floating point) and must be used by the next instruction.

In particular please note that a number recovered from memory and wished to be placed in the corresponding a register must use w or &w as appropriate as the next following instruction.

For example, 7&<&w or 8<w need to be used to get an integer from integer memory 7 or a floating point number from floating point memory 8 respectively and place the result in the corresponding a register.

In order to place a floating point version of whatever is in ai1456 into ad1456, the I command is used.

In order to place an integer version of the whole number part of whatever is in ad1456 into ai1456, the &D command is used.

Various mathematical functions may be performed on the contents of the ad1456 register, the result being placed in the ad1456 register, overwriting the original content.

Command s produces the sine function.

Command c produces the cosine function.

Command t produces the tangent function.

Command !s produces the arcsine function.

Command !c produces the arccosine function.

Command !t produces the arctangent function.

Command e produces the exponential function.

Command n produces the natural logarithm function.

Command q produces the square root function.

Command !r converts from degrees to radians.

Command !d converts from radians to degrees.

In addition, the following are available.

Command p puts the floating point representation of pi in ad1456, computed from 4 times the arctangent of 1.

Command r produces a random number from greater than or equal to 0.0 to less than 1.0 in value.

The program operation may be changed by using a jump command. For example, to continue processing from label 23 use 23J in the software, though 23: must be included somewhere else in the software, or program operation will go to the very start of the software, which may not necessarily be label 1, though in many cases it will be.

It is possible to call subroutines. For example, to call a subroutine at label 27 use 27C in the software, though 27: must be included somewhere else in the software, or program operation will go to the very start of the software, which may not necessarily be label 1, though in many cases it will be. In addition, when the program reaches a R command, program control will return, continuing from the command immediately after the C command. Subroutine calls may be nested, though not to a huge depth.

The linkflag1456 is now introduced, which is a boolean value which is either true or false. The Jump on linkflag1456 being true command is !J and the Call subroutine on linkflag1456 being true command is !C and the Return on linkflag1456 being true is !R.

The linkflag1456 is set as either true or false by a number of instructions, some of which work with integers and some with floating point numbers.

Comparison is always between the a register and the b register of the type. The value of the a register is not affected. The b register will be cleared in the normal course of events, though not by the compare instruction as such.

Floating point comparisons.

If a equals b is coded by the !E command.

If a is greater than b is coded by the !G command.

If a is less than b is coded by the !L command.

These are straightforward to remember from the first letters of the words equals, greater and less.

If a is not equal to b is coded by !F where F is the next letter after E.

If a is greater than or equal to b is coded by !H where H is the next letter after G.

If a is less than or equal to b is coded by !M where M is the next letter after L.

Integer comparisons.

If a equals b is coded by the &E command.

If a is greater than b is coded by the &G command.

If a is less than b is coded by the &L command.

These are straightforward to remember from the first letters of the words equals, greater and less.

If a is not equal to b is coded by &F where F is the next letter after E.

If a is greater than or equal to b is coded by &H where H is the next letter after G.

If a is less than or equal to b is coded by &M where M is the next letter after L.

Thus by setting linkflag1456 by means of a compare instruction and then using !J or !C or !R as appropriate, control over program instruction obeying order can be achieved.

The value of the linkflag1456 may be made the opposite of its present value by the N command.

1456 object code

Copyright 2000 William Overington