MIPS Assembly Labels

前端 未结 2 1684
灰色年华
灰色年华 2021-01-06 19:59

Does assembly for MIPS read every label? ignore the task and syntax, I just put something together quick.

add reg3, reg1, $zero
add reg1, reg1, reg2
beq reg1         


        
相关标签:
2条回答
  • 2021-01-06 20:48

    Labels are created for humans to write and read more convenient, the after assembling, they're translated into machine code. You can, of course, don't use any labels, but this will introduce at last two problems:

    1. you need to count A LOT;
    2. once you change somewhere in your assembly program, almost you need to change most of your jr, j, jal, etc, because you're using absolute address of your program.

    If you use labels(now they're references to sections in your program), these program will be solved with no extra effort!

    0 讨论(0)
  • 2021-01-06 20:49

    Labels are only so you can reference the line with a jump. The CPU itself will only see the machine code. The same is true of any comments in your code. They are only there in the assembler - this is then converted into machine code.

    You will need to jump over a line if you don't want it executing.

    0 讨论(0)
提交回复
热议问题