diff --git a/2-2_asm/src/assembleur.s b/2-2_asm/src/assembleur.s index 47d9aeb6411708b23f8828b4b7b970bd2b6dde3d..672743d2287559e2159b4ebecc15d7b3b7111134 100644 --- a/2-2_asm/src/assembleur.s +++ b/2-2_asm/src/assembleur.s @@ -42,20 +42,21 @@ add_err: .thumb_func funcexo2: // r3 index for loop - mov r3, #0 + mov r3, #1 cmp r3, r2 blt funcexo2_for_loop - mov r0, #1 - bx lr + funcexo2_for_loop: add r3, #1 ldr r4, [r0], #4 - adds r5, r4, r4 + adds r4, r4 bhs err - str r1, [r5], #4 + str r4, [r1], #4 cmp r3, r2 - blt funcexo2_for_loop + blo funcexo2_for_loop + mov r0, #1 + bx lr err: mov r0, #0 @@ -63,13 +64,33 @@ err: - - .thumb_func majuscule: + //index while loop + mov r1, #0 + +debut_while: + ldr r2, [r0], #1 + cmp r2, #0 + bne funcexo3_while_loop + bx lr +funcexo3_while_loop: + cmp r2, #97 + bge second_cond bx lr +second_cond: + cmp r2, #122 + ble if_cond + bx lr + +if_cond: + sub r2, #32 + str r2, [r0, r1] + add r1, #1 + b debut_while + //.weak add_sat .ltorg diff --git a/2-2_asm/src/labo2.2_asm.c b/2-2_asm/src/labo2.2_asm.c index e3995ebc800d5bf8040370c4515bb73966f8fcd9..0217b8a12cce6a322c9e25da46cc75b472a4763a 100644 --- a/2-2_asm/src/labo2.2_asm.c +++ b/2-2_asm/src/labo2.2_asm.c @@ -25,7 +25,7 @@ uint32_t funcexo2(uint32_t *, uint32_t *, uint32_t); void majuscule(char *s); /* global variables */ -int exo = 2; // change this number with the exercise number you want to test; +int exo = 3; // change this number with the exercise number you want to test; int main(void) {