• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Another IIci ROM hack

dougg3

Well-known member
LOL! That would be an awesome startup chime! I have to admit I haven't seen Jurassic Park in ages and didn't get the reference, but I googled it and saw the clip...funny stuff!

 

Dennis Nedry

Well-known member
That was a Quadra 700 in Jurassic Park, which coincidentally is the same form factor as the IIci and IIcx.

Is the sound you played an actual sampled sound or did you use re-use the synthesizer somehow? It has quite a similar timbre as the original startup chime!

 

dougg3

Well-known member
I reused the synthesizer. It's one function that both the death chime and the startup sound share. I actually call the function multiple times, once for each chord. I haven't yet figured out how to use the Apple Sound Chip in sampled mode, but I'm guessing it is possible...it might take your "bigger ROM" hack to be able to fit anything though. It appears the chip supports 22-ish and 44.1 KHz 8-bit sound.

 

Dennis Nedry

Well-known member
Would it be of any help to inspect some Mac ROMs that have sampled startup sounds? I guess I'm not sure if they would have the same sound hardware or not, which could be a problem. I suppose you could find the address where the sampled sound starts in ROM and trace it back to some code and maybe get some clues.

I have a ROM dump of about every Mac ever made if you need any. I tried a few directly in my IIci. I know for sure there are others that are compatible, especially the IIfx, but I never found one with a sampled startup sound that worked.

 

dougg3

Well-known member
I remember reading that the II series ROMs are compatible with each other to some extent. The IIci's sound synthesizer code actually checks the version register of the sound chip and writes differently to the volume register based on the version. I never did figure out exactly what it was doing.

Yeah, looking at the oldest possible Mac that has a sampled chime would probably be the best way to go. The chips are likely similar in behavior. I think I have a few ROM dumps as well, but do you have any idea as to what a good candidate Mac model would be? The address of the sampled chime would be a big help in that case, and I also have ROM maps of many models that might be able to help me out (included with MPW).

Very interesting that you tried other ROMs. I was curious how that would turn out!

 

Dennis Nedry

Well-known member
Finding the address of the sound sample might not be too hard. When I ripped all of my lossless startup sounds, I did it by importing the entire ROM as a raw sound sample into an audio program, then adjusted things to the right settings (sample rate, bits, stereo/mono, etc) and cropped it. So I bet that the sound is stored at some very obvious starting address, like xxxx0000, which could be narrowed down significantly by trying to determine about where the sample starts in the audio program, then going back to the data and narrowing to an exact address.

I would recommend the Mac LC II or III ROM I think. They are the only 030s I am aware of that use a sampled startup sound. I'm not sure how much of an advantage it is for it to be an 030, but if an 040 is okay, I'm thinking that a Quadra 601 might be something else to try.

 

dougg3

Well-known member
Ah, that's a good idea! I just tried that with Audacity. I do happen to have LC II and III ROM images. I found the LC III's sampled startup sound using that trick (8-bit unsigned, mono, 22254 Hz), but I'm not so sure about the LC II -- it's only a 512 KB ROM, so is it possible that one is still synthesized? I did find a little horn honk sound, but that sound is also in the LC III. I guess I could find out for sure by disassembling the LC II's ROM. Either way, the LC III should work, and I should be able to get a good idea of where the sound starts in the ROM from Audacity.

Apple's ROM maps for the LC II are interesting:

They have ORIGBOOTBEEP, ORIGBOOTBEEP6, and ORIGERRORBEEP1-4 which are located at the exact same offsets as they are in the IIci. Then there is also BOOTBEEP, BOOTBEEP6, and ERRORBEEP1-4 which are located way farther on in the ROM. It's almost like they left some of the II series code in there alone...interesting...did you try an LC II ROM in the IIci? I suppose I could do that too since it's not any bigger...

The LC III has all of the beep related labels that are in the LC II, as well as some other stuff like DOBEEP, BEEPERLOOP, BEEPMIXERPATCHRETURN, and BEEPMIXERDONE. I'd say those would be a good place for me to start. It's possible that they might have something to do with the sampled startup sound.

I don't think it matters that much if I look at an 040 instead of an 030, so I could take a look at those too if the LC III doesn't get me anywhere.

 

Dennis Nedry

Well-known member
You know, I'm not sure what startup sound the LC II has. I know for sure that the original LC has a synthesized startup sound that is different than a Mac II.

I don't exactly recall anymore exactly, but I know that I tried at least one of the LC II or III ROMs.

 

dougg3

