jeudi 26 mars 2015

What's the technique for outputting the value of a memory address, that is contained inside a string, in ARM?

I have an .asciz "string" in the data field of a program that represents a table of characters in alphabetical order as well as numbers 0-9. I'm attempting to print a solitary character from within the table to a file using SWI commands. I use an ADD to access a particular memory address of the table as seen here:



LDR r1, =Table
ADD r1,r1,r8
SWI SWI_PrStr

.data
Table: .asciz "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890+/"


Note that the filehandle is already stored in R0 before the SWI command is encountered, it's just not pictured here. Instead of getting a printout like f, for example, I get instead: fghijklmnopqrstuvwxyz1234567890+/. Is there an easy way to just print the single value in memory, not using the SWI_PrStr to print the entire line, or would I have to move the value to an array or empty .asciz data table?


Aucun commentaire:

Enregistrer un commentaire