Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to carve up ZX Basic into different ORG values
#4
(05-17-2021, 07: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:

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
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.

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?
Reply


Messages In This Thread
RE: How to carve up ZX Basic into different ORG values - by Ljg701 - 05-21-2021, 05:57 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)