Well-known member
OK -- I listened to some of the chimes with Mactracker. It seems that the LC and LC II have the same startup chime (and it's the same as the startup chime for the Classic II). So I'm pretty sure the sampled startup chime coincides with having a ROM that's 1 MB or bigger.

I tried an LC II ROM image in my IIci just now, and nothing happened other than the fan turning on. So even though the ROM includes some of the sounds from the IIci, it apparently doesn't use them at all. Not all that surprising that it didn't work, but It's interesting that they left the old sounds in there...

The sampled sound in the LC III begins at offset 0xC67BE -- that's where the beginning of the 'snd ' header is. I went ahead and deciphered the header, and it's 31,178 samples long with a sample rate of about 22.254 KHz.

The LC III's ROM is mapped at 0x40800000. I didn't see any direct references to the sound header's address in the ROM, but that doesn't mean anything because addresses to most of the things in the IIci's ROM were loaded with a program-counter-relative offset. That would make sense because it makes the ROM position-independent in case they decided to map it elsewhere at the last second or whatever. I did find several references to the Apple Sound Chip's address, though, so that will give me some clues.

One thing that concerns me is that these Macs with larger ROMs have some soldered motherboard RAM. I'm hoping that the startup chime function isn't using RAM in these, because it might be more difficult to get it to work in the IIci. The IIci doesn't have any RAM set up when it plays the startup chime -- everything is passed around in registers, and it seems fairly standard that when you go to a subroutine, you put the address it should return to in A6 before jumping to it. I'm hoping that they did a similar thing in the LC III.

P.S. At long last my freaking DIP sockets are finally starting to loosen up. I thought I was going to destroy some of the pins on my EEPROMs when I was yanking them out with my cheapo DIP extractor tool.

 

trag

Well-known member
P.S. At long last my freaking DIP sockets are finally starting to loosen up. I thought I was going to destroy some of the pins on my EEPROMs when I was yanking them out with my cheapo DIP extractor tool.
:) You should have installed ZIF sockets...

Very cool hacking by the way.

 

Trash80toHP_Mini

NIGHT STALKER
Copyright Warning!

DANGER, DANGER, Will Robinson!

Keep any requests for info in PM! Stickifying this is a BAD idea.

I'll have one of the other mods move it to the, 'bot-resistant, lounge too! ;)

 

dougg3

Well-known member
:) You should have installed ZIF sockets...
Very cool hacking by the way.
Thanks! I considered them, but the ~$15 per socket price tag on DigiKey scared me away. On second thought it's really not that bad considering the convenience it adds...

Someone sticky this hack and put it on the front page. It is the coolest hack I've ever seen. :D
Gracias! :)

 

dougg3

Well-known member
I found the code that plays the LC III's startup chime and it did indeed reference the startup chime snd resource in a position-independent manner as I suspected. The code is a bit more complex than the IIci's code because it has several different code paths for different versions of the sound chip. In fact, if it finds the original sound chip from the IIci, it actually jumps to the old synthesized startup chime code! I also found some weird references to other snd resources that looked malformed -- a sampled sound with only 1 sample, and the high byte of the baseNote is 0xFE. and I didn't see anything about that in Inside Macintosh. It looks like the startup code goes to one of those weird sounds if yet a different sound chip version is found. I'm suspecting it's for the LC/LC II's startup chime, but I don't know for sure.

The good news, though, is that the sampled sound startup chime doesn't use RAM. So it should be possible to play a sampled sound without RAM. Once you get past all the complicated branching around for different sound chip versions, playing the sampled sound is pretty simple. The meat of the sound playing code is actually simpler than the IIci's synthesized sound code. You just sequentially write samples into a FIFO, and you check a register to see if there's room in the FIFO -- waiting until there's room. Hopefully that simple code is still possible with the IIci.

I wrote some test code to try to play the LC III startup chime on my IIci while booted into System 7.6 by directly accessing the sound chip registers, but it seems that the FIFO status registers act differently on different sound chips -- my program immediately hangs waiting for free space in the FIFO. If I ignore the status registers and write stuff on my own, I hear sound, but it is messed up and doesn't sound like the startup chime. I'm also wondering if the operating system is getting interrupts from the sound chip and resetting status flags before I get a chance to see them. My best bet might actually be to disassemble an old system file like from System 5 or 6 and see how it talks to the sound chip when it plays sounds.

Anyway, basically just wanted to say that sampled sounds will DEFINITELY be possible with the IIci, it's just a matter of figuring out how the sound chip wants me to talk to it!

 

Trash80toHP_Mini

NIGHT STALKER
We definitely need a PIRATE Emoticon! }:)

I envy your high level of patience and your low level code hackin' acumen! :approve:

I'll just have to stick to the Block Diagram Level and make do w/rearranging chunks of hardware . . .

. . . kinda like playing Jenga. ;)

Bits-n-Bytes are beyond me . . . :eek:)

Way to go my code hackin' bro! :cool:

 

dougg3

Well-known member
Haha, thanks! :) I'm jealous of you hardware hackin' types! All the electronics knowledge is way beyond me, and I think it's impressive that you guys know all about it. I hear these terms like "bypass capacitor" and "AC coupling" and "TTL" and all this other crazy stuff and have no idea what any of it means! LOL.

 
Top