Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Easyflash save feature #137

Open
mambrino opened this issue Aug 19, 2022 · 29 comments
Open

Feature request: Easyflash save feature #137

mambrino opened this issue Aug 19, 2022 · 29 comments

Comments

@mambrino
Copy link

mambrino commented Aug 19, 2022

Easyflash specifications allows to save data on the cartridge (has 1KB SRAM with 256 bytes available and mapped to I/O $DF00-$DFFFF).
This is used more and more in new releases, so, it would be great to support the feature.

These are some games and apps that make use of save functionality, p.e:

https://csdb.dk/release/?id=156948
https://csdb.dk/release/?id=98674

@sorgelig
Copy link
Member

i can try to add. Just need more technical info. I believe it's not mapped all the time and requires some register to enable/disable

@sorgelig
Copy link
Member

sorgelig commented Aug 20, 2022

image
are you talking about this RAM? It's 256 bytes only. No mention about 1KB paged RAM. There is no mention it's battery backed RAM.

@mambrino
Copy link
Author

are you talking about this RAM? It's 256 bytes only. No mention about 1KB paged RAM. There is no mention it's battery backed RAM.

the c64 wiki (https://www.c64-wiki.com/wiki/EasyFlash) says that it has an 8 KiB SRAM installed but only 256 bytes are available.
It doesn't mention anything about battery backed either, and on the pcb you can't see the battery anywhere, but it must have to keep content when disconnected, no?

@mambrino
Copy link
Author

mambrino commented Aug 20, 2022

i can try to add. Just need more technical info. I believe it's not mapped all the time and requires some register to enable/disable

Here is the complete repository for EasyFlash with hardware folder including schematics and components bom list (here however says that it's a 64Kbits 6264 SRAM for EasyFlash v1 and 256kbits AS6C62256-55STC SRAM for EasyFlash v3, both cartridges has power pin connected to vdd, nothing about battery backed anywhere):

https://bitbucket.org/skoe/easyflash/downloads/

@sorgelig
Copy link
Member

I don't think this RAM is used for saves. It's rather RAM extension.

@mambrino
Copy link
Author

mambrino commented Aug 20, 2022

Easyflash programmer's guide clearly indicates "it can be used to save small portions of code or data", in addition, it's a fact that games like Caren and the Tangled Tentacles, Zak McKracken and Sam's Journey, have an option or key to save the game to cartridge.
There are others like Epyx Game Collection that use this memory to save records, but also in the main menu there is a tool to dump data from EF to disk and vice versa. (https://csdb.dk/release/?id=107705)
Since there isn't battery that can keep the data when the computer is turned off, probably, what the original hard does is to dump the cartridge content back to the filesystem (just the sram i guess). I think that's what other fpga like ultimate II/64 does to save the data.

@paich64
Copy link

paich64 commented Aug 27, 2022

as stated on https://skoe.de/easyflash/efintro/ :
"HOW DOES EASYFLASH WORK?
EasyFlash is an 1 MByte Flash EPROM cartridge with multiple configurations and banks possible. It does not use traditional UV-EPROMs, but Flash memory. This makes it possible to “burn” the cartridge using your C64, no EPROM programmer is needed."
and on http://skoe.de/easyflash/recommended/ :

"Saving features mentioned here means saving to flash. If a game has e.g. a high score saving, the game saves the scores directly to the cartridge flash.

A Backup/Restore feature means that the saved data can be exported to disk and imported back to EasyFlash cartridge. This is very useful if you have a cartridge with e.g. saved high scores. You are then able to rewrite the EasyFlash cartridge, and restore the saved data later on."

here is the programmer guide https://skoe.de/easyflash/files/devdocs/EasyFlash-ProgRef.pdf

@theenemy-thd
Copy link

+1 for this option .... more and more games are being released on easyflash these days and my group will be releasing more versions of old games converted to run on easyflash with save support for high scores etc. If more info is required on the tech side of saving then please ask and I can ask Mike/knight rider who does the easyflash conversions

@mambrino
Copy link
Author

mambrino commented Feb 15, 2023

A Pig Quest

Another game released (a big one) in CRT Easyflash format where progress needs to be saved to the cartridge in order to continue.

There are more and more releases of this type, because due to the size of the game it is not possible to distribute it in floppy disk format.

Please, it would be appreciated if this functionality is added to the core.

@Schermobianco
Copy link

+1 for this option, thanks guys

@sorgelig
Copy link
Member

saving is not trivial as it needs emulation of flash memory erase/write cycles.

@theenemy-thd
Copy link

saving is not trivial as it needs emulation of flash memory erase/write cycles.

I think how the ultimate 64 gets around it is it allows you in the menu to resave the whole easyflash file in memory, which then includes the highscores etc when reloaded.

Kungfu flash does something different for saving easyflash I think or maybe the same but just overwrites the original file

@mambrino
Copy link
Author

it could even be an automatic process, just like saving sram on console cores. When the menu opens it could automatically dump the entire easyflash area back into the crt file, wouldn't that be possible?

@sorgelig
Copy link
Member

it has nothing to do how much of cart will be saved.

@theenemy-thd
Copy link

So it can't be done then?

@jedcooper
Copy link

+1 for this option, thanks

@sorgelig
Copy link
Member

there are 2 issues:

  1. need to emulate flash erase/write commands - should be no problem
  2. since there is no dedicated storage for saves, any part of cart can contain saves. Thus entire cart must be saved. With size of 1MB it can take a lot of time...

@mambrino
Copy link
Author

mambrino commented May 22, 2023

can't be updated only the part of the crt file that corresponds to the 1kb sram area (mapped at $DF00-$DFFFF)? from what i understood, saves will be always in this memory bank.

@sorgelig
Copy link
Member

SRAM on easyflash is not battery powered as i know. So it cannot hold saves between power cycles.

@mambrino
Copy link
Author

mambrino commented May 22, 2023

of course, that's why I tell you to dump that memory area to the crt file when a change occurs, which I suspect is what the original hardware does, since it doesn't have a battery to store between power cycles. Maybe I'm not getting it right, but it seems the only way to do it.

@sorgelig
Copy link
Member

Original HW has no CPU/MCU on cart and cannot copy anything internally.

@theenemy-thd
Copy link

When you say "takes a lot of time", I dont think anyone who wants this feature would mind a 5 to 15 second delay on exiting back to menu and it saving.

couldnt it be done as a on/off option for easyflash save for those who dont care for save .. then it wouldnt effect those individuals.

there are 2 issues:

  1. need to emulate flash erase/write commands - should be no problem
  2. since there is no dedicated storage for saves, any part of cart can contain saves. Thus entire cart must be saved. With size of 1MB it can take a lot of time...

@sparkysanxion
Copy link

+1 for this feature if it's possible.

it's kinda the only thing holding me back fromn the mister being my main c64 machine at the mo.
Also +1 for not particularly caring for the save write times too.

Great core tho. brilliant stuff.

@theenemy-thd
Copy link

Totally agree sanxion, this feature would basically make the mister my goto for c64 ... until then I have to boot my u64 up

@theenemy-thd
Copy link

Sorry to bang on about this ... but more easyflash games have now been released with saving of progress in game.

Briley witch chronicles 2, space station 23 and yeti mountain

Not having the saving is becoming more of an issue as more easyflash saving games get released.

@mambrino
Copy link
Author

Original HW has no CPU/MCU on cart and cannot copy anything internally.

There is no RAM or battery to keep the data, nor does it need a CPU to do so, what the original cartridge does is flashing the eeprom to update the save data area (256 bytes mapped to I/O $DF00-$DFFFF).

as stated by paich64 this howto has info about the process: https://skoe.de/easyflash/efintro/

"HOW DOES EASYFLASH WORK?
EasyFlash is an 1 MByte Flash EPROM cartridge with multiple configurations and banks possible. It does not use traditional UV-EPROMs, but Flash memory. This makes it possible to “burn” the cartridge using your C64, no EPROM programmer is needed."

"Saving features mentioned here means saving to flash. If a game has e.g. a high score saving, the game saves the scores directly to the cartridge flash.

A Backup/Restore feature means that the saved data can be exported to disk and imported back to EasyFlash cartridge. This is very useful if you have a cartridge with e.g. saved high scores. You are then able to rewrite the EasyFlash cartridge, and restore the saved data later on."

@theenemy-thd
Copy link

The above is not actually correct as the save can be in any 64kb sector of the file hence why a full copy from memory to file would be needed. People don't adhere to keeping the saves to a particular part of the easyflash

@sparkysanxion
Copy link

Was just going to add (and I know nothing of the technicalities of why/how).... but the way it works on an kung-fu flash on real harware (for those that have not used one) is, when you hit the menu button to go back, if 'something' has changed, it prompts you to overwrites the full .crt file on the sd card, or not.

@sorgelig
Copy link
Member

I keep in my mind this feature. So i will implement it when i'll find some good ideas of implementation.

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

No branches or pull requests

7 participants