Hacker News new | past | comments | ask | show | jobs | submit login
The BASIC Issue with Retro Computers (hackaday.com)
106 points by rbanffy on Nov 22, 2016 | hide | past | favorite | 138 comments



If you're interested in BASIC, there's an open source BBC Basic V interpreter:

https://sourceforge.net/projects/brandy/

(Also in Debian.)

BBC Basic is one of the best BASICs ever, featuring things like named procedures with local variables, structured programming, etc. Basic V, which Brandy simulates, is effectively Comal.

But you don't have to use any of that stuff if you don't want to, and all the old favourites like GOTO, GOSUB, ON GOSUB etc still exist. (Along with a handy RENUMBER command for when you run out of space between lines 140 and 150.)

I recently found an ancient program I wrote as a teenager in BBC Basic II --- I'd submitted it to a computer magazine to be printed in an issue (and then they rejected it). If you want to know what BBC Basic II looks like, here's an example.

http://cowlark.com/2015-02-03-bbc-micro

Edit: cut-n-paste tyop.


Wikipedia mentions that "One of the unique features of BBC BASIC was the presence of an inline assembler"; how does Brandy deal with that? Does it offer inline x86 asm, or does it emulate classic 6502?


Good question --- I just looked it up. Alas, no, it's not implemented at all. It doesn't even support CALL (but it does support BBC Basic's equivalent of PEEK and POKE).


"I agree BBC BASIC is excellent, particularly in having structured programming support."

Found this in the article comments. What happened to the BBC BASIC language? Is it still available, in source?


Well... the original BBC Basic was originally hand-written in 6502 assembly for the BBC Micro; it's a 16kB application ROM. Later versions were rewritten for the 65C102. The extra opcodes available freed up some space and they added a few more features, and made it even faster (and BBC Basic was already one of the fastest 8-bit Basics around). I don't believe that any of the 6502-era Acorn sources were ever released, which is a shame, as Acorn's MOS was one of the best 8-bit operating systems around.

Basic V was a complete rewrite for the ARM. In hand-tooled ARM machine code, also by Sophie Wilson. The source for this is available from the CVS archive here: https://www.riscosopen.org/content/downloads/cvs-access But trust me, it won't help. I've debugged my way through it. It's very... hand written.

Oh, yes: there are also ports of BBC Basic IVish to the 8086 and the Z80 by R.T. Russell: http://www.bbcbasic.co.uk/bbcbasic/bbcbasic.html He wasn't associated with Acorn, as far as I know. The 8086 version (for Windows and DOS) is commercial, but the Z80 version (for a variety of CP/M machines) is a free download. Not open source, unfortunately. His version even includes 80186 or Z80 inline assemblers, depending on the version. His Z80 port was licensed for a variety of machines --- Amstrad made a range of Z80 notebooks with his Basic in ROM. I've used all his versions, and they're superb.


Locomotive BASIC - which was shipped on the Amstrad CPC range of micro computers - was heavily influenced by BBC BASIC. It made switching between the CPC 464 and BBC Micro really easy.

The other variation of BASIC I used a lot in the 80s was Microsoft BASIC on the Commodore 64.

dim personalopinion$ = "Frankly I think the C64 was over hyped. Sure it had the popular MOS 6510 rather than the Z80 as used by the BBC Micro and Amstrad CPC range, but the Amstrad CPC had a more vibrant display, built in cassette player and, most importantly to me as a programming kid in the 80s, a far superior port of BASIC than Microsoft BASIC was."


"The source for this is available from the CVS archive here: ... But trust me, it won't help. I've debugged my way through it. It's very... hand written."

First computer ZX80, so I missed the BBCM.

Thx @David, the reason I asked was I was interested to see ^how^ it was written, but probably more to the point, what made it good? Sounds like speed was a loved feature. Was there ever a API or documentation made public?

Reason: want to hack a language together a BASIC-like language (are of use) for graphics.


Well, there's an annotated disassembly here:

http://acorn.huininga.nl/pub/docs/sourcecode/Acorn/BASIC%202...

AFAIK there wasn't anything particular magical about it --- it was just written well, with great care. Programs were stored in tokenised form, where each keyword was reduced to a byte, and line numbers in things like GOTO statements were stored preparsed, but execution happened directly from the tokenised form. Named procedures were faster than GOTOs because the interpreter would cache the address of the line where they were defined, while GOTOs would have to search for the line; variables were stored in a hash table; there were two stacks, one for GOSUBs and one for PROCs (the GOSUB stack was much smaller!); there was a superb 5-byte floating point library...

It's also worth mentioning that Acorn's MOS was in a different ROM, so it didn't have to share space with Basic. The two communicated via a system call interface. I've seen people run BBC Basic on entirely different 6502 machines by reimplementing the system call interface.

I would not recommend writing this style of Basic if you want a simple language these days. Basics are a nightmare of ad-hoc parsing with too many edge cases. Better to write a modern byte-compiled language with a byte interpreter --- you'll end up with something much cleaner and easier to understand. We're not all Sophie Wilson.


"I would not recommend writing this style of Basic if you want a simple language these days. Basics are a nightmare of ad-hoc parsing with too many edge cases. Better to write a modern byte-compiled language with a byte interpreter --- you'll end up with something much cleaner and easier to understand."

thankyou for these suggestions.

"We're not all Sophie Wilson."

agree, very talented individual.


> want to hack a language together a BASIC-like language (are of use) for graphics.

One of the coolest ones was AMOS for the Amiga.


Now I see why BBC BASIC is liked.

It was created by Sophie Wilson FRS FREng, while at Cambridge as a student over a summer break on a 6502 micro processor. Wilson also designed the Acorn System 1. [0],[1] Also a portable C version of BBC BASIC is available. [2]

[0] https://en.wikipedia.org/wiki/Sophie_Wilson

[1] https://en.wikipedia.org/wiki/Acorn_System_1

[2] https://en.wikipedia.org/wiki/BBC_BASIC#cite_note-11 and

http://mdfs.net/Software/BBCBasic/


The port of RISC OS for Raspberry Pi contains a BBC BASIC interpreter:

https://www.raspberrypi.org/blog/risc-os-for-raspberry-pi/

I think you hit F12 and then type 'basic' (no quotes) at the prompt to get to it.


thx @Fr0sty I'm mighty impressed with the RISCOS effort. You can even purchase dev manuals in print. Must fire this one up on a Pi at home. This would be a good start.


It's part of RISCOS, so yes.


Try TurboBasic / QuickBasic


Another fascinating concept of old computers is about 10 years before FOSS and about 30 years before github we used to buy strange telephone book sized tomes with titles like "Journey to the Center of the ROM" and they were commented disassemblies of the rom that shipped with the BASIC from the linked article, for example. On the theory that you'd learn yourself a little something by studying how an "old timer" with 2 or even 3 years of Z80 assembly experience wrote a basic interpreter, because you were a noob with like 6 months experience. And they had similar books for other system software like various disk operating systems (not the IBM product from many years in the future)

Coolest thing about those books is they're up on archive.org just like the article's BASIC books.

Now... one thing to realize is bits cost money back then so self modifying code was "clever" not insane. And an old timer having maybe two whole years of experience meant that the code probably looks extremely amateurish today. But, it worked, and back then the only way you got to patch bugs was to sign a contract for new masked roms and then physically install them, in other words it didn't happen, so its a good thing we only had 4K eproms and so on because that's only 4K possible things to be a bug, um, sorta. Kids these days don't realize in the old days software was like un-upgradable firmware today. Some dude screws up the key debounce routine in the rom of your TRS-80 model I, well you better like it that way, or like patching manually after very reboot...

Something I was just thinking about today is noobs today must have it extremely rough being dumped into advanced data structures and RTOS and interrupts and multithreaded programming and GUI interfaces right at the start. In the old days life was easy because stuff you wouldn't understand as a noob didn't exist, or at least you could mostly ignore it. Nobody got confused about MALLOC memory on a TRS80 until they knew what it meant and why they wanted it because it was a model 3000 running linux 1.0, but in 1981 the whole topic couldn't confuse noobs because it wasn't there.


Nowadays, you can still ignore: while you're so low down on the stack that you don't have to worry about that stuff, new newbs don't have to worry about that stuff because they're too high up the stack. Many new newbs learn javascript, so not only are they upstack, they still have to deal with the "joy" of re-writing the display by hand every frame.

And I should know, because I was one (although I learned python, and never got into the graphics stuff).


The 3000 never ran Linux: http://articles.orlandosentinel.com/1986-03-15/business/0200...

but maybe you were thinking of Xenix on the Model 6000? The 6000 had a System3 variety of Xenix with the Z80 as an I/O controller and a Motorola 68K as the CPU.


If you're interested in old computer programming, Usborne recently released downloadable PDFs of their childrens' computing books:

https://www.theguardian.com/technology/2016/feb/10/programmi...

In addition, I wrote an article for Commodore Disk User on interrupt requests some 25 years ago and was pleasantly surprised to see that the magazines are available on the Internet Archive:

http://alblue.bandlem.com/2012/04/first-published-article.ht...

http://archive.org/details/commodore-diskuser


I grew up with these books! And 80s computer magazines too (UK Spectrum mags in my case though, but also C&VG). Thanks for the links.

I loved to get Usborne books as presents or go to the library every week to see if they had any new ones. Still have a few, including one which I couldn't see on the website. Maybe I'll check and email them about it.

I was at the computer museum in Swindon (UK) last week. It's a small museum but they have among other things a couple of Sinclair machines and a C64 set up for people to play with (type in BASIC or load games from tape/disk/cartridge). I attempted to type in a simple program to draw a coloured pattern onscreen from one of the books provided, but I'd forgotten how to type some of the Spectrum's more obscure shift-keyword combinations and after 30 years of progressively nicer IDEs the 48k BASIC editing interface was quite frustrating. Still, good for nostalgia.

Would recommend to micro nostalgists if you're in the area, although it's possible to look at everything they've got within an hour so probably not worth driving much more than that for.

(I suppose I could donate my Usborne books and magazines - if I could bear to part with them...)


I keep thinking of ways to get my kids involved with computers in a more intellectual way. The oldest likes the gamified programming with blocks but has no real desire to explore further. He has been interacting with iPod touches or iPads since before he could walk. I think it was a mistake in retrospect.

Just the eagerness to get your hands on a computer is hard to describe today. Studying the ads in magazines. Hanging around electronic stores. Riding bikes miles to friends who were more fortunate. Even today looking through an old Byte magazines at obsolete hardware almost has me salivating.

I know that today there has never been more capable hardware, more available, more affordable and with the level of help and documentation that we have on the Internet. But it is still hard to let go of the 80s. It was a time when kids with no Internet or peers to help would spontaneously disassemble ROMS and hand code asm. I had two television channels which played no more than an hour of content a day of any interest and the only console game we had was a Pong made from a kit. Although the primitive nature of old computers helped their learnability the lack of distractions was also helpful.


If they play Minecraft, there are some very cool modpacks that you can install which add programmable computers into the world, eg:

http://www.computercraft.info/

http://technicpack.wikia.com/wiki/Forth_language


Get him into Zachtronics games: start with Spacechem. Then give him TIS-100. Then give him a micro (of some sort).

Hope that helps.


Try Techcompliant. Where you can use an 8 bit computer to control a spaceship or a whole space station.


...hang on a minute. AFAICT, that's another 0x10c spinoff.

If you don't know, 0x10c is a (semi-famously) aborted game project by Notch, which was was known for its 8-bit DCPU computer, which would control your spaceship. Techcompliant seems to be one of several continuations of the concept.

I'm pretty sure Project Trillek is the most active continuation project, but this also seems worth looking at.

Until they're done, though, you can pay TIS-100, or backdate your mincraft to 1.2.5 and install RedPower2. Or you can wait for RedPower3, the game of that mod, which goes in a similar direction.


Actually, scratch that. Trillek is less active. Hopefully, Techcompliant is good. I wouldn't know, because there's no way to actually get the game.


I was less than 10 years old in the sea house we rented in August here in Sicily, 1986 or alike. ZX Spectrum connected to the TV, and me working to make a point moving with the arrows on the screen, a problem that was for me unsolvable. Then, suddenly, I realized that I could updated a var in terms of itself: X = X + 1. A whole new world opened in front of my eyes.


Back then computers came with real manuals and tutorials.

My family bought a 48k ZX Spectrum for Christmas one year, and the tape-deck didn't work. So no games for my sisters and I. Instead I started programming via the orange programming guide/documentation. My sisters lost interest until we could get a working cassette player a few days later.

From BASIC to z80 machine code - again via the documentation - was a great start.


Yeah... there was no internet, and in my case, no local group of users, so either the manual or it was impossible to use it :-)


