Tape Level

Disassembler, Pilot, roster, dropout, memory loader, memory sort, inventory control, graph, land surveying, mixed monthly sales report, shopping list, diet planning 3, loan progress chart, hex-decimal conversion.

Also Star Trek 4, states and capitals, battleships 2, spelling practice 2, number guessing, hangman 2, snark.slot machine, cipher, target, surround, adder, termites, lunar lander, multiplication exercise, five-in-a-row, Bastem, and write. A number after a program indicates there are other similar People's Software programs. Pilot is the same as the disk pilot on tape 5, except runs on 16K tape systems.

-CA Residents Add 6 per cent TAX ($8.45, $16.40 & 24.88). Quoted Prices INCLUDE $.50 Shipping-

Gerry Sturgeon

Indianapolis, IN

Passing Variables

Save your variables while swapping from one program to another...

Since getting my disk system about a year ago, I have been perplexed by one of Disk Basic's short comings. Actually this short coming is shared with Level II and other versions of Microsoft Basic. While Microsoft has allowed for program chaining (even in Level II), they did not allow for the passing of variables between programs. Of course you can save the variables on a disk or tape file, but this takes up precious space on your disk and is intolerably slow on tape.

Fortunately there is an alternative. During a phone conversation with Jim Crocker (Technical Editor, 80-US), Jim gave me a few "pointers". I worked with them for awhile, and here is what I came up with.

A quick look at a Level II memory map will reveal an area of RAM between 4080H (16512D) and 41 E6H (16870D) that is labeled "reserved". This same area in Disk Basic is labeled "Basic Vectors". It is here that we find the solution to our problem.

Starting at about 40A0H (who said this is an exact science) there are a number of pointers which establish boundaries within RAM. The three pointers we are concerned with are at

40F9H, 40FBH, and 40FDH (16633D, 16635D, and 1 6637D). These pointers point to the beginning of simple variables, beginning of array variables, and beginning of free memory respectively. Of course, as is usual with the Z-80, the locations pointed to are stored with the least significant byte first and the most significant byte second, so that the location 6A26H is stored as 266A.

Now, let's see how this thing works. If we look at these pointers with T-Bug or De-Bug just after power up, and before running a program (Figure 1), we see that these pointers all contain the same numbers. However, if we look again after running a program (Figure 2), we see that this has all changed. They all three point to different locations: The current locations of the variables and beginning of free memory. If we now run a different program and check the pointers, we will see that they have changed again. Any variable that was defined in the first program has now been lost.

Herein lies the remedy to our problem. If we could just keep the pointers from being changed, we

20 POKE C &H40F9), < &H00): POKE < &H40Fft), C &H70 >

30 POKE<&H40FB>, C&H00) : POKEC &H40FC), ( &H70)

40 POKE C &H40FD ) , < &H00) 5 POKE (&H40FE), C &-H70)

0 0

Post a comment