The text of a manual · part 18 of 38
PEN*KEY 6100 Computer Programmer's Reference Guide: Section 6: Conversions and Interfaces, pages 147 to 156
Pages 147 to 156 of 328, from PEN*KEY 6100 Computer Programmer's Reference Guide
The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Norand 6100
Page 147
SECTION 6
EXAMPLE:
Conversions and Interfaces
6. Conversions and Interfaces
EXTERNALS ++ifdef 6000 NUMERIC FUNCTION FILECOMMIT = IPFCMT6 ++endif LOCAL VARIABLES 01 RESULT BINARY WORD . . . ++ifdef 6000 ;Commit files to disk when transaction is complete PERFORM FILE_COMMIT ++endif . . . ++ifdef 6000 PROCEDURE FILE_COMMIT RESULT = FILECOMMIT IF RESULT THEN OUT (KBD) (KB_HOME) & ‘FILE COMMIT’, & ‘FAILED!’, & ‘DOS ERROR #’, RESULT, & ‘DISK MAY BE’, & ‘CORRUPT. NOTIFY’, & ‘SUPERVISOR’, BEL, BEL ;Do not allow user to continue REPEAT RESULT = INPUT(E) UNTIL 0 ENDIF END; OF FILE_COMMIT ++endif
Power Management BIOS Interfaces: ELANAPM.EXE Overview This paragraph describes the register interfaces to the APM BIOS functions. Functions are accessed through INT 15h. The carry flag is set and an error code is placed in the AH register when an error condition is detected. The carry flag is reset to zero upon return from successful calls. The contents of the AH regisĆ ter depend on the particular call. This interface has a convention for identifying a device class and units within that class to allow for direct control of devices. For example, all disk devices are a class and the units are the physical unit numbers. The device ID parameter is passed in a wordĆlength register (BX), where BH is the device class and BL is the device unit.
PEN*KEY R 6100 Computer Programmer’s Reference Guide
6-11
Page 148
Conversions and Interfaces
SECTION 6
Power Device IDs The APM Power Device Class/Subclass IDs are defined as follows: 6. Conversions and Interfaces
Value in Register BX XXh FFh
Power Device ID (General Definitions) Unit number (Zero based) All devices in this class
ID (Hex) 00XX 00 01 0100 0200 03XX 0400 0410 0500 0600 0601 0700-DFFF E000-EFFF E000 E100 E200 F000-FFFF
Description System APM BIOS All devices powerĆmanaged by the APM BIOS Display Secondary storage (PC Card) Parallel ports RS-232 serial port RS-485 serial port Reserved for Ethernet network adapters PC Card socket A PC Card socket B (Reserved) OEMĆdefined power device IDs POD1 Digitizer Backlight (Reserved)
APM Function Summary The following is a summary of the interrupt 15h functions that are available for Advanced Power Management (APM) in the 6100 Computer. Table 6-1 APM Interrupt Summary
6-12
INT DOS APM Interrupts (INT 15h)
Function AL=
Requires Connection
15h
APM Installation Check
00h
No
15h
APM Real-Mode Interface Connect
01h
No
15h
APM Interface Disconnect
04h
Yes
15h
CPU Idle
05h
No
15h
CPU Busy
05h
No
15h
Set Power State
07h
No
15h
Enable/Disable Power Management
08h
No
15h
Get Power Status
0Ah
No
15h
Get PM Event
0Bh
No
15h
Get Power State
0Ch
No
15h
Enable/Disable Device Power Management
0Dh
No
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 149
SECTION 6
Conversions and Interfaces
APM CPU Idle Interrupt CPU Idle, INT 15h, AX=5305h, is an APM BIOS function. Refer to the CPU Idle definition, on page 6-78, for details on usage.
Refer to the Intel APM BIOS Interface specification 1.1 or Ralf Brown's Interrupt List for more information. Refer to Appendix B, Common PEN*KEY 6000 Series Information, for a sample listing (IDLE.CPP) showing the use of the CPU Idle interrupt.
6100 BIOS Interfaces Overview This is the core BIOS supported for the 6100 Computer. Starting with flash verĆ sion 1.11, the following features are added to the core BIOS: Suspend/resume coordination (suspend/resume key mapped to I/O key, if IO2SUS.COM is loaded): " to work with NORAND Card and Socket services " and for radio integration " COM4 timeout for the BIOS data area The detailed definitions for the PC BIOS interfaces supported for the 6100 ComĆ puter are described in the paragraph. The following paragraphs summarize the supported interrupts, as well as the unsupported interrupts. "
Only some of the 4000 Series BIOS interrupts are supported by the 6100 ComĆ puter, as described in the following paragraphs:
Supported BIOS Interfaces There are two indexes provided for the details of the BIOS interface functions supported for the 6100 Computer. To find an interrupt by its name, refer to the Interrupt Index, at the end of this publication. To locate an interrupt by the inĆ terrupt number, refer to the Interrupt Cross-Reference table, on page 6-28.
System Timer Interface: Interrupt 08h The system provides a periodic system timer tick and issues interrupt 8 at every timer tick. The interrupt occurs approximately every 55 milliseconds. This rate is close to 65535 ticks per hour. The interrupt service routine maintains the count of interrupts from powerĆon at BIOS data location 0x40:0x6C. After 24 hours of operation, location 0x40:0x7C is nonzero when the counter overflows to the next day. The number of ticks in 24 hours is 0x1800B0. The system timer interrupt issues a call to a userĆsupplied routine through interĆ rupt 0x1C at every interrupt. Application programs should avoid using the Timer Tick as much as possible, since many applications are already hooked into it and it could become overĆ loaded. PEN*KEY R 6100 Computer Programmer’s Reference Guide
6-13
6. Conversions and Interfaces
A call to this function causes the processor to halt (via the HLT instruction) until the next hardware interrupt. This causes good power savings, if it is used during input polling loops, or other low activity points in an application.
Page 150
Conversions and Interfaces
SECTION 6
Standard Keyboard Interface: Interrupt 09h This interface is for both the internal keypad and an external keyboard.
6. Conversions and Interfaces
Matrix scan codes are converted to PCĆcompatible scan codes before Interrupt 09h is issued. Standard scan codes are read from port 60h. If the scan code is not a request for an internal function or a control key press, both the character code and scan code (two bytes) are placed in a 16Ćword circular buffer at the posiĆ tion pointed to by the keyboard tail buffer pointer. The tail pointer is then inĆ cremented by two and allowed to wrap around the buffer. The entire keyboard interface is described later in this publication in the StanĆ dard Keyboard Interface paragraph, on page 6-35.
Display Services: Interrupt 10h A standard VGA BIOS is provided. The software interface to the display hardĆ ware is through function calls to the BIOS interrupt 10h. The function number is placed in the AH register. Other registers are loaded with the values required by the individual function and then the call to the interrupt is made. Each indiĆ vidual function is described in detail in the following pages.
Equipment Determination: Interrupt 11h This function returns the equipment information stored in the word located at 40:10h in the BIOS data area. The organization of the word is defined as folĆ lows: Bits
Description
15-14 Number of printer channels 13
Internal modem installed
12 joystick installed
11-9
Number of RS-232 channels
8
(Not used)
7-6
Number of diskette drives (if bit 0 = 1) 0 = One drive 1 = Two drives
5-4
Initial video mode 0 = Not used 1 = 40x25 color 2 = 80x25 color 3 = 80x25 B/W
3
(Not used)
2
Pointing device installed
1
Math coprocessor installed
0
Diskette available for boot
On Entry: None On Return: AX = Equipment information 6-14
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 151
SECTION 6
Conversions and Interfaces
Memory Size Determination: Interrupt 12h
Certain memoryĆsize information is stored in CMOS RAM located in the realĆ time clock. The organization of this data is as follows: Offset Size
Description
15h byte
Base memory in 1KB multiples, low byte
16h byte
Base Memory in 1KB multiples, high byte
17h byte
Extended Memory in 1KB multiples, low byte
18h byte
Extended Memory in 1KB multiples, high byte
Disk Services: Interrupt 13h Disk Services perform I/O to RAM, flash, and PC Card devices. The partitioning of RAM and flash for mass storage and the assignment of drive letters are deterĆ mined at system configuration. The following is a list of the Error Codes: Code (Hex) 00 01 03 04 05 06 07 08 09 0A 0B 0C
Description No error Invalid function or parameter WriteĆprotect error Sector not found Reset failed Diskette change line active Drive parameter activity failed DMA overrun operation Data boundary error BadĆsector flag detected Bad cylinder detected Media type not found
Code (Hex) 0D 0E 0F 10 20 40 80 AA BB CC E0 FF
Description Invalid number of sectors on format Control data address mark detected DMA arbitration level out of range Uncorrectable ECC or CRC error General controller failure Seek operation failed Timeout Drive not ready or not selected Undefined error occurred Write fault on selected drive Status error/error register = 0 Sense operation failed
Serial Communications Services: Interrupt 14h The transmit and receive functions use a timeout value from a table at location 40:7C. The default timeout value is 1, which represents about 1 second. The extended initialize function allows you to set baud rates beyond those availĆ able on a PC. Since these functions are polled (not interruptĆdriven), the faster baud rates are of little utility.
PEN*KEY R 6100 Computer Programmer’s Reference Guide
6-15
6. Conversions and Interfaces
This software interrupt returns the contents of location 40:13h in the BIOS data area in the AX register. Register AX contains the amount of RAM available to the operating system - up to 640K - as determined by the POST. The value reĆ turned in register AX indicates the number of 1KB blocks available and does not include the interrupt vector memory, BIOS data memory, or extended BIOS data memory areas.
Page 152
Conversions and Interfaces
SECTION 6
System Services: Interrupt 15h These services consist of the following topics: " "
6. Conversions and Interfaces
" " " " " " " "
Keyboard intercept Device access Program termination Event wait interval System request key Moving memory and reading memory size Switching to protected mode Indicating interrupt complete Returning system configuration parameters Returning extended BIOS data area segment
Keyboard Services: Interrupt 16h Access to the keyboard BIOS services is through INT 16h. The AH register is loaded with the function number to be performed. Other registers are loaded as required by the individual functions. Values are returned in individual registers as defined by the functions.
System Reboot: Interrupt 19h Application programs can issue Interrupt 19h to force the computer to reboot. The computer is forced through the initial powerĆup sequence. " NOTE:
Do not use INT 19h to reboot, as it causes a system failure on the 6100 Computer.
This computer uses ROM DOS and does not reload disk DOS when an interrupt 19h occurs. Refer to the Interrupt Cross-Reference table, page 6-28, for INT 15h, System Reset, function AX = 5380h, subfunction BH = 1Dh.
Real-Time Clock: Interrupt 70h This interrupt handler controls the periodic and alarm interrupt functions from the RTC. The periodic function, when activated, occurs 1024 times per second. The Dword counter is decremented by 976 at each interrupt. When the location becomes equal to or less than zero, bit seven of the designated location is set. The alarm function of the RTC provides an interrupt at the specified time and software Interrupt 4Ah is issued.
Locating 6100 BIOS Interrupts The interrupts supported for the 6100 Computer are listed in the Interrupt Cross-Reference tale, located under the Interrupt Cross-Ref (by number) tab. Even though they are matrixed into the entire set of interrupts, each individual interrupt supported by the 6100 BIOS can be identified by the notation, BIOS, immediately under the interrupt heading. The categories of interrupt services are listed in the center column of Table 6-2. Individual interrupt definitions can be located: "
" "
6-16
Looking up almost any noun or verb relating to a specific interrupt in the Interrupt Index, with the exception of Read, Set, and Get. Using the Interrupt Cross-Reference table; or Thumbing through the definitions, searching for the notation, BIOS.
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 153
SECTION 6
Conversions and Interfaces
Table 6-2 6100 BIOS Interrupt Summary Supported Interfaces
08h
System Timer Interrupt
09h
Keyboard Interface
10h
Display Services
11h
Equipment Determination
12h
Memory Size Determination
13h
Disk Services
14h
Serial Communications Services
15h
System Services
16h
Keyboard Services
19h
System Reboot
1Ah
Timer and Real-Time Clock Services
70h
Real-Time Clock Interrupt
6. Conversions and Interfaces
INT#
NORAND Proprietary System Interfaces There are some proprietary system interface extensions reserved for use by InĆ termec Technologies Corporation. These are in the INT 15, AX=5380, series.
Unsupported PC, 4000 Series BIOS Functions Nonmaskable Interrupt (NMI) 02h This interrupt is not used by the 6100 BIOS.
Print Screen Interrupt 05h The Print Screen interrupt is not supported by the 6100 BIOS.
4000 Series Video BIOS Functions: Interrupts 12h & 14h 4000 Series video functions are not available in the BIOS. This means that the 4000 display processing features listed below are not available. The 6100 screen rotation and font mapping utilities are provided to emulate the 4000 Series video functions for porting applications from the 4000 Series to the computer. " Cursor Fixed and Cursor Chase modes are not supported by the VGA BIOS. " NorLib and PL/N cursor on and off support are not supported. " InverseĆmode character mapping is not supported (characters above 127 are mapped to inverse video characters 0-127 by turning off the high bit). Also, the following 4000 Functions are not supported by the 6100 BIOS: " Function AH = 12h, Subfunction BL = 0FAh: Set Physical Display Size " Function AH = 12h, Subfunction BL = 0FBh: Return Pointer to Current Display Parameters " Function AH = 12h, Subfunction BL = 0FCh, AL = 0DDh: Return Invert Mode Status " Function AH = 12h, Subfunction BL = 0FCh, AL = 0DEh: Enable Invert Mode PEN*KEY R 6100 Computer Programmer’s Reference Guide
6-17
Page 154
Conversions and Interfaces
SECTION 6
Function AH = 12h, Subfunction BL = 0FCh, AL = 0DFh: Disable Invert Mode " Function AH = 12h, Subfunction BL = 0FCh, AL = 0E0h: Set Chase Mode " Function AH = 12h, Subfunction BL = 0FCh, AL = 0E1h: Set Fixed Mode " Function AH = 12h, Subfunction BL = 0FDh: Return Physical Display Size " Function AH = 12h, Subfunction BL = 0FEh: Read/Write Contrast (supĆ ported by 4000API.EXE) " Function AH = 12h, Subfunction BL = FFh: Backlight Off/On (supported by 4000API.EXE) " Function AH = 14h, Subfunction AL = 00h: Load User Font " Function AH = 14h, Subfunction AL = 01h Load System Default Font Support for porting 4000 Series applications to the 6100 Computer is provided by VROTATE.EXE and FONTSEL.EXE for most of the above services. For detailed information on supported video functions, refer to 4000 Series Screen Emulation, starting on page 6-24, or the Display Services Interrupt definition, page 6-36. "
6. Conversions and Interfaces
4000 Series Disk BIOS Services: Interrupt 13h These 4000 BIOS Interrupt 13h functions are not supported by the 6100 BIOS: Function 05h: Format Disk (reserved) " Function 0Ah: Read Long Sectors (reserved for diagnostics) " Function 0Bh: Write Long Sectors (reserved for diagnostics) Refer to Disk Services Interrupt, starting on page 6-36 in this section, for inforĆ mation on supported disk services. "
4000 Series Port Control BIOS Services: Interrupt 14h These 4000 BIOS Interrupt 14h functions are unsupported by the 6100 BIOS: Function AH = 05h: Extended Port Control " Function AH = 0FFh: Port Power On/Off Support is provided via 4000API.EXE for porting 4000 Series applications to the 6100 Computer. Refer to the Serial Communications Services Interrupt, starting on page 6-24 in this section, for supported serial communications services. "
4000 Series Multitasking BIOS Services: Interrupt 15h The 4000 Series BIOS multitasking services, informally referred to as INT 15, are not provided by the 6100 BIOS. This includes the following list of functions: " " " " " " " " " " " "
6-18
Function AX = 0100h: Create a task Function AX = 0101h: Delete a task Function AX = 0102h: Return information about a task Function AX = 0103h: Disable Task Switching Function AX = 0104h: Enable Task Switching Function AX = 0105h: Reset Multitasker Function AX = 0106h: Pend on Mailbox with Optional Timeout Function AX = 0107h: Accept Message from Mailbox (no pend) Function AX = 0108h: Post Message to Mailbox Function AX = 0109h: Pend on Queue with Optional Timeout Function AX = 010Ah: Accept Message from Queue (no pend) Function AX = 010Bh: Post Message to Queue
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 155
SECTION 6
Conversions and Interfaces
" " " "
4000 Series Printer BIOS Functions: Interrupt 17h
PC BIOS Interrupt 17h printer interfaces are not supported, as no parallel port is available on the 6100 Computer. These PC BIOS functions are not available: " Function AH = 0 Print character " Function AH = 1 Initialize printer port " Function AH = 2 Read status
4000 Series Programming Interfaces: 4000API.EXE Topics Overview Installation Command Line Switches Supported Programming Interfaces Unimplemented 4000 Series BIOS APIs
Page 6-19 6-19 6-19 6-20 6-23
Overview 4000API.EXE provides the capability of porting 4000 Series applications to the PEN*KEY 6000 Series environment by providing programming interfaces that these applications expect. These programming interfaces greatly reduce the amount of work required to port an application to the 6100 Computer. Please note that 4000API.EXE provides proprietary functions that are not indusĆ try standards. Use of certain 4000API.EXE functions limit the ability of the apĆ plication to function on standard platforms. If you desire portability and stanĆ dardization of applications, consider modifying old programs and developing new programs to conform to industry standards. These PEN*KEY 6000 Series platĆ forms are PCĆcompatible. When you want application portability to include PCs, use PC standards instead of the functions listed here.
Installation To load 4000API.EXE for use with a C++ application, use this command: 4000API.EXE /C3 /PC /10 /14 /16 To load 4000API.EXE for use with a PL/N application, use these commands: if an internal modem is used: 4000API.EXE /C3 /16 /10 /PC if an internal modem is not used: 4000API.EXE /16 /10 /PC
Command Line Switches /C3
/PC
Do not redirect COM3 to COM1. Do not ignore modem control signals. Existing PL/N applications frequently used COM3 to communicate with COM1, only without modem control signals being used. Typically, you should supply this switch, unless your application is a PL/N application that was originally designed to run on a 4000 Series Computer. Change the return value returned by interrupt 15h AX=01FBh. The default value is BIOS V3.00". When this switch is supplied, the value returned is BIOS V3.00". PEN*KEY R 6100 Computer Programmer’s Reference Guide
6-19
6. Conversions and Interfaces
"
Function AX = 010Ch: Delay Current Task Function AX = 010Dh: Initialize a Queue Structure as Empty Function AX = 010Eh: Enable Time Slicing Function AX = 010Fh: Disable Time Slicing Function AX = 0110h: Set Task Identifier
Page 156
Conversions and Interfaces
/10 /14 6. Conversions and Interfaces
/16
SECTION 6
Do not trap interrupt 10h (the video BIOS interrupt). There are a couple of 4000Ćcompatible video BIOS extensions enabled by default and disabled via this switch. Do not trap interrupt 14h (the COM port BIOS interrupt). By default, 4000API supplies 4000ĆcomĆ patible BIOS extensions for communicating to COM ports. By supplying this switch, the COM port BIOS supplied in ROM BIOS is used instead of the 4000API services. Typically, you should supply this switch, unless your application is a PL/N application that was originally to run on a 4000 SeĆ ries Computer. Do not trap interrupt 16h (the keyboard BIOS interrupt). By default, 4000API emulates the 4000 keyboard, complete with the ability to remap keys. When this switch is supplied, PCĆcompatible keycodes are returned instead of 4000Ćstyle keycodes.
Supported Programming Interfaces Some of the 4000 Series programming interface functions are supported for the 6100 Computer. Refer to the Cross-Reference by Interrupt Numbers on page 6-28, for a listing of the supported functions.
INT 10h: Display Services These services consist of interrupts supporting the display screen, including topĆ ics such as: V25 Comparator port, screen refresh, contrast, and backlight.
INT 14h: Serial Communications Services Software interrupt 14h is embedded into 4000API.EXE and allows access to the 4000 Series style serial communications channels. Three logical ports are mapped onto two physical ports. Port 0 and port 2 refer to the RS-232 ports. Port 2 acts like port 0 except that the modem control signals (RTS and CTS) are ignored. For example, Function 01h sends the character regardless of the state of those signals. Port 0 can act like port 2 with Function 05h. A major enhancement that these communication functions provide is the ability to ignore modem control signals when sending and receiving characters. This is a non-PC standard, but allows the use of cables that do not have DTR/CSR and RTS/CTS loopĆbacks or threeĆwireĆonly devices (TXD, RXD, and GND). This feaĆ ture is programmable via the extended port control functions. Port 1 refers to the RS-485 port. This port does not use the modem control sigĆ nals. If you try to read the signals for port 1, they always indicate To extend battery life, shut off communications port power when the port is not in use. The power is turned on whenever you access a port. You must explicitly turn off the power with Function FFh. The transmit and receive functions use a timeout value from a table at location 40:7C. The default timeout is 1, which represents about 1 second. The extended initialize function allows you to set baud rates beyond those availĆ able on a PC. Since these functions are polled (not interruptĆdriven), the faster baud rates are of little utility unless interruptĆdriven functions are used in place of the BIOS functions to send and receive a character. A major difference between the 4000 Series and PEN*KEY 6000 Series ComputĆ ers lies in UART capability. The 6000 Series uses PCĆcompatible UARTs. The 4000 Series does not use the PCĆcompatible 8250 UARTs. Because of this differĆ ence, the following conditions are expected by 4000 code. These conditions do not exist in the PEN*KEY 6000 Series Computer. This may affect portability of code where these bits are incorrectly masked and tested; modifications to existing 4000 Series code may be required for proper functioning. 6-20
PEN*KEY R 6100 Computer Programmer’s Reference Guide