Hello, fellows!
Collided with such a task: "Using ARM assembler initialize an array of 16 elements each of one is 24-bit signed integer". We're using STM32 for calculations therefore Thumb2 instructions are only available.
Maybe anybody has an idea of what how that can be implemented?
store the low 16bits with STH. Then shift the register value so you can store the final 8bits with STB. Maybe preserve the original register contents. (that assumes you want code. I can also interpret the question as wanting to specify data in source code, which would be different and use macros.)
STM32 includes both CM0 (ARMv6m) and CM3/4(ARMv7m), which have different lists of available instructions, BTW. ARMv6m only supports a very limited subset of THUMB2 (mostly just THUMB)
Trying to solve his homework ;-) But using STH might fails on the second element. But one can split and store the lower 16bit in one table and the higher 8 bit in another. A common trick used on 6502.
Thank you very much) I just got confused of such a task, knowing that in ARM there is an allignement to a word/halfword
That's definetely interesting approach. Thank you :-)
I thought it was a vague enough "hint" for a "do my homework" question.Good point about the 2nd element!
The 6502-like trick is ... clever and gross. four stars!