Advertisement
abdullahkahraman

Microchip Forums: RTOS implementation - Dissambly Listing 1

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