Bob’s Notebook: Renumber to 10000+, TASWORD utils

Authors

Publication

Pub Details

Date

Pages

See all articles from Sinc-Link v7 n1

Let’s get back to some programming for a change. I have two interesting utilities from my notebook.

RENUMBER TO 10000+

When you are faced with using the MERGE command to join one of your utilities with another program, the first problem is whether there will be a clash of line numbers. Keeping your utilities (the ones written in BASIC) above line 9000 or so is helpful but there is no guarantee that some programs have not gone into this area. What to do? First, if the utility can be written in machine code or compiled via Timachine, that is an obvious out. But if BASIC is the only way, then here is the solution.

Renumber the utility starting at line 10000. Right, that’s what I saidı ten thousand! Then there will be no danger of a line number conflict of interest. Type in the program below and SAVE it.

 1000 REM Renumber to 10000 plus
1005 REM Bob Mitchell 1988
1010 REM Do not leave out lines 1000 and 1005. Change them is OK
1015 CLS : PRINT "This utility allows renumbering to lines higher than the usual 9799. "i'"The current start line is set at 10000. Line numbers increment by five."
1020 PRINT •"To set a different start line use GO TO 10040 now. Now, MERGE the program to be renumbered."
1025 PRINT '"DELETE the lines of this utility by using DELETE 10000, 10095."
1030 PRINT '"Change all GO TOs etc manually calculating them carefully in respect to the new start line. "''"When ready, use RANDOMIZE USR 32000 to renumber."
1035 STOP
1040 INPUT "Start line # ? ",line
1045 LET line=line-5
1050 RANDOMIZE line
1055 LET hi=PEEK 23671: LET lo=PEEK 23670: POKE 32004,10: POKE 32005, hi
1060 STOP
1065 RESTORE 1070: FOR İ=32000 TO 32030: READ a: POKE i,a: NEXT i: GO TO 1015
1070 DATA 42,83,92,17,11,39,237,75
1075 DATA 75,92,167,237,66,200,9,6
1080 DATA 5,19,16,253,114,35,115,35
1085 DATA 78,35,70,9,35,24,231,0
1090 SAVE "re#10+" LINE 1065
1095 STOP

Try this program on itself. GO TO 1065 then RANDOMIZE USR 32000 and LIST. All the line numbers now start with a colon ‹:> which is the next character after ‹9> in the TS2068 character set. Thus it represents ‹10›, If you choose 11000 as the start line, the first “digit” in the line numbers would be a semicolon (;) and so on.

Now MERGE this program with your favourite short utility. Change all your GO TO and GO SUB numbers to the line numbers they will represent after the renumbering is done, noting that the line numbers increment by five (5) only, I have deliberately chosen a renumber routine that does NOT renumber GO TOs and GO SUBs because those that do will not handle line numbers over 9999. Once the renumbering is done, it is impossible to edit the lines, hence the need to change these GO TOs etc manually. DELETE my utility as indicated in line 1025 above. Then, use ‹RANDOMIZE USR 32000> now to renumber your utility and SAVE it.

TASORT – A TASWORD UTILITY TO SORT LISTS

As the title infers, this utility will sort Tasword lists of up to 240 lines or 15360 bytes. Each record in the list must be only one line long, but with 64 characters per line there is room for a lot of material in any list (eg, birthdays and anniversaries, long play records, telephone numbers, things to do, diaries, program descriptions on disk or tape).

You may sort all or part of a list, or just the list in a longer Tasword file. When your list is saved in the usual Tasword manner, ensure you have noted the file text length (variable ‹a› gives this), list’s start and end line numbers and the column number to sort on. The program prompts will walk you through the operation and when finished, the program along with its newly sorted list will have been saved ready for loading into Tasword. Respond to all ‹scroll ?> prompts with a ‹y>.

The program is set up for compiling via Timachine and there is a short loader/manager program to go with it. Type in the two listings, compile the main program and save it in the usual way and save the loader. The utility is then ready for use.

Try it on your favourite Tasword list, bearing in mind the limitations explained above. It should only take a few short minutes to get the job done.

One thing more: the display of the lines in the list uses Tasword’s companion piece, Taswide, to present it in a 64 col format. II you do not have Taswide, change line 230 to read:

CLS: FOR i=n TO e: PRINT d$(i): NEXT 1 and remove RANDOMIZE USR 100: LOAD “taswi. Cx”CODE> from line 8 of listing 2.

