AY-5-3600-PRO

75 posts / 0 new
Last post
S.Elliott's picture
Offline
Last seen: 11 hours 47 min ago
Joined: Jun 23 2022 - 16:26
Posts: 230
Please pardon a little repetition...

Ah then, time to flash back to my challenge in comment 41.

The Applesoft program is supposed to read keystrokes and print the ASCII code associated with each one.

10 GET A$

20 PRINT A$, ASC(A$)

30 GOTO 10

So, the original challenge was to figure out how to cause an ILLEGAL QUANTITY ERROR when running the program.

 

  • It's actually a bug in Applesoft's GET handler, not an error in line 20.
  • On an Apple ][ or Apple ][ Plus the error occurs when you press SHIFT+CTRL+P.
  • On an Apple //e the error occurs with SHIFT+CONTROL+2 or just CONTROL+2.

 

But here's the fun sequel...

The Coleco Adam computer uses SmartBASIC, a derivative of Applesoft.  A member of the Apple II Enthusiasts group on Facebook tried the program on his Adam and found he could cause SYNTAX ERROR by pressing Ctrl+D.  AFAIK, that's unique to SmartBASIC...not reproducible on an original Apple II.

Offline
Last seen: 7 hours 50 min ago
Joined: Feb 27 2021 - 18:59
Posts: 599
Nitpick, referenced to published source

Book excerpt from 2007:

S.Elliott's picture
Offline
Last seen: 11 hours 47 min ago
Joined: Jun 23 2022 - 16:26
Posts: 230
Cross-checked KR9600 from AliExpress
CVT wrote:

The third time is the charm! Got a perfectly working KR9600-PRO for $6 shipping included!

Not sure if they have 27,700 more, but here is the link again: https://www.aliexpress.com/item/4000830397007.html

Out of sheer curiosity, I bought a KR9600-PRO from that link.  And it arrived yesterday...with 7 bent pins and a lot of blemishes.  It sure looks like it has gone through the mangle!

 

It wouldn't fit directly into my Apple //e because the pins were splayed too widely, so I used a spare 40-pin socket to carefully fix the pins one-by-one.  (Ignore the wires, they're left over from this socket's previous application.)

After straightening those pins, it worked perfectly in my 1983 Apple //e.  Including autorepeat, n-key rollover, and the AKO/AKD function.

 

No doubt these AliExpress chips are recycled from old equipment.  It's even possible it was pulled from another Apple //e, based on its 1992 manufacture date, but it seems more likely that it was pulled from something else that just happened to use the same part.

 

It also exhibits the same "bug" that AKD is not debounced.  Just like the originals.

CVT
CVT's picture
Offline
Last seen: 1 day 6 hours ago
Joined: Aug 9 2022 - 00:48
Posts: 1165
Wow, this one has taken more

Wow, this one has taken more abuse than the one I got! How do I reproduce this bug? I want to see if mine has it too. (Most likely it does.)

 

Otherwise yes, the KR9600-PRO is a generic chip and it is used in other devices as well. So far I have found two, which means that there are many more:

 

1: https://www.ebay.com/itm/123873021615

 

2: https://maraindustrial.com/cart/circuit-boards/heidelberg-web-systems-pca5347051-keyboard-encoder-board-new-no-box.html

Offline
Last seen: 1 month 2 weeks ago
Joined: Jul 5 2018 - 09:44
Posts: 2587
What else would be programmed

What else would be programmed for the right keyswitch matrix besides one salvaged from an e-waste recycled //e?  That one has the characteristic little dot on it you see on chips in Platinum //e although it is kind of worn off.  Ones in earlier //e usually seem to have two dots.  I'm thinking that ones with no dots or some other symbol on there may not work.

 

Offline
Last seen: 1 month 2 weeks ago
Joined: Jul 5 2018 - 09:44
Posts: 2587
CVT wrote:Wow, this one has
CVT wrote:

Wow, this one has taken more abuse than the one I got! How do I reproduce this bug? I want to see if mine has it too. (Most likely it does.)

 

Otherwise yes, the KR9600-PRO is a generic chip and it is used in other devices as well. So far I have found two, which means that there are many more:

 

1: https

 

If would be interesting to know if either of those will actually work in a //e.  The one on eBay obviously would be too expensive to buy just to find out.  I'm suspicious that these were made/programmed for decoding something else and would have the same issue you ran into with that ][+ controller, that it wold never really give proper or acceptable operation even with a custom encoder ROM because the matrix wouldn't have keys at the right places.

 

CVT
CVT's picture
Offline
Last seen: 1 day 6 hours ago
Joined: Aug 9 2022 - 00:48
Posts: 1165
softwarejanitor wrote:If
softwarejanitor wrote:
If would be interesting to know if either of those will actually work in a //e.
...

 

They will work. All the encoder chips that end on -PRO are internally programmed exactly the same way. This is what makes them generic and allows an external EPROM chip to be used for mapping. The non-generic ones (like the one for the Apple II+ and the Apple III) are all programmed differently, they don't need an external EPROM and they don't have the -PRO suffix.

Offline
Last seen: 1 month 2 weeks ago
Joined: Jul 5 2018 - 09:44
Posts: 2587
CVT wrote:softwarejanitor
CVT wrote:
softwarejanitor wrote:
If would be interesting to know if either of those will actually work in a //e.
...

 

They will work. All the encoder chips that end on -PRO are internally programmed exactly the same way. This is what makes them generic. The non-generic ones (like the one for the Apple II+

Oh, that's interesting. I was under the impression they all had to be factory programmed for a certain matrix.

 

 

 

CVT
CVT's picture
Offline
Last seen: 1 day 6 hours ago
Joined: Aug 9 2022 - 00:48
Posts: 1165
I was under the same

I was under the same impression when I first started learning about this, but it turned out to be incorrect. Basically the PRO picked one full matrix mapping, standardized it and documented it in the datasheet, so it can be easily remapped externally.

Offline
Last seen: 3 months 6 days ago
Joined: Jan 1 2021 - 09:56
Posts: 26
CVT wrote:I was under the
CVT wrote:

I was under the same impression when I first started learning about this, but it turned out to be incorrect. Basically the PRO picked one full matrix mapping, standardized it and documented it in the datasheet, so it can be easily remapped externally.

The KR9600-PRO is the original part that was used, and was available as the "programmable" version used in the Apple IIc and IIe, where the KR9600 was preprogrammed at the chip fab with a specific row/column matrix that meant you had to design your keyboard to match their matrix. Standard Microsystems made this chip, along with a whole host of other really useful peripheral interface chips (everything from character and CRT timing generators up through UARTs and baud rate generators). General Instrument often bought up whole ecosystems of intellectual property when semiconductor fabs either went under or changed focus (as SMC would) and then started reproducing their designs with a GI part number. That's why the KR9600-PRO and the AY-5-3600-PRO are exactly the same part, and honestly, it's one of the only reasons we still have some of these really useful old chips. 

Another good example is the YM2149 PSG -- GI originally made this part as the AY-3-8910, which Yamaha then later licensed as the PSG in the MSX line of game consoles. 

Three other interesting tidbits:

  • General Instrument is likely the company that made your cable TV box in the 1980s and 1990s. 
  • SMC is still around today as a subsidiary of Microchip, which, oddly enough, is a spinoff of...guess who...General Instrument.
  • GI created the PIC1650, an NMOS microcontroller. The CMOS version of this same chip is the foundation of today's PIC microcontroller family.
CVT
CVT's picture
Offline
Last seen: 1 day 6 hours ago
Joined: Aug 9 2022 - 00:48
Posts: 1165
Exactly, what makes the -PRO

Exactly. What makes the -PRO externally programmable (using an external EPROM) is that it was internally programmed at the factory with one particular full matrix and this matrix was documented in the datasheet. Then the external EPROM connects to the output of the encoder and acts like a lookup table.

MacFly's picture
Offline
Last seen: 1 day 4 hours ago
Joined: Nov 7 2019 - 13:49
Posts: 483
CVT wrote:They will work. All
CVT wrote:

They will work. All the encoder chips that end on -PRO are internally programmed exactly the same way.

 

Indeed, you are right: the KR9600 datasheet actually clearly states that. The KR9600 is a custom part, but the KR9600-PRO is a standardized variant with fixed programming. The datasheet lists the complete matrix and describes the -PRO's fixed options. There were also two further standardized variants (KR9600-STD, KR9602-012) which were programmed differently - but sold with a different part number accordingly. So a KR9600-PRO should always have the same functionality - except for defects and fakes. That is really good news. How did we (and everyone else) even miss that before...

S.Elliott's picture
Offline
Last seen: 11 hours 47 min ago
Joined: Jun 23 2022 - 16:26
Posts: 230
MacFly wrote:So a KR9600-PRO
MacFly wrote:
So a KR9600-PRO should always have the same functionality - except for defects and fakes. That is really good news.

 

Not quite the same.  SMC's part uses a single +5 volt power supply, while GI needs -12 volts at pin 27 for its PROM.

At least according to the sheets:

  • AY-3600-5-PRO, pin 27 is -12 volts
  • KR9600-PRO, pin 27 is a soft CAPS LOCK option.

The Apple //e and //c schematics show -12 volts connected to pin 27.  The Apple //e certainly works with a KR9600-PRO installed, probably because it doesn't actually need the CAPS LOCK feature.  My Apple //e came from the factory with a KR9600-PRO, so the -12 volts at pin 27 either doesn't harm the chip...or only harms the soft CAPS LOCK feature that isn't used by the Apple //e or //c.

[EDIT: oopsie, I was looking at the KR9601 in the same data sheet.  The KR9600 shows pin 27 as "not connected"]

S.Elliott's picture
Offline
Last seen: 11 hours 47 min ago
Joined: Jun 23 2022 - 16:26
Posts: 230
Correction
S.Elliott wrote:
MacFly wrote:
So a KR9600-PRO should always have the same functionality - except for defects and fakes. That is really good news.

 

Not quite the same.  SMC's part uses a single +5 volt power supply, while GI needs -12 volts at pin 27 for its PROM.

Oopsie, correction...the parts are different, but the SMC part has "no connection" at pin 27. 

GI's part still needs -12 volts at pin 27, according to its data sheet.

 

So they aren't totally interchangeable, but both should work because an Apple //e or Apple //c does provide -12 volts at pin 27.  The SMC version apparently just ignores that pin, and the GI part gets -12 volts for its PROM.

S.Elliott's picture
Offline
Last seen: 11 hours 47 min ago
Joined: Jun 23 2022 - 16:26
Posts: 230
KR9600 TESTER is attached to a blogpost
CVT wrote:

Wow, this one has taken more abuse than the one I got! How do I reproduce this bug? I want to see if mine has it too. (Most likely it does.)

Okay, I included a program  KR9600 TESTER  (and EDASM source) in my old Prince Of Persia pre-boot disk.  The disk image and instructions are in a blogpost here.

Last week I uploaded a YouTube video here that demonstrates how the bug manifests itself in the game.  If you have a copy of the game, you should be able to reproduce it for yourself by moving releasing all keys and then tapping the keys  J K L K  as shown in the video to attempt the actions turn-left, duck, turn-right, duck.  If your encoder has the bug then you will notice keys occasionally trigger the wrong actions.

If you have an original copy of Prince Of Persia, then you can use that pre-boot disk to fix it via a software patch.  (It does not modify the disk.)

CVT
CVT's picture
Offline
Last seen: 1 day 6 hours ago
Joined: Aug 9 2022 - 00:48
Posts: 1165
Great write-up! Mine has the

Great write-up! Mine has the bug too. I guess it would not be too hard to add a permanent rising edge 10-millisecond delay to the AKD line externally.

S.Elliott's picture
Offline
Last seen: 11 hours 47 min ago
Joined: Jun 23 2022 - 16:26
Posts: 230
...or just add a pair of NOR gates
CVT wrote:

Great write-up! Mine has the bug too. I guess it would not be too hard to add a permanent rising edge 10-millisecond delay to the AKD line externally.

In 1989 I devised this ugly-looking circuit, just so I could play Prince Of Persia on my parent's Apple //e.  My parents didn't own a joystick, and my own Apple ][ Plus couldn't play the game at all, so I used a pair of 40-pin sockets to insert a 7402 NOR gate between the keyboard decoder and the motherboard.  This solves the problem by using two NOR gates to gate pin 5 (AKO/AKD) against pin 16 (Data Ready), so AKD can't rise until a key is decoded, but once AKD rises it can remain high until it falls on its own. (ie: all keys released)

 

BTW, that's the same 40-pin socket pictured in comment #54 earlier.

All told, I know of 6 ways to work around the keyboard issue in Prince Of Persia:

  • Use a joystick to play Prince Of Persia, not the keyboard.
  • Switch to an Apple IIgs.  It doesn't have this issue.
  • Use 40-pin sockets to gate pin-5 as illustrated above.
  • Replace the KR9600-PRO or AY-5-3600-PRO with the JCM-1 Universal Keyboard Decoder.
  • Use a pre-boot patch, like the PoPABoL disk attached to my blogpost.
  • Use a Prince Of Persia replica that has a software bug fix built-in.

 

It would probably be easy to use Watson to apply the fix to any of the Prince Of Persia cracks, but I haven't attempted that.  I plan to blogpost the details of the bug itself, my software patch, and a reverse-engineering of Jordan Mechner's apparent effort to fix it himself...without success.

Offline
Last seen: 7 months 1 week ago
Joined: Mar 31 2024 - 19:03
Posts: 1
CVT wrote:I was under the
CVT wrote:

I was under the same impression when I first started learning about this, but it turned out to be incorrect. Basically the PRO picked one full matrix mapping, standardized it and documented it in the datasheet, so it can be easily remapped externally.

Thanks for sharing your progress with the keyboard encoder! I would have one question, if the PRO is just a generic matrix scanner, how come the first replacements you ordered didn't work?

I am in a similar situation, I think my board may need a replacement for the AY-5-3600-PRO (the current one keeps lines AKD and KBD high all the time, and it spams thr same character in the prompt continuously). But odering the replacement from JCM is just too expensive with shipping to Europe, so I was hoping to be able to make one of the Aliexpress ones work.

CVT
CVT's picture
Offline
Last seen: 1 day 6 hours ago
Joined: Aug 9 2022 - 00:48
Posts: 1165
segmentation_fault wrote:...I
segmentation_fault wrote:
...
I would have one question, if the PRO is just a generic matrix scanner, how come the first replacements you ordered didn't work?
...

 

You will find my best-guess answer to this quetion in this thread: https://www.applefritter.com/comment/102858#comment-102858

 

However now it looks like the Chinese seller knows what he has and has decided to increase the price of the KR9600-PRO by a factor of 10.

Online
Last seen: 2 min 23 sec ago
Joined: Jan 31 2024 - 06:40
Posts: 215
CVT wrote:segmentation_fault
CVT wrote:
segmentation_fault wrote:
...
I would have one question, if the PRO is just a generic matrix scanner, how come the first replacements you ordered didn't work?
...

 

You will find my best-guess answer to this quetion in this thread: 

Most likely a big apple2 involved (re)seller following this thread had purchased significant amount of these chips from aliexpress (the listed quantity halved) and that pupmed their price inflation. As a second thought people selling 3600 replacements may have enlighten the Chinese seller.  Starting to appreciate our Pravetz 8A clones without this encoder. 

Offline
Last seen: 1 week 1 day ago
Joined: May 31 2022 - 18:18
Posts: 360
CVT wrote: However now it
CVT wrote:
 
However now it looks like the Chinese seller knows what he has and has decided to increase the price of the KR9600-PRO by a factor of 10.

 

Are you sure about this? I just looked using Scott's link from earlier and see it's $22/5  and there are other sellers selling what may or may not be different versions of the 9600-pro. I now need to figure out which ones may or may not be compatible because I'd like a few spares. 

CVT
CVT's picture
Offline
Last seen: 1 day 6 hours ago
Joined: Aug 9 2022 - 00:48
Posts: 1165
jeff d wrote:CVT wrote:
jeff d wrote:
CVT wrote:
 
However now it looks like the Chinese seller knows what he has and has decided to increase the price of the KR9600-PRO by a factor of 10.

 

Are you sure about this? I just looked using Scott's link from earlier and see it's $22/5  and there are other sellers

 

I was talking about the link I provided: https://www.aliexpress.com/item/4000830397007.html

 

Now it's $27.36 + $4.17 for shipping, for a total of $31.51 (VAT included). Sure it's 5 chips now, but usually you only need one, so it's no longer a bargain over the JCM Universal Keyboard Encoder, which is guaranteed to work and can be easily configured for various Apple II and Apple III machines: https://jcm-1.com/product/jcm-universal-keyboard-encoder/

 

Here is my original order:

 

Online
Last seen: 2 min 23 sec ago
Joined: Jan 31 2024 - 06:40
Posts: 215
IMG_3672.JPG
These days I had to repair an Asian Apple ][e clone. One of the defective components was keyboard controller. It appears they use different than the Apple 2e controller based on PIC1650A. I have no replacement for these so had to figure out which matrix input was burnt and made a low output impedance amplifier to drive the problematic PIN. Now computer works great.  
Online
Last seen: 2 min 23 sec ago
Joined: Jan 31 2024 - 06:40
Posts: 215
There's a related discussion

There's a related discussion about dumping the  factory FW of that controller:

 https://www.eevblog.com/forum/microcontrollers/looking-for-information-on-test-pin-and-ways-to-dump-mask-rom-of-pic1650-pic165x/msg5482066/#msg5482066

Pages

Log in or register to post comments