11-21-2018, 10:54 PM
1. Where is used the data parameter on this method :
As I said in one of my previous post, C uses the stack to share parameters between main code and function. Thus xhl (32bit register) is filled with the address of your data.
2.a : It Create a u32 pointer called ptr, with 0x200000+0x1e0000 value. For me, the problem here is that I don't know what is the real value of 0x200000+0x1e0000.
On a NGPC, the cartridge begins at 0x200000. so we initialize the pointer at 0x200000 (start of the cartridge address range) + 0x1e0000 (the offset of your saved data on the cartridge).
This address thus indicate the exact position of your data on the cartridge.
I think that those save/read function in the C framework should be rewritten so they can become bloc related instead of a single address/bloc.
2.b : this pointer should be to the RAM structure that will recieve the data.
2.c : There's no absolute need for this control. None of the official games are doing this. This is only to check if your loaded data are correct (you write this control data, and check if htey are correct when reading your data).
2.d : Same as 2.c. Not really needed, but you can use this to know if you have already used the save function. if the result pointer is null, it means that you don't have data saved on your cartridge.
Loïc
Code:
__ASM(" ld xhl,(xsp+4)");As I said in one of my previous post, C uses the stack to share parameters between main code and function. Thus xhl (32bit register) is filled with the address of your data.
2.a : It Create a u32 pointer called ptr, with 0x200000+0x1e0000 value. For me, the problem here is that I don't know what is the real value of 0x200000+0x1e0000.
On a NGPC, the cartridge begins at 0x200000. so we initialize the pointer at 0x200000 (start of the cartridge address range) + 0x1e0000 (the offset of your saved data on the cartridge).
This address thus indicate the exact position of your data on the cartridge.
I think that those save/read function in the C framework should be rewritten so they can become bloc related instead of a single address/bloc.
2.b : this pointer should be to the RAM structure that will recieve the data.
2.c : There's no absolute need for this control. None of the official games are doing this. This is only to check if your loaded data are correct (you write this control data, and check if htey are correct when reading your data).
2.d : Same as 2.c. Not really needed, but you can use this to know if you have already used the save function. if the result pointer is null, it means that you don't have data saved on your cartridge.
Loïc

