LisaList2

General Category => LisaList2 => Topic started by: blusnowkitty on April 20, 2022, 09:46:43 pm

Title: WDC 65C22 vs. MOS 6522
Post by: blusnowkitty on April 20, 2022, 09:46:43 pm
I recently obtained a giant pile of scrap alarm system boards which are all basically textbook 1980s-era 6502 computers - just with the addition of an ethernet interface. Of course they're all made with modern WDC parts instead of vintage MOS parts, but they're still the same core on the inside.

Is there any reason why a modern WDC 65C22 couldn't be used as a drop-in replacement for a vintage MOS 6522 on the I/O or parallel boards?
Title: Re: WDC 65C22 vs. MOS 6522
Post by: Lisa2 on April 21, 2022, 12:46:18 pm
According to WDC, the W65C22N is a "drop-in" replacement for the older VIA chips and should be compatible.  The W65C22S version is not.


Title: Re: WDC 65C22 vs. MOS 6522
Post by: blusnowkitty on April 21, 2022, 03:35:13 pm
According to WDC, the W65C22N is a "drop-in" replacement for the older VIA chips and should be compatible.  The W65C22S version is not.

Thanks for the tip, with that in mind I started digging through the WDC datasheet. It looks to me like the biggest differences are that,

- S variant is fabbed with CMOS and thus can be clocked faster than the N variant
- S variant has a "bus holding device" on the data pins while the N variant does not
- S variant has a different on-die IRQB circuit than the vintage and N variants, but WDC states you can wire an external diode to the IRQB pin on the S variant to make it behave like the N
- S variant does not have current limiting resistors on the output pins while the N variant does, but a footnote in the datasheet suggests you can use external limiting resistors to make it behave like the N

So yeah, it looks like the S variant may not be a 100% compatible drop-in, but it may be possible to use the S variant anyway with enough external support components. At least I have a scope and a logic analyzer?

Now to find out if the 6522s in my scrap alarm boards are the S or the N variants...

For future study: https://www.eevblog.com/forum/beginners/combining-open-drain-and-totem-pole-outputs/
Title: Re: WDC 65C22 vs. MOS 6522
Post by: Lisa2 on April 22, 2022, 11:16:07 am
Speaking of replacement 65xx chips, I have had success using the 6507 in place of the of 6504 in the FDC section of the I/O board.  6507's are easier to find due to them being used in millions of Atari game systems.
After the supplies of 6504's and 6507's dry up, someone will have to work up an adapter to use a 6502 ( maybe a modern WDC version) on the Lisa IO card.
Title: Re: WDC 65C22 vs. MOS 6522
Post by: blusnowkitty on April 22, 2022, 02:16:43 pm
Speaking of replacement 65xx chips, I have had success using the 6507 in place of the of 6504 in the FDC section of the I/O board.  6507's are easier to find due to them being used in millions of Atari game systems.
After the supplies of 6504's and 6507's dry up, someone will have to work up an adapter to use a 6502 ( maybe a modern WDC version) on the Lisa IO card.

I did a quick bit of research and, at least according to the Atari guys there appears to be no reason why you couldn't use a full-blown vintage 6502 in place of a 6507. Things get more interesting by the time we get to the 65C02 (and by extension, the modern WDC parts) - I don't speak 6502 assembly, but according to the Atari guys code that uses illegal opcodes on a vintage 650x will no longer function on the 65C02. Another page I found said that illegal opcodes simply NOP in the 65C02, and some instructions may take an extra cycle or two to complete now.

Not speaking 6502 I couldn't disassemble the floppy ROM and tell you if this would be a problem... but it might be worth looking at to see if the floppy ROM would play nice with a WDC 65C02. On the bright side, if the floppy ROMs do have to be patched, at least there's only 3 floppy ROMs to patch (Twiggy, 400k, SunRem 800k) instead of thousands of Atari 2600 games?

