.TITLE TRNSLT - Translate one word into another. .VERSION 20 .ENABLE 7BIT / ++ / TRNSLT Y2.0 / / (c) 1989 by Johnny Billquist / / History: / / 89/01/04 16:00 BQT X1.0. Split from STRLIB. / 89/12/27 05:00 BQT Y2.0. Made from PRSIB. / / -- .FSECT TRNSLT / / TRNSLT translates one word into another according to a translation table. / 0 /For return address. CIA /Make compare out of word. DCA CHR$ /Save compare. TAD I TRNSLT /Get arg1. ISZ TRNSLT DCA TBL$ /Save as table pointer. RDF /Get return field. TAD (CDF CIF) DCA R$ TAD I TBL$ /Get # of entries in table. ISZ TBL$ /Bump pointer. CIA /Make count out of it. DCA LC$ /Save count. 1$: TAD I TBL$ /Get entry. ISZ TBL$ /Bump pointer. TAD CHR$ /Compare. SNA CLA /Equals? JMP F$ /Yes. ISZ TBL$ /No. Bump pointer. ISZ LC$ /Bump count. JMP 1$ /Repeat. JMP R$ /Not found. Return. F$: TAD I TBL$ /Found. Get associated word. ISZ TRNSLT /Bump return. R$: HLT /Return field. JMP I TRNSLT /Return. CHR$: 0 /Comparator. TBL$: 0 /Table pointer. LC$: 0 /Loop count. / $