# Questo file Š una versione ridotta del manuale della libreria AMIS 0.91 # di Ralf Brown. Sono descritte solo le macro utilizzate in KEYBIT Lite. # # La libreria completa Š contenuta nel file AMISL091.??? che pu• essere # prelevato da: # - tutti i mirror "SimTel" nella directory /pub/msdos/asmutl # - le migliori BBS FidoNet, tra cui The Bits (2:335/225) # Alternate Multiplex Interrupt Specification Library Public Domain 1992 Ralf Brown Version 0.91 To make use of this library, you basically need to do four things: 1. To each source file that will make calls, add INCLUDE AMIS.MAC 2. In the source file containing the program's entry point, add @Startup M,NN,SSS just after the above INCLUDE and @Startup2 at the program's entry point (see below for details). 3. Change the END line of the main source file to END INIT 4. Link in AMIS.OBJ (assembled from AMIS.ASM) with the rest of your object modules. ---------------------------------------------------------------------- After an INCLUDE AMIS.MAC, the following definitions and macros are available: @Startup Declare all segments and provide some startup code. Usage: @Startup major,minor,stack Arguments: major [opt] the minimum major version of DOS required to run minor [opt] the major minor version of DOS required to run stack [opt] the number of bytes of stack to provide at startup Note: If either or is blank, the program will not check the DOS version at startup. If is blank, a default stack of 256 bytes will be provided in memory models other than Tiny (there is no stack in Tiny model, so this value will be ignored). @Startup2 Provide additional startup code at the program's actual entry point. Usage: @Startup2 psp Arguments: psp [opt] if non-blank, allocate a public variable named __psp Note: should be blank if some other module (such as the C runtime library) provides a public variable named __psp. TGROUP Group containing all resident segments in the TSR. TSRcode@ TSRcodeEnd@ Delimit the code which will remain resident; some of the other macros listed below will not function correctly unless within a section of code delimited with TSRcode@ and TSRcodeEnd@. DISPLAY_STRING Output a '$'-terminated string to standard output via DOS. Usage: DISPLAY_STRING string,dataseg Arguments: string the label of the string to be displayed dataseg [opt] the segment of the string Example: DISPLAY_STRING banner ... ... banner db "FOOBAR (c) 1992 Harry Q Bovik",13,10,"$" # NOTA: la macro seguente Š stata modificata. Ora accetta anche il parametro # tsr_code_len che permette di rendere opzionale l'installazione di una # parte del codice. INSTALL_TSR Allocate memory for the resident code, copy the resident code to the allocated memory, hook all interrupts used by the TSR, optionally call an initialization function, and terminate back to DOS. Usage: INSTALL_TSR tsr_code_len,extra,fit,high,init,if_inst,on_err,more_flags Arguments: tsr_code_len [opt] length of resident code in bytes extra [opt] number of additional paragraphs needed in resident part fit [opt] FIRST or BEST (default) -fit allocation high [opt] HIGHONLY to only use UMBs, LOWONLY to only use conventional memory, TOPMEM to allocate block at high end of conventional memory if no UMBs, TOPLOW to only use top end of conventional memory init [opt] function to call after installing TSR but before exiting if_inst [opt] label to branch to if already installed on_err [opt] label to branch to if unable to install more_flags [opt] label of byte containing additional flags to be ORed with those automatically set by and Notes: If 'init' is specified, the indicated function will be called with AX = segment at which TSR was loaded If 'if_inst' is specified, the indicated function will be jumped at with AH = multiplex number CX = version number The TOPMEM and TOPLOW options are reported to be incompatible with Windows 3.0, and will most likely cause a crash if the TSR is installed while shelled out from a program using SPAWNO or another swapping spawn() replacement. Then again, anyone who attempts to install a TSR while shelled out of another program deserves whatever happens. UNINSTALL Remove the TSR from memory. Usage: UNINSTALL on_err Arguments: on_err [opt] label to branch to if unable to remove from memory Notes: If 'on_err' is omitted, check CF after this macro to determine whether the removal was successful (CF clear if successful, set on error). ISP_HEADER Set up the Interrupt Sharing Protocol header for an interrupt. Usage: ISP_HEADER intr,reset,eoi Arguments: intr interrupt number reset [opt] name of routine to perform hardware reset eoi [opt] if nonzero, this is the primary handler for a hardware int Exported Labels: (for example "ISP_HEADER 00h,reset_func,0") INT00h_handler (public), ORIG_INT00h (public), HWRESET_00h, EOI_FLAG_00h [in addition, hw_reset_00h would be present for ISP_HEADER 00h,,0] Note: This macro must be used inside a TSRcode@/TSRcodeEnd@ pair. Example: ISP_HEADER 21h cmp ah,4Bh ; provide our own EXEC replacement je exec_call jmp ORIG_INT21h exec_call: ... HOOKED_INTS Declare the interrupts this TSR hooks. Usage: HOOKED_INTS int1,int2,...,int32 Arguments: up to 32 interrupt numbers Exported Labels: $AMIS$HOOKED_INT_LIST (public) Notes: This macro must be used inside a TSRcode@/TSRcodeEnd@ or TSRdata@/TSRdataEnd@ pair. INT 2Dh need not be listed, as it is automatically added to the end of the list of hooked interrupts. Examples: HOOKED_INTS ; this TSR hooks only INT 2Dh HOOKED_INTS 13h,21h,FFh ; this TSR hooks INTs 13h, 21h, 2Dh, FFh # NOTA: La macro seguente Š stata modificata. Ora include anche l'API # di KEYBIT Lite (mettendola nella macro si risparmia qualche byte). ALTMPX Define the alternate multiplex interrupt handler for the program. Usage: ALTMPX manuf,prodname,version,descrip,remove,psp Arguments: manuf one- to eight-character manufacturer's name prodname one- to eight-character product name version four-digit hex version number (hi byte = major, lo = minor) descrip [opt] string (max 63 char) describing the product remove [opt] name of function to call to remove TSR from memory psp [opt] if nonblank, set up patch word for memblk segment to be returned if omitted; returns CS if both and blank (in this case, INSTALL_TSR must specify either TOPMEM or HIGHONLY) Notes: This macro must be used inside a TSRcode@/TSRcodeEnd@ pair. must be located in TSRcode@ input: DX:BX = return address if uninstall successful return: AL = status 01h unable to remove from memory 02h can't remove now, will do so when able 03h safe to remove, but no resident uninstaller (TSR still enabled) BX = segment of memory block 04h safe to remove, but no resident uninstaller (TSR now disabled) BX = segment of memory block 05h not safe to remove now, try again later FFh successful (DX:BX were ignored) return at DX:BX with AX destroyed if successful and honors specific return address if omitted, ALTMPX returns AL=03h Exported Labels: INT2Dh_handler (public), ORIG_INT2Dh (public), HWRESET_2Dh, EOI_FLAG_2Dh, hw_reset_2Dh, $AMIS$MULTIPLEX_NUMBER (public), ALTMPX_SIGNATURE (public), ALTMPX$PSP [patch word if nonblank] ---------------------------------------------------------------------- Ralf Brown [valid until at least May 1, 1996] 813 Copeland Way, Suite 26 Pittsburgh, PA 15232-2217 Internet: ralf@telerama.lm.com FIDO: Ralf Brown 1:129/26.1