Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tips for reading ASM code?

Tags:

assembly

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!

like image 253
kthakore Avatar asked Apr 09 '09 13:04

kthakore


People also ask

How do I read an assembly file?

Reading from a FilePut the system call sys_read() number 3, in the EAX register. Put the file descriptor in the EBX register. Put the pointer to the input buffer in the ECX register. Put the buffer size, i.e., the number of bytes to read, in the EDX register.

What does asm mean in code?

In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence between the instructions in the language and the architecture's machine code ...


3 Answers

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.

like image 93
Nils Pipenbrinck Avatar answered Nov 15 '22 12:11

Nils Pipenbrinck


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.

like image 33
Hans Sjunnesson Avatar answered Nov 15 '22 12:11

Hans Sjunnesson


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.

like image 43
macropas Avatar answered Nov 15 '22 11:11

macropas