Author Topic: Z80 Homebrew Computer - fault finding  (Read 97472 times)

0 Members and 1 Guest are viewing this topic.

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #350 on: August 10, 2017, 09:06:14 pm »
Okay grumpydoc, if my interpretation is correct, the image below should show the correct schematic for the improved IO decoder:



If this is correct, I'll get to work on it next week.  I'm assuming this will still play nicely with the existing peripherals, namely the SIO/2 and CF card as per Grant's circuit?
 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #351 on: August 10, 2017, 09:31:06 pm »
Looks OK.
 
The following users thanked this post: nockieboy

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #352 on: August 10, 2017, 11:15:29 pm »
Right

I have had a look in detail at the timing and I now agree that C has some valid points regarding interfacing with an 8MHz Z80. Some of these issues also affect the 4MHz Z80 somewhat so in practice might not be show stoppers given that I had a working sound card despite technically violating the timing constraints.

Now we are definitely going to need wait states at 8MHz so I am discussing the timing with that in mind - the I/O cycle timing (loosely to scale with typical propagation delays) looks like this.



Compare this with the AY-3-8912 timing diagrams, first of all the latch address timing.



The address is obviously latched as BC1 and BDIR switch back to the inactive state, there are just two timing values

TAS - the address set up time before the data is latched and
TAH - the hold time for which the DA0-DA7 must remain valid.

TAS is easily met, the AY-3-8912 spec is 400ns and we have 4\$\small\frac{1}{2}\$ clocks or 560ns at 8MHz so that is fine.
TAH however, is a bit of a problem because the 8MHz Z80 only guarantees 15ns of data hold time and the AY-3-8912 wants 100ns

Let's look at the write data timing


Here we have TDS - data setup, TDW - the write pulse width and TDH, the data hold time.

The write pulse width is OK, we have 560ns and need a minimum of 500ns - that box is ticked.

Then it starts to fall apart. The data setup time is 100ns and, well, the Z80 does not, in fact guarantee that the data is valid when \$\small\overline{WR}\$ goes low. The data hold time has the same problem as the address hold time.

Finally read timing


The access time is actually just about OK - the maximum is 500ns and we do just have 500ns to the point where we need the data to be valid, typical is 250ns though which is plenty fast enough.

The tristate delay does mean we could be pushing data onto the Z80 bus well into T1 of the next cycle at 8MHz.

So we have three problem areas, the data hold time on a latch address or data write cycle, the data setup time on a write and the tristate delay - so that's the three places that C identified plus the data setup time issue.

Do these matter?

Well, we would design to these times if we want a robust system but I have the following thoughts.

First off I don't think the tristate delay is significant, at least not for the typical value of 100ns - the cycle following the I/O read will be an opcode fetch - the only way it can be anything else is if you are executing an INI or INIR in which case it will be a memory write (you could take an interrupt, of course) - but nothing very interesting happens on the bus in T1 so the sound chip not having got around to turning its output buffer off is not that big a deal. At 4MHz or slower it definitely isn't going to be an issue, at 8Mhz it should still be OK but I don't think I would push it any further.

Then there is the data hold time. Well, that could be an issue but I "got away" with it with a 4MHz CPU where the Z80 guarantees 60ns of data hold time. In fact if I have calculated it correctly the 8MHz part is better when run at 4MHz as it then has a data hold time of 80ns - and don't forget nockieboy went down to 1.8MHz at which point I think he will actually meet the 100ns.

Finally that data set up time - why is it in the spec in the first place? There isn't an equivalent on the address latch cycle and it's clear the data is latched as BC1/BDIR switch to "inactive" so I find that just odd. It might be worth noting that I "got away" with that one as well.

So I think it is still worth pursuing the current build (I must get back to my own system build as well). At 1.8Mhz I think that all of the PSG timing constraints will be met except the data set up time but I genuinely can't see why the PSG needs that. If it works at 2 or 4MHz and fails at 8 then you know the issue is clock speed.

If it won't work at 8MHz then answer probably is to use a PIO to talk to it.

« Last Edit: August 10, 2017, 11:22:25 pm by grumpydoc »
 
The following users thanked this post: nockieboy

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #353 on: August 11, 2017, 01:08:16 am »
Then it starts to fall apart. The data setup time is 100ns and, well, the Z80 does not, in fact guarantee that the data is valid when \$\small\overline{WR}\$ goes low. The data hold time has the same problem as the address hold time.

Z8400, Z84C00 Specification
http://www.zilog.com/docs/z80/ps0178.pdf
page 31 Number 33
Data stable prior to WR fail   range is -10 to -55 ns
This is for IO Write

