WarpSE: 25 MHz 68HC000-based accelerator for Mac SE

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,656
1,416
113
53
Japan
youtube.com
Absolutely incredible, Zane. SE owners worldwide would be nuts NOT to buy the WarpSE, even if they already have another accelerator, mainly because you have address the distorted sound problem! I'm definitely going to make a video about it once they are released. This is ground-breaking work. Bravo!
 

Zane Kaminski

Administrator
Staff member
Founder
Sep 5, 2021
372
612
93
Columbus, Ohio, USA
New idea for the sound fix. If I can get this to work before I send out test units that'll be great. The sound slowdown works well now but it's not cycle-accurate. That would be more robust but the current hardware can't pause the fast 68k's clock. I thought this would make cycle-accurate sound slowdown impossible. I'll add CPU clock gating to the next version but I have a solution that makes cycle-accurate sound slowdown with the current hardware possible

I can't stop the clock, but what I can do is keep track of how many clock cycles have gone by and then add wait states to subsequent bus cycles to maintain an average rate of 7.8336 MHz. Here's the code:
Screenshot 2023-04-17 at 5.52.50 AM.png


It's sort of like credit-based flow control in networking but you can go into the negative. The 8-bit Credits register holds a signed (two's complement) number of cycle "credits." When the fast 68k executes a cycle of useful work (i.e. not a wait state), the credit counter is decreased by 1. When the credits are negative (i.e. Credits[7] is 1), the sound QoS inserts wait states in the next bus cycle. Every time a 7.8336 MHz clock falling edge occurs, the credits are increased. So this matches the overall rate of the fast CPU to the slow frequency.

The control for the credit counter is pretty simple. It involves the SndSlowEN "sound slowdown triggered," FSBW "fast/frontside bus waiting," and C8MFall "8 MHz clock just fell" signals. SndSlowEN is true during the 30-40 microseconds after a sound access. FSBW is true on the fifth and subsequent clock cycles of a bus access. So it indicates if wait states are being inserted. C8MFall is an indication in the 25 MHz bus domain that the 7.8336 MHz clock just went from 1 to 0.

When SndSlowEN is false, sound slowdown hasn't been triggered so the credit register gets reset to 0, which is nonnegative, so slowdown won't be triggered. Otherwise, when FSBW is false, that means the current clock is not a wait state and so the 68k is running at "full speed." Therefore we use up one credit. When C8MFall is true, the credit counter increments to give back credits on average at the 7.8336 MHz Mac clock rate. And when both or neither happen, the credit counter stays the same since they either cancel out or neither a C8M fall nor an FSB non-wait state occurred.

The credit counter has quite a large range. Half of it is wasted since it'll never go above 1. The reason for the range is so that it can go all the way to -128. When executing a multiply instruction, depending on the numbers being multiplied, the 68k might think for 66 clock cycles between accessing the RAM! So we need to go to at least -74 if we want the timer not to roll over during a long multiply. Divide is even longer on the 68k and can take up to 160 clocks (IIRC). Rolling over won't crash anything but it'll result in the system running full-speed for 256 more clock cycles than it's supposed to. If that happens repeatedly during sound generation then the sound fix won't work. Fortunately dividing is so slow on the 68000 that it's impractical to use during sound generation anyway. So -127 to 128 is a good range for the sound clock credit counter.

Should work if it fits in the CPLD. It's getting a bit tight. I'll try this in the next day or two.
 
Last edited:

Patrick

Tinkerer
Oct 26, 2021
435
1
224
43
So how do faster macs solve this problem? do they simply have a bigger sound buffer ?
 

Zane Kaminski

Administrator
Staff member
Founder
Sep 5, 2021
372
612
93
Columbus, Ohio, USA
So how do faster macs solve this problem? do they simply have a bigger sound buffer ?
They've got the Apple Sound Chip (ASC) which fixes a lot of the limitations of the SE sound. See here: https://se30forever.com/sound.html
That link goes over the basics but the original designer has a bit more to say about the timing here:

https://web.archive.org/web/20190103001714/https://www.byrdsight.com/apple-macintosh/
"The chip had two 1K byte SRAMs that could be configured as FIFOs (First In First Out memories) using chasing pointers. FIFO mode enabled the processor to stuff audio values into the FIFO in an opportunistic “dump and run” mode, while the chip fed the FIFO output values to the audio DAC at a steady rate."

Apparently this was necessary since the Mac II didn't have integrated video, so there was no VSYNC interrupt to rely on to generate the sound, and even if there was, it would occur at a different rate depending on the screen resolution. So I guess with the ASC, it sends its own interrupt when it's getting low on samples, and the CPU just fills up the FIFO without worrying about where to start writing and how to fast to go to avoid corrupting the sound output.
 
  • Love
