More Notes on VU-Calc

See all articles from T-S Horizons n16
Author(s): Charles Peterson
Publication: T-S Horizons
Pub Details: T-S Horizons n16 (Issue 16)
Date: November 1984
Pages: 18-19

James W. Holder wrote how to program an 80-column print-out from Vucalc in Issue 15. Being able to do so is a big step forward in putting Vucalc to practical use. I shelved my copy of the program for a while for two additional reasons. 1) The keyboard response is slow. 2) Once you have entered data into the array, B$, you cannot add, delete, or edit BASIC lines. If you do, the program will crash when you CONTINUE.

Recently I discovered two modifications which overcome these problems. One changes the timing of delay loops. The other reinitializes Vucalc’s machine code every time you re-enter the program through the “C” (CONTINUE) option. Thus, you can add, delete, and edit BASIC lines whenever you want and still CONTINUE with the program. These improvements can be added to a copy of Vucalc which already has titles and formulas in it.

First, speed up the keyboard response by changing the value of the main timing loop. You will also have to slow down the cursor. Load the program and STOP it. Type in the following commands and press ENTER after each.

COMMAND           DESCRIPTION       ORIGINAL VALUE
POKE 17459,100    MainTimingLoop          0
POKE 17592,25     Cursor delay           10
POKE 17600,25     Cursor delay           10

Check out the results with GOTO 110. Enter the “E” or “C” option. Add a title and notice how much faster the keys respond.

Next, add some machine code to allow editing. STOP the program again. Add a REM line to hold the machine code and a program for loading it.

  14 REM 1234567890123456789012345678901234
6000 DIM A$(4)
6010 FOR I=19656 TO 19689
6020 INPUT A$
6030 POKE F,VAL A$
6040 PRINT A$;
6050 NEXT F
6060 DIM A$(0)

Line 6060 is of special interest. It will clear the variable A$ from memory. All other variables will be left intact. The program stops with a 3/6060 report.

Before loading the machine code, make sure the REM line is long enough. The command, PRINT PEEK 19653, should print 36 on the screen. Start the loader with the command GOTO 6000. When the cursor (in quotes) appears, enter the following numbers one at a time. Go from left to right and top to bottom.

58  134 64  167 40  24  42  16
64 1 238 32 9 1 35 0
17 3 65 235 115 35 114 35
35 235 9 61 32 245 205 143
65 201

Those who have a hex loader can use the following:

4CC8   3A8640           LD A,(16518d)
4CCB A7 AND A
4CCC 2818 JRZ CALL
4CCE 2A1040 LD HL,(VARS)
4CD1 01EE20 LD BC,8430d
4CD4 09 ADD HL,BC
4CD5 012300 LD BC,35d
4CD8 110341 LD DE,16643d
4CDB EB POKE EX DE,HL
4CDC 73 LD(HL),E
4CDD 23 INC HL
4CDE 72 LD(HL),D
4CDF 23 INC HL
4CE0 23 INC HL
4CE1 EB EX DE,HL
4CE2 09 ADD HL,BC
4CE3 3D DEC A
4CE4 20F5 JRNZ POKE
4CE6 CD8F41 CALL CALL 16783d
4CE9 C9 RET

Once the machine code is loaded, edit line 2000 to read:

2000 LET Z=19656

Save the program at this point. Then restart Vucalc with GOTO 110 and type the “c” option to CONTINUE. If you have made a mistake, you will know it. The screen will be messed up. Unplug or reset to begin again. If all is well, you can now add and delete BASIC lines even when B$ has data in it.

Holder showed how to print out the whole grid, a page at a time. It is also possible to print out selected boxes. For those who like to custom tailor their program, here are some tips on printing out Vucalc data. All the information in Vucalc’s grid is stored in B$(2 to 8424).

       01               02                 03
A  B$(2 TO 9)     B$(236 TO 243)    B$(470 TO 477)
B  B$(11 TO 18)   B$(245 TO 252)    B$(479 TO 486)
C  B$(20 TO 27)   B$(254 TO 261)    B$(488 TO 495)

Adding the following routine will allow the computer to calculate the location of any box for you.

6000 PRINT "ENTER ROW/COLUMN:""B03"""
6010 INPUT A$
6020 LET Z=9*(CODE A$-38)+2
6030 LET Z=Z+234*(VAL A$(2 TO)-1)
6040 PRINT A$;TAB 5;"B$(";Z;" TO ";Z+7;")";
6050 PRINT TAB 23;B$(Z TO Z+7)
6060 GOTO 6010

Start the routine using GOTO 6000. When the cursor (in quotes) appears, enter the row and column number of a box containing information. Use the format: “D05”, “R27”, etc. The routine will print the location and contents of the box to the screen. To STOP this routine, press ENTER when the cursor asks for an input.

Finding and printing one box at a time is not very useful. Let’s assume you want to print boxes A01 through A03 and C01 through C03. The following lines will do it for you.

7000 FOR F=2 TO 20 STEP 18
7010 LET P$=""
7020 FOR G=F TO F+468 STEP 234
7030 LET P$=P$+B$(G TO G+7)+" "
7040 NEXT G
7050 PRINT P$
7060 PRINT
7070 NEXT F
7080 STOP

NOTE: Quotation marks in line 7030 contain one space; in line 7010 they contain no space.

Line 7000 determines whether row A or C is printed. Line 7020 determines whether column 1, 2, or 3 is printed. It’s a little tricky. It may be helpful to calculate by hand the value of G for each pass through the loops. Or, you could add the line:

7025 PRINT G

Use GOTO 7000 to start the routine. For hard copy, change the PRINT statements to LPRINT.

All of the above program lines will fit into a stock 16K Vucalc and you will have about 540 additional bytes of space for programming. If you eliminate lines 7000-7080, you will have about 690 bytes of space available for your own use. You could delete other program lines, particularly menu lines, and lines 6000 to 6060 as well. If you run out of memory, the program will not crash. You’ll get a ‘memory full’ (4/line #) report. Sometimes the line you want to add to the program will stay at the bottom of the screen and not be inserted in the listing.

There should be just enough space left for you to program that custom print-out you’ve always wanted.

Charles Peterson
Box 98, Alcester, SD 57001 TSH

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