Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Applied links to System Call Reference API's

...

OS_In         read a character from the standard input
OS_Tin        read a character from the standard input, with timeout
GN_Sip        standard input line routine
OS_Sr         reads a character when doing a "Page Wait". Returns always ASCII 8
              or an RC_ error code.

GN_Sip is described later in this section and OS_Sr is discussed in "Miscellaneous useful routines". OS_In and OS_Tin return the character read in register A and Fc = 0 to indicate success. Since these are pre-emptable calls they may return Fc = 1 and any of RC_SUSP, RC_DRAW, RC_ESC, RC_QUIT and, in the case of OS_Tin, RC_TIME. These calls usually returns ASCII values, but for special Z88 keys and menu commands, some other encoding is required. The solution is that when a special key or menu command occurrs, the OS_In or OS_Tin will return a zero. The call is then made again and the value returned by this second call corresponds to the special key or menu command. The codes for the special keyboard sequences are shown below, those marked * are not zero prefixed. Keys marked with ** are internal keycodes and not available to applications. Finally, note that register pair AF and the alternate registers are corrupted by OS_In (as almost all system calls). OS_Tin waits for keyboard input for as long as the number of centiseconds specified in the BC(in) register pair, and on exit BC will be the centiseconds of the timeout remaining, and so BC will have changed as well as AF and the alternate register set. 
 

...

HEX           DECIMAL          SYMBOL         KEYS           DESCRIPTION
$00           0                NUL            <>=            NULL
$01           1                SOH            <>A            Start of header
$02           2                STX            <>B            Start of text
$03           3                ETX            <>C            End of text
$04           4                EOT            <>D            End of transmission
$05           5                ENQ            <>E            Enquiry
$06           6                ACK            <>F            Acknowledge
$07           7                BEL            <>G            Bell
$08           8                BS             <>H            Backspace
$09           9                HT             <>I            Horizontal tabulation
$0A           10               LF             <>J            Line feed
$0B           11               VT             <>K            Vertical tabulation
$0C           12               FF             <>L            Form feed
$0D           13               CR             <>M            Carriage return
$0E           14               SO             <>N            Shift out
$0F           15               SI             <>O            Shift in
$10           16               DLE            <>P            Data link escape
$11           17               DC1            <>Q            Device control 1 (XON)
$12           18               DC2            <>R            Device control 2
$13           19               DC3            <>S            Device control 1 (XOFF)
$14           20               DC4            <>T            Device control 4
$15           21               NAK            <>U            Negative acknowledge
$16           22               SYN            <>V            Synchronous idle
$17           23               ETB            <>W            End of transmitted block
$18           24               CAN            <>X            Cancel line
$19           25               EM             <>Y            End of medium
$1A           26               SUB            <>Z            Substitute (End of file)
$1B           27               ESC            <>[ or ESC     Escape
$1C           28               FS             <>\            File separator
$1D           29               GS             <>]            Group separator
$1E           30               RS             <>`            Record separator
$1F           31               US             <>-            Unit separator

The Input Line Routine

GN_Sip is the standard system input line routine and used by most of the applications (Diary uses it for editing individual lines on a date page). It provides access to all the standard editing commands which are:

...

The basic specifications of GN_Sip is as follows:

 

Code Block
languagenone
titleGN_Sip, system input line routine
RST 20H, DEFW $3909

IN:

              DE = buffer for input string

              A0 = 1, buffer already contains data to be edited
              A1 = 1, force insert/overwrite mode (see A2)
              A2 = 1, if A1 = 1, 0 = insert mode, 1 = overwrite mode
              A3 = 1, return unexpected characters
              A4 = 1, return if wrap occurs
              A5 = 1, single line lock control
              A6 = 1, disply in reverse video
              A7 = 1, if A3 = 1, allow for insert/overwrite return

              B = length of buffer
              C = cursor position, if A0 = 1
              L = width of line, if A5 = 1 (incl. null-terminator)
OUT, if call successful:

              Fc = 0
              B = length of line entered, including terminating null
              C = cursor position on exit
              A = character which caused end of input
OUT, if call failed:

              Fc = 1
              A = error code:
                               RC_BAD ($04), bad arguments
                               RC_WRAP ($0D), wrapping has occurred (only if A4 = 1)
                               RC_SUSP ($69), suspicion of suspension
                               RC_DRAW ($66), application screen needs redrawing
                               RC_QUIT ($67), kill request (e.g. from INDEX)
                               RC_ESC ($01), if escape detection is enabled
Registers changed after return:

              ....DEHL/IXIY same
              AFBC..../.... different

If bit 0 of register A is set then DE should point to a null-terminated string which is no greater than the buffer length specified in B. GN_Sip will write this string to standard output starting at the cursor position and then place the cursor at the position in the buffer indicated by C. If C is greater than B, then the cursor is placed at the end of the buffer. Note that if GN_Sip is suspended then to continue editing the cursor needs to be re-positioned to the start of the input line and GN_Sip called again with A0 set and the buffer length reset to its initial value. Unless this is done suspension will not be transparent, eg. whenever <DIAMOND> is inadvertently pressed during input, the input would be terminated or ots output would be corrupted.

...

The following example uses a locked line width of 15 characters. When <ENTER> is pressed the full input line is displayed. When the buffer is nearly full, try suspending GN_Sip, eg. by pressing the Square key twice, and you will see a slight flicker as GN_Sip re-displays and scrolls the line.

...