Reactions: Patrick

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,656
1,416
113
53
Japan
youtube.com
Oh and on the subject of testing @JDW @alxlab @Kai Robinson I have had you guys in mind as beta testers so let me know if you have a working SE to try the WarpSE in and I'll send you one.
My SE has a pristine and problem-free "SE Reloaded" motherboard which currently has a Levco SuperMac Speedcard (16MHz 68000) installed in the PDS slot. I also have a stock SE motherboard. 4MB of RAM. I have the OLD ROMs & IWM chip. Don't have the new ROMs, unfortunately.
 

Zane Kaminski

Administrator
Staff member
Founder
Sep 5, 2021
372
612
93
Columbus, Ohio, USA
Don't have the new ROMs, unfortunately.
On that note, should we sell an FDHD ROM kit for the SE? Obviously due to the WarpSE’s fast ROM it’s not necessary with the accelerator. The specific pinout of the SE FDHD ROM is not compatible with flash or EPROMs so you have to have a custom board. We sell our Apple IIgs ROM01 replacement which has the same pinout so we could do the SE FDHD ROM at any time. Is it worth it?

We sell the IIgs ROM01 for $25 which kinda feels like a ripoff but it’s hard to make and a bit costly. Picture:
B3E89523-7CE7-424D-A55C-2F7B69ADBFCE.jpeg
$3+ for the carrier with the DIP legs, $2+ for the ROM, $3.50-4.50 domestic shipping, $3 eBay fees and it’s quite difficult to solder the board to the DIP carrier. So since the SE FDHD ROM set has two chips it’d have to be $30-35. Honestly it sounds like a lot of money and you don’t even get an IWM. Any thoughts? I’ll send you a set James if we do make a batch or FDHD ROMs but I dunno if anyone will buy em.
 
  • Love
Reactions: JDW

Zane Kaminski

Administrator
Staff member
Founder
Sep 5, 2021
372
612
93
Columbus, Ohio, USA
And it even has a switch between 20 and 25 MHz!
Well actually I’m gonna eliminate 20 MHz mode because it’s not that useful. Why not just go 25 MHz? That’s 25% better lol. And motherboard ROM mode is going away as well since it’s also not too useful except for fixing a bad fast ROM flash. You can just use the update system to fix that instead. 3rd switch was just to have another setting if I felt I needed one. Wasn’t needed though.
 

retr01

Senior Tinkerer
Jun 6, 2022
2,474
1
796
113
Utah, USA
retr01.com
Well actually I’m gonna eliminate 20 MHz mode because it’s not that useful. Why not just go 25 MHz? That’s 25% better lol.

Okay, so switch one will be available for other uses?

And motherboard ROM mode is going away as well since it’s also not too useful except for fixing a bad fast ROM flash. You can just use the update system to fix that instead.

Another switch to use for something else?

3rd switch was just to have another setting if I felt I needed one. Wasn’t needed though.

WiFi? :)

1681799120656.png
 

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,656
1,416
113
53
Japan
youtube.com
On that note, should we sell an FDHD ROM kit for the SE? Obviously due to the WarpSE’s fast ROM it’s not necessary with the accelerator. The specific pinout of the SE FDHD ROM is not compatible with flash or EPROMs so you have to have a custom board. We sell our Apple IIgs ROM01 replacement which has the same pinout so we could do the SE FDHD ROM at any time. Is it worth it?

We sell the IIgs ROM01 for $25 which kinda feels like a ripoff but it’s hard to make and a bit costly. Picture:
View attachment 11874
$3+ for the carrier with the DIP legs, $2+ for the ROM, $3.50-4.50 domestic shipping, $3 eBay fees and it’s quite difficult to solder the board to the DIP carrier. So since the SE FDHD ROM set has two chips it’d have to be $30-35. Honestly it sounds like a lot of money and you don’t even get an IWM. Any thoughts? I’ll send you a set James if we do make a batch or FDHD ROMs but I dunno if anyone will buy em.
We need to consider demand from people outside the US too because, well, I am among those folks. :) If shipping to destinations outside the US costs as much as the item itself, then you'd probably only get demand within the US, except for a rare sale here and there to folks who don't really care about price. Not sure how cheaply USPS can ship tiny and light packages these days. People outside the US probably wouldn't mind $10-$12 in shipping, but $30 or more in shipping would be pretty painful.

But within the USA, $35 "shipped" might sell to people who really want to upgrade their floppy drive and who don't care about running old OS's below System 6 (for people with stock SE boards who have no intention of buying a WarpSE). Right now, if somebody wants to upgrade their old stock ROMs to the new FDHD-compatible version, they'd either have to (1) buy an SE board and extract the ROM, which is costly and wasteful; or (2) use the Gerber files from @max1zzz to make no less than 5 PCBs at JLC or PCBway, then buy the chip and header pins, and then buy a programmer (which most people don't have) to program the chip, then do the assembly.

