Showing posts with label retro. Show all posts
Showing posts with label retro. Show all posts

Tuesday, 10 February 2009

Reflection: 6502 assembler

I intended this blog to be part technical and part anecdotal, this post I feel probably falls into both categories at once.

Back in the day when I were a lad etc etc and other grammatically incorrect cliches pertaining to a time only about 12 years ago, I was studying an A-Level in electronics under the Welsh Joint Education Committee exam board. The course was split up into 5 modules:

  1. Basic digital electronics
  2. Basic analogue electronics
  3. Slightly harder digital and analogue electronics
  4. 6502 assembler
  5. Communications
  6. A project
Okay so I can't count... anyway you can guess the vague areas studied in each: 1. Logic gates, boolean algebra, karnaugh maps and so on; 2. resistance, capacitance, diodes, transistor switches and amplifier circuits, RC circuits etc; 3. capacitor charge and discharge, diode characteristics, a/d and d/a converters; 4. 6502 assembler 5. yeah y'know radios, tv's, all the stuff I'd covered in my radio amateurs exam at 14 years old (yawn). 6. I made a guitar tuner... phase locked loop... I won't even go into it here.

You may have noticed something here, 4. 6502 Assembler ... umm ... I've no idea whatsoever why this was included in the course - there's a miriad of exciting bits of electronics out there to cover but no, there it was 1 whole terms worth of assembly language - wow!

The way our practicals work was that we sat down infront of a base unit connectd to a central computer and got assimi... no sorry, wrong reality again, ... got tested on a bunch of multiple choice questions. The great bit was that the whole practical could be carried out on the same unit which looked like one of those yamaha O2R digital mixing consoles without any over the twiddly knobs on top - instead we normally had a prototype board on which we could just plug components in to build up whatever circuit we required.

Module 4 supplied a basic motherboard with a 6502 processor, a socket for an eprom (dead flash - we had a battery unit for ours so we could actually retain work on it!) and even an io port. But the best part was a 16 key hex pad and a 6 x 8 segment led display - old skool!

So how did it work? You had to figure out what you wanted to do - I mean exactly what you wanted to do, which register was going to hold which bit of data and so on; then you wrote it down in pnemonics - a shorthand pseudo-language; then the best bit: you translated it directly into hex represented 6502 machine code with the aid of a lookup table and typed it in on the hex key pad.

Now while this was all very well and good, what was the purpose? The purpose was a very good one - to gain an in-depth, ground level understanding of what was going on inside. I'm a huge fan of modern languages like python who's high level functionality provide an amazingly flexible approach to software development but isn't it better to really really understand what's under the bonnet?

Well that's my opinon anyway.

</rant>

Sunday, 8 February 2009

What's in a name?


Welcome brave reader to the first installation of "The Programmer's Den". Having recently moved back into the realms of development - this time far more comfortably in web development with out all that messy mucking about with science on the side - I decided it was high time to get blogging proper. The main impetus for this has been that over the first two weeks at my totally fantastic new job I have been relying heavily on many other kind people's sharing of their discoveries as they have been tackling similar conundra as myself. The list of these unknowing contributors is already too long to mention but they all have my utmost gratitude.
Anyway - as the title asks: "What's in a name?" A very good question indeed! At first glance it may seem a suitably geekly title for a blog writen by my good self. But dear reader the geek-tastic reference go so so much deeper.
Who now amoung the development fraternity remembers Colossal Cave? Yes I can see some tentative hands raising, no sir don't pretend you are just stroking your long white, pony-tailed hair, I'm sure you've been through the source code a few times when you got stuck.
Anyway, for those of you who don't, Colossal Cave (also known as Adventure or ADVENT (this is what the executable was normally called)) is like the grandfather of computer games. A good old text interface (in the original) describing - sometimes irritatingly - what you can see and waiting for you to say what you are going to do next... does that sound familiar? Single player, solo adventuring, fanstasy role play kind of idea... yeah this is starting to sound like it spawned a lot of things.
There are many many memorable parts to this game that if you were to quote to someone who was of the Adventure playing crowd would definitly recogonise instantly. I'm sure a lot of folk have come across the magic word "XYZZY" - handy little translocation device from the "inside the building" and the "debris room". How about plugh? Again took you from the building where you could stash all your stuff (yeah people were after epic lewtz even in the 70's kids - don't think your purplz lol are anything new!) to Y2.
I could go on and on and on as this game still has a great impact today. Stanford University only stopped requiring it's first year comp-sci students to re-implement the game as a project last year.
Anyway, back to explaining the name: Don Woods wrote probably the most famous version of the game after discovering it as a graduate student in Stanford. This version, known as Adventure 350 (due to 350 being the highest score), is the one you may have been introduced to as an aspiring young, pre-teen geek (or was that just me?) on an old PC, mine was a 8086 with a fairly burnt monocrome hercules, orange on black monitor that my father helped me build after fishing components out of a skip round the back of Aberystwyth university physics dept. He knew of adventure because he had played it back in the 70's on a PDP-11 ... ah! now we're going back a bit (before I was born admittedly). He told me of a place he'd discovered in colossal cave - not available in Wood's version, but presumably available on the one he'd played which one can only assume was the age old Will Crowther original, called "The Programmer's Den" - with pictures of undraped Cray's on the wall, half drunk coffee on the desk and half eaten pizza in a box (this is really starting to sound familiar isn't it? we really are creatures of habit). It seemed a suitable name for such a writing expedition so I've gone for it.
I would be interested in hearing from anyone else who ever encountered the fabled place as I can find absolutely no reference to it anywhere else - though I may be force to grab the original source code and search the data file one day just to check.
Well I'm pretty much out of orange smoke so we better call it a day. I future I intend there to be some slightly more illuminating posts on development rather than idle ramblings on ancient computer entertainment. So watch this space for my latest (not very) shocking discoveries in PHP, MySQL, JavaScript, AJAX, Ruby on Rails, Codeigniter, Perl and what ever the hell else the universe deems fit to lob at me. (Image above borrowed from wikipedia).