Boray wrote:Mike: Is it really possible to set the timers for such a tiny interval?
Yes, that's entirely possible. The SID Vicious Emulation, for example, uses an NMI at a rate of ~6 kHz.
You'd use Timer 1 of VIA #2, controlling the IRQ. The low- and high byte are located in $9124 and $9125, respectively, and need to be written in that order to copy the period into the latch.
The value you need to write to the Timer 1 latch then is:
value := 1108405/rate - 2 for PAL or
value := 1022727/rate - 2 for NTSC.
The interrupt server should not end with the 'normal' exit to $EABF, because you really won't want to scan the keyboard 6000 times a second.

Rather the keyboard can be left disabled while the sample plays, and the interrupt routine should just acknowledge the IRQ at the end and exit. That's most easily done with JMP $EB15.
It is not necessary to save the A, X and Y registers at the beginning of your own interrupt service routine, as this has already been done by the KERNAL before - and the routine at $EB15 equally well restores them.
It's a pity though, that it is not possible to map out the KERNAL ROM so the hardware IRQ vector on the VIC-20 could be changed through a value in RAM (like it is possible on the C64). The forced saving and restoring of the registers needs a lot of cycles, while the Flag byte I mentioned earlier could easily be set without touching any registers (with SEC:ROR Flag, for example) ...
