Skip to content
beginning of expansion authored by Pim van Tend's avatar Pim van Tend
## 12. Entering blocks 13 - 47
For the moment we abandon the use of a blocks file. We could type in
the listing as interactive input after metaforth's OK prompt. If we then
make a mistake and mess up the system, we would be forced to start all
over. Besides, this way we can only save a compiled system, not its
source code.
The solution to this is copy-paste. We type the listing into a normal
ascii text file. We mark a chunk of it in our editor of choice, and do
ctrl-c (for copy). Then we go to the OK prompt of the simulated forth
system, and do ctrl-shift-v (for paste, we need to use shift because we
are in a terminal). And look: we see metaforth eating
(in fact compiling) our text as if it was being typed in by a monkey,
saying OK after every carriage return. Solution found!
We must be very grateful to the saints of software that this works. When
it comes to accepting input, the hp2100 simulator is generally not so
cooperative. It seems the debian version does not have libreadline
compiled in. So you cannot recall your previous command by using uparrow
and your only way of editing the current command is by using backspace.
(This behaviour holds for the simulator command line, where nicer features
could exist. That nice features do not exist inside simulated programs
goes without saying. There we have to face the harshness of seventies
computing anyway.)
The pasted text is first accepted by the simulator. The simulator
then feeds that text into its built-in simulated tty-terminal. This
terminal is queried by the simulated tty-driver of metaforth, which
then feeds the characters into its listen-for-input loop. In this
chain many things can go wrong. The simulated terminal could differ
from the real tty that was used. (Not very likely though, the
tty interface is quite minimal.) We could have made a mistake
while typing in the driver. The smallest error would have put
us in a situation which is extremely hard to solve. But we have been
lucky.
Next page coming soon
\ No newline at end of file