I am unable to get even a disk directory reliably with 1950 commented out. If I put it back in it works the same as it did before, so in my case it makes it worse.
From an emulation standpoint the CIA needs to be cycle exact to the CPU, and typically with sub-cycle accuracy. So certain things like the fact that CIA timers actually start 1us after they are told to start have to be duplicated correctly. The delay in the IEC can be up to several seconds long, depending on what operation the disk drive is doing. How a IEC device works should have absolutely no affect on how the IEC bus on the C64 works. I have not looked at the relationship between the CIA emulation and the CPU emulation in the Teensy64 source code. These have to be "locked" by a common cycle clock. It's the only way to emulate this correctly.
With my 1541 emulator (uDrive) I run the CPU instruction clock as an interrupt. When an instruction is fetched, a large lookup table jumps to the proper code to handle the instruction. The first thing that the code to handle the instruction does is to poke in a new value for the instruction clock. This would be 2us for a NOP, 4us for STA $xxxx, etc. Instructions where a page boundary is crossed will increment the clock by 1us. When done, the interrupt exits to the main loop. The CPU instruction interrupt will re-trigger when the clock time set by the last instruction look up expires. I also have the VIAs in emulations also trigger interrupts when necessary (based on the control reg). This method keeps everything synchronized. Otherwise, polling in the main loop would be required and that gets messy.
From an emulation standpoint the CIA needs to be cycle exact to the CPU, and typically with sub-cycle accuracy. So certain things like the fact that CIA timers actually start 1us after they are told to start have to be duplicated correctly. The delay in the IEC can be up to several seconds long, depending on what operation the disk drive is doing. How a IEC device works should have absolutely no affect on how the IEC bus on the C64 works. I have not looked at the relationship between the CIA emulation and the CPU emulation in the Teensy64 source code. These have to be "locked" by a common cycle clock. It's the only way to emulate this correctly.
With my 1541 emulator (uDrive) I run the CPU instruction clock as an interrupt. When an instruction is fetched, a large lookup table jumps to the proper code to handle the instruction. The first thing that the code to handle the instruction does is to poke in a new value for the instruction clock. This would be 2us for a NOP, 4us for STA $xxxx, etc. Instructions where a page boundary is crossed will increment the clock by 1us. When done, the interrupt exits to the main loop. The CPU instruction interrupt will re-trigger when the clock time set by the last instruction look up expires. I also have the VIAs in emulations also trigger interrupts when necessary (based on the control reg). This method keeps everything synchronized. Otherwise, polling in the main loop would be required and that gets messy.
Last edited: