Shop OBEX P1 Docs P2 Docs Learn Events
Hero-1 Robot: Online Assembly to Machine Language Converter! — Parallax Forums

Hero-1 Robot: Online Assembly to Machine Language Converter!

ZootZoot Posts: 2,227
edited 2011-01-17 11:16 in Robotics
Hey all -- if you are fortunate enough to own a Heathkit Hero-1, I've written a simple online application that converts mneumonic assembly language for the MC6808 (and the Hero-1 interpreted "Robot Language"!) to ready-to-enter machine language opcodes. I am not fortunate enough to have serial capability on my Hero-1, so I have to hand-enter all the hex code.

The converter has all the instructions built-in, along with many, many pre-defined constants specific to the Hero-1: all ROM subroutine addresses (INCH, OUTBYT, OUTHEX, etc), all port addresses (e.g. light/sound sensor), all the speech phonemes, data addresses such as motor positions and sonar hits, etc. It even includes ready-to-use "bitmaps" for outputting characters to the led segment display. Of course, all interpreted "robot language" opcodes are implemented as well. The only items I still need to add are the addresses for pre-defined speech strings in ROM -- I'll be getting to those in the next several days.

The nice thing about the converter is that it lets you write Hero-1 code with constants, labels, ORG statements for organizing RAM, evaluated constants, etc. Relative branches are calculated automatically to labels which is very convenient.

It's lightly optimized as well -- if you load an accumulator from an address <= $FF, the compiler will use the direct instruction if it's available. Likewise for inserting one or two arguments depending on instruction and value of the argument.

In any case, if you are interested, give it a whirl. There is a sample program that comes up by default if you want to see what the generated code looks like.

(FYI -- I'm currently interfacing an SX into my Hero-1 to handle IR communication with all my other 'bots -- I wrote this utillity because I was sick of writing machine language and always looking up the addresses of ROM subroutines and the like.)

Try it out here: 1uffakind.com/apptoys/onlinecompilers/MC6800
373 x 656 - 27K
690 x 967 - 45K
1024 x 757 - 87K
1024 x 825 - 98K

