jenkin@utai.UUCP (Michael Jenkin) (05/23/86)
Here is a very simple vt52 emulator for the st with function keys. It is a quick hack designed to work with CMS systems. It defines the arrow keys, the enter key, and f1-f10 are defined as CMS function keys f1-f10. This was written using HIPPO-C (yes, you can write things using HIPPO-C), and converting to DRI 'C' should be straight forward. To use, save this to disk, compile, and link with the -S option. Move a:\a.prt to a:\vt52.tos and you're ready to go. --------------------------- cut here ------------------------------ # include <stdio.h> /* vt52.c - a very simple vt52 emulator with function keys */ # define ESC 0x1b int c, k; esc(s) char *s; { auxout(ESC); for(;*s;s++){ while(!auxos()); auxout(*s); } } main() { while(1){ while(auxis() < 0) putchar(auxin() & 0xff); if(conis() < 0){ c = rawcin(); k = c & 0xff; c = c >> 16; if(c < 0x3a) /* regular keyboard character */ auxout(k); else if((c >= 0x3b) && (c < 0x44)){ /* function key */ auxout(ESC); auxout('1' + (c - 0x3b)); } else if(c == 0x44){ esc("0"); } else { /* special function keys */ switch(c){ case 0x62: /* help - return to desktop */ term0(); break; case 0x48: /* cursor up */ esc("A"); break; case 0x4b: /* cursor left */ esc("D"); break; case 0x50: /* cursor down */ esc("B"); break; case 0x4d: /* cursor right */ esc("C"); break; case 0x72: /* keypad enter */ esc("?M"); break; } } } } } -- Michael Jenkin University of Toronto USENET: {utzoo,floyd,linus,decvax,ihnp4,allegra}!utcsri!utai!jenkin CSNET: jenkin@Toronto ARPA: jenkin%Toronto@CSNet-Relay BELL: 416-978-7321