TRA1 and TRA2

Developer(s): Jan Bredenbeek
Date: 1986
Type: Diskette
Platform(s): QL
Tags: RS232

These two programs build tables for the QDOS TRA command. TRA1_bas asks for character codes and up to three replacement codes each and builds a translation table for the RS-232 ports, for printers that need different codes; TRA2_bas builds a table that redefines the system error reports.

The REMs credit Jan Bredenbeek of Hilversum and date the programs 13 April and 7 March 1986. The article “TRA_BAS 1.2 RS-232 Translation” describes an enhanced version of TRA1_bas.

Program Analysis

Both reserve 1 KB with RESPR and start the table with the word $4AFB that TRA checks for; TRA1_bas fills a 256-byte one-to-one table before applying your replacements.

It came from a QL owner’s floppy copies of QUANTA and IQLUG library material, imaged double-stepped so that only half of each disk survived; this file read back complete. The download holds the files exactly as recovered and a QL5A floppy image, TRA1 and TRA2.img, with the same files and their QDOS headers. Mount the image as FLP1_ (drop it on the QLRun page, or use it as a floppy image in sQLux, QPC2 or Q-emuLator) and type lrun flp1_TRA1_bas. In the image copies only, mdv1_tra_list reads flp1_tra_list so the program finds its files on the floppy.

Tested in QLRun with the JS ROM as far as its first prompt.

Related Articles

TRA_BAS 1.2 is an enhancement of Jan Bredenbeek’s TRA1_bas program (October 1986 QUANTA) and my subsequent TRA_BAS 1.1 (QUANTUM LEVELS).

Source Code

100 REMark TRA-command for RS232-translations
110 REMark Jan Bredenbeek, Hilversum
120 REMark 1986 April 13
130 :
140 DIM v(3)
150 start=RESPR(1024)
160 POKE_W start,19195: REMark $4AFB
170 table_a=start+6: table_b=start+262
180 POKE_W start+2,table_a-start: POKE_W start+4,table_b-start
190 FOR i=0 TO 255:POKE table_a+i,i
200 pointer=table_b+1
210 ncodes=0
220 CLS
230 REPeat loop
240   INPUT "Code ? (ENTER to stop)"!a$
250   IF a$="" THEN EXIT loop
260   REPeat loop1
270     INPUT "Number of repace codes (1-3) ?"!n
280     IF n>0 AND n<4 THEN EXIT loop1
290   END REPeat loop1
300   FOR i=1 TO n
310     INPUT "replacecode"!(i);"?:"!v(i)
320   END FOR i
330   IF n=1 THEN 
340     POKE table_a+a$,v(1)
350   ELSE 
360     POKE table_a+a$,0
370     POKE pointer,a$
380     FOR i=1 TO n:POKE pointer+i,v(i)
390     ncodes=ncodes+1
400     pointer=pointer+4
410   END IF 
420 END REPeat loop
430 POKE table_b,ncodes
440 TRA start,0
450 SBYTES mdv1_tra_list,start,pointer-start
460 PRINT "You may reload your codes with:"
470 PRINT "a=RESPR(";pointer-start;")"
480 PRINT "LBYTES mdv1_tra_list,a"
490 PRINT "TRA a"
500 REMark *** end of listing TRA1_bas ***

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.