randyrossi / bmc64

A bare metal Commodore 64 emulator for the Raspberry Pi with true 50hz/60hz smooth scrolling, low input latency and better audio/video sync.
GNU General Public License v3.0
473 stars 56 forks source link

FR: Flush Disk/Cartridge option #177

Closed Kugelblitz360 closed 3 years ago

Kugelblitz360 commented 3 years ago

As you are considering a new release based on 3.7, may I respectfully ask again for a menu option that will flush the current inserted disks AND easyflash cartridge back to SD storage, and that this "flush" command ideally is mappable to a controller or GPIO button? That would make BMC64 so much more usable in scenarios where you are not just running a simple game. Thank you so much for your consideration. Boris.

randyrossi commented 3 years ago

I tried adding this recently and I found no flush function in VICE. So I'd have to unmount and mount the same disk image which is a bit more involved as the code currently doesn't remember what is mounted . I'll try to see what I can do.

On Mon, May 31, 2021 at 6:21 PM Kugelblitz360 @.***> wrote:

As you are considering a new release based on 3.7, may I respectfully ask again for a menu option that will flush the current inserted disks AND easyflash cartridge back to SD storage, and that this "flush" command ideally is mappable to a controller or GPIO button? That would make BMC64 so much more usable in scenarios where you are not just running a simple game. Thank you so much for your consideration. Boris.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/randyrossi/bmc64/issues/177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3HKFT3U56RNYUHFQHBWTTQQDVNANCNFSM453RFSZQ .

-- Randy Rossi

Kugelblitz360 commented 3 years ago

Wow - I never realized that Vice really has NO option to flush a drive mid-term. The D64 is only updated to storage on disk change and/or shutdown. Simply reattaching the current disk image works though - if the D64 in RAM is "dirty" it is written back. So basically flushing a disk is just remounting it (no need to unmount it first!). Vice must remember the name of the currently mounted image because in a proper shutdown it is written back. Hope you can find where they store that value... :-)

In the Vice 3.5 GTK UI I can see a specific flush function for Easyflash in the settings. (Settings/Cartridges/Easyflash - next to the "Save Image when changed" option - that also shows you if the image in emulator memory is "dirty" - then the option is grayed out, it only is available when the EF has changed, so most likely you can call that one.) Remounting won't work here, simply because a cartridge mount always resets the machine. Again, THANK YOU for your investigations and efforts!

Kugelblitz360 commented 3 years ago

Oh, doesn't this code snippet in vdrive.c suggest a flush function? vdrive is the code for all virtual disk drives, isn't it?

/* called to flush out attached images */
void vdrive_flush(unsigned int unit)
{
    vdrive_t *vdrive;

#ifdef DEBUG_DRIVE
log_debug("VDRIVE: flush unit %u", unit);
#endif

    vdrive = file_system_get_vdrive(unit);

    if (!vdrive) {
        return;
    }

    /* flush current bam */
    if (vdrive->bam) {
        vdrive_bam_write_bam(vdrive);
    }
}
randyrossi commented 3 years ago

What version of VICE is that from? I don't see that code in 3.3 (or 3.4 or 3.5)

On Tue, Jun 1, 2021 at 6:16 AM Kugelblitz360 @.***> wrote:

Oh, doesn't this code snippet in vdrive.c suggest a flush function? vdrive is the code for all virtual disk drives, isn't it?

/ called to flush out attached images / void vdrive_flush(unsigned int unit) { vdrive_t *vdrive;

ifdef DEBUG_DRIVE

log_debug("VDRIVE: flush unit %u", unit);

endif

vdrive = file_system_get_vdrive(unit);

if (!vdrive) { return; }

/ flush current bam / if (vdrive->bam) { vdrive_bam_write_bam(vdrive); }

}

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/randyrossi/bmc64/issues/177#issuecomment-852007145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3HKHFSNLBY3SBB34XGDTTQSXPDANCNFSM453RFSZQ .

-- Randy Rossi

Kugelblitz360 commented 3 years ago

https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/vdrive/

randyrossi commented 3 years ago

Looks like that was added in Jan of this year so not in BMC64's version of vice unfortunately. I'm not sure if it's released in any version yet, actually.

On Tue, Jun 1, 2021 at 10:01 AM Kugelblitz360 @.***> wrote:

https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/vdrive/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/randyrossi/bmc64/issues/177#issuecomment-852149763, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3HKB5JS443YGLKS2NXL3TQTRZZANCNFSM453RFSZQ .

-- Randy Rossi

Kugelblitz360 commented 3 years ago

I see. Well, just remounting the current image should be a stopgap solution.

Kugelblitz360 commented 3 years ago

You are a hero, thank you!