2 Replies - 346 Views - Last Post: 09 February 2019 - 11:56 AM

#1 TonyRymond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 09-February 19

Labels between instructions.

Posted 09 February 2019 - 10:34 AM

Hello gentlmen, once I have an instructions which having between them a labels ; for instance jumping to label 1 which it's located away from my current status of my current instruction(the one that I'm reading it); my question ; is the label considered as an instruction and the assembler decode it? it sounds something fuzzy how the CPU go to my label which I've been called ..
Also, will the PC updated once I jump to any label?

To illustrate more:
fact:
  1.
  2.
  3.
  4.
  5.
  6.
  7. jal fact // so here how does the cpu know where is my label "fact"? and what about the PC .. will get updated from PC=0 ?




thanks!

And will the PC at every function's call get updated to zero to start with the new function that's has been called?

Is This A Good Question/Topic? 0
  • +

Replies To: Labels between instructions.

#2 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7108
  • View blog
  • Posts: 24,145
  • Joined: 05-May 12

Re: Labels between instructions.

Posted 09 February 2019 - 11:53 AM

No, the label is not an instruction. It's just your way to telling the assembler to keep track of a memory location. When you reference a label, the compiler substitutes either the address of the memory location or computes the offset to that location depending on what is needed by the assembly instruction in question.
Was This Post Helpful? 1
  • +
  • -

#3 TonyRymond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 09-February 19

Re: Labels between instructions.

Posted 09 February 2019 - 11:56 AM

As a result I could say that label is just an indication for assembler itself and not getting decoded to 0/1 bits.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1