This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

my contribuiton

ive done this code and want to share.
you can use in your project or change it but you must say i did it here. you can send money if you want to paypal or western union.

int delay ( int pause )
{
  for ( 9 ; pause  && pause ; pause=pause-1 )
    {
#asm
  using   ar0                    //use the registers
  push    2                      //push 2
  mov     2,#0D7h                //move d7 into 2
  djnz    2,$                    //jump aroud and reduce 2
  mov     2,#0D7h                //move d7 into 2
  djnz    2,$                    //jump around and reduce 2
  pop     2                      //pop 2
#endasm
    }
  return 7;             //return with value
}

  • I honestly can't decide who is more confused: you or this "code" !

  • Is this an entry for the "least added value in a comment" competition?

    pop     2                      //pop 2
    

    That comment adds absolutely no value whatsoever!!

  • Is this an entry for the "least added value in a comment" competition?
    Is this an entry for the "most convoluted" competition?

    mov 2,#0D7h //move d7 into 2
    first, the "comment match Andys comment
    second, it took a second or two to figure out
    mov R2,#0D7h //move d7 into R2

    let alone

    for ( 9 what, where?; pause && pause ; pause=pause-1

    for ( 9 ; pause no need && pause ; pause<=pause-1

    for ( 9 ; pause && pause ; pause why not -- and not =pause-1

    should be

    for ( pause = 9 ; pause ; pause--

    or clearer

    for ( pause = 9 ; pause !=0 ; pause--

    and then, of course
    using #pragma asm loses debug, where an asm module retains it

    Erik