Electronics > Projects, Designs, and Technical Stuff
AY-3-8910 - can't write odd values to its registers?
<< < (6/7) > >>
nockieboy:
All sorted now.

Yes, it was because of AQ8 - which is just A8 from the Z80 through a buffer.

I'd misunderstood (or more likely forgotten) the operation of OUT (C),A - so it was the contents of the A register on A8-A15 that was throwing the address decode out for the PSG.  It's working fine now that I've disconnected AQ8 from the 521 and grounded that pin.

Thanks for your help and advice everyone - it's much appreciated. :)  I'll probably be back later for problems with the analogue stage - still getting rubbish out of the speaker, but I've got some more testing I can do with that end before I worry everyone else with it.   :-+
nick_d:
Good that you got it solved. The Z80's handling of A8-A15 for IO cycles is indeed quite weird, something that has been addressed in the Z180 by adding the IN0 and OUT0 instructions, though unfortunately they're longer and slower.

To clarify my earlier suggestion I meant that the Z80 chip could have been damaged or faulty with a fault that only affected a subset of IO write cycles. But since you have other IO devices on the bus as you mention, that was unlikely.

Anyway the A-Y chips are uber cool, I would LOVE to have a Mockingboard for my souped up Apple IIe some day!

cheers, Nick
floobydust:
A last note, I think 74F inputs float low as opposed to 'LS and TTL which float high. This would affect your address select dipswitch circuit.
SiliconWizard:

--- Quote from: radiolistener on February 27, 2019, 06:33:21 pm ---
--- Quote from: SiliconWizard on February 27, 2019, 06:12:55 pm ---the Z80 only uses the lower 8 address bits for IN/OUT requests, so the upper 8 address bits may hold any value - I don't think this is specified. So don't use them for decoding IO accesses.

--- End quote ---

thats not true, Z80 uses all 16 address lines for IN/OUT operations.

For non-prefixed IN/OUT operations, the high byte address is taken from register A.
So, this code:

--- Code: ---LD    A,#AA
OUT (#55),A

--- End code ---

is equals to OUT (#AA55),#55

For #ED prefixed IN/OUT operations, 16-bit address is taken from register BC.

--- End quote ---

I haven't used a Z80 in ages, hence the "IIRC"... and I didn't remember that. That's old memories, but I don't think I have ever used anything but the lower 8 bits for IN/OUT operations.

That said, the upper 8 address bits with the OUT (n),A instruction kinda looks like a trick, since it will output the same byte on the data bus than on the upper 8 address bits. Could be put to use I guess, but that's kind of funky nonetheless.

I downloaded the Z80 user manual to refresh memory (my own). What's somewhat confusing (and maybe why I, and probably others, have never thought of using the upper 8 address bits) is that, whereas it's indeed stated in the instruction set description, the /IORQ pin function description says ('Overview' section):

--- Quote ---Input/Output Request (output, active Low, tristate). IORQ indicates that
the lower half of the address bus holds a valid I/O address for an I/O read or
write operation.
--- End quote ---

So I'm wondering whether this upper half trick wasn't added as an afterthought or something, and the manual not completely updated. Looks like I just learned a Z80 trick more than 20 years since I last used one. ;D

And in the OP's case, since he wasn't taking care of the upper half anyway, there was no reason to use anything but the lower half.

Brings back fond memories!
radiolistener:

--- Quote from: SiliconWizard on February 28, 2019, 02:57:17 pm ---
So I'm wondering whether this upper half trick wasn't added as an afterthought or something, and the manual not completely updated. Looks like I just learned a Z80 trick more than 20 years since I last used one. ;D


--- End quote ---

I was used Z80 a long time ago, there are a lot of different documentation about Z80, I don't remember exactly where this feature is described, but this is well known behavior and it works on all Z80 modifications and clones in the same way. This behavior was used in some ZX Spectrum programs for fast access to the port with 16-bit decoding. For example it is extensively used in demos from Code Busters group to access AY8910 which uses A14 and A15 lines for port address decoding.

There is also one instruction that works in different way on different Z80 clones.
OUT (BC),#00 writes #FF on some Z80 modifications and #00 on original Z80.
But this instruction is undocumented.  :)
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod