1

I am taking a course for ARM cortex-M microcontrollers with Assembly Language, and I am trying to figure out how to work with strings in order to complete a problem that asks to convert all characters of a string to uppercase characters, but I am not sure how to approach the problem since I am fairly new to this language. I have attempted the problem by trying to define the string that I want to convert as:

word DCB "Hello world", 0

but I am not sure if this is how strings are defined in this language. Any assistance and explanation for the syntax to be used, what each line of code means, and how to structure the code for this problem would be greatly appreciated!

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Code
  • 51
  • 4
  • 1
    [Arm Assembly Rasperry-Pi: Converting a string to Upper case](https://stackoverflow.com/q/16599258) has some versions, using GAS's version of ARM syntax (same instruction syntax, different directives) – Peter Cordes Feb 20 '21 at 05:29
  • The general idea for the conversion is this: Check if the character is in the range from `a` to `z`. If it is, subtract 32 to get the corresponding upper case character. Do this for each character in the string. – fuz Feb 20 '21 at 12:33
  • Even xor 0x20 rather than sub 0x20 – Antonin GAVREL Feb 20 '21 at 18:19
  • This question is a sub-set of the other question. If the OP has a specific aspect that still seems problematic after looking at the other question; please ask. Note, that duplicate questions are still valuable as someone searching maybe looking for concepts of how to represent a string. Specifically there are 'Pascal' format and 'C' format. Pascal is figuratively 'int size; char data[size]' and there is not a null terminator. The loop mechanics will be different for a pascal string, but the core (`xor 0x20` or `sub 'a' - 'A'`) is the same for ascii; different constant for other encodes. – artless noise Feb 21 '21 at 12:09

0 Answers0