-
Notifications
You must be signed in to change notification settings - Fork 1
/
menuzin.asm
86 lines (69 loc) · 2.3 KB
/
menuzin.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.macro menu()
start:
addi $v0, $zero, 4 #loads v0 for print syscall
la $a0, mainmenu #printcontent adress
syscall
addi $v0, $zero, 5 #loads v0 for read int syscall
syscall #saves value to v0
#all read syscalls request int numbers.Any other input will trigger coproc0.
beq $v0, 1, blurm #if 1 is chosen, go to blur menu
beq $v0, 2, edgem #if 2 is chosen, go to edge extractor menu
beq $v0, 3, binam #if 3 is chosen, go to binary threshold menu
beq $v0, 4, exit #if 4 is chosen, exit program
#if the user types any other value, a error message is printed
addi $v0, $zero, 4 #loads v0 for print syscall
la $a0, errormain #error message adress
syscall
j start
blurm: #blur menu
addi $v0, $zero, 4 #loads v0 for print syscall
la $a0, kernelmenu #print content adress
syscall
blurread:
addi $v0, $zero, 5 #loads v0 for read syscall
syscall #saves value to v0
#from bge to contblur, checks if the typed value is beetween 1 and 3. if it isn't, requests another value
bge $v0,1,condblur1
j blurread
condblur1:
ble $v0,3,contblur
j blurread
contblur:
j start #returns to main menu
edgem: #edge extractor menu
addi $v0, $zero, 4 #loads v0 for print syscall
la $a0, kernelmenu #print content adress
syscall
edgeread:
addi $v0, $zero, 5 #loads v0 for read syscall
syscall #saves value to v0
##from bge to contedge, checks if the typed value is beetween 1 and 3. if it isn't, requests another value
bge $v0,1,condedge1
j edgeread
condedge1:
ble $v0,3,contedge
j edgeread
contedge:
j start #returns to main menu
binam: #binary threshold menu
addi $v0, $zero, 4 #loads v0 for print syscall
la $a0, binamenu #print content adress
syscall
binaread:
addi $v0, $zero, 5 #loads v0 for read int syscall
syscall #saves value to v0
##from bge to contbina, checks if the typed value is beetween 1 and 10. if it isn't, requests another value
bge $v0,1,condbina1
j binaread
condbina1:
ble $v0,10,contbina
j binaread
contbina:
j start
exit:
.end_macro
.data
mainmenu: .asciiz "selecione uma operacao:\n1)blur\n2)edge extractor\n3)binarizacao\n4)exit\n"
errormain: .asciiz "opcao invalida, selecione uma opcao listada."
kernelmenu: .asciiz "selecione o tamanho do kernel:\n1)3x3\n2)5x5\n3) 7x7\n"
binamenu: .asciiz "escolha uma intensidade de 1 a 10:\n"