Macro help?
- floobydust
- Posts: 1394
- Joined: 05 Mar 2013
Re: Macro help?
BigDumbDinosaur wrote:
floobydust wrote:
I still need to clean up a few pieces of code... but if anyone is interested to play around with it, you're welcome to it. As the HW design is quite simple, it should be easy to build a drive up provided you can get an 8520A (or possibly a 6526) and the WD1772 chip. Everything else is readily available.
Regards, KM
https://github.com/floobydust
https://github.com/floobydust
Re: Macro help?
Hi
I think I understand what it is for.
The WD chip is a small uP. When it is busy it doesn't respond.
In other words, it floats the buss.
Have you ever looked at what is read from the buss when you
read an empty location?
It is the LSB of the address!
It is just code to make up for a slow chip that doesn't always
respond when it is busy.
Dwight
I think I understand what it is for.
The WD chip is a small uP. When it is busy it doesn't respond.
In other words, it floats the buss.
Have you ever looked at what is read from the buss when you
read an empty location?
It is the LSB of the address!
It is just code to make up for a slow chip that doesn't always
respond when it is busy.
Dwight
- floobydust
- Posts: 1394
- Joined: 05 Mar 2013
Re: Macro help?
dwight wrote:
Hi
I think I understand what it is for.
The WD chip is a small uP. When it is busy it doesn't respond.
In other words, it floats the buss.
Have you ever looked at what is read from the buss when you
read an empty location?
It is the LSB of the address!
It is just code to make up for a slow chip that doesn't always
respond when it is busy.
Dwight
I think I understand what it is for.
The WD chip is a small uP. When it is busy it doesn't respond.
In other words, it floats the buss.
Have you ever looked at what is read from the buss when you
read an empty location?
It is the LSB of the address!
It is just code to make up for a slow chip that doesn't always
respond when it is busy.
Dwight
I designed a controller using the WD2797 back in the 80's and did use some PHP/PLP sequences to lose some time when accessing the FDC, but never had any odd responses from the chip itself. It does seem a bit strange, but then again, the way the 1581 hardware accesses ROM and RAM it is a bit unusual as well, so your idea does have some foundation
I still need to look into this closer... plus and Jeff and I have kicked around a few other possible ideas for digging deeper into it. I'm hoping to get around to this a bit later this week or next... scope and logic analyzer attached! The good news is that I can write code to loop on some functions and burn it to EPROM and install in the drive.
Regards, KM
https://github.com/floobydust
https://github.com/floobydust
Re: Macro help?
I suspect it isn't allowing access before the register has valid data.
I think there is some other hardware methods but I think the main issue
is that it is really designed to do DMA.
Dwight
I think there is some other hardware methods but I think the main issue
is that it is really designed to do DMA.
Dwight
Re: Macro help?
Anyway, I'm relatively sure that is it, unless someone else can come up with an
address dependency of the WD chip.
Dwight
address dependency of the WD chip.
Dwight
Re: Macro help?
dwight wrote:
I suspect it isn't allowing access before the register has valid data.
I think there is some other hardware methods but I think the main issue
is that it is really designed to do DMA.
[...]
Anyway, I'm relatively sure that is it, unless someone else can come up with an
address dependency of the WD chip.
I think there is some other hardware methods but I think the main issue
is that it is really designed to do DMA.
[...]
Anyway, I'm relatively sure that is it, unless someone else can come up with an
address dependency of the WD chip.
My attention is on the transitions of address lines A1 and A0 in the cycles during and immediately after the lda wdstat. These cycles are:
- ROM access: read the LDA opcode
- ROM access: read the LDA LS operand byte
- ROM access: read the LDA MS operand byte
- FDC access: read the Status register
- ROM access: fetch the opcode of the following instruction
- 00,01,10,00,11 <-- problematic
- 01,10,11,00,00
- 10,11,00,00,01
- 11,00,01,00,10
Theories, anyone? I tend to suspect a flaw in the 1581 more so than a problem in the FDC chip itself. Meanwhile keep us posted, please, floobydust, and best of luck in your efforts.
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Macro help?
Dr Jefyll wrote:
Moving the lda wdstat instruction around results in the following four possibilities. During the cycles of interest, the A1 and A0 values could be...
- 00,01,10,00,11 <-- problematic
- 01,10,11,00,00
- 10,11,00,00,01
- 11,00,01,00,10
xxxxxxxxxxxIt is the second case that adds a nop.
My bad, I was looking at it wrong.
Dwight
Re: Macro help?
dwight wrote:
My bad, I was looking at it wrong.
I'm starting to think I was mistaken to suspect the flaw is in the 1581 drive electronics (not the FDC chip). Looking back over the earlier posts, I see John West said the mysterious macro is used in the 1571 firmware as well.
This business about the 00,11 sequence still seems pertinent, though. As I was saying in a PM to floobydust, 11 is the address of the Data Register, which is "read sensitive." By design, a read of that register can alter the state of the chip -- implying that a rogue read can upset normal operations.
Clearly there's a glitch somewhere, whether it's in the drive electronics or the actual FDC chip. Either way, it seems plausible -- or at least not impossible -- that the (normal, intended) read of address 00 could fail to terminate promptly, causing the read to endure for an extra few dozen nanoseconds. If so, the address during that time will make a difference. The rogue read could hit register 00 01 or 10 and be harmless. But if it hits a read-sensitive register (like 11) then that could explain the trouble.
Just a theory. I need to re-read that FDC datasheet. IIRC, Register 11 is read-sensitive with respect to the "Lost Data" flag.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Macro help?
If he put nop in front of all the status reads, it could end up creating
the 00,11 sequence. That would explain why all having nop fails
I think you may be on to it. It just doesn't stop decoding the
address fast enough.
This is most likely a race condition in the address decoder.
Dwight
the 00,11 sequence. That would explain why all having nop fails
I think you may be on to it. It just doesn't stop decoding the
address fast enough.
This is most likely a race condition in the address decoder.
Dwight
Re: Macro help?
( last week someone sent me the following tech humor
)
- Q: Knock knock,
Q: Race condition.
A: Who's there?
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Macro help?
Dr Jefyll wrote:
( last week someone sent me the following tech humor
)
- Q: Knock knock,
Q: Race condition.
A: Who's there?
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Macro help?
Gentlemen, I've been following this topic and for some strange reason, my memory was jogged concerning a conversation Lloyd Sponenburgh and I had had in the late 1980s about the WD1772 floppy controller's behavior.
Lloyd, who was one of the two architects of the Xetec Lt. Kernal (LK) hard drive subsystem for the Commodore 64 and 128, was working on FASTCOPY, which is an LK utility for rapidly copying files between the hard drive and a 1571 or 1581. He kept running into sporadic errors following an access to one of the WD1772 registers and ended up contacting Commodore for help. What I recall was Lloyd was told by Commodore there was a certain WD1772 register that could only be "touched" once every 8 or 16 clock cycles (I don't recall the exact number), a clock cycle being the clock driving the WD1772. That could explain the macro kludge, since the NOP would throw a couple of microseconds of delay in there.
Dunno if any of this helps.
Lloyd, who was one of the two architects of the Xetec Lt. Kernal (LK) hard drive subsystem for the Commodore 64 and 128, was working on FASTCOPY, which is an LK utility for rapidly copying files between the hard drive and a 1571 or 1581. He kept running into sporadic errors following an access to one of the WD1772 registers and ended up contacting Commodore for help. What I recall was Lloyd was told by Commodore there was a certain WD1772 register that could only be "touched" once every 8 or 16 clock cycles (I don't recall the exact number), a clock cycle being the clock driving the WD1772. That could explain the macro kludge, since the NOP would throw a couple of microseconds of delay in there.
Dunno if any of this helps.
x86? We ain't got no x86. We don't NEED no stinking x86!
- floobydust
- Posts: 1394
- Joined: 05 Mar 2013
Re: Macro help?
Hi BDD,
The same access timing existed with other earlier WDC FDC chips as well, like the 2797. The clock that drives the WD1772 is 8MHz and the clock rate for the 6502A is 2MHz, both derived from the 16MHz can oscillator via a 74LS93 counter. There are numerous sections in the 1581 code where 20 NOPs are inserted after accessing one of the WD1772 registers, likely to allow the chip to handle a command or respond to an access.
The thing with the macro, it doesn't appear to be a timing related mechanism, but to ensure that the instruction that will read the status register is located in ROM at an address where the lower two address bits are not zero. It almost seems that the address lines (which also are connected to the WD1772) need to toggle some number of times before accessing the status register, otherwise the SR read doesn't come back with the correct results. I'm still puzzled on this one.
Unfortunately, I've managed to tear a miniscus in my left knee and have limited mobility (including standing) for the next few weeks at a minimum. As a result, I've been a bit limited on trying to get back to this as well.
The same access timing existed with other earlier WDC FDC chips as well, like the 2797. The clock that drives the WD1772 is 8MHz and the clock rate for the 6502A is 2MHz, both derived from the 16MHz can oscillator via a 74LS93 counter. There are numerous sections in the 1581 code where 20 NOPs are inserted after accessing one of the WD1772 registers, likely to allow the chip to handle a command or respond to an access.
The thing with the macro, it doesn't appear to be a timing related mechanism, but to ensure that the instruction that will read the status register is located in ROM at an address where the lower two address bits are not zero. It almost seems that the address lines (which also are connected to the WD1772) need to toggle some number of times before accessing the status register, otherwise the SR read doesn't come back with the correct results. I'm still puzzled on this one.
Unfortunately, I've managed to tear a miniscus in my left knee and have limited mobility (including standing) for the next few weeks at a minimum. As a result, I've been a bit limited on trying to get back to this as well.
Regards, KM
https://github.com/floobydust
https://github.com/floobydust
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Macro help?
floobydust wrote:
Unfortunately, I've managed to tear a miniscus in my left knee and have limited mobility (including standing) for the next few weeks at a minimum. As a result, I've been a bit limited on trying to get back to this as well.
x86? We ain't got no x86. We don't NEED no stinking x86!
- floobydust
- Posts: 1394
- Joined: 05 Mar 2013
Re: Macro help?
BigDumbDinosaur wrote:
floobydust wrote:
Unfortunately, I've managed to tear a miniscus in my left knee and have limited mobility (including standing) for the next few weeks at a minimum. As a result, I've been a bit limited on trying to get back to this as well.
Regards, KM
https://github.com/floobydust
https://github.com/floobydust