News for hackers. Stuff that matters.
Re:The original source code of Microsoft GW-BASIC from 1983 by linguae on Thursday May 21, 2020 @09:08PM (#23267661)
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 such as WordPerfect and Lotus 1-2-3) and software manuals. When we finally got Internet access in 1998 via AOL, I used the message boards to get resources on how to program. I was recommended to learn QBASIC, and I was told that QBASIC could be found on the Windows 95 install CD. I remember initially learning QBASIC through some web tutorials. My mom happened to have a friend who recently took a QBASIC programming course; her friend gave my mom her QBASIC textbook, which my mom then gave to me.

I'm now a researcher at an AI lab in Silicon Valley, and I just finished a five-week stint as a section leader for Stanford's CS106A "Code in Place" introductory Python course (https://www.stanforddaily.com/2020/05/07/students-instructor...). There's nothing like the joy of programming for the very first time, the realization that you can create something that works with code. Teaching those sections as well as finding my QBASIC book has reminded me of the feelings that I have from when I started learning how to program roughly 22 years ago. This release of GW-BASIC was quite timely for me.

Re:The original source code of Microsoft GW-BASIC from 1983 by kriro on Friday May 22, 2020 @05:04AM (#23270035)
I also started with QBasic (with no internet connection). Built a small choose your own adventure. Then I wanted to build a "password program" that would ask for a password before you could get "into the computer". I heard somewhere (schooljard) that you can put so called exe files into a file called autoexec.bat and they would start first. Alas QBasic could not build these magical files. I wnt to a store that had computer books and software in their music CD section and saw a huge Turbo Pascal book. It came with a floppy disk that had Turbo Pascal on it and 12 year old me was sitting on the floor of this store in front of the pop music CDs of the day and leafing through the book to see if you could build exe files :P

Lots of begging parents later I owned the book, struggled through it and build some small things. The interesting thing is I never programmed that much but was always fascinated by what amazing things existed. I guess I mostly liked reading about technology and using it a bit. I then mostly went through a phase of playing games on the family computer, completely destroying it when I tried to install Suse-Linux from a CD from some magazine (I was still very young and didn't fully understand what an operating system even is but the article made it sound very cool). My next phase of interest was when I discovered the Llama book and O'Reilly books in general. Programmed some Perl, picked up some other languages but never really build anything worth noting. And then the last experimental phase was when I stumbled upon "Smashing the stack for fun and profit" and into the huge field of computer security. Went through a lot of "crack mes" etc. and just had a fun time. After that I started to understand how things worked a little more and went about it in a more structured way that eventually lead to a CS-ish degree. But I still have the fondest memories of the time when I basically knew nothing and was just fiddling around and then pooof sometimes cool stuff happened, sometimes stuff broke :P

So yeah tl;dr...if it wasn't for stumbling onto Basic some day I might have never gotten interested in anything related to computers.

Re:The original source code of Microsoft GW-BASIC from 1983 by efreak on Friday May 22, 2020 @11:57PM (#23279785)
4.5 definitely had a compiler in it, as did later versions (after the first time I found 7.1, I stopped using the others). I should note that I'm not up to speed on the difference between QBasic and QuickBasic, though--so far as I know they're the same product, but there might be differences.

My favorite program for autoexec just had an infinite loop until you hit Ctrl+C.

Re:The original source code of Microsoft GW-BASIC from 1983 by salamanderman on Friday May 22, 2020 @01:31PM (#23274675)
I asked my dad, who programmed in C for work, to teach me how to program, but he was a bit too tired after work, and compilers weren't free back then. Instead he pointed me to QBasic, thinking I'd goof around with it for a little while and probably move on to the next thing. One day I pulled him in to show him a wireframe 3d graphics program I'd written, you could rotate simple models around, and he went "oh no, I'm so sorry, you've learned too much QBasic. I'll teach you C". I remember using GWBasic as well, but I don't think I made anything more than little Choose Your Own Adventure-type stories, i.e. a few if statements.
Re:The original source code of Microsoft GW-BASIC from 1983 by codebolt on Friday May 22, 2020 @12:30AM (#23268640)
My first attempt at coding was with a Java Programming For Dummies book around the Java 1.1 era, using applets. That was a terrible choice for 12 year old non-native english speaking me, and I never got too far.

Somehow I ended up trying QBASIC a couple of years later and programming suddenly became a lot easier and fun. I especially loved that you could easily switch to graphics mode and just start drawing pixels and lines to the screen, it was like the perfect blank canvas to try out different ideas for a curious young mind.

Re:The original source code of Microsoft GW-BASIC from 1983 by dTal on Friday May 22, 2020 @07:21AM (#23270868)
Alas, that easy graphics programming environment - so critical to my early engagement with programming as well -is nowhere to be found. Even in the Python ecosystem, nothing approaches the simplicity of "SCREEN 12" and immediately being able to use POINT, LINE, CIRCLE etc.
Re:The original source code of Microsoft GW-BASIC from 1983 by int_19h on Friday May 22, 2020 @11:23PM (#23279602)
Python ecosystem is precisely the one that does approach this level of simplicity, because it has turtle graphics out of the box. Here's one complete example from the docs:

   from turtle import *
   color('red', 'yellow')
   begin_fill()
   while True:
       forward(200)
       left(170)
       if abs(pos()) < 1:
           break
   end_fill()
   done()
Re:The original source code of Microsoft GW-BASIC from 1983 by kragen on Saturday May 23, 2020 @12:55AM (#23280023)
This does "approach the simplicity of "SCREEN 12" and immediately being able to use POINT, LINE, CIRCLE etc.":

    #!/usr/bin/python
    from pygame import *
    pantalla = display.set_mode((0, 0), FULLSCREEN)
    draw.rect(pantalla, 128, (50, 100, 200, 400))
    display.flip()
    time.delay(2000)
That's from https://github.com/kragen/pyconar-talk/blob/master/helloneg1.... There are some more examples in that directory. They use PyGame, though, which isn't installed by default like POINT.

By default Python comes with Tkinter, though, which lets you do this:

    from tkinter import *  # or Tkinter in Python 2
    w = Tk()
    button(w, text="Not OK", command=w.destroy).pack()
That's a fuckload more than you can do graphically in GW-BASIC.

For graphics, though, you're better off in JS and DHTML. In http://canonical.org/~kragen/sw/dev3/tweetfract.html I have an HTML canvas which renders a fractal if you click on it, in 140 bytes:

    <canvas onclick="c=this.getContext('2d');
    function d(x,y,k){c.fillRect(x,y,1,1);
    (k/=2)>1&&(d(x,y,k),d(x,y+=k,k),d(x+k,y,k))
    }d(0,0,150)">
Moreover, if you put that on the web, you can link anyone in the world to it, and they can run it just by clicking the link. And you don't have to start that complicated; this works too:

    <b onclick='this.style.color="red"'>DO NOT CLICK ME</b>
You don't even need a server; you can put that into the address bar of your browser as data:text/html,<b onclick='this.style.color="red"'>DO NOT CLICK ME</b>.

LÖVE2D comes with a bunch of simple examples, like https://github.com/love2d-community/LOVE-Example-Browser/blo...:

    -- Example: Loading an Image and displaying it
    --[[Description:
    Load an image using love.graphics.newImage(image_path)
    Draw it using love.graphics.draw
    ]]

    function love.load()
        image = love.graphics.newImage("assets/love-ball.png")
    end

    function love.draw()
        love.graphics.draw(image, 400, 300)
    end
LÖVE is programmable in Lua, like Minetest and WoW, and it gives you rotatable, alpha-composited 2-D sprites with collision detection and particle systems.

But Proce55ing is the paragon of this stuff. http://sketchpad.cc/, which uses processing.js, starts you off with this:

    // Pressing Control-R will render this sketch.
    int i = 0; 
    void setup() {  // this is run once.   
        // set the background color
        background(255);
        // canvas size (Integers only, please.)
        size(300, 300); 
        // smooth edges
        smooth();
        // limit the number of frames per second
        frameRate(30);
        // set the width of the line. 
        strokeWeight(12);
    } 

    void draw() {  // this is run repeatedly.  
        // set the color
        stroke(random(50), random(255), random(255), 100);
        // draw the line
        line(i, 0, random(0, width), height);
        // move over a pixel
        if (i < width) {
            i++;
        } else {
            i = 0; 
        }
    }
That just fucking blows away anything I ever created in years of messing with GW-BASIC. And sketchpad.cc lets you edit your code in real time with someone else, and also save a link to the sketch you've made so that anyone else can see it. Still, I translated it to Python for my talk about this stuff at PyCon Ar (https://github.com/kragen/pyconar-talk/blob/master/hello1.py):

    #!/usr/bin/python
    from pygame import *
    from random import randrange

    pantalla = display.set_mode((0, 0), FULLSCREEN)
    ww, hh = pantalla.get_size()

    color = Color(64, 64, 192)

    for xx in range(0, ww, 5):
        h, s, v, a = color.hsva
        color.hsva = xx * 270 / ww, s, v, a # cambiar hue

        draw.line(pantalla,                 # surface
                  color,
                  (xx, 20),                 # punto de inicio
                  (randrange(ww), hh - 20), # punto de terminar
                  10)                       # ancho de rayo
        display.flip()                      # para mostrar
Maybe the biggest environment for this kind of thing nowadays is Roblox, which has a couple of million people writing games in Lua in a 3-D world. It's not free software, but neither was GW-BASIC at the time.

Eat me, GW-BASIC.

Re:The original source code of Microsoft GW-BASIC from 1983 by dirtydroog on Friday May 22, 2020 @04:24AM (#23269815)
I think I had the same book!
Re:The original source code of Microsoft GW-BASIC from 1983 by wuxb on Thursday May 21, 2020 @10:33PM (#23268157)
I wrote my first line of code on a game console without persistent storage. Coding is everything that makes computer a computer.

Now, some kids in college have an impression that coding is less relevant for a CS career.

Re:The original source code of Microsoft GW-BASIC from 1983 by jcims on Friday May 22, 2020 @12:34AM (#23268664)
When I was a kid my brother and a friend and I would spend hours punching games into a C64 out of the back of byte or compute magazine. We would work in shifts, one typing, one reading, and one proofreading to make sure what was said is what showed up on the screen. Usually by the time we were done it would be 4 a.m., so we would play the game for a little bit and then carefully tuck the C 64 in the corner so nobody would trip on the power cord. We didn’t have the floppy or tape drive, so the game only would live for as long as the power was on.

Good times. The best was when there was a typo or a bug or it just didn’t work. Esp. the machine code that was just pages of hex.

Re:The original source code of Microsoft GW-BASIC from 1983 by weej on Thursday May 21, 2020 @11:28PM (#23268405)
"Computer science is no more about computers than astronomy is about telescopes." - Edsger Dijkstra
Re:The original source code of Microsoft GW-BASIC from 1983 by ecpottinger on Thursday May 21, 2020 @11:50PM (#23268477)
Yes, then I had a computer science student who lost three years of work because he never made a backup of the files on his mac computer.

Learning nothing but theory can come back to bite you some times.

Re:The original source code of Microsoft GW-BASIC from 1983 by mrunkel on Friday May 22, 2020 @01:31AM (#23268931)
LOL. I had three graduate students (PHd CompSci candidates) working for me back at UMass. I come around the corner to see them all clustered around one of the PCs. Apparently one of the graduate students had slid a CD-ROM between two of the blanking panels instead of opening the CD-ROM tray. They were trying to figure out where the CD had gone.

After a chuckle, I showed them how to open the case and retrieve the CD.

Re:The original source code of Microsoft GW-BASIC from 1983 by edejong on Friday May 22, 2020 @01:58AM (#23269068)
That quote is misattributed and I also think it is not something Dijkstra would have said. Quite the opposite actually. However, I think this quote from him is much more beautiful:

In their capacity as a tool, computers will be but a ripple on the surface of our culture. In their capacity as intellectual challenge, they are without precedent in the cultural history of mankind.

(Turing award lecture, 1972)

Re:The original source code of Microsoft GW-BASIC from 1983 by dreamcompiler on Friday May 22, 2020 @08:53AM (#23271491)
He did say it because I heard him say it. The sentence just before was: "Our field should be called 'Computing Science' rather than 'Computer Science.'"
Re:The original source code of Microsoft GW-BASIC from 1983 by tosers4 on Friday May 22, 2020 @09:25AM (#23271758)
In my language most university courses/majors are actually named like that. Common names: "Ciências da Computação": Computing Science "Engenharia Informática": (Informática is usually translated as computer or computing science, or just computing) CS Engineering Less common: "Ciencias dos Computadores": Computer Science "Engenharia Informática e Ciências dos Computadores": I bet you can translate this one
Re:The original source code of Microsoft GW-BASIC from 1983 by C1sc0cat on Friday May 22, 2020 @09:51AM (#23272041)
Dijkstra probably assumed that you would have the programming chops and language knowledge.

As our second best DBA did when I worked at BT - he had worked at NPL and Dijkstra was his boss

Re:The original source code of Microsoft GW-BASIC from 1983 by Soulsbane on Thursday May 21, 2020 @09:18PM (#23267732)
QBASIC was also my first programming language. Learned it my Senior year in high school computer programming class back in 1995.
Re:The original source code of Microsoft GW-BASIC from 1983 by redorb on Thursday May 21, 2020 @10:28PM (#23268133)
I still have the Qbasic for dummies book my good friend lent me probably 20+ years ago, back then I was playing with Qbasic even though it was old

I remember changes the variables in the gorilla banana toss game that came with qbasic ~ first time seeing changes in programming changing the game and it was magical.

My friend ended up being a great programmer and I'm doing e-commerce front end / project management work. Great times and I'm thankful for the experience

Re:The original source code of Microsoft GW-BASIC from 1983 by criddell on Friday May 22, 2020 @08:05AM (#23271200)
Mine was TI-99/4A BASIC. I wish I had a printer back then because I probably would have printed out some of my programs and I'd love to see what they look like today.
Re:The original source code of Microsoft GW-BASIC from 1983 by lioeters on Friday May 22, 2020 @09:58AM (#23272100)
As a child, I grew up with BASIC and Turbo Pascal. Your comment made me wonder, which version of BASIC that was.

It turns out, I was using N88-BASIC(86), developed by a Japanese team. Reverse-engineered from N88-BASIC to run on 8086 processor, and produced bytecodes compatible with Microsoft's GW-BASIC, which was released around the same time.

> There's nothing like the joy of programming for the very first time, the realization that you can create something that works with code.

That's so true. I'm thankful that I had use of a computer as a toy, essentially, and the joy I found in creative programming carried me far into the present. I'm not in the education field (at the moment) but would love to, as I get older, to do my part in passing down the torch, to inspire younger people to feel the magic. In my current role at a company, as part of the leadership, I also try to find, share, and encourage that joy.

Re:The original source code of Microsoft GW-BASIC from 1983 by mikorym on Friday May 22, 2020 @11:16AM (#23273005)
> 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 by int_19h on Friday May 22, 2020 @11:30PM (#23279632)
C doesn't have "public" and "private" at all. Java has them for both functions and variables (so long as they are members), as does Delphi. The only difference between the two in that regard is that Java requires visibility on every declaration, while in Delphi using the keyword sets it for all following declarations, until another keyword changes it.

On the whole, I don't see a problem with doing Delphi (or Free Pascal + Lazarus) in school, especially if students have studied Pascal earlier - it teaches them many of the same concepts they'll later see in the likes of Java and C++, and it gives them powerful tools to create "real" GUI apps. There are better options these days, but it's not the worst one.

Re:The original source code of Microsoft GW-BASIC from 1983 by mikorym on Saturday May 23, 2020 @07:34AM (#23282105)
You're right about C; I forgot that Java added it.

I think that Delphi could be a good language to teach in, but in practice it doesn't seem to be. You lose a lot of students along the way that feel it's irrelevant. In classes where you have a really good teacher they would add in "modules" of their own, irrespective of whether the syllabus makes sense or not. Often, however, a class barely gets through the standard workload to start off with.

Re:The original source code of Microsoft GW-BASIC from 1983 by weq on Thursday May 21, 2020 @10:58PM (#23268278)
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

Re:The original source code of Microsoft GW-BASIC from 1983 by igravious on Friday May 22, 2020 @03:39AM (#23269587)
Just realised we have Apple computers, Apricot computers, Blackberry phones, Raspberry (Pi) computers – is there some kind of fruit obsession in IT I've missed out on?
Re:The original source code of Microsoft GW-BASIC from 1983 by pbhjpbhj on Friday May 22, 2020 @08:50AM (#23271470)
There was Apricot too, https://en.m.wikipedia.org/wiki/Apricot_Computers.

And Cherry made peripherals/components, https://en.m.wikipedia.org/wiki/Cherry_(keyboards).

I guess such names make for simple logos.

Re:The original source code of Microsoft GW-BASIC from 1983 by igravious on Saturday May 23, 2020 @05:12AM (#23281397)
I mentioned Apricot :)

Cherry, yes – good catch!

Re:The original source code of Microsoft GW-BASIC from 1983 by pmyteh on Friday May 22, 2020 @05:20AM (#23270117)
Tangerine computers too, back in the day, Acorn (technically a fruit)...
Re:The original source code of Microsoft GW-BASIC from 1983 by ngcc_hk on Friday May 22, 2020 @07:08AM (#23270789)
Apple from Beatles and for years Apple cannot release any music from Beatles to avoid confusion of the brand name (of Beatles).
Re:The original source code of Microsoft GW-BASIC from 1983 by Starwatcher2001 on Friday May 22, 2020 @11:41AM (#23273274)
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 by cabaalis on Friday May 22, 2020 @08:44AM (#23271430)
I recently found my copy of the Precomputer 1000 manual that I learned BASIC with around 1993. It's now mounted in a shadow box!
Re:The original source code of Microsoft GW-BASIC from 1983 by npongratz on Friday May 22, 2020 @09:46AM (#23271998)
That's awesome! I enjoyed my Precomputer 1000 so much when I started digging into the BASIC module, that I experienced my first bout of insomnia when I was in second grade (around age seven). Earlier that day I had discovered the trigonometric functions, and they fascinated me so much that I obsessively spent hours running different numbers through them, individually and in combination. I didn't understand trig at that age, so I didn't know that significance of the calculations, but I knew I wanted to develop an intuition for them.

That night as I tried falling asleep, the numbers and functions were all I could think about, preventing me from sleeping. It scared me, but I knew that excitement would lead to something interesting someday. It did: I can trace my academic work and career directly back to that experience with the Precomputer 1000.

To this day, I try to limit my bedtime reading to fiction, because when I read technical non-fiction, I get too hopped up on knowledge to want to fall asleep.

Re:The original source code of Microsoft GW-BASIC from 1983 by OOPMan on Friday May 22, 2020 @02:56PM (#23275601)
I started with QBASIC too.

Except I'd learned Speccy Basic from an Usborne book (Prior to getting access to a real computer) and as a result some parts of my programs failed to work correctly (usually stuff around PEEK and POKE)

It was a while before I worked out that the issue was :-)

Re:The original source code of Microsoft GW-BASIC from 1983 by markandrewj on Friday May 22, 2020 @12:01AM (#23268519)
I have a copy of the GW-Basic 3.2 user manual, and the MS-Dos 4.0 manual under my desk at the moment. I think they are still pretty common books, I mainly hold on to them for sentimental reasons.
Re:The original source code of Microsoft GW-BASIC from 1983 by schwartzworld on Sunday May 24, 2020 @06:04AM (#23290480)
If you love QBASIC you might be interested in the qb64 project.