Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

LoadData( Not Working Correctly in Certain Programs #123

Open
programmer2514 opened this issue Mar 25, 2019 · 1 comment
Open

LoadData( Not Working Correctly in Certain Programs #123

programmer2514 opened this issue Mar 25, 2019 · 1 comment

Comments

@programmer2514
Copy link

I am trying to use LoadData( to get data from an AppVar defined in Str1.
This works fine in a smaller program, but any time I try to use the command LoadData(Str1,0,3) in a program that is bigger than ~20 KB, my calculator's RAM gets cleared.
What happens exactly is:

  1. I run the program and load the data
  2. It loads fine and I can use it perfectly
  3. I exit the program and my RAM clears

I have found no workaround for this and it is hard to do certain things without it.
If this can be fixed, that would be great.

Thanks,
calclover2514

@beckadamtheinventor
Copy link
Contributor

beckadamtheinventor commented Mar 25, 2019

I've never had success with LoadData.
LoadData(A,B,C
Essentially, all it does is allocate a pointer to C sprites from B offset of the file named A, iirc.
Try this in the meantime (THIS WON'T WORK IF YOU HAVE MORE THAN 682 SPRITES):

Open(FILE,"r->D
GetDataPtr(D->PTR
GetSize(D->LEN
Close(D
Str1->S
While LEN
PTR->{S
S+3->S
2+*{PTR}*(*{PTR+1->L
PTR+L->PTR
LEN-L->LEN
End

This should provide the sprite pointers for DefineTilemap(
To start ahead of the start of the file, just add the number of bytes to skip to PTR and subtract them from LEN before the loop

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants