Home NVDI Programmer's Guide Raster Operations Text Mode and VT52

2.13 Input Functions

The input functions allow user interactions with the application program.

The input function are designed for use by the owner of the physical screen workstation - the AES. As long as there is no particular reason, an application should always use the event calls of the AES. Otherwise you might steal other applcations' events.


2.13.1 SET INPUT MODE (VDI 33)

This functions sets the input mode for the specified device <dev_type>.

Decl.:  void vsin_mode( WORD handle, WORD dev_type, WORD mode );
Call:   vsin_mode( handle, dev_type, mode );

Variable         Arguments           Meaning
Input:

contrl[0]        33                  vsin_mode
contrl[1]        0                   entries in ptsin
contrl[3]        2                   entries in intin
contrl[6]        handle
intin[0]         dev_type            input device
intin[1]         mode                requested input mode

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        1                   entries in intout
intout[0]        set_mode            selected input mode

Meaning of dev_type:
1: Mouse
2: Cursor
3: Function keys
4: Keyboard

Meaning of mode:
REQUEST MODE   1: wait until input data is available
SAMPLE MODE    2: return device status and input data (if available)

2.13.2 INPUT LOCATOR, REQUEST MODE (VDI 28)

"INPUT LOCATOR" returns the position of the mouse. You can use this function to change the position of the mouse cursor (but you should not because it will only irritate the user). This functions waits until a mouse button is pressed.

Decl.:  void vrq_locator( WORD handle, WORD x, WORD y, WORD *xout,
                               WORD *yout, WORD *term );
Call:   vrq_locator( handle, x, y, &xout, &yout, &term );

Variable         Arguments           Meaning
Input:

contrl[0]        28                  vrq_locator
contrl[1]        1                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle
ptsin[0]         x                   new x-coordinate of the mouse cursor
ptsin[1]         y                   new y-coordinate of the mouse cursor

Output:

contrl[2]        1                   entries in ptsout
contrl[4]        1                   entries in intout
intout[0]        term                Maustastenstatus+31
ptsout[0]        xout                old x-coordinate of the mouse cursor
ptsout[1]        yout                old x-coordinate of the mouse cursor

2.13.3 INPUT LOCATOR, SAMPLE MODE (VDI 28)

This functions returns the coordinates of the mouse cursor and sets new coordinates. contrl[2] and contrl[4] specifiy if the mouse has been moved or a button has been pressed.

Decl.:  WORD vsm_locator( WORD handle,  WORD x,  WORD y,  WORD *xout,
                          WORD *yout, WORD *term );
Call:   status = vsm_locator( handle, x, y, &xout, &yout, &term );

Variable         Arguments           Meaning
Input:

contrl[0]        28                  vsm_locator
contrl[1]        1                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle
ptsin[0]         x                   new x-coordinate of the mouse cursor
ptsin[1]         y                   new y-coordinate of the mouse cursor

Output:

contrl[2]        0 or 1              entries in ptsout
contrl[4]        0 or 1              entries in intout
intout[0]        term                mouse button + 31
ptsout[0]        xout                old x-coordinate of the mouse cursor
ptsout[1]        yout                old y-coordinate of the mouse cursor

Meaning of status (is (contrl[4]<<1)|contrl[2])):
0: mouse movement
1: button pressed

2.13.4 INPUT CHOICE, REQUEST MODE (VDI 30)

This function returns the number of the function key pressed.

Decl.:  void vrq_choice( WORD handle, WORD ch_in, WORD *ch_out );
Call:   vrq_choice( handle, ch_in, &ch_out );

Variable         Arguments           Meaning
Input:

contrl[0]        30                  vrq_choice
contrl[1]        0                   entries in ptsin
contrl[3]        1                   entries in intin
contrl[6]        handle
intin[0]         ch_in               initialisierende Taste (0)

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        1                   entries in intout
intout[0]        ch_out              ausgewählte Funktionstaste

2.13.5 INPUT CHOICE, SAMPLE MODE (VDI 30)

If a function key has been pressed "INPUT CHOICE" returns its number.

Decl.:  WORD vsm_choice( WORD handle, WORD *choice );
Call:   status = vsm_choice( handle, &choice );

Variable         Arguments           Meaning
Input:

contrl[0]        30                  vsm_choice
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0 or 1              entries in intout
intout[0]        choice              key number (1-10)

Meaning of status (contrl[4]):
0: no key
1: key pressed

2.13.6 INPUT STRING,REQUEST MODE (VDI 31)

This function returns a string from the keyboard. "INPUT STRING, REQUEST MODE" returns if the maximum string length is reached or if the user has pressed RETURN.

