ISO IEC 20060:2010 pdf download – Information technology — Open Terminal Architecture (OTA) — Virtual machine
5.2 Stack Notation OTA is based on an architecture incorporating push-down stacks (Last In First Out lists). The data stack is used primarily for passing parameters between procedures.
The return stack is used primarily for system functions such as procedure return addresses, loop parameters, etc. The VM contains other specialised stacks that are described later. Stack parameters input to and output from a procedure are described using the notation: (stack-id before — after) Individual items are listed using the notation in Table 1 above. Where an operation is described that uses more than one stack, the data stack stack-id is S:, and the return stack stack-id is R:. When there is no confusion possible, the data stack stack-id may be omitted. If the parameters that a procedure uses or returns may vary, the options are separated by a vertical bar, indicating “or”. For example, the notation ( — addr | 0 ) indicates that the procedure takes no input and returns either a valid address or zero. The notation i*x or j*x indicates the presence of an undefined number of cells of any data type (x); this is normally used to indicate that the state of the stack is preserved during or restored after an operation.
5.3 Flags Procedures that accept flags as input arguments shall treat zero as false, and any non-zero value as true. A flag returned as an argument is a “well-formed” flag with all bits zero (false), or all bits one (true). Certain device control and other functions return an ior to report the results of an operation. See Annex C for specific ior values. An ior may be treated as a flag in the sense that a non-zero value is true; however, it is not necessarily a well-formed flag, as its value may be used to convey additional information. By convention a value of zero for an ior implies successful completion (i.e., no error), while non-zero values may indicate an error condition or other abnormal status.
6 OTA virtual machine
6.1 General principles The software in every OTA terminal is written in terms of a common “virtual machine.” This is a theoretical microprocessor with standard characteristics that define addressing mode, stack usage, register usage, address space, etc. (see 6.2 Virtual Machine CPU below for details).
The OTA kernel for each particular CPU type shall be written to make that processor emulate the virtual machine. The virtual machine concept makes a high degree of standardisation possible across widely varying CPU types, and simplifies program portability, testing, and certification issues. The virtual machine provides the following services:
⎯ standard CPU and instruction set, represented by OTA tokens; ⎯ standard I/O support for common devices, with provisions for generic I/O to support additional devices that may be added;
⎯ database management functions;
⎯ TLV management, including format conversions and other functions; ⎯ management of token modules, including maintaining them in storage (updating as necessary) and executing them on demand.
These services are described in detail in Section 5 of this International Standard.
The fundamental design concepts underlying OTA technology are discussed in Annex F.
OTA provides program portability across heterogeneous terminals by treating terminal pro-grams as the intermediate code of a compiler. This code consists of streams of byte-codes, called OTA tokens. Terminals then process this code by interpreting it or by other means such as native code compilation. It is assumed that together with an implementation of an OTA virtual machine an Implementation Conformance Statement is made available.
The OTA token set covers two areas. The first is the instruction set of a processor architecture (the virtual machine), which provides the instructions necessary for the efficient execution of programs. The second provides what are normally called “operating system functions”. In those terminals for which OTA is designed, system functions include specific functions such as I/O drivers and TLV management; and also inter-module access and access control mechanisms.
6.2 Virtual Machine CPU The OTA virtual machine (VM) is based on a multiple stack architecture. This architecture is most commonly seen in the Forth programming language (see ANSI X3.215-1994 for the ANS Forth standard). This architecture has been further modified for portability, code density, security, ease of compilation, and for use with other programming languages. For example, it contains provisions for local variable frames used in C. Thus, OTA token compilers can be written not only for Forth but also for C and other languages.