6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Oct 04, 2024 9:17 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Apr 15, 2009 8:03 am 
Offline

Joined: Sat Apr 11, 2009 6:20 pm
Posts: 2
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 :P). 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 :D, 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 :D), 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.)


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 15, 2009 3:53 pm 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 325
Moepi wrote:
Where is the register 0xD019 checked and cleared within the ISR?


If my memory can be trusted, the answer is "it isn't". The kernel uses CIA timer interrupts, not VIC raster interrupts.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 15, 2009 5:12 pm 
Offline

Joined: Sat Apr 11, 2009 6:20 pm
Posts: 2
Hmm ok, I think i was misleaded by write access to 0xD012 and 0xD011 which led me to the conclusion a raster line interrupt would have been set up. In fact this is only the raster line number which would cause the interrupt if the corresponding bit (0) in the interrupt request register 0xD019 is set. However, the kernal initializes this register with 0. Therefore all interrupts originating from the VIC are disabled by default.

No more blinking cursor anymore until I have the CIA... :(


Thanks very much. The memory problem is still not solved...



Edit: Cursor is blinking again, now with a CIA (:

Edit2: Just to update this thread:
The basic emulation is working. KERNAL and BASIC boot, keyboard interaction is working very well. However, rendering is quite slow (about 45fps @ 1920x1200 without filtering, but no OpenGL yet). Currently I'm updating my code and writing for my seminar (for which I started to work at the emulator at all).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: