Classic Computer Magazine Archive COMPUTE! ISSUE 87 / AUGUST 1987 / PAGE 91

Pop-Up ASCII Table For IBM

Paul W. Carlson

This handy utility provides an instant list of all IBM characters and their ASCII equivalents—and it's available at any time with the touch of a key.

The IBM PC/PCjr has a very rich character set. Besides the usual punctuation marks, numbers, and upper-and lowercase letters, many other characters are available to BASIC programmers. Any character can be displayed in BASIC by using a statement such as PRINT CHR$(n), where n is the ASCII code for the character to be displayed. There are so many characters, however, that it's nearly impossible to remember the ASCII codes for all of them. Most programmers have to refer frequently to the BASIC manual for this information, which takes time and interrupts your train of thought.

"Pop-Up ASCII Table" is a memory-resident machine language program that displays a complete table of IBM characters, along with their ASCII codes, at the touch of a key. Whenever you press its hot-key combination, the ASCII table pops up for your inspection, even if you're running another program at the time. Listed below is a BASIC filemaker program which creates ASCIITBL.COM, the machine language program. Type in the program and run it to create the ASCIITBL.COM machine language file. (ASCIITBL.COM is the name of the file created by the BASIC program; you must use some other name for the BASIC program itself.)

ASCIITBL.COM is a memory-resident program, also known as a terminate and stay resident (TSR) program. This type of program runs only once to install itself in the computer's memory, then waits in the background for the special event which triggers it. This particular program is triggered by pressing a special key combination, called a hot key. The hot key for the Pop-Up ASCII Table program is Alt-A (hold down the Alt key and press A).

To install this program in memory, enter ASCIITBL at the DOS prompt. In about a second, the DOS prompt reappears. Although nothing seems to have happened, the program has installed itself in memory and is quietly waiting to be activated by the hot-key combination. If you have an AUTOEXEC.BAT file on the disk you use to boot your system, you may want to add the line ASCIITBL to the batch file so the program will be installed automatically each time you boot the computer.

Once the program is installed, you can instantly bring the ASCII table onto the screen by pressing Alt-A. To hide the table and return to what you were doing, press the Esc key. This can be done at any time, even when you're in the middle of entering a BASIC program line. When you exit the ASCII table, the screen is restored exactly as it appeared before. Note that you must be in 80-column mode when you activate the ASCII table. If you are not, the program simply ignores the hot key.

When the table appears, you will notice that character codes 0, 7, 9–13, and 28–31 have a two-letter abbreviation after them. These are unprintable characters that perform a control function rather than causing a character to appear on the screen. Here is an explanation of those abbreviations:

NU null character (zero)
BP beep
TB tab
LF linefeed
FF form feed
CR carriage return
RT cursor right
LT cursor left
UP cursor up
DN cursor down

ASCIITBL.COM is designed primarily as an aid for BASIC programmers and it performs well in that environment. However, it also works with many other programs, including other memory-resident programs. Still, it may not be able to work with programs that take absolute control of the keyboard. The only way to tell for sure is to try it out.

Customizing ASCIITBL.COM

The Alt-A key combination was chosen because the letter A suggests ASCII. Should you want to use this program along with some other memory-resident program which also uses Alt-A, you can substitute another letter for A. The number in parentheses in line 30 is the extended scan code for the key-press that activates the program. To change the A in Alt-A to some other letter, replace the number in parentheses with a number from the following table.

30 Alt-A
48 Alt-B
46 Alt-C
32 Alt-D
18 Alt-E
33 Alt-F
34 Alt-G
35 Alt-H
23 Alt-I
36 Alt-J
37 Alt-K
38 Alt-L
50 Alt-M
49 Alt-N
24 Alt-O
25 Alt-P
16 Alt-Q
19 Alt-R
31 Alt-S
20 Alt-T
22 Alt-U
47 Alt-V
17 Alt-W
45 Alt-X
21 Alt-Y
44 Alt-Z

ASCIITBL.COM Filemaker

