{"id":5592,"date":"2020-05-21T16:13:50","date_gmt":"2020-05-21T23:13:50","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/commandline\/?p=5592"},"modified":"2020-05-22T09:32:17","modified_gmt":"2020-05-22T16:32:17","slug":"microsoft-open-sources-gw-basic","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/commandline\/microsoft-open-sources-gw-basic\/","title":{"rendered":"Microsoft Open-Sources GW-BASIC"},"content":{"rendered":"<p>We are excited to announce the open-sourcing of <a href=\"https:\/\/github.com\/microsoft\/GW-BASIC\" rel=\"noopener noreferrer\" target=\"_blank\">Microsoft GW-BASIC<\/a> on GitHub!<\/p>\n<p>Yes, seriously \ud83d\ude00<\/p>\n<h2>Why?<\/h2>\n<p>Since <a href=\"https:\/\/devblogs.microsoft.com\/commandline\/re-open-sourcing-ms-dos-1-25-and-2-0\/\" rel=\"noopener noreferrer\" target=\"_blank\">re-open-sourcing MS-DOS 1.25 &amp; 2.0 on GitHub last year<\/a>, we&#8217;ve received numerous requests to also open-source Microsoft BASIC.<\/p>\n<p>Well, here we are! \ud83d\ude01<\/p>\n<h2>The Source<\/h2>\n<p><a href=\"https:\/\/github.com\/microsoft\/GW-BASIC\" rel=\"noopener noreferrer\" target=\"_blank\">These sources<\/a>, as clearly stated in <a href=\"https:\/\/github.com\/microsoft\/GW-BASIC\/blob\/master\/README.md\" rel=\"noopener noreferrer\" target=\"_blank\">the repo&#8217;s readme<\/a>, are the 8088 assembly language sources from 10th Feb 1983, and are being open-sourced for historical reference and educational purposes. This means we will not be accepting PRs that modify the source in any way.<\/p>\n<h2>A little historical context<\/h2>\n<p><a href=\"https:\/\/github.com\/microsoft\/GW-BASIC\" rel=\"noopener noreferrer\" target=\"_blank\">The GW-BASIC source code being published<\/a> is dated Feb 10th 1983. That was quite a while ago, so just to set a little historical perspective:<\/p>\n<p>The week this source was created Men At Work topped the US and UK singles charts with &#8220;Down Under&#8221;, Dustin Hoffman starred in the #1 US box-office movie, &#8220;Tootsie&#8221;. In 1983, &#8220;Star Wars Episode VI &#8211; Return of the Jedi&#8221; was released, as was &#8220;War Games&#8221;! And, Emily Blunt, Kate Mara, Jonah Hill, Chris Hemsworth, and Henry Cavill, were born! Ronald Reagan was President of the USA, and Margaret Thatcher was the UK&#8217;s Prime Minister.<\/p>\n<p>That same year, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bjarne_Stroustrup\" rel=\"noopener noreferrer\" target=\"_blank\">Bjarne Stroustrup<\/a> was in the middle of developing the first version of <a href=\"https:\/\/en.wikipedia.org\/wiki\/C%2B%2B\" rel=\"noopener noreferrer\" target=\"_blank\">the C++ programming language<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/ARPANET\" rel=\"noopener noreferrer\" target=\"_blank\">ARPANET<\/a> standardized <a href=\"https:\/\/en.wikipedia.org\/wiki\/Internet_protocol_suite\" rel=\"noopener noreferrer\" target=\"_blank\">TCP\/IP<\/a>. <a href=\"https:\/\/en.wikipedia.org\/wiki\/Borland\" rel=\"noopener noreferrer\" target=\"_blank\">Borland<\/a> announced <a href=\"https:\/\/en.wikipedia.org\/wiki\/Turbo_Pascal\" rel=\"noopener noreferrer\" target=\"_blank\">Turbo Pascal<\/a>, created by <a href=\"https:\/\/en.wikipedia.org\/wiki\/Anders_Hejlsberg\" rel=\"noopener noreferrer\" target=\"_blank\">Anders Hejlsberg<\/a> (who went on to join Microsoft, and create <a href=\"https:\/\/en.wikipedia.org\/wiki\/Visual_J%2B%2B\" rel=\"noopener noreferrer\" target=\"_blank\">J++<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/C_Sharp_(programming_language)\" rel=\"noopener noreferrer\" target=\"_blank\">C#<\/a> and <a href=\"https:\/\/en.wikipedia.org\/wiki\/TypeScript\" rel=\"noopener noreferrer\" target=\"_blank\">TypeScript<\/a>).<\/p>\n<p>1983 was also the year AT&amp;T released <a href=\"https:\/\/en.wikipedia.org\/wiki\/UNIX_System_V\" rel=\"noopener noreferrer\" target=\"_blank\">UNIX System V R1<\/a>, and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Berkeley_Software_Distribution\" rel=\"noopener noreferrer\" target=\"_blank\">BSD<\/a> 4.2 was released, introducing the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pseudoterminal\" rel=\"noopener noreferrer\" target=\"_blank\">pseudoterminal<\/a> for the first time (the progenitor to <a href=\"https:\/\/devblogs.microsoft.com\/commandline\/windows-command-line-introducing-the-windows-pseudo-console-conpty\/\" rel=\"noopener noreferrer\" target=\"_blank\">Windows&#8217; ConPTY<\/a> we introduced to Windows in 2018 \ud83d\ude01)<\/p>\n<p>I was 13, and spent every spare second that I wasn&#8217;t finishing my homework or doing my chores, writing BASIC and assembly code on one of the hottest home computers of the time &#8211; the <a href=\"https:\/\/en.wikipedia.org\/wiki\/BBC_Micro\" rel=\"noopener noreferrer\" target=\"_blank\">BBC Micro<\/a> sporting 32KB RAM (yes, 32,768 <strong><em>bytes<\/em><\/strong>, total!), powered by a <a href=\"https:\/\/en.wikipedia.org\/wiki\/MOS_Technology_6502\" rel=\"noopener noreferrer\" target=\"_blank\">6502 processor<\/a> running at a BLAZING 2MHz. When not coding, I was usually playing one of the most groundbreaking games of all time: &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Elite_(video_game)\" rel=\"noopener noreferrer\" target=\"_blank\">Elite<\/a>&#8221; by <a href=\"https:\/\/en.wikipedia.org\/wiki\/David_Braben\" rel=\"noopener noreferrer\" target=\"_blank\">David Braben<\/a> &amp; <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ian_Bell_(programmer)\" rel=\"noopener noreferrer\" target=\"_blank\">Ian Bell<\/a>.<\/p>\n<p>In 1983, Apple launched the 1MHz <a href=\"https:\/\/en.wikipedia.org\/wiki\/6502\" rel=\"noopener noreferrer\" target=\"_blank\">6502<\/a>-powered <a href=\"https:\/\/en.wikipedia.org\/wiki\/Apple_IIe\" rel=\"noopener noreferrer\" target=\"_blank\">Apple IIe<\/a> for US$1,395 (> $3,500 in 2020). Apple also launched the first retail-available computer with a GUI &#8211; the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Apple_Lisa\" rel=\"noopener noreferrer\" target=\"_blank\">Apple Lisa<\/a>. The Lisa contained a staggering 1MB RAM, and ran the awesome <a href=\"https:\/\/en.wikipedia.org\/wiki\/Motorola_68000\" rel=\"noopener noreferrer\" target=\"_blank\">Motorola 68000<\/a> processor at an astounding 5MHz, but it cost $9,995 (> $25,000 in 2020 dollars), so all I could do was peer at it through the window of the one computer store in our town authorized to sell Apple&#8217;s products &#8230; and dream.<\/p>\n<p>And, in 1983 Microsoft released MS-DOS 2.0 (<a href=\"https:\/\/github.com\/microsoft\/MS-DOS\" rel=\"noopener noreferrer\" target=\"_blank\">source here<\/a>), and GW-BASIC for the <a href=\"https:\/\/en.wikipedia.org\/wiki\/IBM_Personal_Computer\" rel=\"noopener noreferrer\" target=\"_blank\">IBM PC XT<\/a> and compatibles.<\/p>\n<h2>What IS GW-BASIC?<\/h2>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/GW-BASIC\" rel=\"noopener noreferrer\" target=\"_blank\">GW-BASIC<\/a> was a BASIC interpreter derived from <a href=\"https:\/\/en.wikipedia.org\/wiki\/IBM_BASIC#IBM_Advanced_BASIC\" rel=\"noopener noreferrer\" target=\"_blank\">IBM&#8217;s Advanced BASIC\/BASICA<\/a>, which itself was a port of <a href=\"https:\/\/en.wikipedia.org\/wiki\/MBASIC\" rel=\"noopener noreferrer\" target=\"_blank\">Microsoft BASIC<\/a>.<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Microsoft_BASIC\" rel=\"noopener noreferrer\" target=\"_blank\">Microsoft&#8217;s various BASIC implementations<\/a> can trace their origins all the way back to Bill Gates &amp; Paul Allen&#8217;s implementation of Microsoft&#8217;s first product &#8211; a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Altair_BASIC\" rel=\"noopener noreferrer\" target=\"_blank\">BASIC interpreter for the Altair 8800<\/a>.<\/p>\n<p>During the late &#8217;70s and 80s, Microsoft&#8217;s BASIC was ported to many OEM&#8217;s specific platform and hardware needs, and for several processors popular at that time, including the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Intel_8088\" rel=\"noopener noreferrer\" target=\"_blank\">8088<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/MOS_Technology_6502\" rel=\"noopener noreferrer\" target=\"_blank\">6502<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Motorola_6809\" rel=\"noopener noreferrer\" target=\"_blank\">6809<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Zilog_Z80\" rel=\"noopener noreferrer\" target=\"_blank\">Z80<\/a>, and others.<\/p>\n<h2>FAQ<\/h2>\n<h3>Wait &#8211; where&#8217;s the C source code?<\/h3>\n<p>There is no C source code!<\/p>\n<p>Like much software from the 70s and 80s, and just like <a href=\"https:\/\/github.com\/microsoft\/MS-DOS\" rel=\"noopener noreferrer\" target=\"_blank\">the source for MS-DOS<\/a>, the source code of GW-BASIC is 100% assembly language.<\/p>\n<h3>Why assembly? Why didn&#8217;t developers use higher-level languages like C, or Pascal?<\/h3>\n<p>When developing on\/for mainframes and minicomputers of the day, developers were sometimes able to use higher-level languages like FORTRAN, LISP, COBOL, RPG, CPL\/BCPL, C, etc. but the compilers for such languages were often hugely expensive, rarely generated efficient code, and were generally unavailable for the space and performance constrained home and personal computers of the day.<\/p>\n<p>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&#8217;s resources and internal workings.<\/p>\n<p>Thus, all the source code for GW-BASIC is pure assembly code, translated on a per-processor\/per-machine basis from core\/master sources.<\/p>\n<h3>This source was &#8216;translated&#8217;?<\/h3>\n<p>Each of the assembly source files contains a header stating <code>This translation created 10-Feb-83 by Version 4.3<\/code><\/p>\n<p>Since the Instruction Set Architecture (ISA) of the early processors used in home and personal computers weren&#8217;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&#8217;re unable to open-source the ISA translator.)<\/p>\n<h3>What about other ports?<\/h3>\n<p>Many have asked if we can also open-source implementations for processors other than the 808x. Alas, we&#8217;re unable to provide sources for these ports and\/or customizations.<\/p>\n<h2>Enjoy!<\/h2>\n<p>We hope you enjoy exploring this fascinating snapshot of what software development looked like during the glorious, exciting, heady days of the &#8217;70s and early &#8217;80s at the dawn of &#8220;the personal computer&#8221; \ud83d\ude01<\/p>\n<p><em>Many thanks to Amy, <a href=\"https:\/\/www.linkedin.com\/in\/julia-liuson-6703441\/\" rel=\"noopener noreferrer\" target=\"_blank\">Julia Liuson<\/a>, <a href=\"https:\/\/twitter.com\/amandaksilver\" rel=\"noopener noreferrer\" target=\"_blank\">Amanda Silver<\/a>, and our awesome CELA team for their approval and help finding, reviewing, and open-sourcing GW-BASIC<\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are excited to announce the open-sourcing of Microsoft&#8217;s GW-BASIC on GitHub!<\/p>\n","protected":false},"author":910,"featured_media":5732,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1534,1,2,4,1535],"tags":[1547,1548,1550],"class_list":["post-5592","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-basic","category-commandline","category-command-line","category-ms-dos","category-open-source","tag-basic","tag-open-source","tag-vintage"],"acf":[],"blog_post_summary":"<p>We are excited to announce the open-sourcing of Microsoft&#8217;s GW-BASIC on GitHub!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts\/5592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/users\/910"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/comments?post=5592"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts\/5592\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/media\/5732"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/media?parent=5592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/categories?post=5592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/tags?post=5592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}