The nostalgic appeal of watching flickering border stripes while a Spectrum program is loading soon wears off, and almost every Spectrum emulator implements some technique to speed up the tape loading process (i.e. when loading TAP or TZX files). The most intuitive method of doing this is probably to just increase the emulation speed during tape loading, something I implemented in SoftSpectrum 48 early on. A more efficent but also more difficult method (at least if you want it to work on every type of tape file) is to bypass the translation of tape data to audio signals via the in port, and instead just load the data directly into RAM. This technique is sometimes called "flash load", and I will try to implement it to some degree in SoftSpectrum 48. The basic principle The basic principle behind flash load (as I understand it - which may be a simplification) is that you need to do do four things:
Of course, things become much more complicated when you have custom loaders which use only some or none of the ROM routines, but I will start with a simple solution where I just intercept the ROM routine for loading a code data block. Flash loading a code block The Controller class orchestrates everything that goes on in the emulator, so it will control the flash load function as well. To do this it needs to do the following things:
Below is the Controller code for handling Tape flash load as described above: Apart from the new Controller code and the new Tape flash loader class (which only acts as an intermediary between the Controller and the Memory class), the other important change is that the Tape item class has been extended with a data array which holds the data block content. Previously, the Tape item class only held information about tape blocks to be presented in the tape player window. A tape item was created for each header block (by the Tape manager when opening a TAP or TZX file). Now, a tape item is created not only for headers but also for data blocks. What happens when the Controller detects a code header being loaded is that it retrieves the data array from the tape item following the header and copies this it to RAM. Result This first effort works surprisingly well, although the fact that program blocks are loaded in "real time" and that the code block flash load is not triggered until after the tape leader pulses have been processed (that is when the LD_BLOCK routine is activated) means that it still takes quite a while to load a tape. Also, headerless code blocks are not handled, so this will probably be the next step.
0 Comments
Leave a Reply. |
Archives
November 2020
Categories
All
|