|Re: MCODE: NoV-32: WROM/WRITE S&X/040 to address 4100|
Message #6 Posted by DavidMY on 18 Mar 2008, 6:43 p.m.,
in response to message #1 by Geir Isene
To access the memory location from a user program (i.e. FOCAL) you would need to have available the "poke" command. The David Assembler should have it available. Of course, if you have the above loaded into the NoV32 rather than the actual module you will need the code in BOTH banks in the same [virtual] port.
Traditionally, when paging was done for a CPU that didn't support this action with CPU hardware registers and didn't have "fixed" external memory locations the trick was to locate the "switch" code at the same memory location in both banks.
Actually, this trick is already used with the 41: if you follow the bank switch code for the HexPac module you will see that the same location (at the end of the module's space) is called to overlay the rom banks.
So, if you want to use an exclusively machine coded solution (and assuming your machine code routine starts at 6100h in the first bank --place the same code in the second bank at 6100h. Since the code--after--the instruction loading the 4000h location is the same the routine finishes and returns.
Done correctly [test the 4000h location first] and you can have a routine that acts as a toggle.
Also, note that because the return stack is part of the CPU registers you will return to the same address in either bank, but the code THERE doesn't need to be the same.