Live data from Hacker News

The original source code of Microsoft GW-BASIC from 1983

devblogs.microsoft.com

221–230 of 272 posts

Re: The original source code of Microsoft GW-BASIC from 1983

#221
post #162

Earlier quoted context omitted.

Mentioned it in another reply, you'd probably want to start with the MASM and LINK from the MS-DOS 2.0 release. https://github.com/microsoft/MS-DOS/tree/master/v2.0/bin

Unfortunately, I can't get MS-DOS 2.0 to run in DOSBOX ("Invalid COMMAND.COM") and running MASM.EXE directly gives me some really interesting errors (looks like it's reading uninitialized memory). I think you're on to something here, though!

Good job! I'm going to throw some cycles at this, this holiday weekend.

https://github.com/lpsantil/GW-BASIC

Re: The original source code of Microsoft GW-BASIC from 1983

#222
post #99

Earlier quoted context omitted.

Microsoft BASIC was all over the place in the late 70's and early 80's. Before MS-DOS, Microsoft was basically a programming languages company (and they still are today). They licensed their BASIC to many other companies, even Apple. https://en.wikipedia.org/wiki/Microsoft_BASIC

And I think most if not all MSBASIC ports for early PC's had a memory leak if you did not break out a FOR loop in the right way. I am a bit rusty but this sows the problem: 10 L = 4720 FOR I =1 TO 1000 STEP 2 30 PRINT I% 35 IF I = l GOTO 6999 40 NEXT 6999 STOP What you needed to do was set I to the end condition as part of the break out of the loop. There was also a lot of aggressive compression done to reduce progra…

There was a bug in the TRS-80 basic (which was indeed Microsoft). It had an "on x goto" command that allowed the program to move to different lines depending on the value of a variable:

ON X GOTO 200,300,400,500 depending if x=1, x=2,x=3...

They'd obviously used the same parser for the standard "If a=1 then goto 200" construct, which allowed an undocumented shortcut of "If a=1, 200" which a few people noticed and started using. However, a later model fixed this, which broke a number of programs.

Re: The original source code of Microsoft GW-BASIC from 1983

#223

Earlier quoted context omitted.

And I think most if not all MSBASIC ports for early PC's had a memory leak if you did not break out a FOR loop in the right way. I am a bit rusty but this sows the problem: 10 L = 4720 FOR I =1 TO 1000 STEP 2 30 PRINT I% 35 IF I = l GOTO 6999 40 NEXT 6999 STOP What you needed to do was set I to the end condition as part of the break out of the loop. There was also a lot of aggressive compression done to reduce progra…

There was a bug in the TRS-80 basic (which was indeed Microsoft). It had an "on x goto" command that allowed the program to move to different lines depending on the value of a variable: ON X GOTO 200,300,400,500 depending if x=1, x=2,x=3... They'd obviously used the same parser for the standard "If a=1 then goto 200" construct, which allowed an undocumented shortcut of "If a=1, 200" which a few people noticed and sta…

ooh I never worked on TRS80's - so they had a version of the Arithmetic IF :-)

I could have Told BillG that was bad idea back when I was 19

Re: The original source code of Microsoft GW-BASIC from 1983

#224
post #56

The funny thing about this announcement is that a week ago I just found my old QBASIC textbook that I learned how to program with back in 1998. QBASIC was my very first programming language; I was a nine year old kid who loved computers and would read anything computer-related that was available, including my mom's textbooks (she was returning to college at the time and took some courses on computing and applications…

> There's nothing like the joy of programming for the very first time

The first time I had an idea of what programming was, was when I saw my brother trying to explain to me that the window had code that ran it. Of course, I ignored him...

We later did Delphi at school, which was maybe a crazy pedagogical decision. The only thing I would say pedagogically useful was that you wrote PUBLIC and PRIVATE for variables, but C or Java has that for functions.

One way in which I would say my fascination differed is this:

> the realization that you can create something that works with code

A lot of programmers mention the ability to write concrete instructions as their first realisation. OP is closer to my experience, but to me the a-ha moment was more surreal: It is strange to me, even today, how a computer can even exist at all. I often refer to that when I think the world is unstructured.

