From BeebWiki
Revision as of 13:42, 17 October 2020 by Jgharston (talk | contribs) (Slight tweeks.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

OSWORD &00 (0) - Input line

On entry:
 XY?0..1=>string buffer
 XY?2   =maximum line length (buffer size minus 1)
 XY?3   =minimum acceptable ASCII value
 XY?4   =maximum acceptable ASCII value
On exit:
 Cy=0 if not terminated by Escape
 Y is the line length excluding the CR, so buffer+Y will point to the CR
 A,X undefined
 Cy=1 if Escape terminated input, A,X,Y undefined

This call reads characters from the current input stream by calling OSRDCH. Line editing is performed, at a minimum DELETE (CHR$127) deletes a character, Ctrl-U (CHR$21) deletes the whole line, and (if enabled) cursor keys perform copy editing. Editing is terminated with RETURN (CHR$13) or the current Escape character if enabled (the default is ESCAPE CHR$27).

Extensions may implement line input extensions, for example on RISC OS and many other systems, BS (CHR$8) duplicates DELETE, and Ctrl-J (CHR$10) duplicates RETURN.

Note that this is the only OSWORD call that legally returns values in the registers.

Note that the maximum line length at XY?2 does not count the CR, so XY?0..1 must point to at least XY?2+1 bytes of free memory. Memory past the end of the returned string may be overwritten up to the maximum specified by XY?2+1.

Note that the minimum and maximum acceptable ASCII values only affect the characters entered into the string buffer when the call returns. All characters typed will be echoed to the screen. This includes control characters, so the user can change mode by typing CTRL-V CTRL-@ or similar, which may corrupt the current application if the new mode occupies memory currently in use.

See Also


Jgharston 12:51, 26 May 2009 (UTC)