ZXBASIC_USER_DATA relocation? - Printable Version

+- Forum (
+-- Forum: Compilers and Computer Languages (
+--- Forum: ZX Basic Compiler (
+---- Forum: Help & Support (
+---- Thread: ZXBASIC_USER_DATA relocation? (/showthread.php?tid=787)

ZXBASIC_USER_DATA relocation? - Haplo - 02-07-2017


in my project I use a lot of memory, indeed I use all the banks of RAM available. But my main code has grown beyond the 49151 position and now I have a serious problem by switching pages of RAM: ZXbasic stores some vitality data in the end of the generated code, like ZXBASIC_USER_DATA, so if the label overcome 49152, I can't switch pages without risky consequences Sad

My question is, it's posible to move/relocate these labels to another area more secure?
Of course I could do it manuallyby editing the .asm generated but I hope that exists an easy way to avoid this.

Re: ZXBASIC_USER_DATA relocation? - LCD - 02-08-2017

You can use Assembler to switch bank and copy memory chunks from banks to a buffer in lower memory, then switch bank back (Disable interrupts!). Something like:
LD BC,32765
LD A,17
LD HL,49152
LD DE,16384
LD BC,2048
LD BC,32765
LD A,16

Re: ZXBASIC_USER_DATA relocation? - britlion - 03-15-2017

Yes - like LCD says - write a small routine that's designed to copy data out of the upper memory banks to a low down buffer. (worst case scenario, make teh screen attributes all the same, and you can use the 6k of screen temporarily). Then change bank back and return - the new data is accessible. It's a bit like a ram load option, really.

You may have to write this separately, and call it with a smidge of assembly language, rather than make it part of your main compiled program.