And don't forget to overwrite the old dot after you draw the new one :) (was it OVER or INVERSE?)


OVER; INVERSE was used to swap INK and PAPER :)))


I grew up in the 2000s: No assembly hacking for me. And even if you learn assembly, you're essentially just doing a C compiler's job.

...Which is why I'm building a Z80 machine. It won't be complicated (no monitor, just a DB9 cable connected to a Z19 (and yes, I have a Z19: my father's actually)), but it will be programmable from the ground up. It will be something that I can learn from.

But no way am I implementing BASIC. Sorry, it's complicated and not actually all that good a language. So I'm implementing FORTH. Simpler, and the stack might be a pain, but I'll learn something from that, too.


I wrote a Basic interpreter once (for Infocom's Z-machine). Holy cow, that's an ugly language to parse. It's all ad-hoc rules and heuristics and endless weird edge cases. It just wasn't fun.

Forth's a good choice, and will teach you lots of assembly, but it's not really a compiler, and Z80 Forth's been done to death.

But... and I should point out that where I am it's half past midnight and I'm going weird and random... if you want an off-the-wall but useful language to do an actual compiler for, you might want to check out B. It's like a typeless simplified C (although it's really the other way round), and is eminently suited to tiny architectures.

Tiny example:

http://www.99-bottles-of-beer.net/language-b-1247.html

x86 B compiler written in C, containing links to the language reference:

https://github.com/aap/abc


>Forth's a good choice, and will teach you lots of assembly, but it's not really a compiler, and Z80 Forth's been done to death.

The Z80 itself's been done to death. If I wanted to go super far off the beaten path, I'd build a 6809 computer (something I actually do want to do, but it's hard to get 6809s). But this is good, because I can base it largely on other's designs, which helps me get to the software bit faster (which is the part that actually excites me), although I will have to make some modifications. This is also good because I suck at electronics. Hopefully, I may suck a bit less by the time this project is done, but that's not the point, really.

But yes, a B compiler might be fun. I'm sure I can at least take it as far as assembler. Mind, it will probably suck, but I'm fairly confident I can make it work.

Provided, of course, that I put in the effort, which isn't a given: a lot of what I set out to do doesn't happen, because I got distracted by something else. The comparison to Leonard of Quirm is obvious, but unfair: he's a genius, and fictional: I'm real, and no genius, just easily distractable.


Yes, fair enough; you should do what you want to do, not what I say you should do. But I like compilers, so... (And the B compiler is beautifully simple and is probably really easy to port.)

Re Forth, you might be interested in this:

http://fruttenboel.verhoeven272.nl/Langs/ace.html

It's an annotated disassembly of the Jupiter Ace ROM; the Ace was a ZX80-like Z80 machine which was unique among the 8-bit computers in that it had Forth in ROM rather than Basic. It's a beautiful implementation, and includes everything from keyboard mapping to the character generator to an interactive Forth sort-of-IDE.

Also, there's no modern 6809 variant? There ain't no justice.


Thanks for the tip on that!

As for the 6809, it was out of production for a while. But allegedly, Rochester Electronics is making new ones now. They even seem to have them, if you look on their site. However, they won't sell them to you.


You can get used pulls from Jameco, Unicorn Electronics or eBay.

AFTER you finish your z80 thing, of course.


Oh, and the RS08 and 68HCxx are the modern 6809 offshoots, and they're still in production, but they're not quite the same as the 6809, and the 68HCxx's days may be numbered.


Oh. Thanks.

But neither of them really scratch the 6809 itch: They're closer to the 6800 and the 6502, whereas the 6809 was closer to m68k.


A few years back I too built my own Z80 based machine, and considered FORTH, but ended up writing a LISP-like language for it, including (very primitive) turtle graphics. You could do things like:

  (define (square n)
    (repeat 4 (fd n) (rt 90))
  )
  (square 50)


I could never do this. Because I would want a real Lisp. And that means things like GC.

Do you want to implement GC in 64k?

Also, I don't know compilers super well. And you have to know compilers to actually write an efficient lisp. I plan on learning that, at some point, but while I'm also writing an OS (or at least a monitor) for a Z80? Nope, forth it is.


Yes, my LISP(-like) did have a primitive GC.

The heap consisted of fixed 4-byte cons cells (2 byte car, 2 byte cdr). The cdr value was assumed to always be a pointer, which meant that since the cells were aligned at a 4-byte boundary, I had a few spare bits to implement mark-and-sweep GC and track which data type the car value was (number, atom, list or function).

Edit: I got curious and dug up the code. The entire GC code is less than 100 lines of Z80 assembler (admittedly some of the hairiest code in the interpreter, though)


Huh. Not so bad after all. Ah well.

The other problem becomes space efficiency, but that's not unsolvable.


> Do you want to implement GC in 64k?

Why not? The IBM 704 had around 18k and yet it was good enough for a full Lisp system.

Sometimes I think that people don't really grasp how constrained the computers using Lisp, Smalltalk and memory safe systems programming languages were and yet those systems were already there running, being used to doing actual work.

Somehow C's adoption has created a strange distortion of what those computers were actually capable of, in spite of their resource constraints.


Yeah, but the 704 was a 36-bit machine, and was otherwise well-suited to the task.

Still, I might give it a shot. Once I get the damn thing working, that is.


Those BASICs have GC in <= 64K. (Well, for just character strings.)

How about that IBM 704 from which we have the terms CAR and CDR?

"The 737 Magnetic Core Storage Unit had 4,096 36-bit words, the equivalent of 18,432 bytes and served as RAM."

[Wikipedia]


I didn't say it was impossible. But do you want to implement it?

Besides, the 704 had some helpful features the micros didn't. Also, it was a 36-bit machine. That's a massive advantage.


If I could relive the 80-s, that might be something I would work on.


There actually was a Z80-based computer with built-in FORTH rather than BASIC -- the Jupiter Ace (1982). It was just too weird for the general public, though and didn't do very well.

https://en.wikipedia.org/wiki/Jupiter_Ace


I know. There's even instructions for how to build one online (http://searle.hostei.com/grant/JupiterAce/JupiterAce.html, the very site that I used as a basis for my design, no less) But that has (gasp!) a screen, and while I could no doubt program it (with some trial and error, because I suck), I very much doubt I could actually build it. Maybe if this design works (dubious, but perhaps eventually), I'll give it a shot.


I agree with you. I so wish that the microcomputer culture was based on Forth rather than BASIC. BASIC is a terrible language, but people do like it more than Forth for some weird reason.

(I started on ZX Spectrum in late 80s. If it had Forth, it could fit twice as much stuff into its ROM than it actually did.)

But, we live in a world where Javascript is having Haskell for a dinner. So I am not really sure why I am surprised.

(On the other hand, at least Python is a decent language, even though Lisp should have won in that particular space.)


In case you haven't seen it, Factor is a modern FORTH-like language:

http://factorcode.org/

Funnily enough the most I've ever played with FORTH was inside of Minecraft on an in-world computer:

http://technicpack.wikia.com/wiki/Forth_language


I am aware of Factor, although I believe that conceptually, FORTH can only work in small systems. In a larger system, you can afford yourself something like Haskell (or at least Lisp) and the extensibility and proximity to hardware of FORTH will diminish in value, while the disadvantages will remain. In other words, with a bigger machine, you can go with more abstract language (distancing from hardware but keeping the extensibility), because the compiler/interpreter can be made more powerful.

I also played with FORTH mostly in Minecraft Redpower 2 (but before that I also read Jones Forth, which is excellent), unfortunately, to prove my original point, people didn't like it and longed for BASIC.


Ah, RP2. On of the finest mods that ever came out of the fantastic modding scene around Minecraft. It was one of the four foundational mods in the scene: BuildCraft, IndustrialCraft (and later IC2), Better Than Wolves, and RedPower2.

Sadly, RP2 is dead, and with it the RP2 computer model, the likes of which will likely never be seen again (for those not in the know: most mincraft mods adding computers of some sort essentially allow scripting in some HLL, and maybe a primitive DOS-style prompt, akin to ComputerCraft. Not so in RP2. RP2 computers were actually full emulated 6502s, with a FORTH monitor built in (although you could, of course, write your own). This should give you an idea of what made RP2 so special). Except not quite, because Eloraam is now working on RP3, which will actually be its own game, because she got sick of putting up with MC's limitations. Knowing Eloraam, it will be done by 2030.


Related to RedPower: OpenComputers. While it does come with Lua as the default OS / platform but it has support for arbritary computing architectures - both real and fake. I'm not sure if any has matured to the point of RP2 though (I know someome at least attempted a 6502 architecture at: https://github.com/gamax92/ocsymon)


Forth is still used in places like the bootstrap of FreeBSD 11.

* https://github.com/freebsd/freebsd/tree/release/11.0.1/sys/b...

Some people want to replace this with Lua.


I can't believe how very much I can relate to the first 5 paragraphs of this post. It hits home at very core of what (unknowingly at the time) formed the basis of my career.

I started on the VIC-20 (for which I traded in my old, but working Fairchild Channel F, Doh!) and then moved up to a C-64. One of the first games I had came on cassette tape, was written in basic and at a certain point... you'd hit a syntax error... fixing that bug was my introduction into programming in early Junior High School. And to the point of those opening paragraphs, I remember the Programmer's Reference Guide for the C64 included schematics for the computer.

The limited nature of the BASICs that came in ROM also very much forced me to learn fundamentals of computing that I appreciate to this day. If you wanted to draw circle on the screen you had to perform bitwise operations with the screen memory using "PEEK" and "POKE"; there were no fancy "CIRCLE" or "DRAW" commands. At the time, my friends had computers that could do those things, but the extra effort with my computer had pedagogical value that continues to pay dividends today.


> One of the first games I had came on cassette tape, was written in basic and at a certain point...fixing that bug was my introduction into programming in early Junior High School.

In a similar vein, the first games for my Apple II were in Basic on tape, and I figured out how to cheat at them by changing parameters in the code.


If I could start learning BASIC on a ZX81 at the age of 7, I'm pretty sure anyone can. This is the era that got me into computers, and hopefully with the Pi and similar programmable devices available that are aimed at educating kids, that time will come again.

There's even a new version of the ZX Spectrum on it's way. http://www.specnext.com/


...Or, you can just build a ZX80/ZX81: http://searle.hostei.com/grant/zx80/zx80.html


Our ZX81 came in a kit, so in essence I already did (with a lot of help).


Oh. Heh.

I guess things really don't change.

Except now you have to buy it piecemeal.


Thanks for the info on the spectrum next. If you google github for spectrum fpga you can find some ports of the 48k to Cyclone FPGAS. I guess they are reusing some of that work.


Being dumped straight into a BASIC interpreter after boot was huge to get kids interested in computers. ZX Spectrum was that way, and it is the reason I am a computer programmer today.

It wasn't much code but you had to write a one-liner at least:

   LOAD ""
Then you figure, "What other stuff is there?". Oh you could modify memory to get infinite lives in games and such so you find out about PEEK and POKE. You could go as advanced as you wanted. Wrote my own assembly interpreter. There was a C compiler, a Pascal one. If it crashed, had load everything from tape again.

I remember writing and selling my first program when I was 13. My friend's dad ran an semi-legal broadcasting company showing dubbed American movies to a few apartment blocks in the area, so I wrote a program to display the schedule and movie summaries before movies started. As payment I took a cassette tape with music on it, probably something like 2Unlimited or similar ridiculous thing. No regrets though...


30 years later I still remember: POKE 23659,0

I got my start on the ZX Spectrum, as you say hacking games for infinite lives. First of all cracking the tape-based protection system (bleeplock, speedlock, softlock, movieload etc), then the games themselves. I guess I was lucky in that a lot of these protection systems were evolving as I was working on them. Jumping in to the more advanced system without having experience of naive protections that were available even six months beforehand would have been impossible for me.


The one I remember besides LOAD "" is

   RANDOMIZE USR 0
Also come to think of it, my ZX Spectrum (a Soviet clone of it really) was probably the reason I learned English. All the games and programs were in English, wanted to devour all that info so I learned a new language as a side-effect.


If there's anything that can make you realize how vast the computing resources we have at our disposal are, it's the fact that 1970's and 80's era 8-bit computers, running BASIC programs, even though this was hundreds of times slower than running machine-code programs, were still considered very useful tools.

Outside of high-speed games, the principal complaints that people had back in the day with running BASIC programs had very little to do with the execution speed and more to do with the memory, tooling and display limitations of the platforms they were working with.

It's a great miracle that now, in the modern age, we've managed to build up such intense piles of abstraction that it's not unusual to see a machine capable of billions of operations a second perform as fast as a machine capable of millions of operations a second that was also running BASIC code.


The problem was that BASIC was your first step in this progression:

1) Program in BASIC--realize that you can't do everything that other programs can do

2) Program in BASIC with Peek/Poke and USR()--realize that you still can't do everything that other programs can do

3) Program in Assembly--realize that you can now do everything other programs can do--and programming is painful.

