OSWORD &00

From BeebWiki
Revision as of 17:49, 29 July 2020 by Jgharston (talk | contribs) (Added fuller functionality.)
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.

See Also

http://mdfs.net/Docs/Comp/BBC/Oswords

Jgharston 12:51, 26 May 2009 (UTC)