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 }
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