Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
Microsoft Open Source IT

Microsoft's 6502 BASIC Is Now Open Source (microsoft.com) 50

alternative_right writes: For decades, fragments and unofficial copies of Microsoft's 6502 BASIC have circulated online, mirrored on retrocomputing sites, and preserved in museum archives. Coders have studied the code, rebuilt it, and even run it in modern systems. Today, for the first time, we're opening the hatch and officially releasing the code under an open-source license. Microsoft BASIC began in 1975 as the company's very first product: a BASIC interpreter for the Intel 8080, written by Bill Gates and Paul Allen for the Altair 8800. That codebase was soon adapted to run on other 8-bit CPUs, including the MOS 6502, Motorola 6800, and 6809.

The 6502 port was completed in 1976 by Bill Gates and Ric Weiland. In 1977, Commodore licensed it for a flat fee of $25,000, a deal that placed Microsoft BASIC at the heart of Commodore's PET computers and, later, the VIC-20 and Commodore 64. The version we are releasing here -- labeled "1.1" -- contains fixes to the garbage collector identified by Commodore and jointly implemented in 1978 by Commodore engineer John Feagans and Bill Gates, when Feagans traveled to Microsoft's Bellevue offices. This is the version that shipped as the PET's "BASIC V2." It even contains a playful Bill Gates Easter egg, hidden in the labels STORDO and STORD0, which Gates himself confirmed in 2010.

Microsoft's 6502 BASIC Is Now Open Source

Comments Filter:
  • Now do 6809E for the Tandy CoCo.

    • by Anonymous Coward
      Remember when John Carmark would release all his sources for AAA games a year after release?

      The reason why we're just seeing 45 year old source now is because the authors are embarrassed of what people will see.
    • by dskoll ( 99328 )

      I had a CoCo. There is a great series of books [colorcomputerarchive.com]: Color BASIC Unraveled, Extended BASIC Unraveled and Disk BASIC Unraveled which are commented disassemblies of the ROMs. I learned a lot about assembly language programming from reading those books.

    • "Now do 6809E for the Tandy CoCo." - that was my first thought too after reading the headline. Do both Disk Extended Color Basic 1.1 (CoCo1/2) and 2.0 (CoCo3).

      • by narcc ( 412956 )

        The comment just above yours has what you want [colorcomputerarchive.com]

        • by Megane ( 129182 )

          There is a big difference between a commented disassembly and the original source code with original comments and labels.

          At least that one edited the disassembly to show data bytes. The equivalent books for the Model I/III used a brainless disassembler that mowed right through data.

    • by Megane ( 129182 )

      There is in fact a 6809 version out there, [hackaday.com] but it was from the Dragon 64. Which is almost exactly the same as CoCo, and with a math package not much more advanced than this current 6502 release. The code is mostly a direct port between 6502 and 68xx, so with a good disassembler that lets you assign labels it's not hard to match up to other binary versions.

      And it's still from the era with only one numeric type. There was a relatively modern (roughly equivalent to CP/M) 6502 version for Atari ("Microsoft Ba

  • '48 years ago' (Score:5, Interesting)

    by Sebby ( 238625 ) on Thursday September 04, 2025 @01:08PM (#65638922) Journal

    I kinda like how the file statuses [github.com] actually show them being modified '48 years ago'.

  • by Sloppy ( 14984 ) on Thursday September 04, 2025 @01:10PM (#65638924) Homepage Journal

    I carried my Abacus "The Anatomy of the Commodore 64" around all the time, mostly because it had a somewhat-commented disassembly of the C64's ROMs, which included this interpreter. But actual source would be even cooler.

    I remember reading through it and suddenly realizing: "oh, that is why IF..GOTO is slightly faster than IF..THEN, because it skips an unnecessary call to CHRGET."

    • by Sloppy ( 14984 )

      Ha ha! The github page shows it as last committed "48 years ago." Good one, MS.

    • Teenage me would have been confused. "What is Microsoft thinking, releasing their source code for all to see?" Back then, open source was still kind of a fringe concept.

      • by Sique ( 173459 )
        Teenage me didn't know there was some kind of taboo about reading other people's code. To the contrary, my coding books explicitly asked for reading other people's code to improve your skills.
        • by AmiMoJo ( 196126 )

          Being able to read assembler was a very useful skill, because a lot of software was written in assembler so you essentially had the source minus names and comments.

          Even with that though, there are a few bits of code so clever that even with a disassembly nobody has managed to replicate them. The 2-axis rotozoom from Sanity's Roots demo comes to mind.

      • by tlhIngan ( 30335 )

        Teenage me would have been confused. "What is Microsoft thinking, releasing their source code for all to see?" Back then, open source was still kind of a fringe concept.

        No it wasn't. Open source was a big reason for the microcomputer revolution in the 70s - everyone was sharing around source code freely. The Apple II even came with full source code for the ROM.

        The key points that changed it would be first, BIll Gates' famous "piracy" letter where he called the people freely copying Microsoft Basic as pirate

        • I certainly agree that open source code existed in the 70s. But I'd also point out that computing itself was still "fringe" at that time. Only serious hobbyists and large, rich businesses had computers at all. Yes, the Apple II came with source code, but most of the original personal computers did not. The Commodore 64, TRS-80, IBM PC / DOS, and later Apple computers all were closed source. Most early popular software was also closed source, such as VisiCalc, StarCalc, WordPerfect, and on and on. By 1995, o

    • Same here. I stole mine from a local bookstore, mid eighties. I spent weeks maybe months reading the assembler listings. Now it turns out I have been obsessed by code written by Bill Gates! In his last book he talks about optimizing the code in his head while hiking with his friends.

      • by Megane ( 129182 )

        Actually Bill Gates didn't work on the 6502 versions. He was only involved in the x80 releases. The last version that he did any major work on was supposedly the Tandy 100 portable.

        But I started on a TRS-80 Model I Level II, and within a year or two had already begun disassembling it. So I really did learn assembly language from Bill Gates.

  • I had an OSI Challenger IIP with MS Basic, I wonder if this is the same?

    • by Megane ( 129182 )

      OSI was one of the original targets of this. I spent some time looking at the OS65U version just last week. I could definitely see it being based on this code. They kept to a single binary version and monkey-patched it like crazy to add stuff. Or at least they did after they found a bug in the string garbage collection, when they had already ordered thousands of mask ROMs with the buggy code. The keyword table was 255 bytes long because they didn't want to rewrite the code in CRUNCH and LIST, which used abs

  • by Dadoo ( 899435 ) on Thursday September 04, 2025 @01:38PM (#65638976) Journal

    Interesting. My OSI C4P BASIC in ROM says:

    WRITTEN BY RICHARD W. WEILAND.
    OSI 6502 BASIC VERSION 1.0 REV 3.2
    COPYRIGHT 1977 BY MICROSOFT CO.

    Makes me wonder how much the other guys actually contributed.

  • It's nice to see this. I expect it's like a visit from an old friend for many people on slashdot.

    I got my start with computers on the Commodore PET in our middle-school lunchroom, taking apart commercial BASIC programs, changing them to do what I wanted and saving my creations to blank parts at the end of the cassette tape. Then I moved on to summer BASIC classes on a TRS-80 and eventually more serious programming in Applesoft BASIC on an Apple ][+ as a teenager.

    Never realized all those BASICs were more or

  • It has been way to long, don't remember anymore.
  • Just think, in 20 more years MS will open source Windows 95 and, if lucky NT 3.5!

    • NT4, 2000, and XP/Server2003 sources are out there. What is desperately needed is Win7, and more related to this article, VB6. Those would provide actual benefits beyond hobbyist curiosity for retrocomputing even though they're long out of date. But greedy MS can't even do that. They're still the enemies of open source they've always been... just giving people some little scraps to pretend they're not.
  • I literally learned to program on a Commodore PET, and the first computer I owned was a Commodore 64. Now, the BASIC interpreters in those computers have long since been disassembled and analyzed, but it is still cool to have the original source.
  • FTW

  • Just asking for a friend.

  • by waimate ( 147056 ) on Thursday September 04, 2025 @07:42PM (#65639750) Homepage

    Unrelated to 6502, but may be of interest because it's a very early version of MicroSoft Basic, here is a photorealistic sim of it running on an Altair with an ASR33.

    It's the actual binary of the basic interpreter, running on simulated Altair and simulated ASR-33, with actual sounds and at proper speed. Gives a flavour for where the this Basic interpreter first saw light

    https://s2js.com/altair/sim.ht... [s2js.com]

  • 4358    STWD    FRESPC        ;PUT IT THERE OLD MAN.
    https://github.com/microsoft/BASIC-M6502/blob/7460af2c03ae19c0e60ff327489229d2005b9357/m6502.asm#L4358

    6897    LDWDI    WORDS        ;MORE BULLSHIT.
    https://github.com/microsoft/BASIC-M6502/blob/7460af2c03ae19c0e60ff327489229d2005b9357/m6502.asm#L6897
    • Who's Bob Albrecht?

          CMPI    7        ;IS IT BOB ALBRECHT RINGING THE BELL
                      ;FOR SCHOOL KIDS?

  • by rklrkl ( 554527 ) on Friday September 05, 2025 @05:30AM (#65640454) Homepage

    BBC BASIC shipped with the BBC Micro in 1981 was by far the best BASIC ever written for the 6502 CPU. It was extremely fast (it tokenised BASIC keywords for speed and memory saving), had various graphics instructions and had the brilliant feature of a 6502 assembler built in, so you could write either 100% machine code programs or mix BASIC and machine code. It made Microsoft's 6502 BASIC look like amateur hour, IMHO.

  • Was there much overlap between the 6502 version and the 8088 version, or did it need to be completely rewritten?

    I could see them having a higher level design, which could in theory actually be C code, which just needed to be rendered, er, compiled down to the specific instruction sets. I'm assuming all this assembly was written as assembly, but there could still be a higher-level design, rendered as flowcharts or whatever that was translated for each architecture.

    It's a fascinating part of computer history

    • by Megane ( 129182 )

      The 6502 was basically all new code, then it was ported to the 6800, 6800 variants, and the 6809. At least I think the 6502 was first. The 68000 versions probably evolved from that code base.

      The x86 version was a port of the 8080 version, and those who know their x86 code say that it clearly was ported by one of those cross assembler translation things that made less than optimal code for memory moves, and it took a few years before someone cleaned those up.

      But they did do something cool for the original

  • This is exactly the same as the pagetable.com [pagetable.com] version of ten years ago. The main difference is an official open source license for it.

    I certainly hope they still have the source code to newer versions and will release them. There were improved versions released for the 6502 as Microsoft Basic II for the Atari, and the Epson HX-20 BASIC for 6301. And then there were the 68000 versions that are still completely un-leaked.

You are in a maze of little twisting passages, all alike.

Working...