Trailing whitespace cleanup

This commit is contained in:
Scott Lahteine
2018-05-10 00:15:22 -05:00
parent 42de5b0310
commit c3a891f790
2 changed files with 205 additions and 205 deletions

View File

@@ -406,12 +406,12 @@ void Planner::init() {
// for the same result - Using C division, it takes 500cycles to complete . // for the same result - Using C division, it takes 500cycles to complete .
A("clr %3") // idx = 0 A("clr %3") // idx = 0
A("mov %14,%6") A("mov %14,%6")
A("mov %15,%7") A("mov %15,%7")
A("mov %16,%8") // nr = interval A("mov %16,%8") // nr = interval
A("tst %16") // nr & 0xFF0000 == 0 ? A("tst %16") // nr & 0xFF0000 == 0 ?
A("brne 2f") // No, skip this A("brne 2f") // No, skip this
A("mov %16,%15") A("mov %16,%15")
A("mov %15,%14") // nr <<= 8, %14 not needed A("mov %15,%14") // nr <<= 8, %14 not needed
A("subi %3,-8") // idx += 8 A("subi %3,-8") // idx += 8
A("tst %16") // nr & 0xFF0000 == 0 ? A("tst %16") // nr & 0xFF0000 == 0 ?
@@ -426,7 +426,7 @@ void Planner::init() {
A("brcc 3f") // No, skip this A("brcc 3f") // No, skip this
A("swap %15") // Swap nibbles A("swap %15") // Swap nibbles
A("swap %16") // Swap nibbles. Low nibble is 0 A("swap %16") // Swap nibbles. Low nibble is 0
A("mov %14, %15") A("mov %14, %15")
A("andi %14,0x0F") // Isolate low nibble A("andi %14,0x0F") // Isolate low nibble
A("andi %15,0xF0") // Keep proper nibble in %15 A("andi %15,0xF0") // Keep proper nibble in %15
A("or %16, %14") // %16:%15 <<= 4 A("or %16, %14") // %16:%15 <<= 4
@@ -435,23 +435,23 @@ void Planner::init() {
L("3") L("3")
A("cpi %16,0x40") // (nr & 0xC00000) == 0 ? A("cpi %16,0x40") // (nr & 0xC00000) == 0 ?
A("brcc 4f") // No, skip this A("brcc 4f") // No, skip this
A("add %15,%15") A("add %15,%15")
A("adc %16,%16") A("adc %16,%16")
A("add %15,%15") A("add %15,%15")
A("adc %16,%16") // %16:%15 <<= 2 A("adc %16,%16") // %16:%15 <<= 2
A("subi %3,-2") // idx += 2 A("subi %3,-2") // idx += 2
L("4") L("4")
A("cpi %16,0x80") // (nr & 0x800000) == 0 ? A("cpi %16,0x80") // (nr & 0x800000) == 0 ?
A("brcc 5f") // No, skip this A("brcc 5f") // No, skip this
A("add %15,%15") A("add %15,%15")
A("adc %16,%16") // %16:%15 <<= 1 A("adc %16,%16") // %16:%15 <<= 1
A("inc %3") // idx += 1 A("inc %3") // idx += 1
// Now %16:%15 contains its MSBit set to 1, or %16:%15 is == 0. We are now absolutely sure // Now %16:%15 contains its MSBit set to 1, or %16:%15 is == 0. We are now absolutely sure
// we have at least 9 MSBits available to enter the initial estimation table // we have at least 9 MSBits available to enter the initial estimation table
L("5") L("5")
A("add %15,%15") A("add %15,%15")
A("adc %16,%16") // %16:%15 = tidx = (nr <<= 1), we lose the top MSBit (always set to 1, %16 is the index into the inverse table) A("adc %16,%16") // %16:%15 = tidx = (nr <<= 1), we lose the top MSBit (always set to 1, %16 is the index into the inverse table)
A("add r30,%16") // Only use top 8 bits A("add r30,%16") // Only use top 8 bits
A("adc r31,%13") // r31:r30 = inv_tab + (tidx) A("adc r31,%13") // r31:r30 = inv_tab + (tidx)
@@ -467,31 +467,31 @@ void Planner::init() {
// idx > 8, now %3 = idx - 8. We must perform a left shift. idx range:[1-8] // idx > 8, now %3 = idx - 8. We must perform a left shift. idx range:[1-8]
A("sbrs %3,0") // shift by 1bit position? A("sbrs %3,0") // shift by 1bit position?
A("rjmp 8f") // No A("rjmp 8f") // No
A("add %14,%14") A("add %14,%14")
A("adc %15,%15") // %15:16 <<= 1 A("adc %15,%15") // %15:16 <<= 1
L("8") L("8")
A("sbrs %3,1") // shift by 2bit position? A("sbrs %3,1") // shift by 2bit position?
A("rjmp 9f") // No A("rjmp 9f") // No
A("add %14,%14") A("add %14,%14")
A("adc %15,%15") A("adc %15,%15")
A("add %14,%14") A("add %14,%14")
A("adc %15,%15") // %15:16 <<= 1 A("adc %15,%15") // %15:16 <<= 1
L("9") L("9")
A("sbrs %3,2") // shift by 4bits position? A("sbrs %3,2") // shift by 4bits position?
A("rjmp 16f") // No A("rjmp 16f") // No
A("swap %15") // Swap nibbles. lo nibble of %15 will always be 0 A("swap %15") // Swap nibbles. lo nibble of %15 will always be 0
A("swap %14") // Swap nibbles A("swap %14") // Swap nibbles
A("mov %12,%14") A("mov %12,%14")
A("andi %12,0x0F") // isolate low nibble A("andi %12,0x0F") // isolate low nibble
A("andi %14,0xF0") // and clear it A("andi %14,0xF0") // and clear it
A("or %15,%12") // %15:%16 <<= 4 A("or %15,%12") // %15:%16 <<= 4
L("16") L("16")
A("sbrs %3,3") // shift by 8bits position? A("sbrs %3,3") // shift by 8bits position?
A("rjmp 6f") // No, we are done A("rjmp 6f") // No, we are done
A("mov %16,%15") A("mov %16,%15")
A("mov %15,%14") A("mov %15,%14")
A("clr %14") A("clr %14")
A("jmp 6f") A("jmp 6f")
// idx < 8, now %3 = idx - 8. Get the count of bits // idx < 8, now %3 = idx - 8. Get the count of bits
L("7") L("7")
@@ -499,14 +499,14 @@ void Planner::init() {
A("sbrs %3,0") // shift by 1 bit position ? A("sbrs %3,0") // shift by 1 bit position ?
A("rjmp 10f") // No, skip it A("rjmp 10f") // No, skip it
A("asr %15") // (bit7 is always 0 here) A("asr %15") // (bit7 is always 0 here)
A("ror %14") A("ror %14")
L("10") L("10")
A("sbrs %3,1") // shift by 2 bit position ? A("sbrs %3,1") // shift by 2 bit position ?
A("rjmp 11f") // No, skip it A("rjmp 11f") // No, skip it
A("asr %15") // (bit7 is always 0 here) A("asr %15") // (bit7 is always 0 here)
A("ror %14") A("ror %14")
A("asr %15") // (bit7 is always 0 here) A("asr %15") // (bit7 is always 0 here)
A("ror %14") A("ror %14")
L("11") L("11")
A("sbrs %3,2") // shift by 4 bit position ? A("sbrs %3,2") // shift by 4 bit position ?
A("rjmp 12f") // No, skip it A("rjmp 12f") // No, skip it
@@ -518,8 +518,8 @@ void Planner::init() {
L("12") L("12")
A("sbrs %3,3") // shift by 8 bit position ? A("sbrs %3,3") // shift by 8 bit position ?
A("rjmp 6f") // No, skip it A("rjmp 6f") // No, skip it
A("mov %14,%15") A("mov %14,%15")
A("clr %15") A("clr %15")
L("6") // %16:%15:%14 = initial estimation of 0x1000000 / d) L("6") // %16:%15:%14 = initial estimation of 0x1000000 / d)
// Now, we must refine the estimation present on %16:%15:%14 using 1 iteration // Now, we must refine the estimation present on %16:%15:%14 using 1 iteration
@@ -533,33 +533,33 @@ void Planner::init() {
// %3:%2:%1:%0 = working accumulator // %3:%2:%1:%0 = working accumulator
// Compute 1<<25 - x*d. Result should never exceed 25 bits and should always be positive // Compute 1<<25 - x*d. Result should never exceed 25 bits and should always be positive
A("clr %0") A("clr %0")
A("clr %1") A("clr %1")
A("clr %2") A("clr %2")
A("ldi %3,2") // %3:%2:%1:%0 = 0x2000000 A("ldi %3,2") // %3:%2:%1:%0 = 0x2000000
A("mul %6,%14") // r1:r0 = LO(d) * LO(x) A("mul %6,%14") // r1:r0 = LO(d) * LO(x)
A("sub %0,r0") A("sub %0,r0")
A("sbc %1,r1") A("sbc %1,r1")
A("sbc %2,%13") A("sbc %2,%13")
A("sbc %3,%13") // %3:%2:%1:%0 -= LO(d) * LO(x) A("sbc %3,%13") // %3:%2:%1:%0 -= LO(d) * LO(x)
A("mul %7,%14") // r1:r0 = MI(d) * LO(x) A("mul %7,%14") // r1:r0 = MI(d) * LO(x)
A("sub %1,r0") A("sub %1,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%13") // %3:%2:%1:%0 -= MI(d) * LO(x) << 8 A("sbc %3,%13") // %3:%2:%1:%0 -= MI(d) * LO(x) << 8
A("mul %8,%14") // r1:r0 = HI(d) * LO(x) A("mul %8,%14") // r1:r0 = HI(d) * LO(x)
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") // %3:%2:%1:%0 -= MIL(d) * LO(x) << 16 A("sbc %3,r1") // %3:%2:%1:%0 -= MIL(d) * LO(x) << 16
A("mul %6,%15") // r1:r0 = LO(d) * MI(x) A("mul %6,%15") // r1:r0 = LO(d) * MI(x)
A("sub %1,r0") A("sub %1,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%13") // %3:%2:%1:%0 -= LO(d) * MI(x) << 8 A("sbc %3,%13") // %3:%2:%1:%0 -= LO(d) * MI(x) << 8
A("mul %7,%15") // r1:r0 = MI(d) * MI(x) A("mul %7,%15") // r1:r0 = MI(d) * MI(x)
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") // %3:%2:%1:%0 -= MI(d) * MI(x) << 16 A("sbc %3,r1") // %3:%2:%1:%0 -= MI(d) * MI(x) << 16
A("mul %8,%15") // r1:r0 = HI(d) * MI(x) A("mul %8,%15") // r1:r0 = HI(d) * MI(x)
A("sub %3,r0") // %3:%2:%1:%0 -= MIL(d) * MI(x) << 24 A("sub %3,r0") // %3:%2:%1:%0 -= MIL(d) * MI(x) << 24
A("mul %6,%16") // r1:r0 = LO(d) * HI(x) A("mul %6,%16") // r1:r0 = LO(d) * HI(x)
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") // %3:%2:%1:%0 -= LO(d) * HI(x) << 16 A("sbc %3,r1") // %3:%2:%1:%0 -= LO(d) * HI(x) << 16
A("mul %7,%16") // r1:r0 = MI(d) * HI(x) A("mul %7,%16") // r1:r0 = MI(d) * HI(x)
A("sub %3,r0") // %3:%2:%1:%0 -= MI(d) * HI(x) << 24 A("sub %3,r0") // %3:%2:%1:%0 -= MI(d) * HI(x) << 24
@@ -573,58 +573,58 @@ void Planner::init() {
// result = %11:%10:%9:%5:%4 // result = %11:%10:%9:%5:%4
A("mul %14,%0") // r1:r0 = LO(x) * LO(acc) A("mul %14,%0") // r1:r0 = LO(x) * LO(acc)
A("mov %4,r1") A("mov %4,r1")
A("clr %5") A("clr %5")
A("clr %9") A("clr %9")
A("clr %10") A("clr %10")
A("clr %11") // %11:%10:%9:%5:%4 = LO(x) * LO(acc) >> 8 A("clr %11") // %11:%10:%9:%5:%4 = LO(x) * LO(acc) >> 8
A("mul %15,%0") // r1:r0 = MI(x) * LO(acc) A("mul %15,%0") // r1:r0 = MI(x) * LO(acc)
A("add %4,r0") A("add %4,r0")
A("adc %5,r1") A("adc %5,r1")
A("adc %9,%13") A("adc %9,%13")
A("adc %10,%13") A("adc %10,%13")
A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * LO(acc) A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * LO(acc)
A("mul %16,%0") // r1:r0 = HI(x) * LO(acc) A("mul %16,%0") // r1:r0 = HI(x) * LO(acc)
A("add %5,r0") A("add %5,r0")
A("adc %9,r1") A("adc %9,r1")
A("adc %10,%13") A("adc %10,%13")
A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * LO(acc) << 8 A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * LO(acc) << 8
A("mul %14,%1") // r1:r0 = LO(x) * MIL(acc) A("mul %14,%1") // r1:r0 = LO(x) * MIL(acc)
A("add %4,r0") A("add %4,r0")
A("adc %5,r1") A("adc %5,r1")
A("adc %9,%13") A("adc %9,%13")
A("adc %10,%13") A("adc %10,%13")
A("adc %11,%13") // %11:%10:%9:%5:%4 = LO(x) * MIL(acc) A("adc %11,%13") // %11:%10:%9:%5:%4 = LO(x) * MIL(acc)
A("mul %15,%1") // r1:r0 = MI(x) * MIL(acc) A("mul %15,%1") // r1:r0 = MI(x) * MIL(acc)
A("add %5,r0") A("add %5,r0")
A("adc %9,r1") A("adc %9,r1")
A("adc %10,%13") A("adc %10,%13")
A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * MIL(acc) << 8 A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * MIL(acc) << 8
A("mul %16,%1") // r1:r0 = HI(x) * MIL(acc) A("mul %16,%1") // r1:r0 = HI(x) * MIL(acc)
A("add %9,r0") A("add %9,r0")
A("adc %10,r1") A("adc %10,r1")
A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * MIL(acc) << 16 A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * MIL(acc) << 16
A("mul %14,%2") // r1:r0 = LO(x) * MIH(acc) A("mul %14,%2") // r1:r0 = LO(x) * MIH(acc)
A("add %5,r0") A("add %5,r0")
A("adc %9,r1") A("adc %9,r1")
A("adc %10,%13") A("adc %10,%13")
A("adc %11,%13") // %11:%10:%9:%5:%4 = LO(x) * MIH(acc) << 8 A("adc %11,%13") // %11:%10:%9:%5:%4 = LO(x) * MIH(acc) << 8
A("mul %15,%2") // r1:r0 = MI(x) * MIH(acc) A("mul %15,%2") // r1:r0 = MI(x) * MIH(acc)
A("add %9,r0") A("add %9,r0")
A("adc %10,r1") A("adc %10,r1")
A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * MIH(acc) << 16 A("adc %11,%13") // %11:%10:%9:%5:%4 += MI(x) * MIH(acc) << 16
A("mul %16,%2") // r1:r0 = HI(x) * MIH(acc) A("mul %16,%2") // r1:r0 = HI(x) * MIH(acc)
A("add %10,r0") A("add %10,r0")
A("adc %11,r1") // %11:%10:%9:%5:%4 += MI(x) * MIH(acc) << 24 A("adc %11,r1") // %11:%10:%9:%5:%4 += MI(x) * MIH(acc) << 24
A("mul %14,%3") // r1:r0 = LO(x) * HI(acc) A("mul %14,%3") // r1:r0 = LO(x) * HI(acc)
A("add %9,r0") A("add %9,r0")
A("adc %10,r1") A("adc %10,r1")
A("adc %11,%13") // %11:%10:%9:%5:%4 = LO(x) * HI(acc) << 16 A("adc %11,%13") // %11:%10:%9:%5:%4 = LO(x) * HI(acc) << 16
A("mul %15,%3") // r1:r0 = MI(x) * HI(acc) A("mul %15,%3") // r1:r0 = MI(x) * HI(acc)
A("add %10,r0") A("add %10,r0")
A("adc %11,r1") // %11:%10:%9:%5:%4 += MI(x) * HI(acc) << 24 A("adc %11,r1") // %11:%10:%9:%5:%4 += MI(x) * HI(acc) << 24
A("mul %16,%3") // r1:r0 = HI(x) * HI(acc) A("mul %16,%3") // r1:r0 = HI(x) * HI(acc)
A("add %11,r0") // %11:%10:%9:%5:%4 += MI(x) * HI(acc) << 32 A("add %11,r0") // %11:%10:%9:%5:%4 += MI(x) * HI(acc) << 32
@@ -635,33 +635,33 @@ void Planner::init() {
// (1<<24) - x*d // (1<<24) - x*d
// %11:%10:%9 = x // %11:%10:%9 = x
// %8:%7:%6 = d = interval" "\n\t" // %8:%7:%6 = d = interval" "\n\t"
A("ldi %3,1") A("ldi %3,1")
A("clr %2") A("clr %2")
A("clr %1") A("clr %1")
A("clr %0") // %3:%2:%1:%0 = 0x1000000 A("clr %0") // %3:%2:%1:%0 = 0x1000000
A("mul %6,%9") // r1:r0 = LO(d) * LO(x) A("mul %6,%9") // r1:r0 = LO(d) * LO(x)
A("sub %0,r0") A("sub %0,r0")
A("sbc %1,r1") A("sbc %1,r1")
A("sbc %2,%13") A("sbc %2,%13")
A("sbc %3,%13") // %3:%2:%1:%0 -= LO(d) * LO(x) A("sbc %3,%13") // %3:%2:%1:%0 -= LO(d) * LO(x)
A("mul %7,%9") // r1:r0 = MI(d) * LO(x) A("mul %7,%9") // r1:r0 = MI(d) * LO(x)
A("sub %1,r0") A("sub %1,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%13") // %3:%2:%1:%0 -= MI(d) * LO(x) << 8 A("sbc %3,%13") // %3:%2:%1:%0 -= MI(d) * LO(x) << 8
A("mul %8,%9") // r1:r0 = HI(d) * LO(x) A("mul %8,%9") // r1:r0 = HI(d) * LO(x)
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") // %3:%2:%1:%0 -= MIL(d) * LO(x) << 16 A("sbc %3,r1") // %3:%2:%1:%0 -= MIL(d) * LO(x) << 16
A("mul %6,%10") // r1:r0 = LO(d) * MI(x) A("mul %6,%10") // r1:r0 = LO(d) * MI(x)
A("sub %1,r0") A("sub %1,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%13") // %3:%2:%1:%0 -= LO(d) * MI(x) << 8 A("sbc %3,%13") // %3:%2:%1:%0 -= LO(d) * MI(x) << 8
A("mul %7,%10") // r1:r0 = MI(d) * MI(x) A("mul %7,%10") // r1:r0 = MI(d) * MI(x)
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") // %3:%2:%1:%0 -= MI(d) * MI(x) << 16 A("sbc %3,r1") // %3:%2:%1:%0 -= MI(d) * MI(x) << 16
A("mul %8,%10") // r1:r0 = HI(d) * MI(x) A("mul %8,%10") // r1:r0 = HI(d) * MI(x)
A("sub %3,r0") // %3:%2:%1:%0 -= MIL(d) * MI(x) << 24 A("sub %3,r0") // %3:%2:%1:%0 -= MIL(d) * MI(x) << 24
A("mul %6,%11") // r1:r0 = LO(d) * HI(x) A("mul %6,%11") // r1:r0 = LO(d) * HI(x)
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") // %3:%2:%1:%0 -= LO(d) * HI(x) << 16 A("sbc %3,r1") // %3:%2:%1:%0 -= LO(d) * HI(x) << 16
A("mul %7,%11") // r1:r0 = MI(d) * HI(x) A("mul %7,%11") // r1:r0 = MI(d) * HI(x)
A("sub %3,r0") // %3:%2:%1:%0 -= MI(d) * HI(x) << 24 A("sub %3,r0") // %3:%2:%1:%0 -= MI(d) * HI(x) << 24
@@ -669,15 +669,15 @@ void Planner::init() {
// %8:%7:%6 = d = interval // %8:%7:%6 = d = interval
// Perform the final correction // Perform the final correction
A("sub %0,%6") A("sub %0,%6")
A("sbc %1,%7") A("sbc %1,%7")
A("sbc %2,%8") // r -= d A("sbc %2,%8") // r -= d
A("brcs 14f") // if ( r >= d) A("brcs 14f") // if ( r >= d)
// %11:%10:%9 = x // %11:%10:%9 = x
A("ldi %3,1") A("ldi %3,1")
A("add %9,%3") A("add %9,%3")
A("adc %10,%13") A("adc %10,%13")
A("adc %11,%13") // x++ A("adc %11,%13") // x++
L("14") L("14")
@@ -1850,25 +1850,25 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
/** /**
* Compute maximum allowable entry speed at junction by centripetal acceleration approximation. * Compute maximum allowable entry speed at junction by centripetal acceleration approximation.
* Let a circle be tangent to both previous and current path line segments, where the junction * Let a circle be tangent to both previous and current path line segments, where the junction
* deviation is defined as the distance from the junction to the closest edge of the circle, * deviation is defined as the distance from the junction to the closest edge of the circle,
* colinear with the circle center. The circular segment joining the two paths represents the * colinear with the circle center. The circular segment joining the two paths represents the
* path of centripetal acceleration. Solve for max velocity based on max acceleration about the * path of centripetal acceleration. Solve for max velocity based on max acceleration about the
* radius of the circle, defined indirectly by junction deviation. This may be also viewed as * radius of the circle, defined indirectly by junction deviation. This may be also viewed as
* path width or max_jerk in the previous Grbl version. This approach does not actually deviate * path width or max_jerk in the previous Grbl version. This approach does not actually deviate
* from path, but used as a robust way to compute cornering speeds, as it takes into account the * from path, but used as a robust way to compute cornering speeds, as it takes into account the
* nonlinearities of both the junction angle and junction velocity. * nonlinearities of both the junction angle and junction velocity.
* *
* NOTE: If the junction deviation value is finite, Grbl executes the motions in an exact path * NOTE: If the junction deviation value is finite, Grbl executes the motions in an exact path
* mode (G61). If the junction deviation value is zero, Grbl will execute the motion in an exact * mode (G61). If the junction deviation value is zero, Grbl will execute the motion in an exact
* stop mode (G61.1) manner. In the future, if continuous mode (G64) is desired, the math here * stop mode (G61.1) manner. In the future, if continuous mode (G64) is desired, the math here
* is exactly the same. Instead of motioning all the way to junction point, the machine will * is exactly the same. Instead of motioning all the way to junction point, the machine will
* just follow the arc circle defined here. The Arduino doesn't have the CPU cycles to perform * just follow the arc circle defined here. The Arduino doesn't have the CPU cycles to perform
* a continuous mode path, but ARM-based microcontrollers most certainly do. * a continuous mode path, but ARM-based microcontrollers most certainly do.
* *
* NOTE: The max junction speed is a fixed value, since machine acceleration limits cannot be * NOTE: The max junction speed is a fixed value, since machine acceleration limits cannot be
* changed dynamically during operation nor can the line move geometry. This must be kept in * changed dynamically during operation nor can the line move geometry. This must be kept in
* memory in the event of a feedrate override changing the nominal speeds of blocks, which can * memory in the event of a feedrate override changing the nominal speeds of blocks, which can
* change the overall maximum entry speed conditions of all blocks. * change the overall maximum entry speed conditions of all blocks.
*/ */
@@ -1996,7 +1996,7 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
} }
else else
vmax_junction = safe_speed; vmax_junction = safe_speed;
previous_safe_speed = safe_speed; previous_safe_speed = safe_speed;
#endif // Classic Jerk Limiting #endif // Classic Jerk Limiting
@@ -2021,7 +2021,7 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
// Update previous path unit_vector and nominal speed // Update previous path unit_vector and nominal speed
COPY(previous_speed, current_speed); COPY(previous_speed, current_speed);
previous_nominal_speed = block->nominal_speed; previous_nominal_speed = block->nominal_speed;
// Move buffer head // Move buffer head
block_buffer_head = next_buffer_head; block_buffer_head = next_buffer_head;
@@ -2060,7 +2060,7 @@ void Planner::buffer_sync_block() {
block->nominal_speed = block->nominal_speed =
block->entry_speed = block->entry_speed =
block->max_entry_speed = block->max_entry_speed =
block->millimeters = block->millimeters =
block->acceleration = 0; block->acceleration = 0;
block->step_event_count = block->step_event_count =

View File

@@ -625,23 +625,23 @@ void Stepper::set_directions() {
/* %10 (must be high register!)*/ /* %10 (must be high register!)*/
/* Store initial velocity*/ /* Store initial velocity*/
A("sts bezier_F, %0") A("sts bezier_F, %0")
A("sts bezier_F+1, %1") A("sts bezier_F+1, %1")
A("sts bezier_F+2, %10") /* bezier_F = %10:%1:%0 = v0 */ A("sts bezier_F+2, %10") /* bezier_F = %10:%1:%0 = v0 */
/* Get delta speed */ /* Get delta speed */
A("ldi %2,-1") /* %2 = 0xFF, means A_negative = true */ A("ldi %2,-1") /* %2 = 0xFF, means A_negative = true */
A("clr %8") /* %8 = 0 */ A("clr %8") /* %8 = 0 */
A("sub %0,%3") A("sub %0,%3")
A("sbc %1,%4") A("sbc %1,%4")
A("sbc %10,%5") /* v0 -= v1, C=1 if result is negative */ A("sbc %10,%5") /* v0 -= v1, C=1 if result is negative */
A("brcc 1f") /* branch if result is positive (C=0), that means v0 >= v1 */ A("brcc 1f") /* branch if result is positive (C=0), that means v0 >= v1 */
/* Result was negative, get the absolute value*/ /* Result was negative, get the absolute value*/
A("com %10") A("com %10")
A("com %1") A("com %1")
A("neg %0") A("neg %0")
A("sbc %1,%2") A("sbc %1,%2")
A("sbc %10,%2") /* %10:%1:%0 +1 -> %10:%1:%0 = -(v0 - v1) = (v1 - v0) */ A("sbc %10,%2") /* %10:%1:%0 +1 -> %10:%1:%0 = -(v0 - v1) = (v1 - v0) */
A("clr %2") /* %2 = 0, means A_negative = false */ A("clr %2") /* %2 = 0, means A_negative = false */
@@ -652,41 +652,41 @@ void Stepper::set_directions() {
/* Compute coefficients A,B and C [20 cycles worst case]*/ /* Compute coefficients A,B and C [20 cycles worst case]*/
A("ldi %9,6") /* %9 = 6 */ A("ldi %9,6") /* %9 = 6 */
A("mul %0,%9") /* r1:r0 = 6*LO(v0-v1) */ A("mul %0,%9") /* r1:r0 = 6*LO(v0-v1) */
A("sts bezier_A, r0") A("sts bezier_A, r0")
A("mov %6,r1") A("mov %6,r1")
A("clr %7") /* %7:%6:r0 = 6*LO(v0-v1) */ A("clr %7") /* %7:%6:r0 = 6*LO(v0-v1) */
A("mul %1,%9") /* r1:r0 = 6*MI(v0-v1) */ A("mul %1,%9") /* r1:r0 = 6*MI(v0-v1) */
A("add %6,r0") A("add %6,r0")
A("adc %7,r1") /* %7:%6:?? += 6*MI(v0-v1) << 8 */ A("adc %7,r1") /* %7:%6:?? += 6*MI(v0-v1) << 8 */
A("mul %10,%9") /* r1:r0 = 6*HI(v0-v1) */ A("mul %10,%9") /* r1:r0 = 6*HI(v0-v1) */
A("add %7,r0") /* %7:%6:?? += 6*HI(v0-v1) << 16 */ A("add %7,r0") /* %7:%6:?? += 6*HI(v0-v1) << 16 */
A("sts bezier_A+1, %6") A("sts bezier_A+1, %6")
A("sts bezier_A+2, %7") /* bezier_A = %7:%6:?? = 6*(v0-v1) [35 cycles worst] */ A("sts bezier_A+2, %7") /* bezier_A = %7:%6:?? = 6*(v0-v1) [35 cycles worst] */
A("ldi %9,15") /* %9 = 15 */ A("ldi %9,15") /* %9 = 15 */
A("mul %0,%9") /* r1:r0 = 5*LO(v0-v1) */ A("mul %0,%9") /* r1:r0 = 5*LO(v0-v1) */
A("sts bezier_B, r0") A("sts bezier_B, r0")
A("mov %6,r1") A("mov %6,r1")
A("clr %7") /* %7:%6:?? = 5*LO(v0-v1) */ A("clr %7") /* %7:%6:?? = 5*LO(v0-v1) */
A("mul %1,%9") /* r1:r0 = 5*MI(v0-v1) */ A("mul %1,%9") /* r1:r0 = 5*MI(v0-v1) */
A("add %6,r0") A("add %6,r0")
A("adc %7,r1") /* %7:%6:?? += 5*MI(v0-v1) << 8 */ A("adc %7,r1") /* %7:%6:?? += 5*MI(v0-v1) << 8 */
A("mul %10,%9") /* r1:r0 = 5*HI(v0-v1) */ A("mul %10,%9") /* r1:r0 = 5*HI(v0-v1) */
A("add %7,r0") /* %7:%6:?? += 5*HI(v0-v1) << 16 */ A("add %7,r0") /* %7:%6:?? += 5*HI(v0-v1) << 16 */
A("sts bezier_B+1, %6") A("sts bezier_B+1, %6")
A("sts bezier_B+2, %7") /* bezier_B = %7:%6:?? = 5*(v0-v1) [50 cycles worst] */ A("sts bezier_B+2, %7") /* bezier_B = %7:%6:?? = 5*(v0-v1) [50 cycles worst] */
A("ldi %9,10") /* %9 = 10 */ A("ldi %9,10") /* %9 = 10 */
A("mul %0,%9") /* r1:r0 = 10*LO(v0-v1) */ A("mul %0,%9") /* r1:r0 = 10*LO(v0-v1) */
A("sts bezier_C, r0") A("sts bezier_C, r0")
A("mov %6,r1") A("mov %6,r1")
A("clr %7") /* %7:%6:?? = 10*LO(v0-v1) */ A("clr %7") /* %7:%6:?? = 10*LO(v0-v1) */
A("mul %1,%9") /* r1:r0 = 10*MI(v0-v1) */ A("mul %1,%9") /* r1:r0 = 10*MI(v0-v1) */
A("add %6,r0") A("add %6,r0")
A("adc %7,r1") /* %7:%6:?? += 10*MI(v0-v1) << 8 */ A("adc %7,r1") /* %7:%6:?? += 10*MI(v0-v1) << 8 */
A("mul %10,%9") /* r1:r0 = 10*HI(v0-v1) */ A("mul %10,%9") /* r1:r0 = 10*HI(v0-v1) */
A("add %7,r0") /* %7:%6:?? += 10*HI(v0-v1) << 16 */ A("add %7,r0") /* %7:%6:?? += 10*HI(v0-v1) << 16 */
A("sts bezier_C+1, %6") A("sts bezier_C+1, %6")
" sts bezier_C+2, %7" /* bezier_C = %7:%6:?? = 10*(v0-v1) [65 cycles worst] */ " sts bezier_C+2, %7" /* bezier_C = %7:%6:?? = 10*(v0-v1) [65 cycles worst] */
: "+r" (r2), : "+r" (r2),
"+d" (r3), "+d" (r3),
@@ -724,13 +724,13 @@ void Stepper::set_directions() {
A("clr %8") /* %8:%7 = LO(bezier_AV)*LO(curr_step) >> 8*/ A("clr %8") /* %8:%7 = LO(bezier_AV)*LO(curr_step) >> 8*/
A("lds %10,bezier_AV+1") /* %10 = MI(AV)*/ A("lds %10,bezier_AV+1") /* %10 = MI(AV)*/
A("mul %10,%2") /* r1:r0 = MI(bezier_AV)*LO(curr_step)*/ A("mul %10,%2") /* r1:r0 = MI(bezier_AV)*LO(curr_step)*/
A("add %7,r0") A("add %7,r0")
A("adc %8,r1") /* %8:%7 += MI(bezier_AV)*LO(curr_step)*/ A("adc %8,r1") /* %8:%7 += MI(bezier_AV)*LO(curr_step)*/
A("lds r1,bezier_AV+2") /* r11 = HI(AV)*/ A("lds r1,bezier_AV+2") /* r11 = HI(AV)*/
A("mul r1,%2") /* r1:r0 = HI(bezier_AV)*LO(curr_step)*/ A("mul r1,%2") /* r1:r0 = HI(bezier_AV)*LO(curr_step)*/
A("add %8,r0") /* %8:%7 += HI(bezier_AV)*LO(curr_step) << 8*/ A("add %8,r0") /* %8:%7 += HI(bezier_AV)*LO(curr_step) << 8*/
A("mul %9,%3") /* r1:r0 = LO(bezier_AV)*MI(curr_step)*/ A("mul %9,%3") /* r1:r0 = LO(bezier_AV)*MI(curr_step)*/
A("add %7,r0") A("add %7,r0")
A("adc %8,r1") /* %8:%7 += LO(bezier_AV)*MI(curr_step)*/ A("adc %8,r1") /* %8:%7 += LO(bezier_AV)*MI(curr_step)*/
A("mul %10,%3") /* r1:r0 = MI(bezier_AV)*MI(curr_step)*/ A("mul %10,%3") /* r1:r0 = MI(bezier_AV)*MI(curr_step)*/
A("add %8,r0") /* %8:%7 += LO(bezier_AV)*MI(curr_step) << 8*/ A("add %8,r0") /* %8:%7 += LO(bezier_AV)*MI(curr_step) << 8*/
@@ -740,7 +740,7 @@ void Stepper::set_directions() {
/* uint16_t f = t;*/ /* uint16_t f = t;*/
A("mov %5,%7") /* %6:%5 = f*/ A("mov %5,%7") /* %6:%5 = f*/
A("mov %6,%8") A("mov %6,%8")
/* %6:%5 = f*/ /* %6:%5 = f*/
/* umul16x16to16hi(f, f, t); / Range 16 bits (unsigned) [17] */ /* umul16x16to16hi(f, f, t); / Range 16 bits (unsigned) [17] */
@@ -786,12 +786,12 @@ void Stepper::set_directions() {
/* uint24_t acc = bezier_F; / Range 20 bits (unsigned)*/ /* uint24_t acc = bezier_F; / Range 20 bits (unsigned)*/
A("clr %9") /* "decimal place we get for free"*/ A("clr %9") /* "decimal place we get for free"*/
A("lds %2,bezier_F") A("lds %2,bezier_F")
A("lds %3,bezier_F+1") A("lds %3,bezier_F+1")
A("lds %4,bezier_F+2") /* %4:%3:%2 = acc*/ A("lds %4,bezier_F+2") /* %4:%3:%2 = acc*/
/* if (A_negative) {*/ /* if (A_negative) {*/
A("lds r0,A_negative") A("lds r0,A_negative")
A("or r0,%0") /* Is flag signalling negative? */ A("or r0,%0") /* Is flag signalling negative? */
A("brne 3f") /* If yes, Skip next instruction if A was negative*/ A("brne 3f") /* If yes, Skip next instruction if A was negative*/
A("rjmp 1f") /* Otherwise, jump */ A("rjmp 1f") /* Otherwise, jump */
@@ -802,32 +802,32 @@ void Stepper::set_directions() {
L("3") L("3")
A("lds %10, bezier_C") /* %10 = LO(bezier_C)*/ A("lds %10, bezier_C") /* %10 = LO(bezier_C)*/
A("mul %10,%5") /* r1:r0 = LO(bezier_C) * LO(f)*/ A("mul %10,%5") /* r1:r0 = LO(bezier_C) * LO(f)*/
A("sub %9,r1") A("sub %9,r1")
A("sbc %2,%0") A("sbc %2,%0")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(LO(bezier_C) * LO(f))*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(LO(bezier_C) * LO(f))*/
A("lds %11, bezier_C+1") /* %11 = MI(bezier_C)*/ A("lds %11, bezier_C+1") /* %11 = MI(bezier_C)*/
A("mul %11,%5") /* r1:r0 = MI(bezier_C) * LO(f)*/ A("mul %11,%5") /* r1:r0 = MI(bezier_C) * LO(f)*/
A("sub %9,r0") A("sub %9,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_C) * LO(f)*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_C) * LO(f)*/
A("lds %1, bezier_C+2") /* %1 = HI(bezier_C)*/ A("lds %1, bezier_C+2") /* %1 = HI(bezier_C)*/
A("mul %1,%5") /* r1:r0 = MI(bezier_C) * LO(f)*/ A("mul %1,%5") /* r1:r0 = MI(bezier_C) * LO(f)*/
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") A("sbc %3,r1")
A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(bezier_C) * LO(f) << 8*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(bezier_C) * LO(f) << 8*/
A("mul %10,%6") /* r1:r0 = LO(bezier_C) * MI(f)*/ A("mul %10,%6") /* r1:r0 = LO(bezier_C) * MI(f)*/
A("sub %9,r0") A("sub %9,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= LO(bezier_C) * MI(f)*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= LO(bezier_C) * MI(f)*/
A("mul %11,%6") /* r1:r0 = MI(bezier_C) * MI(f)*/ A("mul %11,%6") /* r1:r0 = MI(bezier_C) * MI(f)*/
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") A("sbc %3,r1")
A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_C) * MI(f) << 8*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_C) * MI(f) << 8*/
A("mul %1,%6") /* r1:r0 = HI(bezier_C) * LO(f)*/ A("mul %1,%6") /* r1:r0 = HI(bezier_C) * LO(f)*/
A("sub %3,r0") A("sub %3,r0")
A("sbc %4,r1") /* %4:%3:%2:%9 -= HI(bezier_C) * LO(f) << 16*/ A("sbc %4,r1") /* %4:%3:%2:%9 -= HI(bezier_C) * LO(f) << 16*/
/* umul16x16to16hi(f, f, t); / Range 16 bits : f = t^3 (unsigned) [17]*/ /* umul16x16to16hi(f, f, t); / Range 16 bits : f = t^3 (unsigned) [17]*/
@@ -853,32 +853,32 @@ void Stepper::set_directions() {
/* acc += v; */ /* acc += v; */
A("lds %10, bezier_B") /* %10 = LO(bezier_B)*/ A("lds %10, bezier_B") /* %10 = LO(bezier_B)*/
A("mul %10,%5") /* r1:r0 = LO(bezier_B) * LO(f)*/ A("mul %10,%5") /* r1:r0 = LO(bezier_B) * LO(f)*/
A("add %9,r1") A("add %9,r1")
A("adc %2,%0") A("adc %2,%0")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += HI(LO(bezier_B) * LO(f))*/ A("adc %4,%0") /* %4:%3:%2:%9 += HI(LO(bezier_B) * LO(f))*/
A("lds %11, bezier_B+1") /* %11 = MI(bezier_B)*/ A("lds %11, bezier_B+1") /* %11 = MI(bezier_B)*/
A("mul %11,%5") /* r1:r0 = MI(bezier_B) * LO(f)*/ A("mul %11,%5") /* r1:r0 = MI(bezier_B) * LO(f)*/
A("add %9,r0") A("add %9,r0")
A("adc %2,r1") A("adc %2,r1")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_B) * LO(f)*/ A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_B) * LO(f)*/
A("lds %1, bezier_B+2") /* %1 = HI(bezier_B)*/ A("lds %1, bezier_B+2") /* %1 = HI(bezier_B)*/
A("mul %1,%5") /* r1:r0 = MI(bezier_B) * LO(f)*/ A("mul %1,%5") /* r1:r0 = MI(bezier_B) * LO(f)*/
A("add %2,r0") A("add %2,r0")
A("adc %3,r1") A("adc %3,r1")
A("adc %4,%0") /* %4:%3:%2:%9 += HI(bezier_B) * LO(f) << 8*/ A("adc %4,%0") /* %4:%3:%2:%9 += HI(bezier_B) * LO(f) << 8*/
A("mul %10,%6") /* r1:r0 = LO(bezier_B) * MI(f)*/ A("mul %10,%6") /* r1:r0 = LO(bezier_B) * MI(f)*/
A("add %9,r0") A("add %9,r0")
A("adc %2,r1") A("adc %2,r1")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += LO(bezier_B) * MI(f)*/ A("adc %4,%0") /* %4:%3:%2:%9 += LO(bezier_B) * MI(f)*/
A("mul %11,%6") /* r1:r0 = MI(bezier_B) * MI(f)*/ A("mul %11,%6") /* r1:r0 = MI(bezier_B) * MI(f)*/
A("add %2,r0") A("add %2,r0")
A("adc %3,r1") A("adc %3,r1")
A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_B) * MI(f) << 8*/ A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_B) * MI(f) << 8*/
A("mul %1,%6") /* r1:r0 = HI(bezier_B) * LO(f)*/ A("mul %1,%6") /* r1:r0 = HI(bezier_B) * LO(f)*/
A("add %3,r0") A("add %3,r0")
A("adc %4,r1") /* %4:%3:%2:%9 += HI(bezier_B) * LO(f) << 16*/ A("adc %4,r1") /* %4:%3:%2:%9 += HI(bezier_B) * LO(f) << 16*/
/* umul16x16to16hi(f, f, t); / Range 16 bits : f = t^5 (unsigned) [17]*/ /* umul16x16to16hi(f, f, t); / Range 16 bits : f = t^5 (unsigned) [17]*/
@@ -904,32 +904,32 @@ void Stepper::set_directions() {
/* acc -= v; */ /* acc -= v; */
A("lds %10, bezier_A") /* %10 = LO(bezier_A)*/ A("lds %10, bezier_A") /* %10 = LO(bezier_A)*/
A("mul %10,%5") /* r1:r0 = LO(bezier_A) * LO(f)*/ A("mul %10,%5") /* r1:r0 = LO(bezier_A) * LO(f)*/
A("sub %9,r1") A("sub %9,r1")
A("sbc %2,%0") A("sbc %2,%0")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(LO(bezier_A) * LO(f))*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(LO(bezier_A) * LO(f))*/
A("lds %11, bezier_A+1") /* %11 = MI(bezier_A)*/ A("lds %11, bezier_A+1") /* %11 = MI(bezier_A)*/
A("mul %11,%5") /* r1:r0 = MI(bezier_A) * LO(f)*/ A("mul %11,%5") /* r1:r0 = MI(bezier_A) * LO(f)*/
A("sub %9,r0") A("sub %9,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_A) * LO(f)*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_A) * LO(f)*/
A("lds %1, bezier_A+2") /* %1 = HI(bezier_A)*/ A("lds %1, bezier_A+2") /* %1 = HI(bezier_A)*/
A("mul %1,%5") /* r1:r0 = MI(bezier_A) * LO(f)*/ A("mul %1,%5") /* r1:r0 = MI(bezier_A) * LO(f)*/
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") A("sbc %3,r1")
A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(bezier_A) * LO(f) << 8*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(bezier_A) * LO(f) << 8*/
A("mul %10,%6") /* r1:r0 = LO(bezier_A) * MI(f)*/ A("mul %10,%6") /* r1:r0 = LO(bezier_A) * MI(f)*/
A("sub %9,r0") A("sub %9,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= LO(bezier_A) * MI(f)*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= LO(bezier_A) * MI(f)*/
A("mul %11,%6") /* r1:r0 = MI(bezier_A) * MI(f)*/ A("mul %11,%6") /* r1:r0 = MI(bezier_A) * MI(f)*/
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") A("sbc %3,r1")
A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_A) * MI(f) << 8*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_A) * MI(f) << 8*/
A("mul %1,%6") /* r1:r0 = HI(bezier_A) * LO(f)*/ A("mul %1,%6") /* r1:r0 = HI(bezier_A) * LO(f)*/
A("sub %3,r0") A("sub %3,r0")
A("sbc %4,r1") /* %4:%3:%2:%9 -= HI(bezier_A) * LO(f) << 16*/ A("sbc %4,r1") /* %4:%3:%2:%9 -= HI(bezier_A) * LO(f) << 16*/
A("jmp 2f") /* Done!*/ A("jmp 2f") /* Done!*/
@@ -940,32 +940,32 @@ void Stepper::set_directions() {
/* acc += v; */ /* acc += v; */
A("lds %10, bezier_C") /* %10 = LO(bezier_C)*/ A("lds %10, bezier_C") /* %10 = LO(bezier_C)*/
A("mul %10,%5") /* r1:r0 = LO(bezier_C) * LO(f)*/ A("mul %10,%5") /* r1:r0 = LO(bezier_C) * LO(f)*/
A("add %9,r1") A("add %9,r1")
A("adc %2,%0") A("adc %2,%0")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += HI(LO(bezier_C) * LO(f))*/ A("adc %4,%0") /* %4:%3:%2:%9 += HI(LO(bezier_C) * LO(f))*/
A("lds %11, bezier_C+1") /* %11 = MI(bezier_C)*/ A("lds %11, bezier_C+1") /* %11 = MI(bezier_C)*/
A("mul %11,%5") /* r1:r0 = MI(bezier_C) * LO(f)*/ A("mul %11,%5") /* r1:r0 = MI(bezier_C) * LO(f)*/
A("add %9,r0") A("add %9,r0")
A("adc %2,r1") A("adc %2,r1")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_C) * LO(f)*/ A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_C) * LO(f)*/
A("lds %1, bezier_C+2") /* %1 = HI(bezier_C)*/ A("lds %1, bezier_C+2") /* %1 = HI(bezier_C)*/
A("mul %1,%5") /* r1:r0 = MI(bezier_C) * LO(f)*/ A("mul %1,%5") /* r1:r0 = MI(bezier_C) * LO(f)*/
A("add %2,r0") A("add %2,r0")
A("adc %3,r1") A("adc %3,r1")
A("adc %4,%0") /* %4:%3:%2:%9 += HI(bezier_C) * LO(f) << 8*/ A("adc %4,%0") /* %4:%3:%2:%9 += HI(bezier_C) * LO(f) << 8*/
A("mul %10,%6") /* r1:r0 = LO(bezier_C) * MI(f)*/ A("mul %10,%6") /* r1:r0 = LO(bezier_C) * MI(f)*/
A("add %9,r0") A("add %9,r0")
A("adc %2,r1") A("adc %2,r1")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += LO(bezier_C) * MI(f)*/ A("adc %4,%0") /* %4:%3:%2:%9 += LO(bezier_C) * MI(f)*/
A("mul %11,%6") /* r1:r0 = MI(bezier_C) * MI(f)*/ A("mul %11,%6") /* r1:r0 = MI(bezier_C) * MI(f)*/
A("add %2,r0") A("add %2,r0")
A("adc %3,r1") A("adc %3,r1")
A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_C) * MI(f) << 8*/ A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_C) * MI(f) << 8*/
A("mul %1,%6") /* r1:r0 = HI(bezier_C) * LO(f)*/ A("mul %1,%6") /* r1:r0 = HI(bezier_C) * LO(f)*/
A("add %3,r0") A("add %3,r0")
A("adc %4,r1") /* %4:%3:%2:%9 += HI(bezier_C) * LO(f) << 16*/ A("adc %4,r1") /* %4:%3:%2:%9 += HI(bezier_C) * LO(f) << 16*/
/* umul16x16to16hi(f, f, t); / Range 16 bits : f = t^3 (unsigned) [17]*/ /* umul16x16to16hi(f, f, t); / Range 16 bits : f = t^3 (unsigned) [17]*/
@@ -991,32 +991,32 @@ void Stepper::set_directions() {
/* acc -= v;*/ /* acc -= v;*/
A("lds %10, bezier_B") /* %10 = LO(bezier_B)*/ A("lds %10, bezier_B") /* %10 = LO(bezier_B)*/
A("mul %10,%5") /* r1:r0 = LO(bezier_B) * LO(f)*/ A("mul %10,%5") /* r1:r0 = LO(bezier_B) * LO(f)*/
A("sub %9,r1") A("sub %9,r1")
A("sbc %2,%0") A("sbc %2,%0")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(LO(bezier_B) * LO(f))*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(LO(bezier_B) * LO(f))*/
A("lds %11, bezier_B+1") /* %11 = MI(bezier_B)*/ A("lds %11, bezier_B+1") /* %11 = MI(bezier_B)*/
A("mul %11,%5") /* r1:r0 = MI(bezier_B) * LO(f)*/ A("mul %11,%5") /* r1:r0 = MI(bezier_B) * LO(f)*/
A("sub %9,r0") A("sub %9,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_B) * LO(f)*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_B) * LO(f)*/
A("lds %1, bezier_B+2") /* %1 = HI(bezier_B)*/ A("lds %1, bezier_B+2") /* %1 = HI(bezier_B)*/
A("mul %1,%5") /* r1:r0 = MI(bezier_B) * LO(f)*/ A("mul %1,%5") /* r1:r0 = MI(bezier_B) * LO(f)*/
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") A("sbc %3,r1")
A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(bezier_B) * LO(f) << 8*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= HI(bezier_B) * LO(f) << 8*/
A("mul %10,%6") /* r1:r0 = LO(bezier_B) * MI(f)*/ A("mul %10,%6") /* r1:r0 = LO(bezier_B) * MI(f)*/
A("sub %9,r0") A("sub %9,r0")
A("sbc %2,r1") A("sbc %2,r1")
A("sbc %3,%0") A("sbc %3,%0")
A("sbc %4,%0") /* %4:%3:%2:%9 -= LO(bezier_B) * MI(f)*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= LO(bezier_B) * MI(f)*/
A("mul %11,%6") /* r1:r0 = MI(bezier_B) * MI(f)*/ A("mul %11,%6") /* r1:r0 = MI(bezier_B) * MI(f)*/
A("sub %2,r0") A("sub %2,r0")
A("sbc %3,r1") A("sbc %3,r1")
A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_B) * MI(f) << 8*/ A("sbc %4,%0") /* %4:%3:%2:%9 -= MI(bezier_B) * MI(f) << 8*/
A("mul %1,%6") /* r1:r0 = HI(bezier_B) * LO(f)*/ A("mul %1,%6") /* r1:r0 = HI(bezier_B) * LO(f)*/
A("sub %3,r0") A("sub %3,r0")
A("sbc %4,r1") /* %4:%3:%2:%9 -= HI(bezier_B) * LO(f) << 16*/ A("sbc %4,r1") /* %4:%3:%2:%9 -= HI(bezier_B) * LO(f) << 16*/
/* umul16x16to16hi(f, f, t); / Range 16 bits : f = t^5 (unsigned) [17]*/ /* umul16x16to16hi(f, f, t); / Range 16 bits : f = t^5 (unsigned) [17]*/
@@ -1042,32 +1042,32 @@ void Stepper::set_directions() {
/* acc += v; */ /* acc += v; */
A("lds %10, bezier_A") /* %10 = LO(bezier_A)*/ A("lds %10, bezier_A") /* %10 = LO(bezier_A)*/
A("mul %10,%5") /* r1:r0 = LO(bezier_A) * LO(f)*/ A("mul %10,%5") /* r1:r0 = LO(bezier_A) * LO(f)*/
A("add %9,r1") A("add %9,r1")
A("adc %2,%0") A("adc %2,%0")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += HI(LO(bezier_A) * LO(f))*/ A("adc %4,%0") /* %4:%3:%2:%9 += HI(LO(bezier_A) * LO(f))*/
A("lds %11, bezier_A+1") /* %11 = MI(bezier_A)*/ A("lds %11, bezier_A+1") /* %11 = MI(bezier_A)*/
A("mul %11,%5") /* r1:r0 = MI(bezier_A) * LO(f)*/ A("mul %11,%5") /* r1:r0 = MI(bezier_A) * LO(f)*/
A("add %9,r0") A("add %9,r0")
A("adc %2,r1") A("adc %2,r1")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_A) * LO(f)*/ A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_A) * LO(f)*/
A("lds %1, bezier_A+2") /* %1 = HI(bezier_A)*/ A("lds %1, bezier_A+2") /* %1 = HI(bezier_A)*/
A("mul %1,%5") /* r1:r0 = MI(bezier_A) * LO(f)*/ A("mul %1,%5") /* r1:r0 = MI(bezier_A) * LO(f)*/
A("add %2,r0") A("add %2,r0")
A("adc %3,r1") A("adc %3,r1")
A("adc %4,%0") /* %4:%3:%2:%9 += HI(bezier_A) * LO(f) << 8*/ A("adc %4,%0") /* %4:%3:%2:%9 += HI(bezier_A) * LO(f) << 8*/
A("mul %10,%6") /* r1:r0 = LO(bezier_A) * MI(f)*/ A("mul %10,%6") /* r1:r0 = LO(bezier_A) * MI(f)*/
A("add %9,r0") A("add %9,r0")
A("adc %2,r1") A("adc %2,r1")
A("adc %3,%0") A("adc %3,%0")
A("adc %4,%0") /* %4:%3:%2:%9 += LO(bezier_A) * MI(f)*/ A("adc %4,%0") /* %4:%3:%2:%9 += LO(bezier_A) * MI(f)*/
A("mul %11,%6") /* r1:r0 = MI(bezier_A) * MI(f)*/ A("mul %11,%6") /* r1:r0 = MI(bezier_A) * MI(f)*/
A("add %2,r0") A("add %2,r0")
A("adc %3,r1") A("adc %3,r1")
A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_A) * MI(f) << 8*/ A("adc %4,%0") /* %4:%3:%2:%9 += MI(bezier_A) * MI(f) << 8*/
A("mul %1,%6") /* r1:r0 = HI(bezier_A) * LO(f)*/ A("mul %1,%6") /* r1:r0 = HI(bezier_A) * LO(f)*/
A("add %3,r0") A("add %3,r0")
A("adc %4,r1") /* %4:%3:%2:%9 += HI(bezier_A) * LO(f) << 16*/ A("adc %4,r1") /* %4:%3:%2:%9 += HI(bezier_A) * LO(f) << 16*/
L("2") L("2")
" clr __zero_reg__" /* C runtime expects r1 = __zero_reg__ = 0 */ " clr __zero_reg__" /* C runtime expects r1 = __zero_reg__ = 0 */