Skip to content

Conversation

EdmanCoding
Copy link
Contributor

You forgot about PC incremented in both cases when was evaluating branch offset. And in part a. you also forgot that x3040 and x3080 are hexadecimal. For example x3040 = 0011 0000 0100 0000, so you should add decimal 62 to x3002 (x3001 +1 PC incremented) rather than 38. The same with x3080. In part b. you jump to x3001 from the x3002, rather than to x3000 due to PC incremented in x3002 (x3003 #- 2 = x3001). So R0 won't be set to zero again and loop won't be infinite.

You forgot about PC incremented in both cases when was evaluating branch offset. And in part a. you also forgot that x3040 and x3080 are hexadecimal. For example  x3040 = 0011 0000 0100 0000, so you should add decimal 62 to x3002 (x3001 +1 PC incremented) rather than 38. The same with x3080. In part b. you jump to x3001 from the x3002, rather than to x3000 due to PC incremented in x3002 (x3003 #- 2 = x3001). So R0 won't be set to zero again and loop won't be infinite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant