
How accurate is the emulator Regen in this demo compared to the real Genesis? (I tried several emulators and Regen is the one that sounds good).
Moderator: Mask of Destiny
I find this very interesting, as I would have thought that even this short time is enough to have noticable jitter at 26khz, but nope, the audio sounds perfectly clear.Kabuto wrote:I'm writing 2 samples at once. I mix one sample (-> 16 bits), then use "swap" to shift the word to the upper half of its register, then mix another sample, and then write both at once to z80. I only hog the z80 bus for this short time frame so the z80 code does not get halted for too long which would degrade audio quality (jitter).
That sounds really short O_o ? at least compared to what i observed when i developed Gens (it was more about 40 to 80 68000 cycles as far i remember) but as the emulator was really off on many timings maybe it was one of them :pMask of Destiny wrote:According to the Z80 manual, the bus request line is sampled on the rising edge of the clock at the beginning of the last t-state of an M cycle and busack will go low sometime before the falling edge of the clock on the following t-state. So in the best case, it will take around 1.5 Z80 cycles which is ~3.25 68K cycles which would be effectively instantaneous given the length of a 68K memory cycle. In the worst case, you just miss the sampling point before a 6 t-state m-cycle which would be something like a 7 Z80 cycle delay. That translates to 15 68K cycles.
Of course this assumes the Z80 manual is correct (which is questionable given some of the obvious errors in other parts) and ignores any propagation delays created by the Genesis bus arbiter hardware. I should probably measure it at some point.
Even if it was 80 cycles, it's only 20 to store a long from memory, and another 12 to release the Z80... meaning at most 112 cycles, or 68 kHz jitter. Like I said, a rough calculation of worst case jitter is well above the hearing threshold.Stef wrote:That sounds really short O_o ? at least compared to what i observed when i developed Gens (it was more about 40 to 80 68000 cycles as far i remember) but as the emulator was really off on many timings maybe it was one of them :pMask of Destiny wrote:According to the Z80 manual, the bus request line is sampled on the rising edge of the clock at the beginning of the last t-state of an M cycle and busack will go low sometime before the falling edge of the clock on the following t-state. So in the best case, it will take around 1.5 Z80 cycles which is ~3.25 68K cycles which would be effectively instantaneous given the length of a 68K memory cycle. In the worst case, you just miss the sampling point before a 6 t-state m-cycle which would be something like a 7 Z80 cycle delay. That translates to 15 68K cycles.
Of course this assumes the Z80 manual is correct (which is questionable given some of the obvious errors in other parts) and ignores any propagation delays created by the Genesis bus arbiter hardware. I should probably measure it at some point.
Well, 3.25-15 68K cycles is just the time from the write to busreq until busack changes. Realistic 68K code to set busreq and wait for busack will be longer than that and as mentioned there may be other delays introduced by hardware in between the 68K and the Z80's busreq/busack lines.Stef wrote:That sounds really short O_o ? at least compared to what i observed when i developed Gens (it was more about 40 to 80 68000 cycles as far i remember) but as the emulator was really off on many timings maybe it was one of them :p
Yeah indeed 112 cycles is not enough to be noticeable, hopefullyChilly Willy wrote: Even if it was 80 cycles, it's only 20 to store a long from memory, and another 12 to release the Z80... meaning at most 112 cycles, or 68 kHz jitter. Like I said, a rough calculation of worst case jitter is well above the hearing threshold.
Code: Select all
; interrupt start
bclr #0, $a11100 ; unpause z80, Z flag will tell whether it has been paused
move.w sr, -(a7) ; push Z flag to stack, we don't need it right now
...interrupt code...
move.w (a7)+, sr ; get Z flag back
bne.s @rte\@ ; if it's set, the z80 was running upon IRQ entry, so no action needed
move.w #$100, $A11100 ; if it was clear it was paused, so pause it again
@rte: rte