LEX 'HEXLEX7' * Michael Markov 86/07/07 ID 94 * Based on DESALS -- JPC25 by M. Martinet MSG 0 HEXLEXT ver. <86/08/20> POLL 0 ENTRY ESC CHAR 15 ENTRY HXTA CHAR 15 ENTRY HEX CHAR 15 ENTRY INH CHAR 15 KEY 'ESC$' Syntax: ESC$(A$) ==> CHR$(27)&A$[1,1]&CHR$(27)&A$[2,2]&.... TOKEN 198 KEY 'HEXTOA$' Syntax: HEXTOA$("414243....") ==> "ABC..." TOKEN 199 KEY 'HEX$' Syntax: HEX$("ABC...") ==> "414243.." TOKEN 200 KEY 'INHEX$' Syntax: INHEX$("ABC...") ==> " 41 42 43 .. .." TOKEN 201 (with protected spaces 1B3C201B3E hex) ENDTXT *************************************** * * ESC$ provides a short-hand for writing CHR$(27)&"T". Instead, * use ESC$("T"). This function is especially useful with video * interfaces, since most escape sequences consist of a single * character parameter. Thus ESC$("ACACAC...") will move the cursor * three spaces to the right & three spaces up. * This is most convenient for inserting or deleting lines, backspacing, * scrolling up or down. * Proposed enhancement: ESC$(A$[,N]), where the optional numeric * parameter would provide the equivalent of RPT$(ESC$(A$),N). (Future) * HEXTOA$ and HEX$ provide handy ASCII <==> hexadecimal conversions * WITHOUT reversing the order of the nibbles, unlike other similar * functions such as ATH$ and HTA$. This has many advantages when * converting mass storage pointers to decimal, since it lets you use * HTD and DTH$. This is far faster than any equivalent BASIC routine. * Among other applications, it should allow translation of BAR75, * an HP-75 program for printing HP-41 barcode. * * INHEX$ is intended for use with a full-screen editor. It greatly * speeds up any program that implements byte level editing with * protected field separators, for those of us who invariably make * mistakes keying-in LEX files from LHEX listings... * CAUTION: Because INHEX$ imbeds a vast quantity of display control * codes into its output, WIDTH should be set to INF. WIDTH, WINDOW, * SCROLL and final cursor position interact to produce some strange * results. * *********************************************** * * EQUate Table * REV$ EQU #1B38E REVPOP EQU #0BD31 POP1S EQU #0BD38 MEMERR EQU #0944D D=AVMS EQU #1A460 ARGERR EQU #0BF19 HEXASC EQU #17148 FNRTN4 EQU #0F238 DRANGE EQU #1B076 RANGE EQU #1B07C CONVUC EQU #152AA EXPR EQU #0F23C NIBHEX 411 HXTA GOSBVL POP1S C=A A ST=C ?ST#0 1 GOYES Argerr CD0EX RSTK=C CD1EX C=C+A A D0=C D1=C C=0 M C=A A CSRB CSRB D=C A C=C+C A CSL W CSL W C=C-1 P R1=C LOOP D=D-1 A GOC HXTAEND D0=D0- 4 A=DAT0 4 P= 1 GOSUB CONVAH ASL B * this reverses BSR B * the order of the A=A!B B * nibbles in each byte D1=D1- 2 DAT1=A B GONC LOOP HXTAEND C=RSTK D0=C D1=D1- 16 C=R1 GOVLNG FNRTN4 Argerr GOVLNG ARGERR CONVAH C=P 15 P= 0 LOOP1 GOSBVL DRANGE GONC CVH10 GOSBVL CONVUC LCASC 'FA' GOSBVL RANGE GOC Argerr LC(1) 9 A=A+C P CVH10 BSL W B=A P ASR W ASR W C=C-1 S GONC LOOP1 A=B W RTNCC NIBHEX 411 HEX GOSBVL POP1S CD0EX RSTK=C CD1EX D1=C D0=C GOSBVL D=AVMS D1=D1- 16 CD1EX C=C-A A ?C