For instructions on entering this programs, please refer to "COMPUTE!'s Guide to Typing in Programs" elsewhere in this issue.

BA 1 'Program to create ASCIITB L.COM
DA 2' Copyright 1987 Compute! Publications, Inc.
MC 3 'All Rights Reserved.
CL 4 CLS : PRINT"Copyright 1987" : PRINT
"Compute! Publications, Inc. " : PRINT" All Rights Reserved.".
NP 5 FOR Z = 1 TO 1500 : NEXT
BO 6 CLS
DI 10 OPEN "ASCIITBL.COm" FOR OUTPUT AS 1
NL 20 PRINT # 1, CHR$ (&HE9); CHR$ (&HBO); CHR$ (&H1);
KM 30 PRINT #1, CHR$ (30);
IM 40 FOR N = 1 TO 6 : PRINT #1, CHR$(0); : NEXT
NN 50 T = 0 : FOR j = 1 TO 646 : READ A$ : N = VAL ("H" + A$)
FD 60 T = T + N : PRINT # 1, CHR$ (N) ; : NEX T : CLOSE 1
NM 70 IF T = 56547! THEN PRINT "ASCIITBL.COM SUCCESSFULLY CREATED!" : END
LP 80 PRINT CHR$(7); " "***** ERROR IN DATA STATEMENTS ******" : END
ID 90 DATA 00, 00, 00, 00, 00, 00, 83, 02, 2C, 28
HH 100 DATA 2D, 29, 2A, 2E, 1E, 1E, AA, 0F, 4E, 55, 0A
IB 110 DATA 14, 42, 50, 4A, 15, 54, 42, EA, 15, 4C
AH 120 DATA 46, 8A, 16, 4B, 4D, 2A, 17, 46, 46, CA
EE 130 DATA 17, 43, 52, 38, 12, 52, 54, D8, 12, 4C
FJ 140 DATA 54, 78, 13, 55, 50, 18, 14, 44, 4E, 50
BK 150 DATA 72, 65, 73, 73, 20, 5B, 45, 73, 63, 5D
MO 160 DATA 20, 74, 6F, 20, 63, 6F, 6E, 74, 69, 6E
QL 170 DATA 75, 65, 2E, 2E, 2E, 2E, 80, 3E, 08, 01
BI 180 DATA 00, 75, 22, FB, 50, 53, 51, 52, 56, 57
HC 190 DATA 1E, 06, E4, 60, 2E, 3A, 06, 03, 01, 75
DF 200 DATA 08, B4, 02, CD, 16, AB, 0B, 75, 0D, 07
CB 210 DATA 1F, 5F, 5E, 5A, 59, 5B, 58, 2E, FF, 2E
IC 220 DATA 0C, 01, EB, DF, 00, 0E, 1F, 0E, 07, B4
CL 230 DATA 0F, CD, 10, 3C, 02, 74, 11, 3C, 03, 74
LD 240 DATA 0D, 3C, 07, 74, 09, 07, 1F, 5F, 5E, 5A
DB 250 DATA 59, 5B, 5B, CF, 88, 3E, 07, 01, C6, 06
NK 260 DATA 08, 01, 01, B4, 03, CD, 10, 89, 0E, 09
B8 270 DATA 01, B4, 01, B5, 20, CD, 10, 80, 3E, 04
IE 280 DATA 01, 00, 75, 03, EB, 84, 00, 8B, 3E, 10
DE 290 DATA 01, EB, 41, 00, BB, A0, 0F, E8, 55, 00
KA 300 DATA 80, 3E, 04, 01, 00, 75, 03, E8, 7C, 00
IC 310 DATA B4, 00, CD, 16, 3C, 1B, 75, F8, 80, 3E
NK 320 DATA 04, 01, 00, 75, 03, E8, 5B, 00, BB, 00
HN 330 DATA 00, EB, 33, 00, 80, 3E, 04, 01, 00, 75
CJ 340 DATA 03, E8, 5A, 00, B4, 01, 8B, 0E, 09, 01
BK 350 DATA CD, 10, C6, 06, 08, 01, 00, EB, BE, BA
BJ 360 DATA 1E, 07, 01, 32, FF, 57, EB, 2A, 00, 8B
AG 370 DATA F7, 5F, 1E, 8E, 1E, 05, 01, B9, D0, 07
IP 380 DATA FC, F3, A5, 1F, C3, 8B, 36, 10, 01, 03
PE 390 DATA F3, 8A, 1E, 07, 01, 32, FF, E8, 0B, 00
DD 400 DATA 8E, 06, 05, 01, FC, B9, D0, 07, F3, A5
OD 410 DATA C3, B8, 00, 10, F7, E3, 8B, FB, C3, BA
EL 420 DATA DA, 03, EC, AB, 08, 74, FB, 83, EA, 02
DA 430 DATA B0, 25, EE, C3, B4, 0F, CD, 10, 8D, 1E
CL 440 DATA 12, 01, D7, BA, DB, 03, EE, C3, E4, 61
FF 450 DATA BA, E0, 0C, 80, E6, 61, 8A, C4, E6, 61
NO 460 DATA FA, BO, 20, E6, 20, FB, C3, C6, 06, 04
EJ 470 DATA 01, 00, C7, 06, 05, 01, 00, B8, B4, 0F
ED 480 DATA CD, 10, 3C, 07, 75, 11, FE, 06, 04, 01
FP 490 DATA 81, 2E, 05, 01, 00, 0B, B9, 0D, 0C, 3C
OK 500 DATA 07, EB, 03, B9, 07, 06, B4, 01, CD, 10
BK 510 DATA B9, D0, 07, 8B, 3E, 10, 01, 81, C7, A0
OE 520 DATA 0F, B8, 20, 07, F3, AB, 8B, 3E, 10, 01
QN 530 DATA B1, C7, A2, 0F, 8B, DF, 8B, FB, B9, 1B
IJ 540 DATA 00, AO, OB, O1, 3C, 17, 77, 09, 83, EF
NE 550 DATA 02, C6, 05, B3, 83, C7, 02, B2, 00, 3C
JE 560 DATA CB, 72, 09, C6, 05, 32, 2C, C8, B2, 01
MP 570 DATA EB, 0B, 3C, 64, 72, 07, C6, 05, 31, 2C
DB 580 DATA 64, B2, 01, 47, 47, D4, 0A, 05, 30, 30
BN 590 DATA 80, FC, 30, 75, 07, 80, FA, 00, 75, 02
DB 600 DATA B4, 20, 8B, 25, 47, 47, 88, 05, 47, 47
FA 610 DATA 47, 47, A0, 0B, 01, 88, 05, 47, 47, 47
CE 620 DATA 47, C6, 05, B3, 81, C7, 94, 00, 80, 3E
DF 630 DATA 0B, 01, FF, 74, 0B, FE, 06, 0B, 01, E2
MH 640 DATA 9C, 83, C3, 0E, EB, 92, 8D, 1E, 19, 01
BK 650 DATA B9, 0B, 00, BE, 00, 00, 8B, 3E, 10, 01
EA 660 DATA 8B, 00, 03, FB, 46, 46, 8A, 00, 88, 05
HD 670 DATA 46, 47, 47, 8A, 00, 88, 05, 46, E2, EB
PJ 680 DATA 8B, 3E, 10, 01, 81, C7, D8, 1E, 8D, 1E
QK 690 DATA 45, 01, B9, 1A, 00, BE, 00, 00, BA, 00
FL 700 DATA B8, 05, 46, 47, 47, E2, F7, B4, 35, B0
FC 710 DATA 09, CD, 21, 89, 1E, 0C, 01, 8C, 06, 0E
LP 720 DATA 01, B4, 25, B0, 09, 8D, 16, 5F, 01, CD
DN 730 DATA 21, BA, C3, 21, CD, 27