2021-05-21, 06:57 PM
(2021-05-17, 08:50 PM)Duefectu Wrote: Hi @RandomiserUsr,
There aren't a direct way to do this, but there is a workarround that I used in CuadragonNext and now in NextDows OS for Next.
In my case, for the ZX Spectrum Next, I load the modules to $8000 at runtime every time I need, but other approaches are possible.
Modules:
Make a Main module at 24576, as you did.
Make a Vars.bas module that uses a vars zone under $8000 and define the vars like:
Make all the code modules at $8000. Every module shoul include "Vars.bas". In this way you can share variables from one module to other.Code:dim moduleLoad as ubyte AT $7ff0 dim moduleParameter1 as ubyte at $7ff1 dim moduleParameter2 as ubyte at $7ff2 dim lives as ubyte at $7ff3
The point id call to set moduleLoad var and moduleParameter1, and so on to the desired module.
Main Module:
Code:sub ExecModule() LoadSD("Module."+str(moduleLoad)+".bin",$8000,16384,0) ' This is for ZX Next and load the "moduleLoad" in $8000 ' Save ix register and call $8000 asm push ix call $8000 pop ix end asm end sub
The code modules can be compiled as standard programs at $8000 and return to Basic when ends...
Code:' The action to executed is defined by moduleParameter and other variables if moduleParameter1=1 then Command1() else if moduleParameter=2 then Command2() end if ' Before to exit, set moduloLoad to determite the next module to load and the parameters needed moduleLoad=2 moduleParameter=3
Try this apporach and share results and apprachs!
Sorry for my bad English, I'm spanish!
With this approach is your initial program a NEX or a SNA?
Could you achieve the same end by compiling all the the modules into a NEX and them swapping the banks?

