I am writing an assembler code to do the following:
ToUpper function converts a string of characters to uppercase, if they are not already uppercase. That is, the string already exists in memory (on the stack)
(Yes it is Homework) I am trying my best to do everything I know... whats to the right after the ';' is what is SUPPOSED to happen. I have filled in everything beyond that. and the ____ is where I am totally lost.
So far this is what I have:
[R0= tha address of the null-terminated string R1=Current character to test R2=Offset value between upper and lower cases (beware of sign) R3= lowercase/uppercase compartor R4=scratch register for use with comparisons .orig 0x3000 LEA R0, Data ; Load the address of the data into R0 LEA R2, offset ; Load the address of the lower/upper compartor into R2 LDR R3, R2, #0 ; Load the lower/upper compartor into R2 LEA R3, offset ; Load the address of the offset, OFFSET, into R3 LDR R3, R3, #0; Load the compartor into R3 ;Test for the end of the string Test ADD R1, R2, R3 ; Load the data element to test into R1 BRz Quit ; Branch on zero (null terminated string) ;Test for Lowercase ADD R4, R1, R3; Do the comparison to set condition code (Use R4) BRz Test ; Branch on Lowercase ;increment any counters as needed INCR ADD R0, R0, #1 ; increment address to data BRnzp TEST ; unconditionally branch to the top of the loop QUIT RET LOWER ADD R1, R1, #1 ; Convert value to uppercaes ___, __, __, __ ; Save the changed value back into memory BRnzp INCR ; Return to the loop OFFSET .FILL #-____ COMP .FILL #-____ DATA .FILL #116 ;'t' .FILL #111 ;'o' .FILL #109 ;'m' .FILL 0 .END]