Q7. Consider the following assembly code and write an equivalent C program to realize the same functions. (You can define the variable as the register) ASSUME CS:TT TT SEGMENT START: MOV BX, 0 MOV CX, 12 s: MOV AX, 0FFFFH MOV DS, AX MOV DL, [BX] MOV AX, 0020H MOV DS, AX MOV [BX], DL INC BX LOOP s MOV AX, 4C00H INT 21H TT ENDS END
Q8. Consider the following assembly code. Write an equivalent C program with instructions. bar(int): push {r4, r5, r11, lr} add r11, sp, #8 mov r4, r0 mov r0, #1 cmp r4, #2 blo .LBB0_2 sub r0, r4, #1 bl bar(int) mov r5, r0 sub r0, r4, #2 bl bar(int) mul r0, r0, r5 add r0, r0, #3 .LBB0_2: pop {r4, r5, r11, pc} Hint blo: Branch if unsigned less than bl: Saves PC+4 in link register and jumps to a function