Decl.:  void vrq_string( WORD handle, WORD max_length, WORD echo_mode,
                              WORD *echo_xy, BYTE *string );
Call:   vrq_string( handle, max_length, echo_mode, echo_xy, string );

Variable         Arguments           Meaning
Input:

contrl[0]        31                  vrq_string
contrl[1]        1                   entries in ptsin
contrl[3]        2                   entries in intin
contrl[6]        handle
intin[0]         max_length          maximum string length
intin[1]         echo_mode           0: no output 1: echo
ptsin[0]         echo_xy[0]
ptsin[1]         echo_xy[1]

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        n                   entries in intout
intout[0..n-1]   string[0..n-1]      input buffer

Meaning of max_length: max_length is the maximum length of the string returned in intout. If max_length is negative, the absolute value is considered to be the maximum length and scan codes are returned instead of ASCII values.

2.13.7 INPUT STRING,SAMPLE MODE (VDI 31)

This function returns a string from the keyboard. "INPUT STRING, SAMPLE MODE" returns if the maximum string length is reached, if the user has pressed RETURN or if the user has not pressed a key.

Decl.:  WORD vsm_string( WORD handle, WORD max_length, WORD echo_mode,
                             WORD *echo_xy, BYTE *string );
Call:   status = vsm_string( handle,  max_length, echo_mode, echo_xy, string );

Variable         Arguments           Meaning
Input:

contrl[0]        31                  vsm_string
contrl[1]        1                   entries in ptsin
contrl[3]        2                   entries in intin
contrl[6]        handle
intin[0]         max_length          maximum string length
intin[1]         echo_mode           0: no output 1: echo
ptsin[0]         echo_xy[0]
ptsin[1]         echo_xy[1]

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        n                   entries in intout
intout[0..n-1]   string[0..n-1]      input buffer

Meaning of max_length: max_length is the maximum length of the string returned in intout. If max_length is negative, the absolute value is considered to be the maximum length and scan codes are returned instead of ASCII values. Codes werden Scan-Codes übergeben.

Meaning of status (contrl[4]): 0: no input <> 0: length of the string

2.13.8 SET MOUSE FORM (VDI 111)

This function modifies the appearance of the mouse cursor.

Decl.:  void vsc_form( WORD handle, WORD *cursor );
Call:   vsc_form( handle, cursor );

Variable         Arguments           Meaning
Input:

contrl[0]        111                 vsc_form
contrl[1]        0                   entries in ptsin
contrl[3]        37                  entries in intin
contrl[6]        handle
intin[0..36]     cursor[0..36]       cursor data

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0                   entries in intout

Meaning of cursor:
pcur_form[0]:       x-coordinate of hot spot
pcur_form[1]:       y-coordinate of hot spot
pcur_form[2]:       must be 1 (REPLACE)
pcur_form[3]:       background color
pcur_form[4]:       foreground color
pcur_form[5..20]:   background mask
pcur_form[21..36]:  foreground mask

Note: Use graf_mouse() to change the mouse cursor!

NVDI allows you to inquire the appearance of the mouse cursor.

Inquire cursor form:

Variable         Arguments           Meaning
Input:

contrl[0]        111                 vgc_form
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        37                  entries in intout
intout[0..36]    cursor[0..36]       cursor data

2.13.9 INQUIRE INPUT MODE (VDI 115)

"INQUIRE INPUT MODE" inquires the input mode of the specified device.

Decl.:  void vqin_mode( WORD handle, WORD dev_type, WORD *input_mode );
Call:   vqin_mode( handle, dev_type, &input_mode );

Variable         Arguments           Meaning
Input:

contrl[0]        115                 vqin_mode
contrl[1]        0                   entries in ptsin
contrl[3]        1                   entries in intin
contrl[6]        handle
intin[0]         dev_type            input device (see vsin_mode)

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        1                   entries in intout
intout[1]        input_mode          mode

2.13.10 EXCHANGE TIMER INTERRUPT VECTOR (VDI 118)

You can use this function to establish a function in the timer interrupt (etv_timer). The subroutine has to save and restore modified registers and call the old timer routine.

Decl.:  void vex_timv( WORD handle, void *tim_addr, void **otim_addr,
                       WORD *tim_conv );
Call:   vex_timv( handle, tim_addr, &otim_addr, &tim_conv );

Variable         Arguments           Meaning
Input:

contrl[0]        118                 vex_timv
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle
contrl[7..8]     tim_addr            address of the new timer routine

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        1                   entries in intout
contrl[9..10]    otim_addr           address of the old timer routine
intout[0]        tim_conv            interrupt interval in ms

2.13.11 SHOW CURSOR (VDI 122)

"SHOW CURSOR" 'neutralizes' a preceding call of "HIDE CURSOR". If you want to display the mouse cursor immediately without regard to the hide counter, the paramter <reset> has to be zero.

Decl.:  void v_show_c( WORD handle, WORD reset );
Call:   v_show_c( handle, reset );

Variable         Arguments           Meaning
Input:

contrl[0]        122                 v_show_c
contrl[1]        0                   entries in ptsin
contrl[3]        1                   entries in intin
contrl[6]        handle
intin[0]         reset

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0                   entries in intout

Meaning of reset:
0:    display cursor immediately
<> 0: decrement hide counter and display cursor if necessary

Note: Use graf_mouse() to switch the cursor on or off.

2.13.12 HIDE CURSOR (VDI 123)

This function switches the mouse cursor off.

Decl.:  void v_hide_c( WORD handle );
Call:   v_hide_c( handle );

Variable         Arguments           Meaning
Input:

contrl[0]        123                 v_hide_c
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0                   entries in intout

Note: Use graf_mouse() to switch the cursor on or off.

2.13.13 SAMPLE MOUSE BUTTON STATE (VDI 124)

This function returns the state of the mouse buttons and the mosue position.

Decl.:  void vq_mouse( WORD handle, WORD *status, WORD *x, WORD *y );
Call:   vq_mouse( handle, &status, &x, &y );

Variable         Arguments           Meaning
Input:

contrl[0]        124                 vq_mouse
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle

Output:

contrl[2]        1                   entries in ptsout
contrl[4]        1                   entries in intout
intout[0]        status              button status
ptsout[0]        x
ptsout[1]        y

Note: Use graf_mkstate() or the event functions of the AES.

2.13.14 EXCHANGE BUTTON CHANGE VECTOR (VDI 125)

"EXCHANGE BUTTON CHANGE VECTOR" installs a routine which is called when a mouse button is pressed. Register d0.w contains the button state. The subroutine must save and restore modified registers and call the old status routine.

Decl.:  void vex_butv( WORD handle, void *pusrcode, void **psavcode );
Call:   vex_butv( handle, pusrcode, &psavcode );

Variable         Arguments           Meaning
Input:

contrl[0]        125                 vex_butv
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle
contrl[7..8]     pusrcode            address of the new routine

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0                   entries in intout
contrl[9..10]    psavcode            address of the old routine

2.13.15 EXCHANGE MOUSE MOVEMENT VECTOR (VDI 126)

This function establishes a routine in the mouse interrupt. The routine will be called if the mouse is moved and d0.w/d1.w contain the coordinates of the mouse cursor. The subroutine must save and restore modified registers and call the old interrupt routine.

Decl.:  void vex_motv( WORD handle, void *pusrcode, void **psavcode );
Call:   vex_motv( handle, pusrcode, &psavcode );

Variable         Arguments           Meaning
Input:

contrl[0]        126                 vex_motv
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle
contrl[7..8]     pusrcode            Adresse der neuen Routine

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0                   entries in intout
contrl[9..10]    psavcode            Adresse der alten Routine

2.13.16 EXCHANGE CURCOR CHANGE VECTOR (VDI 127)

This function establishes a routine in the mouse interrupt. The routine will be called if the mouse is moved and d0.w/d1.w contain the coordinates of the mouse cursor. The subroutine must save and restore modified registers and call the old interrupt routine.

Please note that this interrupt routine is called after the one installed by vex_motv(). In contrast to the preceding routine, the mouse coordinates have been clipped.

Decl.:  void vex_curv( WORD handle, void *pusrcode, void **psavcode );
Call:   vex_curv( handle, pusrcode, &psavcode );

Variable         Arguments           Meaning
Input:

contrl[0]        127                 vex_curv
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle
contrl[7..8]     pusrcode            address of the new routine

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0                   entries in intout
contrl[9..10]    psavcode            address of the old routine

2.13.17 SAMPLE KEYBOARD STATE INFORMATION (VDI 128)

"SAMPLE KEYBOARD STATE INFORMATION" returns the state of CONTROL, ALTERNATE and the SHIFT key(s).

Decl.:  void vq_key_s( WORD handle, WORD *status );
Call:   vq_key_s( handle, &status );

Variable         Arguments           Meaning
Input:

contrl[0]        128                 vq_key_s
contrl[1]        0                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        1                   entries in intout
intout[0]        pstatus             keyboard state

Meaning of pstatus (bit numbers):
0: Shift right
1: Shift left
2: Control
3: Alternate

Note: Use the AES event functions to inquire the keyboard state.


Home NVDI Programmer's Guide Raster Operations Text Mode and VT52