Bill Gates' Personal Easter Eggs in 8 Bit BASIC

If you type “WAIT6502,1″ into a Commodore PET with BASIC V2 (1979), it will show the string “MICROSOFT!” at the top left corner of the screen. Legend has it Bill Gates himself inserted this easter egg “after he had had an argument with Commodore founder Jack Tramiel”, “just in case Commodore ever tried to claim that the code wasn’t from Microsoft”.

In this episode of “Computer Archeology“, we will not only examine this story, but also track down the history of Microsoft BASIC on various computers, and see see how Microsoft added a second easter egg to the TSR-80 Color Computer – because they had forgotten about the first one.

Stolen From Apple?

This whole story sounds similar to Apple embedding a “Stolen From Apple” icon into the Macintosh firmware in 1983, so that in case a cloner copies the ROM, in court, Steve Jobs could hit a few keys on the clone, revealing the icon and proving that not just a “functional mechanism” was copied but instead the whole software was copied verbatim.

Altair BASIC

Let’s dig into the history of Microsoft’s BASIC interpreters. In 1975, Microsoft (back then still spelled “Micro-soft”) released Altair BASIC, a 4 KB BASIC interpreter for the Intel 8080-based MITS Altair 8800, which, despite all its other limitations, included a 32 bit floating point library.

An extended version (BASIC-80) that consisted of 8 KB of code contained extra instructions and functions, and, most importantly, support for strings.

Microsoft BASIC for the 6502

In 1976, MOS Technology launched the KIM-1, an evaluation board based around the new 6502 CPU from the same company. Microsoft converted their BASIC for the Intel 8080 to run on the 6502, keeping both the architecture of the interpreter and its data structures the same, and created two versions: an 8 KB version with a 32 bit floating point library (6 digits), and a 9 KB system with 40 bit floating point support (9 digits).

Some sources claim that, while BASIC for the 8080 was 8 KB in size, Microsoft just couldn’t fit BASIC 6502 into 8 KB, while other sources claim there was an 8KB version for the 6502. The truth is somewhere in the middle. The BASIC ROMs of the Ohio Scientific Model 500/600 (KIM-like microcomputer kits from 1977/1978) and the Compukit UK101 were indeed 8 KB in size, but unlike the 8080 version, it didn’t leave enough room for the machine-specific I/O code that had to be added by the OEM, so these machines required an extra ROM chip containing this I/O code.

In 1977, Microsoft changed the 6 digit floating point code to support 9 digits and included actual error stings instead of two-character codes, while leaving everything else unchanged. A 6502 machine with BASIC in ROM needed more than 8 KB anyway, why not make it a little bigger to add extra features. The 6 digit math code was still an assembly time option; the 1981 Atari Microsoft BASIC used that code.

In 1977, Ohio Scientific introduced the “Model 500″, which was the first machine to contain (6 digit) Microsoft BASIC 1.0 in ROM. Upon startup, it printed:

OSI 6502 BASIC VERSION 1.0 REV 3.2
COPYRIGHT 1977 BY MICROSOFT CO.
OK

In the same year, MOS started selling a tape version of 9 digit Microsoft BASIC 1.1 for the KIM-1. Its start message was:

MOS TECH 6502 BASIC V1.1
COPYRIGHT 1977 BY MICROSOFT CO.
OK

Woz Integer BASIC

The 1976 Apple I was the first system besides the KIM to use the MOS 6502 CPU, but Steve Wozniak wrote his own 4KB BASIC interpreter instead of licensing Microsoft’s. An enhanced version of Woz’ “Integer BASIC” came in the ROM of the Apple II in 1977; Microsoft BASIC (called “AppleSoft”) was available as an option on tape. On the Apple II Plus (1978), AppleSoft II replaced Integer BASIC.

Commodore PET

Commodore had bought MOS in October 1976 and worked on converting the KIM platform into a complete computer system. They licensed Microsoft BASIC for 6502 (also October 1976), renamed it to Commodore BASIC, replaced the “OK” prompt with “READY.”, stripped out the copyright string and shipped it in the ROMs of the first Commodore PET in 1977.

The Easter Egg

In 1979, Commodore started shipping update ROMs with a version 2 of Commodore BASIC for existing PETs. Apart from updates in array handling, it also contained the WAIT 6502 easter egg.

This is what the easter egg code looks like:

.,D710 20 C6 D6  JSR $D6C6      fetch address and value
.,D713 86 46     STX $46        save second parameter
.,D715 A2 00     LDX #$00       default for third parameter
.,D717 20 76 00  JSR $76        CHRGOT get last character
.,D71A F0 29     BEQ $D745      no third parameter
.,D71C 20 CC D6  JSR $D6CC      check for comma and fetch parameter
.,D71F 86 47     STX $47        save 3rd parameter
.,D721 A0 00     LDY #$00
.,D723 B1 11     LDA ($11),Y    read from WAIT address
.,D725 45 47     EOR $47        second parameter
.,D727 25 46     AND $46        first parameter
.,D729 F0 F8     BEQ $D723      keep waiting
.,D72B 60        RTS            back to interpreter loop

On pre-V2 BASIC, the branch at $D71A just skipped the next line: If there is no third parameter, don’t fetch it. On V2, the line is subtly changed to make the two-parameter case branch to a small patch routine:

.,D745 A5 11     LDA $11        low byte of address
.,D747 C9 66     CMP #$66       = low of $1966 (=6502)
.,D749 D0 D4     BNE $D71F      no, back to original code
.,D74B A5 12     LDA $12        high byte of address
.,D74D E9 19     SBC #$19       = high of $1966 (=6502)
.,D74F D0 CE     BNE $D71F      no, back to original code
.,D751 85 11     STA $11        low byte of screen buffer = 0
.,D753 A8        TAY            index = 0
.,D754 A9 80     LDA #$80       high byte of screen buffer
.,D756 85 12     STA $12        screen buffer := $8000
.,D758 A2 0A     LDX #$0A       10 characters
.,D75A BD 81 E0  LDA $E081,X    read character
.,D75D 29 3F     AND #$3F       throw away upper bits
.,D75F 91 11     STA ($11),Y    store into screen RAM
.,D761 C8        INY
.,D762 D0 02     BNE $D766      no carry
.,D764 E6 12     INC $12        increment screen buffer high address
.,D766 CA        DEX
.,D767 D0 F1     BNE $D75A      next character
.,D769 C6 46     DEC $46
.,D76B D0 EB     BNE $D758      repeat n times
.,D76D 60        RTS            back to interpreter loop

The text “MICROSOFT!” is stored in 10 consecutive bytes at $E082, cleverly hidden after a table of coefficients that is used for the SIN() function:

.;E063 05                        6 coefficients for SIN()
.;E064 84 E6 1A 2D 1B            -((2*PI)**11)/11! = -14.3813907
.;E069 86 28 07 FB F8             ((2*PI)**9)/9!   =  42.0077971
.;E06E 87 99 68 89 01            -((2*PI)**7)/7!   = -76.7041703
.;E073 87 23 35 DF E1             ((2*PI)**5)/5!   =  81.6052237
.;E078 86 A5 5D E7 28            -((2*PI)**3)/3!   = -41.3147021
.;E07D 83 49 0F DA A2               2*PI           =  6.28318531
.;E082 A1 54 46 8F 13            "SOFT!" | backwards and with
.;E087 8F 52 43 89 CD            "MICRO" | random upper bits

If we reverse the bytes, we get

CD 89 43 52 8F 13 8F 46 54 A1

The easter egg code clears the upper 2 bits, resulting in

0D 09 03 12 0F 13 0F 06 14 21

The easter egg code does not print the characters through library routines, but instead writes the values directly into screen RAM. While BASIC used the ASCII character encoding, the Commodore character set had its own encoding, with “A” starting at $01, but leaving digits and special characters at the same positions as in ASCII. Thus, the 10 hidden and obfuscated bytes decode into:

MICROSOFT!

Microsoft’s Code?

Commodore engineers are known for putting easter eggs into ROM, but there would be no reason for them to encode the string “MICROSOFT!” and hide it so well. The “WAIT 6502″ easter egg did not show up in Commodore BASIC until version 2, which is in contrast to almost all sources claiming Commodore licensed Microsoft BASIC for a flat fee and never returned to Microsoft for updates, but continued improving BASIC internally.

Commodore had indeed updated its source with Microsoft’s changes since V1. 6502 guru Jim Butterfield states:

Commodore paid Microsoft an additional fee to write a revision to the original BASIC that they had bought. Among other things, spaces-in-keywords were changed, zero page shifted around, and (unknown to Commodore) the WAIT 6502,x joke was inserted.

Targeting Commodore?

While all of Microsoft BASIC only depends on the CPU, makes no other assumptions on the hardware it runs on (be it Commodore, Apple, Atari, …), and does all its input and output by calling into ROM functions external to BASIC, the easter egg writes directly to screen RAM at a fixed address of $8000, and uses the PET character encoding for it: The easter egg has clearly been written specifically for the PET.

We can only speculate on the reasons why Microsoft and possibly Bill Gates himself added the easter egg. A possible reason is that Microsoft wanted to make sure Commodore cannot take credit for “Commodore BASIC” – similar to the “Stolen From Apple” case.

Or it was only about showing the world who really wrote it. Jim Butterfield: As an afterthought, Microsoft would have liked to see their name come up on the screen. But it wasn’t in the contract.

Commodore’s Reaction

The easter egg only exists in BASIC version 2 on the PET. All later Commodore computers didn’t contain it: The branch was restored and the extra code as well as the 10 bytes hidden after the SIN() coefficients were removed.

Jim Butterfield: Shortly after that implementation, I show this to Len Tramiel [of Commodore engineering] at the Commodore booth of a CES show. He was enraged: “We have a machine that’s short of memory space, and the #$#!* [Gates] put that kind of stuff in!!”

Commodore employee Andy Finkel states that the “Gates” (!) easter egg had to be removed for space reasons. It had occupied 51 extra bytes.

Interestingly, starting with the BASIC V7 on the C128 six years later, Commodore started crediting Microsoft, like this:

        COMMODORE BASIC V7.0 122365 BYTES FREE
          (C)1985 COMMODORE ELECTRONICS, LTD.
                (C)1977 MICROSOFT CORP.
                  ALL RIGHTS RESERVED

According to Jim Butterfield, this is probably due to negotiations concerning Microsoft BASIC for the Amiga.

The Easter Egg before the PET

But Microsoft did not encode its company name specifically for Commodore: The 9 digit BASIC 6502 version 1.1 for the KIM-1 contained the 10 hidden bytes:

.;3FAA 05                        6 coefficients for SIN()
.;3FAB 84 E6 1A 2D 1B            -((2*PI)^11)/11! = -14.3813907
.;3FB0 86 28 07 FB F8             ((2*PI)^9)/9!   =  42.0077971
.;3FB5 87 99 68 89 01            -((2*PI)^7)/7!   = -76.7041703
.;3FBA 87 23 35 DF E1             ((2*PI)^5)/5!   =  81.6052237
.;3FBF 86 A5 5D E7 28            -((2*PI)^3)/3!   = -41.3147021
.;3FC4 83 49 0F DA A2               2*PI           =  6.28318531
.;3FC9 A6 D3 C1 C8 D4            "!TFOS"
.;3FCE C8 D5 C4 CE CA            "ORCIM"

The extra bytes here are:

A6 D3 C1 C8 D4 C8 D5 C4 CE CA

If we XOR every byte with 0×87, we get:

21 54 46 4f 53 4f 52 43 49 4d

which, again, is “MICROSOFT!” backwards, but this time in the ASCII encoding. (Note that no XOR or add/sub can be found for the 10 bytes in Commodore BASIC that would convert them into ASCII instead of PETSCII. Also, thanks to Tom for his help here.)

The version of Microsoft BASIC for the 6502-based Apple II, called “AppleSoft“, contains the same 10 bytes after the coefficients in all tape and ROM versions. On AppleSoft II, for example, they are located at address $F075.

KIM-1 BASIC was released in 1977, AppleSoft II in spring 1978, and the V2 ROM of the PET in spring 1979. So Microsoft didn’t “target” Commodore with this at first, but probably put the data in for all their customers – possibly right after they had shipped the easteregg free V1 to Commodore. And when Commodore came back to them, they changed their codebase to encode string differently and added the easter egg code to show the string.

The Easter Egg after the PET

After the second source drop to Commodore, they removed the “WAIT6502″ code again, but kept the 10 encoded bytes in their master codebase: Every non-Commodore post-1978 6502 Microsoft BASIC with the 40 bit floating point library contains the 10 encoded bytes after the SIN() coefficients – still in PET encoding:

  • Tangerine Microtan 65
  • Tangerine Oric-1 and Oric-Atmos
  • Pravetz 8D

This is a snippet from microtan/tanex_h2.rom:

0000fd8: 0f da a2 a1 54 46 8f 13  ....TF..
0000fe0: 8f 52 43 89 cd a5 d5 48  .RC....H

The ROM of the Ohio Scientific Superboard II (and its clone, the Compukit UK101) as well as the Atari Microsoft BASIC tape are based on the 32 bit floating point version and don’t contain the easter egg data.

“MICROSOFT!” on the 6800 and the 6809

It doesn’t stop there: Even the BASIC versions on the TRS-80 Color Computer and the TRS-80 MC-10, which were versions for the 6809 and 6800 CPU architectures, respectively (BASIC-69 and BASIC-68), had the encoded “MICROSOFT!” string after the SIN() coefficients. Here is a snippet of Spectral Associates’ disassembly of the CoCo ROM in his book “Color Basic Unravelled II

                       * MODIFIED TAYLOR SERIES SIN COEFFICIENTS
BFC7 05                LBFC7   FCB   6-1                   SIX COEFFICIENTS
BFC8 84 E6 1A 2D 1B    LBFC8   FCB   $84,$E6,$1A,$2D,$1B   * -((2*PI)**11)/11!
BFCD 86 28 07 FB F8    LBFC8   FCB   $86,$28,$07,$FB,$F8   *  ((2*PI)**9)/9!
BFD2 87 99 68 89 01    LBFD2   FCB   $87,$99,$68,$89,$01   * -((2*PI)**7)/7!
BFD7 87 23 35 DF E1    LBFD7   FCB   $87,$23,$35,$DF,$E1   *  ((2*PI)**5)/5!
BFDC 86 A5 5D E7 28    LBFDC   FCB   $86,$A5,$5D,$E7,$28   * -((2*PI)**3)/3!
BFE1 83 49 0F DA A2    LBFE1   FCB   $83,$49,$0F,$DA,$A2   *    2*PI

BFE6 A1 54 46 8F 13 8F LBFE6   FCB   $A1,$54,$46,$8F,$13   UNUSED GARBAGE BYTES
BFEC 52 43 89 CD               FCB   $8F,$52,$43,$89,$CD   UNUSED GARBAGE BYTES

You can tell that Microsoft didn’t reimplement BASIC for the remaining 8 bit architectures, but practically converted the 6502 code, copying all constants verbatim, even the ones they did not understand, since these are still the obfuscated bytes in PET-encoding.

A Second Easter Egg on the Color Computer

The TSR-80 Color Computer (1980) also has an easter egg in BASIC: If you type “CLS9″ (or any higher number), it will clear the screen and print “MICROSOFT”.

Let’s see how it is done:

                  * CLS
A910 BD 01 A0     CLS     JSR RVEC22     HOOK INTO RAM
A913 27 13                BEQ LA928      BRANCH IF NO ARGUMENT
A915 BD B7 0B             JSR LB70B      CALCULATE ARGUMENT, RETURN VALUE IN ACCB
A918 C1 08                CMPB #8        VALID ARGUMENT?
A91A 22 1B                BHI LA937      IF ARGUMENT >8, GO PRINT ‘MICROSOFT’
[...]
A937 8D EF        LA937   BSR LA928      CLEAR SCREEN
A939 8E A1 65             LDX #LA166-1   *
A93C 7E B9 9C             JMP LB99C      * PRINT ‘MICROSOFT’

The string to be printed is stored here:

A166 4D 49 43 52 4F 53 LA166 FCC 'MICROSOFT'
A16C 4F 46 54
A16F 0D 00             LA16F FCB CR,$00

That’s right, Microsoft added a different easter egg, and included the string “MICROSOFT” again, this time in cleartext. They seem to have forgotten about the obfuscated 10 bytes intended for the PET that had been copied from the 6502 version to the 6800 during conversion, and had still been present in the Color Computer ROM.

The same easter egg exists on the 6800-based TRS-80 MC-10 (also 1980), which also had the 10 PET bytes in ROM:

FBBF 27 13                BEQ $FBD4       ; branch if no argument
FBC1 BD EF 0D             JSR $EF0D       ; get argument
FBC4 C1 08                CMPB #$08       ; easter egg?
FBC6 22 1D                BHI $FBE5       ; yes
[...]
FBE5 8D ED                BSR $FBD4       ; clear screen
FBE7 CE F8 33             LDX #$F834-1
FBEA 7E E7 A8             JMP $E7A8       ; print "MICROSOFT"
[...]
F834 4D 49 43 52 4F       FCC "MICROSOFT"
F834 53 4F 46 54 0D       FCB $0D
F834 00                   FCB $00
[...]
F724 A1 54 46 8F 13       FCB $A1,$54,$46,$8F,$13 ; "!TFOS"
F729 8F 52 43 89 CD       FCB $8F,$52,$43,$89,$CD ; "ORCIM"

