2023-02-19 11:52 PM
Solved! Go to Solution.
2023-02-20 12:07 AM
With asm, often the easiest way is to look at how the compiler does it, i.e. have compiler generate asm from C source (in gcc, using -C).
Jw
2023-02-19 11:57 PM
ChatGPT says:
Q: How can I declare an array in ARM Cortex-M assembler?
A: To declare an array in ARM Cortex-M assembler, you can use the DCB (Define Byte), DCD (Define Doubleword), and DCF (Define Floating-Point) directives, depending on the type of data that you want to store in the array.
Here are examples of how to use these directives to declare arrays of different types:
assembly
my_array DCB 1, 2, 3, 4, 5 ; Declares an array of 5 bytes
assembly
my_array DCD 0x12345678, 0xdeadbeef, 0x87654321 ; Declares an array of 3 32-bit words
assembly
my_array DCD 0x123456789abcdef0, 0xdeadbeef12345678 ; Declares an array of 2 64-bit doublewords
assembly
my_array DCF 3.14, 2.718, 1.414 ; Declares an array of 3 single-precision floating-point numbers
You can access individual elements of the array using the syntax:
assembly
my_array[index]
2023-02-19 11:58 PM
https://lmgtfy.app/?q=declare+an+array+in+assembly+language
2023-02-20 12:07 AM
With asm, often the easiest way is to look at how the compiler does it, i.e. have compiler generate asm from C source (in gcc, using -C).
Jw
2023-02-20 01:35 AM
Thank You for response!
2023-02-20 01:39 AM
Thank You for response, but the link didnt show anything.
2023-02-20 01:39 AM
Thank You for response! I like this idea!