X-Git-Url: https://git.piment-noir.org/?p=TD_IML.git;a=blobdiff_plain;f=TD4%2Fmips1.asm;h=7e49dd305ff5b313ab7ae7c25704b7ec4593ebff;hp=73da674fd5b4304f9d348875bf21b6bdaab01d8b;hb=ca13ceb069c1b24f98864e11dcae99133921052c;hpb=5558d026fc53871fe2622e5bce4722371c3ad293 diff --git a/TD4/mips1.asm b/TD4/mips1.asm index 73da674..7e49dd3 100644 --- a/TD4/mips1.asm +++ b/TD4/mips1.asm @@ -1,7 +1,7 @@ .data - buffer1: .space 20 - buffer2: .space 20 - n: .asciiz "\n" + buffer1: .space 20 + buffer2: .space 20 + n: .asciiz "\n" string_part_one: .asciiz "Le temps est " string_part_two: .asciiz ", je devrais prendre " string_part_three: .asciiz " avant de sortir." @@ -33,15 +33,15 @@ la $a0, buffer1 li $a1, 20 syscall - la $s0, buffer1 # $s0 contains base address of the string buffer + la $s0, buffer1 # $s0 contains base address of the string buffer addi $s3, $0, '\n' # $s3 = '\n' loop1: - lb $s1, 0($s0) # load character into $s0 - beq $s1, $s3, end1 # break if byte is newline + lb $s1, 0($s0) # load character into $s0 + beq $s1, $s3, end1 # break if byte is newline addi $s0, $s0, 1 # increment buffer address - j loop1 + j loop1 end1: - sb $0, 0($s0) #replace newline with 0 + sb $0, 0($s0) # replace newline with 0 la $a0, input_string li $v0, 4 syscall @@ -49,15 +49,15 @@ end1: la $a0, buffer2 li $a1, 20 syscall - la $s0, buffer2 # $s0 contains base address of the string buffer + la $s0, buffer2 # $s0 contains base address of the string buffer addi $s3, $0, '\n' # $s3 = '\n' loop2: - lb $s1, 0($s0) # load character into $s0 - beq $s1, $s3, end2 # break if byte is newline + lb $s1, 0($s0) # load character into $s0 + beq $s1, $s3, end2 # break if byte is newline addi $s0, $s0, 1 # increment buffer address - j loop2 + j loop2 end2: - sb $0, 0($s0) #replace newline with 0 + sb $0, 0($s0) # replace newline with 0 la $a0, string_part_one li $v0, 4 syscall