Microsoft open-sources Bill Gates’ 6502 BASIC from 1978

Bzored

Ars Scholae Palatinae
833
Making the last update 48 years ago on github was a nice touch.

48.JPG
 
Upvote
186 (186 / 0)

tuffy

Ars Scholae Palatinae
943
Still have that Applesoft Tutorial book in a drawer, spiral-bound for easy reference while plugging a lot of BASIC code into an Apple ][. As a kid, getting new video games was a sporadic event, so I spent a lot of time programming my own in BASIC. They weren't much, but it was a good learning experience at the time and I'm still programming to this day.
 
Upvote
53 (53 / 0)

mdrejhon

Ars Praefectus
3,107
Subscriptor
The README on the github page...
[snip]
...the commit date is set correctly :) (1978)
Unless they had HAL9000, I doubt that README.md was made 48 years ago. Whoopsie!

1757006313530.png

For coders, just dive straight into the good source code comments and enjoy history from there. The README seems to be for newbies and non-coders who's still familiar with the retro era.

There's over 500 contiguous lines of nearly completely codeless comments (lines ~200-700) that includes introduction and documentation, so even beginner coders can still enjoy that nugget in the source code.

For me -- my spiritual alma mater is the Commodore 64 that uses the 6510, which uses the 6502 instruction set that I am familiar with. It's neat recognizing the instruction set and logic in this source code.
 
Last edited:
Upvote
47 (49 / -2)
Designer Chuck Peddle created the 6502 specifically to bring computing to the masses, and manufacturers built variations of the chip into the Atari 2600, Nintendo Entertainment System, and millions of Commodore computers.
And Apple ]['s! I taught myself programming on one, with a copy of The Applesoft Tutorial in hand that my dad had photocopied at work. To this day I don't think I'd seen that cover photo in colour :D

More decades than I care to admit later I still code pretty often. Thanks Rick! (and I guess Bill, though iirc AppleSoft didn't have WAIT, I think I wrote a lot of empty FOR loops in those days)
 
Last edited:
Upvote
22 (23 / -1)

StudentofLife

Wise, Aged Ars Veteran
101
Subscriptor++
In 1977, Commodore licensed Microsoft's 6502 BASIC for a flat fee of $25,000. Jack Tramiel's company got perpetual rights to ship the software on unlimited machines
While this was certainly a coup for Jack Tramiel, given what we know about Tramiel, I don’t think the following necessarily follows:
Had Microsoft negotiated a per-unit licensing fee like they did with later products, the deal could have generated tens of millions in revenue.
It’s well known that Tramiel drove impossibly hard bargains and didn’t hesitate to even put vendors out of business or go against his own interests if he thought he wasn’t getting an incredible deal.

I think the exposure in the Commodore computers are partially what gave Microsoft the position to have those later sales with per-unit licensing, and the goodwill for Commodore to allow Commodore engineer John Feagans to spend time with Gates, making what I wouldn’t be surprised to learn were “free” updates to Microsoft code, even though Commodore benefited as well.
 
Upvote
69 (69 / 0)

Kasoroth

Ars Praefectus
4,054
Subscriptor++
Interestingly, just a couple weeks ago I pulled one of my old Commodore 64s out of a drawer, and ordered a C64 to S-video adapter on Amazon (pretty amazing that such a niche thing exists and can be delivered to my house in a few days...thanks to dedicated hobbyists, 3D printers, and custom PCB makers), and a USB video capture adapter with S-video input.

Amazingly, everything still worked fine, and the C64 screen popped up in a VLC window on my Framework 16 running Ubuntu. The plastic of the C64 (actually the slightly updated C64C) was quite discolored, and some of the key caps were so brittle the edges were crumbling, but the thing still just fired up and worked.

I found an old case of floppy disks with various games, and three out of the four I tried still actually worked fine (including "Impossible Mission" from Epyx). I'm actually pretty shocked that any of those disks still worked after sitting in my basement for 35 years.

P.S. - The first thing I did when it successfully powered up was write almost exactly the example BASIC program from this article. Mine was:
10 PRINT "IT WORKS!!!"
20 GOTO 10
 
Last edited:
Upvote
66 (66 / 0)
Post content hidden for low score. Show…

benwaggoner

Ars Praefectus
4,113
Subscriptor
It is crazy thinking back to all the pretty complex programs I wrote on my Apple //c back in high school.

Animated simulators of the statistical drunken man principle. I was able to make an image of a guy running by combining two special characters. I did a number of these for statistics and physics class. Possibly instead of doing my actual homework, and without asking my teachers if I could, let alone for extra credit... I was probably a hard kid to grade.

A pretty full featured RoleMaster combat manager/tracker. I did some other RPG ones as well. I also made a complete Palladium 1e character sheet in PFS Write because the stock one was so terrible. I still have some of those character sheets with a little fringe from where the tractor feed guides on the side didn't pull off cleanly after printing on my ImageWriter. NO WYSIWYG or proportional fonts, of course. I had a 80 character wide screen, so it was an 80 character wide sheet. Just monospaced fonts with pipes and dashes for borders.

And, uh, a bunch of others I remember remembering fifteen years ago...
 
Upvote
17 (17 / 0)
Microsoft was smart in charging a flat rate licensing fee - it meant that millions of people saw the name 'Microsoft' on their computers and gave the company a foothold to become the industry giant it would later be.

I see someone posted this before I did!
They probably would have had their name on it regardless of how good or bad the deal was.
 
Upvote
2 (3 / -1)

stormcrash

Ars Legatus Legionis
10,921
Microsoft was smart in charging a flat rate licensing fee - it meant that millions of people saw the name 'Microsoft' on their computers and gave the company a foothold to become the industry giant it would later be.

I see someone posted this before I did!
They didn't want to but Tramiel/Commodore insisted, they also refused to let the Mirosoft name show up on the boot screen. That flat fee is part of why the 64 shipped with basic 2.0 along with 4.0 needing a bigger ROM. There was even a hidden poke that would spell out MICROSOFT! as an easter egg on some PETs that was hidden in the source code with the string obfuscated, and Commodre was very unhappy when that was found out
 
Upvote
21 (22 / -1)

stormcrash

Ars Legatus Legionis
10,921
While this was certainly a coup for Jack Tramiel, given what we know about Tramiel, I don’t think the following necessarily follows:

It’s well known that Tramiel drove impossibly hard bargains and didn’t hesitate to even put vendors out of business or go against his own interests if he thought he wasn’t getting an incredible deal.

I think the exposure in the Commodore computers are partially what gave Microsoft the position to have those later sales with per-unit licensing, and the goodwill for Commodore to allow Commodore engineer John Feagans to spend time with Gates, making what I wouldn’t be surprised to learn were “free” updates to Microsoft code, even though Commodore benefited as well.
Having a 6502 basic from the PET pretty well set them up to deliver Applesoft Basic to Apple when the need for a floating point basic to replace Woz's Integer Basic became apparent. Though with the Altair/8080/Z80 and CP/M world already having MS Basic pretty entrenched Microsoft was pretty much the go-to for getting a BASIC for your computer
 
Upvote
8 (8 / 0)

jdale

Ars Legatus Legionis
18,338
Subscriptor
It is crazy thinking back to all the pretty complex programs I wrote on my Apple //c back in high school.

Animated simulators of the statistical drunken man principle. I was able to make an image of a guy running by combining two special characters. I did a number of these for statistics and physics class. Possibly instead of doing my actual homework, and without asking my teachers if I could, let alone for extra credit... I was probably a hard kid to grade.

A pretty full featured RoleMaster combat manager/tracker. I did some other RPG ones as well. I also made a complete Palladium 1e character sheet in PFS Write because the stock one was so terrible. I still have some of those character sheets with a little fringe from where the tractor feed guides on the side didn't pull off cleanly after printing on my ImageWriter. NO WYSIWYG or proportional fonts, of course. I had a 80 character wide screen, so it was an 80 character wide sheet. Just monospaced fonts with pipes and dashes for borders.

And, uh, a bunch of others I remember remembering fifteen years ago...
Rolemaster is basically why I learned VBA! Good stuff.

I think my biggest project in the original basic was implementing the game Core Wars https://en.wikipedia.org/wiki/Core_War on the Commodore 128.
 
Upvote
10 (10 / 0)

benwaggoner

Ars Praefectus
4,113
Subscriptor
Interestingly, just a couple weeks ago I pulled one of my old Commodore 64s out of a drawer, and ordered a C64 to S-video adapter on Amazon (pretty amazing that such a niche thing exists and can be delivered to my house in a few days...thanks to dedicated hobbyists, 3D printers, and custom PCB makers), and a USB video capture adapter with S-video input.
IIRC, the C64 did have a RGB output, so that S-video adaptor could well be an entirely analog device. The C64 predated S-VHS and thus consumer S-Video use by five years. While it wasn't used for computer stuff much, the chroma/luma separation made for such clearer looking text and sharp lines without the composite artifacts previously unavoidable without RGB end to end.

(Pro tip, old pre-USB Apple Desktop Bus cables also used the 4-pin mini DIN connectors and work perfectly for S-video too).
 
Upvote
13 (13 / 0)

Sailingfree

Smack-Fu Master, in training
1
Wow, nice to see they've done this. The comments are basically the documentation as was common back then. Only one document to look after and it didn't get lost. I remember documenting most of the commercial 16 bit mini assembler operating system I worked on then in the source code files.
I also remember dissassembling the BASIC on my UK101 - A UK version of one of the OSI 6502 machines in 1979 on rolls of teletype paper and laboriously trying to comment and label the whole thing. I think that the 6502 journal had a similar article. Having the original source, albeit in a general macro form here is interesting. I remember getting stuck in the expression evaluator then. Sadly all that got lost in subsequent house moves.
 
Upvote
9 (9 / 0)

benwaggoner

Ars Praefectus
4,113
Subscriptor
Rolemaster is basically why I learned VBA! Good stuff.
As a wizened grognard now, I look back on RoleMaster as pretty much RollMaster, with a really terrible mechanical complexity to game fun ratio. Having to look up a different table for each weapon made things so slow.

The early RPG I look back on with the most fondness is RuneQuest and its BRP dependents, which seriously surpassed D&D in the fun/roleplaying/visceral combat to mechanical crunch ratio. Hard to believe they delivered something that still seems pretty innovative back in 1978. Classless, levelless, skill based, hit locations and injuries instead of "fight perfectly until you're dead."

The Hero system also has held up really well, with its point-buy customizability. It also introduced lots of other great ideas like advantages/disadvantages, having basic abilities with lots of available modifiers instead of making everything its own unique spell, etcetera.

I think my biggest project in the original basic was implementing the game Core Wars https://en.wikipedia.org/wiki/Core_War on the Commodore 128.
A stone cold classic!
 
Upvote
9 (9 / 0)

Kasoroth

Ars Praefectus
4,054
Subscriptor++
IIRC, the C64 did have a RGB output, so that S-video adaptor could well be an entirely analog device. The C64 predated S-VHS and thus consumer S-Video use by five years. While it wasn't used for computer stuff much, the chroma/luma separation made for such clearer looking text and sharp lines without the composite artifacts previously unavoidable without RGB end to end.

(Pro tip, old pre-USB Apple Desktop Bus cables also used the 4-pin mini DIN connectors and work perfectly for S-video too).
Yep, I think its an entirely passive adapter (I haven't actually opened it up to confirm that though), because the C64 basically had S-video before S-video was a standardized thing. The display on my USB captured S-video setup is much clearer than I ever had with the Magnavox composite video monitor I used back in the 80s when the C64 was my main PC (and even that was significantly better than a typical TV).
 
Upvote
9 (9 / 0)

benwaggoner

Ars Praefectus
4,113
Subscriptor
Wow, nice to see they've done this. The comments are basically the documentation as was common back then. Only one document to look after and it didn't get lost. I remember documenting most of the commercial 16 bit mini assembler operating system I worked on then in the source code files.
I also remember dissassembling the BASIC on my UK101 - A UK version of one of the OSI 6502 machines in 1979 on rolls of teletype paper and laboriously trying to comment and label the whole thing. I think that the 6502 journal had a similar article. Having the original source, albeit in a general macro form here is interesting. I remember getting stuck in the expression evaluator then. Sadly all that got lost in subsequent house moves.
I imagine there was other documentation as well, perhaps lost to time along the way.

Sheesh, in assembly the comments were probably 90% of the source code length. And back in a day with serious file size limits!
 
Upvote
5 (5 / 0)

SharpieFiend

Ars Scholae Palatinae
1,013
They didn't want to but Tramiel/Commodore insisted, they also refused to let the Mirosoft name show up on the boot screen. That flat fee is part of why the 64 shipped with basic 2.0 along with 4.0 needing a bigger ROM. There was even a hidden poke that would spell out MICROSOFT! as an easter egg on some PETs that was hidden in the source code with the string obfuscated, and Commodre was very unhappy when that was found out
It certainly appeared in the documentation which everyone read at the time.
 
Upvote
3 (3 / 0)

benwaggoner

Ars Praefectus
4,113
Subscriptor
Yep, I think its an entirely passive adapter (I haven't actually opened it up to confirm that though), because the C64 basically had S-video before S-video was a standardized thing. The display on my USB captured S-video setup is much clearer than I ever had with the Magnavox composite video monitor I used back in the 80s when the C64 was my main PC (and even that was significantly better than a typical TV).
Composite was one of the original sins of color TV. Instead of making an actual color system, we basically just did a color overlay on top of the existing B&W signal using not-enough bandwidth left over at the sides of the channel's frequency band. But there was no electronic way to accurately separate chroma from luma again, so sharp details would leak into weird color patterns. I remember the ties in Perry Mason being a classic example in circa 1980 TVs. 3D comb filters and such suppressed that kind of error in later devices, but TV broadcast never really got to be much more than a detailed B&W background with some crayon smeared on top, like an eight year old's coloring book.
 
Upvote
5 (13 / -8)
The Commodore “Personal Electronic Transactor” was the first microcomputer I ever used. There was exactly one in our high school. People would get get a little while in the seat to try to finish their assignments, but that didn’t work too well.

Most of my time on it was after classes, competing with the other more hardcore geeks. The discovery of the POKE command was revolutionary!
 
Upvote
8 (8 / 0)

real mikeb_60

Ars Tribunus Angusticlavius
13,054
Subscriptor
Now how about something else from the same period: TRS-80 Level 2 BASIC and its disk extensions, and/or MS BASIC for CP/M? The former is very close to GW-BASIC, but not quite; a key difference is screen addressing as a simple memory array rather than row/col (some hackers of the time provided subroutines or functions that translated the array addressing for specific TRS-80 models to row/col). The disk functions, of course, dealt with TRS-80 standard formats rather than IBM. MS-BASIC for CP/M was even closer to GW-BASIC, but was compiled for 8080 or Z80 processors (most TRS-80 BASIC was for Z80).

As for those wanting QBASIC, if you have 32-bit Windows on some old machine (there was a 32-bit Windows through 10), QBASIC runs fine if you transplant the .exe from an old MSDOS 5 or higher disk. Perhaps too fast for Gorillas to be playable, but it runs. Also runs under DOS or older Windows in a 32-bit VM.

DOSBox and its derivatives in Windows and Linux (not sure about availability in Mac) of course comes with most of DOS built-in so you could probably run the BASIC .exe from any IBM-compatible in it. Was able to install all of Win3.1 in it, running well.

Another early MS thing that would be fun to see would be XENIX. One of the early commercially-oriented UNIX descendants, that would run great in a TRS-80 Model 2 with a 68K upgrade cage (XENIX ran the computer in that case, with the Z80 demoted to an I/O processor). But probably still covered under AT&T's umbrella copyrights so unlikely we'll see it any time soon.

Good to have the source code for any of these, though, even if none of the compiler support needed to build it is provided. Amazing how much could be packed into 8-32K of RAM or ROM.
 
Upvote
12 (12 / 0)

Dzov

Ars Legatus Legionis
16,044
Subscriptor++
Interestingly, just a couple weeks ago I pulled one of my old Commodore 64s out of a drawer, and ordered a C64 to S-video adapter on Amazon (pretty amazing that such a niche thing exists and can be delivered to my house in a few days...thanks to dedicated hobbyists, 3D printers, and custom PCB makers), and a USB video capture adapter with S-video input.
If I recall correctly, the C64 monitor output basically was S-video.
Here's a diagram that seems to back it up from https://www.lemon64.com/forum/viewtopic.php?t=72807 :
Video-4.png

This 8-pin DIN in addition to having the composite video output on pin 4, also now had both a separate LUMA (luminance) and CHROMA (chrominance) output on pins 1 and 6. At the time this was known as Commodore Video but what Commodore had done was to basically implement what would one day be called S-Video which improved picture quality dramatically from the RF and composite signals.
 
Upvote
30 (30 / 0)