Quote:
(Is the 6502 model cycle accurate in the sense, say, that a taken branch will take 3 cycles?)
Yes I tried to make the MCL65+ cycle accurate and included the extra clocks, fetches, and double write-backs as well as most of the undocumented opcodes. It's all simple C code, so in theory it can be massaged into a cycle-exact emulator. (Will probably need this forum's help to achieve that!).
I need to upload the code to GitHub, but I have less then two hours of uptime and I want to clean it up before posting.
One challenge I encountered was that the simple 10 a=a+1, 20 print a, 30 goto 10 program randomly stops due to a "Syntax Error on line 10". The VIC20 does not crash, it simply stops the program with this error.. and it does so randomly... sometimes after 200 iterations.. sometimes 1000... If I just print "Hello World" in this tight loop it never fails...
I believe it is caused by the "math". (happens if I do a=a+1 or a=a-1), and possibly something related to the flags and/or the stack and interrupts... I suspect that while the code is running an interrupt occurs which pushes the flags recently generated by the math, but the flags are not restored correctly upon RTI... This is just a guess!