fork download
  1. asm volatile (
  2. " sbi %[tifr],1<<%[ocf_bit]\n"
  3. " lds %A[now_low],%[tcnt]+0\n"
  4. " lds %B[now_low],%[tcnt]+1\n"
  5. " in %[tifr_var],%[tifr1]\n"
  6. " andi %[tifr_var],1<<%[tov]\n"
  7. " breq no_overflow_%=\n"
  8. " subi %A[now_high],-1\n"
  9. " sbci %B[now_high],-1\n"
  10. " lds %A[now_low],%[tcnt]+0\n"
  11. " lds %B[now_low],%[tcnt]+1\n"
  12. "no_overflow_%=:\n"
  13. " sub %A[time_plus_past],%A[now_low]\n"
  14. " sbc %B[time_plus_past],%B[now_low]\n"
  15. " sbc %C[time_plus_past],%A[now_high]\n"
  16. " sbc %D[time_plus_past],%B[now_high]\n"
  17. " sub %A[time_plus_past],%A[clearance_plus_past]\n"
  18. " sbc %B[time_plus_past],%B[clearance_plus_past]\n"
  19. " sbc %C[time_plus_past],%C[clearance_plus_past]\n"
  20. " sbc %D[time_plus_past],%D[clearance_plus_past]\n"
  21. " brcc no_saturation_%=\n"
  22. " sub %A[time],%A[time_plus_past]\n"
  23. " sbc %B[time],%B[time_plus_past]\n"
  24. " sbc %C[time],%C[time_plus_past]\n"
  25. " sbc %D[time],%D[time_plus_past]\n"
  26. "no_saturation_%=:\n"
  27. " sts %[ocr]+1,%B[time]\n"
  28. " sts %[ocr]+0,%A[time]\n"
  29. " lds %[tifr_var],%[timsk]\n"
  30. " ori %[tifr_var],1<<%[ocie_bit]\n"
  31. " sts %[timsk],%[tifr_var]\n"
  32.  
  33. : [now_low] "=&r" (now_low),
  34. [now_high] "=&a" (now_high),
  35. [tifr_var] "=&a" (tifr_var),
  36. [time_plus_past] "=&r" (time_plus_past),
  37. [time] "=&r" (time)
  38. : "[now_high]" (now_high),
  39. "[time_plus_past]" (time_plus_past),
  40. "[time]" (time),
  41. [clearance_plus_past] "r" (clearance_plus_past),
  42. [tcnt] "n" (_SFR_MEM_ADDR(TCNT1)),
  43. [tifr1] "I" (_SFR_IO_ADDR(TIFR1)),
  44. [tov] "n" (TOV1),
  45. [ocr] "n" (ocr_reg + __SFR_OFFSET),
  46. [timsk] "n" (timsk_reg + __SFR_OFFSET),
  47. [ocie_bit] "n" (ocie_bit),
  48. [tifr] "I" (tifr_reg),
  49. [ocf_bit] "n" (ocf_bit)
  50. );
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty