News:

Want an XLerator? Please participate in the market research thread: https://lisalist2.com/index.php/topic,594.msg4180.html

Main Menu

Some disk images for Lisa 1 and Lisa 2/5 systems

Started by stepleton, December 20, 2025, 01:22:27 PM

Previous topic - Next topic

stepleton

Hi friends, I hope you all are having a nice holiday season...

These are 5 MB ProFile images in dc42 and raw (ESProFile, Cameo/Aphid etc.) formats. They are not suitable for Lisa 2/10s. They may be useful as a test of certain details of emulation accuracy, though I've not tried them in any emulator, only on real hardware.

https://archive.mg-1.uk/tmp/bill.zip
https://archive.mg-1.uk/tmp/julie.zip
https://archive.mg-1.uk/tmp/kevin.zip
https://archive.mg-1.uk/tmp/kris.zip
https://archive.mg-1.uk/tmp/richard.zip

Upon boot, each disk image loads a program and data into RAM and executes it. Once loaded, no input is taken from the user and nothing is read from/written to any disk or any I/O port. To regain use of your system, you will either need to wait until the program completes or press your Lisa's reset button.

The first image has fairly small memory requirements; the rest probably do best on a system with 1 MiB of RAM.

For those who try these images: feel free to comment but please don't spoil the surprise. I'll elaborate for the curious in a few days :-)

AlexTheCat123

Just tried them on the FPGA. That's pretty awesome!

ried


stepleton

Thanks for trying, folks! I'm glad to hear that it worked on the FPGA Lisa, which certainly speaks well to its implementation of the resources the programs use.

Lisa2

#4
Good job!

When I first tried on a 2/5 with 18Mhz XLerator, it works, but she runs too fast.... :o

I swapped in a stock CPU card and the speed is correct.

 

stepleton

Ha, that's interesting, but also a little bit puzzling. I've never seen or used an XLerator, but it sounds like it only modifies the CPU board, and if it doesn't modify the I/O board in any way, then I think I would expect it to work still.