The Write Data is on data bus while WR is low.

nockieboy

While working on address decode, you might want to take a Quick look at some other chips.
74HC139; 74HCT139. Dual 2-to-4 line decoder/demultiplexer
assets.nexperia.com/documents/data-sheet/74HC_HCT139.pdf


SN54/74LS682, 684, 688 8-BIT MAGNITUDE COMPARATORS
http://www.uni-kl.de/elektronik-lager/417899

Back in the day, you might have many boards all the same but at different addresses. By using a Comparator you could have a dip switch to set the address in place of a patch field or jumpers
You could also set the address with logic.


 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #354 on: August 11, 2017, 07:25:53 am »
Then it starts to fall apart. The data setup time is 100ns and, well, the Z80 does not, in fact guarantee that the data is valid when \$\small\overline{WR}\$ goes low. The data hold time has the same problem as the address hold time.

Z8400, Z84C00 Specification
http://www.zilog.com/docs/z80/ps0178.pdf
page 31 Number 33
Data stable prior to WR fail   range is -10 to -55 ns
This is for IO Write

The Write Data is on data bus while WR is low.
I've never been 100% sure how to interpret those negative numbers but the times given for the memory write cycle start out positive which I have interpreted as the data being stable for that amount of time before \$\small\overline{WR}\$ goes low - so I read those negative numbers as indicating that the data might not be stable at the falling edge of the write pulse - after all the business end of write is the rising edge.
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #355 on: August 11, 2017, 07:56:09 am »
I have had a look in detail at the timing

Holy cow, you weren't kidding! :wtf:  What do you use to produce those timing diagrams, grumpydoc?

It's pretty clear the AY-3-891x series weren't created with the Z80 specifically in mind (the manual mentions a CP1610 or something similar - a CPU made by GI, anyway, and clearly the interfacing was setup for direct connection to that CPU.)  Thinking about it, the schematics for my old CPC series of computers show the AY connected via an 8255 PIO.

and don't forget nockieboy went down to 1.8MHz at which point I think he will actually meet the 100ns.

Just for the record, I've got an 8MHz Z80 (currently) running at 3.6864MHz.  The clock to the PSG is halved down to 1.8432MHz, though I'm not entirely sure if the clock affects anything in the PSG other than tone/noise/envelope generation frequencies?  I could be wrong though - I suppose it needs some sort of clock pulse to time the IO and bus control circuits?

C - you mentioned looking at other parts like the 74HCT139?  I've got to take an excited 6-year old to the beach for some rock pooling shortly so I haven't got time to check the datasheets out yet.  Would that offer benefits with regard to the timing or something else?

As always - thanks for the help guys, I really appreciate the expertise and time you're providing to an electronics luddite like me.  :scared:  :-+
 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #356 on: August 11, 2017, 11:57:55 am »
Rockpooling sounds much more fun.

I generally draw diagrams in Inkscape, I guess I should use a better tool and it was a pain at first but I have a fair few diagrams drawn now so I can just cut 'n' paste between them.

The AY-3-891x diagrams are just cut from the datasheet and resized.

I need to learn to use a decent electronics CAD package but haven't found a free one which I'm comfortable with.

Timing diagrams are modelled on the ones in the Z80 User Manual which are nice and free of clutter.

The timings that C refers to come from the Z80 datasheet - those have much more detail and extensive annotations giving precise signal delays but are quite a bit harder to follow.

Just for the record, I've got an 8MHz Z80 (currently) running at 3.6864MHz.  The clock to the PSG is halved down to 1.8432MHz, though I'm not entirely sure if the clock affects anything in the PSG other than tone/noise/envelope generation frequencies?  I could be wrong though - I suppose it needs some sort of clock pulse to time the IO and bus control circuits?
Ah, that was where the 1.8MHz came from - I still suspect that the interface should work at 3.6MHz, 8MHz might be pushing it.

Quote
C - you mentioned looking at other parts like the 74HCT139?  I've got to take an excited 6-year old to the beach for some rock pooling shortly so I haven't got time to check the datasheets out yet.  Would that offer benefits with regard to the timing or something else?
It's very similar to the 138 except that it is a dual 2-line to 4-line decoder, timing is going to be the same. Sometimes splitting the function into two two bit halves is useful but it limits the enable input to a single active low input for each half.
« Last Edit: August 11, 2017, 12:09:07 pm by grumpydoc »
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #357 on: August 11, 2017, 12:40:44 pm »
Rockpooling sounds much more fun.

That may well be, but I've come back with a nasty case of crabs...  :-DD

