dirkwhoffmann / virtualc64

VirtualC64 is a cycle-accurate C64 emulator for macOS
https://dirkwhoffmann.github.io/virtualc64
Other
356 stars 33 forks source link

EasyFlash Cartridge Support #429

Closed mortinus closed 5 years ago

mortinus commented 6 years ago

Hi, as written by other friends I think it is more correct to open an issue for the support of this cartridge called EasyFlash.

Thank you Bye

https://www.c64-wiki.com/wiki/EasyFlash https://csdb.dk/release/?id=166110 moduleasyflash

MrStargazer commented 6 years ago

I like this tooo !!!

mithrendal commented 6 years ago

there are also loads of other cool EasyFlash Releases.... https://csdb.dk/release/?id=166861 https://csdb.dk/release/?id=165405 https://csdb.dk/release/?id=166168 https://csdb.dk/release/?id=167043 https://csdb.dk/release/?id=164883

but this year Excess released an enhanced and reworked speedball2 version (https://csdb.dk/release/?id=166110) which is outstanding. They back ported graphics and speach synthesis from the Amiga-Version and integrated that into the existing c64 version. They had solved a lot of difficulties to fit all that into the c64 memory. Finally you can hear "ice cream"! EasyFlash Cartrige helped them as it could hold up to 1 Mb of data.

I like to see support for that cartrige file too.

mortinus commented 6 years ago

Uh! @mithrendal ...Great links!

Alessandro1970 commented 6 years ago

I do not know this cartridge well but remember that a friend of mine, in those old days, switched a lever to: 1) upload programs from the floppy disk drive 2) after moving the lever again, from programming mode passed in cartridge mode... The fact is that to load the programs it took 30 minutes to upload to fill the cartridge memory.....

The other button what is it ? Is it a reset ?

mithrendal commented 6 years ago

@Alessandro1970 yeah making these cartriges took time, but loading huge amounts of data and running from a easyflash .crt file is nearly instantly. I tried it out with Vice. With the use of the EF .crt format you could also develop and bypass the constrained amount of memory in the c64 by swapping and temporarily loading massive amounts of data lets say 32Kb in a second. Cool for new apps wich use a lot speach output ! See the releases on csdb.dk many of them were just released in 2018. For multidisk c64-apps with long loading times this cartrige format is a game changer, believe me you will want that !!! ;-)

dirkwhoffmann commented 6 years ago

This cartridge is more complicated than the others and requires a thorough familiarization with the details. I'd also like to see this cartridge supported, but please don't expect it soon.

mortinus commented 6 years ago

...Has EasyFlash Cartridge 3 buttons ?!

img_4276__14919 1336620171 1280 1280

Alessandro1970 commented 6 years ago

EasyFlash 3 buttons The EF3 cartridge has three buttons; MENU, SPECIAL and RESET:

MENU -button always resets into the EF3 menu. The operation of the other two buttons is case sensitive.

SPECIAL -button In EF3 menu, it exits to BASIC (without deactivating the cartridge). In EasyFlash mode, it exits to BASIC (leaving the selected EF slot active). In freezer cartridge mode, it acts as the Freeze -button of the selected cartridge. Other modes: No operation.

RESET -button In EasyFlash mode, resets the selected cartridge. In freezer cartridge mode, acts as the Reset button of the selected cartridge. In KERNAL cartridge mode, resets the machine leaving the selected KERNAL active.

mithrendal commented 6 years ago

I don’t care about the emulation of the three buttons. If it just loads into the EF3 crt file then I would be happy enough.

Alessandro1970 commented 5 years ago

There is also an early but good version with only a button and one switch: the push button on the top of the cartridge is for resetting while the two position switch is used when adding new content to the cart. It has an 1 MB Flash memory which makes it possible to ‘burn’ data to the cartridge using the C64 as no EPROM programmer is needed.

img_2941-600x800

dirkwhoffmann commented 5 years ago

Support should be implemented in two stages:

  1. Add support for pre-programmed cartridges. There is a good explanation in EasyFlash-ProgRef.pdf. http://skoe.de/easyflash/doku.php?id=develdocs

  2. Make ROMs programmable. The EasyFlash cartridge uses flash memory of type AMD 29F040: http://robotics.ee.uwa.edu.au/eyebot/doc/DataSheets/29F040.pdf

Stage 1 shouldn't be too difficult. Stage 2 might be more time-consuming.

mithrendal commented 5 years ago

Nice findings, perhaps it is also possible to peek in the vice implementation and adapt some of the stuff over to virtualc64 ?

https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/cartridge.h https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/c64/cart/easyflash.h https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/c64/cart/easyflash.c

here is a ton of cool resources for that one: csdb.dk release type easyflash

dirkwhoffmann commented 5 years ago

😎

http://www.dirkwhoffmann.de/virtualc64/VirtualC64_EasyFlash.zip

bildschirmfoto 2018-10-25 um 10 24 42
dirkwhoffmann commented 5 years ago

Please not that the (virtual) flash chips are not programmable yet (stage 2 is yet to come). Hence, you cannot use the EasyFlash creator and "burn" virtual EasyFlash cartridges inside the emulator. BTW, why would anyone want to do this? 🤔

dirkwhoffmann commented 5 years ago

"Finally you can hear 'ice cream'". How can I hear that in Speedball 2?

Anyway, I lost 0:102 🤭.

bildschirmfoto 2018-10-25 um 10 51 04
Alessandro1970 commented 5 years ago

rightly @mithrendal wrote here that the resources listed here (CSDB) without easyflash are not utilizable, just for this reason. Otherwise I do not think anyone needs this cartridge to load programs or games faster (saving them on ROMs) since the emulator optimally handles the thing in another way; maybe nostalgic will appreciate anyway.

mortinus commented 5 years ago

Ok it's fine, but for me wuould be more and more useful the StarDOS cartridge... VirtualC64 is fast by itself and the games on easyflash aren't so much...

Alessandro1970 commented 5 years ago

@mortinus the EasyFlash is a revolutionary cartridge, I've never had it but you need it to be able to use at least for the C64-software that is on the net. have you tried the AR 7.5 cartridge? ...instead the Stardos... This cartridge (AR 7.5) has an exceptional fastload, works well with VirtualC64, has many options and commands for managing the disk drive that are very valid and effective: untitled 2

mithrendal commented 5 years ago

Wow, it really works. that is fantastic. How did you manage a 000-102 result ??? Thank you very much !!! I am so happy. That made my day !!!

I just played a very short session and could not see the ice cream cut scene either. Will do a long session on his weekend to celebrate the EasyFlash Support of virtualc64!!

but you can watch the Ice-cream cutscene for the c64 here ... so it should be in this version ... https://www.youtube.com/watch?time_continue=12&v=ztuMxsb85CU

http://www.indieretronews.com/2018/05/speedball-2-ultimate-is-coming-to-c64.html#more

you can read some backgrounds of the overhauled version and some comments about memory limits and why they cannot bring it on disk yet with all the extra image stuff in... https://www.lemon64.com/forum/viewtopic.php?t=67867&start=0

Alessandro1970 commented 5 years ago

If I use these cartridges or I load the same cartridges one after the other several times it hangs, or try several time to drag&drop the same crt on the virtualC64 screen:

schermata 2018-10-25 alle 22 44 18

Error.zip

mmzmken.crt.zip Legacy+Legend-Saxxon.crt.zip

puleyo commented 5 years ago

Also to me some EasyFlash cartridges if put repeatedly or even once just crash the virtualc64

mithrendal commented 5 years ago

easyflash version of geos. pretty cool !!! http://cbm.ficicilar.name.tr/program/15/geos-64-2.1e-kernal-rom-image

image

I dragged first the easyflash geos21e-4108.crt on the vc64 and afterwards the GEOS64.D64 disk

Alessandro1970 commented 5 years ago

Lastninja easyflash in VirtualC64 hangs if loaded more than one time (drag&drop): report.txt

schermata 2018-10-26 alle 23 14 46

Cartridge: The Last Ninja all in one Fix.crt.zip

dirkwhoffmann commented 5 years ago

It's some memory handling issue:

VirtualC64(38583,0x1018ab5c0) malloc: Incorrect checksum for freed object 0x103890200: probably modified after being freed.

I'm not sure about the cause yet. it might be related to the issue that was posted a couple of weeks ago about a crash in high Sierra (I had closed the issue without a fix. Unfortunately, I can't find it in the database any more).

Alessandro1970 commented 5 years ago

the strange thing is that the virtualc64 hangs and closes itself only with some easyflas cartridges, not with all. In fact, if I try with speedball it never occurs. Could this be incompatibility with some cartridges?

Alessandro1970 commented 5 years ago

Can someone run this easyflash cartridge ?

Lemmingsef(FINAL-100pc).zip

dirkwhoffmann commented 5 years ago

It crashes for cartridges with more than 64 chip packets. Embarrassing bug, do not wanna talk about it in detail 🙄. Uploading a fix in a minute ...

dirkwhoffmann commented 5 years ago

http://www.dirkwhoffmann.de/virtualc64/VirtualC64_EasyFlash2.zip

Lemmings doesn't work though. Did you already check in VICE?

Alessandro1970 commented 5 years ago

Yes, in VICE Lemmings EF and Maniac Mansion EF work, VirtualC64 hangs at boot of the easyflash crt.

schermata 2018-10-27 alle 14 24 40 schermata 2018-10-27 alle 14 24 59
dirkwhoffmann commented 5 years ago

OK, thanks, I look into it. Maybe, these CRTs use some of the special bank switching combinations that are declared as "invalid. don't use." in the EasyFlash hardware description. We'll see ...

Alessandro1970 commented 5 years ago

Also Flimbo's Quest (EF) hangs on VirtualC64 FlimbosQuest.crt.zip

schermata 2018-10-28 alle 08 51 04 schermata 2018-10-28 alle 08 53 39
Alessandro1970 commented 5 years ago

Turrican (EF) on VirtualC64 hangs before loading menù Turrican.crt.zip

schermata 2018-10-28 alle 09 09 40
dirkwhoffmann commented 5 years ago

Interesting. At some point in the code, Lemmings writes a 7 into $DE02 which selects 16k game mode. This means that ROML is visible at $8000 and ROMH at $A000. Afterwards, it reads the values from $A000 and $A001 which should come from ROMH. In VirtualC64, the values 78 and A2 are returned which are the values inside the ROM chip. In VICE, 01 and A4 are read. 🤔

Need to find out where 01 and A4 are coming from ...

dirkwhoffmann commented 5 years ago

Now it's clear what happens:

In my log (which I created while running VICE), I found the line: 5023: flash040core_store(0555) AA

If you look at the following table in row "Autoselect", you'll see the values 01 A4 which I didn't know where they come from:

bildschirmfoto 2018-10-29 um 10 52 19

To make a long story short: Lemmings (and presumably the other non-working cartridges) make use of the fact that EasyFlash cartridges contain FlashRoms of type 29F040. To make these games work, the flash Roms have to be emulated properly. I a going to implement it, but it'll take some time (need to read und understand the spec first).

dirkwhoffmann commented 5 years ago

Lemmings turns out to be a valuable test case. Thanks for filing that!

Despite the fact that is reads the manufacture IDs from the FlashRom, it arranges the Rom data inside the CRT file in an unusual way. All EasyFlash .crts which I analyzed so far, mapped the even chip packets to ROML and the odd packages to ROMH. Lemmings is different (e.g., see package 110 and 111) :

bildschirmfoto 2018-11-01 um 09 43 01

I'll have to modify the current EasyFlash CRT loader to copy with that (which isn't difficult though) ...

dirkwhoffmann commented 5 years ago

Correction: EasyFlash seems to use Flash Roms of type Am29F040B, not Am29F040.

easyflashpcb

dirkwhoffmann commented 5 years ago

😎

http://www.dirkwhoffmann.de/virtualc64/VirtualC64_EasyFlash3.zip

bildschirmfoto 2018-11-01 um 15 59 35
Alessandro1970 commented 5 years ago

Now all cartridges work fine!

schermata 2018-11-03 alle 23 26 05
rossimariolee commented 5 years ago

With this new version all my EF cartidges start and work fine.

puleyo commented 5 years ago

Now all my Easyflash cartridges now work fine too.

dirkwhoffmann commented 5 years ago

Fixed in 3.1 which is now online.