Top 10k strings from nwBANKswitching.rtf in <root> / doc / technical / RoelofKoning / nwBANKswitching.zip /

Back to the directory listing

   3 \par \tab \tab \tab \tab \tab DEC  HL
   2 \par }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   2 \par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649  (not 5896!) the three bytes of CALL 
   1 {\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1043\deflangfe1043{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
   1 {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain 
   1 {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang 
   1 {\f52\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f53\fswiss\fcharset186\fprq2 Arial Baltic;}{\f54\fswiss\fcharset163\fprq2 Arial (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
   1 {\f46\fswiss\fcharset238\fprq2 Arial CE;}{\f47\fswiss\fcharset204\fprq2 Arial Cyr;}{\f49\fswiss\fcharset161\fprq2 Arial Greek;}{\f50\fswiss\fcharset162\fprq2 Arial Tur;}{\f51\fswiss\fcharset177\fprq2 Arial (Hebrew);}
   1 {\f41\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f42\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f43\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f44\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
   1 {\f36\froman\fcharset238\fprq2 Times New Roman CE;}{\f37\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f39\froman\fcharset161\fprq2 Times New Roman Greek;}{\f40\froman\fcharset162\fprq2 Times New Roman Tur;}
   1 {\*\generator Microsoft Word 11.0.5604;}{\info{\author Windows}{\operator Windows}{\creatim\yr2008\mo12\dy2\hr12\min45}{\revtim\yr2008\mo12\dy2\hr12\min55}{\version2}{\edmins10}{\nofpages5}{\nofwords2709}{\nofchars14904}{\nofcharsws17578}{\vern24689}}
   1 truction:   }{\f1\fs20\cf6\lang2057\langfe1043\langnp2057\insrsid2843649 OUT (C), A    }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 is used.  (here C= port address (in fact BC register) and  A= bank number) }{
   1 to the design of Opus hardware, the actual moment of switching takes place as soon the Z80 processor has finished the 'opcode fetch' part of the instruction, which in fact is the moment after the first byte is read (by Z80) from the address concerned. 
   1 tion with a specific feature of the Sinclair software, where all error-handling is routed to one specific address in ROM, address 8. Whenever address 8 is 'addressed' by a program, this is registrated by a dedicated set of logic (electronic) gates and res
   1 ticated functions, but this simple example might explain the basic idea for this moment.
   1 that operation can take place. Which means that the complete instruction 
   1 that in the Spectrum. Also in this ROM the few jumps to the normal exit address (5960) were changed into jumps to 15586. (addrs.}{\b\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649  0, 119, 203 ,447, 1580 }{
   1 tch, more or less equal to that of Spectrum 128,  which can be controlled by software. This switch can normally even be operated from BASIC by a command like OUT x,y where X is a port address and Y is the number of a memory bank. The hardware switch for t
   1 small bank switch routine was poked. This address was chosen for no particular reason. Then at address }{\b\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 11}{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649  }{
   1 s left there for experiments as the following. 
   1 r". Knowledge of Machine Code (MC) is not necessary to see that when "number" is the port address for an I.O. operation, this number must be known, and therefore }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 must be }{
   1 ong. A clever method was used to 'add' this extra ROM code to the original ROM code inside the Spectrum.
   1 of interfaces holding a ROM constitutes a considerable part of such interface. It was Sinclairs Interface 1 that opened this route to "active paging" of ROMs, and many add-on manufacturers followed there. 
   1 nterface1 ROM. This ROM has less to offer when the accompagnying hardware is not present. And a specific problem regarding IF1 is that the 'addressing' of the RS232 port and the NET is residing in the ULA chip. This makes it rather difficult, but probably
   1 not impossible, to address this hardware without having the "active paging" (and thus IF1 ROM) alert and thus interfering. (There's a challenge out there...) Examination of the famous Colliers expanded ROMs for both Spectrum and IF1 showed that no room wa
   1 ng 'add-on}{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 ' remains}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649  passive although its presence is the reason that paging is needed. 
   1 mpact Flash card, and slowly but relentlessly good old floppy is becoming obsolete. Having the possibility to connect a larger ROM to the Spectrum, and the possibility for 'passive paging' of memory banks, it became clear that all the heavy Opus hardware 
   1 moment, these entrances in Opus-ROM were left out the new scheme.
   1 lts in an electric signal which triggers the (electronic) switch. For all different conditions under which 'paging' must take place, such an 'address-decoding' device must be present. It looks as if Sinclair originally planned to use only address 8 for pa
   1 k switch routine is called in Spectrum ROM at address 11, then the return address, found on the stack, is 14. Because the CALL is a three bytes long instruction. Now, when the Opus ROM takes over, this address is fetched, 3 times decremented, and put back
   1 is processed at the departure side! Although the actual switch takes place during the last phase of this instruction, thus before the next instruction is handled. The same picture is valid for a more often found hardware situation, o.a.128K, where the ins
   1 in the original ROM code. Now the Spectrum played an active role in 'paging', and a much simpler switching mechanism could be used, equivalent to using one or two standard logic chips. The name "passive paging" is suggested for this method, as the recepti
   1 in fact had become completely redundant. If only the 'disk operating system' could be ported to a passive-paged ROMbank, then all might fit inside an rubber 48K which then would become portable again....
   1 his method usually consists of a so called "edge triggered flipflop", which makes that the actual switching is done at a specific moment during the Z80's activities, i.c. a specific state of its control signals.
   1 his behaviour differs completely from the 'on-the-fly' bank switch system described above. Still it is this behaviour which makes it possible to mimic the "active paging" by using "passive" paging. This in turn makes it possible to migrate the Opus system
   1 h is based on tables (a full disassembly available at WorldOfSpectrum) it is possible to isolate and replace all kind of routines. A lot of that was already done long ago.
   1 ging' lost in my view its significance when large capacity ROMs (EPROMs, FlashRAMs) became available and the prices went down. There is no longer a reason for keeping the original 'hard' Spectrum EPROM on duty, }{
   1 ging ROMs, and that later a second address (5896) had to be used for IF1 due to a bug in the Spectrum ROM. 
   1 from the Opus Discovery, where some 9 standard logic chips are needed to get the basic 'switching mechanism' going. The 'switching' part 
   1 e capacity ROM. Such a copy of Spectrum's ROM can, in contrary with the original ROM inside the Spectrum, be modified for the designers specific needs. And among those needs might be the 'paging' of different ROM banks. Several add-ons featuring large cap
   1 e 1 is missing?
   1 ded by the new add-on. The general picture is that interfaces (including IF1) have to be active and 'clever' in order to 'steal' control over the ROM area. 
   1 d by entering BASIC commands, which error messages were taken as proof that all was O.K.and working. The latter may sound funny. But in what other way can the message "Microdrive not present" (following CAT 1) be understood when even the complete Interfac
   1 ascading' system can be thought of, or a 'tandem', which goes beyond the scope of this story...    
   1 are, and choose to supply this software in a ROM chip which resides in the add-on (interface). Such ROM chip is connected parallel with the original Spectrum ROM chip, and a kind of switch is installed which makes it possible to make one of these two ROMs
   1 are available (via Internet) that hold up to 128K ROM and 128K RAM, and even more. Often the ROM (non volatile) part is (re-)programmable.
   1 acity ROM are available nowadays.
   1 \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 
   1 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;
   1 \red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1043\langfe1043\cgrid\langnp1043\langfenp1043 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
   1 \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid2843649\rsid6520506}
   1 \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 \fs24\lang1043\langfe1043\cgrid\langnp1043\langfenp1043 {\f1\fs28\lang2057\langfe1043\langnp2057\insrsid2843649 A story about extending the Spectrum ROM.
   1 \par }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 Some testing}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 Owing an explanation}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 On the fly method}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 Its all software now}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 Hard method}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 Finally...}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 Conclusion}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }{\f1\fs20\lang1033\langfe1043\langnp1033\insrsid2843649 Exit addresses were found in IF1-v2 at: (decimal) 5, 97, 175, 545, 3477, 7822.  }{\lang1033\langfe1043\langnp1033\insrsid2843649 
   1 \par }{\f1\fs20\lang1033\langfe1043\langnp1033\insrsid2843649 
   1 \par }{\f1\fs20\cf6\lang2057\langfe1043\langnp2057\insrsid2843649 \tab \tab \tab }{\f1\fs20\cf2\insrsid2843649 POP  AF}{\f1\fs20\cf6\insrsid2843649 \tab \tab POP  AF \tab \tab 
   1 \par }{\f1\fs20\cf6\lang2057\langfe1043\langnp2057\insrsid2843649 \tab \tab \tab IN   A,(13)  ;opusbank\tab \tab }{\f1\fs20\cf2\lang2057\langfe1043\langnp2057\insrsid2843649 IN     A,(9)  ;spectrumbank
   1 \par }\pard \ql \li0\ri0\nowidctlpar\tx568\tx1278\tx2840\tx4536\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 Now anywhere in ROM 9 this code could exist: \tab }{\f1\fs20\cf6\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }\pard \ql \li0\ri0\nowidctlpar\tx568\tx1278\tx2840\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649   The method of 'active pa
   1 \par }\pard \ql \li0\ri0\nowidctlpar\tx568\tx1278\tx2840\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }\pard \ql \li0\ri0\nowidctlpar\tx2556\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }\pard \ql \li0\ri0\nowidctlpar\tx2414\tx3124\tx3408\tx5396\tx5538\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 The bankswitch routines: \tab \tab  }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 SPECTRUM}{
   1 \par }\pard \ql \li0\ri0\nowidctlpar\tx2414\tx3124\tx3408\tx5396\tx5538\faauto\rin0\lin0\itap0 {\f1\fs20\cf6\lang2057\langfe1043\langnp2057\insrsid2843649 \tab \tab \tab PUSH AF\tab \tab }{\f1\fs20\cf2\lang2057\langfe1043\langnp2057\insrsid2843649 PUSH AF
   1 \par }\pard \ql \li0\ri0\nowidctlpar\tx2414\tx3124\tx3408\tx5112\tx5396\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par }\pard \ql \li0\ri0\nowidctlpar\tx2127\tx3408\tx5396\tx5538\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 \tab   L15586:\tab }{\f1\fs20\cf6\lang2057\langfe1043\langnp2057\insrsid2843649 DI\tab \tab }{
   1 \par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649   When on-the-fly going from Spectrum to Opus the code in red is executed, returning from Opus to Spectrum the code in blue is executed. 
   1 \par that mimics the mechanism as is used in Sinclairs Interface1.
   1 \par by Roelof Koning.
   1 \par \tab \tab bankswitch: \tab PUSH AF
   1 \par \tab \tab \tab }{\f1\fs20\cf2\insrsid2843649 EI}{\f1\fs20\cf6\insrsid2843649 \tab \tab EI
   1 \par \tab \tab \tab \tab \tab RET
   1 \par \tab \tab \tab \tab \tab EX     (SP), HL
   1 \par \tab In }{\b\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 Spectrum}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649  ROM code, at }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 address }{
   1 \par \tab In }{\b\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 Opus}{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649  ROM code (now occupying a full 16K bank instead of the original 8K!), at address }{
   1 \par What happens exactly is this: the actual two bytes for the IN A,(number) instruction are 219 and "numbe
   1 \par These large ROMs or RAMs are split up in smaller parts that individually can be selected. Such parts are called }{\b\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 'banks' }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 or}{
   1 \par The example regarding the Opus Discovery ROM is ment to demonstrate that 'passive' on-the-fly bank switching can be as functional as the "active paging" that is used by Interface1 and similars. 
   1 \par Soft method}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par Of course both Spectrum and Opus ROM code must be available as file, for changing.
   1 \par Notes:
   1 \par It also provides a method by which hardware add-ons that were incompatible as long as 'active paging' was used, can now be used together, by preparing one (or more!) for 'passive paging'. Even a 'c
   1 \par Groningen, november 2008.
   1 \par For studying this problem, once more the Opus system was analized. And more than  expected was found this time....  }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par And introducing an on-the-fly method for paging ROM banks
   1 \par All numbers given are in decimal, but some numbers might be more decimal than others.}{\f1\fs20\lang1033\langfe1043\langnp1033\insrsid2843649  :-)}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par (For IF1 a similar set of changes must be made, see addresses below under Notes.)
   1 \par  }{\f1\lang2057\langfe1043\langnp2057\insrsid2843649   
   1 \par  }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par   When}{\f1\fs20\cf5\lang2057\langfe1043\langnp2057\insrsid2843649  }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 testing the method with Interface1 ROM,
   1 \par   When the ban
   1 \par   This property of machine language I/O instructions }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 creates the possibility}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par   This means that the ' instruction' at the page-in address is read from the Spectrum ROM, but that any further processing (when needed) takes place in the Opus ROM! So for instance at address 8, where LD HL,(23645) is found in Spectrum ROM and JP 360 in 
   1 \par   This is the reason why not IF1 but the white raven Opus Discovery is taken further as example. But tests proved that the story is valid for IF1 too, which for some readers might be a more conveniant entry to the scheme explained here. 
   1 \par   This experiment, more specificly, demonstrates the fact that the "RST 8 route", as known from IF1, is also open for ROM/RAM interfaces that only feature a
   1 \par   This concludes the complete list of changes needed to get the mechanism going! 
   1 \par   This clever method of ROM-extension that left the Spectrum completely untouched was (and still is) impressive. 
   1 \par   This 'paging' is only possible because the Spectrum has a connection on the edge connector by which the original ROM can be switched off. That possibility is all that Spectrum offers, all other switching gear (plus the connected 'logic') must be provi
   1 \par   The switching logic of a 'clever' interface resides in a number of standard chips, or in a dedicated chip like the ULA in Interface1 or the PAL in the PlusD. An idea of the size of such switching gear can be }{
   1 \par   The specific
   1 \par   The same method, often named 'paging' or 'hard paging', was also used by manufacturers of other interfaces. It is an intrigueing method with intrigueing results, and among us for some 25 years now.
   1 \par   The reason for this in-depth explanation of a long existing system lies in the present. I myself use, together with a 48K Spectrum, an Opus Discovery with 720K Floppy and  64MB hard disk. But the massive hard disk was long time ago replaced by a small C
   1 \par   The measures taken for a 'passive paging' Opus system are described here:
   1 \par   The following story tries to explain, for those who are still active in the field of programming and developing and for those who are hoping that they one day will find the time for that, how still a new and probably usefull aspect was discovered.
   1 \par   The conditions under which Opus actively pages in are documented: memory access in Spectrum ROM on addresses 0, 8, 72, 5896. Note that addresses 8 and 5896 are used by the Sinclair Interface 1 for the same purpose. Now, due 
   1 \par   The Sinclair Spectrum was brought on the market at a moment in which the development of the 'system' (BASIC residing in ROM) was not yet completely finished. The Sinclair Interface 1 (IF1) hardware extension therefore had to bring extra 'system code' al
   1 \par   The 'paging' mechanism of such added memory is mostly based on a simple hardware swi
   1 \par   Now of course the parts in Opus ROM that handle floppy disk, printer and joystick are useless without the specific Opus hardware. But thanks to the modular structure of the Opus system whic
   1 \par   My own Spectrum system with a multi-page ROM (since 1987....) might serve here as a living example for this on-the-fly method. In my system is, for a number of (hardware related) reasons, chosen to switch between 16K ROM banks with an IN instruction in 
   1 \par   Let us start with a view at the more or less classic situation regarding the Spectrum. A hardware manufacturer designed a nice add-on (IF1, Opus, PlusD, DivIDE, Spectranet) which needed its own softw
   1 \par   Let us assume that in ROM 9 the bankswitch routine holds 13 as bank number, and in ROM 13 the bankswitch routine (on the same address) holds 9 as number. 
   1 \par   It was thrilling in an oldfashioned way to see how all the intricate features of the Opus system obeyed the new regime without any problem. Even PRINT USR 8 returned the version number as usual! }{
   1 \par   It should be noted that this method has a connec
   1 \par   In Opus ROM the paging address 0 seems to serve no specific purpose, and address 72 activates an extension for the keyboard interrupt in the Spectrum ROM. While neither was needed for this 
   1 \par   Here a comparison must be made with the more common (and even better documented) I
   1 \par   From this experiment arises a more general idea that goes beyond migrating a disk system: 
   1 \par   Chips that can be used as ROM have become significantly cheaper since 1982, and sizes nowadays go far beyond the 16K as used in the Spectrum. Add-ons for the Spectrum 
   1 \par   An logical extension to this idea is having two banks with identical routines that carry each others bank number. This creates a vice versa situation. In this way a Spectrum ROM could enter and leave an Extension ROM bank on the fly. 
   1 \par   An added bonus might be that a major part of the electronic properties of the IF1 ULA chip now can be und}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 erstood by studying}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \par   A second method of 
   1 \par                      \tab \tab IN A, (banknumber)
   1 \par                                                }{\f1\fs20\cf2\insrsid2843649  \tab \tab }{\f1\fs20\cf2\lang2057\langfe1043\langnp2057\insrsid2843649 RET}{\f1\fs20\cf6\lang2057\langfe1043\langnp2057\insrsid2843649 \tab \tab EX     (SP), HL
   1 \par                                                \tab RET
   1 \par                                                \tab POP AF
   1 \par                                                                         \tab PUSH HL
   1 \par                                                                         \tab CALL bankswitch
   1 \par      
   1 \margl1417\margr1417\margt1417\margb1417 \widowctrl\ftnbj\aenddoc\hyphhotz425\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3
   1 \jcompress\viewkind4\viewscale100\nolnhtadjtbl\rsidroot2843649 \fet0\sectd \linex0\headery708\footery708\colsx708\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang 
   1 \f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 read, }{\i\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 before }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 \tab }{\f1\fs20\ul\lang2057\langfe1043\langnp2057\insrsid2843649 OPUS}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 (not 8!) the LD (23647), HL was replaced }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 by CALL 15586. Also at address }{\b\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 5897
   1 \f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \f1\fs20\cf5\lang2057\langfe1043\langnp2057\insrsid2843649  }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 that the mechanisme worked here too. A number of typical Microdrive error messages could be generate
   1 \f1\fs20\cf2\lang2057\langfe1043\langnp2057\insrsid2843649 DI
   1 \f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 since }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 a copy of it can find a place in a larg
   1 \f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 is as follows:}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649   }{\f1\fs20\cf6\lang2057\langfe1043\langnp2057\insrsid2843649  
   1 \f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 gotten}{\f1\fs20\cf5\lang2057\langfe1043\langnp2057\insrsid2843649  }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 for OPUSv2.24) This was done only because there was no room to poke this jump}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649  at 5960.
   1 \f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 In this case }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \b\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649  'pages'}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 \b\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 15586}{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 , a small bank switch routine was poked, slightly differing from 
   1 \b\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 15586}{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649  a }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 
   1 This would make the program to continue running in ROM 13 at address 12345. And a similar code in ROM 13 could bring the program back to ROM 9, and so on. In fact this mechanism should be extended to suit more sophis
   1 Opus ROM, actually a LD HL,(360) is executed when this address is reached. And when Opus pages out at address 5960, the (single byte) RET instruction that is found there is read at Opus side, and executed at Spectrum side. (Equal to IF1's RET at 1792.) 
   1 Machine Code. These banks are numbered 9 - 16 . }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 And}{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649  the code for switching banks }{
   1 LD HL, 12345
   1 896 in Spectrum is executed, and the next instruction is taken from 5897 in Opus. 
   1 15586 were poked. These pokes destroy the original code but that is no problem. As explained above, the instruction at address 8 is not executed properly when 'active paging' is used, and is therefore repaired/ignored in Opus. And the code at 5897 resides
   1 , and usually have a number assigned. This article, by the way,  regards pages of 16K bytes that, when active, fill the Z80's address space from 0 to 16383.
   1 'paging' was used by Sinclair when the Spectrum128 arrived. Here the control over ROM (and RAM) areas is not 'stolen away' by a stranger but handed over by Spectrum ROM itself,  to a friendly 'colleague' ROM. For this purpose a few minor changes were made
   1  to use identical pageing routines 'parallel' in different ROM banks, and then }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 to }{\f1\fs20\lang2057\langfe1043\langnp2057\insrsid2843649 switch between pages 'in real time'. }{
   1  the right place to continue!
   1  the Opus diagram as example. 
   1  situations in which the Spectrum ROM is paged out and another ROM is paged in, are normally connected with certain ROM addresses. Address 8 (this is where RST 8 jumps to) is probably the best known. The Sinclair IF1 is using it, together with address 589
   1  simple 'passive' paging mechanism. In this way for instance can the classic method for extending BASIC be used without the need for owning an IF1! 
   1  match seamlessly. A simple method for that is having identical routines in both ROMs at the 'exchange address'. Let us consider the code given above.  
   1  in the "CLOSE-2" routine which must be replaced anyway as soon as new channels are introduced. 
   1  doing a FORMAT "n";12: PRINT PEEK 23749 worked as expected. By making a few hook code calls (RST 8, DEFB #1C) to do some printing on screen, }{\f1\fs20\cf1\lang2057\langfe1043\langnp2057\insrsid2843649 it was proved}{
   1  active, depending on certain situations. It will be clear that for instance a disk interface that holds a ROM, will 'page in' (switch on, make active) this own ROM (and thus its own software) whenever some disk operation has to be executed. 
   1  Then the RET at the end of the routine takes this address (now 11 ! ) to jump to in the Opus ROM. Because the Opus system expects that execution of the three byte instruction at address 8,9,10 is corrupted (as explained above), this address 11 is exactly
   1  (and IF1's) to new ROM bank-switching hardware without real trouble.
   1  'parallel' means that identical routines reside in different ROM banks on the same address. This address can be anywhere in ROM. 
   1   When the bank switch routine is called in Spectrum ROM at address 5897, then the program continues at address 5897 in Opus. This is correct, because also 'normally' (the old situation), the (one byte instruction!) INC HL at 5
   1   This bank switch routine could reside in RAM, or as in the Spectrum 128, reside in the printer buffer. But such routine can also find a place in ROM. In which case the machine code in the 'departure' ROM and that in the 'arrival' ROM should
   1   The normal return from Opus to Spectrum consists of a simple RET at address 5960. The RET at the end of the bank switch routine (in Spectrum) now does exactly the same.