After 37 Years Microsoft Open Sources GW-BASIC (microsoft.com) 101
"Having re-open-sourced MS-DOS on GitHub in 2018, Microsoft has now released the source code for GW-BASIC, Microsoft's 1983 BASIC interpreter," reports ZDNet, adding that GW-BASIC "can trace its roots back to Bill Gates' and Paul Allen's implementation of Microsoft's first product, the BASIC interpreter for the Altair 8800 computer."
"Interested to look at thousands of lines of glorious 8088 assembly code for the original 1983 GW-BASIC...?" writes Slashdot reader sonofusion82, adding "there are not Makefiles or build scripts, just a bunch of 8088 ASM files."
Or as Hackaday jokes, "Microsoft releases the source code you wanted almost 30 years ago." In the late 1970s and early 1980s, if you had a personal computer there was a fair chance it either booted into some version of Microsoft Basic or you could load and run Basic... Now you can get the once-coveted Microsoft Basic source code...
They put up a read only GW-BASIC repository, presumably to stop a flood of feature requests for GPU acceleration...
From what we understand, GW-Basic was identical to IBM's BASICA, but didn't require certain IBM PC ROMs to operate. Of course, BASICA, itself, came from MBASIC, Microsoft's CP/M language that originated with Altair Basic... We did enjoy the 1975 copyright message, though:
ORIGINALLY WRITTEN ON THE PDP-10 FROM FEBRUARY 9 TO APRIL 9 1975
BILL GATES WROTE A LOT OF STUFF.
PAUL ALLEN WROTE A LOT OF OTHER STUFF AND FAST CODE.
MONTE DAVIDOFF WROTE THE MATH PACKAGE (F4I.MAC).
Bill Gates was 19 years old, Paul Allen was 22.
"Interested to look at thousands of lines of glorious 8088 assembly code for the original 1983 GW-BASIC...?" writes Slashdot reader sonofusion82, adding "there are not Makefiles or build scripts, just a bunch of 8088 ASM files."
Or as Hackaday jokes, "Microsoft releases the source code you wanted almost 30 years ago." In the late 1970s and early 1980s, if you had a personal computer there was a fair chance it either booted into some version of Microsoft Basic or you could load and run Basic... Now you can get the once-coveted Microsoft Basic source code...
They put up a read only GW-BASIC repository, presumably to stop a flood of feature requests for GPU acceleration...
From what we understand, GW-Basic was identical to IBM's BASICA, but didn't require certain IBM PC ROMs to operate. Of course, BASICA, itself, came from MBASIC, Microsoft's CP/M language that originated with Altair Basic... We did enjoy the 1975 copyright message, though:
ORIGINALLY WRITTEN ON THE PDP-10 FROM FEBRUARY 9 TO APRIL 9 1975
BILL GATES WROTE A LOT OF STUFF.
PAUL ALLEN WROTE A LOT OF OTHER STUFF AND FAST CODE.
MONTE DAVIDOFF WROTE THE MATH PACKAGE (F4I.MAC).
Bill Gates was 19 years old, Paul Allen was 22.
Wasn't it already open sourced (Score:5, Funny)
Comments (Score:4, Interesting)
Could have a long conversation on asm comments (Score:4, Insightful)
Looking at the code, I would rate the commenting as fair. I as I read through it, I found too many things like:
XOR AL,AL ;MAKE SURE [AL]=0 ;[H,L]=NUMBER OF DIMENSIONS TIMES TWO ;branch if greater than 0
ADD BX,BX
JG TBNONG
When you're writing assembly language, you have to be judicious when it comes to commenting - long descriptions before blocks of code is better than line by line comments in assembler.
The important thing though, is that the code works and worked well for years.
Re: (Score:2)
When you're writing assembly language, you have to be judicious when it comes to commenting - long descriptions before blocks of code is better than line by line comments in assembler.
In assembly, I've always liked the line-by-line comments, although the long descriptions are important too. You are right "branch if greater than 0" is not helpful.
Re: (Score:3)
I find line by line assembly comments as being distracting and make it difficult to follow the thread of the code.
Interesting that you didn't pick up on the other two examples in my post - Xor'ing a register with itself was a common way of zeroing out an 8086 register - it is a two byte instruction and actually the shortest & fastest way of setting the contents of a register/half register to zero (no clear register and "mov r, 0" took three or four bytes depending on whether or not it was a half or full
Re: (Score:2)
[H,L]=NUMBER OF DIMENSIONS TIMES TWO
On this one it wasn't clear to me what the "number of dimensions" referred to, so without context I didn't feel confident asserting the comment was useless (or useful). The last comment is clearly useless though to anyone who understands what JG means.
Re: (Score:2)
Similarly, "add bx, bx" and saying you multiply the contents by two is assuming that the reader doesn't know that "x + x == 2x".
Ah, but is shifting faster than adding on the 8088?
Re: (Score:2)
Interesting question - I had to go back into some manuals and research it.
"add bx, bx" - two bytes & 3 clock cycles
"sal bx" - (this shifts left once) two bytes & 2 clock cycles
So, yes, shifting is faster on the 8086 but, If I remember correctly, on the 8088 (which has an 8 bit bus the 8086 has a 16 bit) the shift left will execute in 3 clock cycles because it takes two to load in the instruction and one to execute.
Re: (Score:3)
The real thing is that Microsoft wrote BASIC once - they had a master source file and
Microsoft only wrote BASIC once? (Score:2)
Do you have a reference for that?
I have a hard time believing that they had one "master source file" - I know all of those architectures (and have written code for all of them) and I have a hard time believing that there is a single assembly language file that will work on all them.
Just as a cross check on some of your points:
- The 6502 wasn't anywhere close to being "binary code" compatible with the 6800 - the 6800 had 72 instructions and the 6502 had 56 with the big difference being that the 6800 had a 16
Re: (Score:2)
The GitHub repo actually mentions the "master sources". Apparently, that involved a lot of assembly macros.
Re: (Score:2)
The 6502 was source comaptible with the 6800. Not binary
Re: (Score:2)
The 6502 was source comaptible with the 6800. Not binary compatible!
You were the one that said it was "binary compatible".
The MOS 6500 was a completely compatible clone of the Motorola 6800. Pin and binary compatible. Motorola hated that and sued MOS over it. That's why MOS released the 6502, a similar source-compatible version of the 6800, but not binary nor pin compatible.
And by source compatible, I really meant mostly source compatible - differing instructions did mean you did have to adapt things at times.
First off, the MOS 6500 was a microcontroller with 2K PROM and 64 bytes of RAM and the 6502 processor. It was the MOS 6501 that was advertised as a cost efficient drop in replacement to the MOT 6800 but was never a "completely compatible clone": https://en.wikipedia.org/wiki/... [wikipedia.org] The lawsuit was to stop former Motorola employees using IP and patented information - reading about it, it sounds like Motorola was more pissed that their former chip designers
Re: (Score:2)
> The Z80 was a similar story, being source
> compatible with the 8080 at the time.
Outside of a couple of odd circumstances, it was also binary compatible.
IIRC, two instructions took one cycle more or less to execute, but dependency on that would be at least rare.
Also, there were a couple of somewhat commonly used undocumented instructions on the 8080, but I think they all had z80 equivalents. I recall that there was a one byte patch for Heathkit's chess program to make it run on z80.
and there was *s
Re:Could have a long conversation on asm comments (Score:4, Interesting)
I call that No shit, Sherlock amateur coding. Stating the obvious is just noise.
Apparently it took decades for programmers to learn:
* Code documents HOW
* Comments documents WHY
Re:Could have a long conversation on asm comments (Score:5, Insightful)
Don't document your code, code your documentation
Re: (Score:2)
Brilliant!
Mod parent up (Score:2)
Nicely put.
Re:Could have a long conversation on asm comments (Score:4, Insightful)
One technique to writing assembler was to write every step in plain English. Work out the pseudo-code. Then add in the assembly. If you were good at it, you wrote your pseudo-code in a way that had a high correlation to the machine architecture. Doing this make it a bit easier to understand what was intended and compare that to what the assembler actually does. A lot of the microcomputer CISC code of the era had weird side-effects that could trip a person up, spotting this gets a little easier when you can compare side-by-side with the English logic.
Re: (Score:2)
I guess I was very different than most. I entered the field in '79 and from the start realized that reading comments led me astray from what the code actually did far too often. Comments can lie about what the code does. The code can't. If I saw the comment first, it wasn't unusual for me to miss otherwise obvious errors in the code.
Long before editors offered the ability to just hide comments, I usually worked with separate files and programs to strip comments and compare code whenever I needed to make sur
Re: (Score:1)
If I saw the comment first, it wasn't unusual for me to miss otherwise obvious errors in the code.
Indeed. Comments are almost always an incomplete picture of what was actually written. That's not to say comments are worthless, it can be valuable to compare what was intended versus what is written.
Long before editors offered the ability to just hide comments,
I stopped reading at the ; if I was going through code. One of the output formats of my assembler would show address, hex, assembler, and comments all together in an easy to print format. And hopefully the comments were lined up in a way to start on
Re: (Score:2)
One advantage I left out of excessive comments is that it made it quite a bit easier for people to port to other CPUs. Take any of the very direct ports of games and utilities done between 6502 and Z80 back in the day, and the source was very well commented. One guy might design the initial project on a TSR-80 (pre-CoCo) and end up porting it to a few other Z80 systems, before someone else carries it over to 6502 land.
I was in a bit of a different world - very large scale, real-time embedded systems. These systems typically used external hardware-based ROM switching to extend way beyond the addressable limits of the processors. So we had A LOT of code. Consequently, the two times I was involved in architecture ports, we customized cross-compilers to translate the source from one language to the other. The code wasn't ideal, but the projects were successful, even from a budget and schedule POV. I would note that we only f
Re: (Score:2)
I recently discovered some old code I wrote in Z80 assembler more than 35 years ago.
Youtube video showing the source code [youtube.com]
Those were great days... cutting code in assembler was so much fun and allowed you to get so much out of so little (in terms of memory and CPU power).
These days, most application programming is so abstracted from the underlying hardware that I find it all too boring. That's probably why I spend more time cutting microcontroller code in C I guess.
Re: (Score:2)
Necessary back then as code wasn't very self documenting and often needed to be ported to very different architectures.
Now do VB6 (Score:5, Insightful)
...and watch millions of older programmers drop whatever they were forced to change to and go back to what they were actually productive in.
Re: (Score:3)
You don't understand. If you don't use the latest flashy whizbang IDE-in-a-browser-in-an-editor Electron App, you're not productive enough.
Re: (Score:2)
Even though 'real' programmers trash VB, (Score:3)
I've written a lot of code in Visual Basic that got a lot of work done.
Re: (Score:2)
Open Letter to Hobbyists (Score:4, Insightful)
Isn’t Bill more famous for writing the “Open letter” than a microcomputer BASIC?
Notice how as Bill Gates says, Micro-Soft made so little money they closed down and were never heard from again?
Before Bill Gates was a “philanthropist”, he wrote this:
An Open Letter to Hobbyists
To me, the most critical thing in the hobby market right now is the lack of good software courses, books and software itself. Without good software and an owner who understands programming, a hobby computer is wasted. Will quality software be written for the hobby market?
Almost a year ago, Paul Allen and myself, expecting the hobby market to expand, hired Monte Davidoff and developed Altair BASIC. Though the initial work took only two months, the three of us have spent most of the last year documenting, improving and adding features to BASIC. Now we have 4K, 8K, EXTENDED, ROM and DISK BASIC. The value of the computer time we have used exceeds $40,000.
The feedback we have gotten from the hundreds of people who say they are using BASIC has all been positive. Two surprising things are apparent, however, 1) Most of these "users" never bought BASIC (less than 10% of all Altair owners have bought BASIC), and 2) The amount of royalties we have received from sales to hobbyists makes the time spent on Altair BASIC worth less than $2 an hour.
Why is this? As the majority of hobbyists must be aware, most of you steal your software. Hardware must be paid for, but software is something to share. Who cares if the people who worked on it get paid?
Is this fair? One thing you don't do by stealing software is get back at MITS for some problem you may have had. MITS doesn't make money selling software. The royalty paid to us, the manual, the tape and the overhead make it a break-even operation. One thing you do do is prevent good software from being written. Who can afford to do professional work for nothing? What hobbyist can put 3-man years into programming, finding all bugs, documenting his product and distribute for free? The fact is, no one besides us has invested a lot of money in hobby software. We have written 6800 BASIC, and are writing 8080 APL and 6800 APL, but there is very little incentive to make this software available to hobbyists. Most directly, the thing you do is theft.
What about the guys who re-sell Altair BASIC, aren't they making money on hobby software? Yes, but those who have been reported to us may lose in the end. They are the ones who give hobbyists a bad name, and should be kicked out of any club meeting they show up at.
I would appreciate letters from any one who wants to pay up, or has a suggestion or comment. Just write to me at 1180 Alvarado SE, #114, Albuquerque, New Mexico, 87108. Nothing would please me more than being able to hire ten programmers and deluge the hobby market with good software.
Bill Gates
General Partner, Micro-Soft
Re: (Score:2)
4k and 8k versions! That explains the later comments about not needing more the 640k of memory....eh? :-).
These were the days when one person could understand the whole (non-trivial/commercial) application.
Re: (Score:2)
Re: Open Letter to Hobbyists (Score:1)
Re: (Score:1)
Welp. On the core of the matter he was proven wrong. Yet on the basis of the aggrieved tone, I still rate this a fair to good Evil Scientist motivation letter, and indeed he turned out very successful in that endeavour.
Re: (Score:2)
I do believe that this was posted without paying the royalty. :_)
hawk
What, no GPU acceleration?? (Score:4, Funny)
At least they could have included VGA support. How am I supposed to use my light pen now?
Re: (Score:1)
QB64 [qb64.org] has OpenGL keywords [qb64.org]. I'm not sure if GORILLAS.BAS works in QB64, but a lot of stuff does work if it isn't overly dependent on 16-bit x86 tricks like DEF SEG.
Re: (Score:2)
Wow... I'm impressed by this QB64 project.
Re: (Score:2)
Re: (Score:1)
The original GORILLAS.BAS doesn't work, but they include a version that does: programs/samples/misc/gor64.bas
Re: (Score:1)
How am I supposed to use my light pen now?
Sometimes you need a bigger light pen. Personally, I use a light sabre.
Re: (Score:2)
Reminds me of something from the distant past (Score:3)
Anyway thought I'd share for the other old-timers, who remember when 'personal computers' usually meant something you had to get a soldering iron out to assemble and not just a #2 Phillips screwdriver. Back in the day, it was fun.
Re: (Score:2)
Re: Reminds me of something from the distant past (Score:2)
I used to be fascinated by the one-line basic programs so popular in some of the early TRS-80 and Apple II magazines around 1980.
More than once did I mistakenly hit the backspace key while holding down the shift key, causing the entire line to be erased!
As I recall, a single line could go for 256 characters, and we used character substitution to squeeze ever more code into the line. For example, a question mark had an ASCII code that matched the internal symbol for the print command, so you'd see code like
Re: Reminds me of something from the distant past (Score:2)
Re: Reminds me of something from the distant past (Score:1)
Re: (Score:2)
Re: (Score:3)
I also had a Shugart SA4000 30MB (26MB formatted) 14" HDD, and over time upgraded the full-height 8" single-sided floppy drives to Tandon-made half-h
Early 80s? There was much more diversity than that (Score:4, Informative)
Remove the word "Microsoft" from that and it's even more true. IBM-compatibles didn't overtake Commodore until the mid-80s, and there were tonnes of other PCs out there: Atari, TRS-80, Apple, Amstrad, ...
By the time I first used a computer with Microsoft BASIC on it, I found it hugely limiting because I was used to Blitz BASIC on the Amiga.
Re: (Score:2)
Microsoft wrote Commodore Basic, as well as the "level-II" Basic for TRS-80.
Re: (Score:2)
Commodore licensed MS BASIC for the C=64. Probably the VIC-20, not sure.
Our memory expansion for the 20 never came in so we had to learn assembly instead. Fortune smiled on us, in retrospect.
Re: Early 80s? There was much more diversity than (Score:1)
Comment removed (Score:5, Informative)
Re: (Score:2)
>Atari originally intended to go Microsoft but couldn't fit Microsoft BASIC
>with the features they needed into the ROMs they'd spec'd,
I doubt that (even though wikipedia says so)--atari had a *ridiculous* amount of ROM available in its design, with a rather aggressive bank switching system. At the time, it appeared to be more about royalties.
Maybe the party lines repeated in wikipedia are true, but having been around at the time, I'm skeptical. And given the bank-switching at the time, an 8k cartrid
Re: (Score:2)
Re: (Score:2)
there's soeminghing in the back of my mind wanting to say that the rom cartridge in the 800 (which plugged in next to the memory cartridges) was 26k--but I can't find anything to support that these days.
Given the large amount of ROM they used, though, and that they had bank-switched away the 64k number, the difference between 8k and 9.5k for a dedicated basic interpreter seems like small potatoes.
Re: Early 80s? There was much more diversity than (Score:2)
Atari machines had MS BASIC available as a cartridge and a floppy version. They just couldn't squeeze it in 8K for the machine's release. Atari BASIC was slow but had some advantages in ways.
Re: (Score:2)
A Microsoft BASIC was almost everywhere BASIC could be found. It was in Apples and Commodores, on the Altair, and even the TRS-80.
Microsofts GWBASIC was created for PC clones. IBM machines had BASICA in ROM, which was also a Microsoft BASIC, where GWBASIC was the alternative tot he ROM chips for the clones.
Re: (Score:2)
IBM went with Microsoft because they were willing to sign the NDA and everything. IBM called Digital Research first (seeking to put CP/M on their new PC). Problem was well, Digital Research didn't respond, or rather, IBM got hold of his wife who refused to sign the NDA or get her husband back from the vacation. So IBM got frustrated, and called Microsoft instead who in typical Bill Gat
Re: (Score:2)
another couple of issues:
--the QDOS authors turned out to have access to the CP/M sure code, some of which apparently got used and survived into PC/MS-DOS 1.0.
--the price difference between PC-DOS and CP/M-86 was staggering. While IBM offered both, the price of CP/M was several times higher.
--neither CP/M nor MS-DOS included the incredibly useful IO Byte (0x03), which allowed you to redirect hardware devices.
hawk
Re: Early 80s? There was much more diversity than (Score:2)
IBM went with Microsoft because Gary Kildall decided to not take the meeting with IBM - I understand he instead decided to go out in his plane.
The fact that nearly every US PC at the time used a version of Microsoft BASIC was surely a factor, but the only other off-the-shelf option for an OS didn't bother to even take the meeting.
Of course, MS didn't have an OS, they acquired one to license to IBM.
Re: (Score:1)
Is this the same implementation found on the DEC VK100 aka GIGI, an 8085-based graphics terminal?
Love the "initial commit" timestamp (Score:2)
Re: (Score:2)
Re: Love the "initial commit" timestamp (Score:1)
Re: (Score:3)
READY _ (Score:2)
You could type stuff like
10 PRINT "HELLO"
20 GOTO 10
Now get off my lawn.
Re: (Score:3)
In a lot of ways Javaschit is the new BASIC.
* Web Browsers are ubiquitous which mean everyone has access to Javascript, and
* It has the same shitty design -- reference a variable you haven't used before? No problem! It will just use its undefined value and not stop, or even warn you!
While there is a hack
that enables stricter type checking it has two problems:
a) It isn't on by default, and
b) there is no way to turn off once turned on.
Obsolete but still in use. (Score:4, Interesting)
Output from these programs is to dot matrix line printers (fortunately still easy to get these).
Re: (Score:2)
As I recall, QBasic/QuickBASIC could run GWBasic code without change, but QuickBASIC added structure programming so the only time you had to use GOTO was for error handling.
Re: (Score:2)
It was already possible to largely avoid GOTO by MBASIC5, and even, iirc, 4.
You still had line numbers instead of named routines, but it was straightforward to use a main loop and go subs.
A "typical" program from those of us that learned on earlier versions, in which memory was searched for line numbers, would be a GOTO the main loop (WHILE/WEND that never terminated) placed after common subroutines, then a "GOSUB 50000" for the setup that would only be used once, and then executing the loop.
It appears that
VB for DOS (Score:2)
Re: (Score:2)
Re: (Score:2)
I used Binkleyterm and
Now, go back to 1981 and make a fortune (Score:3)
I've looked through a number of the source files and they're quite interesting - although I would like to see them *before* they were "translated". The files seem to be nicely formatted for consistency and easier reading (ie everything in set columns and minimal whitespace). Any other .asm file I've seen from that era has formatting specific to the author which makes reading through them a unique and often very difficult experience.
There doesn't seem to be any make information which would be interesting in terms of how the programs were loaded onto disk, PROMs or tape (I believe taped versions of GW-BASIC were available for non-IBM systems which did not have disk drives).
Releasing this source means that Microsoft is taking a huge risk; as soon as I get my time machine working, I'm going back and owning Bill Gates' ass.
Re: (Score:3)
I lived through the early '80s (Score:2)
Great times and lots of fiddly computers.
Re: Now, go back to 1981 and make a fortune (Score:2)
While the Altair famously had Microsoft BASIC on paper tape
Cassette tapes weren't really an option yet - paper tape and teletypes with paper tape readers and punches were.
Re: (Score:1)
Give a call to Gary Kildall. Tell him his wife is going to get a phone call and to tell IBM that you can get right back to them whenever they call... You'll be right up there.
Man, the world would be so much better off now.
I'm confused (Score:2)
Looking at the repository there is an MIT license file that has a commit of 09ad7bc on Feb 10, 1983.
But according to wikipedia the MIT license was first published in 1988.
So Bill and Ted's Excellent Adventure was actually a pseudo documentary based on Bill and Paul?
Re: (Score:2)
Looking at the repository there is an MIT license file that has a commit of 09ad7bc on Feb 10, 1983.
Does it mean if you paid for GW-BASIC after Feb 10, 1983 you should seek a refund from Micro-Soft? With interest that could be a nice amount.
Copyright year is not the license year (Score:1)
You are free to offer multiple licenses for a copyrighted work you own. Caveat emptor if you chose to pay full price instead of waiting 30+ years for this new license.
Microsoft should open more stuff (Score:3)
microsoft is so stuck on on Win10 that the older stuff is irrelevant, except for hobbiests and tinkerers,
is win10 going to be a forever windows version? or is microsoft working on a Windows 11, as it stands i dont like windows anymore because i was annoyed by it enough to switch exclusively to Linux for so long that i am more comfortable using Linux than i am using windows, and it will have to take one hell of a good windows version to win me back
Re: (Score:2)
You can get the sourcecode for those OS's, but its not quite open source - my understanding is there are a lot of legal hurdles to overcome in a lot of these OS's because there is so much licensed code (from 3rd parties like Adobe, IBM etc) inside the product. I'm sure it will happen someday though.
Re: (Score:2)
They're probably not old enough to be open sourced? Or newer Windows still use those legacy codes? :O
Re: (Score:2)
Re: (Score:2)
If you're so great, why not write a better Windows 7 from scratch? Maybe show up those ReactOS guys.
Anyone remember a 3D rolling ball demo? (Score:2)
I seem to recall a version of GW-BASIC for the Compaq (?) PC that used page flipping on a 640x200 (?) monochrome graphics screen. It drew a 3D wireframe of a ball and a fake 3D terrain [ftcdn.net] then looped through 4 page flips giving the illusion of that the ball was rolling.
ORIGINALLY WRITTEN ON THE PDP-10... (Score:5, Insightful)
..which they stole the time used from Harvard which they both dropped out from ...
Re: (Score:2)
Will they leave in the Harvard copyright notices?
Re: (Score:2)
Re: (Score:1)
How about that? I think Bill did well as a college dropout.
gwbasic (Score:2)
wow, that was my first programming language
Bill's bug fix. Wait for the next version (Score:1)
I have a entry in one of my old lab notebooks from 1978 that reads, "Talked to Bill at Microsoft about the bug we found. He says it will be fixed in the next version." I was still working on my Masters thesis and using my advisor's S100 NorthStar Horizon w/10 Mb removable disk pack and the original Microsoft Basic for CP/M. Don't remember if the bug ever got fixed or not. We were using his Horizon that summer because the new Honeywell Multics machine at the University was still being installed.
Now we won't
Memories, Memories (Score:2)
Man, doesn't this bring back some interesting memories! All the .ASM code I hacked (back when that was a good word), .COM and .EXE files I disassembled and tweaked or debugged, or at least learned a lot from. All the source code that was floating around, just for us to learn from. Anyone else remember porting XMODEM.ASM (or C or .PAS) to the different PCs and modems of the time? (Thanks again, Christensen!) And then watching in amazement as Forsberg took it a step farther (beyond YMODEM even) and came
Re: (Score:2)
ZMODEM could accurately adjust to predict download times. When will Microsoft implement something similar?