(Assuming the Nintendo DS is "obsolete" so this thread can be in Other Retro Dev, move if need be).
I wanted to check out ARM assembly language, but don't have any money for a Raspberry Pi (my preferred method), so I decided to go with the Nintendo DS using libnds.
ARM makes sense to some extent, but due to problems with GAS not letting me grab just #defines from a file and ignore C code, if I continue with the NDS then C will be the primary language rather than the assembler.
That's not exactly what I'm wondering about, though. What I want to know is why GAS chooses to have registers "point to pointers" instead of be pointers.
As an example, for iprintf("HI!");, GAS would generate:
The pointer isn't necessary, though, since afaik registers can be pointers for themselves:
This is kind of a difficult question now that I think about it (and may or may not be kind of an excuse to have people to talk about ARM with) but does anyone know why GAS chooses to manually make pointers rather than just skip that step of the assembly process entirely? Is there a good reason, or is that just a random consequence of having a computer make code for you?
I wanted to check out ARM assembly language, but don't have any money for a Raspberry Pi (my preferred method), so I decided to go with the Nintendo DS using libnds.
ARM makes sense to some extent, but due to problems with GAS not letting me grab just #defines from a file and ignore C code, if I continue with the NDS then C will be the primary language rather than the assembler.
That's not exactly what I'm wondering about, though. What I want to know is why GAS chooses to have registers "point to pointers" instead of be pointers.
As an example, for iprintf("HI!");, GAS would generate:
Code:
ldr r0, [message_pointer]
bl iprintf
message_pointer:
.word message
message:
.ascii "HI!\0"
bl iprintf
message_pointer:
.word message
message:
.ascii "HI!\0"
The pointer isn't necessary, though, since afaik registers can be pointers for themselves:
Code:
ldr r0, =message
bl iprintf
message:
.ascii "HI!\0"
bl iprintf
message:
.ascii "HI!\0"
This is kind of a difficult question now that I think about it (and may or may not be kind of an excuse to have people to talk about ARM with) but does anyone know why GAS chooses to manually make pointers rather than just skip that step of the assembly process entirely? Is there a good reason, or is that just a random consequence of having a computer make code for you?