Difference between revisions of "OSWORD &00"
(Clarify interpretation of XY?2) |
(Added return values.) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:OSWORD]] | [[Category:OSWORD]] | ||
− | OSWORD &00 ( 0 ) | + | {{PageTitle|OSWORD &00 (0): Input line of text}} |
− | |||
On entry: | On entry: | ||
XY?0..1=>string buffer | XY?0..1=>string buffer | ||
− | XY?2 =maximum line length | + | XY?2 =maximum line length (buffer size minus 1) |
XY?3 =minimum acceptable ASCII value | XY?3 =minimum acceptable ASCII value | ||
XY?4 =maximum acceptable ASCII value | XY?4 =maximum acceptable ASCII value | ||
On exit: | On exit: | ||
− | Y is the line length | + | Cy=0 if not terminated by Escape |
− | Cy=1 if Escape terminated input | + | 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. | ||
+ | OSWORD &00 is the only OSWORD call that returns information in the registers. | ||
+ | It returns the length and Escape state in different processors' registers as: | ||
+ | {| cellpadding="0" cellspacing="0" | ||
+ | | 6502 || Z80 || 6809 || PDP11 || 80x86 || 32016 || ARM || RISC-V || align="left" | '''On exit:''' | ||
+ | |- align="center" valign="top" | ||
+ | | Y || H || Y || R2 || BH || R3 || R2 || A2 || align="left" | returned text length | ||
+ | |- align="center" valign="top" | ||
+ | | || || || || || || || || align="left" | Carry=Escape | ||
+ | |} | ||
==See Also== | ==See Also== |
Latest revision as of 21:55, 11 September 2023
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.
OSWORD &00 is the only OSWORD call that returns information in the registers. It returns the length and Escape state in different processors' registers as:
6502 | Z80 | 6809 | PDP11 | 80x86 | 32016 | ARM | RISC-V | On exit: |
Y | H | Y | R2 | BH | R3 | R2 | A2 | returned text length |
Carry=Escape |
See Also
http://mdfs.net/Docs/Comp/BBC/Oswords
Jgharston 12:51, 26 May 2009 (UTC)