Advertisement
abdullahkahraman

Microchip Forums: RTOS implementation - Dissambly Listing 2

Jun 13th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Disassembly Listing for messingWithRTOS
  2. Generated From:
  3.  
  4. ---  D:/Documents/MPLABXProjects/messingWithRTOS.X/main.c  ----------------------------------------------
  5. 1:             /*
  6. 2:              * File:   main.c
  7. 3:              * Author: abdullah
  8. 4:              *
  9. 5:              * Created on 10 Haziran 2012 Pazar, 14:43
  10. 6:              */
  11. 7:             #include <xc.h> // Include the header file needed by the compiler
  12. 8:             __CONFIG(FOSC_INTOSCIO & WDTE_OFF & PWRTE_ON & MCLRE_OFF & CP_OFF & IOSCFS_4MHZ & BOREN_ON);
  13. 9:             /*
  14. 10:             * INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN
  15. 11:             * WDT disabled and can be enabled by SWDTEN bit of the WDTCON register
  16. 12:             * PWRT enabled
  17. 13:             * MCLR pin function is digital input, MCLR internally tied to VDD
  18. 14:             * Program memory code protection is disabled
  19. 15:             * Internal Oscillator Frequency Select bit : 4MHz
  20. 16:             * Brown-out Reset Selection bits : BOR enabled
  21. 17:             */
  22. 18:            
  23. 19:            /*
  24. 20:             * OS_initializeTask(); definition will copy the PCLATH register to the task's PCLATH  , which is held in taskx.pch
  25. 21:             * This will help us hold the PCLATH at the point we yield.
  26. 22:             * After that, it will copy the (PCL register + 8) to current task's PCL which is held in taskx.pcl.
  27. 23:             * 8 is added to PCL because this line plus the "return" takes 8 instructions.
  28. 24:             * We will set the PCL after these instructions, because
  29. 25:             * we want to be in the point after OS_initializeTask when we come back to this task.
  30. 26:             * After all, the function returns without doing anything more. This will initialize the task's PCLATH and PCL.
  31. 27:             */
  32. 28:            #define numberOfTasks 2
  33. 29:            #define OS_initializeTask(x); tasks[x].pch = PCLATH;\
  34. 30:                                         tasks[x].pcl = PCL + 6;\
  35. 31:                                         asm("return");
  36. 32:            
  37. 33:            /*
  38. 34:             * OS_yield(); definition will do the same stuff that OS_initializeTask(); definition do, however
  39. 35:             * it will return to "taskswitcher" label, which is the start of OS_runTasks(); definition.
  40. 36:             */
  41. 37:            
  42. 38:            #define OS_yield(x);         tasks[x].pch = PCLATH;\
  43. 39:                                         tasks[x].pcl = PCL + 6;\
  44. 40:                                         asm("goto _taskswitcher");
  45. 41:            
  46. 42:            /*
  47. 43:             * OS_runTasks(); definition will set the "taskswitcher" label. After that it will change the
  48. 44:             * current task to the next task, by pointing the next item in the linked list of "TCB"s.
  49. 45:             * After that, it will change the PCLATH and PCL registers with the current task's. That will
  50. 46:             * make the program continue the next task from the place it left last time.
  51. 47:             */
  52. 48:            
  53. 49:            #define OS_runTasks();       asm("_taskswitcher");\
  54. 50:                                         ++currentTask;\
  55. 51:            if (currentTask > (numberOfTasks - 1))currentTask = 0;  \
  56. 52:                                         PCLATH = tasks[currentTask].pch;  \
  57. 53:                                         PCL = tasks[currentTask].pcl;
  58. 54:            
  59. 55:            typedef struct _TCB // Create task control block and type define it as "TCB"
  60. 56:            {
  61. 57:                unsigned char pch; // pch register will hold the PCLATH value of the task after the last yield.
  62. 58:                unsigned char pcl; // pcl register will hold the PCL value of the task after the last yield.
  63. 59:            } TCB;
  64. 60:            
  65. 61:            unsigned char currentTask = 0; // This TCB pointer will point to the current task's TCB.
  66. 62:            
  67. 63:            TCB tasks[2]; // Define the TCB for task1 and task2.
  68. 64:            
  69. 65:            void fTask1(void); // Prototype the function for task1.
  70. 66:            void fTask2(void); // Prototype the function for task2.
  71. 67:            
  72. 68:            void main(void)
  73. 69:            {
  74. 70:                TRISA = 0; // Set all of the PORTA pins as outputs.
  75. 07D8  1683     BSF STATUS, 0x5
  76. 07D9  0185     CLRF PORTA
  77. 71:                TRISC = 0; // Set all of the PORTC pins as outputs.
  78. 07DA  0187     CLRF PORTC
  79. 72:                ANSEL = 0; // Set all of the analog input pins as digital i/o.
  80. 07DB  0191     CLRF TMR2
  81. 73:                PORTA = 0; // Clear PORTA bits.
  82. 07DC  1283     BCF STATUS, 0x5
  83. 07DD  0185     CLRF PORTA
  84. 74:                PORTC = 0; // Clear PORTC bits.
  85. 07DE  0187     CLRF PORTC
  86. 75:            
  87. 76:                /*
  88. 77:                 * Before running the tasks, we should initialize the PCL and PCLATH registers for the tasks.
  89. 78:                 * In order to do this, we could have looked up the absolute address with a function pointer.
  90. 79:                 * However, it seems like this is not possible with this compiler (or all the x16 PICs?)
  91. 80:                 * What this compiler creates is a table of the addresses of the functions and a bunch of GOTOs.
  92. 81:                 * This will not let us get the absolute address of the function by doing something like:
  93. 82:                 * "currentTask->pcl=low(functionpointer);"
  94. 83:                 */
  95. 84:                fTask1(); // Run task1 so that we get the address of it and initialize pch and pcl registers.
  96. 07DF  27B9     CALL 0x7B9
  97. 85:                currentTask = currentTask++; // Point the currentTask pointer to the next pointer which
  98. 07E0  3001     MOVLW 0x1
  99. 07E1  00F6     MOVWF 0x76
  100. 07E2  0876     MOVF 0x76, W
  101. 07E3  07F4     ADDWF currentTask, F
  102. 86:                fTask2(); // is task2. And run task2 so that we get the correct pch and pcl.
  103. 07E4  279A     CALL 0x79A
  104. 87:            
  105. 88:                //OS_runTasks(); // Task switcher. See the comments in the definitions above.
  106. 89:                asm("_taskswitcher");
  107. 90:                ++currentTask;
  108. 07E5  3001     MOVLW 0x1
  109. 07E6  00F6     MOVWF 0x76
  110. 07E7  0876     MOVF 0x76, W
  111. 07E8  07F4     ADDWF currentTask, F
  112. 91:                if (currentTask == 2)currentTask = 0;
  113. 07E9  0874     MOVF currentTask, W
  114. 07EA  3A02     XORLW 0x2
  115. 07EB  1D03     BTFSS STATUS, 0x2
  116. 07EC  2FEE     GOTO 0x7EE
  117. 07ED  2FEF     GOTO 0x7EF
  118. 07EE  2FF1     GOTO 0x7F1
  119. 07EF  01F4     CLRF currentTask
  120. 07F0  2FF1     GOTO 0x7F1
  121. 92:                PCLATH = tasks[currentTask].pch;
  122. 07F1  0874     MOVF currentTask, W
  123. 07F2  00F6     MOVWF 0x76
  124. 07F3  0776     ADDWF 0x76, W
  125. 07F4  3E70     ADDLW 0x70
  126. 07F5  0084     MOVWF FSR
  127. 07F6  0800     MOVF INDF, W
  128. 07F7  1283     BCF STATUS, 0x5
  129. 07F8  008A     MOVWF PCLATH
  130. 93:                PCL = tasks[currentTask].pcl;
  131. 07F9  1403     BSF STATUS, 0x0
  132. 07FA  0D74     RLF currentTask, W
  133. 07FB  3E70     ADDLW 0x70
  134. 07FC  0084     MOVWF FSR
  135. 07FD  0800     MOVF INDF, W
  136. 07FE  0082     MOVWF PCL
  137. 94:            }
  138. 95:            
  139. 96:            void fTask1(void)
  140. 97:            {
  141. 98:                //OS_initializeTask(0); // Initialize the task
  142. 99:                tasks[0].pch = PCLATH;
  143. 07B9  1283     BCF STATUS, 0x5
  144. 07BA  080A     MOVF PCLATH, W
  145. 07BB  00F5     MOVWF 0x75
  146. 07BC  0875     MOVF 0x75, W
  147. 07BD  00F0     MOVWF tasks
  148. 100:               tasks[0].pcl = PCL + 6;
  149. 07BE  0802     MOVF PCL, W
  150. 07BF  3E06     ADDLW 0x6
  151. 07C0  00F5     MOVWF 0x75
  152. 07C1  0875     MOVF 0x75, W
  153. 07C2  00F1     MOVWF 0x71
  154. 101:               asm("return");
  155. 07C3  0008     RETURN
  156. 07C4  2FC5     GOTO 0x7C5
  157. 102:          
  158. 103:               while (1)
  159. 07D6  2FC5     GOTO 0x7C5
  160. 104:               {
  161. 105:                   PORTA = 0xAA; // Toggle PORTA.0
  162. 07C5  30AA     MOVLW 0xAA
  163. 07C6  1283     BCF STATUS, 0x5
  164. 07C7  0085     MOVWF PORTA
  165. 106:                   //OS_yield(0); // Yield
  166. 107:                   tasks[0].pch = PCLATH;
  167. 07C8  080A     MOVF PCLATH, W
  168. 07C9  00F5     MOVWF 0x75
  169. 07CA  0875     MOVF 0x75, W
  170. 07CB  00F0     MOVWF tasks
  171. 108:                   tasks[0].pcl = PCL + 6;
  172. 07CC  0802     MOVF PCL, W
  173. 07CD  3E06     ADDLW 0x6
  174. 07CE  00F5     MOVWF 0x75
  175. 07CF  0875     MOVF 0x75, W
  176. 07D0  00F1     MOVWF 0x71
  177. 109:                   asm("goto _taskswitcher");
  178. 07D1  2FE5     GOTO 0x7E5
  179. 110:          
  180. 111:                   PORTA = 0x55; // Toggle PORTA.0
  181. 07D2  3055     MOVLW 0x55
  182. 07D3  1283     BCF STATUS, 0x5
  183. 07D4  0085     MOVWF PORTA
  184. 07D5  2FC5     GOTO 0x7C5
  185. 112:               }
  186. 113:           }
  187. 07D7  0008     RETURN
  188. 114:          
  189. 115:           void fTask2(void)
  190. 116:           {
  191. 117:               //OS_initializeTask(1); // Initialize the task
  192. 118:               tasks[1].pch = PCLATH;
  193. 079A  1283     BCF STATUS, 0x5
  194. 079B  080A     MOVF PCLATH, W
  195. 079C  00F5     MOVWF 0x75
  196. 079D  0875     MOVF 0x75, W
  197. 079E  00F2     MOVWF 0x72
  198. 119:               tasks[1].pcl = PCL + 6;
  199. 079F  0802     MOVF PCL, W
  200. 07A0  3E06     ADDLW 0x6
  201. 07A1  00F5     MOVWF 0x75
  202. 07A2  0875     MOVF 0x75, W
  203. 07A3  00F3     MOVWF 0x73
  204. 120:               asm("return");
  205. 07A4  0008     RETURN
  206. 07A5  2FA6     GOTO 0x7A6
  207. 121:          
  208. 122:               while (1)
  209. 07B7  2FA6     GOTO 0x7A6
  210. 123:               {
  211. 124:                   PORTC = 0xAA; // Toggle PORTA.1
  212. 07A6  30AA     MOVLW 0xAA
  213. 07A7  1283     BCF STATUS, 0x5
  214. 07A8  0087     MOVWF PORTC
  215. 125:                   OS_yield(1); // Yield
  216. 07A9  080A     MOVF PCLATH, W
  217. 07AA  00F5     MOVWF 0x75
  218. 07AB  0875     MOVF 0x75, W
  219. 07AC  00F2     MOVWF 0x72
  220. 07AD  0802     MOVF PCL, W
  221. 07AE  3E06     ADDLW 0x6
  222. 07AF  00F5     MOVWF 0x75
  223. 07B0  0875     MOVF 0x75, W
  224. 07B1  00F3     MOVWF 0x73
  225. 07B2  2FE5     GOTO 0x7E5
  226. 126:                   PORTC = 0x55; // Toggle PORTA.1
  227. 07B3  3055     MOVLW 0x55
  228. 07B4  1283     BCF STATUS, 0x5
  229. 07B5  0087     MOVWF PORTC
  230. 07B6  2FA6     GOTO 0x7A6
  231. 127:               }
  232. 128:           }
  233. 07B8  0008     RETURN
  234. ---  D:/Documents/MPLABXProjects/messingWithRTOS.X/dist/default/production/messingWithRTOS.X.production.as
  235. 1:             opt subtitle "HI-TECH Software Omniscient Code Generator (Lite mode) build 12136"
  236. 2:            
  237. 3:             opt pagewidth 120
  238. 4:            
  239. 5:              opt lm
  240. 6:            
  241. 7:              processor   16F616
  242. 8:             clrc macro
  243. 9:              bcf 3,0
  244. 10:             endm
  245. 11:            clrz macro
  246. 12:             bcf 3,2
  247. 13:             endm
  248. 14:            setc macro
  249. 15:             bsf 3,0
  250. 16:             endm
  251. 17:            setz macro
  252. 18:             bsf 3,2
  253. 19:             endm
  254. 20:            skipc    macro
  255. 21:             btfss   3,0
  256. 22:             endm
  257. 23:            skipz    macro
  258. 24:             btfss   3,2
  259. 25:             endm
  260. 26:            skipnc   macro
  261. 27:             btfsc   3,0
  262. 28:             endm
  263. 29:            skipnz   macro
  264. 30:             btfsc   3,2
  265. 31:             endm
  266. 32:            indf equ 0
  267. 33:            indf0    equ 0
  268. 34:            pc   equ 2
  269. 35:            pcl  equ 2
  270. 36:            status   equ 3
  271. 37:            fsr  equ 4
  272. 38:            fsr0 equ 4
  273. 39:            c    equ 1
  274. 40:            z    equ 0
  275. 41:            pclath   equ 10
  276. 42:            # 8 "main.c"
  277. 43:            psect config,class=CONFIG,delta=2 ;#
  278. 44:            # 8 "main.c"
  279. 45:            dw 0xFFFC & 0xFFF7 & 0xFFEF & 0xFFDF & 0xFFFF & 0xFF7F & 0xFFFF ;#
  280. 46:             FNCALL  _main,_fTask1
  281. 47:             FNCALL  _main,_fTask2
  282. 48:             FNROOT  _main
  283. 49:             global  _tasks
  284. 50:             global  _currentTask
  285. 51:             global  _PCL
  286. 52:            _PCL set 0x2
  287. 53:             global  _PCLATH
  288. 54:            _PCLATH  set 0xA
  289. 55:             global  _PORTA
  290. 56:            _PORTA   set 0x5
  291. 57:             global  _PORTC
  292. 58:            _PORTC   set 0x7
  293. 59:             global  _ANSEL
  294. 60:            _ANSEL   set 0x91
  295. 61:             global  _TRISA
  296. 62:            _TRISA   set 0x85
  297. 63:             global  _TRISC
  298. 64:            _TRISC   set 0x87
  299. 65:            psect    text36,local,class=CODE,delta=2,merge=1
  300. 66:            global __ptext36
  301. 67:            __ptext36:
  302. 68:             file    "dist/default/production\messingWithRTOS.X.production.as"
  303. 69:             line    #
  304. 70:            psect cinit,class=CODE,delta=2
  305. 71:            global start_initialization
  306. 72:            start_initialization:
  307. 73:            
  308. 74:            psect    bssCOMMON,class=COMMON,space=1
  309. 75:            global __pbssCOMMON
  310. 76:            __pbssCOMMON:
  311. 77:            _tasks:
  312. 78:                   ds      4
  313. 79:            
  314. 80:            _currentTask:
  315. 81:                   ds      1
  316. 82:            
  317. 83:            ; Clear objects allocated to COMMON
  318. 84:            psect cinit,class=CODE,delta=2,merge=1
  319. 85:             clrf    ((__pbssCOMMON)+0)&07Fh
  320. 0793  01F0     CLRF tasks
  321. 86:             clrf    ((__pbssCOMMON)+1)&07Fh
  322. 0794  01F1     CLRF 0x71
  323. 87:             clrf    ((__pbssCOMMON)+2)&07Fh
  324. 0795  01F2     CLRF 0x72
  325. 88:             clrf    ((__pbssCOMMON)+3)&07Fh
  326. 0796  01F3     CLRF 0x73
  327. 89:             clrf    ((__pbssCOMMON)+4)&07Fh
  328. 0797  01F4     CLRF currentTask
  329. 90:            psect cinit,class=CODE,delta=2,merge=1
  330. 91:            global end_of_initialization
  331. 92:            
  332. 93:            ;End of C runtime variable initialization code
  333. 94:            
  334. 95:            end_of_initialization:
  335. 96:            clrf status
  336. 0798  0183     CLRF STATUS
  337. 97:            ljmp _main   ;jump to C main() function
  338. 0799  2FD8     GOTO 0x7D8
  339. 98:            psect    cstackCOMMON,class=COMMON,space=1
  340. 99:            global __pcstackCOMMON
  341. 100:           __pcstackCOMMON:
  342. 101:            global  ?_fTask1
  343. 102:           ?_fTask1:    ; 0 bytes @ 0x0
  344. 103:            global  ??_fTask1
  345. 104:           ??_fTask1:   ; 0 bytes @ 0x0
  346. 105:            global  ?_fTask2
  347. 106:           ?_fTask2:    ; 0 bytes @ 0x0
  348. 107:            global  ??_fTask2
  349. 108:           ??_fTask2:   ; 0 bytes @ 0x0
  350. 109:            global  ?_main
  351. 110:           ?_main:  ; 0 bytes @ 0x0
  352. 111:            ds  1
  353. 112:            global  ??_main
  354. 113:           ??_main: ; 0 bytes @ 0x1
  355. 114:            ds  1
  356. 115:           ;!
  357. 116:           ;!Data Sizes:
  358. 117:           ;!    Strings     0
  359. 118:           ;!    Constant    0
  360. 119:           ;!    Data        0
  361. 120:           ;!    BSS         5
  362. 121:           ;!    Persistent  0
  363. 122:           ;!    Stack       0
  364. 123:           ;!
  365. 124:           ;!Auto Spaces:
  366. 125:           ;!    Space          Size  Autos    Used
  367. 126:           ;!    COMMON           14      2       7
  368. 127:           ;!    BANK0            80      0       0
  369. 128:           ;!    BANK1            32      0       0
  370. 129:          
  371. 130:           ;!
  372. 131:           ;!Pointer List with Targets:
  373. 132:           ;!
  374. 133:           ;!    None.
  375. 134:          
  376. 135:          
  377. 136:           ;!
  378. 137:           ;!Critical Paths under _main in COMMON
  379. 138:           ;!
  380. 139:           ;!    _main->_fTask1
  381. 140:           ;!    _main->_fTask2
  382. 141:           ;!
  383. 142:           ;!Critical Paths under _main in BANK0
  384. 143:           ;!
  385. 144:           ;!    None.
  386. 145:           ;!
  387. 146:           ;!Critical Paths under _main in BANK1
  388. 147:           ;!
  389. 148:           ;!    None.
  390. 149:          
  391. 150:           ;;
  392. 151:           ;;Main: autosize = 0, tempsize = 1, incstack = 0, save=0
  393. 152:           ;;
  394. 153:          
  395. 154:           ;!
  396. 155:           ;!Call Graph Tables:
  397. 156:           ;!
  398. 157:           ;! ---------------------------------------------------------------------------------
  399. 158:           ;! (Depth) Function              Calls       Base Space   Used Autos Params    Refs
  400. 159:           ;! ---------------------------------------------------------------------------------
  401. 160:           ;! (0) _main                                                 1     1      0       0
  402. 161:           ;!                                              1 COMMON     1     1      0
  403. 162:           ;!                             _fTask1
  404. 163:           ;!                             _fTask2
  405. 164:           ;! ---------------------------------------------------------------------------------
  406. 165:           ;! (1) _fTask1                                               1     1      0       0
  407. 166:           ;!                                              0 COMMON     1     1      0
  408. 167:           ;! ---------------------------------------------------------------------------------
  409. 168:           ;! (1) _fTask2                                               1     1      0       0
  410. 169:           ;!                                              0 COMMON     1     1      0
  411. 170:           ;! ---------------------------------------------------------------------------------
  412. 171:           ;! Estimated maximum stack depth 1
  413. 172:           ;! ---------------------------------------------------------------------------------
  414. 173:           ;!
  415. 174:           ;! Call Graph Graphs:
  416. 175:           ;!
  417. 176:           ;! _main (ROOT)
  418. 177:           ;!   _fTask1
  419. 178:           ;!   _fTask2
  420. 179:           ;!
  421. 180:          
  422. 181:           ;! Address spaces:
  423. 182:          
  424. 183:           ;!Name               Size   Autos  Total    Cost      Usage
  425. 184:           ;!BITCOMMON            E      0       0       0        0.0%
  426. 185:           ;!NULL                 0      0       0       0        0.0%
  427. 186:           ;!CODE                 0      0       0       0        0.0%
  428. 187:           ;!COMMON               E      2       7       1       50.0%
  429. 188:           ;!BITSFR0              0      0       0       1        0.0%
  430. 189:           ;!SFR0                 0      0       0       1        0.0%
  431. 190:           ;!BITSFR1              0      0       0       2        0.0%
  432. 191:           ;!SFR1                 0      0       0       2        0.0%
  433. 192:           ;!STACK                0      0       1       2        0.0%
  434. 193:           ;!BITBANK0            50      0       0       3        0.0%
  435. 194:           ;!BANK0               50      0       0       4        0.0%
  436. 195:           ;!BANK1               20      0       0       5        0.0%
  437. 196:           ;!ABS                  0      0       7       6        0.0%
  438. 197:           ;!BITBANK1            20      0       0       7        0.0%
  439. 198:           ;!DATA                 0      0       8       8        0.0%
  440. 199:          
  441. 200:            global  _main
  442. 201:          
  443. 202:           ;; *************** function _main *****************
  444. 203:           ;; Defined at:
  445. 204:           ;;       line 69 in file "main.c"
  446. 205:           ;; Parameters:    Size  Location     Type
  447. 206:           ;;       None
  448. 207:           ;; Auto vars:     Size  Location     Type
  449. 208:           ;;       None
  450. 209:           ;; Return value:  Size  Location     Type
  451. 210:           ;;       None               void
  452. 211:           ;; Registers used:
  453. 212:           ;;       wreg, fsr0l, fsr0h, status,2, status,0, pclath, cstack
  454. 213:           ;; Tracked objects:
  455. 214:           ;;       On entry : 17F/0
  456. 215:           ;;       On exit  : 0/0
  457. 216:           ;;       Unchanged: 0/0
  458. 217:           ;; Data sizes:     COMMON   BANK0   BANK1
  459. 218:           ;;      Params:         0       0       0
  460. 219:           ;;      Locals:         0       0       0
  461. 220:           ;;      Temps:          1       0       0
  462. 221:           ;;      Totals:         1       0       0
  463. 222:           ;;Total ram usage:        1 bytes
  464. 223:           ;; Hardware stack levels required when called:    1
  465. 224:           ;; This function calls:
  466. 225:           ;;       _fTask1
  467. 226:           ;;       _fTask2
  468. 227:           ;; This function is called by:
  469. 228:           ;;       Startup code after reset
  470. 229:           ;; This function uses a non-reentrant model
  471. 230:           ;;
  472. 231:           psect    maintext,global,class=CODE,delta=2,split=1
  473. 232:           global __pmaintext
  474. 233:           __pmaintext:
  475. 234:           psect    maintext
  476. 235:            file    "main.c"
  477. 236:            line    69
  478. 237:            global  __size_of_main
  479. 238:            __size_of_main  equ __end_of_main-_main
  480. 239:            
  481. 240:           _main:  
  482. 241:            opt stack 7
  483. 242:           ; Regs used in _main: [wreg-fsr0h+status,2+status,0+pclath+cstack]
  484. 243:            line    70
  485. 244:            
  486. 245:           l431:   
  487. 246:           ;main.c: 70: TRISA = 0;
  488. 247:            bsf status, 5   ;RP0=1, select bank1
  489. 248:            clrf    (133)^080h  ;volatile
  490. 249:            line    71
  491. 250:           ;main.c: 71: TRISC = 0;
  492. 251:            clrf    (135)^080h  ;volatile
  493. 252:            line    72
  494. 253:           ;main.c: 72: ANSEL = 0;
  495. 254:            clrf    (145)^080h  ;volatile
  496. 255:            line    73
  497. 256:           ;main.c: 73: PORTA = 0;
  498. 257:            bcf status, 5   ;RP0=0, select bank0
  499. 258:            clrf    (5) ;volatile
  500. 259:            line    74
  501. 260:           ;main.c: 74: PORTC = 0;
  502. 261:            clrf    (7) ;volatile
  503. 262:            line    84
  504. 263:            
  505. 264:           l433:   
  506. 265:           ;main.c: 85: currentTask = currentTask++;
  507. 266:            fcall   _fTask1
  508. 267:            line    85
  509. 268:            
  510. 269:           l435:   
  511. 270:            movlw   (01h)
  512. 271:            movwf   (??_main+0)+0
  513. 272:            movf    (??_main+0)+0,w
  514. 273:            addwf   (_currentTask),f
  515. 274:            line    86
  516. 275:            
  517. 276:           l437:   
  518. 277:           ;main.c: 86: fTask2();
  519. 278:            fcall   _fTask2
  520. 279:            line    89
  521. 280:           # 89 "main.c"
  522. 281:           _taskswitcher ;#
  523. 282:           psect    maintext
  524. 283:            line    90
  525. 284:            
  526. 285:           l439:   
  527. 286:           ;main.c: 90: ++currentTask;
  528. 287:            movlw   (01h)
  529. 288:            movwf   (??_main+0)+0
  530. 289:            movf    (??_main+0)+0,w
  531. 290:            addwf   (_currentTask),f
  532. 291:            line    91
  533. 292:            
  534. 293:           l441:   
  535. 294:           ;main.c: 91: if (currentTask == 2)currentTask = 0;
  536. 295:            movf    (_currentTask),w
  537. 296:            xorlw   02h
  538. 297:            skipz
  539. 298:            goto    u11
  540. 299:            goto    u10
  541. 300:           u11:
  542. 301:            goto    l445
  543. 302:           u10:
  544. 303:            
  545. 304:           l443:   
  546. 305:            clrf    (_currentTask)
  547. 306:            goto    l445
  548. 307:            
  549. 308:           l25:
  550. 309:            line    92
  551. 310:            
  552. 311:           l445:   
  553. 312:           ;main.c: 92: PCLATH = tasks[currentTask].pch;
  554. 313:            movf    (_currentTask),w
  555. 314:            movwf   (??_main+0)+0
  556. 315:            addwf   (??_main+0)+0,w
  557. 316:            addlw   _tasks&0ffh
  558. 317:            movwf   fsr0
  559. 318:            movf    indf,w
  560. 319:            bcf status, 5   ;RP0=0, select bank0
  561. 320:            movwf   (10)    ;volatile
  562. 321:            line    93
  563. 322:           ;main.c: 93: PCL = tasks[currentTask].pcl;
  564. 323:            setc
  565. 324:            rlf (_currentTask),w
  566. 325:            addlw   _tasks&0ffh
  567. 326:            movwf   fsr0
  568. 327:            movf    indf,w
  569. 328:            movwf   (2) ;volatile
  570. 329:            line    94
  571. 330:            
  572. 331:           l26:
  573. 332:            global  start
  574. 333:            ljmp    start
  575. 334:            opt stack 0
  576. 335:           GLOBAL   __end_of_main
  577. 336:            __end_of_main:
  578. 337:            signat  _main,88
  579. 338:            global  _fTask1
  580. 339:          
  581. 340:           ;; *************** function _fTask1 *****************
  582. 341:           ;; Defined at:
  583. 342:           ;;       line 97 in file "main.c"
  584. 343:           ;; Parameters:    Size  Location     Type
  585. 344:           ;;       None
  586. 345:           ;; Auto vars:     Size  Location     Type
  587. 346:           ;;       None
  588. 347:           ;; Return value:  Size  Location     Type
  589. 348:           ;;       None               void
  590. 349:           ;; Registers used:
  591. 350:           ;;       wreg, status,2, status,0
  592. 351:           ;; Tracked objects:
  593. 352:           ;;       On entry : 0/0
  594. 353:           ;;       On exit  : 0/0
  595. 354:           ;;       Unchanged: 0/0
  596. 355:           ;; Data sizes:     COMMON   BANK0   BANK1
  597. 356:           ;;      Params:         0       0       0
  598. 357:           ;;      Locals:         0       0       0
  599. 358:           ;;      Temps:          1       0       0
  600. 359:           ;;      Totals:         1       0       0
  601. 360:           ;;Total ram usage:        1 bytes
  602. 361:           ;; Hardware stack levels used:    1
  603. 362:           ;; This function calls:
  604. 363:           ;;       Nothing
  605. 364:           ;; This function is called by:
  606. 365:           ;;       _main
  607. 366:           ;; This function uses a non-reentrant model
  608. 367:           ;;
  609. 368:           psect    text37,local,class=CODE,delta=2,merge=1
  610. 369:           global __ptext37
  611. 370:           __ptext37:
  612. 371:           psect    text37
  613. 372:            file    "main.c"
  614. 373:            line    97
  615. 374:            global  __size_of_fTask1
  616. 375:            __size_of_fTask1    equ __end_of_fTask1-_fTask1
  617. 376:            
  618. 377:           _fTask1:
  619. 378:            opt stack 7
  620. 379:           ; Regs used in _fTask1: [wreg+status,2+status,0]
  621. 380:            line    99
  622. 381:            
  623. 382:           l411:   
  624. 383:           ;main.c: 99: tasks[0].pch = PCLATH;
  625. 384:            bcf status, 5   ;RP0=0, select bank0
  626. 385:            movf    (10),;volatile
  627. 386:            movwf   (??_fTask1+0)+0
  628. 387:            movf    (??_fTask1+0)+0,w
  629. 388:            movwf   (_tasks)
  630. 389:            line    100
  631. 390:            
  632. 391:           l413:   
  633. 392:           ;main.c: 100: tasks[0].pcl = PCL + 6;
  634. 393:            movf    (2),w   ;volatile
  635. 394:            addlw   06h
  636. 395:            movwf   (??_fTask1+0)+0
  637. 396:            movf    (??_fTask1+0)+0,w
  638. 397:            movwf   0+(_tasks)+01h
  639. 398:            line    101
  640. 399:           # 101 "main.c"
  641. 400:           return ;#
  642. 401:           psect    text37
  643. 402:            goto    l415
  644. 403:            line    103
  645. 404:           ;main.c: 103: while (1)
  646. 405:            
  647. 406:           l29:
  648. 407:            line    105
  649. 408:            
  650. 409:           l415:   
  651. 410:           ;main.c: 104: {
  652. 411:           ;main.c: 105: PORTA = 0xAA;
  653. 412:            movlw   (0AAh)
  654. 413:            bcf status, 5   ;RP0=0, select bank0
  655. 414:            movwf   (5) ;volatile
  656. 415:            line    107
  657. 416:            
  658. 417:           l417:   
  659. 418:           ;main.c: 107: tasks[0].pch = PCLATH;
  660. 419:            movf    (10),;volatile
  661. 420:            movwf   (??_fTask1+0)+0
  662. 421:            movf    (??_fTask1+0)+0,w
  663. 422:            movwf   (_tasks)
  664. 423:            line    108
  665. 424:            
  666. 425:           l419:   
  667. 426:           ;main.c: 108: tasks[0].pcl = PCL + 6;
  668. 427:            movf    (2),w   ;volatile
  669. 428:            addlw   06h
  670. 429:            movwf   (??_fTask1+0)+0
  671. 430:            movf    (??_fTask1+0)+0,w
  672. 431:            movwf   0+(_tasks)+01h
  673. 432:            line    109
  674. 433:           # 109 "main.c"
  675. 434:           goto _taskswitcher ;#
  676. 435:           psect    text37
  677. 436:            line    111
  678. 437:           ;main.c: 111: PORTA = 0x55;
  679. 438:            movlw   (055h)
  680. 439:            bcf status, 5   ;RP0=0, select bank0
  681. 440:            movwf   (5) ;volatile
  682. 441:            goto    l415
  683. 442:            line    112
  684. 443:            
  685. 444:           l30:
  686. 445:            line    103
  687. 446:            goto    l415
  688. 447:            
  689. 448:           l31:
  690. 449:            line    113
  691. 450:            
  692. 451:           l32:
  693. 452:            return
  694. 453:            opt stack 0
  695. 454:           GLOBAL   __end_of_fTask1
  696. 455:            __end_of_fTask1:
  697. 456:            signat  _fTask1,88
  698. 457:            global  _fTask2
  699. 458:          
  700. 459:           ;; *************** function _fTask2 *****************
  701. 460:           ;; Defined at:
  702. 461:           ;;       line 116 in file "main.c"
  703. 462:           ;; Parameters:    Size  Location     Type
  704. 463:           ;;       None
  705. 464:           ;; Auto vars:     Size  Location     Type
  706. 465:           ;;       None
  707. 466:           ;; Return value:  Size  Location     Type
  708. 467:           ;;       None               void
  709. 468:           ;; Registers used:
  710. 469:           ;;       wreg, status,2, status,0
  711. 470:           ;; Tracked objects:
  712. 471:           ;;       On entry : 0/0
  713. 472:           ;;       On exit  : 0/0
  714. 473:           ;;       Unchanged: 0/0
  715. 474:           ;; Data sizes:     COMMON   BANK0   BANK1
  716. 475:           ;;      Params:         0       0       0
  717. 476:           ;;      Locals:         0       0       0
  718. 477:           ;;      Temps:          1       0       0
  719. 478:           ;;      Totals:         1       0       0
  720. 479:           ;;Total ram usage:        1 bytes
  721. 480:           ;; Hardware stack levels used:    1
  722. 481:           ;; This function calls:
  723. 482:           ;;       Nothing
  724. 483:           ;; This function is called by:
  725. 484:           ;;       _main
  726. 485:           ;; This function uses a non-reentrant model
  727. 486:           ;;
  728. 487:           psect    text38,local,class=CODE,delta=2,merge=1
  729. 488:           global __ptext38
  730. 489:           __ptext38:
  731. 490:           psect    text38
  732. 491:            file    "main.c"
  733. 492:            line    116
  734. 493:            global  __size_of_fTask2
  735. 494:            __size_of_fTask2    equ __end_of_fTask2-_fTask2
  736. 495:            
  737. 496:           _fTask2:
  738. 497:            opt stack 7
  739. 498:           ; Regs used in _fTask2: [wreg+status,2+status,0]
  740. 499:            line    118
  741. 500:            
  742. 501:           l421:   
  743. 502:           ;main.c: 118: tasks[1].pch = PCLATH;
  744. 503:            bcf status, 5   ;RP0=0, select bank0
  745. 504:            movf    (10),;volatile
  746. 505:            movwf   (??_fTask2+0)+0
  747. 506:            movf    (??_fTask2+0)+0,w
  748. 507:            movwf   0+(_tasks)+02h
  749. 508:            line    119
  750. 509:            
  751. 510:           l423:   
  752. 511:           ;main.c: 119: tasks[1].pcl = PCL + 6;
  753. 512:            movf    (2),w   ;volatile
  754. 513:            addlw   06h
  755. 514:            movwf   (??_fTask2+0)+0
  756. 515:            movf    (??_fTask2+0)+0,w
  757. 516:            movwf   0+(_tasks)+03h
  758. 517:            line    120
  759. 518:           # 120 "main.c"
  760. 519:           return ;#
  761. 520:           psect    text38
  762. 521:            goto    l425
  763. 522:            line    122
  764. 523:           ;main.c: 122: while (1)
  765. 524:            
  766. 525:           l35:
  767. 526:            line    124
  768. 527:            
  769. 528:           l425:   
  770. 529:           ;main.c: 123: {
  771. 530:           ;main.c: 124: PORTC = 0xAA;
  772. 531:            movlw   (0AAh)
  773. 532:            bcf status, 5   ;RP0=0, select bank0
  774. 533:            movwf   (7) ;volatile
  775. 534:            line    125
  776. 535:            
  777. 536:           l427:   
  778. 537:           ;main.c: 125: ; tasks[1].pch = PCLATH; tasks[1].pcl = PCL + 6; asm("goto _taskswitcher");;
  779. 538:            movf    (10),;volatile
  780. 539:            movwf   (??_fTask2+0)+0
  781. 540:            movf    (??_fTask2+0)+0,w
  782. 541:            movwf   0+(_tasks)+02h
  783. 542:            
  784. 543:           l429:   
  785. 544:            movf    (2),w   ;volatile
  786. 545:            addlw   06h
  787. 546:            movwf   (??_fTask2+0)+0
  788. 547:            movf    (??_fTask2+0)+0,w
  789. 548:            movwf   0+(_tasks)+03h
  790. 549:           # 125 "main.c"
  791. 550:           goto _taskswitcher ;#
  792. 551:           psect    text38
  793. 552:            line    126
  794. 553:           ;main.c: 126: PORTC = 0x55;
  795. 554:            movlw   (055h)
  796. 555:            bcf status, 5   ;RP0=0, select bank0
  797. 556:            movwf   (7) ;volatile
  798. 557:            goto    l425
  799. 558:            line    127
  800. 559:            
  801. 560:           l36:
  802. 561:            line    122
  803. 562:            goto    l425
  804. 563:            
  805. 564:           l37:
  806. 565:            line    128
  807. 566:            
  808. 567:           l38:
  809. 568:            return
  810. 569:            opt stack 0
  811. 570:           GLOBAL   __end_of_fTask2
  812. 571:            __end_of_fTask2:
  813. 572:            signat  _fTask2,88
  814. 573:           psect    text39,local,class=CODE,delta=2,merge=1
  815. 574:           global __ptext39
  816. 575:           __ptext39:
  817. 576:            global  btemp
  818. 577:            btemp set 07Eh
  819. 578:          
  820. 579:            DABS    1,126,2 ;btemp
  821. 580:            global  wtemp0
  822. 581:            wtemp0 set btemp
  823. 582:            end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement