Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5164

General • Re: Bare-metal Bit Banging GPIO (AQA Assembly style)

$
0
0
In keeping with the style of tasks in the course, can I ignore the flags here (to some extent) and re-write that section of code so that

AND the RESET_DONE value with the bitmask.
CMP the result with 0
BEQ back to reset
Yes, and that's what I would tend to do no matter what the architecture and ISA. It means you only need to remember that CMP sets flags, don't have to care about or know what any other operations do, whether they set flags or don't, require an 's' suffix or something else to set those flags.

Code being more than it needs to be is an irrelevancy in most cases. And being able to write code which will work is the most important goal IMO.

You can write a peep-hole optimiser to take out redundant CMP, compact and refactor code if you were worried about efficiency.

Statistics: Posted by hippy — Thu Jul 04, 2024 8:37 am



Viewing all articles
Browse latest Browse all 5164

Trending Articles