Questions then:
- Does the XLerator change any of the clocking of I/O board components?
(Actually, we have some of our answer here..., don't we)
- Does the XLerator change any of the memory-mapped locations of I/O board things?

An XLerator in a 2/10 might have enough grunt to overcome the 2/10 hardware variations that make these programs unworkable there.

Jacexpo

Very happy to report that all titles work correctly on a Lisa with upgraded 3A roms.

Happy Holidays to all!

Chris

Lisa2

Quote from: stepleton on December 22, 2025, 04:18:41 AMAn XLerator in a 2/10 might have enough grunt to overcome the 2/10 hardware variations that make these programs unworkable there.

I tried on a 2/10 with an XLerator, she produced output but it was unintelligible.  I am guessing that timing is mission critical for this to work.

stepleton

#8
Quote from: Lisa2 on December 27, 2025, 10:31:37 PMI tried on a 2/10 with an XLerator, she produced output but it was unintelligible.  I am guessing that timing is mission critical for this to work.

In this case it's not timing exactly!

I promise I'm still working on a proper writeup, with code and everything, but my other computers keep breaking! So I'll say a few words as a stopgap.

What this was all about: sampled audio sound!

For those who haven't tried it, this program plays sampled audio at middling quality on a stock Lisa, which notionally only has the hardware to make beeps and clicks. Here's a crummy video that shows a bit of what this sounds like:
https://photos.app.goo.gl/Yb6EaDYYmpfmepyW9

Background of how it works

The Lisa 1 and Lisa 2/5 have an audio chain that goes like this:

"Keyboard" 6522 VIA pin CB2 --> Amplifier/volume ctrl --> Amplifier --> Speaker

(Refer to the schematic, especially the last page.) As you can see, the speaker can basically play only an amplified version of a digital signal: bits, in other words. This is great if you want to make a square wave, but if you want something else, you'll need to approximate it using a technique like pulse-density modulation.

Thankfully, pin CB2 on a 6522 is special: you can stuff a byte into the VIA in the right place and then the VIA will shift its bits out on pin CB2 on its own, giving you enough time to get the next byte and shove that into the VIA, and so on. It's a lot less CPU-intensive than wiggling a bit directly, which I gather is what the Apple II has to do.

The Lisa is not the only computer with this arrangement: it's also found in various models of Commodore PET. Earlier this year, a YouTuber demonstrated using this facility to play sampled audio on the PET, which you can see here. Readers with good memories may recall me pointing to this video on LisaList2 before. Anyway, I couldn't resist trying it out... eventually.

Lisa disadvantages and advantages

Compared to the PET, the Lisa has advantages and disadvantages. The main disadvantage is that the VIA is clocked (I believe) considerably more slowly on the Lisa 1 and Lisa 2/5 than it is on that YouTuber's PET. An additional problem is the complicated interleave between the VIA's clocking and the 68000's, and puzzlement about this was my main motivation for starting this thread. I am very grateful to @sigma7 for such detailed responses and hope I can be forgiven for a question or two that led attention away from what I was cooking, for the sake of the surprise. Despite the goose chase, I have a feeling that the unrelated information spelled out there will still be quite handy to have down the line!

Anyway, the huge advantage the Lisa has (besides a whole lot of RAM for storing lots of sample data) is the ability to select one of eight possible speaker volumes for the audio. If you're doing pulse-density modulation, this is a big win which I will now demonstrate.

Why volume control is a win for us

The easiest way to think about pulse-density modulation is to imagine a moving average going over the stream of bits. Basically, the position of the speaker cone should be the average of the last several bits coming out of the VIA. If they were 0000000, then the speaker cone should be drawn all the way back; if 1111111, it should be pushed all the way out. Makes sense, but what if you want the speaker to be "at rest" right in the middle of its travel? Well, the PDM way to do that is:

01010101010101010101010101010101010101010101010101010101

The moving average is 0.5, right in the middle. And what do you hear if you play that? Well, you'll probably hear something soft and high-pitched, depending on how fast the VIA is moving bits out of the shift register. If it's moving them quickly, then the inertia of the speaker and the rest of the audio system will probably average all of those wiggles out pretty well. Unfortunately you probably can't clock the bits out of the Lisa fast enough to avoid hearing something.

Fortunately, there is an alternative: just change the volume! Sure, you could hold the speaker at mid-travel by sending it 01010101..., or you could simply set the volume to 0. It works much better!

But the more satisfying win comes when you try to play audio with dynamics. Let's first say you want to play a loud square wave. This is no problem at all, just push these bits to the speaker:

00000000000000001111111111111111000000000000000011111111111111110000000000000000

This moves the speaker back and forth between position 0 and position 1. You get the loud buzz you're looking for. But if you want to play a soft square wave without controlling the volume directly, you've got a problem. You want the speaker to move back and forth between position 0.375 and 0.625, say. And that means you've got to do the best you can with the moving average, getting:

01000101010001010111010101011101010001010100010101110101010111010100010101000101

That's hardly different from the 01010101 0.5-average "at rest" bitstream I mentioned earlier --- to make it easier, I've bolded the few bits that are different. (Note how they coincide with the 1 and 0 regions of the original full-volume square wave.) It's hard to see, and at the rate you can clock the Lisa's VIA, it'll also be hard to hear. But again, on the Lisa you can just set the volume to something low and soft instead! Given what the Lisa makes available, you select 2/7ths of full loudness and then send this bitstream:

00001000001000001111011111011111000010000010000011110111110111110000100000100000

Now that's a tone you'll definitely hear! There are still a few flipped bits to try and nudge the speaker to average positions of 0.375 and 0.625, but the square wave still predominates.

Being able to control the volume envelope like this means you make better use of the bits you've got, and it was this advantage that I really wanted to explore after seeing the video I mentioned. In the end, I was only able to clock the VIA shift register at about half the rate of the ~60 KHz that the YouTuber could do with his PET, but the sound is still of comparable quality. If we only had the 64 KiB RAM of the PET, we could play twice as much audio. Happily, we have much more, and a 1 MiB Lisa can probably play around three minutes' worth!

Why it fails on a Lisa 2/10

...and why it's not strictly a matter of timing.

As has been noted on this forum, the 2/10 clocks its VIA much, much faster --- 2.5 times if I'm not mistaken. That's a big change, but Apple appears not to have wanted to inconvenience the primary clients of the Lisa speaker too much, so they added a bit of hardware as a stopgap. I'll write in a way that tries to give you a chance to guess what that was as you read along.

Most Lisa speaker applications involve making beeps, and for that you can take advantage of another 6522 feature. My audio demos work by sending bytes out of the shift register... but for that to work, the CPU needs to be ready to give the 6522 another byte exactly when it needs it. If all you want is a beep, life is much easier: you can tell the 6522 to simply play the same byte over and over, at a rate of your choosing. Different rates in combination with bytes like '01010101', '00110011', and '00001111' give you a few octaves of buzzy square-wave notes. Once you set the VIA a-buzzing, you don't need to do anything: it'll keep buzzing until you stop it. This is how beeping works in the Lisa OS and in the boot ROM.

All fine, but what if someone has made your VIA run about 2.5 times faster? Well, all of a sudden you'll need to change the bytes and the rates you've chosen by quite a lot if you want to make the same tones. You may even find that your "keyboard" of notes may be missing some keys because you can't specify certain necessary combination of bit patterns and playback frequencies anymore. Apple must have felt it necessary to fix this.

If you look at the boot ROM, specifically at location 0B24, you can see the ROM programmer dealing with the different clocking on the 2/10. There is a correction, but surprisingly it works by multiplying the clock period by only 1.25! That's just half of the 2.5 times frequency boost. What did Apple do? Can you guess?

To find out, compare the SPEAKER AMP section on the last page of the Lisa 1 I/O board schematic with the same part of the 2/10 schematic. Note U1F at the far left-hand side. The 2/10 pumps the audio bitstream through a 2:1 clock divider!

The nature of the failure

From an audio modulation standpoint, the clock-divided audio bitstream changes the meaning of the bits considerably. On the earlier Lisas, a 1 means "speaker full out" and a 0 means "speaker full in". (Or maybe the reverse; it doesn't actually matter which way round it is.) On a 2/10, it's transitions from 1 to 0 that are meaningful. ...10... means "swing the speaker to the opposite end of travel from where it was". Runs of 000s or 111s do nothing except pass the time, and a 0->1 transition does nothing except set things up for another 1->0 transition, which is the only pattern that affects the speaker. So, if you play this bitstream on a Lisa 1 or 2/5:

00000111111111000000

then to make the same sound on a Lisa 2/10, you need to play a bitstream like this:

00111000001111000000

except you'll need to specify a clock rate 2.5 times slower (not 1.25 in this case!), or as close as you can get to that given rounding error. Note that each 1->0 transition in the second bitstream happens at the same place as the bit changes in the first bitstream.

When I said this:

Quote from: stepleton on December 22, 2025, 04:18:41 AMAn XLerator in a 2/10 might have enough grunt to overcome the 2/10 hardware variations that make these programs unworkable there.

what I meant more precisely was "An XLerator in a 2/10 might have enough grunt to take the bitstream intended for a Lisa 1 or 2/5 and convert it into a 2/10 bitstream quickly enough to play intelligible audio on a 2/10."

Why not just make a 2/10-native bitstream? Well, it'll take up 2.5 times as much RAM, and I'm not even certain that the 68000 in a stock 2/10 will be fast enough to send the bytes to the VIA. It might work, but it'll be harder. Experimentation is required here.

Culture-jammers with pre-2/10 Lisas and a familiarity with Apple's internal code names may appreciate this 1997 track which fits this situation well: https://archive.mg-1.uk/tmp/pepsi.zip

What next

Well, I gotta clean up the code and get it out there. What I have to share includes a nice Python script that makes it easy to make your own audio images.

You can probably push the VIA to faster sample rates if you really cycle-count on the 68000 side. This will probably yield some noticeable audio quality improvements: less hiss in the background primarily. My code is already pretty tightly-optimised, but it's written in a way that lets you select the bitrate. If you commit to a single, faster bitrate, you might be able to achieve it.

I'm not in a rush to get things working on a 2/10, but it's annoying not to support the whole range, so...

The idea of more classic, full-featured demos comes to mind; I'm not sure we have a lot of cycles to spare for things besides pushing bytes into the VIA, but I haven't really attempted to measure it.

Anyway, that's about all I can think to say about this for now!

stepleton

I forgot to mention that Adam PodstawczyƄski also hypothesised about the possibility for this technique on this delightful webpage.

Finally, in a related vein, do you want to encode audio for the PERQ workstation and its CVSD-based audio system? (When it's not bl**dy broken again owing to another failure of one of its frustratingly unreliable 74S225 FIFOs, of which it has a few dozen?) Here is a script for you!

AlexTheCat123

Wow, what a nice and detailed write-up! Making use of the Lisa's volume control in addition to the shift register was a really good idea. And I completely forgot about that flip-flop divider on the 2/10; it's such a tiny little detail that completely breaks everything!