For the vast majority of vintage Mac hobbyists though, a ready-to-go turnkey solution like you propose is ideal. It's then a matter of would-be buyers squabbling over the price. Would people in the US squabble over $35 shipped for a ready-to-use FDHD-compatible ROM replacement made by Garrett's Workshop? Well, I can't say for sure, but we could poll people about it, both here on TD and on FaceBook groups.

But just to reconfirm, when the WarpSE is installed on a SE motherboard, the stock ROMs could be old or new, and they could have the IWM or SWIM chip, and it won't matter, correct? (We talked earlier in this thread about ROM version switching -- the purpose being that if you switch to the old ROMs, you can boot System 1.0 and later and have 400K/800K disk compatibility, and if you switch to the new ROMs, you can boot from System 6 and later, and get compatibility with 400K/800K/1.44MB disks.)
 

Zane Kaminski

Administrator
Staff member
Founder
Sep 5, 2021
372
612
93
Columbus, Ohio, USA
Okay, so switch one will be available for other uses?
Another switch to use for something else?
Nah, let’s just eliminate the dip switch altogether. Why not? Then people will feel like they have to read the manual instead of just install it and go. I can’t see the need for any options except in one specific case. If the computer crashes during a flash, you need to use the “motherboard ROM” setting to fix it. We can just do that as a USB update that you apply, then you reflash the fast ROM having booted from motherboard ROM, then you use the USB update systwm go back to“fast ROM” mode.

And @JDW yeah, you get FDHD ROM with the WarpSE independent of your motherboard ROM. That is, unless you reflash the ROMs on the WarpSE.

No point doing a poll, we can just make a few next time we make our Apple IIgs ROM01. Only difference the ROM image and we must put a “SE FDHD LO” / “HI” sticker on the bottom. If it’s popular we’ll make more.
 
  • Love
  • Like
Reactions: retr01 and JDW

retr01

Senior Tinkerer
Jun 6, 2022
2,474
1
796
113
Utah, USA
retr01.com
I agree. Nowadays it’s a software switching rather than DIPs anyway. Just develop a CDEV for Systems 6 and 7. 😉

If any need to adjust for earlier System versions, it could be done on the fly with the onboard WarpSE detecting which System is being booted and adjusting accordingly. Hmmm.

Looking forward!
 

Zane Kaminski

Administrator
Staff member
Founder
Sep 5, 2021
372
612
93
Columbus, Ohio, USA
"I, there were several of my favorite computers that I liked to design over and over and over and get my designs better and better and better, meaning fewer parts."
I'm convinced doing this is the key to becoming a good engineer. Back in 2015/2016 I was working on this Bluetooth audio gizmo for Hondas and Acuras. We wanted to sell it but the margins on the product were going to be very tight and we had to make a large initial batch of these things, something like $10k or more worth of parts, so I couldn't afford to mess up and produce something subpar. I redesigned that product something like 13 or 15 times. I had no experience with electrical engineering at the time so my first few designs were awful. If we shipped them, they would have not worked right, broken after a while, hell maybe they could have even caught fire. By the final iteration, I think what I had was really good. Unfortunately it took so long for me to learn electrical engineering that our competitors were able to capture that opportunity first, with a lower-quality gizmo that could sell for a lower price. So good thing we didn't come out with it but the experience of feeling like I had to redo my design until it was perfect was a massive blessing.
 

mdeverhart

New Tinkerer
Apr 17, 2022
9
3
3
So since the SE FDHD ROM set has two chips it’d have to be $30-35. Honestly it sounds like a lot of money and you don’t even get an IWM. Any thoughts?
Hmm… if the SWIM weren’t required separately - maybe? With the SWIM I feel like you’re talking $50-60+, plus the cost of a SuperDrive. Generally speaking, I feel like you’re going to have two camps:

1. Folks that are generally content with the machine as-shipped (or prefer the original configuration for historical accuracy; these folks probably have both an original SE and an FDHD)
2. Folks that want to max everything out, and who will jump at the WarpSE (including the FDHD ROM), and will supply their own SWIM and SuperDrive (or have an FDHD that they’re upgrading with the WarpSE).

I’m not sure there are many folks in between, that effectively want to convert their original SE to an FDHD. At least, I could see myself in either #1 or #2, but I’m pretty sure I wouldn’t upgrade my 800k to be an FDHD - I’d either add a WarpSE and live with 800k floppies, or I’d pick up an FDHD and upgrade one (or both) of my SEs with WarpSEs.
 
  • Like
Reactions: JeffC and retr01