

$mod51 

   org 00h 
   jmp start    ;It's good practice to jump
                ; over the interrupt vectors

   org 40H
start: 
   clr  a       ;Preset zero for reg loading
   mov  r0,a    ;Init .. the minor loop count
   mov  r1,a    ;     .. the major loop count
   setb p2.0    ;     .. LEDs into alternate states 
   clr  p2.3
   
;  *** LED State Delay Loop ***
loop:
   mul  ab      ;this instr. used just for delay
   mul  ab      ; MUL AB = 48 cycles or 4.3us
   mul  ab
   mul  ab
   djnz r1,loop ;Down count the minor loop 

;  *** inner loop count exhausted ***

   djnz r0,loop ;Down count the major loop

;  *** alternate the illumination state of both LEDs ***

   cpl  p2.0 
   cpl  p2.3

   jmp  loop   ;Restart the state delay

   end 

