Write a program in IAR Workbench assembly language that has
Write a program in IAR Workbench assembly language that has a downcounter time from 10 seconds to 0 then resets. Thanks!
Solution
section .text global main extern printf main: mov edx,10 ; // this is to move the number 10 to ebx loop: push edx ;//This is the first parameter push createmessage ;// this is the second parameter call printf ;// now we will call inbuilt printf statement for outputting dec edx ;// we will now decrement the value of ebx by 1( from 10 to 0) jnz loop ;// loop till 0,if not equal to zero go to loop add esp,80 ; finally we will clear all the stack ret createmessage db \"Value = %d\",10,0