I was lucky to be on a TRS-80 Color Computer and had William Barden producing excellent books and articles for it.


I distinctly remember this book after my Z80 adventures:

https://archive.org/details/Color_Computer_Assembly_Language...

I also remember "leveling up" going from edtasm cartridge pack to Microware OS-9 and being pretty well blown away, like today going from edlin or GNU-nano to suddenly emacs. Whoa...


I am forever grateful that I happened to start with the Color Computer: the 6809 was the best introduction to assembly available at the time.

So far, I haven't done any Z80 or 6502 programming.

And as much as I love the 6809, I'm super happy to ARM machines to play with now.


You forgot that 3) for many of us actually meant using hexdumps with DATA, and not an Assembler. :)

I never managed to get money for an Assembler for the Timex 2068 I had.

By the time I could afford them, I was already using a PC.


While we're sharing BASIC stories, middle school me was like "wait, hmm, I can take a 'long' number, take the cosine of it, and get a 'shorter' number. COMPRESSION!" It was then that i learned about how a computer stores floats, and essentially a bit about entropy. I then started to really understand floats when I tried to use cosine as an encryption function and then all the lost precision became obvious.


As a kid I always wondered why my Amstrad computer turned all keywords in a listing to Uppercase...

... years later I figured out they were coding internally every basic keyword into a lookup table, thus saving your precious 64kb of RAM. The Spectrum did the same, but they didn't have to parse the strings: you had to type the correct key combination to actually write the sentence (does anyone remember spectrum k,l,c, and e cursor modes?)


And speeding the program up, too: because each line had been tokenised on input, the interpreter's work at runtime was much less.

I miss my Amstrad.


"In no other era could a title like “Machine Code For Beginners” have been a children’s book."

This is so, so true. I cannot even imagine such a book for kids or even teenagers now. Something was lost when computers became powerful and boring.


...Really? I'm a teenager now. I'm actually learning z80 assembler. And GBZ80, which is actually closer to 8080.

I don't know if I'll ever manage it, but that's not because it's too hard, it's because I famously never finish projects.


Modern x86 assembly would probably fill a dozen thousand-page tomes...


Classic x86 (16 bit) not was hard to understand. The most problematic is the segmentation system. But beyond of it, it's very straightforward.

I got some knowledge from one of the Norton's book.


Well, yeah. Classic x86 was a well known instruction set. Not so for modern x86.

Segmentation still sucks, though.


...Which is why nobody actually knows x86. Yet another reason it sucks. Also the reason I'm not trying to write x86 code.

I mean, seriously Intel. Memory Segmentation? Yuck. And that's just the tip of the iceberg.


If you think x86 sucks (and I agree), how about learning ARM or MIPS or SPARC instead of Z80? Or if you want to stick with oldschool, maybe m68k.


Several reasons.

-Simplicity: The Z80's instruction set is dead simple, and thus easy to wrap your head around.