Listing 1. Tasort

   40 REM !USR 28000
50 REM ! LPRINT
60 REM ! LIST
70 REM ! LEN h$<=64
80 REM !INT +oa,ob,sf,a,b,c,e,s,n,i,j,t
90 REM ! OPEN #
100 CLS
110 LET oa=SGN PI: LET ob=2: LET sf=64: LET a=47615: DIM d$(240,64)
120 INPUT "length of text? <=15360"'b: IF b>15360 THEN GO TO 120
130 LET c=INT (b/sf)
150 INPUT "start line? ";s
152 INPUT "end line? (0=last)";e
153 IF e=NOT PI THEN LET e=c
154 LET e1=a+((e-1)*sf)
157 CLS : PRINT "loading text from"'"line ";s;" to line ";e:"..."
160 LET n=g
170 FOR i=a+((s-1)*sf) TO el STEP sf
180 FOR j=NOT PI TO 63
190 LET d$(s,j+oa)=CHR$ PEEK (i+j)
200 NEXT j
210 LET s=g+oa: IF s>e THEN GO TO 230
220 NEXT i: STOP
230 CLS : RANDOMIZE USR 64300:FOR i=n TO e: PRINT CHR$3;d$(1), NEXT i
240 BEEP oa,10: INPUT "1=sort 0=save? ";ss: IF NOT ss THEN GO TO 440
255 INPUT "sort on which col.? (1-63) ";t
260 CLS : PRINT "sorting on col. ";t: GO SUB 300: GO TO 230
290 REM shell-faulk sort
300 LET sn=e
310 LET sn=INT (sn/ob)
320 IF sn<oa THEN CLS : RETURN
330 IF sn/ob=INT (sn/ob) THEN LET sn=sn+oa
340 FOR i=n TO e-sn
350 LET mm=i
360 IF d$(mm,t TO )<=d$(mm+sn,t TO ) THEN GO TO 420
370 LET h$=d$(mm)
380 LET d$(mm)=d$(mm+sn)
390 LET d$(mm+sn)=h$
400 LET mm=mm-sn
410 IF mm>0 THEN GO TO 360
420 NEXT i
430 GO TO 310
440 CLS : PRINT "storing sorted file for SAVE...": LET s=n: FOR i=a+((s-oa)*sf) TO el STEP sf
450 FOR j=NOT PI TO 63
460 POKE (i+j),CODE d$(s,j+oa)
470 NEXT j
480 LET s=s+oa: IF s>e THEN GO TO 492
490 NEXT i
492 STOP
495 REM ! CLOSE #
550 CLEAR : SAVE "tasort" LINE 100

Listing 2. The loader

   5 CLS : PRINT INVERSE 1; "TASWORD SORT"; INVERSE 0; " by Bob Mitchell. "''"This utility will sort Tasword lists of up to 240 lines (15360 bytes)."
6 PRINT •"Have the following parameters ready from SAVED list, "''"1. text length"''"2. start line number"''"3. end line number if not last"''"4. column # to sort on (1-63)."
7 PRINT '"Install disk containing list to be sorted, then, press a key.", PAUSE 0
8 LOAD "taswide"CODE : LOAD "tasort."CODE 28000
10 INPUT " TASWORD SORT "'"list name? max 6 "; LINE n$: LOAD n$ CODE 47615
20 ON ERR GO TO 25: RANDOMIZE USR 28000: GO TO 30
25 ON ERR RESET: POKE 23607,60: GO TO 55
30 LET b=PEEK 30078+256*PEEK 30079: REM see note 1.
40 INPUT "list name? max 6 ", LINE n$: SAVE n$ CODE 47615,b
50 CLS : PRINT "Sorted file has been saved and is ready for loading into Tasword"
55 INPUT "1=more 0=quit ";m
56 IF m THEN GO TO 5
57 IF NOT m THEN STOP
60 CLEAR : SAVE "tasort" LINE 5

NOTE 1. Line 30. This gets the value of ‹b> in the compiled program. The PEEK addresses may on your compilation list of variables. NOTE 2. The listings above have been entered into Tasword using the Sequential File routine in the Larken Version 3 LKDOS EPROM. This was covered in my article in the Sep-Oct issue of Sinc-Link page 10.

Products

 

Media

 

Image Gallery

Source Code

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

Scroll to Top