-
Notifications
You must be signed in to change notification settings - Fork 0
/
4.asm
67 lines (50 loc) · 739 Bytes
/
4.asm
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.data
.space 30
mensagem: .asciiz "Digite o tamanho da sua frase: "
mensagem2: .asciiz "Digite a sua frase: "
.text
la $a0, mensagem
li $v0, 4
syscall
li $v0, 5
syscall
move $a1, $v0
addi $a1, $a1, 1
la $a0, mensagem2
li $v0, 4
syscall
li $v0, 8
lui $a0, 0x1001
syscall
li $t8, 32
li $t3, 90
li $t5, 1
inicio:
beq $a1, $zero, fim
lb $t1, ($a0)
slt $t4, $t1, $t3
beq $t1, $t8, espaco
beq $t4, $t5, maiuscula
beq $t4, $zero, minuscula
maiuscula:
addi $t1, $t1, 32
sb $t1, ($a0)
addi $a0, $a0, 1
sub $a1, $a1, $t5
j inicio
minuscula:
sub $t1, $t1, 32
sb $t1, ($a0)
addi $a0, $a0, 1
sub $a1, $a1, $t5
j inicio
espaco:
addi $a0, $a0, 1
sub $a1, $a1, $t5
j inicio
fim:
lui $a0, 0x1001
li $v0, 4
syscall
li $v0, 10
syscall