Please support the defense of Ukraine.
Direct or via Unclutter App
No Ads.
No Trackers.
No Social Media.
All Content Locally Hosted.
Built on Free Software.
We have complied with zero government requests for information.
~ Est. 1999 ~
A pillar of corporate stability since the second millenium.
© 1999-2999 Tom Owad
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.
IMG_0864.JPG
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.
Coleco ADAM.jpg
Book excerpt from 2007:
cores1.png
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!
IMG_1017.JPG
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.)
IMG_1018.JPG
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.
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
s-l1600.jpg
2: https://maraindustrial.com/cart/circuit-boards/heidelberg-web-systems-pca5347051-keyboard-encoder-board-new-no-box.html
heidelberg-web-systems-pca5347051-keyboard-encoder-board-new-no-box.jpg
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.
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.
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.
Oh, that's interesting. I was under the impression they all had to be factory programmed for a certain matrix.
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:
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.
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...
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:
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"]
Oopsie, correction...the parts are different, but the SMC part has "no connection" at pin 27.
SharedScreenshot.jpg
GI's part still needs -12 volts at pin 27, according to its data sheet.
Screencap.png
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.
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.)
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)
IMG_0982.JPG
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:
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.
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.
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.
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.
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.
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:
KR9600-PRO.png
IMG_3672.JPG
IMG_3673.JPG
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