[net.micro.atari16] keypad probem ,need vt100 for ST

jtl3767@ritvaxc.BITNET.UUCP (05/17/86)

Hello,
        I would like to know is there any modem program for either 16
or 8 bits that would support keypad for full screen mode?? just like
VT100, I know vt52 don't work with that problem. I have Chat, ST-talk and
STerminal but they don't work with keypad support. If you know any program
or suggest, please respond, I need it badly, more that you can imaged!
 mail back to me  or
leave mail in GEnie my mail address is J.T.Lytle
                          Thanks,
                             John Lytle
                             NTID/RIT
                             Rochester, NY

braner@batcomputer.TN.CORNELL.EDU (braner) (05/23/86)

I have written a small program that installs an alternative keyboard
tranlation table into TOS. The table is read as a (binary) file.
I currently have a file which translates Backspace to rubout, Delete
to ^D, and the arrow keys to what is needed for microEmacs. A file
can be created for vi, say, using a simple C program I have also
written. The numeric pad keys CAN be distinguished, if you want.

Catches: A key can only be translated to ONE ASCII code with this
method. The installed table is used only by programs that call the
usual TOS char input routine. Communication programs may bypass that
upon some function keys, e.g. XMOTER preempts all F# keys and more.

Nevertheless, this method is an easy way to make life easier INSIDE
existing programs/environments! Email if interested.

braner@batcomputer.TN.CORNELL.EDU (braner) (06/06/86)

[]

* This is the assembly source for the program that installs
*   keyboard conversion tables.
* The table is read from a binary file 384 bytes long.

   .xdef _main

_main:
   bra SK

* Space for keyboard tables
   even
US ds.b 128
SH ds.b 128
CL ds.b 128

TT dc.b 27,"E"
   dc.b 13,10,"+--------------------------+"
   dc.b 13,10,"|  SET-KEYBOARD PROGRAM    |"
   dc.b 13,10,"|                          |"
   dc.b 13,10,"|  by Moshe Braner, 8605   |"
   dc.b 13,10,"+--------------------------+"
   dc.b 13,10
   dc.b 13,10,"Name of .ktb file: (RETURN for sys) _"
   dc.b 8, 0
   even

* get file name from user

SK move.l A0,-(SP)           * save registers
   move.l D0,-(SP)
   pea TT(PC)                * push addr of title
   move.w #9,-(SP)           * code of PRINT LINE
   trap #1                   * call GEMDOS
   addq.l #6,SP
   lea FL(PC),A0
   move.b #40,(A0)           * max no. of chars to input...
   pea FL(PC)                * into filename buffer...
   move.w #10,-(SP)          * using READLINE() function...
   trap #1                   * of GEMDOS
   addq.l #6,SP
   tst.b D0                  * any input?
   bne S1                    *  - then do it,

* exit program

S0 move.w #24,-(SP)          * else...
   trap #14                  * restore system kbd table...
   addq.l #2,SP
   move.l (SP)+,D0           * restore registers...
   move.l (SP)+,A0
   clr.w -(SP)               * and return to GEMDOS
   trap #1

* read data file

S1 lea FN(PC),A0             * use input length to put a
   clr.b #0(A0,D0)           *   0 at end of filename
   clr.w -(SP)               * open file for read only
   pea FN(PC)                *   using given filename
   move.w #$3D,-(SP)
   trap #1                   * OPEN()
   addq.l #8,SP
   tst.w D0
   bmi S0                    * exit upon error
   lea FH(PC),A0
   move.w D0,(A0)            * save file handle
   pea US(PC)                * read into table area
   move.l #$180,-(SP)        * a complete keyboard table
   move.w D0,-(SP)           * from this file
   move.w #$3F,-(SP)
   trap #1                   * READ()
   adda.l #12,SP
   lea FE(PC),A0
   move.w D0,(A0)            * save error code
   lea FH(PC),A0
   move.w (A0),-(SP)         * push file handle
   move.w #$3E,-(SP)
   trap #1                   * CLOSE()
   addq.l #4,SP
   tst.w D0                  * exit upon error in...
   bmi S0                    *   closing or...
   move.w FE(PC),D0          *     reading
   tst.w D0
   bmi S0

* install new table pointers

   pea CL(PC)                * new keyboard tables
   pea SH(PC)
   pea US(PC)
   move.w #16,-(SP)          * code of keytbl()
   trap #14
   adda.l #14,SP

* exit but leave table resident

   move.l (SP)+,D0           * restore registers...
   move.l (SP)+,A0
   move.w #0,-(SP)           * no-error code
   move.l #$400,-(SP)        * save this much stuff
   move.w #$31,-(SP)         * code for KEEP PROCESS
   trap #1                   * return to GEMDOS

* File handle, error_code, name_len & name buffers

   even
FH ds.w 1
FE ds.w 1
FL ds.b 2
FN ds.b 40

* - Moshe Braner, Cornell, 607-255-3498

braner@batcomputer.TN.CORNELL.EDU (braner) (06/06/86)

[]

