[address omitted]
April 16, 1990
Dear George,
Here is the ml version of Tas>MS, as I talked about in my second letter past. I have gotten Bob Mitchell to test it out for me, and he says it “works very well and very fast.”
You will also find a pseudo-assembly listing of the two code routines. Since I don’t actually use an Assembler, I find it easier to do my “assembly” listings in something that comes a bit closer to BASIC than any typical assembler. It is easier for me to read, and hopefully easier for anyone else to understand as well.
As far as what this code does. It implements a few other suggestions I made to Bob concerning his original program.
The code has been designed to perform best with unjustified text. As such, it therefore only removes spaces which occur at the end of lines. This means that if the text includes any tables, it will not remove the formatting from between table entries. As with Bob’s original code, however, it does add a space at the end of every line if the text calls for it.
In addition, it automatically takes care of most paragraphs. If the paragraph is seperated by a blank line or is indented, it sees a line that begins with a space, which signals the code to put a CHR$ 13 in the file, which MScript uses to seperate paragraphs. The only place this will usually get you into trouble is where the entire paragraph is indented – a format used for quotations in formal papers – or in tables or listings. In the latter, some or all of the lines might not begin with a space, so you will need to add the ENTER manually.
I am not sure how fast the original Timachine compiled version of Tas>MS was, but I am sure this will be much faster. On the files I tested it on, it was too fast to time. Bob tells me it did a 18000 byte file – about the maximum size it can handle – in just over a second. Either way, if you blink, you will miss it. That, and you don’t have to have a copy of Timachine to compile it, are the main reasons I thought this was a good thing to write in ml.
The first routine in the listing has the sole purpose of clearing the area the Tasword file will occupy. Among other things, this allows the second routine to automatically find the end of the file, which it does in the first 7 lines of code. So to run it, all you need is the name of the Tasword file. Also, the code returns the length of the result directly, so there is no need to have a PEEK for this.
I have included some error checking in the BASIC to create the Tas>MS, so you don’t have to find out the hard way that one of the numbers is wrong.
I hope this program will be useful for the other members. I don’t have MScript, but I might write another version for my word processor. Either way, it is short and quick enough that anyone should be able to find space for it. Oh, don’t try to use it on the same file twice, the results might be a little strange. It SAVEs its files with the same “.CT” that Tasword uses, so make sure you know whether or not the file is actually a Tasword file if you might have changed it already.
Well, I guess that is all I have to say about it. I hope you had a pleasant Easter. Looks like I have certainly done my part to keep you busy this issue. Peace, and God bless.
Sincerely,
Steven V. Gunhouse
P.S., I will print the rest of this in 12 pitch, since I think that will look better for the newsletter.
Machine Code: (for unjustified text)
First Routine: clear buffer
FF00 21 00 6C :HL = 27648 (Start of Tasword memory area)
FF03 54 :D = H
FF04 5D :E = L
FF05 13 :DE = DE+1
FF06 36 20 :POKE HL,32 (CODE " ")
FF08 01 00 4B :BC = 19200
FF0B ED B0 :Block Move
FF0D C9 :RETURN (to BASIC)
Second Routine: Reformat file
FF14 21 FF B6 :HL = 46847
FF17 3E 20 :A = 32 (CODE " ")
FF19 2B :HL = HL-1
FF1A BE :IF A = PEEK HL (A is CODE " " throughout)
FF1B 28 FC :THEN GOTO FF19
FF1D 23 :HL = HL+1
FF1E 22 56 FF :POKE 65366,HL
FF21 21 00 6C :HL = 27648 (Start of Tasword text file)
FF24 11 4F B7 :DE = 46927 (Start of MScript memory area)
FF27 06 00 :B = 0
FF29 0E 40 :C = 64
FF2B BE :IF A <> PEEK HL
FF2C 20 06 :THEN GOTO FF34
FF2E EB :Exchange DE and HL
FF2F 2B :HL = HL-1
FF30 36 0D :POKE HL,13
FF32 23 :HL = HL+1
FF33 EB :Exchange DE and HL
FF34 ED B0 :Block Move
FF36 EB :Exchange DE and HL
FF37 2B :HL = HL-1
FF38 BE :IF A =PEEK HL
FF39 28 FC :THEN GOTO FF37
FF3B 23 :HL = HL+1
FF3C 77 :POKE HL,A
FF3D 23 :HL = HL+1
FF3E E5 :PUSH HL
FF3F 2A 56 FF :HL = PEEK 65366
FF42 A7 :A = A AND A (Clear carry)
FF43 ED 52 :HL = HL-DE
FF45 E1 :POP HL
FF46 EB :Exchange DE and HL
FF47 30 E0 :IF DE <= End THEN GOTO FF29
FF49 EB :Exchange DE and HL
FF4A 11 4F B7 :DE = 46927
FF4D 36 00 :POKE HL,0
FF4F 23 :HL = HL+1
FF50 A7 :A = A AND A (Clear carry)
FF51 ED 52 :HL = HL-DE
FF53 44 :B = H
FF54 4D :C = L
FF55 C9 :RETURN (to BASIC)
ML loader program:
10 LET t=0
100 FOR i=1 TO 86
110 READ a
120 POKE 65279+i,a
130 LET t=t+i*a
140 NEXT i
150 IF t<>428022 THEN BEEP 1,1: PRINT "Error in DATA!": STOP
200 RANDOMIZE USR 100: SAVE "Tas>MS.Cm" CODE65280,86
500 DATA 33,0,108,84,93,19,54,32,1,0
510 DATA 75,237,176,201,0,0,0,0,0,0
520 DATA 33,255,182,62,32,43,190,40,252,35
530 DATA 34,86,255,33,0,108,17,79,183,6
540 DATA 0,14,64,190,32,6,235,43,54,13
550 DATA 35,235,237,176,235,43,190,40,252,35
560 DATA 119,35,229,42,86,255,167,237,82,225
570 DATA 235,48,224,235,17,79,183,54,0,35
580 DATA 167,237,82,68,77,201
BASIC program to control ml
100 RANDOMIZE USR 65280
110 RANDOMIZE USR 100: CAT ".CT",
200 INPUT "File Name? ";LINE n$
210 IF n$="" OR LEN n$>6 THEN GOTO 200
220 RANDOMIZE USR 100: LOAD n$+".CT"CODE 27648
250 LET len=USR 65300
260 INPUT "SAVE file as: ";LINE s$
270 IF s$="" THEN LET s$=n$
280 IF LEN s$>6 THEN GOTO 260
290 RANDOMIZE USR 100: SAVE s$+".CT"CODE 46927,len
300 PRINT #1;"LOAD another file? (Y/N)"
310 PAUSE 0: LET s$=INKEY$: IF s$="Y" OR s$="y" THEN GOTO 100
320 IF s$="N" OR s$="n" THEN STOP
330 GOTO 310
9800 RANDOMIZE USR 100: LOAD "Tas>MS.Cm"CODE
9810 GOTO 100
9900 RANDOMIZE USR 100: SAVE "Tas>MS.Bm"LINE 9800
9910 RANDOMIZE USR 100: SAVE "Tas>MS.Cm"CODE 65280,86
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.