-Availability: Z80 chips are dirt cheap (and if you want to build a computer around it, designs are readily available).

-Ease: As a new assembler programmer, Z80 assembler is considerably more high level than, say, 6502 assembler.

-Other Factors: GBZ80 is hugely useful, especially to me, because I've got a Gameboy.

Some of those other architectures are on my list as well. Like m68k (and its cousin, the 6809): if only I could still buy the chips. 6502 isn't on your list, but it's on mine.

Also, ARMv4T, for the ARM7TDMI: GBA hacking could be fun.



What, what machine is this? Trillek?

oh my god, they're still working on it!

Well, this is very exciting.


Well, you could just make use of the ARM chip on your mobile phone and besides some boilerplate code to start your own Assembly code, do some ARM demos. :)

But yeah, GBA coding is also cool.


My phone runs Android. I shudder to think of the boilerplate involved.



Thanks! But it wasn't the prospect of the assembly that scared me: Android's Java API is a disgusting mess that I would happily never touch again for as long as I live.


Which is why even if it sounds foolish, I have more fun with UWP than Android.


I'd buy that. As much as I hate Microsoft, they have a much more fun ecosystem to work in than Android's (or so I've heard). C# isn't my favorite language, but there's less brain damage than there is in Java.


Not only C#, all the OS APIs are available to all languages including C++, not the half baked NDK experience and everything is compiled to native code on the store before downloading into the devices.

Not like the great idea from Google to do AOT on the device itself, which was so good that had to create an hybrid solution on Android N.


Oh. I didn't know that, and that sounds great. Or at least, way better than the NDK

I would gladly switch to a platform other than android for my smartphone, but as bad as Android is, everything else seems to suck more.


Reasonable enough. Good luck. I think your efforts will be rewarded.


BASIC was an awesome language to get started with. It's simple to learn and gives a quick feedback loop that you're making progress. People obsess about teaching beginners good principles from the start but forget if it's too unforgiving to begin with you'll drive a lot of people away.


Yeah. Dijkstra got that one wrong.


There are few things in our industry better than seeing someone pick up an old 8-bit machine and doing something amazing and cool with it, using modern processes and even tools. If you think you're an elite hacker but you've never written a scrap of 6502 code, you've got some distance to the end of the race yet, young 'un. Get out there and get yourself a real computer.

And remember this, always: old computers never die. Their users do!


You've probably seen these but I thought I'd mention them anyway.

https://www.youtube.com/watch?v=H1p1im_2uf4

https://www.youtube.com/watch?v=MWdG413nNkI

Piece de resistance: https://www.youtube.com/watch?v=gdb3AQ14iVc (live cheering FTW) / https://www.youtube.com/watch?v=hNRO7lno_DM (capture card copy)

The credits in the 3rd video are an excellent example of using modern tooling. (How this was done has been documented online and is easy to find; it did take some cheating to do it but it's still awesome.)

Hrm, the SID music in https://www.youtube.com/watch?v=-mgtY2326Y0 is also amazing (this demo was on two floppies, I particularly like the music in the 2nd part which uses a distinctly different theme) and very obviously produced by modern tools too. (Note, that video is a 50fps capture and uses a real SID.)


Nice links, thanks for that!

My favourite aspect of the modern 8-bit movement is watching the development of this Blakes 7 game for the Oric-1/Atmos games .. we Oric nerds are getting some real treats these days, which seem to really push the machine beyond what we expected in the 80's, and that is surely nice. Just check out the smooth animation and clever use of colours in this demo, for example:

https://www.youtube.com/watch?v=OskowiQuDzQ&t=39s

Interesting note: OASIS is the game/script/content engine created for the purpose of making games like this on the Oric systems. How amazing we have such tools for such an obscure device, even today!


Wow, 1MHz.

That demo looks pretty cool and rather refined, yeah - the colors are indeed well-balanced. The galaxy sidescrolling does appear to be pushing the machine's limits; with that in mind the mouth animation is very smooth. I'd admittedly add at least one extra mouth-movement frame and randomly switch between them for more realistic lo-fi animation, I'd make the text sequences advance about 25% faster, and I'm not sure if the text was traditionally at the top but I kept looking for it at the bottom (where subtitles/closed captions usually live).

OASIS sounds interesting, but I'm unsure where to find more info on it. Very amusingly, when I googled "oric-1 oasis", your comment on here was among the search results! http://i.imgur.com/4HUICdo.png

Also, for other interesting things that fit in 1MHz: https://www.youtube.com/watch?v=QUN5CSWiLaw



>Get out there and get yourself a real computer.

Ironically, this is what hackers from the world of Big Iron (MIT LCS, MIT AI, and MIT MDL (much of which would later become Infocom's Imps and hackers), most famously) said to micro users at the time.

What an irony, that HN is full of kids who grew up on Micros, and yet the culture is a direct descendant of the LISP and UNIX lab cultures of old, whose hatred of micros was legendary.


All the Big Iron hackers I used to know (and got my grommet wings rubbed by) are dead now. :(


...That's sad.

I really don't know what else to say.


Well, their computers are probably still out there, humming away. At least, in my mind they are.


These days, of course, a micro is what a CSAIL hacker of 1983 would have called an ultrasupercomputer. Even a Raspberry Pi has amazing storage, I/O and computing capabilities.


Obviously. But GP was talking about the micros of the 80s.


I recently did a similar thing with a Spectrum emulator and zasm. As I kid I completely failed to teach myself Z80 machine code, but trying again now with way better tooling it was surprisingly easy and a whole lot of fun. I actually enjoyed the 8bit assembly experience. The feeling (on 8bit machines) that the whole computer is deterministically comprehendible was a change.

I then started looking at what i386/AMD64 assembly looked like to teach myself that, and quickly decided to back away :)


ARM kind of has a chance though, right?


Possibly, although I imagine any kind of 32bit (or 64bit) assembly on top of an OS is likely to not have that 8bit fun factor.


BASIC was kind of nice, I liked to program simple adventure games on it. Too bad I never really figured out arrays and DATA statements, that would have helped immensely with getting more complex things done.


Indeed, I can remember trying to make some kind of space game that declared data like this:

  LET PLANET1$ = "Earth"
  LET PLANET2$ = "Mars"
  LET PLANET3$ = "Venus"
  ...
  LET PLANET45$ = "Sirius"
And rendered its amazing 16-color EGA screens like this:

  PSET 0, 0, 7
  PSET 1, 0, 5
  PSET 2, 0, 6
  ...
  PSET 200, 150, 5
Drawing those pics required some patience for sure. After all that effort, I had no idea how to make them move.


I, too, wrote entire games as a kid without knowing what an array was. :shudder:


I remember that QBasic/TurboBasic, had a instruction to move blocks of screen applying some basic bit blit like XOR, AND, etc. There was example of animated ball using it.


The discovery of arrays was one of the most amazing moments in my young programmer education. That and if/then and gosub/return. Paradigm changers!


For me, it was nested loops.


I felt like I'd stumbled into some sort of Bond villain's lair when I discovered PEEK and POKE in the BASIC manual for my TRS-80 Model I.


I discovered this for my Model III one morning, and my parents couldn't pull me away to leave for school. I had to try each one! You could change the shape of the cursor, the cursor blink rate, and even display a clock in the upper-right! That was a good day.


Ah the nostalgia of reading the entire guide to BASIC that came with my first computer, an Amstrad CPC6128. (Aside: The A in Amstrad stands for Alan and the S for Sugar, as in Lord Alan Sugar).

The days when it was possible to learn and memorise the entire built-in library of a programming language. I never did work out how to implement a linked list in Amstrad BASIC though.


I was surprised when finding my aunt oldest daughter Amstrad, that it came with a BASIC manual. I did not expect this to be marketed a programmable, more like game / word processor appliance. Also had a modem slot. I can't imagine what it would be to network in the 80s on such hardware.


It was terrific. I used my Amstrad CPC to dial up to bulletin boards: Preston ROS, Aspects BBS, Supe's Motel. Aspects was known to be one of the best in the UK, and it was consequently the devil's own work not to get the engaged tone.

Early on, connection speed was 300/300 or 1200/75. Later I ended up writing my own terminal program, because I picked up a 2400 baud +compression modem from somewhere, and none of the existing software was fast enough to do the resulting speed of 4800 baud without dropping characters. To get the speed it had to talk directly to the UART in the serial interface, and then write the bitmaps directly to screen: no firmware calls anywhere, they were too slow. Heady days.

FWIW I don't think any of the 8-bit Amstrads came with a built-in serial port. But they were certainly available as add-ons for both the CPC and PCW.


My memories are blurry, but I clearly remember how surprised I was seeing mentions of modems on the manual.

Got me to do a little youtube digging : https://www.youtube.com/watch?v=3WPMq80wYFY


Ah, that's the Pace serial interface there. Yes, I remember that one.


Top comment mention a wifi board made recently. Retrofuturism.


That model didn't come out until '84. I was on Compuserv at 300 baud by then. It was expensive. Like AOL but for a CLI. It always felt rather DEC, kinda VAX-ish, because... (and no it wasn't run on VAX but it shared common corporate culture)


It was run on PDP-10s!


https://youtu.be/wDTt7Pw-4GM shows the Minitel system. It used an asymmetric 1200/75 modem.

Also, the movie "23" has some very accurate depictions.


I thought about that just submitting. The difference is that a Minitel is a closed system. You're only a client. Other than that I agree.

ps: oh you meant http://www.imdb.com/title/tt0126765/ not "number 23" .. interesting.


Home computers, especially cheap ones, were always marketed as programmable: it was a hobbyist market. If you wanted to do word processing, you'd have bought a CP/M machine.

As for the modem slot, it was quite common to have dial-up BBSes at the time. You can probably imagine.


I don't know, as a Kid all we saw was games, games, games. As soon as the machine was unboxed, we inserted the disk and type RUN. We never heard the name BASIC anywhere, except maybe in passing while booting.


Erm... I think you might have been in the minority on that.

Wait, what computer were you even using?


Alan Michael Sugar TRADing!

(See also TESsa COhen.)


His middle initial is M; so AMS is his initials. The trad is a contraction of trading - so Amstrad is AMS Trad(ing).


Check the BBC Micro User Guide [1] for a very quick example of why so many of us that got computers at that time got into programming. By page 5 you're writing code (after the info on how to plug it in). Lines, colours, and sounds by pages 6 and 7. Page 168 is program optimisation techniques. Page 428: "An introduction to assembly language" ... 6502 assembler, amazing. That guide inspired me (aged 10) to start writing games, and gave me a career!

[1] http://bbc.nvg.org/doc/BBCUserGuide-1.00.pdf


Wow you guys were coddled. I had a hard time finding good Spectrum info in an ex-YU backwater, mostly just piecing it a bit at a time from magazines.

If I got access to something like Stack Overflow back then I think I would have fainted.


Well, there's always FreeBASIC, though it's more inline with QBasic and its derivatives. Can do some nice things in it, and there's support for C libraries.


Oh my... so many good memories. The best part of the article was to find this link: https://usborne.com/browse-books/features/computer-and-codin.... There's one of the books that I used to teach myself how to code when I was a kid. So many good memories :)


I still have this on my shelf! :D


> They printed listings in the magazines, and enthusiasts would laboriously type them line by line into their machines.

Guilty!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: