Hi,

I need to use 12288 bytes for data storage, and I think creating an apvar is the best way to do it, as there is probably no ram area big enough for that amounth of data. But I have no idea how to create this variable, and how to delete it when the program finishes.
ben_g wrote:
Hi,

I need to use 12288 bytes for data storage, and I think creating an apvar is the best way to do it, as there is probably no ram area big enough for that amounth of data. But I have no idea how to create this variable, and how to delete it when the program finishes.


Easy to do with doors. is this basic or assembly?
It is in assembly and it's for an app, so I can't use doors.
Easy to do without Doors CS too:


Code:
    ld hl,AppVarName
    rst 20h   ;copy to Op1
    bcall(_chkfindsym)
    jr nc,Already_Exists ;make this go somewhere useful
    ld hl,NNNN ;how many bytes it should be
    bcall(_createappvar)
    inc de
    inc de
    ;now de->first byte of contents

AppVarName:
    .db AppVarObj,"MYNAME",0


Hope this helps.
Thanks, It works. How can I delete it?
ben_g wrote:
Thanks, It works. How can I delete it?
Also a good question; it follows the same general outline:


Code:
    ld hl,AppVarName ;assume this is already defined
    rst 20h
    bcall(_chkfindsym)
    jr c,NotFound ;don't delete a non-existent appvar!
    bcall(_delvar)
If you're using an APP and you need a certain amount of memory to use, it's usually a lot simpler to use _InsertMem to insert memory at userMem ($9D95), then use _DelMem before exit. That way, you can use absolute addresses to access your data rather than offsets into an appvar.
That's a good solution, to be sure. Just don't forget to use bcall(_memfree) or bcall(_enoughmem) as needed before _InsertMem.
Thanks, that worked well.
ben_g wrote:
Thanks, that worked well.
No problem, glad to hear it. Of course, as usual, feel free to bump this topic if you think of any related questions.
I'm new to hybrid/asm working with basic, in order for a game to work i was thinking of using lists/matrices to define certain data but i was wondering if appvars would work better. Could you explain how to make appvars with doors cs (Version>=7)
Welcome to Cemetech, Ciyco! Be sure to Introduce Yourself when you get a chance. So taking a look at the Third Party BASIC Libraries reference on the Doors CS wiki, these are the functions that would help you:
You should note that you need a special prefix on the AppVar name so that the Celtic2 libs inside Doors CS 7+ know that you want to work with AppVars. By default, it assumes you're referring to programs.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement