5 - Forth Interest Group
5 - Forth Interest Group
5 - Forth Interest Group
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
SEPARATED HEADS<br />
Klaus Schleisiek<br />
Memory in RAM-based systems can be<br />
used more efficiently by means of a<br />
"Symbol Dictionary Area ," which allows<br />
words and/or name and link fields<br />
which are needed only at compile time<br />
to be thrown away after compilation.<br />
Incremental use of these techniques<br />
will result in more efficient memory<br />
usage and will. also encourage the use<br />
of more and shorter definitions<br />
because there is no longer the need<br />
to pay the penalty of taking up<br />
memory space with numerous name and<br />
link fields.<br />
In the course of a two-year<br />
project I developed some tools which<br />
allow a significant compression of<br />
code in RAM-based systems. I also<br />
feel these methods will have a sig-<br />
nificant impact on programming style,<br />
particularly because they will encour-<br />
age the use of more and shorter<br />
definitions. The followicg is an<br />
explanation of these various functions<br />
in a somewhat historical order.<br />
My programming task was to develop<br />
a lightpen-operated sound system,<br />
which would allow control of a number<br />
of small sound synthesizers by point-<br />
ing a lightpen to various dots, light<br />
potentiometers, and the like on a<br />
video display. There was to be no<br />
keyboard intervention. A "dot" was<br />
put together by compiling a word<br />
which associated the following<br />
information:<br />
A) The shape of the dot itself as<br />
an address of some programmable<br />
character.<br />
B) The dot's location on the<br />
screen as an address relative<br />
to the upper left hand corner<br />
of the screen.<br />
C) As an option, either a text<br />
string or a string of program-<br />
mable graphics characters to<br />
be displayed above, below, or<br />
to either side of the dot.<br />
Thus, every "dot" served a double<br />
purpose. On the one hand, it des-<br />
cribed a portion of the display<br />
itself which had to flash on the<br />
screen. Secondly, it supplied the<br />
key to a large keyed CASE statement<br />
which associated the dot with the<br />
function to be performed when the<br />
lightpen was pointed to it. In other<br />
words, the definitions of the dots<br />
themselves were only needed at<br />
compile time .<br />
The dot definitions were used to<br />
create a densely packed "image" definition<br />
to flash the picture on the<br />
screen, while the addresses of the<br />
dot locations were used as keys in<br />
the CASE statement. So, to be memory<br />
efficient, I wanted to set up some<br />
mechanism which would allow the presence<br />
of "symbols" at compile time<br />
that could then be thrown away after<br />
compilation to free memory. By<br />
"symbol" I mean any legal FORTH<br />
definition that is only needed at<br />
compile time. This led to the idea<br />
of dividing the dictionary into "main<br />
dictionary" and " symbol dictionary . "<br />
Figure 1 shows the arrangement of<br />
this scheme based on the 6502's unique<br />
memory mapping.<br />
I<br />
1<br />
I<br />
I<br />
I<br />
I<br />
I<br />
1<br />
I<br />
I<br />
I<br />
I<br />
Figure 1<br />
FORTE DIMENSIONS II/5 Page 147