Donkey – A computer game included with early versions of PC DOS
github.com
github.com
"The above simulation is configured for a clock speed of 4.77Mhz, with 64Kb of RAM and a CGA display, using the original IBM PC Model 5150 ROM BIOS and CGA font ROM. This configuration also includes a predefined state, with PC-DOS 1.0 already booted and DONKEY.BAS ready to run.
And now that PCx86 automatically saves all your changes (subject to the limits of your browser’s local storage), you can even close the browser in the middle of a game of DONKEY, and the next time you load this page, your progress (and the donkey) will be perfectly restored."
It's not surprising that this simulation of a 36 year old 4.77Mhz desktop runs fine in javascript on my 1.3GHz quadcore $40 phone... but in a way, it is.
If anything, this was likely a demo of Microsoft BASIC, let's not forget that Bill Gate's first product was not an OS, but rather a BASIC interpreter written in 1975 for the Altair 8800, written in assembly on paper tape, without the actual hardware! This was written a good 5-7 years later.
While some may not like Bill Gates, he was probably a better programmer than most of you in his youth and this was before the Internet where it's now easy to get access to books, screencasts and lots of sample code via github. Give the man his respect.
Promptly after switching I learned c and never looked back, but there's a lot to be said for what these early open-source (ykwim) games unlocked.
Hell, I started coding because I wanted to play games, and could only do so by copying them into a micro from a magazine (storage media was prohibited) - and fairly promptly wanted to cheat - and before I even really realised, was writing my own games and finding holes in the micro's interpreter that could cause entertaining crashes (I still fondly remember the look of panic on the geography (that was the nearest thing to computers, I guess?) teacher's face on coming into a lab (air raid shelter) full of vdus displaying a garbled mess).
So yeah, "bad" code can be great to learn from at an early level.
Comment complete, please proceed to downvote.
Who wrote more elegant software?
Who undercut the price of the other's software? And why?
Microsoft's early success was not due to originality.
Gates has no aesthetic. He has no respectable standard of quality.
Does anyone remember "Microsoft Bob"?
He may be worthy of respect by less capable programmers. He may be worthy of respect by the business community. He may be worthy of respect for his philanthropic efforts.
But for software users who have any insight into and appreciation of software quality, he has yet to earn any respect. For these users, he has only impeded progress. And Microsoft continues this tradition to this day.
It is perfectly OK to critique him on this particular point.
[Original title was something like "Gates wrote this beauty at four in the morning."]
"'We were just ahead of our time, like most of our mistakes,' Gates says of personal agents like the notorious Clippy character."
"Gates has a personal connection to Microsoft Bob -- more than it being just another product launched on his watch -- as his wife, Melinda French Gates, was a marketing manager on the Bob project."
http://www.folklore.org/StoryView.py?project=Macintosh&story...
I'd call it an honest, judgmental article.
Edit: I'm talking about the author throwing salt, not any of the posters here.
Donkey was a 'hello world' of graphics with basic, it wasn't a game. Even as a kid, playing it never lasted more than a few seconds. Critiquing it as though it's a serious game gives this code too much credit and makes Hertzfeld look bad too- taking it seriously is almost as funny to me as the game is. For what it is, a code example, having a better game would have detracted significantly from it's value.
On the PC there were a lot of fights about standard ways to do things that just worked on the Mac: Memory expansion (that was a whole industry right there), graphics, networking, mice. Even the CPU needed a turbo button to work correctly. Just about the only piece of the PC that universally worked and didn't beg for improvement was the keyboard.
So you can argue that the "crappy PC" spawned a bunch of industries to fix things, while the Mac, which was a lot closer to perfection, only spawned small businesses to satisfy niche needs. Apple nearly died in the 1990s because the alternatives finally caught up to them, a decade later, and Apple couldn't satisfy the computing industry alone. Still can't, doesn't try.
But I had a PC (256K, two floppies) and I had a Mac, and I sold the Mac because I couldn't develop software on it without going crazy (early Mac development was pretty painful; at one point I was seriously considering FORTH, and I hate FORTH).
While true, the quality of sound achievable this way is a matter of software. There are many programs that achieved excellent sound quality, playing music even with just a speaker and a TTL drive.
Remember, the simplest DAC is PWM into a low-pass filter.
The PC speaker didn't have PWM; it had a square-wave generator with adjustable frequency. Very few 1980s programs achieved anything even approaching decent sound quality using the PC speaker, although by the 90s, CPUs were fast enough that it was reasonably feasible. In the late 90s, I used to patch my Linux kernel with an unofficial driver that provided arbitrary PCM output via the PC speaker. It was glitchy if I left interrupts disabled during IDE disk accesses, which was the default at the time due to some buggy IDE devices that would sometimes corrupt data if you didn't. Fortunately, mine wasn't one of them.
I feel like PDM is just as simple as PWM and often gives better quality, and an R-2R DAC like a Covox is arguably just as simple as PWM and gives dramatically better quality. You need a few more pins, though, or a 74595.
I must be thinking of a different computer then. Perhaps my Radio Shack CoCo. I remember some small computer from the mid-late 80's producing really good music with just a logic output driving the speaker. Was sure it was the IBM/clone.
One of the nice things is that I have original cloth-bound IBM PC 5150 Technical Manuals in my basement so I can actually go look up the schematics of what's driving the speaker :-)
The PC was built to beep, and that's about it. Anything you got out of it past that was painful and used a lot of CPU.
I recall working on a Grey Import IBP Pc in the UK - Our electronics shop built an inverter to convert 240v to 110.
This is odd that these comments aren't in the github source code, is it missing something? Why does it starts at line 940?
940 REM The IBM Personal Computer Donkey
950 REM Version 1.10 (C)Copyright IBM Corp 1981, 1982
960 REM Licensed Material - Program Property of IBM 10 PRINT "1"
30 PRINT "2"
20 GOTO 10
What would print out? Just a bunch of "1"s or "12"s?The thing is that basic programs were not entered through a 2D text-editor per rather line per line. You would type "LIST" to re-read the whole program you typed so far, with the lines in the correct order. Then, you would enter a line starting with a number. It would overwrite any existing line with the same number.
Typically, a way to correct the program you wrote would be to type:
30
15 PRINT "2"
(replace the line 30 by an empty line, and insert a line number 15)
You can get around that with some flags, but its more of a pain than its worth.
We tend to go by hundreds for programs, and we have a renumber command, but using it is the nuclear option because it will break goto line number references from outside programs (yeah, that's a very common thing in this language)
The main application is decades old, and Providex provides a database of sorts, the language/runtime, a GUI toolkit, and the ability to run on windows, linux, and as a web app (you can use a "desktop" application written in providex in the browser, a great idea in principle, but with the cost of each user license of the language becomes cost prohibitive really fast).
So while everyone agrees that providex needs to go, that would mean replacing just about every single aspect of the company's core application GUI, language, database, even simple-ish things like the editor we use (which is built into the language) all need to be replaced. It's not an easy task.
We've started moving away, but it's going to take a lot of time, and a ton of effort. Right now we are still relying on the providex db stuff pretty much across the board (although i'm launching a new node.js+postgresql server in the next month or so), and we are slowly moving our hosted applications to more traditional web languages (we have some PHP, a bunch of javascript, and a little python).
But the language hurts. It is a combination of compiled and interpreted, so unless you jump through hoops files are saved in a binary format, and you can only use their editor. This also locks us into SVN as our source control, as it's the only VCS that providex supports (and even then, it's pretty bad support). There is virtually 0 tooling, nothing is open sourced, and it's really expensive. It's impossible to remove old code as there is 0 safety, any line can be GOTO'd or GOSUB'd by any other program at any time, and while new programs don't do that, the old programs that do are the ones that you want to refactor but can't. There are also programs where we are out of line numbers and need to resort to GOSUB "hacks" to add a line.
But it's not all bad. Being able to use a "drag and drop" visual editor to make a screen that will work on windows, linux, and the web is pretty nice, and having the DB so tightly coupled means stuff like upgrades/downgrades are pretty simple and don't involve multiple systems. It's also a pretty capable language all things considered (it has classes/objects, it's not as slow as i thought it would be, and it runs on anything without any modification).
SCREEN 9
LINE (100,100)-(200,200)
I only know processing that has this kind of ease of use. But any curious kid, given a BASIC interpreter and the LINE instruction will start drawing stuff around, naturally come to loops, and so on, without having to worry about the details of "real" programming languages.
FOR i$ FROM 1 TO 10 STEP 2
PRINT i$
NEXT
and get back 2, 4, 6, 8, 10, each on its own line.I don't remember a command to set the increment for line numbers, but that may be because I never used a BASIC which didn't either require a number on every line or not care about line numbers except as targets for GOTO and similar.
17 GOSUB 5500 LIST
command, the interpreter would return 10 PRINT "1"
20 GOTO 10
30 PRINT "2"
You don't have to type LIST to reorder the lines, that just shows the re-ordering to you. If you didn't type LIST, but did type RUN (with the "unordered" listing) the interpreter would run each line in sequence of line number.If you ran out of line numbers you could sometimes RENUMber the listing.
Here's Stackoverflow:
This question is marked as a duplicate: http://stackoverflow.com/questions/2435488/why-basic-had-num...
Here's the closed question it's marked as a duplicate of: http://stackoverflow.com/questions/541421/why-did-we-bother-...
char** lines = malloc(...);
lines[10] = &line1;
lines[30] = &line2;
lines[20] = &line3;
Then when executing, it starts at `lines[0]', sees nops, gets to `lines[10]' and runs it, sees more nops, gets to `lines[20]' and jumps to `lines[10]'. All the while ignoring `lines[21]' and up.http://xania.org/200711/bbc-basic-v-format
That's Basic V, which was the variant used on the ARM-based Archimedes, but it's the same file format as the 6502 machine Basics.
Note that the line numbers used by GOTO and GOSUB were specially flagged --- this was so the RENUMBER command could find them. It also meant that computed gotos weren't renumbered...
(Of course, BBC Basic had proper named procedures and functions with local variables, but all self-respecting Basics had to support GOTO and GOSUB.)
I escaped the "permanent brain damage" that Dijkstra complained about that era of BASIC producing, but I understand where he's coming from now and don't begrudge him the slight hyperbole. It was a language where there were so many accidental complexities that there was virtually no prayer of someone penetrating through to the essential issues, using Fred Brook's definitions of accidental/essential. You're not learning anything useful while you're manually renumbering lines because you used up everything between 15-20 and fixing up the GOTOs. (I never had anything with RENUM support.)
10 PRINT "1" 20 GOTO 10 30 PRINT "2"
The reason this is allowed is because it let you rewrite existing programs; if you later entered
10 PRINT "Hello World"
It would replace the original line 10 and use this one instead.
So you can see that they added the copyright and SAMPLES$ logic later.
This is the improved 1982 version.
http://www.pcjs.org/devices/pcx86/machine/5150/cga/64kb/donk...
But I learned to program by playing and modifying Microsoft Nibbles -- which is still my favourite snake game. And possibly my favourite Microsoft product.
And QBasic is still the only IDE that I ever really liked. Although there are some newer ones that I respect.
There's something about an immersive fullscreen coding tool with offline documentation built in.
The other environments I've really loved were Lisp in Emacs and Java in IDEA...
http://s3.amazonaws.com/scardigest/wp-content/uploads/Aston-...
https://i2.wp.com/farm7.static.flickr.com/6190/6095678527_cc...
http://sportscarcraftsmen.com/wp-content/uploads/2014/04/MGA...
Found from some rather more shady-looking sites, but it points back to download.microsoft.com, so I suppose it's legit.
But donkey.BAS was, which all those other things weren't, is my _first_, real introduction to programming. I was too young at the time to really recognize the value in being able to not only consume, but read the code, change it, learn from it. Unlike more polished games, I learned way more about programming from changing, breaking, and subverting donkey.bas than anything else on the PCjr. Sure, it wasn't _the best_, but it was the first time that someone pulled back the curtain and I was afforded a glimpse at what was possible, and what computers could _do_. Between that, pouring through the "Hands On Basic" book[0], and typing in basic programs COMPUTE magazine, I'm not sure that I'd be a programmer today, as hyperbolous as that sounds...
And some overly nostalgic part of me kind of misses doing PEEKs and POKEs in physical memory and the summer I spent learning binary math because I didn't understand the relationship between the AH and AL registers of my 286 years later. Then I go back to writing CRUD applications in whatever javascript library is the flavor of the month.
I just hope that kids today have the same access to shitty, but accessible, chunks of code to help inspire them and show them what the machines they interact with everyday are really capable of.
[0]: http://www.brutman.com/BasementCleanout/IBM_Hands-On_BASIC/H...
There's a lot of shitty but accessible examples now, and a lot more ways to get them easily. If anything, it's harder now to pick a platform/device/language because there are so many choices. My kids won't put down their iPhone games long enough to read code examples, even though they talk about wanting to program.
[1] https://drive.google.com/file/d/0Bxv0SsvibDMTYkFJbUswOHFQclE...
So much so, I remember writing program for solving quadratic equations.
They were supposed to clear the calculators memory during exmas, but the exam invigilators had no idea what calculators could do, so they didn't.
I'd like to think it wasn't cheating... as writing quadratic solver in TI basic is harder than solving simple quadratic equations. And I did do them all by hand anyway in the exams...
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
http://www.cs.virginia.edu/~evans/cs655/readings/ewd498.html
The second line of code I ever wrote was in BASIC :
goto 10 10 GOTO 10
RUN
Oops. No way to recover without power cycling the computer. I remember Commodore brought their product to an early computer show, and all the annoying nerds (like me) kept entering that one-line program into the demo computers, much to the annoyance of the nearby sales critters.And it wasn't possible to patch that quickly, since BASIC was in ROM. They probably had a fix about 12 weeks later.
For expert BASIC code see Nibbles.BAS:
[1]: https://en.wikipedia.org/wiki/Hercules_Graphics_Card#CGA_Emu...
Unless we do something exotic we're probably going to predict 25 as the point estimate of {24, 25, 26}.
60 - 36 = 24 <- Bill Gates age when he wrote this.
Shortly after that we got a PC at home and it came with a demo copy of EGA Golf which I think only had Pebble Beach. Sound quality was similar.
A couple of interesting features of the game (quotidian to those of us around at the time, but...)
1. The "PLAY" statement is barely used; the sounds are mostly done with the SOUND statement, maybe in part because they are being generated randomly. In fact it seems to be used only to verify that the program is being run on a BASIC interpreter that supports "advanced" features like DRAW.
2. The "DRAW" statement, which has its own mini-language similar to that of the "PLAY" statement. Later these were dubbed "Graphics Macro Language" and "Music Macro Language", even though neither one allows you to define macros. This is used to include vector graphics of the donkey and the racecar in the program, in the subroutines on lines 1940 and 1780, respectively. But the interpretive rendering of these vector graphics (and especially the flood fills, lines 1900 and 2010) was too slow to want to do it every frame; instead it's done at program startup (into an on-screen buffer, since that's the only way to do it in GW-BASIC or BASICA; you can see the painting happen briefly before the game starts) and stored in the arrays CAR% and DNK% with GET statements, later to be PUT onto the screen in the right place each frame. There's a bit of sloppiness there: CAR% is DIMmed right there in the subroutine on line 1910, while DNK% is DIMmed up at the top on line 1470. (And the sprites for the halves of the donkey and car are dimmed there too, along with a planned sprite called Q% which is never used.)
3. There's actually an additional sprite, B%, which isn't set up with a GET statement; it's filled in "by hand" to a simple fill pattern on lines 1510–1530. My memory was saying that the data format of this array was undocumented, but it does seem to be documented in http://www.antonis.de/qbebooks/gwbasman/, which I'm pretty sure is the actual GW-BASIC manual from Microsoft. Anyway, B% is a vertical line that's getting XORed into the framebuffer (the default PUT raster op was to XOR into the framebuffer, violating patent 4,197,590 if you use it for a cursor) to make the stripes down the middle of the road "move".
4. See how AND is being used as a bitwise operator? That's why true was -1 in MBASIC.
I think there are some important lessons in GW-BASIC/BASICA about how to design user interfaces for end-user programming, and the DRAW and PLAY statements in particular. Also, I can't have been the only person who never figured out how to use the vi-like line editor in BASIC-80 but who edited existing code all the time in Z-BASIC/GW-BASIC/BASICA because I could just use the arrow keys.
If you see a submission with a very bad title in the front page, you can ask the mods to change it with an email to hn@ycombinator.com
It's usually faster to use the email because sometimes the comments are unnoticed.