INPUTcommand displays characters at the current print position, and as you enter additional lines the previous lines stay on screen and the input position scrolls downwards.
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$ INPUT;:PRINT '"*";a$
INPUTmoves down one line too many.
INPUTing at the line minus 2 forces the bottom of the screen to expand up to the same line by making it big enough to find the equivalant line off the bottom of the screen. For instance, if the print line is 4, then 23689 will hold 20, and moving the
INPUTposition to 18 expands the bottom of the screen to 18 lines.
INPUTposition is then moved back to (0,0) to read the entered line.
INPUT;and the entered line is redisplayed, this time in the top of the screen.
To see what is happening, make the
BORDER a different colour