

In my computer's ROM, location numbers 64489, 64490 and 64491, taken together, contain a particular pattern of contents---1s and 0s which---when interpreted as instructions, result in the computer's little loudspeaker uttering a blip sound. This bit pattern is 10101101 00110000 11000000.





The memory space on the Apple II between $C000 and $CFFF was assigned to handle input and output. From $C000 to $C0FF the space was reserved for various soft-switches used to control the display, and various built-in I/O devices, such as the keyboard, paddles, annunciators, and the cassette port.





FBE4: A9 0C 597 BELL2 LDA #$0C TOGGLE SPEAKER AT

FBE6: 20 A8 FC 598 JSR WAIT 1 KHZ FOR .1 SEC

FBE9: AD 30 C0 599 LDA SPKR

FBEC: 88 600 DEY

FBED: D0 F5 601 BNE BELL2

FBEF: 60 602 RTS2B RTS



I've been reading through Richard Dawkins ' books and am currently half way through The Blind Watchmaker (2006 paperback edition) and on page 119 he writes:Of course, this piqued my curiosity. Did Dawkins just make that up, or is this really the contents of a specific bit of memory on a specific computer?The book was first published in 1986, so I just had to figure out what it was. Starting with the instructions and converting to hex we have AD 30 C0. Now, considering the main processors around at the time there are three possible interpretations of these three bytes:XOR L ; JR NC C0: LDA C030: JSR 30C0The first didn't look at all plausible, but both the other two do. The 6809 looks like it could be calling a sub-routine at location 30C0 and the 6502 would work if C030 were actually memory-mapped I/O and a read was necessary to cause the blip.I couldn't find any machine with a meaningful interpretation of the 30C0 location on a 6809 machine, but 6502 turned out to be a different story.On an Apple ][ memory in the range C000-C0FF is mapped to various bits of I/O:Poking around further I discovered that a read from C030 (known as SPKR) will blip the speaker on an Apple ][. So Dawkins is telling the truth and he's using an Apple ][.So returning to the memory locations what program is he talking about? The three memory locations are FBE9, FBEA and FBEB. That turns out to be inside the Monitor ROM on an Apple ][ (the stuff that Woz wrote) and happily a complete ROM listing was provided with the Apple ][.So looking in a scanned Apple ][ manual we find that those locations are inside the BELL2 routine. Specifically on page 163 of the manual we find the following:The line in bold is exactly the code that Dawkins is referrring to.So, while writing this famous text on evolution, Dawkins had time to poke around inside the Apple ][ ROM and write about it in his book.Respect.

Labels: pseudo-randomness