The way I heard the story is that they didn't actually have a running 8080 system. Gates had a DEC-10 at his disposal that used an assembly language called MACRO-10 (MAC files) He wrote macros for each 8080 instruction that fiddles with all the right simulated bits; each with the right name for the 8080 assembler. Then wrote all the code for basic with 8080 instruction names/syntax. Once that was all debugged you could just copy the MAC file off the DEC and put it into an 8080 assembler and with some cleanup of unneeded headers etc, out pops working BASIC. Old time DECSystem-10 programmer here. Loved that machine.
I remember that masm.com/.exe was pretty default on the early clones. But isn't this just entering a higher language so you can leave most of the abstract hardware-dependent logic? Technically, you can adress everything from withing Basic but it's asking to get lost in a maze. If you want that, better take a C-compiler for direct operations on your physical hardware. I mean, you don't want to make a game with any Basic-version's VGA abilities...
I used Microsoft BASIC at school because they had IBM machines, but at home I used Commodore BASIC exclusively because I had the Commodore 64. There are a lot of similarities and a lot of differences between the two versions.
Because the 8086 processor accessed memory a word (16 bits) at a time, there was a huge performance for non-aligned (odd) memory addresses. From www.cpu-world.com/Arch/8086.html Data memory - Word data can be located at odd or even byte boundaries. *The processor uses two memory accesses to read 16-bit word located at odd byte boundaries.* Reading word data from even byte boundaries requires only one memory access. Stack memory can be placed anywhere in memory. *The stack can be located at odd memory addresses, but it is not recommended for performance reasons (see "Data Memory" above).* Considering relative memory speed at the time, twice as many memory accesses was a big deal.
The memory access took four cycles. For example Push register was 10-11 cycles (depending on the source). If it was not word aligned there was 4 cycle penalty. On 8088 there always was the penalty. Especially the 8088 spent most time fetching the code. For example simple ADD reg,reg was 3 cycles but s it was two bytes it took 8 cycles to fetch.
I wrote hundreds of programs in GWBasic for work in 1987-1991, on a ACT Apricot, MS-DOS but not ibm compatible, you could see the screen write it was so slow! In the end I Hacked D86 debugger to work on the apricot screen (which ran top to bottom in memory) I then re-wrote most of my stuff in assembler, before moving to pc at that point I had a budget and switched to QuickBasic. VBA,Visual Basic continued the trend right up to today!
This is great... can you share more about the kind of programs you wrote? I wish I was a programmer back then, but learning all this stuff right now, after three years of JavaScript.
If you're nostalgic and want to write a few snippets of code in GWBASIC, have a look at PC-BASIC. It runs directly under windows (no need for DOSBox) and gives you the exact environment you were used to with a great online reference manual. Write a few programs with simple music, circle graphics and EGA support! github.com/robhagemans/pcbasic (edit: updated with github link)
It's kinda funny how the changed date on github looks like. It shows that the files were last modified 37years ago. Github didn't even exist back then. It's nice to see a proper repository migration :)
@@user255 I get it, they're referring to Bill Gates and his comments on vaccines, euthanasia, tracking people with chips and software. Not a conspiracy theory, BUT, not sure everything is presented in the intended context to the conspiracy theorist crowd. Maybe it is. Some states have given over tracing info on some covid people without their permission, to I think it was Foursquare and Facebook. Not saying you should make a hat but keep the tinfoil handy :-)
There WERE different versions of ( not counting the IBM versions..) GW-BASIC. IIRC the first version was 1.12, the last was 3.23, The last version of MS-DOS to include it was 4.01, It was replaced in MS-DOS 5 and later with QBasic, a watered down version of "Quick BASIC" (Interpreted only...)
The alignment concern for 8088 versus 8086 is because an un-aligned access on 8086 gives up the extra speed of the 8086 over the 8088. You're exactly right that the difference is the width of the external data bus. This means that a fetch of a 16-bit value from the stack requires two memory accesses on the 8088, but it requires only one on an 8086 AS LONG AS the stack is 16-bit aligned. If the stack is offset by 8 bits, then the stack fetch must be performed by fetching 8 bits from the "top" of one address and 8 bits from the "bottom" of the next address, and combining the two together. The 8086 will actually "fix up" these unaligned accesses, so the program would run either way, but it would require an extra memory cycle for every stack instruction on an unaligned stack. The only reason to pay the (substantial) price penalty for an 8086 was to get those faster accesses, so it's worth doing the optimization. On the other hand, on the 8088, you might as well save the RAM and allow unaligned access, since you have to do the extra memory fetch no matter what.
Wrote a lot of commercial software in the late 80's with PDS 7 & 7.1 Since I knew the whole language and never had to look things up or struggle, I sometimes still use it in the form of QB64 for small projects like conversion/migration utilities :-)
There's lots of times where I need to do something oddly specific (Usually, mathematic) And often whipping up some BASIC code is faster than creating a spreadsheet! Both QB64 and PC BASIC are on my taskbar, LOL.
MS-DOS came with GWBASIC, IBM DOS used BASIC and BASICA that relied on ROM BASIC that came in their systems. There were some differences, but I don't recall encountering them.
There was a lot of 8080 to 8086 converters around. CPM86 and early MSDOS were very close to CPM-80 for the 8080 in their low level structures. NEC actually made chips wich run 8080 code as well as 8086 code. An MSDOS machine could then run CPM-80 programs with a software shim. This was all Real-Mode stuff. Later the 386 came out with V86 mode for running MSDOS code under a protected Mode OS. This was the first VM support on PCs. I believe it still lives deep in you 64 bit Intel or AMD fire breather today. I think DosBox and DOSEMU use it on x86 hardware. Remember " 640K is all you Need!!!" Who will write GWBASIC for the Raspberry PI? It is projects like this the old source is really great for. Convert the Routines into a High Level Language, then run it on anything you like. Imagine 64 bit GWBASIC. All those nasty things we worked around back in The Day are gone. Memory limits File name limit, even Path limits are history. Every CPU has floating point built in and almost every high level Language supports it. Building low level frame work to deal with the Console style of the old DOS / CPM world might take work. Graphics might be tricky. Again , our systems can still do it. It is juast getting the old stuff to work through modern features. Have fun and God bless you.
DB is Define Byte, used to reserve space for and define values in the assembly output. DW is Define Word, and so on. Used for things like data structures, strings, variables, etc.
I wrote a lot of Basic code for Atari 400s and 800s. I then wrote a bit of assembly code and some machine code because it was so much faster. When I got my first PC, I used QBasic. I then got QuickBasic so that I could compile the code to a stand-alone executable. I sold a lot of software written with compiled QuickBasic. Over the years I've used Pascal, Borland C++, Visual Basic and Visual C/C++/C#, Python. The fun part is discovering what the language is about and how far you can push it. When I get bored, I try another language.
The original version Gates and Allen wrote for the Altair in a few weeks or months was probably written in 8088 assembly language and cross-assembled on the PDP-10. Intel would have supplied the assembler. Davidoff may have been recruited to write the math routines (trig functions, etc.) because he had the requisite knowledge and Gates and Allen did not. The code Dave is looking at was presumably hand-translated from the original 8088 code to a "generic assembly language" which was then automatically translated to the native assembly languages of several target processors including the 8086/8088 and perhaps the 6502 and 6800. Personal computers of the day had various processors and operating systems, and Microsoft supplied versions of BASIC for many of them. It represents many more than a few weeks or months of work, possibly by other programmers, who would certainly have retained the original comments crediting Gates and Allen. I still run QuickBASIC programs I wrote long ago, using QB64 (see www.qb64.org/portal/) since neither QuickBASIC 4.5 nor BASIC PDS (copies of which I still have) no longer run under Windows. I occasionally write new code using QB64 when I need something quick and dirty. Back in the day, we bought personal computers to write our own software. In the beginning, little was available off the shelf.
The original 4k BASIC was written in 8080 assembly, cross-assembled on the PDP-10 and tested on an 8080 simulator on the same PDP-10. The PDP's were owned by Harvard, where Gates attended. Later Micro-Soft (as they were known at the time) would generate specific versions of their BASIC from the 8080 code, at least for similar processor architects. There were numerous flags throughout the code for machine specific changes. The "Mother" code existed for the major architectures they supported, which were 8080 (8086, etc.), 6502 (various CBM, Acorn etc.), and 6800.
@@theannoyedmrfloyd3998 Yes, but QB64 uses a more reasonable font and lets you use a mouse in a less clunky way than QuickBASIC. It would be nice to go back to whatever 32-bit version of Windows still let you run QuickBASIC from a DOS prompt. Each "upgrade" of Windows just makes things harder. :(
Wow just wow! I still have the original GW Basic manual sitting on my shelf, from one of the earliest computers I owned. Quite a piece of history here.
.MAC was the file extension for MACRO 10 running on those old DECs. I guess the translation software referred to took the original .MAC files and generated these 8088 .ASM files from them.
As I recall ASM was part of the DOS distribution. The .asm source modules are input to ASM and the output of the assembler was an .obj module ("object code"). One ore more obj's are then linked (using LINK, also distributed with DOS) to form a .com or .exe. Boy, this goes back a long way. As for the 8086/8088 thing, I think they were effectively identical except that the 8088 had an 8-bit data bus and the 8086 has a 16-bit data bus. Please feel free to correct my folks.
I was curious which assembler also. I did a little real-mode asm in school and we used MASM, but wasn't sure if that came out later. Also, this code has some different things going on with directives so very curious. Also, no build scripts ...ahem... "batch files" are there. So funny to think if you set everything up in an emulator it would probably all build and link in just a few seconds now!
Microsoft's assembler was called MASM, and never came with any DOS version. It was rather pricey at the time. I don't recall an assembler coming with DOS. GWBASIC/Microsoft BASIC was built for many platforms and CPUs other than the PC.
takes me back i spent a lot of my rime writing code in GW-BASIC then moved to BC7 (QBX) and when VBDOS came along I installed that.. ... takes me back .. VBDOS and BC7 were virtually the same until hey introduced the Forms features .. wow nostalgic
In these assemblers, there basically were 3 ways a variable or code label could be declared. 1) "local" or just declaring means that it is only seen in this file. This is unlike C were functions are always public. 2) "public" this means another file could declare it as "external" and then use it. 3) "external" means it is defined in another file. The code can be very modular because you only would make external what you really needed to reference and you would only make public what was valid to use externally. I wrote a fair amount of 8086 assembly way back when. The horrid instruction set was the biggest problem. You would run out of registers a lot and have to keep stuff on the stack.
8086 had a 16-bit data bus, so it would require two memory access cycles to access a 16-bit value at a misaligned address (the high 8 bits of one word and the low 8 bits of the next word), whereas aligned 16-bit accesses are a single memory access. 8088 had an 8-bit data bus, so alignment was irrelevant, it always takes two memory accesses to access a 16 bit value.
Hi Dave, The comment about the stack on the 8086, is referring to a decision the designers made, for that particular platform, it may be in contrast to the code for the 8080, or another processor, or the "untranslated" version. It is just saying, instead of packing the stack, we will push an unused byte to the stack while executing the for loop. This way they can use the mov instruction rather than the movb(byte) instruction for better perf. But it wastes stack memory. Hope that makes scene.
2:55 His thought seems to be incomplete. I'm assuming he means that they could port this over to run on a different 8-bit processor. Also, he's implying that there were 'early' versions of the 8080 to which, they had to translate (?)
OMG... I just retired a unit using GWBASIC software for a wire bond pull tester yesterday. Been in reliable service since 1992! I was one of the few that remembered how to use DOS and program in BASIC with line numbers. IT only knew GUI. 🤣 I think this was the last project Bill Gates actually did any programming on.
The last commercial product that Bill Gates personally did programming on was Tandy's (Radio Shack) TRS-80 Model 100 "laptop" from 1983. It's an interesting device in it used an Intel 80C85 unlike other TRS-80s that used the Zilog Z-80. Of course it had Microsoft BASIC!
gw basic was what my father wrote battery capacity tester using a radio shack multi meter with pc link ( serial) and a 1 aa tape player or toy, it would graph the voltage over runtime and even had fancy voc sound byte for the level warnings. fun times, as a tinker, i always perfered qbasic or ppowerbasic, was so cool making exe';s
The canonical Microsoft BASIC code was written in PDP-10 MACRO assembler, which had a massive set of macros to translate to the target microprocessor. The macro package was translated over to Xenix when they retired their PDP-10 from service, and was used until the Xenix systems were retired in the mid '90s.
The lessons learned from doing their language packages (which were all made in the same basic way), carried and evolved over to products like MultiPlan.
Wow. 1983 was the year for the release of Turbo Pascal. I bought a copy of it for use on an Apple ][ that I had back in the day. :) I still do some assembly level programming. Currently for 6800, 6809, and 68000. I have an old 1802 based CPU board I'm getting running again and will need to do some assembly programming for it. I never liked the 8086 architecture and its assembly language. In the Letter from Gates I saw mention of versions of APL for the 6800 and 8080. I wonder if they ever got released. I'll have to look in to that.
The initial versions of Delphi were hell because of its data access layer, the Borland Database Engine BDE. 20 years later I still have nightmares about it.
I used Turbo Pascal 5, then 5,5. After some time with Delphi and a collection of PC's 286/386/486 Dos, Win 3.1 and Win95 - i said "get some one else to do it, leave me alone with the dos version" - it works fine in a dos window. 5 mins ago i grabbed my box of floppies and a 2546meg usb stick from 20 years ago and they rang in Win 10 on dosbox - plus my old P2 and P4 Regards George
C# has the safe memory of Basic, and for most projects, compile time is so fast on modern hardware that the benefits of an interpreter don't really matter. One can even get safe memory with stdlib in C++ now.
I had a TRS-80 color computer in the early 80's which had a 6809 CPU and GWBASIC in ROM. I quickly got OS-9 for that computer as well as an assembly language package. I disassembled the ROM to see how the guts of the computer worked (I think that would be illegal these days). The interesting thing about GWBASIC code was how they would try to save space by intentionally jumping into the _middle_ of multi-byte instructions in order to take advantage of instruction sequences as interpreted from that offset starting point. Must've been hell to maintain that code. I think the name for that technique is called "bad coding."
Yes, I was one of the users of the original MITS ALTAIR 8800 Basic releases, the first BASIC that Bill and Paul released. Had to buy two 4K ram cards at US $795 each, in order to buy their MITS BASIC for an additional US $795. That effectively gave you a 5K image running BASIC with around 3K of code space for your source. Soon added a North Star Floppy disc (5 1/4" about 73K Space per floppy storsge).....etc lots of early history.
Some of the comments include register names that suggest the original source was probably written for Z80 or 8080. The 8086 comments are probably referring to the differences between 8086 and those ones
Wow! Memories. Used GWBasic for programs to control HP GPIB test equipment back in mid 80's, however way too slow. Switched to Anders Hejlsberg's Turbo Pascal - huge difference. Has the source code been released for Turbo Pascal? I'd love to graze it!
Nice to hear. Where is it? This might be useful! I rewrote my TRS-BASIC to distribute my 1984 PhD program with GW-BASICA. Such historic programs can again be run. Now that the Virtual Box is available to run Windows XP I may be able to get it working again from the original disks I had converted to CD. Maybe an exercise for the students and to do more research? Great; Thanks. F. Miller, Adjunct Computer Sci.
Ah, brings back childhood memories learning basic on an IBM clone. When I went to tech to do EE, I used to like writing assembler code in class. Couldn't do it now, but it was fun.
The blog post says the translator was to convert from the original instruction set, to the 8086 instruction set. They didn't write it on a higher level. They translated from PDP assembly to x86, using a tool. The blog says sadly they can't opensource this translator.
I transferred TRS-80 MICROSOFT BASIC to a Dick Smith Electronics "Super-80" computer (kit-built) and re-wrote it to run in that environment. I would have expanded it to use disks, but the price of "real" computers dramatically dropped in the mean time, so it wasn't really worth my while (although it would have been fun). Edit: In GWBASIC, if you needed to save and load an array of numbers of a fixed length (such as you might use for a game which is played within certain boundaries), it was just a case of finding the first array element using VARPTR and calculating the size of the data with some simple muliplications, then you could save or load the entire array with a single BSAVE or BLOAD (Binary Save and Binary Load) command, which took only a fraction of a second. e.g. an array is 10 x 10 (which has 11 elements since arrays start from 0) and a single precision number takes 4 bytes, so the length to either save or load is 11 x 11 x 4 = 484 bytes.
Thanks for this info EEVblog2! I watched it twice and now once again, and looked at the gwmain.asm file on Github and found a wasted byte of binary code: It says AND reg1,reg2 and then DEC and the comment says that it is to set the CC (condition codes=flags), but AND already sets the flags! So the code isn''t perfect, but I still admire it's quality! I wrote a disassembler in Basic on my TRS-80 and figured huge parts of it out. All on paper of course, because printers were way too expensive back then. BTW. the level 2 BASIC interpreter in the TRS-80 was 12 Kbyte of ROM whereas the level 1 was 4K, if I remember correctly. BTW. I'd love to see the source for the 8080/Z80 version of BASIC for the TRS-80, but perhaps that was the same? BTW. the 8088 and 8086 are binary code compatible, but it says somewhere that they added a byte to the stack to make the 8086 with it's 16 bits bus faster.
Also, they did "pay" for the time, but not in money; Twenex could "bill" you by processor time, connection time, and disk usage, or any combination of the three. Student accounts at universities were given a limited allotment of those each month, and if you used it up your were out of luck. They "paid" by having less time available for actual course work, which they had to at least pretend to do in order to not lose access to the machine.
Note that while they did use the university's PDP-10 for free to develop the demo that they showed to MITS, once they closed the deal and moved to Albuquerque they rented time on a PDP-10 from a local service to finish the product that was then released. So when the letter was written they had indeed spent a lot of actual money. The letter was published in February of 1976 and at that time source code was protected by copyright but binary programs were not. So his threats to sue didn't really worry anybody. That would change just a few months later: en.wikipedia.org/wiki/Copyright_Act_of_1976
Aligning value on even boundaries with an 8086 means the processor interface can fetch or write in a single cycle. if a value appears on an odd boundary or with 8088 two cycles will be required. The relevent comment is addressing how they optimised access to stack values. The extra cycle thing affects all memory accesses, however the stack is used so frequently, the extra cycle can significantly reduce performance.
I think the reason you don't want to cross word boundaries is that, on a 16 bit bus, it would require 2 operations, whereas if you keep your words aligned, it would take only one.
Re. EEVblog's "stack" comment - I did not look at the code, very rusty, but it's probably word (16 bit) aligning the stack if an 8086. This would likely speed it up quite a bit. 8088 likely wouldn't care. I have some 8086 assembler (the correct term for it, runs equally well on 8088) that I wrote and hand optimised to hell to save every cycle. It has quite a few NOPs in it to Word align the code for efficiency. I neglected to keep the original un-optimised code and I now have something that works but is more or less completely unintelligible. I counted cycles and then tested to verify faster operation. Here is a code fragment EVEN nop ;********** no_wordmatch: xlat ; Load AL with [BX+AL] cmp AL, 19[SI] ;DI] EVEN is an assembler directive to Word align by adding a NOP if required but I then add a NOP myself.This stuff must be more efficient unaligned for reasons I no longer understand.
Great video Dave, I started in High School using HPBasic with punch cards, Then a form of basic on a "mini-computer" at Uni, it was a 5ft high rack mount machine with a TeleType ASR 33, I think, connected. Stored all your programs on punch tape, great times, made some software to predict Amateur Radio Satellites. Tandy TRS-80 basic, code to select cap and resistor values for LM555 circuits. Then GWBasic and Quick basic. Nice clunky code..... I agree, nice commented assembly code in the source code.
I recently did a project with GW-BASIC for fun, just to get the hang of it. I have an old IBM 5140 laptop here, the IBM convertible and I attached a modern SIM to it using SIM800L I'm sendng an email with my old laptop using the AT command sent towards the SIM800L module through the serial port of the laptop. Fittingly ending all emails with a 'sent from my IBM5140' statement XD
The assembly looks cleaner than most GW Basic code I wrote oh so many years ago. Most programs consisted of 254 char lines of spaghetti up to the 64Kb limit. And never a comment to be seen.
I did play a bit with GWBASIC on my old Atari STE 1024, as you said 30years a go, but you know about ageing diskettes and Atari... as fore a 8MHz computer was really grate!
Keep in mind this is GWBASIC, not QBasic source. QBasic was later on and quite nice. QBasic was based on QuickBasic - same language but did not have the linker and compiler. So, QBasic/QuickBasic was VAST better and nicer then GWBASIC GWBASIC still required each line of code to have a line number. Versions started to have if/then blocks (in place of having to use one line). So, GWBASIC is the pre-cursor to QBasic/QuickBasic, but QuickBasic was a re-write - and not to be confused with GWBASIC. As for this raw assembler? Yes, back then they often used a cross-assembler. So, you could/would write using somewhat of a pseudo instruction set,, and then output the assembler for a given CPU platform. As long as the architecture of the CPU was close, then this was possible. You would then take this output (source file with nice comments) and then run it though an assembler that would convert each 3 letter code to actually byte code, and of course the result is binary code/data without any comments. So this is not the QBASIC source, but only the GWBASIC source code.
@@stargazer7644 No one. But if you had experience with dos, then any reference or use of the term basic that was included and packaged with dos often means that many here would thus make the assumption that this basic was and would be the basic included with dos. In other words the basic included with dos was and would be qBasic for a huge number of people watching this video. So to avoid confusion I simply pointed out this difference.
@@Albertkallal I wouldn't call QBasic "the basic that was included ... with dos." In MS-DOS QBasic was only included in versions 5 and 6 for 3 years from 1991 to 1994 and really wasn't nearly as popular at that time as GWBasic/Microsoft Basic was. GWBasic was included in every Microsoft DOS and most OEM DOS versions for 10 years prior to that, and also in quite a few other operating systems and non-pc systems and in derivative forms for 6 years before that. It was everywhere. QBasic was a stripped down version of QuickBasic. QuickBasic was far more powerful and popular as it created compiled executables and ran much faster.
@@stargazer7644 I was simple stating that a huge number of people were introduced to Qbasic, and it was installed on their computers. And this occurred during a period of HUGE growth. And QBasic was much the same syntax and code as QuickBasic - just missing the extra parts you noted. So for a whole group of middle school, or even for high school? That is all they knew and saw. Remember, in that 5 year period? (say 1991-1995)? About 160 million PC's were sold. In the previous 5 years (1990-1985)? About half above was sold (about 74 million). So, never stated it was the most popular (do learn to read, will you????). I simple stated that Qbasic was popular, and was installed on a lot of computers. Nothing more, nothing less. No big deal. And looking at the s-curve adoption of computers? yes in that time frame DOUBLE the number of units was sold. In 1984, about 6 million pc's were sold. In 1990, 20 million were sold - MORE then 3 times!!! (and in-between, MANY more units were being sold each year) So, I not sure how many years we have to go back from say a 5 year period in which Qbasic was shipped with dos. In fact, I might even be able to make a case that MORE units were shipped with QBasic, since the explosive growth in our industry occurred about the same time QBasic starting shipping, and it remained that case for some time onwards. I mean, even if we ignore the above math (which we should not!!!)? There are significant groups that were introduced to Qbasic (and its full version), and significant more units were shipping during that time frame then the earlier years of the computer industry. And QBasic continued to ship even during the rapid rise of win 3.1. As I stated, not a huge deal here. But simple that MANY were introduced to QBasic, and that's not the version being talked about here, and it was a simple and fair point I was making.
@@Albertkallal "do learn to read, will you?" Why don't you learn to listen? The video wasn't about QBasic, and had nothing to do with QBasic. You're the only one jumping up and down about QBasic. For all your claims of units shipped, and explosive growth, QBasic was never that popular. Sure, maybe some middle school kids were taught it because it was free. But I was a programmer using a variety of tools including QuickBasic during this period, and QBasic really wasn't a big thing. And now you want to start talking about Windows when the video was about DOS. VisualBasic is what made Windows a success. It sure as hell wasn't QBasic.
I think the 8088 had a 8bit bus and the 8086 had the 16bit bus, I am 90% sure. So anytime memory was accessed on a 8088 it could only access 8 bits at a time that included the stack.. I was 15 at the time. So to push or pop from the stack you would have to send the low and high byte separately and the low and high byte at the memory location would be sent separately. Can't remember if it was big or little indian. Also you could use Pascal and Delphi with C you just had to remember with function calls the arguments were put on the stack in the reverse order. Tis was a long time ago..
The 8088 was a 16 bit processor, but only had an 8 bit data bus. That means 8 bit memory accesses happened in one memory cycle, and 16 bit accesses happened in two cycles (this was transparent to the programmer - it just took longer). The 8086 had a 16 bit data bus, so 8 bit reads and 16 bit word aligned reads both took one cycle. 16 bit unaligned reads took two cycles, and there was great benefit in avoiding this.
Ha Ha, Yeah I loved doing that on the Apple IIc's in high school. I remember writing a dripping tap program and every time I left computer class I'd run it. Used to just go "Plop" every second or so. Fucking annoying. Then when it got to the top of the screen it would make lots of static noise and empty out. Then start all over again! ;) Fun times
The comments must have been copied over from the 8080 code, as they refer to registers like H,L,D,E, etc. Also, 8080 has a PUSH AF instruction that pushes the accumulator and flags together. The 8086/8 version does LAHF (load flags into AH), XCHG AL,AH, PUSH AX (push both AH and AL as a single register) a lot, along with its complementary instructions to restore them, in order to emulate this sequence. Unaligned stack is explicitly allowed on the 8086/8, just like any other unaligned access, but the processor manual also states that there will be a performance penalty. Both 8088 and 8086 multiplex the data and address pins. But the 8088 only uses the lower 8 pins.
I have an old Epson PX-16 with the large display, an analog/digital interface card and GWBASIC in ROM, I really need to write some kind of datalogger/graph program for it at some point :)
I remember the Gates letter being published in "Byte" magazine back in the day when that publication was worth something more than just being an over-priced advert shill. I also remember something else that Gates published that basically implied hobbyists were thieves and criminals ripping off his code, et cetera, et cetera. I also vividly remember that Gates' attitude and implications did not go down well at all with the computing community, hobbyist or otherwise.
Interesting, my first basic was IBM's Advanced BASIC "basica" on a cartridge in a PCjr running DOS 3.11 lol. Trying to remember if it was QBASIC or GW that I used in the DOS 6.22/Windows 3.11 days but by that time I was more into C.
I am waiting for a show off programmer to add AI to gorrilla.bas. Then I could enjoy watching them throw bananas at each other rather than having to play both gorillas.
Considering a .bas file is source code, wasn't it always released open source. I remember tinkering with the gorilla.bas code in high school 25+ years ago (holy crap ... I'm getting old). If I recall I also pilfered a qbasic based BMP renderer and had it render a bmp on startup just for the sake of it as well.
I actually still have GWBASIC.EXE on my hard drive! It's 80,608 bytes. Mine is version 3.23, though, and the copyright says "(C) Copyright Microsoft 1983,1984,1985,1986,1987,1988", so mine might be a later version.
Hehe, even though you often think of "HAL9000" when you see HAL in code (which came from the acronym IBM, 1 letter "left" for each character). HAL in low level code is most often an acronym for "hardware abstraction layer". Not sure it is here though. Just wanted to mention it :)
I have an idea for your kids. Microsoft has some 'Easter Eggs' in their Operating Systems. Google it and you might find cool things, like a Tank Game in DOS, under WIN XP.
Some time I just want a 20 line program to do something simple. I miss having a small basic interpreter of some sort. Now I write small programs in cshell on a unix box.
I like running Solaris using csh shell. I use shell scripts mostly, when I need something that more powerful depending on what I want to accomplish it is C or Fortran for my higher level languages. No matter what I'm writing I lose interest at around one thousand lines of code. I also use Assembly and machine code when I can. I do have a version of Basic that runs on Solaris, it is kind of strange at best. I think I'll go write something using AWK and SED using ED as my editor. VI VI VI the editor of the Beast.
@@stargazer7644 Yea, to run it on the pi you would need to emulate something that can run the software. I'm talking about building something completely new with modern components that can run the software without any hardware emulation, something like the 8 bit guys computer project
@@untrust2033 You don't need to emulate anything. You have the source code. Just cross compile it for whatever platform you want to use. There are already several GW-BASIC interpreters available for the pi. All you have to do is install them. If you want something that can compile and run this code as is, the device you're looking for is called a PC.
The differentiation between the 8088 and 8086 was due to internal differences. 8086 is a 16 bit processor with an 8 bit data bus and the 8088 is an 8 bit processor
No, it's not. The 8086 is 16 bits internal and external while the 8088 is 16 bits internal but uses an 8 bit external bus to save costs on the board. The instructionset is x86 for both of them. You might have confused the 8088 with the 8080, which was 8bit.
Neat! If only they released the master and translator, but oh well, still very interesting! Don't think the translator just generated code, probably just created copies and switched out opcodes and stuff for the different CPUs, keeping comments and formatting intact... AFAIK most of the main uPs of the day worked vaguely similarly enough for that to be possible?
The way I heard the story is that they didn't actually have a running 8080 system. Gates had a DEC-10 at his disposal that used an assembly language called MACRO-10 (MAC files) He wrote macros for each 8080 instruction that fiddles with all the right simulated bits; each with the right name for the 8080 assembler. Then wrote all the code for basic with 8080 instruction names/syntax. Once that was all debugged you could just copy the MAC file off the DEC and put it into an 8080 assembler and with some cleanup of unneeded headers etc, out pops working BASIC.
Old time DECSystem-10 programmer here. Loved that machine.
Aren't you talking about BASIC for the Altair? The version where Gates whined about thieves and pirates. That was several years before GW-Basic.
@@akallio9000 Based on the headers included here a lot of the core of GW-Basic is from that original 1975 version.
I remember that masm.com/.exe was pretty default on the early clones. But isn't this just entering a higher language so you can leave most of the abstract hardware-dependent logic? Technically, you can adress everything from withing Basic but it's asking to get lost in a maze. If you want that, better take a C-compiler for direct operations on your physical hardware. I mean, you don't want to make a game with any Basic-version's VGA abilities...
@@lamelama22 Yes. GW BASIC is derived from the Altair version. ALL early Microsoft BASICs have this "root".
I used Microsoft BASIC at school because they had IBM machines, but at home I used Commodore BASIC exclusively because I had the Commodore 64. There are a lot of similarities and a lot of differences between the two versions.
They changed the 'Latest commit' on GitHub to say 38 years ago. 😂
yep someone has a sense of humour!
Because the 8086 processor accessed memory a word (16 bits) at a time, there was a huge performance for non-aligned (odd) memory addresses.
From www.cpu-world.com/Arch/8086.html
Data memory -
Word data can be located at odd or even byte boundaries. *The processor uses two memory accesses to read 16-bit word located at odd byte boundaries.* Reading word data from even byte boundaries requires only one memory access.
Stack memory can be placed anywhere in memory. *The stack can be located at odd memory addresses, but it is not recommended for performance reasons (see "Data Memory" above).*
Considering relative memory speed at the time, twice as many memory accesses was a big deal.
It still is but most of the time people are too sloppy to care.
The memory access took four cycles. For example Push register was 10-11 cycles (depending on the source). If it was not word aligned there was 4 cycle penalty. On 8088 there always was the penalty. Especially the 8088 spent most time fetching the code. For example simple ADD reg,reg was 3 cycles but s it was two bytes it took 8 cycles to fetch.
Also, every memory access needed a trip through the ALU to add the segment register bits into the address. Many 8 bit machines were faster.
@@traewatkins931 luckily most compilers aren't so sloppy.
I wrote hundreds of programs in GWBasic for work in 1987-1991, on a ACT Apricot, MS-DOS but not ibm compatible, you could see the screen write it was so slow! In the end I Hacked D86 debugger to work on the apricot screen (which ran top to bottom in memory) I then re-wrote most of my stuff in assembler, before moving to pc at that point I had a budget and switched to QuickBasic. VBA,Visual Basic continued the trend right up to today!
This is great... can you share more about the kind of programs you wrote? I wish I was a programmer back then, but learning all this stuff right now, after three years of JavaScript.
If you're nostalgic and want to write a few snippets of code in GWBASIC, have a look at PC-BASIC. It runs directly under windows (no need for DOSBox) and gives you the exact environment you were used to with a great online reference manual. Write a few programs with simple music, circle graphics and EGA support!
github.com/robhagemans/pcbasic
(edit: updated with github link)
It's kinda funny how the changed date on github looks like. It shows that the files were last modified 37years ago. Github didn't even exist back then. It's nice to see a proper repository migration :)
Who had this square on their Apocalypse Bingo card?
Look at source code a man wrote who would like to see nothing better happen than you and me get a needle full with some mystery injection?
@@statinskill I think your tinfoil hat is a bit too tight
@@statinskill What..!?
@@user255 I get it, they're referring to Bill Gates and his comments on vaccines, euthanasia, tracking people with chips and software. Not a conspiracy theory, BUT, not sure everything is presented in the intended context to the conspiracy theorist crowd. Maybe it is. Some states have given over tracing info on some covid people without their permission, to I think it was Foursquare and Facebook. Not saying you should make a hat but keep the tinfoil handy :-)
@@pgtmr2713 - Careful you might get accused of having an open mind.
do we have to wait another 30y fore Win3.1....
It's useless garbage code by then... should become public domain
I believe that Windows 3.1 was actually written in GW-BASIC or a version of it. Not this specific compiler, of course.
@@henrikg1388 No. C and assembly. You obviously have never written a 16 bit windows program.
There WERE different versions of ( not counting the IBM versions..) GW-BASIC. IIRC the first version was 1.12, the last was 3.23, The last version of MS-DOS to include it was 4.01, It was replaced in MS-DOS 5 and later with QBasic, a watered down version of "Quick BASIC" (Interpreted only...)
My start was with Disk Extended Color Basic on the Tandy Color Computer, then GWBasic. Fun stuff
The basic that came on my CoCo2 was Basic (probably gw) by Microsoft. I never had a disk drive for it. Just the tape drive.
I think it was a combo of gw basic and extended color basic.
@@bertblankenstein3738 GW BASIC came out in 83. Color BASIC (Basic-69) for the TRS-80/Tandy computers came out a few years earlier.
The alignment concern for 8088 versus 8086 is because an un-aligned access on 8086 gives up the extra speed of the 8086 over the 8088. You're exactly right that the difference is the width of the external data bus. This means that a fetch of a 16-bit value from the stack requires two memory accesses on the 8088, but it requires only one on an 8086 AS LONG AS the stack is 16-bit aligned. If the stack is offset by 8 bits, then the stack fetch must be performed by fetching 8 bits from the "top" of one address and 8 bits from the "bottom" of the next address, and combining the two together.
The 8086 will actually "fix up" these unaligned accesses, so the program would run either way, but it would require an extra memory cycle for every stack instruction on an unaligned stack. The only reason to pay the (substantial) price penalty for an 8086 was to get those faster accesses, so it's worth doing the optimization. On the other hand, on the 8088, you might as well save the RAM and allow unaligned access, since you have to do the extra memory fetch no matter what.
Wrote a lot of commercial software in the late 80's with PDS 7 & 7.1
Since I knew the whole language and never had to look things up or struggle, I sometimes still use it in the form of QB64 for small projects like conversion/migration utilities :-)
There's lots of times where I need to do something oddly specific (Usually, mathematic) And often whipping up some BASIC code is faster than creating a spreadsheet! Both QB64 and PC BASIC are on my taskbar, LOL.
MS-DOS came with GWBASIC, IBM DOS used BASIC and BASICA that relied on ROM BASIC that came in their systems. There were some differences, but I don't recall encountering them.
The book “Hard Drive” by James Wallace and Jim Erickson.
It tells the Microsoft story very accurately unlike Pirates Of Silicon Valley.
There was a lot of 8080 to 8086 converters around. CPM86 and early MSDOS were very close to CPM-80 for the 8080 in their low level structures. NEC actually made chips wich run 8080 code as well as 8086 code. An MSDOS machine could then run CPM-80 programs with a software shim. This was all Real-Mode stuff. Later the 386 came out with V86 mode for running MSDOS code under a protected Mode OS. This was the first VM support on PCs. I believe it still lives deep in you 64 bit Intel or AMD fire breather today. I think DosBox and DOSEMU use it on x86 hardware. Remember " 640K is all you Need!!!"
Who will write GWBASIC for the Raspberry PI? It is projects like this the old source is really great for. Convert the Routines into a High Level Language, then run it on anything you like. Imagine 64 bit GWBASIC. All those nasty things we worked around back in The Day are gone. Memory limits File name limit, even Path limits are history. Every CPU has floating point built in and almost every high level Language supports it. Building low level frame work to deal with the Console style of the old DOS / CPM world might take work. Graphics might be tricky. Again , our systems can still do it. It is juast getting the old stuff to work through modern features. Have fun and God bless you.
DB is Define Byte, used to reserve space for and define values in the assembly output. DW is Define Word, and so on. Used for things like data structures, strings, variables, etc.
I wrote a lot of Basic code for Atari 400s and 800s. I then wrote a bit of assembly code and some machine code because it was so much faster. When I got my first PC, I used QBasic. I then got QuickBasic so that I could compile the code to a stand-alone executable. I sold a lot of software written with compiled QuickBasic. Over the years I've used Pascal, Borland C++, Visual Basic and Visual C/C++/C#, Python. The fun part is discovering what the language is about and how far you can push it. When I get bored, I try another language.
The original version Gates and Allen wrote for the Altair in a few weeks or months was probably written in 8088 assembly language and cross-assembled on the PDP-10. Intel would have supplied the assembler. Davidoff may have been recruited to write the math routines (trig functions, etc.) because he had the requisite knowledge and Gates and Allen did not.
The code Dave is looking at was presumably hand-translated from the original 8088 code to a "generic assembly language" which was then automatically translated to the native assembly languages of several target processors including the 8086/8088 and perhaps the 6502 and 6800. Personal computers of the day had various processors and operating systems, and Microsoft supplied versions of BASIC for many of them.
It represents many more than a few weeks or months of work, possibly by other programmers, who would certainly have retained the original comments crediting Gates and Allen.
I still run QuickBASIC programs I wrote long ago, using QB64 (see www.qb64.org/portal/) since neither QuickBASIC 4.5 nor BASIC PDS (copies of which I still have) no longer run under Windows. I occasionally write new code using QB64 when I need something quick and dirty.
Back in the day, we bought personal computers to write our own software. In the beginning, little was available off the shelf.
MikeMike Have you tried DOSbox for that QuickBASIC?
The original 4k BASIC was written in 8080 assembly, cross-assembled on the PDP-10 and tested on an 8080 simulator on the same PDP-10. The PDP's were owned by Harvard, where Gates attended. Later Micro-Soft (as they were known at the time) would generate specific versions of their BASIC from the 8080 code, at least for similar processor architects. There were numerous flags throughout the code for machine specific changes. The "Mother" code existed for the major architectures they supported, which were 8080 (8086, etc.), 6502 (various CBM, Acorn etc.), and 6800.
@@theannoyedmrfloyd3998 Yes, but QB64 uses a more reasonable font and lets you use a mouse in a less clunky way than QuickBASIC. It would be nice to go back to whatever 32-bit version of Windows still let you run QuickBASIC from a DOS prompt. Each "upgrade" of Windows just makes things harder. :(
Wow just wow! I still have the original GW Basic manual sitting on my shelf, from one of the earliest computers I owned. Quite a piece of history here.
.MAC was the file extension for MACRO 10 running on those old DECs. I guess the translation software referred to took the original .MAC files and generated these 8088 .ASM files from them.
Oh yes. I remember writing Assembly cod on a VAX-11/780. IIRC; linking was a separate step.
I remember programming in basic. Also reminds me of starting on the old Tandy before floppy discs were a thing.
I did a major project with UCSD Pascal on an Apple III around 1986. Later moved it to IBM Pascal for a PC-AT.
As I recall ASM was part of the DOS distribution. The .asm source modules are input to ASM and the output of the assembler was an .obj module ("object code"). One ore more obj's are then linked (using LINK, also distributed with DOS) to form a .com or .exe. Boy, this goes back a long way. As for the 8086/8088 thing, I think they were effectively identical except that the 8088 had an 8-bit data bus and the 8086 has a 16-bit data bus. Please feel free to correct my folks.
I was curious which assembler also. I did a little real-mode asm in school and we used MASM, but wasn't sure if that came out later. Also, this code has some different things going on with directives so very curious. Also, no build scripts ...ahem... "batch files" are there. So funny to think if you set everything up in an emulator it would probably all build and link in just a few seconds now!
Microsoft's assembler was called MASM, and never came with any DOS version. It was rather pricey at the time. I don't recall an assembler coming with DOS. GWBASIC/Microsoft BASIC was built for many platforms and CPUs other than the PC.
takes me back i spent a lot of my rime writing code in GW-BASIC then moved to BC7 (QBX) and when VBDOS came along I installed that.. ... takes me back .. VBDOS and BC7 were virtually the same until hey introduced the Forms features .. wow nostalgic
In these assemblers, there basically were 3 ways a variable or code label could be declared.
1) "local" or just declaring means that it is only seen in this file. This is unlike C were functions are always public.
2) "public" this means another file could declare it as "external" and then use it.
3) "external" means it is defined in another file.
The code can be very modular because you only would make external what you really needed to reference and you would only make public what was valid to use externally.
I wrote a fair amount of 8086 assembly way back when. The horrid instruction set was the biggest problem. You would run out of registers a lot and have to keep stuff on the stack.
8086 had a 16-bit data bus, so it would require two memory access cycles to access a 16-bit value at a misaligned address (the high 8 bits of one word and the low 8 bits of the next word), whereas aligned 16-bit accesses are a single memory access. 8088 had an 8-bit data bus, so alignment was irrelevant, it always takes two memory accesses to access a 16 bit value.
Hi Dave,
The comment about the stack on the 8086, is referring to a decision the designers made, for that particular platform, it may be in contrast to the code for the 8080, or another processor, or the "untranslated" version.
It is just saying, instead of packing the stack, we will push an unused byte to the stack while executing the for loop. This way they can use the mov instruction rather than the movb(byte) instruction for better perf. But it wastes stack memory. Hope that makes scene.
I know you could assemble 8080 code for the 8088, but I suspect they're talking about hand-translation from some sort of pseudo-assembler.
Oh the memories ... I stated programming on a PDP11 in basic in 1978
2:55 His thought seems to be incomplete. I'm assuming he means that they could port this over to run on a different 8-bit processor. Also, he's implying that there were 'early' versions of the 8080 to which, they had to translate (?)
OMG...
I just retired a unit using GWBASIC software for a wire bond pull tester yesterday.
Been in reliable service since 1992!
I was one of the few that remembered how to use DOS and program in BASIC with line numbers.
IT only knew GUI. 🤣
I think this was the last project Bill Gates actually did any programming on.
The last commercial product that Bill Gates personally did programming on was Tandy's (Radio Shack) TRS-80 Model 100 "laptop" from 1983. It's an interesting device in it used an Intel 80C85 unlike other TRS-80s that used the Zilog Z-80. Of course it had Microsoft BASIC!
gw basic was what my father wrote battery capacity tester using a radio shack multi meter with pc link ( serial) and a 1 aa tape player or toy, it would graph the voltage over runtime and even had fancy voc sound byte for the level warnings. fun times, as a tinker, i always perfered qbasic or ppowerbasic, was so cool making exe';s
If baterizer / bateroo gets to hear about any 'battery capacity tester' they'll sue you into oblivion :)
The canonical Microsoft BASIC code was written in PDP-10 MACRO assembler, which had a massive set of macros to translate to the target microprocessor. The macro package was translated over to Xenix when they retired their PDP-10 from service, and was used until the Xenix systems were retired in the mid '90s.
The lessons learned from doing their language packages (which were all made in the same basic way), carried and evolved over to products like MultiPlan.
Wow. 1983 was the year for the release of Turbo Pascal. I bought a copy of it for use on an Apple ][ that I had back in the day. :) I still do some assembly level programming. Currently for 6800, 6809, and 68000. I have an old 1802 based CPU board I'm getting running again and will need to do some assembly programming for it. I never liked the 8086 architecture and its assembly language. In the Letter from Gates I saw mention of versions of APL for the 6800 and 8080. I wonder if they ever got released. I'll have to look in to that.
Around the 80ties you could buy a book called: Basic decoded of the TRS-80 model I. This basic was also written by Microsoft.
The initial versions of Delphi were hell because of its data access layer, the Borland Database Engine BDE. 20 years later I still have nightmares about it.
I used Turbo Pascal 5, then 5,5. After some time with Delphi and a collection of PC's 286/386/486 Dos, Win 3.1 and Win95 - i said "get some one else to do it, leave me alone with the dos version" - it works fine in a dos window.
5 mins ago i grabbed my box of floppies and a 2546meg usb stick from 20 years ago and they rang in Win 10 on dosbox - plus my old P2 and P4
Regards
George
C# has the safe memory of Basic, and for most projects, compile time is so fast on modern hardware that the benefits of an interpreter don't really matter. One can even get safe memory with stdlib in C++ now.
For RUclipsrs who know basic, the most feared expression is END SUB
"Tom Corbett, Space Cadet" was an early 1950s Kid's TV show. Tom Corbett ALSO was the Governor of Pennsylvania from 2011-2015, LOL.
I had a TRS-80 color computer in the early 80's which had a 6809 CPU and GWBASIC in ROM. I quickly got OS-9 for that computer as well as an assembly language package. I disassembled the ROM to see how the guts of the computer worked (I think that would be illegal these days).
The interesting thing about GWBASIC code was how they would try to save space by intentionally jumping into the _middle_ of multi-byte instructions in order to take advantage of instruction sequences as interpreted from that offset starting point. Must've been hell to maintain that code.
I think the name for that technique is called "bad coding."
Yes, I was one of the users of the original MITS ALTAIR 8800 Basic releases, the first BASIC that Bill and Paul released. Had to buy two 4K ram cards at US $795 each, in order to buy their MITS BASIC for an additional US $795. That effectively gave you a 5K image running BASIC with around 3K of code space for your source. Soon added a North Star Floppy disc (5 1/4" about 73K Space per floppy storsge).....etc lots of early history.
That was a pretty penny back then! :)
@@jameslynch8738 Sure was, after tax monthly income was a bit over Aust$800 that then was actually about over US $800. So say about 2 1/2 months work.
Now that's a blast from the past! I remember I wrote a GW Basic database program to keep track of my progress and grades during my University years.
Some of the comments include register names that suggest the original source was probably written for Z80 or 8080. The 8086 comments are probably referring to the differences between 8086 and those ones
Wow! Memories. Used GWBasic for programs to control HP GPIB test equipment back in mid 80's, however way too slow. Switched to Anders Hejlsberg's Turbo Pascal - huge difference. Has the source code been released for Turbo Pascal? I'd love to graze it!
I dont know about the source code, but all the borland programs are now free in their museum.
Regards
George
Nice to hear. Where is it? This might be useful! I rewrote my TRS-BASIC to distribute my 1984 PhD program with GW-BASICA. Such historic programs can again be run. Now that the Virtual Box is available to run Windows XP I may be able to get it working again from the original disks I had converted to CD. Maybe an exercise for the students and to do more research? Great; Thanks. F. Miller, Adjunct Computer Sci.
I've got my first Made in Taiwan copycat APPLE ][ in December, 1982.
I was probably trying to write my first 6502 assembly program in February.
Ah, brings back childhood memories learning basic on an IBM clone. When I went to tech to do EE, I used to like writing assembler code in class. Couldn't do it now, but it was fun.
The blog post says the translator was to convert from the original instruction set, to the 8086 instruction set. They didn't write it on a higher level. They translated from PDP assembly to x86, using a tool. The blog says sadly they can't opensource this translator.
I transferred TRS-80 MICROSOFT BASIC to a Dick Smith Electronics "Super-80" computer (kit-built) and re-wrote it to run in that environment. I would have expanded it to use disks, but the price of "real" computers dramatically dropped in the mean time, so it wasn't really worth my while (although it would have been fun).
Edit: In GWBASIC, if you needed to save and load an array of numbers of a fixed length (such as you might use for a game which is played within certain boundaries), it was just a case of finding the first array element using VARPTR and calculating the size of the data with some simple muliplications, then you could save or load the entire array with a single BSAVE or BLOAD (Binary Save and Binary Load) command, which took only a fraction of a second. e.g. an array is 10 x 10 (which has 11 elements since arrays start from 0) and a single precision number takes 4 bytes, so the length to either save or load is 11 x 11 x 4 = 484 bytes.
Thanks for this info EEVblog2! I watched it twice and now once again, and looked at the gwmain.asm file on Github and found a wasted byte of binary code: It says AND reg1,reg2 and then DEC and the comment says that it is to set the CC (condition codes=flags), but AND already sets the flags! So the code isn''t perfect, but I still admire it's quality! I wrote a disassembler in Basic on my TRS-80 and figured huge parts of it out. All on paper of course, because printers were way too expensive back then. BTW. the level 2 BASIC interpreter in the TRS-80 was 12 Kbyte of ROM whereas the level 1 was 4K, if I remember correctly. BTW. I'd love to see the source for the 8080/Z80 version of BASIC for the TRS-80, but perhaps that was the same? BTW. the 8088 and 8086 are binary code compatible, but it says somewhere that they added a byte to the stack to make the 8086 with it's 16 bits bus faster.
Also, they did "pay" for the time, but not in money; Twenex could "bill" you by processor time, connection time, and disk usage, or any combination of the three. Student accounts at universities were given a limited allotment of those each month, and if you used it up your were out of luck. They "paid" by having less time available for actual course work, which they had to at least pretend to do in order to not lose access to the machine.
Note that while they did use the university's PDP-10 for free to develop the demo that they showed to MITS, once they closed the deal and moved to Albuquerque they rented time on a PDP-10 from a local service to finish the product that was then released. So when the letter was written they had indeed spent a lot of actual money.
The letter was published in February of 1976 and at that time source code was protected by copyright but binary programs were not. So his threats to sue didn't really worry anybody. That would change just a few months later: en.wikipedia.org/wiki/Copyright_Act_of_1976
Aligning value on even boundaries with an 8086 means the processor interface can fetch or write in a single cycle. if a value appears on an odd boundary or with 8088 two cycles will be required. The relevent comment is addressing how they optimised access to stack values. The extra cycle thing affects all memory accesses, however the stack is used so frequently, the extra cycle can significantly reduce performance.
.MAC is the extension for PDP-10 MACRO files. MACRO was DEC's macro assembler. Twenex filenames are DRIVE:FILE.EXT
I think the reason you don't want to cross word boundaries is that, on a 16 bit bus, it would require 2 operations, whereas if you keep your words aligned, it would take only one.
QBasic was where I got my start - great times...
GW BASIC was very similar, but older... And had a compiler which QBASIC didn't have.
Re. EEVblog's "stack" comment - I did not look at the code, very rusty, but it's probably word (16 bit) aligning the stack if an 8086. This would likely speed it up quite a bit. 8088 likely wouldn't care.
I have some 8086 assembler (the correct term for it, runs equally well on 8088) that I wrote and hand optimised to hell to save every cycle. It has quite a few NOPs in it to Word align the code for efficiency. I neglected to keep the original un-optimised code and I now have something that works but is more or less completely unintelligible. I counted cycles and then tested to verify faster operation.
Here is a code fragment
EVEN
nop ;**********
no_wordmatch:
xlat ; Load AL with [BX+AL]
cmp AL, 19[SI] ;DI]
EVEN is an assembler directive to Word align by adding a NOP if required but I then add a NOP myself.This stuff must be more efficient unaligned for reasons I no longer understand.
This is how I got started writing games in GW basic on a TI-99 (Texas Instruments ) computer AWESOME
The TI-99 did not have GWBasic. It used the built in TI Basic, and Extended Basic if you had the cartridge.
Seeing x86 instructions in PDP-10 MACRO form is somehow offensive to me. I feel the need for a stiff drink, and I don't drink.
Agreed
Yeah, well I am appalled that M$ put bash terminal in windows rather than giving us the full CLI back.
Great video Dave,
I started in High School using HPBasic with punch cards,
Then a form of basic on a "mini-computer" at Uni, it was a 5ft high rack mount machine with a TeleType ASR 33, I think, connected.
Stored all your programs on punch tape, great times, made some software to predict Amateur Radio Satellites.
Tandy TRS-80 basic, code to select cap and resistor values for LM555 circuits.
Then GWBasic and Quick basic.
Nice clunky code.....
I agree, nice commented assembly code in the source code.
I didn't hear from GW-Basic for decades ! It was my language for a start in the '80s, then I switched to Turbo-Pascal, in these years...
There were tools to translate 8080 assembler to 8086 automatically.
Brings back memories of the 80's and programming.
They ran the same code, but on 8086 there was performance penalty if things were not word aligned.
I recently did a project with GW-BASIC for fun, just to get the hang of it.
I have an old IBM 5140 laptop here, the IBM convertible and I attached a modern SIM to it using SIM800L
I'm sendng an email with my old laptop using the AT command sent towards the SIM800L module through the serial port of the laptop.
Fittingly ending all emails with a 'sent from my IBM5140' statement XD
OMG i can't believe you remembered PDS.. I loved the windowed demo's!!!
The assembly looks cleaner than most GW Basic code I wrote oh so many years ago. Most programs consisted of 254 char lines of spaghetti up to the 64Kb limit. And never a comment to be seen.
PDS brings back memories, still have the original box complete with all books and disks hidden somewhere.
I did play a bit with GWBASIC on my old Atari STE 1024, as you said 30years a go, but you know about ageing diskettes and Atari... as fore a 8MHz computer was really grate!
Keep in mind this is GWBASIC, not QBasic source.
QBasic was later on and quite nice. QBasic was based on QuickBasic - same language but did not have the linker and compiler.
So, QBasic/QuickBasic was VAST better and nicer then GWBASIC
GWBASIC still required each line of code to have a line number. Versions started to have if/then blocks (in place of having to use one line).
So, GWBASIC is the pre-cursor to QBasic/QuickBasic, but QuickBasic was a re-write - and not to be confused with GWBASIC.
As for this raw assembler? Yes, back then they often used a cross-assembler. So, you could/would write using somewhat of a pseudo instruction set,, and then output the assembler for a given CPU platform. As long as the architecture of the CPU was close, then this was possible. You would then take this output (source file with nice comments) and then run it though an assembler that would convert each 3 letter code to actually byte code, and of course the result is binary code/data without any comments.
So this is not the QBASIC source, but only the GWBASIC source code.
Who mentioned QBasic?
@@stargazer7644
No one. But if you had experience with dos, then any reference or use of the term basic that was included and packaged with dos often means that many here would thus make the assumption that this basic was and would be the basic included with dos.
In other words the basic included with dos was and would be qBasic for a huge number of people watching this video.
So to avoid confusion I simply pointed out this difference.
@@Albertkallal I wouldn't call QBasic "the basic that was included ... with dos." In MS-DOS QBasic was only included in versions 5 and 6 for 3 years from 1991 to 1994 and really wasn't nearly as popular at that time as GWBasic/Microsoft Basic was. GWBasic was included in every Microsoft DOS and most OEM DOS versions for 10 years prior to that, and also in quite a few other operating systems and non-pc systems and in derivative forms for 6 years before that. It was everywhere. QBasic was a stripped down version of QuickBasic. QuickBasic was far more powerful and popular as it created compiled executables and ran much faster.
@@stargazer7644
I was simple stating that a huge number of people were introduced to Qbasic, and it was installed on their computers.
And this occurred during a period of HUGE growth. And QBasic was much the same syntax and code as QuickBasic - just missing the extra parts you noted.
So for a whole group of middle school, or even for high school? That is all they knew and saw.
Remember, in that 5 year period? (say 1991-1995)?
About 160 million PC's were sold.
In the previous 5 years (1990-1985)? About half above was sold (about 74 million).
So, never stated it was the most popular (do learn to read, will you????).
I simple stated that Qbasic was popular, and was installed on a lot of computers. Nothing more, nothing less. No big deal.
And looking at the s-curve adoption of computers? yes in that time frame DOUBLE the number of units was sold.
In 1984, about 6 million pc's were sold.
In 1990, 20 million were sold - MORE then 3 times!!!
(and in-between, MANY more units were being sold each year)
So, I not sure how many years we have to go back from say a 5 year period in which Qbasic was shipped with dos.
In fact, I might even be able to make a case that MORE units were shipped with QBasic, since the explosive growth in our industry occurred about the same time QBasic starting shipping, and it remained that case for some time onwards.
I mean, even if we ignore the above math (which we should not!!!)? There are significant groups that were introduced to Qbasic (and its full version), and significant more units were shipping during that time frame then the earlier years of the computer industry. And QBasic continued to ship even during the rapid rise of win 3.1.
As I stated, not a huge deal here. But simple that MANY were introduced to QBasic, and that's not the version being talked about here, and it was a simple and fair point I was making.
@@Albertkallal "do learn to read, will you?" Why don't you learn to listen? The video wasn't about QBasic, and had nothing to do with QBasic. You're the only one jumping up and down about QBasic. For all your claims of units shipped, and explosive growth, QBasic was never that popular. Sure, maybe some middle school kids were taught it because it was free. But I was a programmer using a variety of tools including QuickBasic during this period, and QBasic really wasn't a big thing. And now you want to start talking about Windows when the video was about DOS. VisualBasic is what made Windows a success. It sure as hell wasn't QBasic.
And here I am just restoring a Commodore PC-I and started GW-Basic yesterday to find this today... what are the odds?
Serious question.. what is it good for today? I can not think of anything that it is used for in modern electronics, or computers.
pretty much only good for nostalgia.
What was it good for at the time? It's still good for the same things.
@@stargazer7644 It was used in a lot of things then.
I still have some old GW-BASIC 5 1/4 floppies. I used QBasic 4.5 and PDS 7.1 to first learn programming.
You mean QuickBasic 4.5. Because QBasic was a different software, and I don't think it reached version 4 not even 3 at all.
I think the 8088 had a 8bit bus and the 8086 had the 16bit bus, I am 90% sure. So anytime memory was accessed on a 8088 it could only access 8 bits at a time that included the stack.. I was 15 at the time. So to push or pop from the stack you would have to send the low and high byte separately and the low and high byte at the memory location would be sent separately. Can't remember if it was big or little indian. Also you could use Pascal and Delphi with C you just had to remember with function calls the arguments were put on the stack in the reverse order. Tis was a long time ago..
The 8088 was a 16 bit processor, but only had an 8 bit data bus. That means 8 bit memory accesses happened in one memory cycle, and 16 bit accesses happened in two cycles (this was transparent to the programmer - it just took longer). The 8086 had a 16 bit data bus, so 8 bit reads and 16 bit word aligned reads both took one cycle. 16 bit unaligned reads took two cycles, and there was great benefit in avoiding this.
@@stargazer7644 been so long I forgot. Laff
10 PRINT "NAUGHTY WORDS"
20 GOTO 10
RUN
And then you run... away from the computer!
I did that in a Dixon’s store once in my younger years!
Ha Ha, Yeah I loved doing that on the Apple IIc's in high school. I remember writing a dripping tap program and every time I left computer class I'd run it. Used to just go "Plop" every second or so. Fucking annoying. Then when it got to the top of the screen it would make lots of static noise and empty out. Then start all over again! ;)
Fun times
You're doing it wrong... You edit autoexec.bat to have that same infinite loop. Shop staff can't even just reboot it to fix it 😂
The comments must have been copied over from the 8080 code, as they refer to registers like H,L,D,E, etc. Also, 8080 has a PUSH AF instruction that pushes the accumulator and flags together. The 8086/8 version does LAHF (load flags into AH), XCHG AL,AH, PUSH AX (push both AH and AL as a single register) a lot, along with its complementary instructions to restore them, in order to emulate this sequence.
Unaligned stack is explicitly allowed on the 8086/8, just like any other unaligned access, but the processor manual also states that there will be a performance penalty.
Both 8088 and 8086 multiplex the data and address pins. But the 8088 only uses the lower 8 pins.
I have an old Epson PX-16 with the large display, an analog/digital interface card and GWBASIC in ROM, I really need to write some kind of datalogger/graph program for it at some point :)
I'd love for Borland to release the source for TurboPascal 3.0!
Someone wrote a modern version GW-basic for modern computers.
robhagemans.github.io/pcbasic/index.html
Works on Windows, Mac, Linux, and Python.
I remember the Gates letter being published in "Byte" magazine back in the day when that publication was worth something more than just being an over-priced advert shill. I also remember something else that Gates published that basically implied hobbyists were thieves and criminals ripping off his code, et cetera, et cetera. I also vividly remember that Gates' attitude and implications did not go down well at all with the computing community, hobbyist or otherwise.
Interesting, my first basic was IBM's Advanced BASIC "basica" on a cartridge in a PCjr running DOS 3.11 lol. Trying to remember if it was QBASIC or GW that I used in the DOS 6.22/Windows 3.11 days but by that time I was more into C.
RADIX 8 means that all the numbers are octal. PDP-10s are 36-bit octal machines.
Didn't an early beta version of dos 6.0 source code get leaked like a decade ago?
I'm waiting for Microsoft to release the source code to gorilla.bas
They already did:
github.com/GorillaStack/gorillas/blob/master/gorillas.bas
😂
This gorilla approves.
I am waiting for a show off programmer to add AI to gorrilla.bas. Then I could enjoy watching them throw bananas at each other rather than having to play both gorillas.
Considering a .bas file is source code, wasn't it always released open source. I remember tinkering with the gorilla.bas code in high school 25+ years ago (holy crap ... I'm getting old). If I recall I also pilfered a qbasic based BMP renderer and had it render a bmp on startup just for the sake of it as well.
I actually still have GWBASIC.EXE on my hard drive! It's 80,608 bytes. Mine is version 3.23, though, and the copyright says "(C) Copyright Microsoft 1983,1984,1985,1986,1987,1988", so mine might be a later version.
3.23 is the final version that was released with DOS 4.x.
Github has initial commit at Feb 10, 1983. Github founded in 2008. 🧐
That was a nice touch!
88mph and the right vehicle is all it takes
Microsoft owns GitHub, so they can do whatever they like :P
@@samuelschwager yes they bought GitHub just to foce the desired commit date. :-)
You can manually backdate commits in git and Github will respectfully display it. Was there even rcs in 1975? In '83?
Must get this GIT Source as I have Basic, Tiny C and other language source for several early programs already.
I like a good bit of coding these days, only really began to undersand it in uni.
1975 vintage? wonder how it compares to Atari basic with its JIT features. ((which was also a Microsoft basic))
Leggo MuhEggo Atari BASIC is not a Microsoft BASIC variant though the 8-bit Atari did get its own translation of Microsoft BASIC.
Hehe, even though you often think of "HAL9000" when you see HAL in code (which came from the acronym IBM, 1 letter "left" for each character). HAL in low level code is most often an acronym for "hardware abstraction layer". Not sure it is here though. Just wanted to mention it :)
According to Arthur C Clarke, HAL was an abbreviation for Heuristic-ALgorithm
I have an idea for your kids. Microsoft has some 'Easter Eggs' in their Operating Systems. Google it and you might find cool things, like a Tank Game in DOS, under WIN XP.
1983? That's 37 years ago... a bit late, but OK. How much do we need to wait for Windows 1.0?
Some time I just want a 20 line program to do something simple. I miss having a small basic interpreter of some sort. Now I write small programs in cshell on a unix box.
Why not just use Perl or Awk - both incredibly useful for small programs.
You can use basic, I do.
I like running Solaris using csh shell. I use shell scripts mostly, when I need something that more powerful depending on what I want to accomplish it is C or Fortran for my higher level languages. No matter what I'm writing I lose interest at around one thousand lines of code. I also use Assembly and machine code when I can. I do have a version of Basic that runs on Solaris, it is kind of strange at best.
I think I'll go write something using AWK and SED using ED as my editor.
VI VI VI the editor of the Beast.
Comments ... a lost art. And i bet they removed a lot of comments before they open sourced it.
Hope they continue with qbasic/quickbasic.
First time i have been to early to a video, have to come back later and check comments.
I would love to have a full QuickBasic port on linux.
I started writing 8085 Machine Code then Motorola Assembler followed by C, never used Basic.
Will be interesting to see if companies now start making rpi style GWBASIC computers
Would be pretty cool :3
BASIC is already available on the rpi.
@@stargazer7644 I mean properly implement it on real hardware instead of emulation
@@untrust2033 Properly implement what? It is software. You emulate hardware, not software.
@@stargazer7644 Yea, to run it on the pi you would need to emulate something that can run the software. I'm talking about building something completely new with modern components that can run the software without any hardware emulation, something like the 8 bit guys computer project
@@untrust2033 You don't need to emulate anything. You have the source code. Just cross compile it for whatever platform you want to use. There are already several GW-BASIC interpreters available for the pi. All you have to do is install them. If you want something that can compile and run this code as is, the device you're looking for is called a PC.
The differentiation between the 8088 and 8086 was due to internal differences. 8086 is a 16 bit processor with an 8 bit data bus and the 8088 is an 8 bit processor
No, it's not. The 8086 is 16 bits internal and external while the 8088 is 16 bits internal but uses an 8 bit external bus to save costs on the board. The instructionset is x86 for both of them. You might have confused the 8088 with the 8080, which was 8bit.
Good grief, I remember linking SQL databases to Delphi with ODBC... epic times.
Same here
Neat! If only they released the master and translator, but oh well, still very interesting!
Don't think the translator just generated code, probably just created copies and switched out opcodes and stuff for the different CPUs, keeping comments and formatting intact...
AFAIK most of the main uPs of the day worked vaguely similarly enough for that to be possible?
What would you do with the translator? Do you have a PDP-10 to run it on?
@@stargazer7644 Moreso just software preservation and archival, etc
It seems interesting