Mini Memory module is a plug in module containing a battery and battery sustained ram. The memory can be used for a variety of purposes including program storage and permits the creation of assembly routines using the simple line-by-line assembler supplied on cassette with the module. Additional CALLs are added to BASIC including access to VDP RAM.
The mini memory module carries out a number of functions, but only one at a time:
You may use it for ONE of:
The module itself can be used in a TI BASIC program as though it was a single disk file called "MINIMEM", and all the file handling commands available with disk drives will work with the module. It has a battery backup, and the information you store in the module will therefore remain after you switch your console off.
The module permits you to use the 32k Expansion Memory as a second 'solid state disk drive' called "EXPMEM2", which may store up to 24k of data. This data is lost when the 32k expansion is switched off.
Using either the module or the 32k expansion as data files, the information is retrieved even more quickly than with a disk drive. The computer does not have to waste time in moving a disk drive head over the disk.
It is possible to store data in the module or expansion memory with one program, and then to access the data with a second program, provided you do not reset the system by using QUIT or removing the module or power supply. This may help you to run a long adventure program for instance, by first placing the text into the memory and then loading your control program.
If you use the module as a data file, the contents can be saved to tape: thus you may store adventure text into the module with a BASIC program, and then copy the data onto tape easily using the 'S' option from the 'Easybug' selection from the main menu. Data is reloaded with the 'L' option.
When you OPEN a file to save data to mini memory the default settings are:
SEQUENTIAL, DISPLAY, VARIABLE 80.
Minimemory enables you to use MINIMEM and EXPMEM2 as files for data - and if you FIRST open a file to MINIMEM, than you are allowed to use EXPMEM1 as a datafile.
However, you can if you choose use EXPMEM1 without having to use MINIMEM, by tricking the console:
100 CALL PEEK(28672,S1,S2) 110 CALL LOAD(28672,90,l65) 120 OPEN #1:"EXPMEM1",OUTPUT INTERNAL, FIXED 60 130 CALL LOAD(28672,S1,S2)
A false value is placed into 28672, the file opened, and 28672 then restored.
If you have problems opening APPEND files just try dropping the file definitions and open as
OPEN # 1:" MINIMEM", APPEND
This can be used with files opened previously as OPEN #1 :" MINIMEM", OUTPUT etc.
The default values apply -e. g. SEQUENTIAL, DISPLAY, VARIABLE 80.
APPEND can ONLY be used with VARIABLE records, but you can specify a different length e. g. VARIABLE 100 etc.
N. B. This length is the MAXIMUM length of the VARIABLE file.
DISPLAY is OK if you are only putting single values into each record, but becomes obscure for multi-value records. You may prefer to specify INTERNAL for these.
Because APPEND can only be used with VARIABLE records, you are also stuck with SEQUENTIAL records - you cannot specify a RELATIVE file.
So OPEN # 1:" MINIMEM", SEQUENTIAL, INTERNAL, VARIABLE 100, APPEND
is OK. (The restrictions on the use of APPEND appear in the Extended Basic Manual, which also indicates the default values - MINIMEM appears to be treated in the same way as a disk drive).
Sample BASIC program storing DATA to Mini Memory
100 CALL INIT 110 OPEN #1:" MINIMEM", OUTPUT, VARIABLE 120 PRINT #1: AAA 130 CLOSE #1 140 OPEN #1: "MlNIMEM", APPEND 150 PRINT #1: 1234 160 CLOSE #1 170 OPEN #1:" MINIMEM", INPUT 180 INPUT #1: A 190 INPUT #1: B 200 PRINT A, B 210 CLOSE #1 220 END
Storing a screen dump to Mini Memory
See Mini Memory Screen Dump to Module A routine with explanation on reading the screen and dumping the screen to mini memory by placing it directly into memory locations in the module; and a routine to read the dumpred screen from the module and place it on screen.
A small program (up to 4k) may be stored in the module using SAVE MINIMEM and recovered using OLD MINIMEM. The program is loaded almost instantly.
Assembly Language access
With the module a cassette is supplied with a 'line by line assembler' which provides a primitive and difficult to use method of writing your own machine code programs.
You will need to purchase the Editor/Assembler manual for information on the 99/4A Assembly language, and should be aware that the manual is not written for the novice.
The LBLA itself occupies the module, and the maximum machine code program you may write with it is therefore about 750 bytes. A few machine code games are now appearing on cassette which can be loaded into the module.
The mini memory provides a low cost entry into the field of machine code programming.
Machine code is a 'low level' language, which is not as easy to use as BASIC. Because the computer does not have to translate the commands, a machine code program may be as much as 1600 times faster than a TI Basic program.
If you wish to convert an integer number to floating point, you will use CIF. The minimemory manual seems to have been cut and pasted from the Editor Assembler manual here, and you need to note the following correction:
is the correct address - the manual suggests 23 in error.
EXTENSIONS TO TI BASIC
The mini memory adds some commands for use in your TI BASIC programs, allowing you to PEEK and POKE both CPU and VDP memory, and to obtain the hexadecimal string defining any character:
See also the article Using VDP with BASIC
is used to obtain the defining string for a character, which you may then manipulate with SEG$ and redefine with CALL CHAR.
e.g.CALL HCHAR(1,1,94,760) CALL CHARPAT(94,A$) A$=SEG$(A$,1,14)&"FF"
permits a TI BASIC program to use a machine code utility or program stored in the Mini Memory with CALL LOAD.
PEEK and POKE
are used in many computers to look at and change the contents of one single memory location in the computer. The 99/4A console has 16k of user memory (RAM) known as VDP RAM, which is not directly addressable by the CPU (Central Processing Unit). The Mini Memory is the ONLY module available which allows you access to the VDP ram.
CALL PEEKV and CALL POKEV
are used, and samples may be seen in preceeding chapter on advanced programming. They may be used to look at your PROGRAM, or to manipulate the SCREEN DISPLAY or to otherwise play around with the VDP ram.
Also refer to article Sound with CALL LOAD for the details on the values which we are POKEing into VDP to replace the CALL SOUNDs.
Here is a way to have the computer play a piece of music whilst your basic program is getting on with something else- you don't have to insert lots of CALL SOUNDs.
You need to place the music score somewhere... and that somewhere is VDP RAM, which is where POKEV comes in. First we need to protect a part of VDP ram from your BASIC program and other inconveniences- that is, we partition memory.
Turn your console on and select TI BASIC. Now to reserve some VDP RAM to store the music in:
---- If you have a disk controller, you can use: ---- CALL FILES(1) ---- then NEW. ----then key the program in and RUN it.
OR - If you do not have a disk controller, you can still reserve memory. The CALL FILES reserves space at the top of VDP ram, and this is controlled by a couple of bytes in CPU RAM... we can use CALL LOAD to do the same thing...
Type in CALL LOAD(-31888,50,0)
then enter NEW. then key in the program and RUN it!
That NEW above is important. It tells the computer to remap VDP. This it does after reference to location -31888. Loading -31888 with 50 and 0 tells the computer the TI BASIC program can commence not at its normal 16383, but instead at 256*50+0= 12800.
This gives us about 3.5k for the music, far more than this program needs!
First the listing then an explanation. The CALL SOUND in line 100 is essential.
100 CALL SOUND(-2,30000,0) 110 CALL CLEAR 120 REM DURATION IN 1/60th 130 REM OF A SEC.1 SECOND=60 140 REM 1/2 BECOND=30 150 REM •••••••••••••••••••• 160 REM 170 REM BELOW LOADS SOUND TABLE 180 CALL POKEV(14096,3,142,15,144,30) 190 CALL POKEV(14101,3,133,13,144,60) 200 CALL POKEV(14106,3,128,15,146,30) 210 CALL POKEV(14111,3.142,15,144,15) 220 CALL POKEV(14116,3,141,17,145,15) 230 CALL POKEV(14121,3,142,15,146,30) 240 CALL POKEV(14126,3,129,20,146,30) 250 CALL POKEV(14131,3,141,17,144,15) 260 CALL POKEV(14136,3,129,20,146,15) 270 CALL POKEV(14141,3,131,21,146,30) 280 CALL POKEV(14146,3,140,23,146,30) 290 CALL POKEV114151,3,139,26,144,60) 300 CALL POKEV(14156,3,141,17,146,30) 310 CALL POKEV(14161,3,141,17,144,60) 320 CALL POKEV(14166,3,142,15,146,30) 330 CALL POKEV(14171,3,133,13,144,60) 340 CALL POKEV(14176,3,12B,15,146,30) 350 CALL POKEV(14181,3,142,15,144,15) 360 CALL POKEV(14186,3.141,17,145,15) 370 CALL POKEV(14191,3,142,15,146,30) 380 CALL POKEVI14196,3,129,20,146,30) 390 CALL POKEV(14201.3,141.17,144,15) 400 CALL POKEV(14206,3,129,20,145,15) 410 CALL POKEV(14211,3,131.21,146,30) 420 CALL POKEV(14216,3,140,23,146,30) 430 CALL POKEV(14221,3,129,20,144,60) 440 CALL POKEV(14226,3,134,00,159,30) 450 CALL LOAD(-31796,55,16) 460 CALL LOAD(-31794,1) 470 REM 480 REM 490 REM THIS LOOP WILL BE 500 REM PROCESSED WHILE THE 510 REM MUSIC PLAYs 520 REM = TWO PROGRAMS 530 REM SIMULTANEOUSLY! 540 REM —-------- 550 CALL CLEAR 560 PRINT " ]":" ]]":" ]]]":::: 570 CALL PEEKV(1152,A,B,C.D,E,F,G,H) 580 CALL POKEV(1232,A,B,C,D,E,F,G,H) 590 REM CHR$(58) DEF AS ZERO 600 REM 610 FOR T=1152 TO 1231 620 CALL PEEKV(T,A,B,C,D,E,F,G,H) 630 CALL POKEV(1512,A,B,C,D,E,F,G,H) 640 CALL PEEK(-31796,A,B) 650 IF A<55 THEN 690 660 IF B<150 THEN 670 ELSE 690 670 NEXT T 680 GOTO 610 690 REM 700 REM END OF LOOP 710 CALL SOUND(-20,30000,0) 720 REM 730 REM "READY FOR NEXT RUN" 740 REM WHEN SOUND TABLE DONE 750 J=J+1 760 IF J<40 THEN 750 770 J=0 780 CALL LOAD(-31796,55,16) 790 CALL LOAD(-31794,1) 800 GOTO 610
LINE 100 is required for the MINIMEM.
The music is loaded with POKEV into the reserved area. The first item of the POKEV is the address the first byte is going to be loaded at. The sound table has to be sequential.
Then load that and successive memory locations as follows:
- 1. Length of sound information, excluding duration, normally 3.
- 2 and 3. The tone generator data, exactly as in the previous direct sound program
- 4. Attenuation (or volume) value, again as in direct sound.
- 5. The time the note is to sound, in 60th's of a second.
Therefore the minimum note is 1/60th of a second!
Line 550 tells the computer where the SOUND TABLE can be found: 55*256+16 = 14096. (Check line 280) Line 580 is an instruction to the computer: START PLAYING
Then we go into a loop which demonstrates that the computer carries on playing without further instruction.
Problem: How do we know the music has ended? The computer only does as it is told, and will carry on through memory until you tall it to stop... corrupting the program as it goes along...
My first attempt at this was to wait til the end of the tune, BREAK and find out the values at -31796 and -31795. Then I test for those values, as above in line 640.
Line 710 restores sound to normal, and lines 750 to 770 put in a small delay before we start again by loading the start of the sound table and tell the computer to PLAY!
Another approach is to place a silent note (eg 30db attenuation) at the end of the sound table. Then test another location. The amendments required are:
545 CALL POKEV(-14231,3,159,191,223,0) 640 REM 650 CALL PEEK(-31747,A) 660 IF A=0 THEN 780 750 CALL LOAD(-31747,1) 760 REM 770 REM
An even more interesting approach is to tell the computer to "play it again" - by adding a "go back to beginning" instruction at the end of the sound table, in this case as the sound table begins at address 14096 (256*55 + 16) we need to put in a line:
445 CALL POKEV(14231,0,55,16)
And remove lines 640 to 660 completely. The music will stop with any CALL SOUND or other use of the sound chip.
TI Basic Animated Sprites
Please also refer to Sprites in Basic for explanation.
110 B$="000032FF7070301" 120 FOR T=96 TO 120 130 CALL CHAR(T,A$) 140 NEXT T 150 CALL CLEAR 160 CALL SCREEN(5) 170 CALL POKEV(768,38,154,192,15,91,122,193,15,140,84,194,15,208) 180 CALL POKEV(1920,0,20,0,20,0,20,0,20,0,20,0,20) 190 CALL LOAD(-31878,3) 200 FOR T=96 TO 98 210 CALL CHAR(T,B$) 220 NEXT T 230 FOR T=96 TO 98 240 CALL CHAR(T,A$) 250 NEXT T 260 GOTO 200 270 END
CALL LOAD and CALL PEEK
are used to access the CPU RAM, which comprises of the 4k mini memory, the 32k expansion memory, and the 255 bytes of CPU ram in the console. CALL PEEK can also be used to examine the contents of CPU ROM (READ ONLY MEMORY).
If you have a speech synthesiser try this line in a BASIC program with the Mini Memory module plugged in:
This also works with Extended Basic with Expansion Memory.
References: Editor Assembler Manual: pages 351. 355. 422 to 427 (Errata: The reference in para 1, page 355. should be to Section 22.1.4. not as printed in the manual).
The mini memory contains a battery with a stated life of two years, and will retain any data you load into it, even after the console is switched off and the module removed.
Data is destroyed if you: Insert or remove the module when the console is switched on. Use CALL INIT or the INITIALISE option. Use the module for something else.
Data in the module is also subject to corruption by static electricity, and you should not rely on it as a sole copy of your program or data. Always keep a tape backup.