It Freakin' Works!!!
September 22, 2023 9:15 AM   Subscribe

Repairing an Apple II Clone (1/3) "In the early 80s, the Apple II had was selling well but it was expensive. This is where foreign companies stepped in and started making clones. These machines were much cheaper but also illegal due to them using copied ROMs."

It's filled with oscilloscopes, shorts and bad chips.

Part 2
Part 3

Initial "unboxing" from his second channel
posted by kathrynm (23 comments total) 11 users marked this as a favorite
 
I was at Apple during these days. There was a clone company called Franklin that got sued. The proof that they copied the ROMs was the existence of the name of one of the programmers at Apple in the ROM in their machine. QED.
posted by njohnson23 at 9:25 AM on September 22, 2023 [3 favorites]


This video is a Franklin Ace! Not actually copied ROMs, in theory a clean room ROM but actually not. The weird thing is it was mostly an Apple ][+ ROM but it supported lowercase (like a //e) and 64k of RAM with the extra 16k bank switch feature. Also its clock ran at something like 1.022MHz instead of Apple's 1.023MHz, just far enough off to cause problems with timing loops generating DTMF tones to dial a modem. When Apple released ProDOS they put a check in and crashed if running on a Franklin.

(This detailed knowledge from the brain of 12-year-old me, who had this clone and learned enough machine language chops to work around them.)
posted by Nelson at 9:31 AM on September 22, 2023 [8 favorites]


See also the "Stolen from Apple" story at folklore.org.
posted by RonButNotStupid at 9:34 AM on September 22, 2023 [4 favorites]


The machine in the video is not a Franklin. This is a no-name knockoff of the Apple II+ with an Apple-style case, copied ROMs (they didn't even change the "Apple ][" boot message) and a weird Sinclair-style keyword autocomplete feature.

I had one of these clones as a kid. It's a treat to see one in the wild again.
posted by Sauce Trough at 10:07 AM on September 22, 2023 [4 favorites]


I worked in the engineering department of a company back in the early 80s and some of the guys had pooled their money on a group buy of AppleII clone boards. They populated them with components out of the stock room, including the then-expensive 16K DRAM chips. The guy running the stock room was running a scam on the side, so no questions were ever asked.
posted by tommasz at 11:40 AM on September 22, 2023 [3 favorites]


I've seen a few of these. They vary in quality from the "might run for a few days" right up to "far better made that Apple ever did". The ROMS were complete copies, though. I remember my uncle in Hong Kong bough an Apple II clone in the market: it was built up while you waited, and you could choose what fruit sticker you wanted your clone to be called.

I recently handled a legal but very weird Apple II clone: the ITT 2020. Licensed from Apple, it was an Apple II with PAL graphics. The resolution was different, as was the memory map, but for a while it was one of the few ways to get a working (if only sorta compatible) Apple II in the UK. The Apple II Europlus killed it, so there aren't many around.
posted by scruss at 12:11 PM on September 22, 2023 [5 favorites]


I remember my uncle in Hong Kong bough an Apple II clone in the market: it was built up while you waited, and you could choose what fruit sticker you wanted your clone to be called.

Somewhere, Gene Simmons's mother is regretting that she didn't do this and choose the Banana Junior 6000.
posted by delfin at 12:33 PM on September 22, 2023 [5 favorites]


I had a Laser 128, one of the legal clones that was fully reverse engineered. It taught me that “95% compatible” is not an A grade, it’s more like a C-.

This was in the ‘90s when educational institution dumpsters were lousy with Apple gear, so I never really used it.
posted by Headfullofair at 12:36 PM on September 22, 2023


Also its clock ran at something like 1.022MHz instead of Apple's 1.023MHz, just far enough off to cause problems with timing loops

The Apple II was originally released with a 14.318MHz master clock; divide that by four and you get 3.5795MHz, the NTSC colorburst frequency.

The Apple II video timing chain divided the master clock by 2 to generate the ~7MHz pixel clock used in text and hi-res graphics modes. This got further divided by 7 to generate a CPU clock at 1.0227MHz.

On every 65th cycle, though, the CPU clock was stretched by an extra 7MHz period to keep the interleaved CPU and video DMA cycles synchronized with the horizontal video line rate, which therefore came out to 14.318MHz / 2 / (65 * 7 + 1) = 15700Hz.

That line rate is nonstandard for color NTSC; without the extra per-line clock stretch, the line rate would have been 14.318MHz / 2 / (65 * 7) = 15734Hz which is standard. So why, you may well ask, was that stretch in the design?

It was done to make the line rate an integer submultiple of the colorburst frequency rather than a half-integer submultiple, thereby maximizing spectral interference between luminance and chrominance information rather than minimizing it. This allowed the Apple II to make an NTSC color television show fully saturated colors just by emitting sequences of alternating black and white pixels: the TV interpreted the resulting 3.5795MHz square waves as a color subcarrier signal.

To avoid this cheap hack causing horrible color fringing in text mode, another cheap hack just turned off the color burst signal entirely for all the text mode video lines. This is also why the mixed graphics and text modes worked the way they did - you could get both nasty fringey color graphics and reasonably sharp text on screen at the same time if you were content to put all your text in the bottom sixth of the display.

Oh, and the field rate was nonstandard as well: rather than dividing twice the line frequency by 525 to get the field clock, the Apple II just divided the line rate by 262. The resulting fields were close enough to standard that a TV would lock onto them, but they were also not interleaved, which is why a TV connected to an Apple II displayed 262 lines at ~60Hz rather than the NTSC standard 525 interleaved lines at ~30Hz.

All of the Apple II's color generation, then, relied on the way its video timing chain worked. There was no circuitry at all that in any way resembled a conventional NTSC color encoder.

The Apple II Europlus, designed for markets where the prevailing video standards are built around 625 lines at 25 frames per second, left almost all of that timing logic unchanged except that (a) the master clock ran at 14.250MHz instead of 14.318MHz, yielding a line rate that actually was the standard 15625Hz expected by PAL and SECAM televisions and (b) the line rate was divided by 312 instead of 262 to get a field rate near enough to 50Hz. The Europlus motherboard did not provide a PAL- or SECAM-compatible color signal; that had to be done by plugging an accessory color encoder card into motherboard slot 7, which had a couple of timing signals available on its edge connector that weren't present on other slots.

The change of master clock frequency did indeed drop the Europlus's CPU clock speed by about half a percent. That caused a bit of occasional timing loop trouble, though not as much as every 65th CPU cycle being 14 percent slow on every Apple II by design.

I never had my hands on the ITT 2020 that scruss mentions, but I did once see a machine at an Apple User's Society of Melbourne meeting that I assume was a clone of that clone. I believe it used a similar colorburst hack to Apple's NTSC one to coax artifact colors out of a PAL television. Its text character cells were nine pixels wide instead of the Apple's seven, necessitating a very weird video memory map even by Apple standards and rendering it completely incompatible with all existing Apple II game software. As engineering choices go, those were fairly perverse.
posted by flabdablet at 1:28 PM on September 22, 2023 [13 favorites]


So, returning to the machine presented in the video, which is almost exactly like the one I had as a kid -- I've always wondered why this cheapass clone had the keyword shortcut key feature.

(if you haven't watched the video -- the clone replaces the power indicator on a genuine Apple 2 with a modifier key that you can use, alone with another key, to get a BASIC/DOS 3.3 keyword auto-typed for you. So if you typed Mod + G, you'd get GOSUB, mod+X was XDRAW, and so forth. The keycaps included the keyword on the side facing the user)

The clone's virtue is that it's cheap, so why would someone engineer this new feature into one and produce a physical keyboard to match? Maybe having the keywords accessible on the keyboard was an internationalization feature, intended to help non-English-speaking audiences use the computer?

As far as compatibility goes, mine appeared to be 100% compatible with DOS 3.3 software. I never tried ProDOS on it. It was also robust enough to stand up to a couple years continuous use until I saved all my milk money and upgraded to an Atari ST.
posted by Sauce Trough at 2:53 PM on September 22, 2023 [2 favorites]


My dad built one of these when I was a kid. He spent many nights soldering chips to the board.
That computer lasted all the way from middle school to college. I did all my high school papers on it.

I think he got it along with a bunch of other people where he worked.
posted by cuscutis at 5:05 PM on September 22, 2023 [1 favorite]


I wasn't a techie, but I learned enough soldering to build a decent functional Apple II clone in our Art School experimental electronics class in the early 80s. Fun times.
posted by ovvl at 5:18 PM on September 22, 2023 [1 favorite]


That seems like a lot of defects ... bad CPU, bad transistors, shorts in the address lines, etc. In contrast, after 40 years my old II+ only had a couple of bad RAM chips that needed replacing, even the power supply still worked. Guess you pay a little extra for QC.
posted by credulous at 7:02 PM on September 22, 2023 [1 favorite]


I believe he said he rescued it from a junk heap and the keyboard was rusted and worse.

I remember the integer BASIC card. Had a friend who's a real hacker back then, he'll load a game, flip the switch, and flip into monitor and troll around in 6502 machine language to break copy protection for funsies.
posted by kschang at 1:21 PM on September 23, 2023


There were rare cases in which breaking copy protection made the software work less well.

Roland Gustafsson's RW18 fast loader implemented a unique formatting for disk tracks that standard Apple II disk copy routines couldn't work with, which made it function as a very effective copy protection mechanism. But it also pulled games off disks at more than twice the speed of the best available disk read code for standard Apple formats, and packed 12% more information onto those tracks as well. So if you managed to crack a disk distributed with that fast loader, you'd end up with something not quite as good and possibly requiring multiple disks.

I did crack several of the Broderbund Software titles that came with that fast loader, to make versions that the company I worked for at the time could transcribe onto our shared hard disk drive product for the benefit of customers who already owned those titles. Doing that involved disassembling and understanding RW18 and consequently coming to view its author with something close to genuine awe, mainly because his loader pulled stuff off floppies very nearly as fast as we could load it off our networked hard drive. It was the only software available at the time that could do that.

I last mentioned RW18 on Metafilter back in the Before Times, by the end of which thread I'd heard from Roland who said he was going to make the source code available. Heard nothing further, but I've just checked and there it is on GitHub, hand-transcribed from Roland's 2016 YouTube scroll-through by the kind of magnificent Apple II obsessive who has made the community that still exists around that machine the beautiful thing that it is.
posted by flabdablet at 1:09 AM on September 24, 2023 [3 favorites]


I too had a home-built Apple clone in high school. This is the first time in my life that I have used the word "too" in that sentence. Metafilter is an amazing place. I guess I have to tell my story, as best I remember it.

I believe it was the summer of 1981, and I was 12. My parents had recently divorced, and I was visiting my father, who was on sabbatical at UC Berkeley. Returning from a trip to Japan, he showed me what he had found in Akihabara or some such place: an Apple II clone circuit board and a bag of chips and other parts. Instructions in Japanese, which neither of us speak, but lots of diagrams. He told me that if I could put it together, then I could keep it. So I spent the next several weeks on the floor of his apartment with a soldering iron, and he got some work done in peace and quiet. The summer ended with a complete circuit board, but no keyboard, disk drive or monitor. I figured I must have made at least one bad connection, and it wouldn't work. But later that fall, my father hooked it up to a weird J&R keyboard, standard Apple disk, and delivered it to me in a transparent plexiglass case that he had put together. It freakin' worked!!!

That said, I will never know how many of my mistakes he had to track down and fix. And it was a bit glitchy occasionally.

But I developed my coding skills on that beautiful one-of-a-kind frankenstein computer: BASIC, Pascal, Forth, 6502 assembly... for maybe 5 years until I got an Amiga 1000.
posted by brambleboy at 12:06 PM on September 24, 2023 [2 favorites]


I was team laser 128.
posted by jeffamaphone at 8:10 AM on September 25, 2023


just far enough off to cause problems with timing loops generating DTMF tones to dial a modem

What was your approach to generating DTMF tones? I ask because I once wrote a DTMF generator for the Apple II that I was quite pleased with, and I'd be interested to compare notes.

Mine generated summed sine waves on a pulse width modulated carrier at the video horizontal scan rate (i.e. 65 CPU cycles per sample) so that the stretched clocks would wind up at a consistent spot inside the PWM waveform for the duration of any given DTMF loop and therefore not cause jitter.

This choice of sample rate also let me debug the thing by arranging for it to toggle the graphics mode latch instead of the speaker. Filling a hi-res graphics page with white would get me a sideways oscilloscope-style trace that could I also lock to vsync by fooling with the timing in the calling routine.

All DTMF tones were well within 1% of the specified frequencies for both the original 15700Hz and Europlus 15625Hz scan rates. It sounded really clean, and dialled reliably on any phone whose mouthpiece I put near the Apple II speaker.

The floppies with the source code on them seem to have gone to God, so I'm currently in the process of recreating this routine from memory. Most enjoyable.
posted by flabdablet at 9:27 AM on September 25, 2023


I was using Cats Meow with an Apple Cat modem. It generated sounds directly on the phone line, you could also play bad voice synth and music. No idea how the DTMF generator worked I just had some hack to change a constant, presumably timing related.
posted by Nelson at 7:00 AM on September 27, 2023


Quick look at that product suggests to me that it probably featured somewhat more sophisticated audio generation hardware than the inbuilt Apple speaker.

Getting usable DTMF out of the inbuilt speaker is quite challenging, because the only thing the hardware can do is toggle a flip-flop that switches the voice coil between having either 5V or 0V applied to it. There's a current limiting resistor in series with the speaker, and a capacitor in the signal path to stop the voice coil burning out from being left energized, but that's it. There's no DAC. Well, technically there kind of is, but it's only a one-bit DAC.

Over the years I'd seen various attempts to implement a better DAC in software using pulse-width modulation. SoftDAC is typical of the genre. There were also games with something very much like SoftDAC built in to do sound effects. The first time I heard an unmodified Apple II+ shout "Delta-One-Niner, Mayday!! We are lost behind Jupiter! Roger this is Delta-One-Niner, we have you on radar, we are go on hyperspace!" I was seriously impressed. But the PWM carrier this technique uses is a clearly audible 11kHz, and the PWM resolution is only four bits, so the resulting sound is noisy as hell and very distorted.

The PWM code I wrote and am currently reinventing pushes the PWM carrier frequency up to the video line rate, which at nearly 16kHz is much less intrusive. It also raises the duty-cycle resolution from 16 levels to 51 (i.e. closer to six bits than four) and synthesizes paired DTMF tones accurately on the fly.

The old version was quiet and clean enough to place a phone call reliably by holding the handset near the Apple speaker, though back in the day I got better results by using half of a shit-grade pair of over-ear headphones to make a dialling cup. It took quite a large chunk of weird, unrolled spaghetti code to make it work, but for what other purpose did God put 48K of RAM in a personal computer?

I'm doing it slightly differently this time around and the new version will be a bit smaller. Should go close to fitting into 2K all up.
posted by flabdablet at 2:16 PM on September 28, 2023 [1 favorite]


You are way more expert at this than I am flabdabbet, your project sounds fun. I may just be showing off but maybe these vague memories are helpful.

Yes, the Apple Cat had special audio generation hardware separate from the Apple speaker. It was quite a neat little bit of hardware. Affordable 1200bps! Well, half duplex at least.

I remember being blown away by a game that had (very lo fi) 4 part harmony in an endgame cutscene sequence. It was kind of like the Ewok party at the end of Jedi, but I don't think it was a Star Wars game. They played some music with 4 voices. I dimly remember reading how one trick was that loading from $C030 would click the speaker, but storing to it would click the speaker twice in rapid succession. That effectively gave you two atomic sounds to build from.

I wonder how hard it is to get working Mockingboard hardware? I know it exists in emulation.
posted by Nelson at 2:43 PM on September 28, 2023


I dimly remember reading how one trick was that loading from $C030 would click the speaker, but storing to it would click the speaker twice in rapid succession.

Every access to location $C030 applies one clock edge to the flipflop that drives the speaker, causing it to flip to the opposite output state and thereby cause a single click.

If you're working in BASIC you can get a loud click using something like X = PEEK(49200), or a barely perceptible click using POKE 49200,X. The difference is because the STA instruction that the BASIC interpreter eventually runs to perform that POKE happens to use the 6502's indirect indexed addressing mode, which performs a dummy read cycle just before the write. So the speaker flipflop ends up toggled twice about one microsecond apart, and delivers an almost nonexistent glitch to the speaker instead of a solid voltage transition.

In machine code you can get the same solid click whether reading or writing, as long as you avoid addressing modes that do those dummy reads. Using a simple STA $C030 instruction (a write) is often preferred because it doesn't alter any CPU registers or status flags.

While the DTMF code I'm working on is running, it does a STA $C030 on every 65th CPU clock to toggle the speaker flipflop and start an output pulse. That instruction takes four clocks to execute (three to read the instruction, one to do the write) leaving 61 in between. That's just seven more than is needed to increment and test a 16-bit pulse count, index and fetch a couple of sine wave sample values, add them together to calculate a new DTMF sample value, execute a second STA $C030 to toggle the speaker flipflop back again and complete the output pulse, and use the sample value to dispatch to one of 51 separate code paths for generating the next pulse. Each of those paths has the second STA $C030 happening at a different time, somewhere from 9 to 59 cycles after the first.

So what comes out of the speaker is a pulse train with a fixed period of 65 CPU clocks (i.e. a frequency of 15625 or 15700Hz as discussed earlier) and a duty cycle between 9:56 and 59:6, with the duty cycle of any given pulse set by the DTMF sample value calculated during the previous one. The general shittiness of the Apple speaker acts as a crude lowpass filter, averaging out that nearly-ultrasonic pulse train into audio. The highest DTMF modulation frequency is 1633Hz and the pulse train goes at about 10 times that, so the resulting distortion is acceptably low although still clearly perceptible.

Getting the timing right is a little tricky because there are indeed only seven spare clocks available per pulse for pure time padding, and the instructions involved all require 2, 3 or 4 clocks each so I can't just step the second STA $C030 along the code one clock at a time but need to do a bit of instruction re-ordering as well.

I like writing timing-critical code. It's relaxing and contemplative, a bit like doing crosswords or jigsaw puzzles.
posted by flabdablet at 8:29 AM on September 29, 2023 [1 favorite]


The economy of Apple II mainboard was legendary, partly thanks to Steve Wozniak.

IIRC, Woz had a job at HP, like likes to meet with Jobs and the rest of geeks, and Jobs was working at Atari, and supposedly often bring a job to Woz and ask him to simplify the circuits so Jobs can get a bonus. The story was that Jobs ended up only paying a $350 bonus to Woz and kept the rest? :D Many of the simplified circuits for the arcade games from Atari at the time was touched by Woz. Supposedly a project that normally takes up 200+ chips ended at at 45 chips after Wozniak went on an optimization binge over 4 days. However, "... in an effort to use less chips, unreliable and unrepeatable glitch logic was used to short circuit the need for more chips to implement synchronous clocking logic."
posted by kschang at 11:18 AM on October 1, 2023


« Older Escape from Dogtown.   |   Right now, a deadly virus is in the air. Newer »


This thread has been archived and is closed to new comments