| Electronics > Projects, Designs, and Technical Stuff |
| AY-3-8910 - can't write odd values to its registers? |
| << < (5/7) > >> |
| radiolistener:
all looks good. May be there is some mistake with connection between PSG board and Z80 |
| nockieboy:
Above is the latest trace. This time I'm looking at AQ0, WR and P=Q (PSG_SELECT) to confirm correct generation of BC1 and BDIR signals to the PSG. All looks to be fine. ??? Next I'm going to see if I can hook up the 521 and see what the IN_B_x lines are doing - they should be constant throughout - then check the AQ address lines for the other half of the comparator input. UPDATE: So it seems AQ8 is pulsing high twice, corresponding to the WR and RD with the odd value. This could be a coincidence that these HIGHs on AQ8 are corresponding to the IN/OUT with odd values, but in any case will prevent /(P=Q) going low. I will disconnect AQ8 from the 521 and pull that pin LOW. Not sure why I connected it in the first place, tbh, there was no requirement for it - just a free pin. |O |
| SiliconWizard:
I take it that AQ8 is A8 from the Z80's address bus? IIRC, 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. |
| mikerj:
FWIW this is documented in the Z80 manual: OUT (n),A The operand n is placed on the bottom half (A0 through A7) of the address bus to select the I/O device at one of 256 possible ports. The contents of the Accumulator (Register A) also appear on the top half (A8 through A15) of the address bus at this time. Then the byte contained in the Accumulator is placed on the data bus and written to the selected peripheral device. OUT (C),r The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of the address bus at this time. Then the byte contained in register r is placed on the data bus and written to the selected peripheral device. Register r identifies any of the CPU registers shown in the following table, which also shows the corresponding three-bit r field for each that appears in the assembled object code. I'm almost certain some of the old Z80 machines used the value placed on the upper bits to simplify decoding. |
| radiolistener:
--- 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. For example, ZX Spectum used address lines A14 and A15 for AY8910 port decoding. So it seems, that the issue happens just because topic starter uses address line A8 for port decoding and didn't set port address properly in the code :) There are 3 ways to fix it: 1) set all 16 bits of the port address in the code properly. There is need to load high address byte into A. But since unprefixed OUT instructions uses A to store output value, and at the same time it uses A to store high byte of port address, you will not be able to use this instruction to write odd or even values (it will depends on jumper for 74f521 decoder) 2) use #ed prefixed instruction to access port, and load all 16 bits of port address into BC 3) just disconnect A8 from 74f521 and pull that pin to the ground or VCC (jumper also should be set properly) |
| Navigation |
| Message Index |
| Next page |
| Previous page |