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

Bare metal, Assembly language • Re: Need help with assembler OPcodes and gdb

$
0
0
The best way in my opinion is to read the ARM Cortex-A Series Programmer's Guide for ARMv8-A. This is a higher level overview of the processor. You'll want to read from the introduction through "The A64 instruction set" at least.

You may also want the Arm Architecture Reference Manual for A-profile architecture, especially when encountering instructions not covered by the Programmer's Guide. The Arm ARM is a reference manual, therefore not very useful for learning, but it is useful for referencing all the possible instructions, registers etc. It's written almost like a legal text. No online resource should be trusted over the Arm ARM unless the resource is correcting errata in the ARM.

Searching the Arm ARM for "lsr" gets me to page F5-8533 (8533), then I scroll down and find LSRS:
Logical Shift Right, setting flags (immediate) shifts a register value right by an immediate number of bits, shifting
in zeros, and writes the result to the destination register.
If the destination register is not the PC, this instruction updates the condition flags based on the result.
So this implies you want "lsrs", not "lsr". As for whether that sets the Carry flag, you'd have to read more in the ARM. I'm sure it says whether it does somewhere.

I keep all my Pi documentation in a Git LFS repository so I can easily refer to them and know years from know I'll still have it. There may be some documents in there which also might be of interest to you.

If you have any interest in your code running on a Pi 5, you should avoid moving back to 32 bit, since the Pi 5 doesn't run A32 at all.

Statistics: Posted by macoy — Tue Mar 05, 2024 3:42 pm



Viewing all articles
Browse latest Browse all 4956

Trending Articles