Difference between revisions of "OSWORD &00"

From BeebWiki
Jump to: navigation, search
m (Fix line wrapping on previous edit)
(Added fuller functionality.)
Line 1: Line 1:
 
[[Category:OSWORD]]
 
[[Category:OSWORD]]
OSWORD &00 ( 0 ) - Input line Acorn MOS 1.20
+
==OSWORD &00 (0) - Input line==
  
 
  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 (excluding CR)
+
  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
  
Note that this is the only OSWORD call that legally returns values
+
This call reads characters from the current input stream by calling OSRDCH.
in the registers.
+
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).
  
Note that the maximum line length at XY?2 does not count the CR, so
+
Extensions may implement line input extensions, for example on RISC OS and
XY?0..1 must point to at least 1+XY?2 bytes of free memory.
+
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==
 
==See Also==

Revision as of 17:49, 29 July 2020

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)