views:

274

answers:

4

I have an exam coming up on HC12 Motorola assembly code. Any tips to improve my time in read and understanding asm code efficiently and accurately? My problems: I take a long time to read asm code accurately and if I rush my stack is messed up!

+2  A: 

ASM code is hard to read. There is no magic thing that makes it easier to decypher.

The only tips I can give you: Add lot of comments to the code. Document what a sequence of instructions does. Don't focus on the instructions itself unless you have to.

Also assembler reading skills can be practiced fast. If you spend some evenings writing little toy programs you'll be able to understand other peoples code with ease. You will develop the skill to focus on the important things, so you have less code to read overall.

Nils Pipenbrinck
+1  A: 

I remember my institute. I printed difficult assembler program on a paper roll and then I covered this role with color lines (by pencils), designating procedures, blocks, jumping and other things. Maybe there exist some programs for "visualisation" of Motorola assembly code, but I don't know about it.

macropas
Please, don't use toilet paper roll! :)))
macropas
good point! Back in the days when I was at the university I've used the time in the public transportation (two hours a day) to read and debug my own asm-code.
Nils Pipenbrinck
+1  A: 

Since this is an exam, handle it like any other exam - organize! You need to be able to quickly identify code blocks. Start with the branch/return instructions that break the control flow. These typically indicated a loop or mark subroutines. Once you have and idea of how the code flows, then figure out what it does within each block.

sybreon
+1  A: 

This blog post is kind of related. It's a series of visualizations of Atari 2600 games, their machine code and data segments, illustrated with lines denoting jumps.

It's not an answer, but it's interesting.

Hans Sjunnesson