157 lines
3.9 KiB
Plaintext
157 lines
3.9 KiB
Plaintext
|
||
|
||
|
||
AST RESEARCH, INC. TECHNICAL BULLETIN #TB-0349 12/28/87
|
||
|
||
AST 5250 TRANSLATION TABLES
|
||
|
||
|
||
An alternate method of finding the translation tables for
|
||
AST's 5250 family of products is available through the use
|
||
of the Application Program Interface (API). This method does
|
||
not use the method mentioned in the AST-5250 Emulation
|
||
Program base manual, which uses the Device Control Block
|
||
(DCB). Instead, this method uses function 0Fh of the API.
|
||
|
||
-NOTE: Programmers wishing to use the AST-API
|
||
should refer to publication 000357-001B "AST-API
|
||
supplement to the AST-5251/11 user's manual" or
|
||
the IBM-API documentation.
|
||
|
||
Here is a sample program written for Borland's TURBO C
|
||
compiler that uses API function 0Fh to find the translation
|
||
tables.
|
||
|
||
/* ------------------------------------------------------ */
|
||
/* TABLES.C - programmer: Paul McGinnis - DataComm */
|
||
/* Support Dec. 1987 Uses AST-5250 implementation of API */
|
||
/* (Applications Program Interface) Program compiled and */
|
||
/* tested with Borland's TURBO C v1.0 */
|
||
|
||
#include <stdio.h>
|
||
#include <dos.h>
|
||
|
||
main()
|
||
{
|
||
unsigned char c;
|
||
unsigned int offset, off2, xu, xl, i, j, k;
|
||
int seg;
|
||
puts("");
|
||
puts("AST-5250 products - API conversion tables");
|
||
puts("");
|
||
puts("Choices available are:");
|
||
puts("");
|
||
puts("--> 1 <-- EBCDIC-to-ASCII table");
|
||
puts("");
|
||
puts("--> 2 <-- Scan code table");
|
||
puts("");
|
||
puts("--> 3 <-- ASCII-to-EBCDIC table");
|
||
puts("");
|
||
puts("--> 4 <-- ASCII-to-5250 scan code table");
|
||
puts("");
|
||
puts("--> 5 <-- PC-to-5250 uppercase scan code table");
|
||
puts("");
|
||
puts("--> X <-- Abort program and exit to DOS");
|
||
printf("\n\nEnter choice: ");
|
||
c = getchar();
|
||
if ((c > 0x35) || (c < 0x31))
|
||
return;
|
||
puts("");
|
||
|
||
/* This section calculates the necessary offsets for the
|
||
pointer table */
|
||
|
||
if (c == 0x31)
|
||
{
|
||
puts("EBCDIC-to-ASCII table");
|
||
off2 = 0;
|
||
}
|
||
else if (c == 0x32)
|
||
{
|
||
puts("Scan code table");
|
||
off2 = 4;
|
||
}
|
||
else if (c == 0x33)
|
||
{
|
||
puts("ASCII-to-EBCDIC table");
|
||
off2 = 8;
|
||
}
|
||
else if (c == 0x34)
|
||
{
|
||
puts("ASCII-to-5250 scan code table");
|
||
off2 = 0x0c;
|
||
}
|
||
else
|
||
{
|
||
puts("PC-to-5250 uppercase scan code table");
|
||
off2 = 0x10;
|
||
}
|
||
|
||
/* This section loads the AL register with the function
|
||
number (0Fh), generates DOS interrupt 59h used by AST-5250
|
||
API, and retrieves the segment and offset of the pointer
|
||
table */
|
||
|
||
_AL = 0x0f;
|
||
geninterrupt(0x59);
|
||
c = _AL;
|
||
offset = _SI;
|
||
seg = _ES;
|
||
if (c != 0)
|
||
{
|
||
puts("***FATAL ERROR*** generating DOS interrupt 59h
|
||
used by API.");
|
||
puts("");
|
||
return;
|
||
}
|
||
/* This section finds and displays the actual table in
|
||
memory */
|
||
|
||
i = offset + off2;
|
||
xl = peek(seg, i);
|
||
j = i + 2;
|
||
xu = peek(seg, j);
|
||
printf
|
||
("Pointer location = %04X:%04X table location =
|
||
%04X:%04X\n\n",
|
||
seg, i, xu, xl);
|
||
puts
|
||
(" 0# 1# 2# 3# 4# 5# 6# 7# 8# 9# A# B#
|
||
C# D# E# F#");
|
||
printf
|
||
(" -- -- -- -- -- -- -- -- -- -- -- -- -
|
||
- -- -- --");
|
||
for (i = 0; i < 0x10; ++i)
|
||
{
|
||
printf("\n#%01X: ", i);
|
||
for (j = 0; j < 0x10; ++j)
|
||
{
|
||
k = xl + (j << 4) + i;
|
||
c = (unsigned char) peek(xu, k);
|
||
printf("%02X ", c);
|
||
}
|
||
}
|
||
puts("");
|
||
puts("");
|
||
}
|
||
|
||
/* ------------------------------------------------------ */
|
||
References:
|
||
|
||
- AST-API Supplement to the AST-5251/11 user's manual
|
||
000357-001B February 1987.
|
||
|
||
- AST-5250 Emulation Program base manual 000425-001A
|
||
January 1987.
|
||
|
||
- IBM 5250 API programmer's manual.
|
||
|
||
- Turbo C user's guide & reference guide
|
||
|
||
TURBO C is a registered trademark of Borland International
|
||
IBM is a registered trademark of International Business
|
||
Machines Corp.
|
||
|
||
|
||
|
||
|