MICRODRIVE WHITE LIGHTNING INTRODUCTION In order to make maximu use of the Spectrum's 48k of memory the tape based White Lightning was located at 24832 decimal. This leaves room for a small BASIC loader program. If, however, Interface 1 is fitted, the execution of any of the shadow ROM commands will cause BASIC to be relocated upwards and result in insufficient memory for the tape based loader program. It was therefore decided, on completion of the tape based program, to develop another version which would not only be microdrive compatible but would also utilise the drives to compile source code. Unfortunately, because of the way that the shadow ROM operates, the BASIC interface part of the software is no longer practical and therefore Microdrive White Lightning no longer has this feature. The editing buffers have now been moved up to occupy the old screens 6, 7 and 8, and an extra 1k of dictionary space is now available. Source code is now compiled directly from microdrives and so sprites can be stored from 53760 onwards. Microdrive screens 1 to 19 are utilised by the system but you can edit any of the screens 20 to 150. This means that Microdrive White Lightning can handle six times as much source code without any troublesome reloading from tape. IMPLEMENTING ON MICRODRIVE 1. Insert Tape 1 in your cassette and rewind to Side A. 2. Type LOAD "" and when "MWL" has loaded it will auto-run, format your microdrive and save the BASIC loader and the machine code. 3. To run the microdrive version just type LOAD *"M";1;"MWL" and it will load and execute. PREPARING A CARTRIDGE FOR SOURCE CODE Before using the microdrive version it is necessary to set up a separate cartridge for storing and loading source code. This version has been designed to work exclusively with microdrive number 1. To set up the cartridge, insert it in microdrive 1 and execute the following: FORMAT "M";1;"name": OPEN #4;"M";1;"a" FOR i=1 TO 100000: PRINT #4;CHR$ 32;: NEXT i Note the lower case "a" used in the filename. After several minutes, the error message "MICRODRIVE FULL" will be printed. You should now key in: CLOSE #4 to close the file. To check that you have a correctly prepared cartridge, type: CAT 1 "a" should be printed on the screen to indicate a single file called "a" and 0 to indicate zero bytes free. -- end of page 26 Please note that this cartridge shoule be clearly labelled and used exclusively for SAVEing and LOADing Forth source code while you are editing Forth screens. Sprites, BASIC and blocks of machine code should be SAVEd on a separate cartridge or cartridges. There are no commands within White Lightning to manipulate microdrives, therefore all such commands (eg. FORMAT, ERASE, OPEN#) are executed from BASIC after exiting via the PROG command. EDITING FORTH SCREENS Forth source code is still EDITed in exactly the same way as the tape version (using EDIT,P,S,D etc) except that EDIT will not automatically execute a FLUSH. This means that your EDITs will not be updated on microdrive until you type FLUSH, so be sure to remember to do this before moving on to another screen. THE EDIT BUFFERS To give some idea of how White Lightning uses the microdrive for Forth source, the following brief description may be helpful. There exists in RAM an area of 1024 bytes called the edit buffer, which can hold two 512 byte Forth screens. If you issue a command which requires the use of a screen (LIST, CLEAR or INDEX) then this screen will be read from the microdrive into the edit buffer. If the edit buffer already contains two screens and they have been altered in any way since they were last loaded, then they must first be saved (using FLUSH) back to the drive in order to allow the currently required screen to be loaded in. Note that before a screen is first edited it will need to be cleared using the CLEAR command as it will probably contain garbage. For example, before using screen 20 for the first time, type: 20 CLEAR 20 LIST TRANSFERRING OLD SOURCE If you have already written a sizeable program with the tape based White Lightning, then you will want to transfer it to your microdrive based White Lightning without having to completely re-type it. To do this, use the following: 1. Type OLD . 2. Type PROG and load your old source code from the tape in the normal way. Then re-enter Forth as normal. 3. Transfer each screen from its old number in memory to its new number on the microdrive using: OLDSCREEN NEWSCREEN TRANS So, for example, to transfer the old screen 6 to microdrive screen 25, use: 6 25 TRANS If a bad sector is encountered you will get error message 8. Skip over this sector and try the next one (see next section on BAD SECTORS). -- end of page 27 4. Finally, type NEW to restore the editing buffers to their microdrive addresses. BAD SECTORS Regrettably, at the time of writing, whilst the microdrive cartridge costs about twice as much as a standard 5 1/4 inch floppy, the number of bad sectors is still extremely high. Forth screens map directly to microdrive sectors, so screen 25 uses sector 25 and so on. So as we shall see, some screens may be unusable. A bad sector will be identified by White Lightning the first time a read or write operation is carried out, and error 8 is generated. Note that executing CLEAR will mean that you can find bad sectors before editing into them. If you do find a bad sector, keep a note of it and don't use that screen. There is a simple way around this problem as we shall see in the following example. Assume we want to edit into screens 25 to 28 and that we did the following: 1. Type 25 CLEAR 0 EDIT . 2. Key in text for lines 0 to 6. 3. Type 7 EDIT then key in --> to indicate continue with next screen when LOADing. 4. Type 26 CLEAR 0 EDIT . 5. Key in text for lines 0 to 6. 6. Type 7 EDIT and key in --> . Now suppose when we typed in 27 CLEAR that we got error 8, indicating drive error. This would mean that sector 27 was a bad sector and therefore that screen 27 was unusable. Remember that in screen 26 the last line was: --> which tells Forth to continue LOADing on the next screen. The next screen is screen 27 which is unusable, so we have to change the last line of screen 26 to become: 7 28 LOAD which tells Forth to continue LOADing at screen 28. This will then skip over the bad sector. ADDITIONAL ERROR MESSAGES # 3 - incorrect addressing mode # 7 - stack overflow # 8 - microdrive read/write error (bad sector) -- end of page 28 SUMMARY OF MICRODRIVE WHITE LIGHTNING 1. Only use specially prepared cartridges for EDITing and use them exclusively for storing screens. 2. CLEAR a screen before using it for the first time and change the previous screen to skip over it if it is a bad sector. Do not use this screen again. 3. Microdrive commands such as ERASE, VERIFY, etc, can be executed after entering BASIC using PROG. 4. Do NOT break into the program (SHIFT and SPACE) while the microdrive is running. 5. RESERVE no longer executes. 6. There are some additional error messages (listed above). 7. Always execute a FLUSH after editing of a screen is complete. THE MICRODRIVE SPRITE GENERATOR INTRODUCTION The microdrive Sprite Generator Program is upwardly compatible with the current tape based version and tape LOADing and SAVEing is still supported. An extra command has been added to make the creation of large sprites easier and the arcade character set has been re-organised to give extra sprite space. IMPLEMENTING ON MICRODRIVE The first thing to do is to transfer the program onto a microdrive cartridge. 1. Insert Tape 1 in your cassette and rewind to Side A. 2. Type LOAD "": LOAD "" CODE 3. Place a formateed cartridge in microdrive 1. 4. Type GOTO 9998. This will save and verify the generator onto the microdrive. Now type PRINT USR 0 to clear memory. The microdrive version can now be LOADed and RUN by typing: LOAD *"M";1;"S" SAVING AND LOADING SPRITES The micrdorive version of the Sprite Development Program still allows sprites to be loaded and saved from and to tape as described in the manual. A separate cartridge is required to store sprites. The program will allow you to move five files of sprites per cartridge, these being numbered 1 to 5. -- end of page 29 Before a cartridge can be used to stor sprites, it has to be specially formatted. This is done using the Sprite Generator Program by typing SYMBOL SHIFT F (TO). This will format the cartridge and set up five dummy files, numbered 1 to 5. From now on, whenever you save a file of sprites, the old file of that number will be erased to conserve cartridge storage space. For example, if you wished to save a file of sprites currently in memory, to file 1, use: 1. Type SYMBOL SHIFT S (save sprites). 2. Type N (we don't want tape). 3. Type Y (save to drive). 4. Insert the formatted cartridge. 5. Press any key. 6. Type 1 (save to file 1). To load sprites just press SYMBOL SHIFT J and then follow the same sequence as that used to save. AVAILABLE MEMORY You have 13595 bytes available for sprites. Please note that the bottom 2816 bytes, locations 51685 to 54501 are used to store the arcade character library accesses by the 'Z' key. If, by creating lots of sprites, you overwrite this area of memory, you should nor try to access any of these characters. CREATION OF LARGE SPRITES The microdrive version of the Sprite Development Package allowd the creation of large sprites (larger than the 15x15 screen) in memory. These sprites can be said to be empty when created and have to be filled by placing smaller sprites into them using the 'place sprite into sprite window' function (BREAK SPACE key). To create a large sprite hit CAPS SHIFT C and enter the dimensions as instructed. MERGING SPRITES FROM MICRODRIVE The actual microdrive file that contains the sprite data has the capital letter B after it (CHR$ 66) such that, for example, the sprite data for sprite file '5' is file '5B'. So with reference to line 5 on page 81 of the White Lightning manual; to merge from microdrive the sprites of sprite file 5 in White Lightning, exit to BASIC and then type: LOAD *"M";1;"5B" CODE -- end of page 30 (last page)