9 ms·
Microsoft GW-Basic Interpreter Source Code
- krylon 5y agoLike so many, I gathered my first experiences with programming in Basic (or is it BASIC?). My first computer was a Commodore 128, and my mother sent to a week-long programming course that for some reason the local Sparkasse (quasi-public bank in Germany) held over the Easter holidays 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.
- daveroberts 5y agoI suspect they'll get zero PRs: "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."
- krylon 5y agoAh, yes, I should have read the README. ;-)
- unwind 5y agoIt is supposed to be "BASIC", from Beginner's All-purpose Symbolic Instruction Code no less [1]. [1]: https://en.wikipedia.org/wiki/BASIC https://en.wikipedia.org/wiki/BASIC
- krylon 5y agoI knew that it used to stand for that (and as an acronym should be upper-case), but I thought they maybe dropped that somewhere along the way. 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. (-:
- bobochan 5y agoDartmouth celebrated the 50th anniversary of BASIC a few years ago and they were pretty consistent in keeping it all upper case. https://www.dartmouth.edu/basicfifty/basic.html https://www.dartmouth.edu/basicfifty/basic.html True BASIC, a company that Kemeny and Kurtz founded in 1983, is all upper case too. https://www.truebasic.com/about https://www.truebasic.com/about
- krylon 5y agoWell, Happy Birthday BASIC! Love it or hate it, BASIC has left a footprint in the IT world that few languages could match.
- dragonwriter 5y ago> 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 COBOL is still “COBOL” (at least per the IBM page on the language and the ISO/IEC 1989:2014 standard for the language.
- krylon 5y agoMy bad then. Thank you for pointing that out.
- gpvos 5y ago(From the linked announcement blog:) > (Alas, sorry, we’re unable to open-source the ISA translator.) Awww...
- skissane 5y agoI wonder why. Uses third-party code? Some contractor/consultant/etc wrote it and they can't find the contract so they don't know what it says about copyrights? Lost it completely?
- krylon 5y agoLikely something like that. My money is on them being unable to locate someone who needs to give permission, and it's probably not a very high priority issue. 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.
- GekkePrutser 5y agoAnd then Oracle went and undid almost all that work :'(
- krylon 5y agoTo make it even worse, they laid off most of their Solaris developers a couple years ago. 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.
- pdw 5y agoMichal Necasek has some notes on this code on his blog: https://www.os2museum.com/wp/gw-basic-source-notes/ https://www.os2museum.com/wp/gw-basic-source-notes/
- notacoward 5y agoAll of the "comments are useless because they get out of date" folks should look at this code, which is still comprehensible 40 years later because of the comments.
- gpvos 5y agoWell, they get out of date because the code around it changes. If the code doesn't change either... I do agree with you though that commenting is a good thing.
- kwertyoowiyop 5y agoUpdating comments as needed is just something I consider part of being a professional programmer.
- JohnBooty 5y agoThis is why I've always been an advocate of inline code comments. 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...)
- TedDoesntTalk 5y agoI can’t count the number of PRs I’ve rejected because code was changed but the corresponding inline comments were not.
- kwertyoowiyop 5y agoThank you for being part of the professional 50%!
- ejb999 5y agoI couldn't agree more - and think it is asinine to tell developers to not comment code; most of the comments I write, are for me as much as for the next person who works on it. I find them invaluable. 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.
- IncRnd 5y agoThere are forked versions which have been made somewhat to work. [1] [2] The original version (the linked article) won't work as-is, since there are no build scripts, instructions, or executables. [1] https://github.com/dspinellis/GW-BASIC https://github.com/dspinellis/GW-BASIC [2] https://github.com/tkchia/GW-BASIC https://github.com/tkchia/GW-BASIC
- jafoi 5y ago>Will not be modified - please do not submit PR's or request changes Why doesn't github still allow users to deactivate the "pull requests" tab?
- DeWilde 5y agoSeems to me like better UX as the users are being informed why they can't make pull requests. Of course this could be done differently but I don't have an issue with it.
- deleted 5y ago[deleted]
- mseepgood 5y agoWhy does GitHub say 40 years ago when 1983 is 39 years ago?
- potamic 5y agoWow! They added a markdown formatted code of conduct 40 years ago!!
- colejohnson66 5y agoThey even reference "Windows Store app package directories and files"[0]. Very futurist thinking! [0]: https://github.com/microsoft/GW-BASIC/blob/edf82c2ebf6bfe099c2054e0ae125c3efe5769c4/.gitignore#L207 https://github.com/microsoft/GW-BASIC/blob/edf82c2ebf6bfe099...
- banana_giraffe 5y agoBecause the relative date function that powers that label rounds to the nearest year (it also treats 360 days as a year): 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_modules/@github/time-elements/dist/index.js https://github.githubassets.com/assets/javascript/node_modul...
- gwbas1c 5y agoFor awhile googling for GWBasic would find my homepage. (I used to have a video call widget and my username was "GWBasic.") 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"
- jandrese 5y agoDid the manual have the incredibly easy "decryption" process? https://groups.google.com/g/comp.os.msdos.misc/c/PA9sve0eKAk https://groups.google.com/g/comp.os.msdos.misc/c/PA9sve0eKAk
- gwbas1c 5y agoNo. At the time I got the email my GWBasic manual was 3000 miles away. 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.
- jblazevic 5y ago--------- ---- -- ---- ----- --- ---- ----- 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.
- quietbritishjim 5y agoAccording to Paul Allen's book [1] about his time at Microsoft (admittedly a biased source), his particularly critical contribution was an 8088 emulator/simulator for the PDP-10. That allowed them to write and even interactively debug (if I remember right) BASIC for the 8088 on the PDP. It would've been hopeless to develop directly on a microcomputer, so they would've had to have written on the minicomputer, transferred the binary across and see if it worked, and iterate like that. 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-Microsoft/dp/0241953715 https://www.amazon.co.uk/Idea-Man-Memoir-Co-founder-Microsof...
- PaulHoule 5y agoUsing a minicomputer as a dev environment for micros was particularly popular in the late 1970s and early 1980s. See Infocom https://www.filfre.net/2013/03/the-top-of-its-game/ 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 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.
- andrewinardeer 5y agoA 13 year old me brought down the entire showcase of Kmart's PCs with this program back in the 80's. Good times.
- eggy 5y agoI'd love to hear how. Did you go computer to computer, since LAN in the early 80s was not really a common thing except for big businesses. Was this late 80s? I was a Banyan Vines guy vs. Netware by then.
- andrewinardeer 5y agoDeployed the program via floppy. Edited the autoexec.bat to load the program straight away and interrupted any keyboard input such as Ctrl-C. Program layed dormant until the system clock reached a certain time then back to dos to format c:
- julian_sark 5y agoI must admit we did a similar thing without BASIC. 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 :)
- pauldavis 5y agoDoes everybody know the duality of "Gee Whiz BASIC" and "Gordon Whitten BASIC"?
- Wistar 5y agoGreg Whitten. I don't know the answer.
- pauldavis 5y agoWhoops, yeah.
- IncRnd 5y agoYes. And, there are other possible expansions, e.g. Gates William. 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.
- pauldavis 5y agoPretty sure it is Mark Zbikowski.
- colejohnson66 5y agoTo be fair, he did design the file format
- IncRnd 5y agoI believe that, too. However, for something like a zip file, I KNOW that the PK in the header stands for Phil Katz.
- hypertoast 5y agoOh - The nostalgia - the memories... 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...
- api 5y agoThe numeric scanning sub is called NUMNUM. Love it.
- julian_sark 5y agoAh. GW Basic. Memories. 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.
- Emigre_ 5y agoOooh Alley Cat! That game was so good!…
- gekkonier 5y agoI never got what what to do in that room with the sleeping dogs :D Failed hard! Good times.
- rzzzt 5y agoDrink the milk! 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 https://archive.org/details/msdos_Alley_Cat_1984
- incanus77 5y agoThere’s a fun GW-BASIC emulator written in Python that even has cassette tape audio file read access: http://pc-basic.org http://pc-basic.org
- fulafel 5y agoThere are machine translator sounding comments and references to nonexistent source .mac files - is the real source code lost?
- localhost 5y agoGreg Whitten still lives in the area and brings one of his Ferraris to the Microsoft charity car show every year (last time it was a LaFerrari!). I hope that happens again this year.
- __michaelg 5y agoI love how they went through all the internal hoops to make this public and consequently put the SECURITY.md in there. Just in case someone finds a vulnerability in GW-Basic after all these years...
- ChrisArchitect 5y agoAh, memories. Also, love that the commits are set to '40 years ago'.
- pvg 5y agoBig thread from when it was released in 2020: https://news.ycombinator.com/item?id=23266917 https://news.ycombinator.com/item?id=23266917
- codewiz 5y agoThe GW-BASIC source code was published 2 years ago: https://devblogs.microsoft.com/commandline/microsoft-open-sources-gw-basic/ https://devblogs.microsoft.com/commandline/microsoft-open-so...
- dang 5y agoThanks! Discussed at the time: The original source code of Microsoft GW-BASIC from 1983 - https://news.ycombinator.com/item?id=23266917 https://news.ycombinator.com/item?id=23266917 - May 2020 (266 comments) Related: GW-Basic Source Notes - https://news.ycombinator.com/item?id=23619590 https://news.ycombinator.com/item?id=23619590 - June 2020 (17 comments) Converting GW-BASIC to the Z80 - https://news.ycombinator.com/item?id=23605821 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 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 https://news.ycombinator.com/item?id=506466 - March 2009 (31 comments)
- oso2k 5y agoFor those interested in building this repo, TKChia has a repo with changes for building the repo with MASM 5.1A or JWASM. https://github.com/tkchia/GW-BASIC https://github.com/tkchia/GW-BASIC
- anticensor 5y agoStill looking forward to https://github.com/Microsoft/Windows https://github.com/Microsoft/Windows .
- amelius 5y agoI wonder how much more diversity in programming languages we would have had if BASIC wasn't pre-installed on home computers.
- ncmncm 5y agoI remember being shocked to find that every GOTO (and even a NEXT) would do a linear search for the right line number starting from the beginning of the program image. 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.
- arantius 5y agoOptimizing for time and optimizing for memory are different things. Choosing one over the other doesn't guarantee the author "did not care about performance".
- ncmncm 5y agoNothing guarantees anything. But the extra stuff needed to compensate for being extremely slow can often cost more than the cost not to be extremely slow.