Comments

  • ercoerco Posts: 20,256
    edited 2011-01-14 00:10
    Zoot: Fantastic effort. I have all the Heathkit robots, and it's been a while since I've fired them up. This gives me a reason to dust off my HERO-1 when I get a minute. It'll be a while still, but it's great that you've breathed new life into these old robots. I'm sure Robert (Robotworkshop) will also be quite pleased. Thanks!
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-01-14 00:31
    Zoot, wow! Congratulations on your accomplishment! Old Heros never die!
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-01-14 06:13
    Looks good Zoot! I usually use the Motorola freeware assembler and then send them down to the HERO 1 with the Serial or USB Interface. Does your robot have the memory expansion installed? If not I have all of those on hand. The USB interface works well with newer PC's and Mac's. It's pretty cool to see Windows show a pop up that it finds a HERO 1 when you plug in the USB interface.

    Robert
  • ZootZoot Posts: 2,227
    edited 2011-01-14 13:01
    Robert -- before I wrote the code for my little app, I looked around for an assembler but couldn't find one. I found references to the freeware assembler, but no actual downloads. Any idea where to get a copy? Not sure I feel like abandoning my Mac for writing Hero code, though :)

    You and I have discussed upgrading my Hero-1 to add serial capability; I've always been interested in this possibility but $$ is always a problem and I've been reluctant to mess too much with the I/O and CPU boards on my 'bot as everything just gets more fragile each year.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-01-14 13:45
    The package for the freeware assembler isn't that large so I could e-mail it to you. I also have a nice diagnostic program that can check all the memory in the robot as well.

    Adding a Serial (or USB connection) is pretty easy since it just plugs into the breadboard on the head. The only concern is that it requires the memory expansion board with the 4Mhz crystal.

    Robert
  • ZootZoot Posts: 2,227
    edited 2011-01-14 16:00
    =The only concern is that it requires the memory expansion board with the 4Mhz crystal.

    Robert

    Yeah, that's the part I'm not sure I want to do :)

    If you could email me the assembler, that would be awesome.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-01-14 18:18
    It's been 25 years since I hand entered hex code into a keypad on a microcomputer. As I recall you would type in a hex address, then a value and hit store. There was some way to set the program counter as well. It was really tedious and error prone.

    Now here's a totally crazy idea that would allow you to automatically download code to a Hero without modifying the Hero hardware. Build an automated key press machine! It would receives and buffer a stream of bytes, then push the buttons on the keypad to store the values into the Hero.
  • ZootZoot Posts: 2,227
    edited 2011-01-14 18:32
    Martin_H -- it's not quite so bad. You enter a starting address, then enter each byte instruction while the address increments automatically. You get fast at it :)

    However, as Robert mentioned there is a serial interface and ROM chip avail. for being able to download code direct. I may not go that route due to time and $$ and fragility of the platform. However, I have toyed with the idea of loading up an EEPROM with the code and letting the SX act as an I2C peripheral for pulling bytecode down to the Hero-1. This would mean I would only have to load up a short bootloader into the Hero-1 that would read the SX and fill up it's own addresses w/the program.

    For the Hero-1, there is a tape-in/tape-out interface, so it's not like I enter the program in every time -- I record the audio to a digital audio file on my laptop and just play it back when I want to load up the 'bot. It's kind of funny and old school in a way.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-01-15 13:53
    BTW I am completely jealous of Hero robot owners. When I was a teen I thought they were cool and wanted one, but couldn't afford one. I've often contemplated trying to build a look alike out of modern components.
  • ZootZoot Posts: 2,227
    edited 2011-01-15 13:59
    I was lucky enough to have my grandfather kick down for the Hero-1 plus arm and speech board when I was about 16. I didn't realize then how generous a gift it was. Fortunately, I was very careful about assembly, and later packing it and storing it when I went off to college. Nearly twenty years after that, I visited the old homestead, brought the Hero-1 out of storage, and except for needing new batteries, it's as good as ever... of course, now he sports an OSHA orange and pasel pink paint job :)

    http://1uffakind.com/DesignMediaArtRobotics.php?p=14
  • Martin_HMartin_H Posts: 4,051
    edited 2011-01-17 10:53
    @Zoot, one other question. I've only used robots with differential drive and the Hero uses a drive wheel that can turn. I'm curious if there are any benefits to this arrangement for Hero?

    If Hero used a regular motor I could see that helping it go straight, but I thought the Hero uses stepper motors which can go straight without encoders.
  • ZootZoot Posts: 2,227
    edited 2011-01-17 11:16
    It's a pain, to be honest. More work to code certain escape maneuvers and such. And forget cartesian odemetry. For my part, I prefer differential steering. But back then, it was really before the time of powerful, but small, full H-bridges. You had a huge power transistor driver circuit for speed control and a relay, and having two heavy boards like that, two heavy motors, etc., was somewhat impractical. But it also means you only need one speed/distance encoder.

    It was also just the "style" or preference most of the time -- a "steered" vehicle with a single drive wheel and two fixed free-axle wheels. The drive wheel turns +/- 90 degrees so you can more or less turn in a circle. The Hero-1 uses a stepper motor for turning the drive wheel, along with mechanical limit switches for homing the stepper. My own Hero-1 main code has the wheel "self" home and reset its internal stepper motor position register every 10 minutes or so -- a hard knock or bump in the road can throw the steering stepper off pretty quickly.

    I would say the only thing I like about it is that the motion you can get while turning the drive wheel while moving forward or back is aesthetically pleasing -- it's fluid in a mechanical way that differential steering needs very careful -- and perhaps unnatural -- coding to achieve.

    But that's academic, really. Even many years after introduction, the Hero-1 is a delightful platform. It's old-fashioned, but like a classic Cadillac or Olds 98. Everything may be a bit behind the times, but the attention to detail and approach is amazing and it's appointed with every luxurious peripheral you can imagine. And when folks see it they all stop and look :)

    I think it's probably something to do with the fact that it's almost R2-D2 sized and shaped... it's like what lay folks want a "robot" to look like.
Sign In or Register to comment.