Skip to content

Commit

Permalink
Simplified asm code a little
Browse files Browse the repository at this point in the history
  • Loading branch information
PaintYourDragon committed Dec 14, 2012
1 parent d3077b0 commit b64d68a
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions Adafruit_NeoPixel.cpp
Expand Up @@ -328,15 +328,13 @@ void Adafruit_NeoPixel::show(void) {
"mul r0, r0\n\n" // 2 nop nop (T = 38) "mul r0, r0\n\n" // 2 nop nop (T = 38)
"rjmp head40\n\t" // 2 -> head40 (next bit out) "rjmp head40\n\t" // 2 -> head40 (next bit out)
"nextbyte40:\n\t" // (T = 27) "nextbyte40:\n\t" // (T = 27)
"ldi %3, 8\n\t" // 1 bit = 8 (T = 28) "ldi %3, 8\n\t" // 1 bit = 8 (T = 28)
"ld %2, %a6+\n\t" // 2 b = *ptr++ (T = 30) "ld %2, %a6+\n\t" // 2 b = *ptr++ (T = 30)
"sbiw %7, 1\n\t" // 2 i-- (T = 32) "mul r0, r0\n\n" // 2 nop nop (T = 32)
"st %a0, %5\n\t" // 2 PORT = lo (T = 34) "st %a0, %5\n\t" // 2 PORT = lo (T = 34)
"breq done40\n\t" // 1-2 if(i == 0) -> done "mul r0, r0\n\n" // 2 nop nop (T = 36)
"nop\n\t" // 1 nop (T = 36) "sbiw %7, 1\n\t" // 2 i-- (T = 38)
"mul r0, r0\n\n" // 2 nop nop (T = 38) "brne head40\n\t" // 1-2 if(i != 0) -> head40 (next byte)
"rjmp head40\n\t" // 1-2 -> head40 (next byte)
"done40:\n\t"
:: ::
"e" (port), // %a0 "e" (port), // %a0
"r" (hi), // %1 "r" (hi), // %1
Expand Down Expand Up @@ -391,12 +389,12 @@ void Adafruit_NeoPixel::show(void) {
"st %a0, %5\n\t" // 2 PORT = lo (T = 18) "st %a0, %5\n\t" // 2 PORT = lo (T = 18)
"rjmp head20\n\t" // 2 -> head20 (next bit out) "rjmp head20\n\t" // 2 -> head20 (next bit out)
"nextbyte20:\n\t" // (T = 10) "nextbyte20:\n\t" // (T = 10)
"nop\n\t" // 1 nop (T = 11) "nop\n\t" // 1 nop (T = 11)
"ldi %3, 8\n\t" // 1 bit = 8 (T = 12) "ldi %3, 8\n\t" // 1 bit = 8 (T = 12)
"ld %2, %a6+\n\t" // 2 b = *ptr++ (T = 14) "ld %2, %a6+\n\t" // 2 b = *ptr++ (T = 14)
"sbiw %7, 1\n\t" // 2 i-- (T = 16) "sbiw %7, 1\n\t" // 2 i-- (T = 16)
"st %a0, %5\n\t" // 2 PORT = lo (T = 18) "st %a0, %5\n\t" // 2 PORT = lo (T = 18)
"brne head20\n\t" // 2 if(i != 0) -> head20 (next byte) "brne head20\n\t" // 2 if(i != 0) -> head20 (next byte)
:: ::
"e" (port), // %a0 "e" (port), // %a0
"r" (hi), // %1 "r" (hi), // %1
Expand Down

0 comments on commit b64d68a

Please sign in to comment.