Loading routine "cores": Difference between revisions

Jump to navigation Jump to search
no edit summary
(Document the Microsphere loader.)
No edit summary
(6 intermediate revisions by the same user not shown)
Line 104: Line 104:


Another very close variant on the ROM loader, this time replacing the <code>RET NC</code> with the <code>NOP</code>-equivalent <code>AND A</code>.
Another very close variant on the ROM loader, this time replacing the <code>RET NC</code> with the <code>NOP</code>-equivalent <code>AND A</code>.
=== Paul Owens ===
Used in some Ocean games, for example [https://spectrumcomputing.co.uk/index.php?cat=96&id=903 Chase H.Q.].
LD-SAMPLE  INC B
            RET Z
            LD A,7F
            IN A,(FE)
            RRA
            RET Z
            XOR C
            AND 20
            JR Z,LD-SAMPLE
Again just a one-byte change from the ROM loader, replacing the <code>RET NC</code> with Alkatraz's <code>RET Z</code>.
=== Dinaload ===
Used by Dinamic, for example in [https://spectrumcomputing.co.uk/index.php?cat=96&id=295 Astro Marine Corps] and [https://spectrumcomputing.co.uk/index.php?cat=96&id=1863 Freddy Hardest en Manhattan Sur].
LD-SAMPLE  INC B
            RET Z
            LD A,FF
            IN A,(FE)
            RRA
            RET NC
            XOR C
            AND 20
            JR Z,LD-SAMPLE
Yet another one-byte change from the ROM loader, this time ensuring that no keyboard half-rows are read, meaning the <code>RET NC</code> will never trigger.
=== Search Loader ===
Used in [https://spectrumcomputing.co.uk/index.php?cat=96&id=584 Blood Brothers] and [https://spectrumcomputing.co.uk/index.php?cat=96&id=978 City Slicker].
LD-SAMPLE  INC B
            RET Z
            LD A,00
            IN A,(FE)
            XOR C
            AND 40
            RET C
            NOP
            JR Z,LD-SAMPLE
The first loader which is actually non-trivially different from the ROM loader. The changes here:
* Setting the high byte of the <code>IN</code> to be zero - this causes every keyboard half-row to be read. This is unimportant as all five low bits are masked out later.
* Dropping the <code>RRA</code> of the ROM loader - as we're not checking for any keys being pressed, no need to shift the byte around. This means the EAR bit stays in bit 6 rather than being shifted to bit 5 so the <code>AND</code> changes as well.
* The <code>RET C</code> is a no-op as <code>AND</code> explicitly clears the carry flag.
This code has fairly obviously been constructed to have exactly the same runtime as the ROM code, which explains the always failing <code>RET C</code> and <code>NOP</code> (which replaces the <code>RRA</code> of the ROM routine). All the variants which replace the <code>RET NC</code> with a <code>NOP</code> or similar actually have a different runtime as a failing conditional <code>RET</code> is the ''only'' Z80 instruction which takes 5 t-states.
==== "Variant" Search Loader ====
Used by some late era Gremlin games; so far seen only in [https://spectrumcomputing.co.uk/index.php?cat=96&id=2937 Lotus Esprit Turbo Challenge] and [https://spectrumcomputing.co.uk/index.php?cat=96&id=4660 Space Crusade].
LD-SAMPLE  INC B
            RET Z
            LD A,7F
            IN A,(FE)
            XOR C
            AND 40
            JR Z,LD-SAMPLE
While this maintains the distinctive <code>AND 40</code> of the Search Loader, I suspect it's actually an independent derivation.
=== Digital Integration ===
Unsurprisingly enough, used by Digital Integration in some of their games, for example [https://spectrumcomputing.co.uk/index.php?cat=96&id=305 ATF] and [https://spectrumcomputing.co.uk/index.php?cat=96&id=5317 Tomahawk].
LD-SAMPLE  DEC B
            RET Z
            IN A,(FE)
            XOR C
            AND 40
            JP Z,LD-SAMPLE
This loader has two points of note: it inverts the counter (which just requires the flip of a condition outside this loop when working out whether it's a long or short pulse), and it's probably the minimal loop which is possible while still being anything even vaguely similar to the ROM loader.
== Emulation ==
[http://fuse-emulator.sourceforge.net/ Fuse] pattern matches for the above cores to implement its "accelerate loaders" feature.
49

edits

Navigation menu