Scrolling Input |
MDFS::Info.Comp.Spectrum.Code.Editors.input/htm | Search |
INPUT
command displays characters at the
current print position, and as you enter
On the Spectrum, INPUT
always uses the bottom lines
of the screen. Once a line has been input, it is cleared
and the next INPUT
displays at the bottom of the
screen again.
On the Spectrum you can write code to give the same effect
as INPUT
on other systems. The main
disadvantages are that you have to write a complete editor,
deal with adding and removing characters, process
key-repeats and key-clicks all yourself. This is a lot of
work, when almost everything is already available in the
system ROM.
The code simulates the "normal" INPUT
used
on other systems. It works by increasing the size of the bottom
input area enough to push the top of the bottom of the screen up
to the same position as the current screen
print position. The INPUT
is then taken at the top of
the bottom of the screen. After the INPUT
, the entered
string is then redisplayed. This example displays a "*"
prompt before the input.
FOR a=0 TO 31:PRINT CHR$8;:NEXT a INPUT AT PEEK 23689-2,0;AT 0,0;"*";LINE a$ PRINT '"*";a$
INPUT
moves down one line too many.
INPUT
ing at the line minus 2INPUT
position to 18
expands the bottom of the screen to 18 lines.
INPUT
position is then moved back to (0,0) to read
the entered line.
To see what is happening, make the BORDER
a different colour
from the PAPER
.