R.O.M.E.68000 Home
Prev. Table of Cont. Help Cont. of This Ch.

This is the R.O.M.E.68000 Manual version 0.51.
This is an experimental version.
Copyright © 1997 by G. Mezzetti; last update: January 1, 1999.


3. Language Used in Formal Descriptions

To describe formally the action of an instruction, we shall make use of a language similar to Pascal; anyway, we are not interested in a full programming language, but only in that part of it which concerns control structures. Although the notation will be self-explanatory to experienced programmers, nevertheless we want to outline briefly the definition of our language.

The little ``programs'' which describe instructions are made up of a sequence of statements in ``imperative'' style. For now, all statements are assignments: an expression is evaluated and the resulting value is assigned to a variable, which can be an identifier among A, B, L, and IP, or a temporary variable indicated by an identifier written in lowercase letters (usually ``temp''); for simplicity, such temporary variables are not declared at the beginning of the sequence. The assignment symbol is the arrow ``-->'', pointing from left to right to indicate the direction of the assignment. Double assignment (that is, exchange) is also used, and is indicated by the double arrow ``<->''. Expressions are almost always arithmetic ones, plus a few non-arithmetic functions concerning block of words which are defined below. Arithmetic expressions are written using the common notation: the signs ``+'', ``-'', ``='', ``≠'', ``<'', ``>'', ``≤'', and ``≥'' have their customary meaning, ``*'' indicates multiplication, ``DIV'' denotes integer division, ``MOD'' denotes the arithmetical modulus (that is, x MOD y is the remainder of the division of x by y); remember that all arithmetic calculations are performed in the way described in Section 9 of Chapter I. There is also the special symbol ``cc'' (standing for ``condition code'') which is used in the description of the SKcc family to indicate one of many possible comparison operators. As already said in Section 8 and Section 9 of Chapter III, the operator ``@'', followed by an argument enclosed within round parentheses, extracts the (absolute) address of its argument; for instance, ``@(A)'' evaluates to the absolute address of (the location of the core containing) operand A. Finally, round parentheses (``('' and ``)'') are used, as usual, to group sub-expressions.

Sequential execution is indicated by simple juxtaposition of instructions, listed one below the other separated by semicolons (``;''). A full stop (``.'') marks the end of the action being described. We don't need ``while'' or ``for'' loops [1], but we need the ``if'' ... ``then'' ... ``else'' ...``end if'' construction; we borrow it from Modula-2, where it appears with ``elsif'' clauses too:

if <condition 1> then
   <segment 1>
elsif <condition 2> then
   <segment 2>

...

elsif <condition n> then
   <segment n>
else
   <segment n+1>
end if

The semantic of this control structure is well known: <condition 1>, <condition 2>,... through <condition n> are tested one after the other in the order given, to search the first of them that evaluates to ``true''; if one such is founded, call it <condition i> for i in the set {1, 2, ... , n}, then <segment i> is executed, and after it execution continues below the end if line; if none such is founded, then <segment n+1>, if present, is executed, and after it execution continues below the end if line (the else clause is optional).

Comments can be placed almost everywhere (as usual, in every place where a space can be put), and are enclosed within braces (``{'' and ``}'').

We need now to define some functions which we are going to use in the sequel. We shall give their interface in strict Pascal syntax, and to do this we shall pretend to have defined some types: ``blockOfWords'' will be the type of a variable containing a block of words (of variable length, so it couldn't be a true Pascal variable!), ``location'' will be the type of a variable containing one location of the core, and ``number'' will be the type of a variable containing a number-type datum.

These functions will be used in the next sections to give a formal appearance to statements which, substantially, remain informal!


Prev. Table of Cont. Help Cont. of This Ch.

Notes

[1] Actually, ``for'' loops are implicitly used when handling multiple operands of variable length, but these loops do not appear explicitly in the descriptions of instructions, because there multiple operands are referred to as a whole, and the details of how they are fetched from memory are not considered at all.

[2] In Section 3 of Chapter I we said that word-type data can only be moved or tested for equality or inequality; all other operations that we have introduced or will introduce on word-type data do reduce to these two basic ones, but this does not. Since it requires to mask out the value field, the ability to recognize a correct (or an alterable) data item cannot be reduced to a simple comparison with a constant word, as in the case of blank locations (see next functions), but is a genuine new one. So, after all, we didn't say all the truth about word-type data!


Gustavo MEZZETTI  /  mezzetti@math.unipd.it