If I say,
if a == 10 b = b * 4 + 2
if it does then do 'b = b * 4 + 2' or skip doing it? Would it be BNE or BEQ?
Something tells me it's DON'T DO...
Thanks
It's good that you know that conditional branches looks at flags.
But a couple of questions:
Have you tried to write the code in C and then tried to singlestep through the code in a debugger? No need to use the Keil compiler/debugger - the concept is the same with other compilers or other processor architectures. The only important thing is to not turn on optimization, since that makes it harder to follow the code flow. That would have let you quickly see how a compiler implements comparisons and jumps and from that builds different conditional and loop constructs.
And did you consider the difference of jumping to code, or jumping around code? Because that answers your question if you should use a test for equal or not equal.
You did get excellent help, but decided to ignore it, because it involved own work.
Why do students often get own assignments - might it be because it's a great way to learn? You can't expect to learn if you aren't willing to spend time thinking. And you can't expect to get good help if you claim "troll" if the help requires you to think.
Ok, I apologize. The thing is that I don't know C or any other programming languages. I started learning Assembly a few weeks ago. It easier for me to understand by looking at the solution with comments rather than reading text. Maybe that's wrong but for now this is grasp the material I'm learning.
It easier for me to understand by looking at the solution with comments rather than reading text.
Both can be useful, but the Internet is truly resplendent with examples. It's well worth taking to learn to use sensible search parameters.