1 /* $NetBSD: api.h,v 1.6 2002/06/13 23:41:19 wiz Exp $ */
4 * Copyright (c) 1988 The Regents of the University of California.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * from: @(#)api.h 4.4 (Berkeley) 4/26/91
35 * This file contains header information used by the PC API routines.
39 #define far /* For 'far *' checks */
40 #endif /* !defined(MSDOS) */
42 #define API_INTERRUPT_NUMBER 0x7A /* API Interrupt Number */
45 * Define the gate numbers. These are returned via the Name Resolution
49 #define GATE_SESSMGR 1234
50 #define GATE_KEYBOARD 5678
51 #define GATE_COPY 9101
52 #define GATE_OIAM 1121
55 * The names which correspond to the above gate numbers.
58 #define NAME_SESSMGR "SESSMGR "
59 #define NAME_KEYBOARD "KEYBOARD"
60 #define NAME_COPY "COPY "
61 #define NAME_OIAM "OIAM "
65 * Name Resolution is specified in AH.
68 #define NAME_RESOLUTION 0x81
72 * In unix, we offer a service to allow the application to keep from
73 * having to poll us constantly.
75 #define PS_OR_OIA_MODIFIED 0x99
77 #endif /* defined(unix) */
80 * Codes specified in AL for various services.
83 #define QUERY_SESSION_ID 0x01
84 #define QUERY_SESSION_PARAMETERS 0x02
85 #define QUERY_SESSION_CURSOR 0x0b
87 #define CONNECT_TO_KEYBOARD 0x01
88 #define DISCONNECT_FROM_KEYBOARD 0x02
89 #define WRITE_KEYSTROKE 0x04
90 #define DISABLE_INPUT 0x05
91 #define ENABLE_INPUT 0x06
93 #define COPY_STRING 0x01
95 #define READ_OIA_GROUP 0x02
98 * For each service, we define the assoicated parameter blocks.
102 * Supervisor Services
111 * Session Information Services
126 number_matching_session
;
128 name_array_element
; /* Variable number */
141 } QuerySessionIdParms
;
143 #define ID_OPTION_BY_NAME 0x01 /* By short (or long) name */
144 #define ID_OPTION_ALL 0x00 /* All (of specified type */
153 session_characteristics
,
158 } QuerySessionParametersParms
;
160 #define TYPE_WSCTL 0x01 /* Work Station Control */
161 #define TYPE_DFT 0x02 /* DFT Host Session */
162 #define TYPE_CUT 0x03 /* CUT Host Session */
163 #define TYPE_NOTEPAD 0x04 /* Notepad Session */
164 #define TYPE_PC 0x05 /* Personal Computer Session */
166 #define CHARACTERISTIC_EAB 0x80 /* Extended Attribute Buffer */
167 #define CHARACTERISTIC_PSS 0x40 /* Program Symbols Supported */
175 row_address
, /* from 0 */
176 column_address
; /* from 0 */
177 } QuerySessionCursorParms
;
179 #define CURSOR_INHIBITED_AUTOSCROLL 0x10
180 #define CURSOR_INHIBITED 0x04
181 #define CURSOR_BLINKING 0x02
182 #define CURSOR_BOX 0x01
194 first_connection_identifier
;
195 } ConnectToKeyboardParms
;
205 } DisconnectFromKeyboardParms
;
215 length
; /* Length (in bytes) of list */
216 KeystrokeEntry keystrokes
; /* Variable size */
235 } keystroke_specifier
;
236 } WriteKeystrokeParms
;
238 #define OPTION_SINGLE_KEYSTROKE 0x20
239 #define OPTION_MULTIPLE_KEYSTROKES 0x30
251 typedef DisableInputParms EnableInputParms
;
263 begin
; /* Offset within buffer */
273 source_end
; /* Offset within source buffer */
281 #define COPY_MODE_7_COLOR 0x80 /* Else 4 color mode */
282 #define COPY_MODE_FIELD_ATTRIBUTES 0x40 /* Else don't copy attributes */
296 /* If the user wants all groups, we return API_OIA_BYTES_ALL_GROUPS bytes */
297 #define API_OIA_ALL_GROUPS '\377'
298 #define API_OIA_BYTES_ALL_GROUPS 22 /* 22 bytes of data */
300 /* API_OIA_INPUT_INHIBITED is special. It returns more than on byte of data */
301 #define API_OIA_INPUT_INHIBITED 8
303 #define API_OIA_LAST_LEGAL_GROUP 18 /* Highest legal number */
311 #endif /* !defined(FP_SEG) */
313 #else /* defined(MSDOS) */
316 * These definitions are here to provide the descriptions of
317 * some registers which are, normally, defined in <dos.h> on
321 #define FP_SEG(x) ((unsigned int)(((unsigned long)(x))>>16))
322 #define FP_OFF(y) ((unsigned int)(((unsigned long)(y))&0xFFFF))
325 * Undo the preceding.
328 #define SEG_OFF_BACK(x,y) (((x)<<16)|(y))
331 * Now, it is somewhat of a pain, but we need to keep
332 * 8086 conventions about which of the "highlow"'s map
333 * into which of the "words".
336 #include <sys/param.h> /* Get ENDIAN from machine/endian.h */
338 /* Determine endian'ess (if necessary) */
340 #if !(defined(BYTE_ORDER) && defined(BIG_ENDIAN))
341 #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
342 #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
344 #if defined(vax) || defined(ns32000) || defined(i386) || (defined(mips)&&defined(MIPSEL))
345 #define BYTE_ORDER LITTLE_ENDIAN
346 #endif /* defined(vax) || defined(ns32000) */
348 #if defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr) || defined(gould) || (defined(mips)&&defined(MIPSEB))
349 #define BYTE_ORDER BIG_ENDIAN
350 #endif /* defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr) || defined(gould) */
352 #endif /* !(defined(BYTE_ORDER) && defined(BIG_ENDIAN)) */
356 #if BYTE_ORDER == LITTLE_ENDIAN
365 #endif /* BYTE_ORDER == LITTLE_ENDIAN */
366 #if BYTE_ORDER == BIG_ENDIAN
375 #endif /* BYTE_ORDER == BIG_ENDIAN */
401 #endif /* defined(MSDOS) (else section) */
404 int api_close_api(void);
405 int api_open_api(char *);
406 int api_exch_api(union REGS
*, struct SREGS
*, char *, int);
409 void handle_api(union REGS
*, struct SREGS
*);