So, things like NAND gates (and fully homomorphic encryption) are almost mystical; more generally, I feel like computers are something of a vindication for mathematics that started in the Renaissance. Things can be mystical and mundane at the same time. There is a joke about this along the lines of a specific type of medical doctor, but I don't think I can post it here...

Re: The original source code of Microsoft GW-BASIC from 1983

#225
In 1985, I was developing a simple serial network for barcode readers, to run on the original IBM PC. It needed to run as a TSR (Terminate and Stay Resident) assembler routine and use the 8250 UART chip, and the 8259 Programmable Interupt Controller.

At that point the only documentation we had access to was the IBM Technical Reference Manual, which gave the schematics and BIOS listing, but little else.

I was very familiar with GW-BASIC and had written some BASIC code to use the RS232 serial interface from it, so decided to reverse engineer GW-BASIC itself, to work out how it was addressing those chips.

A month or two later, we came across Peter Norton's "Programmers Guide to the IBM PC", which could have saved us weeks.

Exciting times.

Re: The original source code of Microsoft GW-BASIC from 1983

#227
post #89
post #56

The funny thing about this announcement is that a week ago I just found my old QBASIC textbook that I learned how to program with back in 1998. QBASIC was my very first programming language; I was a nine year old kid who loved computers and would read anything computer-related that was available, including my mom's textbooks (she was returning to college at the time and took some courses on computing and applications…

Borrowed mine from the library at age 13 (`98) when i got a hand-me-down Apricot from a friend. https://en.wikipedia.org/wiki/Apricot_Computers

I ran accounts on an Apricot for a year or so. It was actually an improvement over the PC, using software fonts etc, and the spanking new 3.5" diskettes. I don't think it was 100% compatible and sadly didn't do particularly well.

I'd forgotten about the cool little LCD display until I looked up your link to it.

Re: The original source code of Microsoft GW-BASIC from 1983

#228
post #6

This is great! But it makes me think that Microsoft need to add a BASIC compiler as standard in all Windows distributions. They did that Small Basic thing a while back, but it was too encumbered in .NET-isms, a kind of Visual Basic .NET lite. It would be great if there was just a easy to understand BASIC that you could hack away with that could produce interesting programs without the .NET cruft or the barrier that i…

It's too bad Microsoft QuickBASIC isn't a thing anymore. Who didn't love GORILLAS.BAS?

Who did write GORILLAS.BAS?

Re: The original source code of Microsoft GW-BASIC from 1983

#229

Looking at this source code I'm astonished by how many lines of code it is. I've never written more than the most basic (ha) of assembly language programs in my lifetime. How does all this assemble into a 60k binary?! Also, wasn't it true that Steve Wozniak was able to bootstrap the entire Apple I BASIC in hexadecimal from his own memory? How can that be? I'm reeling.

Each line gets translated down to a few bytes, maybe two to ten depending on the opcode. The downside being that each line doesn't do a whole lot.

And I can imagine that this is an absolute ear pull to try to debug with the tools they had. It's more akin to debugging embedded systems to the PCs we have today.

Re: The original source code of Microsoft GW-BASIC from 1983

#230
post #167
post #57

Earlier quoted context omitted.

Expectations of complexity were much less in those days. Like, a programming language that is limited to 40 character variable names would be considered amateur hour, but back in the day it was prolly considered luxuriant. Also given the memory constraints, it also limited the amount of complexity you could put in your code.

More than luxuriant. Commodore BASIC (effectively 6502 Microsoft BASIC under license with tweaks) on the C64 only looked at the first two characters of variable names. It allowed them to be longer (don't remember how long), but would ignore subsequent letters.

This is getting off-track, but while the pitfalls of two relevant characters out of potentially many are obvious and only excusable due to technical limitation of the platform, insisting on more than 40 relevant characters is likewise contraproductive. Who (which human) will readily distinguish two character strings more than 40 characters in length sharing the first 40?

I feel often the need to remind programmers, that they don't write code for the computer. The computer will make it obvious, whether it understands you or not. You write for the poor sod tasked to maintain your code three years from now, when you're at your next gig.

Post reply on HN