I generally draw diagrams in Inkscape, I guess I should use a better tool and it was a pain at first but I have a fair few diagrams drawn now so I can just cut 'n' paste between them.

The AY-3-891x diagrams are just cut from the datasheet and resized.

I need to learn to use a decent electronics CAD package but haven't found a free one which I'm comfortable with.

Have you tried DipTrace?  I've had a go with most of the free electronics CAD programs (well, Eagle and KiCAD) and have gotten on far better with DipTrace than either of the other two.  The pin count in the free version can be a little restrictive (you're restricted to 300 pins), but I sent them a nice e-mail asking about a home hobbyist (non-commercial) licence, and they sent me a registration key that upped the limit to 500 pins.  Not a great difference, but enough for me to be able to completely plan out my Z80 SBC.  It just seems a lot more logical and easy to use than the competition too, but each to their own.

It doesn't do chip timings though - I don't know if any of the free CADs would do that - but now you've given me the nugget of an idea for a program to write, if I ever get enough spare time to write it.  ::)

Ah, that was where the 1.8MHz came from - I still suspect that the interface should work at 3.6MHz, 8MHz might be pushing it.

Well, we'll find out fairly soon hopefully.

It's very similar to the 138 except that it is a dual 2-line to 4-line decoder, timing is going to be the same. Sometimes splitting the function into two two bit halves is useful but it limits the enable input to a single active low input for each half.

Oh okay, I thought C was mentioning it as the timings would assist.  Well, anyway, there's a chance I can get the IO decoder changes sorted today, so that's the most pressing task on my to-do list at the moment.
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #358 on: August 11, 2017, 01:20:20 pm »
       1 of 2
Dual 1 of 4  139
       1 of 8 138
       1 of 16 _____

Just knowing others exist is good

The 139 attached to your 138 could give you 4 inputs & 1 outputs using RD & WR

Where a 138 would be input or output only when you attach one of TD or WR

 MAGNITUDE COMPARATORS
Knowing they exist and can make things easer

For example, An 8-bit  MAGNITUDE COMPARATORS would let you select a 256 byte block of Z80 memory and a program could change what 256 byte block





 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #359 on: August 11, 2017, 01:38:26 pm »
Hmm okay, I've made the changes to the IO decoder as outlined previously and the SBC now won't boot or show anything on the terminal. Doesn't seem to be receiving or sending from the SIO, so it would appear that the IO address range has changed or the reset circuit has been affected somehow by the changes perhaps?
 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #360 on: August 11, 2017, 01:47:39 pm »
Hmm okay, I've made the changes to the IO decoder as outlined previously and the SBC now won't boot or show anything on the terminal. Doesn't seem to be receiving or sending from the SIO, so it would appear that the IO address range has changed or the reset circuit has been affected somehow by the changes perhaps?

Poop :(

It shouldn't have affected anything - the 74ls138 is still decoding ports 00-3F in 8 groups of 8 ports and each select should correspond to the same range as before, could you have disturbed anything else?

It will have very subtly changed the timing for the select signals but I doubt the design is that marginal.
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #361 on: August 11, 2017, 02:09:00 pm »

Remove M1 from 138 and strap to a level.

 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #362 on: August 11, 2017, 02:30:16 pm »
Remove M1 from 138 and strap to a level.
Temporarily right?

Check that \$\small\overline{M1}\$ is going to the active high enable, not one of the others and maybe make sure the signals look OK but the point of running \$\small\overline{M1}\$ is to have selects that are active for I/O cycles but not INT acknowledge cycles.
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #363 on: August 11, 2017, 02:42:44 pm »
In grant's drawing I have

E1  pin 6 connected to +5 active HIGH
E2  pin 4 connected to A6 active low
E3  pin 5 connected to A7 active low

TI data sheet
E1  pin 4 active low
E2  pin 5 active low
E3  pin 6 active HIGH

Found above so far
nockieboy's matches TI for 138

Remove M1 from 138 and strap to a level.
Temporarily right?
Yes
Having M! connected should be ok but is not a normal connection for all the many Z80's I have seen.



 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #364 on: August 11, 2017, 03:14:37 pm »
nockieboy

Might want to test what you have to see where the problem is.
Valid bootup is good

test #1
E1  pin 4 Connect to 0V
E2  pin 5 Connect to 0V
E3  pin 6 Connect to 5V
This should boot, just reduced Grant

test #2
E1  pin 4 Connect as last decoder U2.1 pin 3
E2  pin 5 Connect to 0V
E3  pin 6 Connect to 5V
This should boot if not U2.1 is wrong

test #3
E1  pin 4 Connect as last decoder U2.1 pin 3
E2  pin 5 Connect to IORQ
E3  pin 6 Connect to 5V
This should boot

test #4
E1  pin 4 Connect as last decoder U2.1 pin 3
E2  pin 5 Connect to IORQ
E3  pin 6 Connect to MI
This should boot but you said fail
If this still fails at this point

test #5
Connect as #1
change
E2  pin 5 Connect to IORQ

test #6
Connect as #1
change
E3  pin 6 Connect to MI

if #2, #5 or #6 fails strap that pin as in #1 with other pins connected.


 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #365 on: August 11, 2017, 04:55:17 pm »
...could you have disturbed anything else?

Poop. Yes, it seems I did - D2 had become disconnected from the ROM.  I'm getting the "Press <SPACE> to continue..." message now, but no further.  No amount of key presses are moving it on from there.

If I hold the spacebar down on the computer and reset the SBC, I get random chars on the terminal sometimes.  But otherwise, it resets normally and shows the initial message but doesn't seem to be Rx-ing anything.. I've checked and am checking again all the connections to make sure nothing else is lose..

EDIT:

Cancel that, it's working perfectly again.  Nothing wrong with your design, grumpydoc, it was my eyesight that was the problem.  I'd failed to notice a jumper from Vcc to E3.  M1 had effectively been pulled high.  It's working fine now, though - I've even checked CP/M and that has loaded fine.  :phew:
« Last Edit: August 11, 2017, 05:01:32 pm by nockieboy »
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #366 on: August 11, 2017, 05:50:15 pm »
Okay, so now the new and improved IO decoder is all working ::), I'm thinking about wiring up the PSG once more.  Piecing together what grumpydoc has said on the previous page, I've come up with the below interface for the PSG - is this likely to work?

 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #367 on: August 11, 2017, 07:10:05 pm »

http://map.grauw.nl/resources/sound/generalinstrument_ay-3-8910.pdf

nockieboy
 When you look at PSG there is no chip select.
The chip was built for a multiplex address & data bus.
On page 2 in section "REGISTER ARRAY"

10-bits of address
In drawing note High order(chip select)
DA7-DA4 are normally 0000 but can be mask programmed.
DA8 is active high
DA9 is active Low
"The high order address bits function as chip selects to control the tri-state bidirectional buffers"

I think at a min you should have a chip select signal and not just count on BC1 &
BDIR

Okay, so now the new and improved IO decoder is all working ::), I'm thinking about wiring up the PSG once more.  Piecing together what grumpydoc has said on the previous page, I've come up with the below interface for the PSG - is this likely to work?


In addition to what you have connect DA9 which is active low to Y1 which is active low.

This should put PSG in TRI-State when Y1 is high

Did not look at logic for BC1 & BDIR

Still do not like the timing between PSG & Z80.

 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #368 on: August 11, 2017, 07:21:30 pm »
is this likely to work?
Yes it should do - subject to the caveats above about timings.

http://map.grauw.nl/resources/sound/generalinstrument_ay-3-8910.pdf

nockieboy
 When you look at PSG there is no chip select.
The chip was built for a multiplex address & data bus.
On page 2 in section "REGISTER ARRAY"

10-bits of address
In drawing note High order(chip select)
DA7-DA4 are normally 0000 but can be mask programmed.
DA8 is active high
DA9 is active Low
"The high order address bits function as chip selects to control the tri-state bidirectional buffers"

I think at a min you should have a chip select signal and not just count on BC1 & BDIR
From the same data sheet
"INACTIVE The PSG/CPU bus is inactive. DA7-DA0 are in a high impedance state"

That applies to all "inactive" combinations of BDIR, BC2 and BC1 - you don't need to separately use A8/A9 to control the buffers.

In fact:

Quote
In addition to what you have connect DA9 which is active low to Y1 which is active low.

Could do but again from the data sheet that you quote ".... may be left unconnected as each is provided with an on chip pull-down (A9) or pull up (A8)..."

Clearly the chip designers did not feel that you need to use A8/A9 as chip selects.

Quote
Still do not like the timing between PSG & Z80.

Agree, but for reasons discussed and past experience I think it should work on  a Z80 clocked at 4MHz or below.

To go to 8MHz wait states will be needed but might not be enough and things could get complicated.

For various reasons will have less time to contribute for at least two weeks but will try to keep an eye on proceedings when I can.

EDIT:
Quote
Did not look at logic for BC1 & BDIR

Inactive (Y1 high) will drive BC1 and BDIR low whatever is on \$\small\overline{WR}\$ and A0

A write cycle with A0=0 will drive BC1 and BDIR high for a latch address cycle
A write cycle with A0=1 will drive BC1 low and BDIR high for a write register cycle.

A read cycle with A0=0 will drive BC1 high and BDIR low for a read register cycle
A read cycle with A0=1 will drive BC1 and BDIR low which will do nothing.

That could be better as the registers write on $BASE+1 and read on $BASE+0 but it only takes two gates to implement and there are no "dangerous" combinations.
« Last Edit: August 11, 2017, 07:34:29 pm by grumpydoc »
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #369 on: August 11, 2017, 10:30:35 pm »
Just had another look at the datasheet for the AY as the thought occurred about whether the IO pins could drive an LED?  I'm probably not reading the sheet right, but it looks to me like the maximum current the IO pins can deliver is 100uA? That's not enough to drive an LED, is it? In which case, I'll need to set up something more involved using transistors to drive the LEDs while I'm testing IOA?
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #370 on: August 11, 2017, 11:43:43 pm »

TTL logic
Can do more current to 0v but much less to 1

I read
low  0-0.5 at 1.6 Ma
High 2.4 to Vcc at 100 ua.

This is normal for TTL
Common practice is to use Pull UP resistors with ttl
Most logic makes a low the active state so that pull ups can be used

Look at your Z80 and see it's currents

Not a good idea to connect LEDs to Z80 computers directly.

If you look at a 244 you will see a higher current output.
So best idea
If you want an active low signal to light an LED use an Inverter to drive LED
if signal is normal then a buffer drive LED


 
The following users thanked this post: nockieboy

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #371 on: August 12, 2017, 05:30:26 pm »
Okay, Z80-PSG interface is completed.  I have tested the IO for input and am successfully reading values across the full range (0-255) on IOA.  :-+

Output, however, seems to be a different story.  There seems to be a constant 3.6V on each of the IO pins when configured for output, no matter what value I write to the PSG IOA port.

Code below is what I'm using to write to the port:

Code: [Select]
AY_IO_ADDR .EQU 0EH ; AY-3-8912 IOA address
AY_WRITE .EQU 09H ; AY-3-8912 write address
AY_READ .EQU 08H ; AY-3-8912 read address
AY_LATCH .EQU 08H ; AY-3-8912 latch address

; Set IOA to OUTPUT
LD A,$07 ; Select address R7 (select ENABLE register)
OUT (AY_LATCH),A ; Latch address R7
LD A,40H ;
OUT (AY_WRITE),A ; Set R7 to 40H (IOA set to output)

; Set value in IOA
LD A,AY_IO_ADDR ; Load A with IOA Register address
OUT (AY_LATCH),A ; Latch register in PSG
LD A,E ; Load A with value
OUT (AY_WRITE),A ; Write value to PSG

Is 40H the right value to use to set IOA to output, I'm wondering?
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Z80 Homebrew Computer - fault finding
« Reply #372 on: August 12, 2017, 06:48:22 pm »

Output, however, seems to be a different story.  There seems to be a constant 3.6V on each of the IO pins when configured for output, no matter what value I write to the PSG IOA port.
Is 40H the right value to use to set IOA to output, I'm wondering?

The 3.6v could be the internal pull-up.
 
R7 B6 is probably a direction control of IOA. Have not found if it's 1 or 0 for output.
40H would set B6 & clear other bits.

Try with just a voltmeter or scope connected to output and
40H And also 00H to R7




 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2905
  • Country: gb
Re: Z80 Homebrew Computer - fault finding
« Reply #373 on: August 12, 2017, 07:10:27 pm »
Are you writing to the correct register for the port. The data sheet says port 16 but you are writing to 0E (14)
 

Offline nockieboyTopic starter

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: england
Re: Z80 Homebrew Computer - fault finding
« Reply #374 on: August 12, 2017, 07:24:45 pm »
Are you writing to the correct register for the port. The data sheet says port 16 but you are writing to 0E (14)

Yup - this was identified in this forum here that the documentation for the AY isn't spot on, as the registers are actually 2 lower than those printed in the datasheet.

I've also verified this myself by reading from 0F and 0E to get the value at IOA.  Only 0E works - 0F is for IOB (which doesn't exist on the 8912), but thinking about it 0F must be IOB as there's no way of passing 10h or higher to the register as the most significant 4 bits are all masked in hardware (so no way to address R17.)

R7 B6 is probably a direction control of IOA. Have not found if it's 1 or 0 for output.
40H would set B6 & clear other bits.

That is indeed the case - R7 B6 sets the direction of IOA.  Below is a screenshot of the documentation I've been using (goes into more detail than the datasheet does for the AY-3-891x series):



Sorry for the quality - the original is a scanned document which isn't great.  The following information should also help:

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf