Trailing-Edge
-
PDP-10 Archives
-
decuslib10-05
-
43,50337/23/arrtxt.mac
There is 1 other file named arrtxt.mac in the archive. Click here to see a list.
00100 COMMENT * SIMULA specification;
00200 OPTIONS(/EXTERN:QUICK,arrtxt);
00300 PROCEDURE arrtxt(ta,t,c); TEXT ARRAY ta;
00400 TEXT t; CHARACTER c;;
00500
00600 !*;! MACRO-10 code !*;!
00700
00800 TITLE arrtxt
00900 ;!
01000 ;! if TA[1:4] has the elements "ABC" , "X" , "123456"
01100 ;! and "SLUT" then the call
01200 ;! arrtxt(ta,t,',')
01300 ;! should give t = "ABC,X,123456,SLUT," as result
01400 ;! it is assumed that t points to a string long enough
01500 ;! to hold this result (ARRLGD can be used to get
01600 ;! the length required e.g. t:-blanks(arrlgd(ta));!
01700 ;! can be computed prior to calling ARRTXT).
01800 sall
01900 search macsim
02000 quickproc
02100 entry arrtxt
02200 specify<
02300 proc .arrtxt,<ta,t,c>
02400 array ta
02500 text t
02600 character c
02700 >
02800 cnt=13
02900 dest=14
03000 elm=16
03100 ;! --------- start of program code -------
03200 byte: oct 440700000002
03300 oct 350700000002
03400 oct 260700000002
03500 oct 170700000002
03600 oct 100700000002
03700 arrtxt: MOVE dest,byte ;! set up length in byte pointers
03800 MOVE X0,c ;! get delimiter character
03900 HLRZ 6,t
04000 HRRZ 8,t ;! start position
04100 IDIVI 6,5
04200 ADD 8,6 ;! word where text starts
04300 MOVE dest,byte(7) ;! set up byte pointer to result
04400 ADDM 8,dest
04500 MOVE cnt,5(ta) ;! length of array
04600 SUB cnt,4(ta)
04700 nexte: HLRZ 6,6(ta) ;! get next element
04800 HRRZ 8,6(ta)
04900 IDIVI 6,5
05000 ADD 8,6
05100 MOVE elm,byte(7) ;! byte pointer to element
05200 ADDM 8,elm
05300 HLRZ 9,7(ta) ;! length of text element
05400 JUMPE 9,fin ;! test if notext
05500 nextc: ILDB 6,elm ;! move characters
05600 IDPB 6,dest
05700 SOJG 9,nextc ;! test if end of text
05800 fin: IDPB X0,dest
05900 ADDI ta,2 ;! forward in vector
06000 SOJGE cnt,nexte
06100 RETURN
06200 LIT
06300 END;