Wednesday, July 14, 2010

Session 3 : Looping

  1. Loops, Conditional jump instructions
  2. Conditions determeining conditional jump
  3. Unconditional long & short jumps
  4. Calculate target addresses for jumps
  5. using stack in subroutines
  6. Crystal frequenscy vs machine cycle
  7. Code programs to generate time delay

Looping ex.3-1
 
MOV    A,#0                     ;;init
MOV    R2,#10
Again:    ADD A,#03        ;;loop body
DJNZ    R2,Again             ;;while test
MOV    R5,A                   ;;after loop
 
> init: A=0; R2=10;
> Loop: do {A+=3;} While (--R2!-0);
   DJNZ means "decrement, jump if not zero"
> after: R5 = A;

No comments: