Microsoft GW-Basic Interpreter Source Code
github.com
github.com
The original source code of Microsoft GW-BASIC from 1983 - https://news.ycombinator.com/item?id=23266917 - May 2020 (266 comments)
Related:
GW-Basic Source Notes - https://news.ycombinator.com/item?id=23619590 - June 2020 (17 comments)
Converting GW-BASIC to the Z80 - https://news.ycombinator.com/item?id=23605821 - June 2020 (4 comments)
Help assemble the released GW-BASIC source code - https://news.ycombinator.com/item?id=23275225 - May 2020 (1 comment)
GW-Basic creator Greg Whitten on Joel Spolsky and other MS things - https://news.ycombinator.com/item?id=506466 - March 2009 (31 comments)
On the very first day our household had a PC, they called "the guy". "The guy" was supposedly a PC guru, and he explained to me how to load a program in GW basic. And he put GW Basic in my autoexec.bat so it would launch automatically.
On day #2, I had gotten hold of some games on the school yard and naturally attempted to load them in GW basic: "LOAD a:\alleycat.exe". It didn't work well.
But I quickly saw the errors of my ways, and was soon whipping up really cool programs in GW Basic, and playing IBM Alley Cat in black, white, cyan and magenta.
Good times. Sometimes I think IT as a whole went down hill from there.
Good times.
Unfortunately the action key is Alt which does not play along well with browsers (they want to show the menu instead): https://archive.org/details/msdos_Alley_Cat_1984
--------- ---- -- ---- ----- --- ---- -----
COPYRIGHT 1975 BY BILL GATES AND PAUL ALLEN
--------- ---- -- ---- ----- --- ---- -----
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.That contribution wouldn't show up directly in the BASIC source code, since the emulator wasn't part of BASIC itself.
[1] https://www.amazon.co.uk/Idea-Man-Memoir-Co-founder-Microsof...
There's an even more extraordinary story about them travelling to demonstrate their implementation of BASIC to the MITS team.
They realise they have not written a bootloader for the Altair, and Allen writes out a bootloader on the plane, which works when they get to MITS.
https://en.wikipedia.org/wiki/Altair_BASIC#Origin_and_develo...
My first encounter with a real Microsoft BASIC wasn't for another 15 years; the interpreter-only QBASIC that came with Halvorson & Rygmyr's Learn BASIC Now, which was a great book I gave away and now feel the urge to repurchase for nostalgia's sake. I used it for my GCSE Computer Science project.
What was extraordinary is Allen realizing he could do this as a shortcut.
https://altairclone.com/downloads/manuals/8080%20Programmers...
As a pragmatic manner, I don't regard having the register and/or addressing mode encoded into the opcode as a separate opcode.
Emulating a modern 64 bit processor would be a major chunk of work, but the old 8 bit ones are simple.
I can't actually remember it in detail now, but this was when I was 15 or 16. It was a database application; I guess mine would have been music lending.
I wonder if I still have the code. I definitely still wish I had the book.
I really enjoyed QBASIC because of the gentle way you were exposed to better programming practices; I've always admired that.
Five or six years later, my uni project was a BASIC-to-C transpiler for a simple dialect of BASIC as a teaching language with some specific language extensions for message-passing parallel programming. It had a simple IDE, too.
In some ways it is a shame BASIC itself is really gone; modern implementations only have a whisper of its original simplicity.
It isn't the same thing though.
In the UK I gather kids are taught Scratch and Python in an overlapping fashion, so they see the structure on the Scratch view and then have a better chance of understanding how the code works without being thrown off by the symbols.
This is probably better in a pedagogical sense, and I am sure Scratch programmers have a better early understanding of flow control and things like loop termination conditions than BASIC programmers did; Scratch makes it more physical.
But it does lose that absolute immediacy of being able to type simple words onto an empty screen and see it do things.
https://www.filfre.net/2013/03/the-top-of-its-game/
which used virtual machine technology to deliver games developed on a Decsystem 20 to many different kinds of Micro.
When Microsoft BASIC came out in 1976 it was rare for a micro to fill out the 16-bit address space with a full 64k. I had a TRS-80 Color Computer which ran a multitasking operating system
https://en.wikipedia.org/wiki/OS-9
With 64k of RAM I wrote a FORTH interpreter that ran under OS-9 with a good standard library in about 3000 lines of assembly. OS-9 looked a lot like UNIX or VMS. Dev tools in 1984 were good enough that writing a BASIC interpreter on a micro in assembly would have been straightforward, I'm sure you could on a C-64.
No way you could do that on the base configuration Altair that Microsoft BASIC originally targeted.
The first time I used emulation was circa 1987 when I developed a BASIC program for a high school teacher who had a Z-80 based CP/M system on my generic 286 machine... Even then there was a CP/M emulator for the 286 which could destroy any Z-80 machine on the market -- even though the protected mode of the 286 was as "brain damaged" as Bill Gates said it was, the raw performance of the 286 was the beginning of the end for the 6502, 68--, 68---, Z80 and all the other architectures.
I have no idea what the people ("Micro Video") producing software for this thing did, but I can't imagine they used this on-machine assembler.
(The tape loading mechanism was basically blocks of address + data. They put loading screens on the tapes by populating video memory first.)
[1] https://obsolescence.wixsite.com/obsolescence/pidp-11 [2] https://github.com/simh/simh
Today you could spend as much time getting the build to work with npm or maven for something very simple.
Macro assemblers are nowhere near as much fun on the x86 (and other 80's era micros) as they are on something like the IBM 360 or AVR8 with a big register file... If you've got 32 registers you can write macros where the register names are parameters and avoid a lot of the meaningless activity involved in "calling conventions" in programming languages like C.
It was unusual in quite a few ways. For one thing it was subroutine threaded which made it a little faster than most FORTHs, also it used self-modifying code in an inner loop to save a cycle in an important place.
Most FORTHs at the time used block-based disk I/O because you could do that without a real operating system and have some nice benefits such being able to copy a block of source code to the screen buffer to edit in place, easy memory allocation, etc.
OS-9 had a handle-based API for filesystem access basically the same as UNIX and MS-DOS 2.0 so my FORTH used that. OS-9 had a choice of text editors, including a vi clone so I didn't feel the need to embed an editor in the interpreter.
It was a skill pretty much everyone knew.
Someone once emailed me looking for support for GWBasic. They apparently got ahold of an old GWBasic program that was saved in an encrypted manner. It was run-only but they couldn't list out the source code.
I just dug out my old GWBasic manual. The command was "Save P"
https://groups.google.com/g/comp.os.msdos.misc/c/PA9sve0eKAk
But it was one of those cases of someone not having good internet etiquette. There was no reference to "GW-Basic" on my home page, other than metadata in the HTML. I should have responded with a link to let me google that for you.
I do agree with you though that commenting is a good thing.
Recent contract at a big Fortune50 company, and they forbid developers from using comments - "any code that you think needs some explanation should be put in a separate readme file in a 'docs' directory off of the root" - how can that be better, or more useful, than a couple of lines of comments right above the code in question?
They didn't want us to use comments, because they were afraid the code would change, and the comments would become out of date - so put those comments in a separate file, that almost nobody will remember to read, much less update, and that would solve the problem.
You can't make this stuff up, utter insanity.
With just the slightest amount of professionalism, you can keep them up to date, and only a real psychopath would update code without updating the comments directly above it.
(So, of course, 50% of programmers don't...)
This is likely no different than the MZ in the DOS exe header. Nobody actually knows (and says!) what MZ stands for, but it is believed to be Mark Zbikowski.
Awww...
I vaguely recall reading a blog post when Sun opened the Solaris source code, that it was a tremendous effort tracking down every single person they needed permission from.
Somebody who used to work on Solaris before the Oracle takeover commented at the time that just by looking at the number of layoffs, Oracle Solaris was effectively dead.
I am not even a big Solaris fan (although it was the most beautifully named OS ever), but I cannot help but think of Rutger Hauer's dying speech from Blade Runner: I have seen things you people would not believe [...] All these moments will be lost in time like tears in the rain.
If somebody who has been there would write a book about the development of SunOS and Solaris, I would probably buy two copies. If the title included the word Eclipse, I'd buy three copies.
The local super groceries-and-more store had a bank of demo PCs running DOS, Geoworks or early Windows, and a screen saver. We used to type "format c: /autotest", the later being an undocumented MS-DOS parameter that skipped the "are you sure?" question, and left it standing on screen like that.
The sales personnel would occasionally terminate the screen saver by pressing "enter". Hilarity ensued (for us! Not for the poor sales person trying to give a demo to a customer) :)
As for programs and the clock, my school (which had HORRIBLE IT courses at the time) had caught a virus (not from me, just like that!).
I removed it for them (using F-PROT and McAfee for DOS back in the days), but they didn't trust that and called an "expert" business (the local typewriter guy), who ran exactly the same virus scanners, and changed them dearly. But they didn't trust him either (ahoy computer virus craze!), so they made me reinstall nine school machines, with Windows 3.1, Word 6, Excel 5, Access 2.0, from floppy disks, because I was apparently the only one capable of installing Windows.
I was so angry about the fact they didn't even properly thank me, I made a Turbo Pascal program that would also check the system clock, and do interesting things. I couldn't get a TSR working properly at the time, so I ended with an exe in the search path called " .exe" (the blank being ascii 255, not ascii 20, which wasn't allowed), and autoexec.bat would have loads of empty lines at the end, and then finally, the call to the program named with "ascii 255", which was invisible in the editor even if someone scrolled all the way down and was looking right at that particular line.
The program was reportedly still there many years thereafter. Figures :)
Another fun one (later in the Windows '95 era) was to create a shortcut to every program on the computer in the startup folder. Then copy / paste it about a dozen times and reboot.
And here we used PCs running DOS, so I almost certainly did my first baby steps programming using GW-BASIC. Little did I know the Basic on my C128 had also been written by Microsoft. Ah, to be that young again...
I expect Microsoft is not going to get many PRs, but it's a nice gesture. One day, some digital archeologist is going to have fun (or curse like a sailor) inspecting this code.
Fortran and Cobol used to be "FORTRAN" and "COBOL", too, but once systems with support for upper- and lowercase-letters became widespread, they went mixed-case.
I recall there was some debate if the name BASIC had been intended as an acronym initially, but in time, evidence (AFAIR, anyway) tended to support the claim is was an acronym from the very beginning. (-:
https://www.dartmouth.edu/basicfifty/basic.html
True BASIC, a company that Kemeny and Kurtz founded in 1983, is all upper case too.
Love it or hate it, BASIC has left a footprint in the IT world that few languages could match.
COBOL is still “COBOL” (at least per the IBM page on the language and the ISO/IEC 1989:2014 standard for the language.
"The files in this repo are for historical reference only and will remain read-only and unmodified in their original state.
Please do not send Pull Requests suggesting any modifications to the source files."
timeAgoFromMs(ms) {
const sec = Math.round(ms / 1000);
const min = Math.round(sec / 60);
const hr = Math.round(min / 60);
const day = Math.round(hr / 24);
const month = Math.round(day / 30);
const year = Math.round(month / 12);
From https://github.githubassets.com/assets/javascript/node_modul...[0]: https://github.com/microsoft/GW-BASIC/blob/edf82c2ebf6bfe099...
They really, actively did not care about performance. Manifestly, it was the right choice for the time, place, and circumstances, but it is hard to see how, today.
My first foray into programming. I remember skipping breaks to go to our computer room (super chilled due to Air conditioning) and popping in a 5.1/4 inch floppy diskette and loading this...
Also, love that the commits are set to '40 years ago'.
Why doesn't github still allow users to deactivate the "pull requests" tab?