The Meaning Of Being A Hard-core Hacker From A 1985 Recollection

6502-hand-assembling-and-programming

Gather ’round children, we’re about to hear a story about the good old days. Except that this is really more of a horror story of what it used to be like as a code monkey. [John Graham-Cumming] shares his experience programming a 6502-based KIM-1 machine back in 1985. Simple, right? The caveat being that there was no assembler or hardware for loading the finished code!

The machine in question was a label application tool for a production line. You know, product goes in bottle, label gets slapped on the side. But the slapping needed to be perfect because consumers shy away from packaging that looks shoddy. Computer control would end up being far superior than the mechanical means the factory had been using because it simplifies the ability to adjust calibration and other parameters. [John] started from square one by interfacing the KIM-1 with the existing hardware. It has a hex keyboard which is how the program was entered into the device. But first he wrote the software on sheets of notebook paper like the one seen above. It includes his hand assembled code, which was then typed in on the keypad. Kind of makes you appreciate all the tools you take for granted (like Eclipse), huh?

[via Reddit]

 

91 thoughts on “The Meaning Of Being A Hard-core Hacker From A 1985 Recollection

    1. Still got my Kim-1 bit my favourite old 8-bit is the Cosmac 1802 Elf. That was the first real computer I ever owned. I saved up all my money when I was 15 years old and bought a Netronics ELF II with a whopping 1/4 Kb RAM. Then I got a 4k ram board and built a general purpose I/O board. It had on-board graphics which were pretty bad but awesome for the time. Coded machine language via the hex keypad… Pretty standard for the time 1979-80.

      1. Me too Andrew. I worked all summer for a Netronics 4 k board.

        I am all for the use of high-level languages but I am always impressed when I see these old assembly language programs. This guy wrote an entire production control application is fewer bytes than most modern microprocessors dedicate to a bootloader. There is definitely an art-form to assembly language programming.

      2. What got me started, was the ELF project in Popular Electronics. I wanted it so bad I couldn’t stand it. Never did get one, though I still have the original articles, and the newer version of it.
        What I did get much later was the Microprofessor Z-80 system. Basically the same thing, different processor. Same coding by hand.
        I lived in a small town, and stuff was HARD to get. Where do you go? TV repair shop and tell ’em you want a Z-80 microprocessor? They just stand there looking at you like you had three heads.

  1. Yup, when hacking was a black art.. Sadly kids today are too lazy to learn assembly, I remember burning an EPROM by hand with dip switches for a special project after I hand decompiled a 6809 program for a lighting/ security system at the school, I had to make an adjustment that they never figured out….

    The super rich 1337 kids had the heathkit Processor trainer, and the really rich kids had the Hero-1. Sadly most of the rich wannabe’s that had the Hero-1 at home could not program to save their lives… Luckily today the playing field is pretty even. Rich kids and poor kids have the same stuff to use.

      1. The new guy at work that has a BS in CS doesn’t know anything about Assembly. In fact he was having trouble figuring out the Checksum bit on a serial packet, he was trying to calculate a CRC for the whole packet and did not understand that you always exclude the preamble.

        I would hope that Assembly was required for a CS degree.

        1. When I was looking to go to the Uni this is exactly why I didn’t enroll in a BS of CS.

          I started learning to reverse engineer software using C/C++ & x86 assembly when I was 11. By the time I had the option of going to Uni there was absolutely nothing worth learning from the course.

          Now I’m 22 and can’t find a job in the industry because I don’t have a degree regardless of my skill set, bad decision.

          1. I thought of doing the same but in the end didn’t. I enrolled in a university and applied for an accelerated program. Pretty much you take a few tests and if you succeed you can skip the entire first year. I was also able to skip the first half of second year enabling me to do an internship then, reducing my total amount at uni to a little over 2 years instead of 4.

          2. I was in the same situation. 4 options for you here.
            1) Freelance. If you have the project management skill do it on your own
            2) Start your own business. Like above but surround yourself with people you can work with to make things happen.
            3) Work in a different field and work your programming magick to make your job and the jobs of others easier. Sooner or later you can have a set of ‘tools’ you can bundle together and call it produtivity software.
            4) Get a degree, while the classes are a bore sometimes if you lack the leadership or oppertunity this is the only route.

            I have actually taken the path of 3 with Litigation Support. I have made ‘tools’ to make my day to day easier and as a result I am working on a software package to manage our workflow more effectivly.

          3. Yep, a lot of times it’s about that sheepskin. I started building stuff when I was 11 also. Worked my whole life in electronics except some part time stuff at a gas station. Almost all self taught, pretty much forced my way into a technicians job, and worked at AT&T in their labs building prototype stuff. Great at what I do.
            But I could only go so far. How does the boss explain to a guy with a BS, that he’s hiring/promoting me over him? That was one of the excuses I got.

          4. Just an update, it wasn’t that I thought I knew everything, it’s just at the time I saw no benefit of studying other than for the sake of having the paper. Do not translate this as a lack of willingness to learn. I still want to go an do a BS in EE, just not CS.

            I did freelance work for a few years then started my own company, however I had some family issues come up and needed a more stable income so I am currently working as a full time RoR developer but I would love to have a job focused on reverse code engineering.

            Old Resume: https://dl.dropboxusercontent.com/u/19100011/resume.pdf
            It’s not focused on any of my security work though.

          5. I knew I wasn’t going to learn much from my degree (and I sure didn’t!), but knew it would help me get good jobs (which it did!). That’s America for you.

        2. It’s only embedded, 8-bit stuff that needs assembly. And even that doesn’t, with C compilers and BASIC (to a lesser extent) being so popular. And Arduinos and whatnot. I’d bet that no commercial software of the last 10 years, for proper keyboard / hard-drive / monitor – having computers, or even game consoles, has included any asm at all.

          Modern PCs are so abstracted nowadays it’s impossible to be an expert in everything. The bus is no longer just the processor’s address and data lines wired to a socket. A modern PC’s rigged up like a network. It used to be possible to understand from microcode up to application level, but no more, or at least not in any detail. There’s just too much!

          1. That is incorrect. Actually a lot of hand written asm code lingers around in our modern systems too, which are high performance hand tuned algorithms for crypto, compression, etc..

          2. While maybe it is rare that you actually have to write something in assembly language but it is really important to understand how computers work on the lowest level.

          3. It’s clear that you lack experience in this field. The amount of assembly used on the systems you describe is small, but there is an incredible amount of assembly required in bootloaders, optimized loops, crypto code, startup routines, I/O timing…

            Nobody writes an application in assembly, that is idiotic. But thinking assembly is not used in modern PCs is a fallacy.

          4. Yep. You just keep right on thinking that……

            This is what determines the difference between the “go to expert” and the guy that just cranks this out because it’s a job.

          5. I don’t know about that: I made a metric ton of money writing a Board Support Package for a PowerQuick CPU + some linker hacks to stop the stupid compiler from dumping its libc-crap over the Interrupt vectors and QNX’s memory management subsystem.

            However, back in the day one could read and understand the manual for a CPU, probably the peripherals also, the z80 book was maybe 100 pages.

            Now, the manual for the memory controller in the SDRAM runs into 200 pages ;-)

            Anyway – as a career I would choose Electrical Engineering with Power Transmission and Power Electronics as subjects: The worlds electrical system is old, decrepit and needs replacing, people pay really good money for electrical engineers now, especially compared to software work which is rapidly going to the cheapest provider in some 3’rd world place.

            One did notice that the Cisco/VM-Ware consultants drive ever shittier cars, so: I changed back from software recently – I am an electrical engineer by training – and doubled my salary.

        3. Seems to me the error was yours. First: most serial protocols doesn’t use CRC at all, even/odd parity is much more common and second: most serial protocols have no preamble. The only way he would be the one to blame is if he didn’t read and/or understand the protocol specifications. If the specifications aren’t well documented how the hell would anyone know how to handle communication?

          BTW previous MEK6800 D2 user here, entering machine code isn’t a hack…

          1. Depends on what is meant by “serial” – Ethernet, CAN, Bluetooth and 802.11 all have a preamble. Source-synchronous or clocked serial interfaces don’t need preamble since the endpoints are in sync CRC is almost always a layer or two higher, so it’s confusing that he’d talk about computing a CRC and talking about preamble in the same sentence.

            The grandparent post really did come off as rather arrogant, though. Kind of like someone who’s a year or two more experienced than the grad and needing to assert his dominance or something.

        4. The Computer Science department at my state school has one perennial elective in x86. Most don’t take it, from what I’ve heard.

          I’m on the other side of campus as a Computer Engineering undergrad, and our required curriculum features loads of assembly in HCS12, PIC16, MIPS and Altera’s Nios II.

      2. When I did my HND, we were the last class to both do mathematics and assembly. This was in 2003-2005. I wasn’t any good at assembly, but I know what it was.

        1. I did an HND in 1995-1996 and we did Assembly, but not a lot of Maths. I then did a degree conversion and we basically did the same lectures again – I coasted for a year, and it was pretty sweet! I “got” assembly better the second time around and did C++, Cobol, Smalltalk and Prolog on top of the ADA we had already done in the HND course. It was fun, and I learnt a hell of a lot more by having an easy ride with the more “boring” courses.

    1. I don’t think it’s laziness, more like realistic. Modern ROM chips would take a very long time to program with DIP switches.

      On an unrelated note I once did a resume as an OS almost entirely with assembly. The text and layout information was stored in XML-like files. I did cheat a bit however, I prototyped the rendering code with C# to figure out how bare bones I could get before it looked bad. Did not get the job I submitted it for, and I know they ran it because my home phone number was only listed in the resume, which is the number they called to break the bad news. they only had my cell number otherwise.

      1. I know I’m always keen to give boot access to any software a stranger passes to me! Let me guess, they either made life-support equipment or ran a nuclear power station?

  2. Still have mine :) bought it new somewhere in the mid 70’ties. Cost more than a month’s salary. Great learning machine in those days. Built 2 x 4K ram cards for it, added a terminal to it, and an old Control Data 3300 papertape reader (after modifying the interface [ECL->TTL). Still have in my collection : Dr Dobbs yearbook vol 1 and Byte yearbook vol 1.

  3. A KIM-1? In 1985? Heh.

    “…you go to war with the army you have: the technical college had a KIM-1 to spare…”

    I’m sure it was a great learning experience, and that’s what you go to college for. But really now. Since it was a job contracted with the college, which I assume involves payment, I’m sure the college could have easily provided something a little better. And easier to maintain should the machine need updates later, which is better for the client.

    I was writing 6502 assembly too in 1985, but on a better machine. Nostalgia aside, this seems more a story of how not to fulfill a contract.

    Speaking of nostalgia, I remember as a small child watching my *grandma* debug huge stacks of COBOL code, printed on that wide green and white tractor-fed paper. That someone else wrote. With a red pen. My grandma was a hardcore hacker. ;)

    1. We used to get tons of that tractor-feed green and white paper when I was a kid! My grandma sometimes brought us huge batches to use for drawing on. Sometimes it came with carbon paper attached between 2 sets of sheets, which was fun. She didn’t program anything herself, just worked on debt control on a Burroughs mainframe.

      1. That does sound fun, I can just picture the art attached to the fridge. :) Mine didn’t bring home any blank paper, but tons of the empty boxes it came in. The whole family had storage systems based around Xerox boxes.

    1. Two words: Don Lancaster!

      For those who don’t know Don’s contributions, here’s a sample:
      Hardware: TTL Cookbook
      Software: Various Apple II & IIe books (including one where Don explains reverse engineering and the use of multi-colored highlighters and colored pens)
      One of the oldest web sites on the net: http://www.tinaja.com

      And 40 years of various magazine articles. I learned a ton about reverse engineering from Don’s Apple II books (I didn’t even have an Apple II at the time).

      1. Oh those were the days – hand assembling the code to enter via an apple II, hooking up a homemade interface circuit. I still think low-level down & dirty programming is the best.

  4. “But first he wrote the software on sheets of notebook paper like the one seen above. “…” Kind of makes you appreciate all the tools you take for granted (like Eclipse), huh?”

    I think I’d take the hex keyboard over eclipse.

  5. It must have been about 1980 or very early 80s I got hold of some 6502 traffic light controller PCBs from the junk at my Dads work and started programming. Large boards, early prototypes, double sided, non-pth, wire patches everywhere. Code hand assembling on paper and entering through toggle switches in binary address/data and a few push buttons. The only display was a row of LEDs. From memory, all 4000 series CMOS, 1MHz 6502, RAM in 256 byte chips. Many hours of fun.

  6. Yup, still have my old computers but when I get nostaglic I simply boot a VM and run an emulator. ;-) I’ve given most of my computer collection to MARCH ( http://www.midatlanticretro.org/ ) except for my modified Atari800XL with 192K Ramdisk and bank switched Omnimon.

    I’m glad to have been a part of that history (hacking, BBS’s, PD files) but I much prefer today with Linux, Arduinos and Pi. Much of what I learned is applicable today, just not in exactly the same way.

    256 Bytes is more than enough for anyone! Now get off my lawn!

    1. Ah… the good old BBS days. I ran one myself. WWIV FOREVER! …(or TAG if you weren’t good at coding)

      …I still have the fanfold printout of the TAG docs in my desk. And a copy of TheDraw on a 3.5… and registered TradeWars around here somewhere…

      …memories :D

  7. What most people seem to be overlooking here is that the KIM-1 was already a dinosaur in 1985. By 1985 there were quite a few macro assemblers hosted on the 6502.

    1. Yeah, that’s quite true. I still had a Kim and my ELF II in 1985 but I had graduated to a TI99 4/A in late 1984. Colour TV monitor with built in basic interpreter. I wasted many hours playing Parsec, piloting my space ship through a debris field (I think). By 1995 I think you could buy a PC from IBM. I bought a PC Jr. Sometime around then.

      1. The PC clone wars started a little earlier than that. I got MY, I bought it no one else can touch it, first PC 386DX20 with 2MB to run Windows in Summer of ’91. I think the PCJr was already off the market at that point. Of course I could do a search, but that would be far too much effort.

        1. I went from ELF/KIM to a Sharp pocket computer PC1261. Then a TI 99 4/A to a PC Jr and finally to a Comtex XT (that’s a 1×86) in about 1989 with a 40MB HD and 640K Ram. It ran no version of Windows but I had some pretty wicked GW Basic and dos utilities going on back in the day.

    2. That was my impression too. The Kim-1 came out in the late 1970s, just before the Apple II. When the Apple II came out there were bunches of assembler tools and the Apple had a built-in disassembler (simple but incredibly useful). By 1989 the Apple II had gone through several generations (Apple II, II+, IIe, IIe+, etc.)

      This person should have been able to easily write the code using an assembler on the Apple II, do the debugging, and other testing, and then port it over to the Kim-1 if there was a specific reason to need the Kim-1 (portability, embedded application, etc.)

  8. Story from 1989. I’m working at this clone PC shop in San Diego and this new kid starts there. A kid named Kevin. He was 17 and a hacker. I had this program that I wanted to run (pirated) which required a parallel port key to operate. I handed the floppy to Kevin and asked him if he knew how to bypass the key. He said “sure!”. He took the floppy, plopped it into some PC on the showroom floor, and opened DOS DEBUG. In ten minutes he located the parallel port check and re wrote the EXE to throw a success flag even if the key was missing.

    10 minutes. After about a year, he left to go to Cal Tech. He was offered an intern job at the then young anti virus company called Symantec. Never heard from him again. I followed his exploits on the web though. He had made his millions in the pre-dot com crash. Good for him.

  9. Great stuff. Reminds me of sitting in middle school, around the same time, writing Apple ][+ BASIC (AppleSoft?) for page after page in a notebook, then going home later to type it all in.

    Bootl, nostalgia ain’t what it used t’be. Nay. When I was a lad, we had t’go all the way back t’primordial memories of t’womb… IF WE WERE LOOUCKY!

  10. Now it’s more simpler because you can code in an IDE and there are binary format standards and abstract OS APIs… I like when people who don’t have a clue about real software and computer engineering try to school us…

    Look at me I wrote an inefficient labeling controller firmware a long time ago when apes could get engineering jobs and high school dropout stoners could hack NASA… Now I represent and industry in a nation not competent enough to maintain any industries..

  11. Assembly? No no no…. That was machine code! He’s coding directly.

    And LOOK! He’s using HEX! Means hex keypad and enter key. Lucky dog indeed that had one of those back then. I had 8 toggle switches, an enter key, 128 bytes ram, and a single led you could blink. 3 nights coding and stepping through looking for input errors to finally succeed… finally blinking… and excitedly call the wife over from the dishes…

    ?? It blinks? That’s all it does? You spent $125 and all this time just to make a light blink? I was lucky she was holding a fork instead of a frying pan. The puncture wounds didn’t bother me for too long and managed to make a darn good living out of it for her. Just mention that day though and you still get that same “you’re gonna die” glare.

    Remember 4004? 8008? 1802? 2704? Go back further grasshopper… I started with Magnetic Core.

    1. I get the same reaction from my wife.

      How about the TI 2708 which was a triple voltage EPROM and was incompatible with everyone else’s 2708. They did have a 2508 which was though (weird). They didn’t have the compatibility issue with 2716 and later EPROMS.

      1. This is called “hand assembly” and the output that is generated by you, the “assembler”, and keyed in through a hex pad is indeed machine code. I wrote rafts of this stuff for F8, 6800 and Z80 before I had the luxury of an assembler to calculate jump offsets and such.

      2. “machine code” is something a machine can run directly on it’s processor. this means that op codes and hex numbers for the operands is machine code. apparently you didn’t get the memo.

    2. When I bought mine I had to borrow 300 guilders (about 150 us$) from my mother (lived at home then). And I will never forget… “Look mum, now I can add 1+1=2” and she turned around,,,,, walked to the kitchen saying “And that is what you paid 1000 guilders for……”. For 10 years I had to hear from the family …what do you want to use it for…. whant can you do with it….. And then the IBM-PC came into the market…….

  12. Have similar story from USSR. My father is military builder, with specialization of undeground and mountain structures (towns, warehouses, missile silos, and the same military stuff). In university his graduation work was undeground autonomic base based on shock absorbers and that can resist exact hits of atomic bombs. As you can imagine, this work have a really lot calculations. This was in the end of 70s, in USSR, so access to mainframes and time for work was very-very limited. So, all work also was on paper first. But after this, you must create thousands punch cards and you can’t check all on real machine! I remember this cards them when was young, grandfather use them as paper drafts for many years and there was two large suitcase full of them :) I’m developer, we also in univerity and colledge write asm progs on paper, do assembling, but this was something small, I can’t imagine, how people do such work in past, moreover when they was not programmers!

  13. I used to hand-code Z80 for my ZX81 (all 1k of RAM of it). Made me a big hit with the ladies in secondary school (‘High School’ in American).
    The only place to write code was in the TEXT of a REM statement at the first line of the program – this was address 16514.. That address lives with me to this day.

  14. Brings back memories for me. Back arounf 1978 I had access to an IMSAI 8080.I hand coded a few peograms for it. I used a multicolimn accounting notebook as a coding form. The IMSAI had a front panel featuring 21 red and blue switches used for entering data and programs in binary I would lookup the machine code, jot it down in hexidecimal and mentally convert to binary when entering the program.

  15. Ha! And I thought I was the only geek that still had a KIM-1 sitting on the workbench. Mine’s been an idle piece of decor for about 20 years… been thinking about cranking it back up just to see if it still runs (I’d have to build a new power supply – other than that it’s likely good to go).

    I didn’t (to my recollection) write my code in colored pens… but I do remember color-coding my cassete tapes for program storage… and recording program code at the tail end of tapes, after my NPR radio plays… :-P

  16. About two years later than him I have used Pascal compiler (gift from a buddy) to do 6502 assembly on Atari 800XL. I even wrote a little utility transforming the Pascal objects into loadable asm programs and wrote drivers for DIY numeric keypad scavenged from a dead calculator. But before that, for a year I couldn’t afford any storage device and all my programs were input from notepads after power-on. The 6502 assembly was a pleasure to work with, after a short time one memorized most of the binary codes. I still miss 6502 in my adult engineer’s life.

    1. In my opinion the 6800 was slightly better and the 6809 was much better. I hated the 8086 and it’s segmented memory. I was surprised at how easy the 8031 family was to use. By the time I got to the 68000 I was using HLLs and using asm on a ‘computer’ was mostly unnecessary. Today, it’s mostly C for small uCs (but you still debug in asm) and C thru HLL (Perl/Python/Java) for everything else (with a little shell to glue thing together).

      1. The last real app I coded in assembler was a terminal program for an 8085 based CPM computer. Later I assembled some code for the 6809, and have to say the the PCR addressing is great, for assembly but would be a pain to hand code. This was in the 80s and I soon found the 6809 assembler could be tricked into compiling for the 6801 by 3 equates that defined some interrupt related commands and taking care to avoid certain addressing modes.

Leave a Reply to t&pCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.