Advertisement
Guest User

windows.lst

a guest
Oct 4th, 2015
417
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Registers:
  2. ; R0: delay counter
  3. ; R29: timer overloads counter
  4. ; R30: FSM state
  5. ; R31: temp
  6.  
  7. ; States:
  8. ; 0: Initial/Midway
  9. ; 1: Going up
  10. ; 2: Up pressed (t<0.2s)
  11. ; 3: Going up to limit
  12. ; 4: At upper end
  13. ; 5: Going down
  14. ; 6: Down pressed (t<0.2s)
  15. ; 7: Going down to limit
  16. ; 8: At lower end
  17.  
  18. ; Interrupt vectors
  19. +00000000: C009 RJMP PC+0x000A ; RST -> 0x000A
  20. +00000001: C09B RJMP PC+0x009C ; INT0 -> 0x009D
  21. +00000002: C018 RJMP PC+0x0019 ; PCINT0 -> 0x001B
  22. +00000003: C07F RJMP PC+0x0080 ; TIM0_OVF -> 0x0083
  23. +00000004: 9518 RETI
  24. +00000005: 9518 RETI
  25. +00000006: 9518 RETI
  26. +00000007: 9518 RETI
  27. +00000008: 9518 RETI
  28. +00000009: 9518 RETI
  29.  
  30. ; RST interrupt handler
  31. +0000000A: E9FF LDI R31,0x9F
  32. +0000000B: BFFD OUT 0x3D,R31 ; SPL = RAMEND
  33. +0000000C: E0F5 LDI R31,0x05
  34. +0000000D: BBF7 OUT 0x17,R31 ; DDRB = DDBR0|DDRB2
  35. +0000000E: E0F2 LDI R31,0x02
  36. +0000000F: BBF8 OUT 0x18,R31 ; PORTB = PORTB1
  37. +00000010: E0F5 LDI R31,0x05
  38. +00000011: BFF3 OUT 0x33,R31 ; TCCR0B = CS00|CS02
  39. +00000012: E0F0 LDI R31,0x00
  40. +00000013: BFF5 OUT 0x35,R31 ; MCUCR = 0
  41. +00000014: E2F0 LDI R31,0x20
  42. +00000015: BFFB OUT 0x3B,R31 ; GIMSK = PCIE
  43. +00000016: E1F8 LDI R31,0x18
  44. +00000017: BBF5 OUT 0x15,R31 ; PCMSK = PCINT3|PCINT4
  45. +00000018: E0E0 LDI R30,0x00 ; R30 = 0
  46. +00000019: 9478 SEI ; Global Interrupt Enable
  47. +0000001A: CFFF RJMP PC-0x0000 ; endless loop
  48.  
  49. ; PCINT0 interrupt handler
  50. +0000001B: D092 RCALL PC+0x0093 ; Call Delay(0x00AE)
  51. +0000001C: D091 RCALL PC+0x0092 ; Call Delay(0x00AE)
  52. +0000001D: 30E0 CPI R30,0x00 ; switch(R30)
  53. +0000001E: F099 BREQ PC+0x14 ; 0: Jump 0x32
  54. +0000001F: 30E1 CPI R30,0x01
  55. +00000020: F161 BREQ PC+0x2D ; 1: Jump 0x4D
  56. +00000021: 30E5 CPI R30,0x05
  57. +00000022: F189 BREQ PC+0x32 ; 5: Jump 0x54
  58. +00000023: 30E2 CPI R30,0x02
  59. +00000024: F1B1 BREQ PC+0x37 ; 2: Jump 0x5B
  60. +00000025: 30E6 CPI R30,0x06
  61. +00000026: F1D9 BREQ PC+0x3C ; 6: Jump 0x62
  62. +00000027: 30E4 CPI R30,0x04
  63. +00000028: F0C9 BREQ PC+0x1A ; 4: Jump 0x42
  64. +00000029: 30E8 CPI R30,0x08
  65. +0000002A: F061 BREQ PC+0x0D ; 8: Jump 0x37
  66. +0000002B: 30E3 CPI R30,0x03
  67. +0000002C: F019 BREQ PC+0x04 ; 3: Jump 0x30 (-> 0x71)
  68. +0000002D: 30E7 CPI R30,0x07
  69. +0000002E: F011 BREQ PC+0x03 ; 7: Jump 0x31 (-> 0x7A)
  70. +0000002F: 9518 RETI ; else exit
  71. +00000030: C040 RJMP PC+0x0041 ; Jump 0x71
  72. +00000031: C048 RJMP PC+0x0049 ; Jump 0x7A
  73. ; case (R30==0)
  74. +00000032: 99B3 SBIC 0x16,3
  75. +00000033: C003 RJMP PC+0x0004 ; if PINB3 jump 0x37 (Up btn)
  76. +00000034: 99B4 SBIC 0x16,4
  77. +00000035: C00C RJMP PC+0x000D ; if PINB4 jump 0x42 (Down btn)
  78. +00000036: 9518 RETI
  79. ; case (R30==8)
  80. +00000037: 9BB3 SBIS 0x16,3
  81. +00000038: 9518 RETI ; if !PINB3 exit
  82. +00000039: E0E2 LDI R30,0x02 ; R30 = 2
  83. +0000003A: 27DD CLR R29 ; R29 = 0
  84. +0000003B: 27FF CLR R31
  85. +0000003C: BFF2 OUT 0x32,R31 ; TCNT0 = 0
  86. +0000003D: E0F2 LDI R31,0x02
  87. +0000003E: BFF8 OUT 0x38,R31 ; TIFR0 = TOV0
  88. +0000003F: E0F2 LDI R31,0x02
  89. +00000040: BFF9 OUT 0x39,R31 ; TIMSK0 = TOIE0
  90. +00000041: 9518 RETI
  91. ; case (R30==4)
  92. +00000042: 9BB4 SBIS 0x16,4
  93. +00000043: 9518 RETI ; if !PINB4 exit
  94. +00000044: E0E6 LDI R30,0x06 ; R30 = 6
  95. +00000045: 27DD CLR R29 ; R29 = 0
  96. +00000046: 27FF CLR R31
  97. +00000047: BFF2 OUT 0x32,R31 ; TCNT0 = 0
  98. +00000048: E0F2 LDI R31,0x02
  99. +00000049: BFF8 OUT 0x38,R31 ; TIFR0 = TOV0
  100. +0000004A: E0F2 LDI R31,0x02
  101. +0000004B: BFF9 OUT 0x39,R31 ; TIMSK0 = TOIE0
  102. +0000004C: 9518 RETI
  103. ; case (R30==1)
  104. +0000004D: 99B3 SBIC 0x16,3
  105. +0000004E: 9518 RETI ; if PINB3 exit
  106. +0000004F: E0E0 LDI R30,0x00 ; R30 = 0
  107. +00000050: 98C2 CBI 0x18,2 ; PORTB2 = 0
  108. +00000051: E0F0 LDI R31,0x00
  109. +00000052: BFF9 OUT 0x39,R31 ; TIMSK0 = 0
  110. +00000053: 9518 RETI
  111. ; case (R30==5)
  112. +00000054: 99B4 SBIC 0x16,4
  113. +00000055: 9518 RETI ; if PINB4 exit
  114. +00000056: E0E0 LDI R30,0x00 ; R30 = 0
  115. +00000057: 98C0 CBI 0x18,0 ; PORTB0 = 0
  116. +00000058: E0F0 LDI R31,0x00
  117. +00000059: BFF9 OUT 0x39,R31 ; TIMSK0 = 0
  118. +0000005A: 9518 RETI
  119. ; case (R30==2)
  120. +0000005B: 99B3 SBIC 0x16,3
  121. +0000005C: 9518 RETI ; if PINB3 exit
  122. +0000005D: E0E3 LDI R30,0x03 ; R30 = 3
  123. +0000005E: E2F0 LDI R31,0x20
  124. +0000005F: BFFB OUT 0x3B,R31 ; GIMSK = PCIE
  125. +00000060: 9AC2 SBI 0x18,2 ; PORTB2 = 1
  126. +00000061: 9518 RETI
  127. ; case (R30==6)
  128. +00000062: 99B4 SBIC 0x16,4
  129. +00000063: 9518 RETI ; if PINB4 exit
  130. +00000064: E0E7 LDI R30,0x07 ; R30 = 7
  131. +00000065: E2F0 LDI R31,0x20
  132. +00000066: BFFB OUT 0x3B,R31 ; GIMSK = PCIE
  133. +00000067: 9AC0 SBI 0x18,0 ; PORTB0 = 1
  134. +00000068: 9518 RETI
  135. ; dead code?
  136. +00000069: 9BB4 SBIS 0x16,4
  137. +0000006A: 9518 RETI ; if !PINB4 exit
  138. +0000006B: CFD6 RJMP PC-0x0029 ; Jump 0x42
  139. +0000006C: 9518 RETI
  140. ; dead code?
  141. +0000006D: 9BB3 SBIS 0x16,3
  142. +0000006E: 9518 RETI ; if !PINB3 exit
  143. +0000006F: CFC7 RJMP PC-0x0038 ; Jump 0x37
  144. +00000070: 9518 RETI
  145. ; case (R30==3)
  146. +00000071: 9BB4 SBIS 0x16,4
  147. +00000072: 9518 RETI ; if !PINB4 exit
  148. +00000073: E0E0 LDI R30,0x00 ; R30 = 0
  149. +00000074: 98C2 CBI 0x18,2 ; PORTB2 = 0
  150. +00000075: E0F0 LDI R31,0x00
  151. +00000076: BFF9 OUT 0x39,R31 ; TIMSK0 = 0
  152. +00000077: 99B4 SBIC 0x16,4
  153. +00000078: CFFE RJMP PC-0x0001 ; while(BTN4) loop
  154. +00000079: 9518 RETI
  155. ; case (R30==7)
  156. +0000007A: 9BB3 SBIS 0x16,3
  157. +0000007B: 9518 RETI ; if !PINB3 exit
  158. +0000007C: E0E0 LDI R30,0x00 ; R30 = 0
  159. +0000007D: 98C0 CBI 0x18,0 ; PORTB0 = 0
  160. +0000007E: E0F0 LDI R31,0x00
  161. +0000007F: BFF9 OUT 0x39,R31 ; TIMSK0 = 0
  162. +00000080: 99B3 SBIC 0x16,3
  163. +00000081: CFFE RJMP PC-0x0001 ; while(BTN3) loop
  164. +00000082: 9518 RETI
  165.  
  166. ; TIM0_OVF interrupt handler
  167. +00000083: 95D3 INC R29 ; R29++
  168. +00000084: 30D1 CPI R29,0x01 ; switch(R29)
  169. +00000085: F029 BREQ PC+0x06 ; 1: Jump 0x8B
  170. +00000086: 30D3 CPI R29,0x03
  171. +00000087: F081 BREQ PC+0x11 ; 3: Jump 0x98
  172. +00000088: 31D4 CPI R29,0x14
  173. +00000089: F099 BREQ PC+0x14 ; 20: Jump 0x9D -> INT0 handler
  174. +0000008A: 9518 RETI ; else exit
  175. ; case(R29==1)
  176. +0000008B: E2F0 LDI R31,0x20
  177. +0000008C: BFFB OUT 0x3B,R31 ; GIMSK = PCIE
  178. +0000008D: 30E2 CPI R30,0x02 ; switch(R30)
  179. +0000008E: F019 BREQ PC+0x04 ; 2: Jump 0x92
  180. +0000008F: 30E6 CPI R30,0x06
  181. +00000090: F021 BREQ PC+0x05 ; 6: Jump 0x95
  182. +00000091: 9518 RETI ; else exit
  183. ; case(R29==1 && R30==2)
  184. +00000092: E0E1 LDI R30,0x01 ; R30 = 1
  185. +00000093: 9AC2 SBI 0x18,2 ; PORTB2 = 1
  186. +00000094: 9518 RETI
  187. ; case(R29==1 && R30==6)
  188. +00000095: E0E5 LDI R30,0x05 ; R30 = 5
  189. +00000096: 9AC0 SBI 0x18,0 ; PORTB0 = 1
  190. +00000097: 9518 RETI
  191. ; case(R29==3)
  192. +00000098: E4F0 LDI R31,0x40
  193. +00000099: BFFA OUT 0x3A,R31 ; GIFR = INTF0
  194. +0000009A: E6F0 LDI R31,0x60
  195. +0000009B: BFFB OUT 0x3B,R31 ; GIMSK = PCIE|INT0
  196. +0000009C: 9518 RETI
  197.  
  198. ; INT0 Interrupt handler
  199. +0000009D: E0F0 LDI R31,0x00
  200. +0000009E: BFF9 OUT 0x39,R31 ; TIMSK0 = 0
  201. +0000009F: 30E1 CPI R30,0x01 ; case(R30)
  202. +000000A0: F039 BREQ PC+0x08 ; 1: Jump 0xA8
  203. +000000A1: 30E5 CPI R30,0x05
  204. +000000A2: F041 BREQ PC+0x09 ; 5: Jump 0xAB
  205. +000000A3: 30E3 CPI R30,0x03
  206. +000000A4: F019 BREQ PC+0x04 ; 3: Jump 0xA8
  207. +000000A5: 30E7 CPI R30,0x07
  208. +000000A6: F021 BREQ PC+0x05 ; 7: Jump 0xAB
  209. +000000A7: 9518 RETI ; else exit
  210. ; case(R30==1 || R30==3)
  211. +000000A8: E0E4 LDI R30,0x04 ; R30 = 4
  212. +000000A9: 98C2 CBI 0x18,2 ; PORTB2 = 0
  213. +000000AA: 9518 RETI
  214. ; case(R30==5 || R30==7)
  215. +000000AB: E0E8 LDI R30,0x08 ; R30 = 8
  216. +000000AC: 98C0 CBI 0x18,0 ; PORTB0 = 0
  217. +000000AD: 9518 RETI
  218.  
  219. ; Delay subroutine (~0.65ms)
  220. +000000AE: 940A DEC R0
  221. +000000AF: F7F1 BRNE PC-0x01
  222. +000000B0: 9508 RET
  223.  
  224. +000000B1: 454D ; 'MEGAVOLT'
  225. +000000B2: 4147
  226. +000000B3: 4F56
  227. +000000B4: 544C
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement