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.


5. Block of Words

The R.O.M.E.68000 architecture provides for instructions that move entire blocks of words, and more generally perform collective operations on block of words. A block of words is what the word itself says: a group of consecutive locations in the memory array. The address of a block of words is the address of its first location, i.e., the one that lies at the lowest address; the length of a block of words is the number of locations in it: in particular, an empty set of locations is a block of length zero (its address is undefined). In fig. 2 a block of length 8 is shown, and is pointed out that the address of the block is the address of its first location.

Figure 2: A block of words

Very often a block will be denoted by X[n], where X stands for the address of its first location (i.e., the address of the block) and n is the length of the block. For instance, the block of fig. 2 could be indicated as base[8].

When a block of words occurs as the operand of an instruction, the address of the block is specified in the address field of that operand, and the length is deduced from some other source. For instance, among instructions that manage the multitasking environment there are some that require as an operand a particular data structure, called a program identifier, which occupies 4 consecutive locations of the core, that is, a block of length 4. In this case the length of the block is implicit in the instruction. On the other hand, there are instructions that copy a block from one place to another, letting you specify, in three operands, the address of the source, the address of the target and the common length of the source and the target. So we see that we are facing two types of blocks:

But of course, some limit must be imposed on the length of variable-size blocks, since otherwise a single instruction would be able to clear out the whole core! This limit is not fixed in the 68000: it is left to the implementator of the system to choose the value that he or she thinks is the best one, or, much better, to preset a table of values among which the final user of the system can choose. The 68000 provides for an instruction that lets programs know at run-time which value is currently being used.

If a program attempts to operate on a variable-size block specifying a length which is greater than the current limit, an error is generated and the program is killed. Note, however, that the limit imposed on the length of variable-size blocks does not affect fixed-size ones; for instance, if the limit is set to 2, you cannot manipulate variable-size blocks of length 4, but you can still use (without fear!) the fixed-size blocks of length 4 that contain program identifiers.

A restriction is imposed on the choice of the limit: it must be a power of two (or be zero: see below). Besides this, it should lie between 1 (that means abolition of the concept of block of words) and 256: greater values give too much destructive power to the programs. If a standard is needed, a value of 32 seems to be a good choice. Let me clarify what could be an ambiguous point: it is the limit of the size of variable-size block which must be a power of two; I am not saying that all variable-size blocks must have a power of two as their size. For instance, you cannot set the limit to be 13, since 13 is not a power of two; but if the limit has been set, say, to 16 (which is a power of two), you can perfectly well use in your program a block of length 13.

Particularly interesting is the case in which the limit on the length of variable-size blocks is set to zero; in this case such blocks cannot be used altogether, an error being generated if any attempt is made to access them (fixed-size blocks, of course, can still be used). You'll learn later that word-type data can only be moved in block of words, and hence copying a program (but also destroying it) becomes impossible in the situation just described: you can only play with number-type data. Metaphorically, you cannot use ``bomb'' to destroy your enemy's code, and you must fight against your opponent by altering the pieces of information that are vital to it. I haven't explored in any way the possibilities offered by this new situation, but I have ready a name for it: Core Cold War!


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

Gustavo MEZZETTI  /  mezzetti@math.unipd.it