https://atariage.com/forums/topic/194587-use-a-6502-instead-of-6507/
http://www.oxyron.de/html/opcodesc02.html
Title: Re: WDC 65C22 vs. MOS 6522
Post by: stepleton on April 22, 2022, 04:13:12 pm
I don't know if it includes illegal instructions (I would be surprised if it did!), but you can find the source code for the 88 I/O ROM on Bitsavers:

http://bitsavers.org/pdf/apple/lisa/firmware/ROM88/
http://bitsavers.org/pdf/apple/lisa/firmware/IO_ROM_88_Listing_Dec83.pdf
Title: Re: WDC 65C22 vs. MOS 6522
Post by: patrick on April 23, 2022, 08:01:19 am
On the 6504, /IRQ is on pin 3, while the 6507 uses this pin as the RDY input. On the Lisa I/O board, /IRQ is not used and pin 3 is terminated with a pullup resistor. Therefore both 6504 and 6507 will work.

All 650x derivatives use the same chip. On the 28-pin variants, some pins are simply not connected. It would be easy to develop an adapter board that allows the use of a 6502 instead. But who needs something like that? I have made adapter boards for the Z8 (with UB8820M) and for the COP421 (with COP402). These parts have internal ROM and are therefore not so easy to replace, but even those no one has needed yet. They just break very rarely.


I did a quick bit of research and, at least according to the Atari guys there appears to be no reason why you couldn't use a full-blown vintage 6502 in place of a 6507. Things get more interesting by the time we get to the 65C02 (and by extension, the modern WDC parts) - I don't speak 6502 assembly, but according to the Atari guys code that uses illegal opcodes on a vintage 650x will no longer function on the 65C02. Another page I found said that illegal opcodes simply NOP in the 65C02, and some instructions may take an extra cycle or two to complete now.

The I/O ROM for the floppy controller does not use illegal opcodes. So I see no reason why a 65C02 (or 65C04 if there is such a thing) should not work.

You (or the Atari guys) are right -- the CMOS devices replaced the illegal opcodes (which are actually just overlays of two legal opcodes because the instruction decoding is incomplete) with either additional opcodes or NOPs. Unfortunately, there were different implementations of the 65C02 with different sets of additional opcodes. Therefore you have to know exactly which controller type is installed if you want to use them.
http://www.6502.org/tutorials/65c02opcodes.html (http://www.6502.org/tutorials/65c02opcodes.html)

Title: Re: WDC 65C22 vs. MOS 6522
Post by: blusnowkitty on April 23, 2022, 11:31:23 pm
It would be easy to develop an adapter board that allows the use of a 6502 instead. But who needs something like that? I have made adapter boards for the Z8 (with UB8820M) and for the COP421 (with COP402). These parts have internal ROM and are therefore not so easy to replace, but even those no one has needed yet. They just break very rarely.

True, I see things more as a case of having and not needing than needing and not having. We've all seen just how bad leaky NiCd batteries can get, who's to say if things sit around long enough it won't rot the pins off other ICs? MOS-fabbed parts haven't stood the test of time either, if you look at how many Commodore computers have dead MOS chips (did Apple ever use MOS-fabbed ICs though? I think I've only seen Synertek or Rockwell). I also don't like the idea of condemning one vintage machine to ewaste to fix another (I suppose if the other machine had extensive physical board damage...), and 6504/6507s aren't exactly common on eBay US right now.
Title: Re: WDC 65C22 vs. MOS 6522
Post by: patrick on April 25, 2022, 02:03:44 pm
Here you are. I have placed the 6502 symmetrically onto the 28pin socket. This should work both for the Lisa I/O board and the Atari 2600. There is a solder jumper on the bottom to select either RDY (6507) or /INT (6504) for pin 3. Besides that, there are two pullup resistors for /NMI and /SO. The 28 pin parts have these lines internally directly connected to VDD, but this gives more flexibility in case someone needs these signals.

Send the zip file to your favourite Chinese PCB supplier, like JLCPCB or Elecrow. Note that this design has been reviewed a couple of times, but it has not been tested yet.