★ APPLICATIONS ★ PROGRAMMATION ★ Rescue ★ |
Rescue | Applications Programmation |
Have you ever lost hours of work when your program has crashed? Even the best commercial software contains bugs, and if you have tried your own machine code programming you will, like me, have grown to dread the sudden appearance of the warm-up screen. Rescue is at hand, however, if you own a CPC6128, or a CPC664/464 with a memory expansion. This program hides in the background of your computer, and keeps it safe in case you crash. If (or when) you crash, Rescue will restore the memory to the exact state it was in when you last saved it. Type in Program 1, which is a Basic loader. When you run it, any data errors will be pointed out. If there are no errors, it will automatically save the binary program, Rescue, to disk or tape. To use Rescue, simply load it at any time and then CALL &BF00 whenever you want to save the contents of the memory to the second block of 64k. To rescue the memory contents after a crash, reset the computer with CTRL-SHIFT-ESC, type 'CALL &BF00,1' then ENTER. When Rescue has been loaded, it will remain in the computer even if you reset it or it crashes, and it will only be lost if you turn the computer off. This means that you do not have to reload Rescue each time your computer crashes or when you reset it with CTRL-SHIFT-ESC. The program works by saving all the usable memory into the second memory block of 64k, which very few programs use. Obviously, if the program you are using or writing does require the second block of 64k, then you cannot use Rescue. These programs include the better word processors such as TASWORD 128 or rare programs such as MASTERFILE, which run on the CPC6128 but not on the unexpanded CPC664/464. The second block of memory cannot be addressed directly because the Z80 processor (which is used in all CPCs) can only use 64k at any one time. In order to use any of the second block of memory, some of the original block must be swapped with it so that the total is always 64k. The easiest way of doing this is to swap a bank of 16k of the second block with a 16k bank of the first block. Swapping memory banks can be done in Basic. The best bank to swap with is the one from &4000 to &7fff. This will not interfere with any Basic programs (unless they are more than 15k long) nor with any machine code programs above &8000. The second block of memory has four banks, and any one of them can be swapped into the first memory block at &4000 with the following short program: 10 bank=1: REM or 2,3 or 4 20 OUT &7F00, 195+bankThe original bank can be restored by: 30 OUT &7F00, 192This second block of 64k can be used to store data, screens, or, as with this program, the whole contents of the first block of memory. Unlike the first block, it is not cleared when you reset the computer, so information stored there is not destroyed when your computer crashes. The following lines added to the above program will put your name into the second block of memory so that it can then be rescued after you have reset the computer: 24 INPUT "Name:", n$:FOR n = 1 TO LEN (n$):POKE &4000+n, ASC (MID$(n$,n,1)): NEXT |
|
|