2023-11-17 02:12:11 -05:00
|
|
|
.data
|
|
|
|
data_address: .word 0
|
|
|
|
data_pointer: .word 0
|
|
|
|
newline: .asciiz "\n"
|
|
|
|
.text
|
|
|
|
setup:
|
|
|
|
li $v0, 9
|
|
|
|
li $a0, 30000
|
|
|
|
syscall
|
|
|
|
|
|
|
|
la $t1, data_address
|
|
|
|
sw $v0, ($t1)
|
|
|
|
|
|
|
|
# t0 - current address (data_pointer)
|
|
|
|
# t1 -
|
|
|
|
# t2 - temp
|
|
|
|
move $t0, $v0
|
|
|
|
bf:
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
beqz $t1, BF_CLOSE_1_0
|
|
|
|
BF_OPEN_1_0:
|
|
|
|
addi $t0, $t0, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
beqz $t1, BF_CLOSE_2_1
|
|
|
|
BF_OPEN_2_1:
|
2023-11-17 02:12:11 -05:00
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
addi $t1, $t1, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
subi $t0, $t0, 1
|
|
|
|
subi $t0, $t0, 1
|
|
|
|
subi $t0, $t0, 1
|
|
|
|
subi $t0, $t0, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
bnez $t1, BF_OPEN_2_1
|
|
|
|
BF_CLOSE_2_1:
|
2023-11-17 02:12:11 -05:00
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
2023-11-17 02:12:11 -05:00
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
beqz $t1, BF_CLOSE_3_1
|
|
|
|
BF_OPEN_3_1:
|
2023-11-20 17:26:37 -05:00
|
|
|
subi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
bnez $t1, BF_OPEN_3_1
|
|
|
|
BF_CLOSE_3_1:
|
2023-11-20 17:26:37 -05:00
|
|
|
subi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
subi $t1, $t1, 1
|
2023-11-20 17:26:37 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
bnez $t1, BF_OPEN_1_0
|
|
|
|
BF_CLOSE_1_0:
|
2023-11-20 17:26:37 -05:00
|
|
|
addi $t0, $t0, 1
|
|
|
|
addi $t0, $t0, 1
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
2023-11-20 17:26:37 -05:00
|
|
|
addi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
2023-11-17 02:12:11 -05:00
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
addi $t0, $t0, 1
|
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
2023-11-17 02:12:11 -05:00
|
|
|
subi $t0, $t0, 1
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
2023-11-17 02:12:11 -05:00
|
|
|
subi $t0, $t0, 1
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
addi $t1, $t1, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
subi $t1, $t1, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
subi $t1, $t1, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
subi $t1, $t1, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
subi $t1, $t1, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
subi $t1, $t1, 1
|
2023-11-20 17:26:37 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
subi $t1, $t1, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
|
|
|
subi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|
2023-11-17 02:12:11 -05:00
|
|
|
addi $t0, $t0, 1
|
2023-11-20 17:26:37 -05:00
|
|
|
addi $t0, $t0, 1
|
2023-11-17 02:12:11 -05:00
|
|
|
lb $t1, ($t0)
|
|
|
|
addi $t1, $t1, 1
|
|
|
|
sb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
2023-11-20 17:26:37 -05:00
|
|
|
syscall
|
2023-11-20 17:52:26 -05:00
|
|
|
addi $t0, $t0, 1
|
2023-11-20 17:26:37 -05:00
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
addi $t1, $t1, 1
|
2023-11-20 17:26:37 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
lb $t1, ($t0)
|
2023-11-20 17:52:26 -05:00
|
|
|
addi $t1, $t1, 1
|
2023-11-20 17:26:37 -05:00
|
|
|
sb $t1, ($t0)
|
|
|
|
li $v0, 11
|
|
|
|
lb $a0, ($t0)
|
|
|
|
syscall
|