; ; Program to interface a Heath H19 terminal to the ; PTDOS EDIT program. If ENTRY is called instead of CONIN ; from EDIT then ESC esquence characters sent by the H19 ; special function keys will be translated into control ; characters used by EDIT. ; This "subroutine" works in the following way: ; If an escape character is recieved then the routine ; waits for another character to be recieved and checks to ; see if it is a valid 2 character escape sequence. If it ; is it is translatted to a 1 character control character ; and returned to edit. If it is not, then the second ; character received is returned. Thus to send an ; escape character to EDIT the escape key should be typed ; twice. ; ; To implement the routine, you must patch EDIT. This is ; not too difficult. READ the program to memory and ; get a dump. Everywhere there is CD A2 BC (CALL CONIN) ; substitute CD 60 00 (a call to this routine). ; Load this routine at 0060 (or elsewhere if you wish) ; so that it wont write over the editor which starts ; at 0100. ; Then WRITE the new version (dont distroy origional) including ; this routine to disk. ; ; The locations of the CALL CONIN are: ; 02B3, 02F7, 0412, 0491, 0617, 06BC, 0721, 0727, 07AE, ; 0C1C, 0CBB, 1557. ; ; By the way, the table that the EDITor uses for control ; key decoding is located at 0337. Its a series of triplets ; (control key code followed by an address of the routine ; to handle that function). ;-------------------------------------------------------------- ; .LOC 60H ;locate this code below ;the editor. COPY ZPTDEFS ;my Z80 definition file. contains ;NPTDEFS as a subset. ; ENTRY: CALL CONIN ;get character CPI ESC ;if not esc RNZ ;return ; ; character was escape, translate next character to ; control character. ; CALL CONIN ;get next character PUSH H PUSH PSW ;save it LXI H,TABLE ;point to translation table ; ; look for character in translation table. ; LOOP: CMP M ;is this it? JZ FOUND ;yes exit INX H ;no point to next character INX H MOV A,M ;end of table? CPI 0 JZ ENDTAB ;yes, no find. POP PSW ;get back character PUSH PSW JMPR LOOP ;and keep looking ; ENDTAB: POP PSW ;return with untranslated character POP H RET FOUND: INX H ;get substitution character POP PSW ;fix stack. MOV A,M ;into A POP H RET ;------------------------------------------------------------ ; translation table. esc followed by letter results in ; output character. ;------------------------------------------------------------ TABLE: .BYTE "A",17H .BYTE "D",01 .BYTE "C",13H .BYTE "B",1AH .BYTE "S",05 .BYTE "T",18H .BYTE "U",12H .BYTE "V",03H .BYTE "W",12H .BYTE "M",10H .BYTE "N",08H .BYTE "L",02H .BYTE "@",14H .BYTE "O",14H .BYTE "P",0FH .BYTE "Q",16H .BYTE "R",00 .BYTE "H",11H .BYTE 0,0 .END