Hi there,
I'm currently writing a Java based emulator for a 6502 and 6569 as part of an academic project (yes, I know, yet another emulator, boooring
). I have the basic emulation up and running. The C64's Basic comes up but calculates the free memory wrong and reports 38930.6608 free bytes
, I hope I'll find the bug. However, 2 days looking at my code did not reveal the bug so I decided to implement interrupts which brings me to my primary request:
I startet with the raster line interrupt generated by the VIC. It works quite well, but the ISR does not clear the interrupt latch register (0xD019) for some reasons. So I stepped through a kernal listing starting at the IRQ vector 0xFFFE. This should (and does) jump to 0xEA31. There it flashes the cursor (great feeling seeing the cursor flashing in my little buggy java application
), it seems to do something with the tape drive which does not exist yet and scans the keyboard. However, I do not see anything regarding the VIC or clearing its latch register.
The VIC can not be aware of the fact that the processor really served the interrupt and therefore it is not logical that it may clear its latch register by itself to pull the interrupt line high again.
So my question: Where is the register 0xD019 checked and cleared within the ISR? Do I overlook something else?
(If anyone knows how and where the Basic calculates the free bytes I would also appreciate a hint how it can happen that it calculates 38930.6608 free bytes. I assume a small bug in the ISA implementation (flags, e.g. ADC/SBC) which currupts the calculation.)