2

The Apple II is famously built around its video generator. Conveniently, addresses are generated which scan all of the video memory and somehow spits the contents onto the screen.

Its occurred to me though, that generation of successive values which are put onto the address bus is useful for much more, because a single address can point to many different things at once. It could read a byte from a bitmap, and at the same time read some other value from another bank of memory. This is how the Apple II does DRAM refresh for example.

But couldn't this also have easily been used for many other purposes?

  • To scan the keyboard? For example, we could map each address to a single key. Then, when a key is pressed, the address is stored in the keyboard latch and the 6502 is interrupted. This could probably mean the design could do without the AY-5-3600 which scans the keyboard.

Other ideas, probably too much feature creep for an Apple II, but maybe for another, more business-oriented computer.

  • Serial port I/O? For as long as the serial port can supply us with bytes, just write them into some buffer to be read later by the CPU. Or write from the buffer to the port of course.

  • Multiple word arithmetic? Now this is something which is quite tedious for a 6502. To add two 48 bit values for example is quite a long program. But if those values are in an appropriate bank of memory, then with the addresses being generated sequentially, a 78LS181 will blithely do the job. I suppose this could accelerate some heavy arithmetic, integer or floating point.

So I've never seen a computer design which uses the video addresses as something else at the same time. Why is this? Didn't occur to anyone? Or is there a technical reason?

  • The original Macintosh uses the video circuitry to fetch PCM audio data during the retrace. Specifically, exactly one byte per line, for ~22kHz 8-bit output. The MSX 2 onwards have an execution unit built into the VDP that can perform basic video manipulations during unused video memory cycles. Are those the sort of possibilities you were thinking of? – Tommy Jan 17 at 16:26
  • @Tommy that's exactly the sort of thing I mean. In the case of the macintosh, is the audio data stored at addresses derived from the addresses that make up the bitmap? – Wilson Jan 18 at 7:42
4

What you are describing is called Direct Memory Access, or DMA. It is very common on computers nowadays but much less common when the Apple II came out.

The main issue is that it requires bus arbitration. The CPU and any DMA devices have to share the memory bus. In the Apple II the CPU, a 6502, only accesses the memory bus every other cycle so it wasn't difficult to have the video generation hardware to use every other cycle as well, avoiding the need for an arbitration.

If you try to add a third device to that bus there needs to be some way to manage and prioritize everything. The video hardware can't wait, it has to have priority or the display will glitch. The CPU can wait, but you need something that tells it to wait while the third device uses the bus.

Later machines such as the Amiga did exactly that, using custom chips to manage multiple DMA devices. The Apple II didn't have the luxury of using custom designed chips, it was all off-the-shelf hardware.

  • I wouldn't call scanning a keyboard matrix DMA... – Wilson Jan 17 at 15:35
  • Also I think, for example if we wanted to add a third device in the manner you suggest, no need for bus arbitration if that device can share the address bus only, using its own data bus. But I could be wrong about that – Wilson Jan 17 at 15:36
  • @Wilson how would the result of the scan be collected if not poked into memory somewhere? It could be done by a peripheral but then the utility of combining it with the screen refresh is absolutely minimal. – user Jan 17 at 17:20
  • @Wilson interesting idea about using the address counters for something else, but it seems like it would be so inflexible and such a pain to use that it's not worth it. Plus the Apple II was designed to be low cost, and the lowest cost keyboard/serial ports are managed entirely in software. – user Jan 17 at 17:21
  • 1
    No, I think he's envisaging a scenario in which a second device is added which uses the same addresses, in the same order, with the same running. – Tommy Jan 18 at 1:04
0

If one wants to use a timer-tick interrupt, keyboard scanning for an 8x8 keyboard can be handled very nicely using a pair of address strobes, a couple 74LS373 or equivalent chips. eight pull-up resistors, and eight diodes. Commodore used a VIA or CIA chip in the VIC-20 and C64 so as to gain the timers and other resources therein, but if those weren't needed a simple pair of 8-wide latches with 3-state outputs would have been sufficient (or even one latch without 3-state outputs, and one 8-bit 3-state bus driver chip).

If one doesn't want to use interrupts, the value of piggy-backing keyboard scanning onto video would likely be rather limited.

Perhaps the biggest omission on the Apple II was the lack of any way of having video trigger an interrupt. While it would be necessary to disable the interrupt during things like floppy-drive access, having a timer tick can be nice for a lot of things. Having a soft switch gate the vertical sync output onto IRQ, using a counter rather than a 555 to control flashing, and feeding some outputs from that counter into general-purpose I/O pins would have made many things on the Apple II far more convenient than they ended up being.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.