r37549 breaks "21 seconds backup"
Versatile Commodore Emulator
Brought to you by:
blackystardust,
gpz
https://csdb.dk/release/?id=212202 stops working at r37549 - it probably doesnt like the wrong order of dummy stores :/
to run it, use something like:
x64sc -default -ntsc -drive8type 1541 -userportdevice "20" -parallel8 "4" -attach8ro VG\ Datashack\ 21\ Second\ Backup\ v4.1.g64
(attaching ro is important, else it will crash after the title no matter what)
Looks like it might be a DCP instruction under some specific circumstance. Here's the earliest I can find that the value in $1804 differs between Vice 3.4 (working) and Vice 3.5 (not working):
$1804 should contain $09 at that point but it has $fd instead. Immediately prior to the instruction at $0469 the value in $1804/$1805 was the same ($02 $00) in both Vice 3.4 and 3.5. For reference, the timer start value at $1806/$1807 is $0b $00.
Here's what the working version on 3.4 looks like right at that point. Other than the stack pointer, registers/flags are identical:
Attached the 21s_decrypt.prg which is the drive contents between $300-$7ff and entry point at $400. You don't need any disk in the drive and it doesn't matter if you use PAL or NTSC as it takes place entirely in the drive. Make sure no extra drive RAM as mirror addresses are accessed. Monitor commands to get to the point at the start of the trace above are:
dev 8:
l"21s_decrypt.prg"0
r pc=$400
un 564
sw reset
z +11470
To test the entire key derivation loop, set a breakpoint at $5d5 and then look at the contents of $c0-$c4. The key there should be:
$16 $66 $d5 $98 $a5
Last edit: Lord Crass 2023-04-05
@gpz already bisected the problem to commit 37549 which is meant to improve instructions with dummy-stores in the non-sc 6502 (like also used in the disk drives).
In bug #1805 I already noticed a remaining problem. I got a bit side-tracked in fixing the CIA DD0DTEST first. But then I got back at the RMW instructions... unfortunately improving them broke a bunch of vicii (non-sc) tests, because it makes unfortunate assumptions about the timing of read and write cycles.
When I try to use the improved rmw-instructions, then the copy program loads...
Should be fixed now in r43647...