Menu

#2036 x64 initializes (clears) memory on first manual reset

v3.x
closed-fixed
gpz
None
x64
2024-06-01
2024-05-18
No

Hi,

Subject: x64 initializes (clears) memory on first manual reset

Using x64 - the first time you manually reset (reset machine CPU) - the memory is initialized and filled with power-up $00/$ff patterns.
It only happens at the first manual reset - any subsequent resets works as intended.
This problem is related to x64 only (both GTK and SDL) - not x64sc
Running Archlinux - building from latest sources
My suggestion to a fix would be this patch - but there may be better solutions - that is why I did create this bug as a patch request.

Kind regards Uffe

--- src/c64/c64.c
+++ src/c64/c64.c
@@ -1459,7 +1459,7 @@ void machine_change_timing(int timeval, int powerfreq, int border_mode)

     rsuser_change_timing(machine_timing.cycles_per_sec);

-    machine_trigger_reset(MACHINE_RESET_MODE_POWER_CYCLE);
+    machine_trigger_reset(MACHINE_RESET_MODE_RESET_CPU);
 }

 /* ------------------------------------------------------------------------- */

Kind regards Uffe

Discussion

  • gpz

    gpz - 2024-05-31

    That patch is not the right thing to do - it will have unwanted side effects (it really should do a power cycle after changing machine timing). Since it would affect both x64 and x64sc, it cant be applied like this. The question is rather, why x64 calls machine_change_timing on the first manual reset.

    Solution: use x64sc :)

     
  • gpz

    gpz - 2024-05-31

    That said, could you please tell what exactly the problem is (and how to reproduce it)? I tried in x64 and xvic and x128 and they all seem to behave as expected.
    edit:nvm, got it now

     

    Last edit: gpz 2024-05-31
  • gpz

    gpz - 2024-05-31

    ok, please try r45176

     
  • Uffe Jakobsen

    Uffe Jakobsen - 2024-05-31

    Now x64 works as expected.
    The newly changed code is also more logical compared to the old approach
    Thanks :-)

     
  • gpz

    gpz - 2024-05-31

    cheers :)

     
  • gpz

    gpz - 2024-05-31
    • status: open --> closed-fixed
    • assigned_to: gpz
     
  • Daniel Kahlin

    Daniel Kahlin - 2024-06-01

    I think this broke mem init when having a default attached cartridge.

    1: Start with x64sc -default
    2: attach a RetroReplay cartridge and set as default
    3: save config
    4: close x64sc
    5: restart x64sc

    Memory now contains a pattern that doesn't respect the configured RAM Reset Pattern.

     

Log in to post a comment.