Search found 2 matches: Bfile_GetBlockAddress
Return to: Mapping a file to memory
- Mon May 16, 2016 9:41 pm
- Forum: Casio Prizm SDK
- Topic: Mapping a file to memory
- Replies: 55
- Views: 429847
Re: Mapping a file to memory
SimonLothar wrote:Hint: If you open a G3A in readwrite mode (3) and use 0x1DAA beyond the last block (in this case 0x1DAA returns -2), the G3A vanishes from the main menu!
Do you have any idea why this happens? Does it vanish until the next reboot? If yes, is there any way to bring the g3a back without rebooting? Sorry for all the questions but this is kind of important for the add-in disabler AmazoNKA was talking about, which I could never get to work in a stable way, because of how poorly the OS handles operations on g3a files.
SimonLothar wrote:You are right: The automatic optimization seems to be a serious problem.
Not so bad as having to deal with TLB restore when the add-in is left. It's a part that actually scares me: some years ago, a user at Cemetech was investigating how the MMU, TLB and exception handling worked on the Prizm. He wanted to add support for dynamic libraries on the Prizm (like DLLs on Windows and SOs on Linux), so people could use code under the GPL license in programs with less restrictive licenses (BSD, MIT, etc.), and most importantly, reuse code between add-ins (to waste less storage space). He made a custom exception handler which worked, but the exception handling settings of the CPU must be restored to their original state before returning to the Casio OS, or it will malfunction. Well, he bricked his calculator because of a series of complications that started when he forgot to reset the MMU and TLB settings to their original values. His (unfinished) work is here: https://github.com/AHelper/ld-prizm
That hopefully explains my emphasis on getting memory mapping to work through OS facilities, which would hopefully not self-destroy themselves. Alas, it seems such a thing doesn't exist. But Bfile_GetBlockAddress is already a quite good outcome, which will save people the work of reading the FAT data structures by hand to achieve the same effect.
- Mon May 16, 2016 9:21 pm
- Forum: Casio Prizm SDK
- Topic: Mapping a file to memory
- Replies: 55
- Views: 429847
Re: Mapping a file to memory
The interface is int Bfile_GetBlockAddress( int handle, int offset, int*address );.gbl08ma wrote:Of all the syscalls you listed, the one that sounds more promising for generic use is 0x1DAA...
handle: file handle, opened in readonly mode (1)
offset: block offset (0, 0x1000, 0x2000, 0x3000...)
*address (on return): block pointer
Hint: If you open a G3A in readwrite mode (3) and use 0x1DAA beyond the last block (in this case 0x1DAA returns -2), the G3A vanishes from the main menu!
You are right: The automatic optimization seems to be a serious problem.
- Search found 2 matches • Page 1 of 1
