Sprite set memory
1 week 1 day ago #111
by ludojoey
Sprite set memory was created by ludojoey
Hello!
I have a question regarding sprite memory organization.The documentation states that it is possible to define up to 256 sprite images.Since each sprite occupies 256 bytes, that results in a total of 64 KB being used (as indicated in the manual).By default, the memory area used is located in page
and starts at address
, ending at
(page 70).However, this memory range is much smaller than 64 KB...In fact, attempting to execute:
to reinitialize the sprite set results in a "Runtime error".There is clearly something I'm missing here...Could someone please explain how this is supposed to work?Thanks !
I have a question regarding sprite memory organization.The documentation states that it is possible to define up to 256 sprite images.Since each sprite occupies 256 bytes, that results in a total of 64 KB being used (as indicated in the manual).By default, the memory area used is located in page
Code:
0x20
Code:
0x3000
Code:
0xEFFF
Code:
memSet(0x3000,65535,0,0x20)
Please Log in or Create an account to join the conversation.
1 week 12 hours ago #115
by Franck
Replied by Franck on topic Sprite set memory
The limitation comes from the fact that the programmable CPU window (the moveable window of external RAM (XSRAM) the CPU sees) is only 48 KiB.
The the CPU cannot write 64 KiB at a time to the XSRAM. If you attempt to do so, the first 48 KiB will end up in the XSRAM at the specified page, and the rest will be mapped to the fixed area (0x3f000 and up) which includes the VM Stack and system data, hence the crash you experienced.
Page 193 of the manual shows how the mapping works.
To clear the entire 64 KiB of sprite memory you can for example do:
The the CPU cannot write 64 KiB at a time to the XSRAM. If you attempt to do so, the first 48 KiB will end up in the XSRAM at the specified page, and the rest will be mapped to the fixed area (0x3f000 and up) which includes the VM Stack and system data, hence the crash you experienced.
Page 193 of the manual shows how the mapping works.
To clear the entire 64 KiB of sprite memory you can for example do:
Code:
memSet(0x3000,32768,0,0x20);
memSet(0x3000,32768,0,0x40);
The following user(s) said Thank You: ludojoey
Please Log in or Create an account to join the conversation.
1 week 11 hours ago #116
by ludojoey
Replied by ludojoey on topic Sprite set memory
Thanks for the reply !
Yes, with your example it's perfectly clear.
Maybe, in page 70, this example should be added!
Yes, with your example it's perfectly clear.
Maybe, in page 70, this example should be added!
The following user(s) said Thank You: Franck
Please Log in or Create an account to join the conversation.
Time to create page: 0.161 seconds