Microsoft BASIC 6502 Timeline

  • Version 1.0 (in the 6 digit version) is used on the Ohio Scientific, and contains a major bug in the garbage collection code.
  • Version 1.0 (in the 9 digit version) is also used in the first Commodore PET as Commodore BASIC V1. It is the oldest known Microsoft BASIC to support 9 digit floating point.
  • Version 1.1, which contained bug fixes, is used on the KIM-1. It is the oldest version to contain the “MICROSOFT!” string (in ASCII).
  • AppleSoft BASIC I is forked from Microsoft BASIC 1.1. It contains the ASCII string.
  • Microsoft BASIC version 2 changes the ASCII string to PET screencode, adds the easter egg code, and is given to Commodore.
  • The code is removed again after the source drop to Commodore. The Tangerine Microtan is based on this.
  • Apple, Commodore and Tangerine continue development of their respective forks without the involvement of Microsoft.
  • The BASIC V2 used on the VIC-20 and the C64 is actually a stripped-down version of PET BASIC 4.0 and not a ported version of PET BASIC V2.

So did Bill Gates write it himself?

Altair BASIC was written by Bill Gates, Paul Allen (the founders of Microsoft) and Monte Davidoff (a contractor), as comments in the original source printout show:

00560  PAUL ALLEN WROTE THE NON-RUNTIME STUFF.
00580  BILL GATES WROTE THE RUNTIME STUFF.
00600  MONTE DAVIDOFF WROTE THE MATH PACKAGE.

Bill Gates wrote “the runtime stuff” (which probably means the implementation of the instructions), as opposed to “the non-runtime stuff” (probably meaning tokenization, memory management) and “the math package”. Consequently, the implementation of the WAIT command would have been his work – on the 8080, at least.

Now who wrote the 6502 version? The KIM-1 BASIC manual credits Gates, Allen and Davidoff, the original authors of the 8080 version, but it might only be left over from the manual for the 8080 version. Davidoff, who worked for Microsoft in the summers of 1975 and 1977, had not been there when BASIC 6502 was written in the summer of 1976, but he probably changed the 6 digit floating point code into the 9 digit version that is first found in BASIC 6502 1.1 (KIM-1, 1977).

The ROM of the 1977/1978 Ohio Superboard II Model 500/600 (6 digit BASIC 1.0) credits RICHARD W. WEILAND, and the 1977 9 digit KIM-1 BASIC 1.1 as well as the 1981 Atari Microsoft BASIC 2.7 credit “WEILAND & GATES”. Ric Weiland was the second Microsoft employee. These credits, again, were easter eggs: While they were clearly visible when looking at the ROM dump, they were only printed when the user entered “A” when BASIC asked for the memory size.

According to apple2history.org, Marc McDonald (employee number 1) wrote the 6502 version, but it is more likely that McDonald wrote the 6800 simulator and Weiland ported 8080 BASIC to the 6800 and then McDonald adapted the 6800 simulator to the 6502 and Weiland wrote the 6502 BASIC.

This and the hidden credits in version 1.0 of 6502 BASIC suggest that Weiland was the main author of 6502 BASIC. Gates is added to the hidden credits in the 1.1 version, so Gates probably contributed to the 1.1 update..

So it is very possible that Gates wrote the easter egg code himself, given that he was responsible for the implementation of WAIT on the 8080, he is credited in BASIC 6502 1.1+, Finkel and Butterfield refer to WAIT6502 as “Gates’” easter egg – and after all, he can write code.

Open Questions

  • What was Atari’s version based on? What versions were there? Atari Microsoft BASIC images are very hard to find.
  • Why did Atari use the 6 digit version, if they extended it with lots of commands (so size couldn’t have been an issue)?

Annotated Disassembly of Different Versions

82 thoughts on “Bill Gates' Personal Easter Eggs in 8 Bit BASIC

  1. rick

    This is the most interesting thing I’ve seen all day. I just bookmarked it to come back.

    Thanks,

    I’ll have to dig through your archives, and if you don’t have more like this then start writing!

    Thanks, good work.

    Reply
  2. Torley

    Good question to ask Bill Gates next time any of us gets an interview opportunity with him. :)

    Brilliant post! So thorough, well-illustrated, and I would think it’s fascinating to non-techs too.

    Reply
  3. John Stracke

    “The same easter egg exists on the 6800-based TRS-80 MC-1 (also 1980)” — I haven’t heard of this machine; was it a variant of the Color Computer? Can you point me to something about it? (A quick Google didn’t find anything useful.)

    I know of the MC-10, of course; but that was a few years later, and based on the 6803. I’ve never heard of any TRS-80 based on the 6800 proper.

    Reply
  4. Michael Steil

    @John Stracke: Sorry, that was a typo. It’s “MC-10″, which is indeed 6803-based, but it’s a variant of the 6800.
    @Jerry Kindall: You are right. I confused it with the court case that lead to the inclusion of the icon, and that court case was about the Apple II.

    Thanks for noting! I fixed both mistakes.

    Reply
  5. Jeff Barr

    Great story.

    In 1977 and 1978 I worked at the Retail Computer Store in Seattle, Washington.

    We sold products from Altair, Imsai, Processor Technology, and others. One day a very strange color terminal device showed up. It was from a new company called CompuColor. Although sold as an “intelligent terminal” it had an 8080 processor and BASIC inside.

    Having spent a lot of time using Altair BASIC, it was pretty clear to me that CompuColor had either licensed or simply copied it for their own use.

    One day, believe it or not, Bill Gates himself walked in to the store! I happened to show him the CompuColor and he was quite intrigued. In fact, he restarted it and when the interpreter asked “Memory Size?” on startup, he entered a magic key sequence (I think it was Control-A) and the system printed out something like “Written by Paul Allen, Bill Gates, and Monte Davidoff.”

    This was a smoking gun and I’m sure Bill sent him lawyers after them shortly thereafter.

    Reply
  6. John Stracke

    “Sorry, that was a typo. It’s “MC-10″” — Got it, thanks. I couldn’t tell if it was an ordinary mistake or an extraordinary bit of history.

    Oh, and nice article. :-)

    Reply
  7. Pingback: links for 2008-09-30 | Nerdcore

  8. Mike Cohen

    Ohio Scientific’s Challenger had a similar easter egg. When you start it up, it asks D/C/W/M (Disk boot, Cold start, Warm start, or Monitor), followed by the memory size prompt. At “memory size’ if you enter A it will say “Written by Bill Gates”.

    Reply
  9. Michael Steil

    @Mike Cohen: Are you sure it credited Bill Gates only? I clarified the paragraph about the “hidden” credits (memory size “A”) and added a screenshot of the OSI Model 600. Its 1977 ROM credits Weiland; the KIM’s 1977 ROM credits Weiland and Gates, and the 1981 Atari Microsoft BASIC 2.7 tape credits Weiland and Gates as well. I haven’t seen a version with only Gates’ name. What Challenger model was this, and what year was it made in? Do you remember what version number of BASIC it printed or whether it supported disk/tape/graphics instructions?

    @Faried Nawaz: “AppleSoft” is the BASIC based on Microsoft BASIC that was offered for the Apple II. “Apple I BASIC” is written by Woz and unrelated.

    Reply
  10. Joe Zbiciak

    I just took a quick peek at the Intellivision Keyboard Component’s BASIC ROM dump to see if I could find the floating point tables. (The Keyboard was a 6502-based machine, and its BASIC ROM was 8K.)

    I didn’t find any of the 40-bit constants mentioned above, so I presume that the Intellivision version that Mattel picked up was the version with 32-bit floating point.

    The Intellivision BASIC reports itself as:

    INTELLIVISION BASIC
    Copyright Microsoft, Mattel 1980

    I wonder where it fits in the time line you have above? FWIW, it doesn’t seem to have a WAIT keyword, and it uses 2-letter error codes. (It does have VSAV/VLOD, which seem to be for audio playback on the tape… This *is* a unique machine.) The errors it reports are: GO, NF, SN, RG, OD, FC, OV, OM, US, BS, DD, /0, ID, TM, LS, ST, CN, UF, TR, TP

    As for easter eggs, I don’t know if Intellivision BASIC has any. I know the Keyboard’s System ROM does have at least one. There are a number of compressed strings that can be expanded with special escapes. (These were character numbers > 255 if arriving via 10-bit wide RAM shared with the Master Component, or a three byte sequence if generated directly on the Keyboard Component from the 6502. A very odd machine.)

    These strings compress down many common phrases and phrase fragments. Two of the strings in this table are “K. Smith” and “L. Zwick”, two of the main programmers for this ROM. So, with an appropriate “PRINT” statement you could get the programmer’s names to appear. In fact, I believe it was possible to get the names to appear in the “typewriter” mode as well.

    On a different note, the Mattel Aquarius (a Z80 based machine) also has Microsoft BASIC built in. I don’t have a dump of its ROM though.

    Reply
  11. tim lindner

    You are misattributing Walter K. Zydhek for the creation of the commented dissasembly of the CoCo’s ROM. Walter did the excellent PDF conversion of Spectral Associates’ (uncredited) Unravelled series.

    Reply
  12. Michael Steil

    @Joe Zbiciak: A ROM that contains the 40 bit library will always contain the bytes 84 E6 1A 2D 1B, and a ROM with the 32 bit library will always contain 86 1E D7 FB.
    You can look at the list of keywords at the beginning of the ROM (last character has bit #7 set) and compare it with other ROMs.

    And of course, I would be happy to look at the ROM you have!

    @tim lindner: Thanks a lot for the hint, I should have read the full foreword! Fixed.

    Reply
  13. Mario Dorion

    Sun Microsystems also had a “security” device in its PROM which it feared would be copied by competitors (there were many Unix Workstation startups in the 80s). Pressing a few keys while in the PROM mode (equivalent to BIOS on a PC) would display “Love your country, distrust its governement” … Scott McNeally always was a bit of a libertarian …

    Reply
  14. Joe Cassara

    Thanks for doing your homework and setting the record straight. All too often the history of these machines is obfuscated by myth and misinformation.

    Reply
  15. Michael O'Keeffe

    “On the Apple II Plus (1978), AppleSoft II replaced Integer BASIC.” – But you could still run Integer BASIC on the Apple II plus. I think it printed a percent symbol as a prompt. I forget the details, and I preferred Apple Soft, but I recall dabbling in Integer Basic. I could check my manuals, but after lugging that around, I finally tossed it. The reference manual had the ROM (?) code for the OS, Woz’s name and comment sprinkled about in the assembly. Yes, must’ve been in the ROM, there was no hard drive ;)

    Reply
  16. Michael Steil

    @Joe Zbiciak:

    This is the keyword list of Microsoft BASIC 1.0:
    END, FOR, NEXT, DATA, INPUT, DIM, READ, LET, GOTO, RUN, IF, RESTORE, GOSUB, RETURN, REM, STOP, ON, NULL, WAIT, LOAD, SAVE, DEF, POKE, PRINT, CONT, LIST, CLEAR, NEW, TAB(, TO, FN, SPC(, THEN, NOT, STEP, AND, OR, SGN, INT, ABS, USR, FRE, POS, SQR, RND, LOG, EXP, COS, SIN, TAN, ATN, PEEK, LEN, STR$, VAL, ASC, CHR$, LEFT$, RIGHT$, MID$
    BASIC 1.1 only added a single instruction keyword: “GET”

    According to your list, Intellivision BASIC doesn’t have GET. It removed NULL, WAIT, POKE and PEEK and added the instructions PLOD, PSAV, VLOD, VSAV, SLOD, PRT and the function GETC. It looks like it’s 1.0-based, although it was released in 1982, and the copyright says 1980.

    Reply
  17. Carsten

    The Atari 8bit 6502 Computer (400/800,800XL …) all have a non-Microsoft BASIC version in ROM or on Cartridge (called Atari-Basic). This Basic was done by Shepardson Microsystems, which later become OSS (Optimized System Software). See
    http://www.laughton.com/paul/abps/oss/oss.html

    TWO BIRTHS
    “COLEEN” AND”CANDY”
    The development of Atari Basic and Atari DOS

    Microsoft BASIC for the Atari 6502 Computer was an optional piece of software that was rather expensive, so most user used the supplied Atari Basic. Later, an optimized Version of Atari Basic was produced by Frank Ostrowski (http://en.wikipedia.org/wiki/Frank_Ostrowski) who later did the GFA-BASIC for the Atari ST series.

    Reply
  18. Joe Zbiciak

    @Michael O’Keeffe:

    As I recall, you could switch between Integer and Applesoft BASIC on an Apple ][+ if you had a language card. The DOS 3.3 commands INT and FP would switch between them.

    The Integer BASIC prompt was a greater-than sign as I recall.

    Reply
  19. Pingback: Bill Gates talks to Fareed Zakaria | Life Goes by Fast

  20. Pingback: FuzzLinks.com » Bill Gates’ Personal Easter Eggs in 8 Bit BASIC

  21. Ed Woods

    Wow has time gone by. I was 11 when my dad bought me my first Atari 800. He would make me program in Atari Basic, I also used Microsoft Basic for the Atari and eventually learned assemby. I had also used GFA Basic for the Atari ST. I remember a lot of those ole wacky stories, now I am 37 and I still develop write software and develop hardware.

    Another friend actually wrote GEM OS for the Atari ST and later moved to EA Electronics to do there Assembly Programming. I still have an Atari ST, and 800 in the garage. Memory lanes..

    Reply
  22. Lars

    BTW: “CLS9″ followed by [RETURN] on Dragon 32 (64, too?) will be clear screen with message “(C) 1982 BY MICROSOFT” @ upper line. :)

    Reply
  23. Carl Snyder

    You don’t mention the later Apple IIe, but it also had Apple Integer BASIC in ROM. I remember getting into it, but just to learn how to get back to Applesoft when I was teaching an adult, non-credit computer literacy course back in 1982.

    FWIW, the Tandy Color Computer line actually had 3 versions of the BASIC in ROM: 8K Color BASIC, sold mostly with the 4K RAM minimum system which was integer only with no graphics extensions. Another 8K ROM which then gave you 16K Extended Color BASIC with all floating point, trigonometry, and graphics extensions. This just plugged into a socket on the motherboard. Last was Disk Extended Color BASIC which came in a ROM on the card which slid into the game slot on the machine on the same board with the disk controller to include the functions for floppy I/O. I believe that all 3 versions were obtained from Microsoft (according to the documentation which came with the computers.)

    Reply
  24. Michael Steil

    @Lars: Interesting. I saw the “MICROSOFT!” easter egg after the floating point constants in the Dragon ROM as well, but I assumed the Dragon was only a clone of the CoCo, so I didn’t look any further and didn’t see that CLS9 actually behaved differently. Thanks!

    Reply
  25. Pingback: Bill Gates’ Easter Egg in 8 Bit BASIC V2

  26. Pingback: Csiga a Marson − HĂşsvĂŠti tojĂĄs

  27. Howard

    You won’t believe how much nostalgia this article brought back in me! I hacked around on most of the computers listed in this article, all in BASIC.

    Great job, thanks!

    Reply
  28. Pingback: FuzzLinks » Bill Gates’ Personal Easter Eggs in 8 Bit BASIC

  29. Pingback: pagetable.com » Blog Archive » Create your own Version of Microsoft BASIC for 6502

  30. Pingback: damage control | F!XMBR

  31. Jamey

    What about the MS implementations of BASIC for the TRS-80 Model I, which included the Level I (4K ROM) and Level II (12K ROM) variations? I wonder if those had the easter eggs, as I know both had the MEM(ORY) SIZE? request on boot.

    Reply
  32. bob thomas

    Never would’ve thought Billy had it in him. All that talk about “people are stealing my code!” and all. Only to find that he leased the code to Commodore and Apple for a one time fee.

    He might never have said “640k is enough for anybody”. But…

    Reply
  33. Tony

    Started with a KIM 1 and then all the CBM’s to Amiga even wrote a graphics extension for CBM64 sold a few as well and was reviewed in a UK magazine.
    Have just re-compiled the source with Visual Studio 2008 debug worked OK then release build failed until I changed the VS user profile(settings) from C# to C++ then was OK.
    Thank’s for the work very much appreciated.

    Reply
  34. Pingback: WAIT 6502,1 | MetaFilter

  35. Pingback: cbmbasic 1.0 with Plugins « pagetable.com

  36. Rich Elmore

    Ahh this site really brings back the memories of how I spent my youth.

    I remember one really interesting “feature” I discovered on the TRS-80 MC-10 when poking/peeking somewhat randomly (at the time I had no documentation for machine besides the BASIC manual.)

    Once the code was executed, the keyboard would lockup (requiring reset) but you could peek $2 which returned a value that seemed to vary with the distance and position my hand was relative to the chiclet keyboard. Years later, I’d often wondered if it was radio interference or something to do with the keyboard switches.

    It was accurate enough to have been used as some kind of input device, if only I wasn’t just a young kid living on a farm way out in the boonies at the time :P

    10 POKE 0, 0
    20 PRINT PEEK(2)
    30 GOTO 20

    Reply
  37. Pingback: Tagz | "pagetable.com » Blog Archive » Bill Gates’ Personal Easter Eggs in 8 Bit BASIC" | Comments

  38. MC Coder

    There is another name hidden in the TRS-80 MC-10 ROM. At $FFD2 the ASCII text ‘Chamberlin’ appears in reverse order.

    Reply
  39. Scott Houdek

    i got the 1.0 version, but………….., it’s nice attempt, YOU SHOULD HAVE ON LINE MANUAL for those don’t know how to use this application!.
    I WOULD APPRECIATE THAT!.

    Reply
  40. Alex from iiiyyy

    Where did you get all of those stuffs? I remember about the BASIC. that time I still a child. I remember when my dad bring home one of that. Also, when I was in elementary, I took computer lesson and they teach me about it. Now, I forgot how to do it.

    Reply
  41. bill gates

    This history is SURPRISINGLY accurate.

    Rick Weiland and I (Bill Gates) wrote the 6502 BASIC.

    I put the WAIT command in.

    Mark Chamberlin and I wrote the 6800 BASIC.

    When it says Paul Allen wrote the non-runtime stuff that means the development environment which was an amazing piece of work he did on the PDP10 that made development work very productive including simulation and symbolic debugging.

    There were a lot of interesting versions of BASIC done for Japanese machines this article misses and then of course we did the IBM PC ROM BASIC (Neil Konzen and a few other people did most of the conversion work).

    Reply
  42. ManikMike

    I “unravelled” the TRS-80 Color Basic ROM using the following program:

    10 CLS
    20 FOR I=&HBFEF TO &HBFE6 STEP -1
    30 J=PEEK(I)
    40 J=J-INT(J/64)*64
    50 IF I>&HBFE6 THEN A$=A$+CHR$(J+64) ELSE A$=A$+CHR$(J)
    60 NEXT I
    70 PRINT A$

    Looks like those “UNUSED GARBAGE BYTES” are indeed the

    MICROSOFT!

    Easter Egg

    Reply
  43. Sven Schubert

    Hmm, it’d be interesting to see if any of those easter eggs persist in the “RBASIC” interpreter for an East German machine called robotron A5105.

    It was manufactured by GDR’s company “robotron” and featured a Z80A clone (U880D), a “GW BASIC compatible” BASIC interpreter in ROM and a CP/M 2.2 clone also in ROM (“SCPX5105″). Interestingly, the OS booted depended on the existance of an empty file on the first floppy drive named “SCPXA5105.SYS” – if it was there, CP/M loaded, otherwise RBASIC.

    Robotron was known for its “creativity” when it came to “adapting” existing western hard- and software for their own socialist product line (CP/MSCP, dBASEIIREDABAS, SuperCalcKP, MS-DOSDCP etc pp).

    Robotron as a hard- and software manufacturer didn’t survive the fall of the Iron curtain and what little is left of it is still very paranoid about discussing this aspect of their creative process ;-)

    Well I guess I’ll see if I can find a ROM image somewhere or fire up one of the old machines even :-)

    Reply
  44. iss

    Confirmed for Tangerine Oric-1 and Oric-Atmos and Bulgarian clone Pravetz 8D.
    Here is the code for above ROMs (Thanks to ManikMike for idea and source :)) :

    1 ‘***********************
    2 ‘ MICROSOFT! Easter Egg
    3 ‘***********************
    4 B=#E435 : E=B+8
    5 FOR I=E TO B STEP -1
    6 J=PEEK(I) : J=J-INT(J/64)*64
    7 IF I>B THEN A$=A$+CHR$(J+64) ELSE A$=A$+CHR$(J)
    8 NEXT I
    9 PRINT A$

    Reply
  45. Pingback: Should I stay or should I go now?

  46. Petr Antos

    Nice to hear BillG here :) Those japanese portables are here: http://oldcomputers.net/kc.html, and I am pleased to have working Olivetti-M10 as precious thing, as by linked interview, its the last machine where Gates designed the 32kB(!) ROM a lot. In today context of phones and slates, they are beautifulll :-) On 4 AA cells for 20 hours of typing on regular keyboard :-). Thanks for all…..

    Reply
  47. Ed

    Given the ubiquity of 9-digit 6502 MS-BASICs, my surmise is that
    this came first – the 6-digit version being a derivative (replete with
    conversion bugs) made upon request for customers like OSI.

    From my notes on the string garbage collector bug in OSI ROM BASIC :

    > There were two distinct bugs in the garbage collector.
    >
    > 1. Bad traversing of the arrays area due to wrong string
    > step size. OSI Disk and other 6502 Basics use a step
    > size of 3. Rom Basic also used 3 but actually needed 4.
    >
    > 2. Temporary strings were not collected.
    >
    > Bug 1 was quite serious and often led to crashes if string
    > arrays were used. It only occurs in OSI/UK101 Rom Basic.
    > (I’m unaware of any 4-byte 6502 MS Basic other than OSI).
    >
    > Bug 2 would result in corrupted strings but not crash the
    > computer. The incidence of the bug hitting was fairly low.
    > It occurs in early 6502 MS Basics (OSI/UK101 Rom Basic,
    > OSI Disk Basic, PET 2001 etc).

    The “step size of 3″ occurs in 5-byte 6502 MS-BASICs. That it
    also appears in 4-byte OSI ROM BASIC and was the source of a bug
    that occured exclusively in that machine is suggestive that
    OSI ROM BASIC was derived from a 5-byte 6502 MS-BASIC.

    Reply
  48. Pingback: Easter Egg de Microsoft en Commodore BASIC en ALT1040 (Cultura Geek)

  49. Pingback: A 256 Byte Autostart Fast Loader for the Commodore 64 « pagetable.com

  50. Phil

    On the Laser 128EX (Apple IIe clone) computer, if you do CALL -151 to enter the monitor, then F094L, you?ll see the 10 bytes at addresses F094-F09D contain the ASCII text “ANITA&PHIL”.

    Reply
  51. überRegenbogen

    Phil said
    | On the Laser 128EX [...] F094-F09D
    | contain[s] the ASCII text ?ANITA&PHIL?.

    Nice tidbit! (I’d still like to score one of those.)

    FWIW, that decodes (per the obfuscated “MICROSOFT!” encoding) to “KNOW!FSNIF”.

    0300: A0 09 LDY #$09
    0302: B9 94 F0 LDA $F094,Y
    0305: 49 07 EOR #$07 ; $87 yields inverse/flash
    0307: 20 ED FD JSR $FDED ; on an A2
    030A: 88 DEY
    030B: 10 F5 BPL $0302
    030D: 60 RTS

    Reply
  52. Jason Harmon

    I might be able to answer the questions about the Atari version. The Atari OS uses 6 byte floating point in the OS by default. The OS ROM (outside of BASIC) has a set of floating point functions that work against these 6 byte structures. I suspect that MS continued to use the 6 byte format so it could use the OS’s FP functions or for compatibility.

    I have original working copies of both the Atari MS Basic v1 (disk based) and v2 (16KB ROM cart with disk based extensions), and could provide an image of these for review.

    Reply
  53. Angela M. Westell

    Dear Bill, thank you! At last all this seems a lot easier. And if anything has come of al this I feel the confidence in responding in a semi-knowledgable way. Microsoft is amazing just keep rockin’ n’ rollin’.

    Reply
  54. Boisy Pitre

    Great write-up. I’m writing a book on the history of the TRS-80 Color Computer and am actively searching for Mark Chamberlin (Chamberlain?) who wrote the 6809 BASIC interpreter code for the CoCo. There’s confusion on the spelling of his last name; I’ve seen both spellings. If anyone knows his whereabouts, please email me at boisy@tee-boy.com.

    Reply
  55. Andy Finkel

    Those bytes were important; Bob Russell and I had to really dig to free up bytes by the 1s and 2s to put in bug-fix patches back in those days. We were even reduced to using my my .byt 1c and 2c tricks to skip instructions. Those 51 bytes were a gift from heaven :-)

    Andy

    Reply
  56. Realms of Quest

    When I was making a retro RPG in 2009 for the VIC 20, instead of reinventing the wheel to perform math functions, I simply made function calls to the BASIC ROM. A lot of it was documented, but I couldn’t find anything on how Microsoft BASIC floating point numbers handled operations so I had to test it in various ways until I figured it out.

    I document this here:

    http://sleepingelephant.com/v-web/bulletin/bb/viewtopic.php?t=676&postdays=0&postorder=asc&start=15

    Reply
  57. Dan Schwartz

    Very interesting.

    Since the OSI (Ohio Scientific) ROM Basic with the buggy garbage collector was the first version of Microsoft’s 6502 Basic, there was no earlier version with 9-digit (5-byte) floating point that the wrong step size could have been copied from. But perhaps one was originally planned, but the plans were changed before it was finished. You do have to wonder why it was REV 3.2 if it was the first version released.

    BTW, I checked OSI’s later 9-digit version of Basic, and it does include the obfuscated MICROSOFT! (not the Commodore-ized version).

    As for Atari Microsoft Basic, it surely didn’t use Atari’s ROM-based floating-point package, since that stored numbers in decimal (BCD) form. I think the Atari Microsoft Basic (which I never used) had both single- and double-precision numbers, much like GWBASIC and its predecessor, MBASIC for CP/M. So single-precision would have been the 6-digit (4-byte or 32-bit) floating point. The Basics that used the 9-digit (5-byte or 40-bit) format did not include double-precision.

    Reply
  58. Dan Schwartz

    Well, another article on this site (Create your own Version of Microsoft BASIC for 6502) says that PET Basic version 1 was the first 6502 Microsoft Basic, so it is a little confusing. I was going to follow up the comment I made above by saying I didn’t think the OSI ROM Basic could have been the first version, because OSI actually had a disk-based version of their 6-digit Basic (shipped only with their earliest systems) that had to precede the ROM version. I’m pretty sure it signed on with the same VERSION 1.0 REV 3.2 message as the ROM version, and my understanding was that it didn’t have the deadly garbage-collector bug that the ROM version did, only the less-serious bug, but I never got the chance to verify that. Anyway, I think the sequence may have been the OSI 6-digit disk Basic first, then their ROM version, then PET Basic version 1, then OSI’s 9-digit disk Basic (which they extensively modified themselves in several different ways for their OS-65D 3.x and OS-65U operating systems).

    BTW, Mike Cohen (who I worked with in 1982-83 writing software for OSI machines) was definitely mistaken when he claimed in a comment left here in 2008 that the message ?Written by Bill Gates? ever appeared in OSI Basic; it was always, as the image above shows, “WRITTEN BY RICHARD W. WEILAND.” The message was supposed to be preceded by a form-feed, ASCII character 12, but outputting character 12 on the OSI ROM-based computers produced a graphic that was intended to be half of the starship Enterprise, and that is what you can see in photo. Mr. Weiland passed away in 2006.

    Reply
  59. Pingback: Anonymous

  60. Pingback: Amiga BASIC written by Microsoft?? - Page 4 - English Amiga Board

  61. Steven Weyhrich

    Fascinating article, with excellent detective/archaeology work!

    Regarding the comments from the Apple II History web site: My source identifying the 6502 BASIC author as Marc McDonald came from the 1993 biography, “Gates” by Stephen Maines and Paul Andrews. The info from that book that I’ve reproduced on my web site mentions McDonald using a modified 6800 microprocessor simulator to create the BASIC. Most likely, the scenario mentioned on this page is more accurate, that McDonald created the simulator and Weiland did the actual port of the BASIC.

    Regarding the comment by David Mercer up above: NONE of the Apple II models ever had BOTH versions of BASIC (Integer and Applesoft) in ROM. Pressing the shift key during boot had no effect on any Apple II. On the Apple IIe (and on any Apple II that had the extra 16K Language Card installed), the HELLO program on the DOS 3.3 Master Disk supplied by Apple would check which version of BASIC was in ROM, and then would load the other version into the Language Card RAM (which was bank-switched from $E000 to $FFFF). Using the DOS commands “INT” and “FP” made it possible to switch from one BASIC to the other (it just activated the appropriate bank of memory and jumped into the start code for that BASIC).

    Reply
  62. Ian McNeill

    the microtan65/tanex “10k extended basic” displayed “written by weiland & gates” when a certain key combo was used (I can’t remember the key combination)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>