PRINT_INT = 1 PRINT_STR = 4 READ_INT = 5 READ_STR = 8 PRINT_CHAR = 11 N_ROWS = 6 N_COLS = 12 # int row, col; # out_loop_init: # row = 0; # outer_loop_cond: # if(row >= N_ROWS) # goto end_out_loop; # inner_loop_init: # col = 0; # inner_loop_cond: # if (col >= N_COLS) # goto end_inner_loop; # inner_loop_body: # printf("%c", flag[row][col]); # inner_loop_inc: # col++; # goto inner_loop_cond; # end_inner_loop: # printf("\n"); # row++; # goto outer_loop_cond; # end_out_loop: # return (0); .text main: outer_loop_init: li $t0, 0 outer_loop_cond: bge $t0, N_ROWS, end_outer_loop inner_loop_init: li $t1, 0 inner_loop_cond: bge $t1, N_COLS, end_inner_loop inner_loop_body: li $v0, PRINT_CHAR mul $t2, $t0, N_COLS add $t2, $t2, $t1 lb $a0, flag($t2) syscall inner_loop_inc: addi $t1, $t1, 1 b inner_loop_cond end_inner_loop: li $v0, PRINT_CHAR li $a0, '\n' syscall addi $t0, $t0, 1 b outer_loop_cond end_outer_loop: li $v0, 0 # jr $ra # return 0; .data flag: .byte '#', '#', '#', '#', '#', '.', '.', '#', '#', '#', '#', '#', .byte '#', '#', '#', '#', '#', '.', '.', '#', '#', '#', '#', '#', .byte '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', .byte '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', .byte '#', '#', '#', '#', '#', '.', '.', '#', '#', '#', '#', '#', .byte '#', '#', '#', '#', '#', '.', '.', '#', '#', '#', '#', '#' # char flag[N_ROWS][N_COLS] = { # {'#', '#', '#', '#', '#', '.', '.', '#', '#', '#', '#', '#'}, # {'#', '#', '#', '#', '#', '.', '.', '#', '#', '#', '#', '#'}, # {'.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'}, # {'.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'}, # {'#', '#', '#', '#', '#', '.', '.', '#', '#', '#', '#', '#'}, # {'#', '#', '#', '#', '#', '.', '.', '#', '#', '#', '#', '#'} # };