21 ms·
The original source code of Microsoft GW-BASIC from 1983
- LyalinDotCom 6y agoFor more information on why this happened check out Richard's blog post: https://devblogs.microsoft.com/commandline/microsoft-open-sources-gw-basic/ https://devblogs.microsoft.com/commandline/microsoft-open-so...
- skissane 6y ago> (Alas, sorry, we’re unable to open-source the ISA translator.) > Alas, we’re unable to provide sources for these ports and/or customizations. I wonder why. (I guess it might involve code licensed from third parties, co-developed and jointly owned with OEM vendors, or unclear provenance of IP.) I wonder if it will ever change. I hope one day it does. One of these days (probably long after I'm dead) the copyright will expire. I hope the source code hasn't been lost by then. (Sadly, there's a decent chance it will have been.)
- WalterBright 6y agoMuch of the source code from those days is simply lost.
- dang 6y agoOK, we've changed to that from https://github.com/microsoft/GW-BASIC https://github.com/microsoft/GW-BASIC. Thanks!
- tobinfricke 6y agoWow, what a blast from the past. I learned to program with BASICA.EXE and GW-BASIC as a kid in the late 80's. I just noticed that microsoft has also released the source to MS-DOS 2.0: https://github.com/microsoft/MS-DOS https://github.com/microsoft/MS-DOS I don't think I ever imagined that I'd be able to "look behind the curtain" like this, let alone that Microsoft would come to embrace open source. From there I moved on to Turbo Pascal 3.0, and then Borland Pascal 7.0 (which I loved - super fast compiler and superb IDE - many examples and comprehensive documentation - which were a must in the pre-Internet era), then Borland C. And then Linux and gcc for the following two decades.
- bitcrazed 6y agoYou and I both - first time I ever touched an IBM PC XT (in my Dad's office), I immediately fired up BASIC and went to town (had already been programming BASIC for 18 months by that time). It was the first time I ever saw him just stare in awe at me like I was an alien's child! :)
- HenryBemis 6y agoAnd me! (and a few hundred/thousand people in this great forum)!! Oh I still remember that Amstrad PC1512!!! What a carefree age that was...
- arbuge 6y agoI learned Locomotive Basic on a CPC464, then moved up to a PCW8256 before transitioning to a PC1512. Those were the days :)
- mrlonglong 6y agoI learned to core in C on a PC1512, using Walter Bright's rather nice Zortech C compiler. TP3 was indeed the dog's bollocks back then, too.
- jmspring 6y agoI recall GW-Basic as well. I ended up with a bunch of random software from my dad at the time. One of the included items was a basic compiler. Showed me how much faster compiled code could be. I then went on to use the various Borland products.
- ArtWomb 6y agoAm actually totally digging JS DOS, the emscripten build of the DOSBox emulator. The performance is phenomenal in the browser, including vsync. Here is an example (CPU intensive) of multiple 64k demos running simultaneously on a single web page ;) https://js-dos.com/6.22/64k/index.html https://js-dos.com/6.22/64k/index.html
- duskwuff 6y agoOh, interesting. I wonder what implications this will have for the MS Basic disassembly project: https://github.com/mist64/msbasic https://github.com/mist64/msbasic
- ksaj 6y agoWhile it might initially feel like a downer, it would still be quite educational on its own to go through the code comparing what they came up with in the disassembly in light of the real deal being now published. There would probably be a few "Ah Hah!" moments for code that stumped them, and lessons to be learned on any particular errors they made.
- deleted 6y ago[deleted]
- skissane 6y agoThey are different. That project is disassembling Microsoft BASIC for 6502. What Microsoft has just open sourced is their BASIC for 8086. Two separate codebases, although they have some commonalities. (As the MS blog post mentions, they kept master source in some kind of abstract assembly which could then be automatically translated into specific machine's assembly language, but then I believe there were manual additions to the assembly code after translation.)
- andrewf 6y agoI wonder if the master source was that abstract, the original Microsoft BASIC was for the 8080, and there were several 8080 -> 8086 source translators. TRANS.COM shipped with 86-DOS before it became Microsoft MS-DOS. https://tech-insider.org/personal-computers/research/acrobat/8206-b.pdf https://tech-insider.org/personal-computers/research/acrobat...
- CamperBob2 6y agoHuh. There's a very well-commented disassembly of Applesoft BASIC in existence already that shipped with the MERLIN assembler. I assume those guys already have that one.
- bexsella 6y agoThis is great! But it makes me think that Microsoft need to add a BASIC compiler as standard in all Windows distributions. They did that Small Basic thing a while back, but it was too encumbered in .NET-isms, a kind of Visual Basic .NET lite. It would be great if there was just a easy to understand BASIC that you could hack away with that could produce interesting programs without the .NET cruft or the barrier that is dealing with Windows APIs.
- tobinfricke 6y agoIt's too bad Microsoft QuickBASIC isn't a thing anymore. Who didn't love GORILLAS.BAS?
- 4cao 6y agoIt's really enjoyable to look at the source. These days one I feel it's quite rare to see assembly code not as an output from a tool like IDA Pro. If I remember correctly, the size of a compiled GWBASIC.EXE file was about 80 kB. What feels weird though is seeing all the files on GitHub last modified "38 years ago," which by the way, also includes the file CODE_OF_CONDUCT.md.
- bitcrazed 6y agoYou think there weren't codes of conduct back in 1983? ;)
- 4cao 6y agoMarkdown itself is from 2004 but the .md extension/suffix wasn't used for it until sometime later (not really sure where it appeared first).
- tjalfi 6y agoMDCD[0], an open source DOS archiver, used the .MD extension in 1988. [0] https://www.sac.sk/download/pack/mdcd10.zip https://www.sac.sk/download/pack/mdcd10.zip
- recursive 6y agoAll those years, people thought MS was hostile to open source, but their commitment was right there all along, in the GW-Basic code of conduct, with a link to their website too!
- flukus 6y agoI'm not familiar with modula but this doesn't appear to be a valid program ;) I think it wasn't until Vim 8 that the default for .md files became markdown.
- 4cao 6y ago.md is mentioned as an extension in the text/markdown RFC from March 2016: https://tools.ietf.org/html/rfc7763 https://tools.ietf.org/html/rfc7763 (Vim 8 was released in September of the same year.)
- rietta 6y agoThat's awesome. I actually have GW Basic from my first computer available. Copied from the old 5.25 inch floppy to a 3.5 inch floppy via a 486 and then to a USB hard drive about 20 years ago into a folder i called "Diskette Collection".
- the_af 6y agoI lost a lot of valuable stuff, including my own first programs I wrote as a kid, to aging diskettes and bit rot. And then threw the diskettes away. I wish I had had your foresight...
- zozbot234 6y agoGreat news, and hopefully this will be pulled into the FreeDOS devtools distribution ASAP.
- wegs 6y agoAwesome! I'd love QBasic from a few years later. I'd also love a nice, easy-to-run Ubuntu .deb for either.
- Koshkin 6y agoNot a .deb, but still pretty damn easy to install: https://github.com/QB64Team/qb64/releases/download/v1.4/qb64_1.4_lnx.tar.gz https://github.com/QB64Team/qb64/releases/download/v1.4/qb64...
- rzzzt 6y agoQB64 is pretty cool, they got the IDE experience right: https://www.qb64.org/portal/#about https://www.qb64.org/portal/#about In their implementation, BASIC code is transpiled to C++ first, then compiled and executed.
- RcouF1uZ4gsC 6y agoFrom a comment in the source > ORIGINALLY WRITTEN ON THE PDP-10 FROM FEBRUARY 9 TO APRIL 9 1975 Wow! I did not realize that it was written so quickly. Two months that literally changed the PC landscape forever.
- copperx 6y agoIt's funny how stuff that got put together quickly like GW-BASIC and JavaScript got so much success because of luck and popular appeal. It's like music. The best music has never been in the top of the charts. The best movies have never won Oscars. This is pop computing.
- tomcam 6y agoWell, some of us think that acts like Kanye, Jay-Z, Amy Weinstein, the Beatles, and Led Zeppelin were pretty great even though they had the crassness and audacity to make it to the top of the charts
- unnouinceput 6y agoPlease don't mix Kanye and Jay-Z with Beatles and Led Zeppelin, they are in different leagues.
- BoiledCabbage 6y agoSounds like you don't know music.
- smacktoward 6y agoIt wasn’t luck or popular appeal, it was like they say in real estate: “location, location, location.” JavaScript came bundled with every Web browser, and GW-BASIC came bundled with every IBM PC clone. A language that everybody in the world already has a copy of is going to get a lot of use, whether it’s good or not.
- 6y ago
- dboreham 6y agoHmm: " (Alas, sorry, we’re unable to open-source the ISA translator.)" For...legal reasons? Or because they lost it?
- pknerd 6y agoGWBasic was good resource to get into programming world during my teenage. Now I want to teach coding to my 10 years old son. Will you still recommend GWBASIC/Quick basic or Python or other languages for kids?
- HenryBemis 6y agoI don't know Python, but I saw online (amazon and the likes) that there are plenty of books on Python for kids (search for that and many similar titles will come up). I was thinking of Python because it's a language that is useful to learn and make it more fun by learnyht it together.
- adzm 6y agoJavaScript since they can make web pages that do things in browsers they are familiar with, which is a huge motivation. Lua so they can mess with Roblox scripting. Then C# mostly for the dev environment And strong types, and Python for the expressiveness. In my humble opinion and experience at least. It's almost always most important to start with something that will augment what they are already interested in.
- pknerd 6y agoI personally don't like JS, how can I teach him? Plus working on JS involves many things for a beginner, you know HTML, you know a bit CSS too.
- axus 6y agoThese days you might use Roblox Studio.
- the_af 6y agoPython is probably a better intro language than GW-BASIC ever was. I say this with all the reverence and fondness I still have for the latter.
- analog31 6y agoI learned BASIC as a kid (first on a mainframe terminal with line numbers), and use Python today. I think the language is not as important as other issues: 1. Computers are so much more advanced now, that the obvious gap between beginner and commercial software is vast. This can be discouraging. When I learned BASIC, I could write programs that didn't look any more crappy than typical commercial software, even if there was a performance gap. 2. There's more magic involved today, meaning that when you run into an obstacle, you wave a wand and a library or stackoverflow post magically appears. To do something in the old BASIC, you had to figure out a way to compose it out of the 13 keywords that you had already learned. So you were forced to think about algorithms, right off the bat. 3. You were closer to the hardware, which was more exciting if you were interested in things. I could kinda explain what the computer was actually doing. I loved math as a kid, but I also loved electronics. The day that I programmed a thing to do something (maybe just a blinking LED) was like the rapture for me. What's closest to the old experience for me is not a language, but a thing: A microcontroller board. Out of the box, it has no GUI, so no expectations for what "cool" software looks like. And you can make it do things that have an immediate sensory effect. You can now put CircuitPython on a Teensy 4.0 board, and sidestep having to learn C, at least for a while. And your son can really own the thing that he's programming. As a minor suggestion, you can also get closer to the computer and to programming by making more use of the command terminal when showing your son how to do things. A final word, don't be heartbroken if it doesn't click. It might not. This is also something parents are told when their kids start music lessons.
- kerng 6y agoVisual Basic 6 next please! :)
- xellisx 6y agoI did VB 3 when I was like 13. I think it makes more sense to me after doing JS for so damned long now.
- jg42 6y agoInitial commit was 38 years ago. Heh.
- the_af 6y agoLike others here, I see, I learned to program with GW-BASIC. Well, actually it was with the clunky BASIC from my beloved C64, but I wrote my first actual programs that did something with GW-BASIC, running on a trusty PC XT clone. I also remember it had a graphics mode -- Hercules card, ambar monochrome monitor -- which sort of resembled Logo's turtle. You gave directions to a sort of pencil tip. I don't remember what the statement was called, but I remember I used it to program games. I owe a lot to GW-BASIC :)
- staycoolboy 6y agoI really appreciate the nearly per-line commenting.
- mrweasel 6y agoSure, but opening a random file yields the comment: .RADIX 8 ; To be safe To be safe of what exactly?
- peteri 6y agoProbably because the PDP & Intel 8080 were typically octal systems rather than hex, the 8080 instruction set decoded nicely in octal (or at least the MOV A,H instructions). By the time the 8086 arrived the micro-computer world had moved to hex as it nice decode mapping was broken by the Z80 and the 6502/68xx families didn't have that nice split. So my guess this is to allow 12 octal to be 10 decimal as that would have been the default in the inital code base.
- guenthert 6y agoI thought the whole octal business stemmed from the time mainframes and minis used 36b, 18b words respectively as 6bit (early mainframe character width) can be conveniently represented as two digit octal. This changed when computers went 16/32bit and started to use 8bit bytes (and ASCII encoding of characters).
- shannifin 6y agoMy first programming language, started self-learning it in the early 90s, great intro language.
- ncmncm 6y agoPoked around a fair bit. Didn't find any hint what the GW is/was supposed to stand for. Micro-soft BASIC on Apple ][, as on other 8-bit targets, infamously did a linear search from the beginning of the program to locate the target of a GOTO or GOSUB statement, so that programs ran faster if frequently called subroutines (what we now call functions) were close to the front. I wonder if or when that behavior was ever corrected in GWBASIC. Also, did the NEXT statement do it too?
- tobinfricke 6y ago> Didn't find any hint what the GW is/was supposed to stand for. Hah! This is the real mystery, isn't it? I noticed Wikipedia has a section on the topic (without resolution): https://en.wikipedia.org/wiki/GW-BASIC#Name https://en.wikipedia.org/wiki/GW-BASIC#Name
- deleted 6y ago[deleted]
- linguae 6y agoThe funny thing about this announcement is that a week ago I just found my old QBASIC textbook that I learned how to program with back in 1998. QBASIC was my very first programming language; I was a nine year old kid who loved computers and would read anything computer-related that was available, including my mom's textbooks (she was returning to college at the time and took some courses on computing and applications such as WordPerfect and Lotus 1-2-3) and software manuals. When we finally got Internet access in 1998 via AOL, I used the message boards to get resources on how to program. I was recommended to learn QBASIC, and I was told that QBASIC could be found on the Windows 95 install CD. I remember initially learning QBASIC through some web tutorials. My mom happened to have a friend who recently took a QBASIC programming course; her friend gave my mom her QBASIC textbook, which my mom then gave to me. I'm now a researcher at an AI lab in Silicon Valley, and I just finished a five-week stint as a section leader for Stanford's CS106A "Code in Place" introductory Python course (https://www.stanforddaily.com/2020/05/07/students-instructors-share-thoughts-on-free-course-code-in-place/ https://www.stanforddaily.com/2020/05/07/students-instructor...). There's nothing like the joy of programming for the very first time, the realization that you can create something that works with code. Teaching those sections as well as finding my QBASIC book has reminded me of the feelings that I have from when I started learning how to program roughly 22 years ago. This release of GW-BASIC was quite timely for me.
- Soulsbane 6y agoQBASIC was also my first programming language. Learned it my Senior year in high school computer programming class back in 1995.
- redorb 6y agoI still have the Qbasic for dummies book my good friend lent me probably 20+ years ago, back then I was playing with Qbasic even though it was old I remember changes the variables in the gorilla banana toss game that came with qbasic ~ first time seeing changes in programming changing the game and it was magical. My friend ended up being a great programmer and I'm doing e-commerce front end / project management work. Great times and I'm thankful for the experience
- bitpow 6y agoGWMAIN.ASM ( https://github.com/microsoft/GW-BASIC/blob/09ad7bc671c90f0eeff4cb7593121ad6f170d903/GWMAIN.ASM#L23 https://github.com/microsoft/GW-BASIC/blob/09ad7bc671c90f0ee... ) BILL GATES WROTE A LOT OF STUFF
- markbnj 6y agoI still have an original GW-BASIC quick reference pamphlet that came with a compaq luggable from about that time, in case anyone wants to complete their collection :).
- mrtweetyhack 6y agoNext, they'll opensource pong
- loraa 6y agoHad a lot of great times with this.
- kristopolous 6y agoIBM had their own Basic, 4 of them really (collectively called IBM Basic) that was a barrier for the clones[1] (eg, Compaq, Dell, etc) because they wouldn't license it. (You probably used one of them, basica if you used the classic PC) Microsoft made GW basic and smited IBM by putting it on the clones Except for the IBM machines. They also intentionally made it slightly incompatible with IBM's basic. Then they held the GW basic source hostage so IBM couldn't resolve the inconsistencies, couldn't backwards engineer it because of the licensing, and thus put them at a losing negotiating position since Microsoft now called the shots because they controlled the software. (I wonder if this slight is in the comments, let me go look, that'd be great[2]) Microsoft also held the DOS source code hostage and it was a huge stickling point in the OS/2 and Windows work and was a significant reason Microsoft was able to steal the show from IBM. IBM even sent over a bunch of engineers to get DOS 2 to work because DOS 1.1 was a complete mess. But they didn't have the rights to walk out the building with the source they wrote due to a contract oversight. Bill Gates was a true software Napoleon, it's really quite something. Now they're releasing all of it. It's a strange coincidence to pick the three they burned IBM with 35 years ago... Maybe they're trying to shake off the old days, maybe they're putting a final stick in IBMs eye, maybe it's genuinely unrelated, who knows. Smacking around IBM is my preferred reading because the idea of doing one final power play, against IBM for God sakes, 25 years after it became unarguably 100% meaningless with the release of Windows 95, I personally find hilarious. --- [1] The only source code left in the timeline we don't have is Phoenix, who cleanroom cloned IBM's BIOS in 1983 (using a Chinese Wall) which allowed the clones to really take off. But they've been pieced off and sold as a fleamarket to HPE, Absolute, and Marlin, so who knows when we'll see that source. [2] I'm going to make the bold claim (after 10 minutes of poking) and say either they removed the incriminating things or the claimed intentionality of the incompatibility is now provably just a rumor (as in they lucked into it through implementing an imperfect clone) There's evidence for both I guess. For instance, GIOCOM.ASM has a reference: COMPAQ=0 ;Include IBM 1.0/1.1 Bugs for compatibility But this isn't cited anywhere else. It's just hanging. They have a bunch of other vendor specific things like ZENITH, TSHIBA, they all have logic, this one is absent any logic, it's just an orphan. Shrug... I just tweeted @ BillG and asked him --- snowballs' chance he'll respond but who knows.
- 6y ago
- axaxs 6y agovery cool. > When writing software for early PCs, every single byte and every single instruction mattered, so developers often wrote code entirely in assembly language simply to be able to physically fit their software into the available memory, and to be able to access the computer’s resources and internal workings. This made me a bit sad. Imagine how fast things could be today if developers still had this mindset. Of course I wouldn't advocate writing everything in ASM, but the adage that computers are fast, write inefficient code...is disappointing to say the least.
- Newtonip 6y agoMy mom's IBM 8088 had GW-BASIC built into its BIOS. You could turn on the computer and go straight into it without having any storage medium present.
- hh2222 6y agoHave an original IBM PC sitting here. It has a 5 pin DIN plug on the back to connect a casette tape drive. I also recall BASICA.COM on diskette leveraged the BASIC routines in the original ROM, so it was about 1/3 the size of GWBASIC.EXE.
- nsxwolf 6y agoThat was actually “Cassette BASIC” written by IBM. It was scary to see it when you didn’t expect to, because that meant something was wrong with your disk drives!
- russellbeattie 6y agoInteresting. Was that the original IBM PC? I thought it needed DOS for some reason. I've always thought that using BASIC as the default command line was really weird... Like on an Apple II or TRS-80. You could type in a command to load something from a disk or run a program, or type a line number to start programming. How did that make sense to anyone?? To my 11yo self, it was confusing and I've never changed my mind.
- nsxwolf 6y agoYes. The original PC and PC XT had BASIC in ROM just like all the other home computers of the day. In its most bare bones configuration, you booted into BASIC and used a cassette tape drive for your storage. I don't know how common that setup was - probably not very. The most typical stripped-down PCs were dual floppy (the hard drive was a premium), and booted either MS-DOS or CP/M.
- int_19h 6y agoIf you already have a PL, why not re-use it as a shell? Those environments were very memory and storage limited, so it made a lot of sense.
- orionblastar 6y agohttps://sourceforge.net/projects/pcbasic/ https://sourceforge.net/projects/pcbasic/ PC Basic emulates GWBasic on many platforms.
- bsharitt 6y agoMy biggest take away here is that old MS-DOS has been made free software. I had a Compaq Portable that I’m restoring, and I gave half a though to combining my love of retro hardware with free software and running FreeDOS even if it is a bit of a resource hog. But I think this machine(its the original version of the Compaq Portable) came with DOS 2.something, so the now open source DOS 2.0 might work without the performance hit of FreeDOS. Neat.
- perl4ever 6y agoI wasn't particularly aware of it, but it looks like the TRS-80 BASIC that introduced me to programming was also probably developed by Microsoft, and I'm pretty sure that AmigaBASIC was as well. I think I also used QuickBASIC on the Mac a little, but what I particularly remember was a demo for it that visually showed different sorting algorithms, that inspired me to do something similar in Pascal.
- pan69 6y agoMicrosoft BASIC was all over the place in the late 70's and early 80's. Before MS-DOS, Microsoft was basically a programming languages company (and they still are today). They licensed their BASIC to many other companies, even Apple. https://en.wikipedia.org/wiki/Microsoft_BASIC https://en.wikipedia.org/wiki/Microsoft_BASIC
- C1sc0cat 6y agoAnd I think most if not all MSBASIC ports for early PC's had a memory leak if you did not break out a FOR loop in the right way. I am a bit rusty but this sows the problem: 10 L = 4720 FOR I =1 TO 1000 STEP 2 30 PRINT I% 35 IF I = l GOTO 6999 40 NEXT 6999 STOP What you needed to do was set I to the end condition as part of the break out of the loop. There was also a lot of aggressive compression done to reduce program size PET in particular munged every thing up putting as many statements on one line as possible
- ajinkyapatil 6y ago10 CLS 10 is always CLS
- Starwatcher2001 6y agoThere was a bug in the TRS-80 basic (which was indeed Microsoft). It had an "on x goto" command that allowed the program to move to different lines depending on the value of a variable: ON X GOTO 200,300,400,500 depending if x=1, x=2,x=3... They'd obviously used the same parser for the standard "If a=1 then goto 200" construct, which allowed an undocumented shortcut of "If a=1, 200" which a few people noticed and started using. However, a later model fixed this, which broke a number of programs.
- downerending 6y agoNot sure whether it was exactly this version, but on an early job in the mid 80s, used a Microsoft BASIC compiler on a PC in a shared office. At least by default, when compiling, it would ring the "bell" on every syntax error. And by "ring", I mean loudly. BEEP BEEP BEEP BEEP BEEP BEEP BEEP. Which I discovered sitting at the PC, surrounded by secretaries, who commenced withering stares. That's the first day I remember not liking Microsoft.
- WorldMaker 6y agoSupposedly IBM's fault that the original PC speaker failed to think of niceties like a mute button. As late as the 486 era I remember how often it was reminded to people to just disconnect the PC Speaker. I also recall there were also crazy case mods where people would add a switch to their cases to add an on/off button.
- downerending 6y agoYeah, once I bought my first PC, I rapidly realized that just disconnecting the speaker was the way to go. That said, I totally blame Microsoft for thinking that ringing the bell was in any way acceptable. Even if the PCs of the day had a soothing, quiet 'ding' sound, emitting that for every compiler diagnostic was the height of stupidity. As it was, I recall the original PC bell sound as more like gear grinding, if your head was one of the gears.
- WorldMaker 6y agoOnce per compiler diagnostic isn't quite so bad as POSIX and macOS apps I know that will ring the bell for every wrong key stroke. ;) (Even if more POSIX terminals these days make the bell actually sound like a bell or use a simple visual "nudge" instead and not the poor buzzsaw of an early DAC wired to a cheap speaker because it was free parts just laying around during the invention of the IBM PC, it's still amazing that terminals ever had a bell signal, as annoying as it can be, much less that apps intentionally used it or that it will forever be ambered into Unicode even. Learning to type a bell was a rite of passage for DOS kids, maybe with pseudo-terminals coming back into fashion it will be a thing kids learn again.)
- pan69 6y 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. MONTE DAVIDOFF WROTE THE MATH PACKAGE (F4I.MAC). I love comments like these. They also say that the GW refers to Bill Gates, as in Gates William but I don't know the details on that. https://github.com/microsoft/GW-BASIC/blob/master/GWMAIN.ASM https://github.com/microsoft/GW-BASIC/blob/master/GWMAIN.ASM Edit: Forgot to say, I was 3 years old when they wrote this code, wow! and I learned programming with GW-BASIC in the late 80's.
- kranner 6y agoThe meaning of "GW" is controversial according to the Wikipedia entry for GW-BASIC [1]: > There are several theories on what the initials "GW" stand for. Greg Whitten, an early Microsoft employee who developed the standards in the company's BASIC compiler line, says Bill Gates picked the name GW-BASIC. Whitten refers to it as Gee-Whiz BASIC and is unsure if Gates named the program after him. The Microsoft User Manual from Microsoft Press also refers to it by this name.[citation needed] It may have also been nicknamed Gee-Whiz because of its numerous graphics commands. Other common theories as to the initials' origins include "Graphics and Windows", "Gates, William" (Microsoft's president at the time), or "Gates-Whitten" (the two main designers of the program). [1] https://en.wikipedia.org/wiki/GW-BASIC https://en.wikipedia.org/wiki/GW-BASIC
- kristopolous 6y agoThose are all too clean for 1983 Microsoft. I'm more likely to think it's some cutting inside joke, maybe an IBM insult. If they said it was say, something like George Wallace Basic, because they segregated it from IBM basic and only put it on the clones as a "separate but equal basic" I wouldn't think twice. I can even imagine the meeting "We can't say this is George Wallace basic, no". "Fine, it's GW basic. Say it means gee wiz or some shit, just make something up"
- m463 6y agoAnother interesting project: https://en.wikipedia.org/wiki/DONKEY.BAS https://en.wikipedia.org/wiki/DONKEY.BAS
- throw_away 6y agoIn 1988 or so, my dad bought us an 8088 IBM-PC for christmas. He used the gw-basic manuals to code in this christmas scene on boot with a santa, a tree, fireworks and even some christmas carol in chiptune in the background. My dad was an autoworker. I've built foundational services and products now in the homes of 100s of millions & to this day I'm still astounded by what my old man pulled off.
- 29athrowaway 6y agoThe Altair BASIC from early Microsoft was an insane achievement. They created it without having access to the Altair, and it worked at the first attempt... using punched tape.
- rluoy 6y agoIs the original Turbo Pascal open sourced? I would have lots of interest in reading it.
- nsxwolf 6y agoLooking at this source code I'm astonished by how many lines of code it is. I've never written more than the most basic (ha) of assembly language programs in my lifetime. How does all this assemble into a 60k binary?! Also, wasn't it true that Steve Wozniak was able to bootstrap the entire Apple I BASIC in hexadecimal from his own memory? How can that be? I'm reeling.
- 13of40 6y agoI wrote an implementation of BASIC for work a year or two ago, and there's a massive nest of case statements to figure out the resulting data types of operations. Grey(er) beard in the next office pointed out I was probably replacing one page of code in the thing I was emulating.
- Scuds 6y agoEach line gets translated down to a few bytes, maybe two to ten depending on the opcode. The downside being that each line doesn't do a whole lot. And I can imagine that this is an absolute ear pull to try to debug with the tools they had. It's more akin to debugging embedded systems to the PCs we have today.
- vs2 6y agoGW stood for Gee Wizz !!!
- timonoko 6y ago"Contains no build scripts, makefiles, or tools required to generate executable binaries, nor does it contain any pre-built binaries / executables". So what is the point of publishing this? All we learn that "Every Line Must Have Comment" in Microsoft.
- timonoko 6y agoCLC ; Clear Carry
- timonoko 6y agoOne line of quoted assembly downvoted. Dang?
- oso2k 6y agoYou could probably use MASM from the the DOS 2.0 release [0], build each ASM file as an OBJ, and finally LINK it all together [1]. [0] https://github.com/microsoft/MS-DOS/blob/master/v2.0/bin/MASM.EXE https://github.com/microsoft/MS-DOS/blob/master/v2.0/bin/MAS... [1] https://github.com/Microsoft/MS-DOS/issues/201 https://github.com/Microsoft/MS-DOS/issues/201
- cachestash 6y agoMy first foray into BASIC was BBC BASIC. I was an 11 year old in the eighties and attending comprehensive secondary school in the UK. We had a school 'computer room' which hosted ten BBC Micros. The mathematics teacher at the time ran an after school computer club and it was alleged that the last 30 minutes were unstructured and some students had managed to get a cassette tape copy of Elite (now Elite Dangerous) loaded onto some Micros. This absolutely blew my mind and I had to get in there somehow. The problem was I knew nothing about computers and I had no computer at home to practise on (this was also not likely to change as I was part of a financially stretched single parent family). What I did manage to do however, was get a copy of Computer Weekly from WH Smiths. This particular edition was running a monthly section on 'Programming in Basic'. Now as said I had no computer, but I was not deterred into letting that stop me, so I wrote my first program on some A4 paper. As with many first time programmers, It was a text based adventure game with a multiple choice engine: You find yourself facing the dragon. Do you? A, Fight the dragon B, Run away C, Use the magic potion the elf gave you. D, Do nothing. The program itself consisted of nothing more than print statements, capturing user input and then conditionals leading to "goto line X" statements. Quite soon this got hugely un-manageable and I realised this programming stuff was not as easy as I thought. Somehow though, I summoned the confidence to take it to the math teacher for his feedback and thought perhaps he might see some promise in me sufficient to get me into the club. He leafed through a few pages and said I could join. He later told me that he was more impressed that someone would attempt such an effort, more than myself showing any sort of genius. Years later now, that snotty nosed inquisitive 11 year old is now a Principal Engineer with a long career spent building many, many systems with many engineers. I have always remained a software engineer , while colleagues have drifted off into management. I will be honest, I am still as excited about tech as I was when I was young upstart. I am also still all to willing to take risks, fail and bite off more that I can chew. In reflection that sense of false bravado is what has led to my career being as successful as it has been. It's never been about how beautiful my code is or how well I understand the deep idiomatic nature of whatever the new language is. It’s been my naive over confident nature to always take on more than I can handle.
- mutagen 6y agoOnes of my early long lasting memories from 7th grade computer lab, my first exposure to programming, was helping another student kick off a deeply nested tangle of IF statements to build his own adventure program. Years later learning about the Z-machine was a revelation.
- ChuckMcM 6y agoI could not find the original macrotized version. As history tells it there was a version of this code that was written in a bunch of macros that were parsable by humans and they emitted assembly code for a wide variety of machines and architectures (from the 8080 to the 80286). When I wrote the BASIC interpreter that runs in your web browser (using Java) I modelled it after GW-BASIC as this was the BASIC that had the most number of test cases I could find. Given that we've got DOSBox for running DOS in your browser this should be portable to that sort of environment right? I know playing HAMMURABI and TREK isn't very engaging to the cool kids these days but they were a big component of the early microcomputer "revolution."
- beambot 6y agoThe article seems to confirm your recollection of a macrotized "master": > Each of the assembly source files contains a header stating This translation created 10-Feb-83 by Version 4.3 > Since the Instruction Set Architecture (ISA) of the early processors used in home and personal computers weren’t spectacularly different from one another, Microsoft was able to generate a substantial amount of the code for a port from the sources of a master implementation. (Alas, sorry, we’re unable to open-source the ISA translator.)
- Brajeshwar 6y agoPerhaps stupid questions but how do they get the commit history to be from 38 years ago at https://github.com/microsoft/GW-BASIC https://github.com/microsoft/GW-BASIC
- mrunkel 6y agoProbably a script with some version of: git commit --amend --no-edit --date="Fri Nov 6 20:00:00 2015 -0600"
- deleted 6y ago[deleted]
- pjmlp 6y agoVery nice commented code, it really looks like the best practices of some Assembly books back then. Also love the remark about high level languages and the choice to go with Assembly, no kids, C wasn't always as fast as you have been sold on, specially on home computers.
- floppy123 6y agoMissing github feature: activity chart on the forks page to see easily who is working on the code - not just collecting
- kerng 6y agoSome real cool things - this is computing history being preserved, like in one of the files I saw this: --------- ---- -- ---- ----- --- ---- ----- 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. MONTE DAVIDOFF WROTE THE MATH PACKAGE (F4I.MAC).
- bajsejohannes 6y agoHas anyone got it compiling yet? I've tried in DOSBOX, using this MASM from this (possibly sketchy?) site: http://www.mediafire.com/file/x13v7gqqmw1pom7/8086_Assembler%2528TechzClub_joyjophin%2529.zip/file http://www.mediafire.com/file/x13v7gqqmw1pom7/8086_Assembler... . The output is as follows: Microsoft (R) Macro Assembler Version 5.00 Copyright (C) Microsoft Corp 1981-1985, 1987. All rights reserved. Object filename [GWMAIN.OBJ]: Source listing [NUL.LST]: Cross-reference [NUL.CRF]: End of file encountered on input file GWMAIN.ASM(3568): warning A4085: End of file, no END directive Open segments: CSEG OEM.H(55): warning A4016: Reserved word used as symbol: SHORT OEM.H(102): warning A4016: Reserved word used as symbol: LENGTH OEM.H(165): warning A4016: Reserved word used as symbol: LENGTH End of file encountered on input file GWMAIN.ASM(3568): warning A4085: End of file, no END directive 51620 + 169980 Bytes symbol space free 4 Warning Errors 1 Severe Errors TASM (version 2.5) gives a similar error.
- Jaruzel 6y agoI'm no assembly genius, but the GWBASIC source is for the 8088 CPU and not the 8086 (the chips are slightly different) - maybe that is why? Also, DOSBox is not 100% compatible with original hardware - Try it again in a VM under VirtualBox maybe?
- einr 6y agoThe 8086 and 8088 are architecturally identical and run the exact same code. The only difference is that the 8088 runs an 8-bit external bus.
- oso2k 6y agoMentioned it in another reply, you'd probably want to start with the MASM and LINK from the MS-DOS 2.0 release. https://github.com/microsoft/MS-DOS/tree/master/v2.0/bin https://github.com/microsoft/MS-DOS/tree/master/v2.0/bin
- acqq 6y agoAlso, as written in the blog post, the .ASM files are not the original sources, more a temporary expansion of these for the given target. Looking at their binary form, all .ASM files end with zero characters instead of, for example, 0x1a with which .H files end. It can be that some tools (different than those originally used) have problems with the zeroes at the end?
- jhoechtl 6y agoThat's interesting: ; There is a problem with running the ASM86 sources for BASIC as they ; stand. MSDOS puts a 100 hex byte control block at the beginning of the ; EXE file and sets up the ES register to point to it. BASIC, however, ; expects this block to be at 0 in the code segment. https://github.com/microsoft/GW-BASIC/blob/master/BIBOOT.ASM https://github.com/microsoft/GW-BASIC/blob/master/BIBOOT.ASM
- hartem_ 6y agoDoes anyone know what GW stands for? Is it just Gates William, or is there more to it?
- qwerty456127 6y agoPlease also open-source MS DOS 7.1 and QuickBasic 4.5. These are equally nostalgic and slightly less useless.
- vijaybritto 6y agoI noticed an odd thing here. The repo is full of assembly code and nothing else but the colored bars in github shows C++ and C !!
- jpswade 6y agoWow, Microsoft are really going full-in on open source. I think this means Open Source has won?
- anticensor 6y agoWait until the Current Branch of Windows 10 becomes open source.
- npongratz 6y agoI'd be content (happy, even!) with Windows 2000.
- rnd0 6y agoNo. Open Source lost to Oracle instead of Microsoft: https://en.wikipedia.org/wiki/Google_v._Oracle_America#Impact https://en.wikipedia.org/wiki/Google_v._Oracle_America#Impac...
- roywashere 6y agoGW-BASIC was the first Basic I wrote substantial code in! I got a kids' book with drawings and text explaing variables and such from my dad. I think I was 7 or 8. It was not long that I reached for the extensive and English-language manual for GW-BASIC which came with the computer. Being a Dutch kid, this allowed me to both learn some English AND some Basic. Prior to that my dad had a Tandy TRS-80 model III but at that point I was 6 or 7 and my typing skills were holding me back from writing more than 3 or 4 lines of code.
- anta40 6y ago"Contains no build scripts, makefiles, or tools required to generate executable binaries, nor does it contain any pre-built binaries / executables" Considering the repository is 80's assembly code, I have no idea how to rebuilt it.
- iforgotpassword 6y agoSo this is the initial version that might still contain some bugs? I forgot the details, but I remember that my XT clone had does MSDOS 2.11 and whatever version of gwbasic came with that, and MUSIC.BAS would always play the notes slightly out of sync with the visuals, and the prompt would return before the last note played. Some day I saw it running on a friends machine, and there everything looked fine. I copied his gwbasic.exe and lo and behold, now it worked on my machine too. The version numbers were also different, but I couldn't tell you either one now.
- bergstromm466 6y agoWow Microsoft's twisted marketing strategies know no limits. They try to seduce you into their way of thinking, not telling you about certain limitations and proprietary formats. If they really cared about open source, they would open source their proprietary Microsoft Office suite document format (.docx etc.). In the end their corporate DNA is programmed to care about charging money above all, by charging rent. That is the nature of all modern day national fiat currencies. Microsoft is just one of those corporations that temporarily falls behind in a certain area of their sector, and then uses the open source community to catch up. I saw someone call it 'fake open source' recently. Let's go for Protocol Cooperativism using Ceptr.org instead. Commons based peer production! The biggest and most damaging black box/proprietary protocol is the money system today. It doesn't allow for a diverse enough view of the different types of wealth [1]. In solidarity [1] https://medium.com/metacurrency-project/the-new-currency-landscape-9964b2c96495 https://medium.com/metacurrency-project/the-new-currency-lan...
- timonoko 6y ago"Sometimes I just look in mirror and spook myself". In 1983 I wrote modern high-level language interpreter and compiler with backtracking and throw-catches (clojures sortof) in MSDOS assembler and it is much shorter than this GW-Basic. Admittedly I used macros like a madman on steroids. https://github.com/timonoko/nokolisp https://github.com/timonoko/nokolisp
- johnnyAghands 6y agoThe perspective and excitement this write up adds is super infectious. Kinda really shows the organic change MS has had in the last 5 years -- at least to me
- ddgflorida 6y agoI loved QBasic. Did Numerical Analysis homework in college with it and wrote a clone in the late 90s that integrated with the web/CGI. It was my favorite until Turbo Pascal came out.
- ezconnect 6y agoMy first programming language was AppleSoft Basic. My Aunt gave me a book, they have Apple II at work, and I read it and learned it even though I dont have an Apple II at that time or even a computer.
- m4tthumphrey 6y agoI love that the "Initial commit" is timestamped to 1983 :)
- goatinaboat 6y agoWhen developing on/for mainframes and minicomputers of the day, developers were sometimes able to use higher-level languages ISTR hearing that MS had a VAX that they developed on then cross-compiled for 8086
- JoeAltmaier 6y agoI remember when Bill Gates released his terrible BASIC for homebrew computers. It was implemented in ROM (because nobody had enough RAM to hold something like an interpreter). It was terrible, bug-ridden and unambitious. I recall thinking at the time "I could do better than that!". If only I had :)
- moron4hire 6y agoWhen I first looked at this, the commit logs showed everything last updated 37 years ago, except the README , which was 37 minutes ago. I thought it was kind of funny.
- password4321 6y agoI read through the GW-BASIC manual of commands from front to back, so I couldn't do any graphics commands until I got to 'SCREEN'.
- Starwatcher2001 6y agoIn 1985, I was developing a simple serial network for barcode readers, to run on the original IBM PC. It needed to run as a TSR (Terminate and Stay Resident) assembler routine and use the 8250 UART chip, and the 8259 Programmable Interupt Controller. At that point the only documentation we had access to was the IBM Technical Reference Manual, which gave the schematics and BIOS listing, but little else. I was very familiar with GW-BASIC and had written some BASIC code to use the RS232 serial interface from it, so decided to reverse engineer GW-BASIC itself, to work out how it was addressing those chips. A month or two later, we came across Peter Norton's "Programmers Guide to the IBM PC", which could have saved us weeks. Exciting times.
- barking 6y agoThere was a later also discontinued Basic from Microsoft that a lot of people have been hoping would be open-sourced too.
- guenthert 6y agoI don't care about Microsoft's BASIC, in fact I don't care much about BASIC at all. It was a poor choice 35 years ago, it's irrelevant today. Or nearly so. However, I do find GPIB programming examples in what seems to be Rocky Mountain BASIC (HP BASIC / HT BASIC) in the manuals of measurement devices from the seventies to the early nineties. Analog electronics didn't evolve nearly as quickly over the last forty years as digital, so some of those instruments are still significant today (chiefly to hobbyists, but at least the HP 3458A, introduced 1989, is still produced virtually unchanged and is even today the top-end long scale-scale DMM). I like to see a OSS implementation of that dialect (for Linux).
- peter_d_sherman 6y agoFirst of all, I'd like to thank Microsoft for open-sourcing this, as well as early versions of MS-DOS; they are important pieces of computer history. Now, a few software engineering observations (these are to my future self, not to Microsoft): 1) This is extremely minor, but it would have been nice if the main file (which I'm guessing is GWMAIN.ASM?) had been pointed to in the documentation. Reason: We're not in a language that has a default main file by custom, i.e., C's 'main.c'. But again, extremely minor... 2) This code is great, I mean, absolutely great for someone to learn x86 programming IF they have the prerequisite understanding about how memory is segmented in those early computers (including segment registers, etc.)... Reason: Very few basic x86 instructions are used, relative to the entire x86 instruction set... 3) It seems that the assembler which was being used at the time had a limitation of 6 characters per symbol. This kind of sucks a little bit for the readability of those symbols (but note that the code makes up for this with liberal commenting, which is great!), and of course, with a little bit of effort, you can mentally parse what most of these mean. 4) I would have liked to see some kind of document (although, since it's 38 years "after-the-fact", after this program was being written, I certainly don't expect one! <g>) which, at a high level, would describe the main data structure being used to hold the lines of basic code (I'm guessing this would be a linked list of sorts), in what source file that data structure lives, and how it is evaluated when a BASIC program is run... Basically, give me the high-level view of the system. The code itself represents the low-level implementation details of that high-level "as simple as possible but not simpler", view... But again, those things are minor, relatively speaking, and they only amount to "notes to self" in my future software engineering efforts... Anyway, thanks again to Microsoft for this great important contribution to computer history!!!
- tinus_hn 6y agoWhat do the letters GW stand for?
- tvmalsv 6y agoVery nice, that was my first language on a PC-compatible (Epson Equity I if anyone remembers those, later upgraded it with a 20MB Seagate ST225!). Man, those were the days... and get off my lawn! lol