|Re: Help request for someone with a real HEPAX|
Message #7 Posted by Diego Diaz on 25 May 2010, 7:10 p.m.,
in response to message #6 by Ángel Martin
There are a couple of things that makes bankswitching (BS) a not-so-easy feature to be implemented, neither physical nor emulated.
First is the fact that *every* BS module (or its emulated counterpart) *must* be able to interpret the ENBANK instructions, modify their internal memory addressing accordingly *and* keep track of it. This must be done independently inside every BS module.
Second, every non-BS module (including OS mainframe) *must* be accessible no matter which bank is active in the BS module where the "call" (JC/JNC) comes from.
The mess may come from any combination of these two sources:
Example 1: A BS module is running on bank n (n>1) then it jumps to an address in a non-BS page. If emulator does not have *all* non-BS pages visible from *all* banks you'll get a weird behaviour... (more likely a crash).
Example 2: Emulator includes ENBANK handling... (this is needed if it emulates CX) but just one bank pointer (instead of one for every BS module). Then it switches accordingly to the "last" ENBANK instruction, but it will switch "every" BS module... again a source for weird behaviour, since a BS module with 4 banks could be accidentally swiched back to bank n (say 2) when it is supposed to be in bank k (say 3).
To my mind the bug reported by Eric is about this second example. I faced this very same problem when developing the NoV-AdvH modules emulation, which handles two BS modules (HEPAX & Advantage) with the same code.
Software emulators will need one BANK pointer for OS (CX) + one for HEPAX + one for Advantage... IR... etc...
Don't know how MLDL handle BS but, since it's a physical device as NoV's, they don't need to care about the OS pointer (calculator itself handles it) that's why HEPAX works as expected on both. However, this is the reason why you cannot (yet) run Advantage into NoV-64: a second BS pointer is needed.
Rule of thumb:
BS modules: must have a dedicated BANK pointer for each BS page.
non-BS module: must be visible from every posible BANK (1-4)
I've also implemented a safety rule into NoV's: BANK is always set back to 1 just before STAND-BY.
Hope this helps.
Edited: 25 May 2010, 7:39 p.m.