Global Sources
EE Times-Asia
Stay in touch with EE Times Asia
?
EE Times-Asia > Embedded
?
?
Embedded??

Playing with assembly code can be fun

Posted: 01 Nov 2007 ?? ?Print Version ?Bookmark and Share

Keywords:virtual computer? assembly code? monitor?

Do you remember the famous Four Yorkshiremen sketch from "Monty Python's Flying Circus"? It involves four old men reminiscing about how hard life was in their younger years, with each trying to outdo the others by telling increasingly extravagant stories. At the end, following the most exaggerated tale, one says, "And you try to tell the young people of today, and they won't believe you!"

I always think of this when talking to young folks about the early days of computing. Today, people expect their computers to come equipped with hundreds of megabytes of RAM, tens of gigabytes of hard-disk storage and the most amazing color graphics displays.

How things have changed! When I was a bright-eyed youth, I dreamed of owning my own computer. At that time, however, the best I could hope for was a machine comprising a simple 8bit CPU, 1Kbyte of ROM, 1Kbyte of RAM, a hexadecimal keypad to input instructions and data, and some seven-segment displays to output results.

In those rudimentary systems, a simple monitor program resided in the ROM. Users would use this monitor to create their own programs by entering instructions (opcodes) and data values into the RAM one byte at a time.

The reason I mention all of this is that I designed a simple 8bit virtual computer called the DIY Calculator to be used with the book How Computers Do Math. Brian Beckius from Buffalo, Minnesota e-mailed me with a question about monitors. It turned out he was planning on writing one for the DIY Calculator.

Brian is a truck repairman by trade, but the love of his life is microprocessors, a subject in which he is completely self-taught. He asked for some general pointers, but he didn't want me to show him any example code because he wished to create "Brian's Brilliant Monitor" all by himself.

Brian's Brilliant Monitor? Someone was having fun, and it wasn't me. So I decided to leap into the fray by responding with "Max's Magnificent Monitor!"

In the end, Brian and I laid down a very simple specification. The monitor was to be a maximum of 1,024bytes. It would allow users to peek inside selected memory locations, poke new values into selected locations and hand off control to the user's program.

The idea was that Brian and I would create our monitors in isolation and then compare the results to see how our implementations differed.

My monitor currently occupies 768bytes of memory, and I'm determined to shrink it to 512bytes or less. Playing with assembly code is really tremendous fun, but if you try to tell this to the young people of today, they won't believe you.

- Clive Maxfield
Editor, Programmable Logic DesignLine




Article Comments - Playing with assembly code can be fu...
Comments:??
*? You can enter [0] more charecters.
*Verify code:
?
?
Webinars

Seminars

Visit Asia Webinars to learn about the latest in technology and get practical design tips.

?
?
Back to Top