home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR4
/
ZWDOS.ZIP
/
ZAPI.DOC
< prev
next >
Wrap
Text File
|
1993-03-05
|
9KB
|
261 lines
How to write programs to take advantage of ZWDOS's
Application Program Interface (ZAPI).
(C) Copyright Ya-Gui Wei 1993. All Rights Reserved.
Table of Contents
I. Why Might You Want to Use ZAPI
II. The ZAPI Function calls
Function 0: Query ZWDOS
Function 1: Get ZWDOS Version Number
Function 2: Set Chinese Compatible Mode
Function 3: Set ASCII Mode
Function 4: Display Chinese Character On Screen
Function 5: Display ASCII Character On Screen
Function 6: Soft Flush Display Buffer
Function 7: Hard Flush Display Buffer
Function 8: Get ZWDOS Mode
Function 9: Restore Auto-Switch
Function 0Ah: Get Bitmap Font for Chinese Character
Function 0Bh: Get Chinese Printing Configuration
Function 0Ch: Set Chinese Printing Configuration
III. How to Print Chinese Characters from Your Program
*****************
I. Why Might You Want to Use ZAPI
If you know how to write a DOS text mode program, you already know
how to write a Chinese program running under ZWDOS: You simply
prints an HZ-Chinese message to screen, and ZWDOS will display
them as Chinese for you. Why, then, might you need ZAPI?
Currently, ZAPI offers these features that you may want to take
advantage of:
(1) The ability to switch ZWDOS to Chinese-Compatible or ASCII-only
modes from software;
(2) The ability to display Chinese character on screen without
having to use the HZ escape sequences.
(3) The ability to control ZWDOS's screen updating;
(4) The ability to obtain the bitmap font of a Chinese character;
(5) The ability to control how Chinese characters are printed;
etc.
If any of the above features are useful for you, you may want to
use ZAPI in your programs.
II. The ZAPI Function calls
The ZWDOS Application Interface is accessed through the MS-DOS
Multiplex Interrupt, by loading register AX with E6A7h (hex E6A7),
BX with a function number, other registers whenever neccessary,
the call interrupt 2Fh.
Function 0: Query ZWDOS
At Entry: AX = E6A7h
BX = 0000h
DX = 7A57h
On Return: AX = 7A57h if ZWDOS was loaded
otherwise ZWDOS was not loaded
Note: Make sure ZWDOS is loaded before calling any other ZWDOS
functions.
Function 1: Get ZWDOS Version Number
At Entry: AX = E6A7h
BX = 0001h
On Return: AX = Version number in BCD Format.
Note: For exaple, for version 2.20, AX returns 0220h.
Function 2: Set Chinese Compatible Mode
At Entry: AX = E6A7h
BX = 0002h
On Return: Screen is switched to Chinese compatible mode.
Note: functions 4, 5, 6, 7, and 0Ah should be called
only when the screen is in Chinese Compatible mode.
Note: The automatic screen switching (between CC mode and
ASCII mode) is disabled after this call.
Function 3: Set ASCII Mode
At Entry: AX = E6A7h
BX = 0003h
On Return: Screen is switched to ASCII mode.
Note: The automatic screen switching (between CC mode and
ASCII mode) is disabled after this call.
Function 4: Display Chinese Character On Screen
At Entry: AX = E6A7h
BX = 0004h
CH = Row Number on Screen (0-24)
CL = Column Number on Screen (0-78)
DH = First Byte of 7-Bit Chinese Code (HZ)
DL = Second Byte of 7-Bit Chinese Code (HZ)
SI (low byte) = Attribute of Character
On Return: Character is queued for writing to requested
screen position.
Note: Attribute is as text mode character attributes, with
the lower 4 bit representing foreground color and
higher 4 bit representing background character.
High intensity background is not allowed.
Note: You can also display Chinese characters by writing
HZ codes to screen through DOS, BIOS or direct
access to video memory. But the ZAPI function call
will allow you to write Chinese characters without
using the HZ escape sequences.
Function 5: Display ASCII Character On Screen
At Entry: AX = E6A7h
BX = 0005h
CH = Row Number on Screen (0-24)
CL = Column Number on Screen (0-78)
DH = Attribute of Character.
DL = ASCII character (8 bit) to write to screen
On Return: Character is queued for writing to requested
screen position.
Note: Attribute is as text mode character attributes.
High intensity background is not allowed.
Function 6: Soft Flush Display Buffer
At Entry: AX = E6A7h
BX = 0006h
On Return: ASCII characters are flushed to screen. Chinese
characters for which font exists in font cache
are flushed to screen.
Note: this function is normally called from the timer interrupt
about 5 times a second.
Function 7: Hard Flush Display Buffer
At Entry: AX = E6A7h
BX = 0007h
On Return: If the font for a Chinese character does not exist
in the font cache, it is read from the disk font
library into the font cache, and the character image
is written to the display.
Note: this function is normally called from the DOS idle interrupt.
Do not call this from inside TSRs unless DOS re-entrancy
problem is watched for.
Function 8: Get ZWDOS Mode
At Entry: AX = E6A7h
BX = 0008h
On Return: AX = 1 if Screen is in Chinese Compatible Mode
AX = 0 if Screen is in ASCII Mode
Function 9: Restore Auto-Switch
At Entry: AX = E6A7h
BX = 0009h
On Return: If the Auto-Switch mode is on (manual mode is off)
before any calls to functions 2 and 3, this call
restores the auto-switch.
Note: If your program used functions 2 and 3, call this
function before you exit.
Function 0Ah: Get Bitmap Font for Chinese Character
At Entry: AX = E6A7h
BX = 000Ah
DX = Chinese Character (DH=First Byte)
ES:DI = pointer to 32-byte buffer
On Return: if AX=1, buffer is filled with bitmap font.
if AX=0, font for character is not found in font cache.
Note: if the requested character font is not found in the cache,
it is queued for reading from the disk font library (along
with other read requests from the screen updating and
printing routines), and the font is read when a Hard Flush
is either explicitly or implicitly called. A second call
to this function after a Hard Flush may be successful. If,
however, if fails after a Hard Flush, the character may be
a bad code or for which the bitmap font is not defined.
Note 2: the size of the above read queue is guaranteed to be
more than 200 entries. Repeated requests with the same
character result in repeated entries in the queue. The
font cache is guranteed to hold fonts for 256 characters,
and usually holds much more.
Function 0Bh: Get Chinese Printing Configuration
At Entry: None
On Return: AL = Printer Type
0: No Printer
1: 9 Pin Dot Matrix Printer
2: 24 Pin Dot Matrix Printer
3: HP LaserJet
4-FFh: Reserved
AH = Dot Matrix Printer Type
0: IBM ProPrinter Compatible
1: Epson Compatible
2-FFh: Reserved
BL = Printer Resolution (LaserJet Only)
0: Low Resolution (100 dpi on LaserJet)
1: Medium Resolution (150 dpi on LaserJet)
2: High Resolution (300 dpi on LaserJet)
3-FFh: Reserved
BH = Printer Port to Use for Chinese Printing
0: LPT1
1: LPT2
2-FFh: Undefined
DL = Print Vertical
0: Chinese text printed horizontally
1: Chinese text printed with 90 degree rotation
2-FFh: Undefined
DH = Print Blank
0: HZ and zW escape sequences not printed at all
1: Escape sequences printed as two ASCII spaces
2-FFh: Undefined
Function 0Ch: Set Chinese Printing Configuration
At Entry: Registers set up with printing configuration info
as described for Function 0Bh.
On Return: None
Note: Do not change printer config while printing is going on.
Do not use undefined or reserved values.
III. How to Print Chinese Characters from Your Program
To print Chinese characters, you simply send the Characters in
their HZ coded format to the printer device through relevant
DOS or BIOS calls, or through their high level language
implementations, as you normally would with ASCII applications.
The output will be printed as Chinese characters if the screen
has been switched to Chinese compatible mode.
You should use ZAPI Functions 0Bh to check the Chinese printing
configurations, particularly the "Print Blank" set-up, which
governs whether the HZ/zW escape sequences are printed as
blanks or not printed at all.
March 4, 1993
[End of Document.]