FAQ  •  Register  •  Login

ZXBASIC_USER_DATA relocation?

<<

Haplo

User avatar

Posts: 9

Joined: Tue May 12, 2015 5:09 pm

Post Tue Feb 07, 2017 4:53 pm

ZXBASIC_USER_DATA relocation?

Hi,

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 :(

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

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Wed Feb 08, 2017 8:26 pm

Re: ZXBASIC_USER_DATA relocation?

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:
  Code:
ASM
DI
LD BC,32765
LD A,17
OUT (C),A
LD HL,49152
LD DE,16384
LD BC,2048
LDIR
LD BC,32765
LD A,16
OUT (C),A
EI
END ASM
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

britlion

Posts: 766

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Wed Mar 15, 2017 3:56 pm

Re: ZXBASIC_USER_DATA relocation?

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.

Return to Help & Support

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO