Bob’s Notebook: Tasword to MScript converter

See all articles from Sinc-Link v8 n1
Author(s): Bob Mitchell
Publication: Sinc-Link
Pub Details: Sinc-Link v8 n1 (Volume 8, Issue 1)
Date: January/February 1990
Pages: 4-5

Many of us use our 2068’s for word processing with the main programs being Mscript and Tasword. Most of my earlier files were done on Tasword but I’ve switched to using Mscript for most of my word processing and I decided to convert some of my Tasword files to Mscript. In the former, each line is exactly 64 characters long and often contains many spaces which are time consuming to remove. The main task then was to cull out these extra spaces and the two programs below are intended to do just that and only that.

The first program listing is a loader/manager that runs in BASIC and controls the second listing which must be compiled via Timachine. The use of these two programs is a good example of how one can switch back and forth between BASIC and COMPILED CODE. If you haven’t done much of this, examine the notes alongside the listings to see how it is done.

Type in these two listings and compile the second one. Be sure to make a printout of the runtimes and variables when doing the Timachine compilation. If your compilation produces different addresses from those shown in the loader, make the necessary changes to the loader listing. (Lines 100, 200, 220, 305).

Now load the first one which will load your compiled code and you are ready to convert any of your Tasword files. You must know the length of any file you are going to convert; this is the value of variable <a> in the Tasword BASIC program.

The loader runs the code which then pops back to BASIC to get the name and length of the file you wish to load and loads it. It then pops back to the compiled code and does the workhorse job of taking out all the excess spaces. It even puts in a needed space at the end of any line that does not end with a space. Once again, the action pops back to BASIC to SAVE what you have done by any name you select. Listing 2 could be enhanced to do more than it does, such as taking out Tasword printer control characters but I decided to leave it as it is.

Now load in MSCRIPT and then the file you have just saved. You will have some editing to do which will include:

1) setting up the paragraphs;

2) adjusting some of the spacing which the code did not catch;

3) rearranging any tabular material in your original text; this is the most difficult type of text to adjust and it is best to have a printout of the Tasword version to help in inserting the line feeds and tab spacing to make the Mscript version look like the orginal.

4) removing all Tasword control characters; those little blurs of pixels;

5) entering Mscript control characters and commands.

But all this is relatively easy compared to trying to take out the extra spaces manually or typing the whole thing from scratch. Files with tabular material (tables, charts, etc) will contain a great many spaces and so the length of the Mscript file can be considerably less that the Tasword one. But even solid text will result in a saving of some bytes.

Why bother with all this? Well, first off, the printing of Mscript text is done much more professionally. Top and Bottom titles can be added to each page with pages numbered if you wish. Other bonuses include: line width can be set and changed at any point in the text and can be more than 64; printer control codes can be set more easily for a wide variety of printers; blocks of text may be printed or saved; finding and changing textual strings of characters is faster and more reliable than via Tasword.

LISTING 1

  10 REM tas>ms loader            :tasword to mscript.
100 RANDOMIZE USR 64745 :calls code at 1st entry point
200 LET addr=PEEK 65360+256*PEEK then back to BASIC to get addr value
65361 from the code.
210 INPUT "file name? (max6) "; :you input name of file to be converted
LINE n$: RANDOMIZE USR 100: LOA and then it is loaded.
D n$+".CT"CODE addr
220 RANDOMIZE USR 64846 :calls code at 2nd entry pt.
300 INPUT "file name for SAVE :code does its job and then switches to
(max6) "; LINE n$ BASIC to get the file name for SAVE.
305 LET len=PEEK 65356+256*PEEK :The length of code is found from
65357: LET len=len-46926 the Timachine variable (j).
310 RANDOMIZE USR 100:
SAVE n$+".CT"CODE 46927,len: STOP
9000 RANDOMIZE USR 100: :The converted text is saved.
SAVE "tas>ms.Bb" LINE 9900: STOP :SAVE the loader.
9900 RANDOMIZE USR 100:
LOAD "tas>ms.Cc"CODE :LOAD the code.
9910 GO TO 10 and start the operation.

LISTING 2

   1 REM ! LPRINT                 :Timachine Commands.
2 REM !INT +j,tl,add,i
3 REM ! LIST
4 REM ! OPEN # :first entry point.
5 LET j=46927 :initialize <j>
6 INPUT "tas len? ";tl :get tasword file length.
7 INPUT "load tas file to addr? :get address where tasword file will be
(>27500) ";add loaded. addr+tl must be <46927
8 STOP :switches back to BASIC.
9 REM ! OPEN # :second entry point.
10 FOR i=0 TO tl :loops through from zero to end of text
15 IF PEEK (i+add)=32 AND PEEK and removes extra spaces.
(i+add+1)=32 THEN GO TO 30
18 IF i/64=INT (i/64) AND PEEK :if last character on line is not
(i+add)<>32 THEN POKE j,32: LET a space, put one in.
j=j+1
20 POKE j,PEEK (i+add): LET :pokes text into Mscript text area.
j=j+1
30 NEXT i
40 REM ! CLOSE # :switch back to BASIC to SAVE converted
file.

BOB MITCHELL [address omitted]

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