(Using “x64sc.exe” from GTK3VICE-3.8-win64-r45202 under Windows 11)
(Possibly related to ticket #2502, and thus helpful for analyzing)
When triggering an CIA timer interrupt as fast as possible by setting the start value of timer A to $0000 and starting the timer, VICE will execute only one more opcode before jumping to the interrupt handler, while a real C64 (and "xscpu64.exe") executes two more opcodes.
This behaviour is reproducible by running the following routine with “x64sc.exe”:
LDX #$FF ; avoid VIC badlines
@A: CPX $D012
BNE @A
INX ; X=$00
STX $DC0E ; halt timer A of CIA 1
STX $DC05 ; set timer A start value to $0000
STX $DC04
LDX #$0E ; let IRQ vector point to RTI opcode in Kernal ROM
STX $0314
LDX #$F0
STX $0315
LDA #$5B ; character code 91 (cross)
LDX #$19 ; start timer A of CIA 1
STX $DC0E
STA $0400 ; write character code 91 to first location of video RAM
STA $0401 ; ... and to second location
STA $0402 ; ... and to third location
RTS ; return to calling function
You can easily try this out by running the following BASIC program both with VICE and with the real hardware:
10 FOR N=0 TO 43:READ D:POKE 49152+N,D:NEXT
20 DATA162,255,236,18,208,208,251,232,142,14,220,142,5,220,142,4,220,162,14,142
30 DATA20,3,162,240,142,21,3,169,91,162,25,142,14,220
40 DATA141,0,4,141,1,4,141,2,4,96
40 SYS49152
On a real C64, two crosses (character code 91) will show up in the upper left corner of the screen.
With VICE, only one cross appears (see attached screenshot).
Did you verify that VICE is configured to emulate the same CIA model that your real C64 has? IIRC they differ slightly in their interrupt timing.
Last edit: Ingo Korb 2024-07-17
are you sure this isn't a difference caused by old vs new CIA?
yup:
x64sc -model c64 bug2055.prg ->two crosses
x64sc -model c64c bug2055.prg -> one cross
(c64 implies old cia here, c64c new cia)
my c64c (with new cia) -> one cross
so its all fine :)
Last edit: gpz 2024-07-17
... and my real C64 is the "classic" model - thus the corresponding VICE emulation behaves correctly.
Strange - pasting the basic program into x64sc gives me multiple crosses no matter what model I specify... I guess I must have missed some important detail here :-)
not using the original kernal perhaps? shrug
No - I was using the wrong basic test program from bug #2052 :-D
OOOPS :D
ok closing here :)