* This is a table of the standard keyboard translation table
* that is in the 1040ST ROM, + comments, in a form that can be
* read by the HTB (hex to binary) program. Modify to suit...

* 1040ST system keyboard table
* ============================

* unshifted:

00
1B 31 32 33 34 35 36 37 38 39 30 2D 3D  * Esc 1 2 3 ... =
08  * Backspace
09 71 77 65 72 74 79 75 69 6F 70 5B 5D  * Tab q w e ... ]
0D  * Return
00 61 73 64 66 67 68 6A 6B 6C 3B 27     * Ctrl a s d ... '
60  * `
00  * Left Shift
5C  * \
7A 78 63 76 62 6E 6D 2C 2E 2F           * z x c ... /
00  * Right Shift
00
00  * Alternate
20  * Space
00  * Caps Lock
00 00 00 00 00 00 00 00 00 00           * F1 F2 ... F10
00 00
00  * Clr Home
00  * Up Arrow
00
2D  * Pad -
00  * Left arrow
00
00  * Right arrow
2B  * Pad +
00
00  * Down arrow
00
00  * Insert
7F  * Delete
00 00 00 00 00 00 00 00 00 00 00 00 00
00  * Undo
00  * Help
* Pad: (  )  /  *  7  8  9  4  5  6  1  2  3  0  .  Enter
      28 29 2F 2A 37 38 39 34 35 36 31 32 33 30 2E 0D
00 00 00 00 00 00 00 00 00 00 00 00 00

* shifted:

00
1B 21 40 23 24 25 5E 26 2A 28 29 5F 2B
08
09 51 57 45 52 54 59 55 49 4F 50 7B 7D
0D
00 41 53 44 46 47 48 4A 4B 4C 3A 22
7E
00
7C
5A 58 43 56 42 4E 4D 3C 3E 3F
00
00
00
20
00
00 00 00 00 00 00 00 00 00 00           * F1 ... F10
00 00
37  * Clr Home
38  * Up arrow (!)
00
2D
34
00
36
2B
00
32
00
30  * Insert
7F  * Delete
00 00 00 00 00 00 00 00 00 00 00 00 00
00  * Undo
00  * Help
28 29 2F 2A 37 38 39 34 35 36 31 32 33 30 2E 0D  * Pad
00 00 00 00 00 00 00 00 00 00 00 00 00

* caps locked:

00
1B 31 32 33 34 35 36 37 38 39 30 2D 3D
08
09 51 57 45 52 54 59 55 49 4F 50 5B 5D
0D
00 41 53 44 46 47 48 4A 4B 4C 3B 27
60
00
5C
5A 58 43 56 42 4E 4D 2C 2E 2F
00
00
00
20
00
00 00 00 00 00 00 00 00 00 00           * F1 ... F10
00 00
00
00
00
2D
00
00
00
2B
00
00
00
00
7F
00 00 00 00 00 00 00 00 00 00 00 00 00
00
00
28 29 2F 2A 37 38 39 34 35 36 31 32 33 30 2E 0D  * Pad
00 00 00 00 00 00 00 00 00 00 00 00 00

braner@batcomputer.TN.CORNELL.EDU (braner) (06/06/86)

[]

/* Program to create a binary file from a hex file.
   by Moshe braner, 860606.

   Will read data with any amount of parsing characters between
    the hex codes (including none).
   Rest of a line after a '*' is regarded as a comment.
   Can be used to create keyboard translation tables, etc.
*/

#include <stdio.h>

#define  ishex(c)  ((c>='0'&&c<='9')||(c>='A'&&c<='F')||(c>='a'&&c<='f'))

/* the following macro assumes ishex(c) and ASCII: */
#define  hexval(c) ((c<'A')?(c-'0'):((c<'a')?(c-'A'+0xA):(c-'a'+0xA)))

main() {
	register int c, b, n;
	FILE *infp, *outfp;
	char infname[80], outfname[80];

	printf("\n\nHex To Binary conversion program.  MB 8606.\n\n");
	printf("Enter name of source file: ",stdout);
	gets(infname);
	if ((infp=fopen(infname,"r")) == NULL) {
		printf("cannot open source file!\n");
		exit(0);
	}
	printf("Enter name of output file: ");
	gets(outfname);
	/* open file with "bw" to avoid translation of '\n's
	   to \r\n by Megamax library
	*/
	if ((outfp=fopen(outfname,"bw")) == NULL) {
		printf("cannot open output file!\n");
		exit(0);
	}
	n = 0;
	while ((c=getc(infp)) != EOF) {
		/* rest of line after '*' is a comment: */
		if (c == '*') {
			while ((c=getc(infp)) != '\n' && c != EOF);
			continue;
		}
		/* read one or two characters for one output byte: */
		if (ishex(c)) {
			b = hexval(c);
			if ((c=getc(infp)) == EOF)
				break;
			if (ishex(c))
				b = 16*b + hexval(c);
			if (putc(b,outfp) != b) {
				printf("error writing file!\n");
				exit(0);
			}
			n++;
		}
	}
	printf("\nWrote %d bytes.\n", n);
}

/* - Moshe Braner, Cornell, 607-255-3498 */