-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathChanging Letters Lower To Uppercase
38 lines (36 loc) · 1.09 KB
/
Changing Letters Lower To Uppercase
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@Program written by Hamed Adefuwa
@Part of computer architecture university module
@ ---------------------------------------------------------------------------------------------
@
@ 3. Assume the that you have an array of chars with the following sentence stored in it:
@ 3.1. “Computer Architecture Module preparation questions\0”. This arrays ends with a null char.
@ Implement an assembly program to convert each char from lower to upper case.
@
@ My theory: load each character into a register and compare it to see if its below or over 91
@ if over 91 then subtract 32
@ if under 91, then skip and go to next position in array
@ use ldrb / strb.
@ ---------------------------------------------------------------------------------------------
.data
.balign 4
string: .asciz "Computer Architecture Module preparation questions\0" @ String is an array of chars. It is stored in memory.
return: .word 0
.text
.global main
main:
ldr r0,=string
loop:
ldrb r9, [r0]
cmp r9, #0
beq exit
cmp r9, #91
bgt subtract
skip:
add r0, r0, #1
b loop
subtract:
sub r9, #32
strb r9, [r0]
b skip
exit:
swi 0