Old School Programming
Scott Hanselman recently wrote about teaching children and kids to program the old school way by using the Commodore 64 emulator. It seems just recently that Zenzo, his 18–month old child, jumped off the cradle.
I wonder if old-school programming with direct access to the computer and the operating system is preferable to learning with scripting languages of today. What follows is my case for old-school programming, but scripting languages do provide a much better, functional programming language to learn from..
I first got into programming with the Commodore PET, followed by the Commodore 64. Like Scott, I would spend hours typing up long BASIC and machine language programs (written in hex) from various computer magazines such as Compute! and Run. It was then that I began programming full-time. I still remember 53280/1 as the addresses for changing the screen colors, SYS 64738 for rebooting the operating system. I still have most of the 6510 codes burned in my head. LDA was A9 (169), LDX A2 (162), JSR 20 (32), RTS 60 (96), and of course BRK was zero.
I wrote my own assembler and disassembler and used both to write primarily in assembly language for the next few years (near address location 40960 which was an unused section of memory), which was all before high school. I used my disassembler to decode and rewrite the entire 8K of BASIC ROM and parts of the 8K kernel back to source with meaningful symbols. I remember becoming mesmerized with how the 256 byte stack was used for parsing expressions. Even though processors were slow, linear search was used everywhere even during frequent operations such as changes in control flow and variable access. I eventually added my own extensions to the BASIC language to support structured programming and better graphics.
I also played around as if I was the operating system, disabling interrupts to create my own interrupt routines, which I used to implement a partial multitasker, an animation engine, as well as a rasterizer that bypassed hardware limits for 8 sprites. In the default screen mode, every character occupied one byte of memory for a total of 1000 characters in a 25x40 grid; the number of characters were limited to 255. I also replaced the default mode to bitmapped mode, which consume eight times as many bytes: This enabled me to support character styles (bold, italics and underline), independent background/foreground colors for each character, larger character sets, and integrated graphics. I also experimented with proportional fonts (based on automatic detection of character boundaries and bit shifting) and screen widths larger than 40 characters.
I wrote rather than purchased my own software, as, being a child, I had no money. I built a range of programs including a wordprocessor to figure out how things works; some of these programs were better than commercial versions, but I just did not know how to sell them. I did seriously think about whether I could one day develop and sell my own software independently. In college, I purchased a couple books on developing and marketing shareware.
Programming at an early age helped with my education. I often found myself exposed to college material as a result of my activities. At a self-pace program in my elementary school, I began taking some high school courses while in sixth grade. Because I was already comfortable with memory addresses and stack, I never had the slightest difficulty with pointers and recursion, when I encountered them in C and Pascal; they both seemed natural to me. (Back eight years earlier, when I encountered PEEKs and POKEs, streams of hexadecimals numbers inside DATA statements, and mysterious SYS statements in computer magazines, I did find myself confused.)
You were lucky! You had a computer *and* magazines!
There weren't any magazines for such an esoteric topic in the newsagents in my town in the west of Ireland, and in any case I couldn't have afforded them if there were. I learned to program by alternately reading children's programming books in the library, and sneaking some use of display computers in computer shops (which were usually primarily TV/video shops in those days)...
I did eventually get my own Amstrad CPC464, and got into Z80 poking by hand, but it wasn't long after that that I got a proper PC...
Not only that, but the CPC464's tape drive didn't work. I couldn't even save my programs when I wanted to write something new!
Ah, the tough old days... :)
Posted by: Barry Kelly | June 16, 2007 at 07:23 PM
Thanks for sharing and for sparking my own trip down memory lane. For me it was an Atari 400 and then an Atari 800 and magazines like these: http://www.atarimagazines.com/
Posted by: Scott Meade | June 16, 2007 at 10:10 PM
Man, you took me back with POKE 53280, 0 POKE 53281, 0 I always liked making the screen black! ;) Good times...
Posted by: Kris | June 17, 2007 at 07:28 AM
9E BD G
Posted by: Ziv Caspi | June 17, 2007 at 10:28 AM
Any recommendations for someone who learned to program in a high level language and is now trying to gain understanding of lower level concepts (i.e. the stack and registers)?
How would one even go about writing there own assembler/disassembler?
Posted by: Kilik | June 18, 2007 at 11:48 AM
For a seriously old-school inspiration for all that is .NET you might look at this complete implementation from the chip/microcode level up to and including network stack, file systems, and graphical user interface.
The whole package, and at least 20 years old prior art!
http://www.unlambda.com/lisp/cadr.page
It does not pre-date the Burroughs or Xerox Parc work, but it retains a hang-tough attitude.
Enjoy!
Posted by: George Carrette | June 29, 2007 at 10:57 PM