After my recently trouble getting this to work and an inordinate amount of patience and help from Memblers and kevtris last night over on #nesdev, I've finally solved the problem.
These are mainly just issues with the Mac OSX build of Nestopia so it may not apply to everyone but I went through so much pain, I'm sharing in the hope that someone else might not have to suffer
1) Nestopia only writes the .SAV file when you QUIT the program. Peculiar to the OSX version, you can close the emulator window without quitting Nestopia. This tripped me up for quite a while.
2) If you clear the SRAM with zeros (00), Nestopia seems to decide that there's no need to output the .SAV file. This could be linked to the next point.
3) The .SAV file is not raw binary data, it's ZIP compressed. To see the actual data in your .SAV file, add ".zip" to the end of the filename and then decompress it. Voila - now you have raw data as written in your code. In this state it's unreadable by Nestopia but you can just recompress the file and then rename it "xxxxxxxx.sav" instead of "xxxxxxxx.zip" and Nestopia will recognise it again.
I checked on the XP version of Nestopia and it saves the .SAV file as raw data. I guess there's an option somewhere but it's not exposed on the OSX version.
These are mainly just issues with the Mac OSX build of Nestopia so it may not apply to everyone but I went through so much pain, I'm sharing in the hope that someone else might not have to suffer
1) Nestopia only writes the .SAV file when you QUIT the program. Peculiar to the OSX version, you can close the emulator window without quitting Nestopia. This tripped me up for quite a while.
2) If you clear the SRAM with zeros (00), Nestopia seems to decide that there's no need to output the .SAV file. This could be linked to the next point.
3) The .SAV file is not raw binary data, it's ZIP compressed. To see the actual data in your .SAV file, add ".zip" to the end of the filename and then decompress it. Voila - now you have raw data as written in your code. In this state it's unreadable by Nestopia but you can just recompress the file and then rename it "xxxxxxxx.sav" instead of "xxxxxxxx.zip" and Nestopia will recognise it again.
I checked on the XP version of Nestopia and it saves the .SAV file as raw data. I guess there's an option somewhere but it's not exposed on the OSX version.