• 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.

How do soft-switches work?

Dog Cow

Well-known member
Here's a question for which I have not found the answer:

The Apple II, as you should know, has some soft-switches, memory locations which cause some setting to change. My question is: how does this work? How is it that using an AppleSoft line such as PEEK manages to change the switch? Is there something in the Monitor that does this?

 

david__schmidt

Well-known member
Soft switches have a hardware component: there is circuitry that reacts to particular address lines being tickled. That's why things like peek can affect them from BASIC.

 

Dog Cow

Well-known member
Do you know what hardware this is? I only have a IIgs, so I suppose that is incorporated in the Mega II, but what about on the older models?

 

II2II

Well-known member
Most people have a nasty tendency to think that memory is something where you specify a memory location, the CPU applies that memory location to the address lines, then the CPU reads the results from the data lines. (Or you specify the memory location and some data, then the CPU applies the memory location to the address lines and the data to the data lines, leaving the RAM to make the data part of its state.) That is a very CPU-centric view of the world. It is also totally incorrect.

Once the address is on the address lines, the external circuitry can do whatever it wants with those electrical impulses. Usually it heads over to RAM, like it is supposed to. But it is also possible to have it do something else. It is easy enough to build a circuit that detects a certain address, then sends an electrical impulse to another part of the circuitry when that happens. If it needs to maintain state, it may go to a flip-flop. In that case, it could totally ignore the data lines and do it's work based upon what happens on the address lines.

I'm fairly certain that would be considered very bad form in this day in age, but it does tend to simplify things.

(When you look at digital electronics, it's possible to do all sorts of weird things. For example, ROMs can do many forms of computation that don't require you to save state.)

 

david__schmidt

Well-known member
I downloaded that PDF a few months ago but haven't read it yet. Maybe I should do that. :p
It's a tough slog, especially if it's the first time through. But Sather lays bare all the secrets of Woz's wonder machine. Some of the hardware later than the ][ and ][+ emulate or replicate the behavior of the earlier machines in LSI chips; but the first ones have it all laid out in discrete logic.

 

porter

Well-known member
Here's a question for which I have not found the answer:
The Apple II, as you should know, has some soft-switches, memory locations which cause some setting to change. My question is: how does this work?
Computers have CPU, memory and IO (input output)

Some CPUs, like Intel family, Z80 etc have different address space for IO devices. Others like Motorola CPUs, 6502 family etc have what is called memory mapped IO, where IO ports appear in the same address space as normal memory.

 
Top