February 8

MIPS, ARM and X86 Assembly Comments

Comments in ARM and X86 Assembly is similar whereas it’s different in Mips Assembly. The basic question in beginners mind arise is why comments are used?

Comments in Assembly programming are used because:

  • It helps the coder a better understanding of the program.
  • Sometimes it is impossible to understand an assembly program without comments
  • It helps the newbies to understand what the instruction is about.

Comments are not necessary, they are optional. It’s better for beginner to use comments while experts can avoide using comments. Comments in ARM, X86, and MIPS are explained below.

Comments in ARM

Comments in ARM assembly are represented by a [thrive_highlight highlight=’#1e73be’ text=’light’]Semicolon(;)[/thrive_highlight]. It can be seen below:

SUB $r0,$r0,$r1      ; subtract register r1 from r0

Comments in MIPS

Comments in MIPS assembly are represented by a [thrive_highlight highlight=’#1e73be’ text=’light’]Hash(#)[/thrive_highlight]. It can be seen below:

la $a0,msg1      # load address of msg1 into $a0

Comments in x86

Comments in X86 assembly are also represented by a [thrive_highlight highlight=’#1e73be’ text=’light’]Semicolon(;)[/thrive_highlight]. It can be seen below:

MOV ah,01      ; load 1 in ah register

If you have any question regarding comments in assembly feel free to ask in the comment box.


Tags


You may also like