This procedure's call allows us to output value of the variables
of different types (INTEGER, CHAR, BOOLEAN) to display screen.
It is evident that this construction is in some parts
similar to assign operator: both of them
load the value of necessary variable.
The execution of WRITE construction consists from 2 steps:
get value of the variable to fixed register (R1 for "E97" and AX for Intel)
print this value using ROM subroutines.
Here we'll consider mainly the second part, because the first was under discussion
in assignment.
"COMPAS" compiles WRITE construction to a call of standard output subroutine.
In "E97" these subroutines are placed into ROM, and for Intel code - into
Run-Time Library (RTL), which automatically adds to every executable program code.
Operator's structure
"E97" code bricks
Example of full operator in "E97" code
Intel code bricks
Example of full operator in Intel code
I called bricks the short pieces of code,
that "COMPAS" generate as a part of operator. Compiler builds result machine
code from the bricks.