AYe AYe...

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: AYe AYe...

Post by sirmorris »

Pardon me, I thought you were referring to the video :oops:

The previous attempt had a naive mixer which tied all outputs together, using a capacitor to remove any DC offset, and a resistor to ground to provide some biasing. I think this is fundamentally wrong, and rests upon the assumption that the outputs are open collector.

The new version uses the mixer circuit presented by another team. It is more sophisticated, providing a stereo mix. http://hw.speccy.cz/ayinterface.html

I hope to credit the work of the people before me, such as zilogator and mdv.

C
Slipstreem
Posts: 21
Joined: Sun Jul 31, 2011 1:02 am

Re: AYe AYe...

Post by Slipstreem »

Assuming that we're talking about the AY-3-8910, the datasheet specifies the analogue outputs as though they're current-limited voltage sources with a maximum voltage swing of 0 to +1V and a maximum source current of just 2mA. That means that the absolute minimum resistive load per output should never be below 500R or the output is likely to saturate before it can reach 1V, and this may lead to audible clipping of the output.

With reference to the 'Simple AY Interface' circuit linked to in the post above, I'd be inclined to increase all of the resistor values in the analogue output network slightly (470R -> 620R, 1K -> 1K3, 1K6 -> 2K2) to ensure that the outputs can achieve their full 1V swing without driving into saturation. Raising the values also ensures that the series/parallel combinations of resistive load seen by each output through the mixer network as the other outputs swing up and down always stays above 500R.

Adding 1n2 capacitors from the final left and right output mixing resistors to ground as simple lowpass filters would also attenuate any residual 1.625MHz clock signal on the outputs by around 20dB whilst leaving the audio band largely untouched with only around 1.5dB of attenuation at 20kHz. This would make the analogue outputs 'friendlier' to budget amplifiers that may not have any RF filtering of their own on their inputs.

The output impedance would still be plenty low enough to drive typical 47K input impedance line-level inputs just fine without the need for additional buffering, and you may actually end up with slightly more output than you had before if this allows the output pins to swing a little further.

...assuming that I'm interpreting the datasheet correctly, that is. If not then I apologise in advance for wasting your time and components. :P
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: AYe AYe...

Post by sirmorris »

Thanks for looking at that - I'll try this out on the next proto and let you know how I get on!

The analogue side of things is a mystery to me - I only really cobble ttl together :)

C
User avatar
BrunoFlorindo
Posts: 290
Joined: Sat May 10, 2008 2:46 am
Location: Anaheim, CA, USA

Re: AYe AYe...

Post by BrunoFlorindo »

I would like to see some of the AY files from project AY (http://www.worldofspectrum.org/projectay/) adapted to be used on the ZXPand. They could be used as Music demos and it would attract even more people to the ZXPand.

I'm very tired right now so forgive me if this question was already answered. Since one of the undocumented features of the AY is digital sample playback and the ZXPand now as an AY, can we make the ZX81 "talk"? Can we make it play a short 4-bit-quality audio file using a 11025Hz raw, unsigned 8-bit mono WAV file as the starting point?

Here's the WAV AY player code created by Matt Wescott which has been successfully used on faster Sinclair computers. Please let me know if this can be modified to be used on the ZX81:

Code: Select all

; sample player
; need 317 tstates per sample

	org 32768
	
	ld hl,33000	; start address of sample data
	ld bc,20007	; length of sample data, in bytes
	push bc
	
	ld a,7			; set bits 0-5 of AY register 7 so that all channels are fixed at 'high'
	ld bc,0xfffd	; output - this way the AY is not generating waveforms of its own, and
	out (c),a		; varying the volume (channels 8/9/10) creates our own wave output instead
	ld a,63
	ld b,0xbf
	out (c),a

	pop bc
	di			; disable interrupts, so that they don't mess with our carefully planned timings

samplelp
	push bc		; 11

	; get low 4 bits to use as the first volume level
	ld a,(hl)	; 7
	and 0x0f	; 7

	; delay 117ish tstates
	ld b,8		; 7
zzz2	djnz zzz2
	
	; output that volume level to channels 8/9/10
	ld bc,0xfffd	; 10
	ld d,8		; 7
	out (c),d	; 12
	ld b,0xbf	; 7
	out (c),a	; 12
	inc d		; 4
	ld b,0xff	; 7
	out (c),d	; 12
	ld b,0xbf	; 7
	out (c),a	; 12
	inc d		; 4
	ld b,0xff	; 7
	out (c),d	; 12
	ld b,0xbf	; 7
	out (c),a	; 12
	
	; get the next volume level from the high 4 bits
	ld a,(hl)	; 7	; start tstate count here
	srl a		; 8
	srl a		; 8
	srl a		; 8
	srl a		; 8

	; delay 152ish tstates
	ld b,11		; 7
zzz1	djnz zzz1
				; 8

	; output that volume level to channels 8/9/10
	ld b,0xff	; 7
	ld d,8		; 7
	out (c),d	; 12
	ld b,0xbf	; 7
	out (c),a	; 12
	inc d		; 4
	ld b,0xff	; 7
	out (c),d	; 12
	ld b,0xbf	; 7
	out (c),a	; 12
	inc d		; 4
	ld b,0xff	; 7
	out (c),d	; 12
	ld b,0xbf	; 4
	out (c),a	; 12
	
	; move on to next byte
	inc hl		; 6
	
	; loop if we haven't reached the end of the sample
	pop bc		; 11
	dec bc		; 6
	ld a,b		; 4
	or c		; 4
	jr nz,samplelp	; 12

	ei
	ret
Slipstreem
Posts: 21
Joined: Sun Jul 31, 2011 1:02 am

Re: AYe AYe...

Post by Slipstreem »

sirmorris wrote:Thanks for looking at that - I'll try this out on the next proto and let you know how I get on!
You're most welcome. I'll be using an AY-3-8910 in my one-off PortaZed project, so I had to do the necessary research anyway as I don't plan on building it twice. :D
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: AYe AYe...

Post by Andy Rea »

Bodgery complete :D
Image

way back when i toyed with Spectrum :geek: i used this http://www.worldofspectrum.org/infoseek ... id=0012090
to create musics.
and this http://www.worldofspectrum.org/infoseek ... id=0008708
to merge the player and music together, you then called the player ever 1/50th second from your interrupt routine.

can't remeber 100% now but i think there was a few other addresses that you could call to start/stop/reset the music.

i wonder if the player part is of any use ?

Andy
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: AYe AYe...

Post by Andy Rea »

well the sound tracker (playback module) code doesn't work out of the box, i'm looking at the code now, seems like it uses the IX register which is a no no on the Zeddy !

i'm just fully disassembling it now, trying to make sense of how it works.

Andy
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: AYe AYe...

Post by Andy Rea »

here is an interesting thread, particularly the last post...

http://www.worldofspectrum.org/forums/s ... 524&page=3
what's that Smell.... smells like fresh flux and solder fumes...
Moggy
Posts: 3267
Joined: Wed Jun 18, 2008 2:00 pm

Re: AYe AYe...

Post by Moggy »

Andy Rea wrote:here is an interesting thread, particularly the last post...

http://www.worldofspectrum.org/forums/s ... 524&page=3

Already mentioned back in May by Rich,no replies though.

viewtopic.php?t=499
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: AYe AYe...

Post by sirmorris »

ACE!
Post Reply