]> git.sur5r.net Git - freertos/blob - Demo/NEC_78K0R_IAR/RegTest.s26
Prepare for V5.3.0 release.
[freertos] / Demo / NEC_78K0R_IAR / RegTest.s26
1 ;/*\r
2 ;       FreeRTOS.org V5.3.0 - Copyright (C) 2003-2009 Richard Barry.\r
3 ;\r
4 ;       This file is part of the FreeRTOS.org distribution.\r
5 ;\r
6 ;       FreeRTOS.org is free software; you can redistribute it and/or modify it\r
7 ;       under the terms of the GNU General Public License (version 2) as published\r
8 ;       by the Free Software Foundation and modified by the FreeRTOS exception.\r
9 ;       **NOTE** The exception to the GPL is included to allow you to distribute a\r
10 ;       combined work that includes FreeRTOS.org without being obliged to provide\r
11 ;       the source code for any proprietary components.  Alternative commercial\r
12 ;       license and support terms are also available upon request.  See the \r
13 ;       licensing section of http://www.FreeRTOS.org for full details.\r
14 ;\r
15 ;       FreeRTOS.org is distributed in the hope that it will be useful, but WITHOUT\r
16 ;       ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
17 ;       FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
18 ;       more details.\r
19 ;\r
20 ;       You should have received a copy of the GNU General Public License along\r
21 ;       with FreeRTOS.org; if not, write to the Free Software Foundation, Inc., 59\r
22 ;       Temple Place, Suite 330, Boston, MA  02111-1307  USA.\r
23 ;\r
24 ;\r
25 ;       ***************************************************************************\r
26 ;       *                                                                         *\r
27 ;       * Get the FreeRTOS eBook!  See http://www.FreeRTOS.org/Documentation      *\r
28 ;       *                                                                         *\r
29 ;       * This is a concise, step by step, 'hands on' guide that describes both   *\r
30 ;       * general multitasking concepts and FreeRTOS specifics. It presents and   *\r
31 ;       * explains numerous examples that are written using the FreeRTOS API.     *\r
32 ;       * Full source code for all the examples is provided in an accompanying    *\r
33 ;       * .zip file.                                                              *\r
34 ;       *                                                                         *\r
35 ;       ***************************************************************************\r
36 ;\r
37 ;       1 tab == 4 spaces!\r
38 ;\r
39 ;       Please ensure to read the configuration and relevant port sections of the\r
40 ;       online documentation.\r
41 ;\r
42 ;       http://www.FreeRTOS.org - Documentation, latest information, license and\r
43 ;       contact details.\r
44 ;\r
45 ;       http://www.SafeRTOS.com - A version that is certified for use in safety\r
46 ;       critical systems.\r
47 ;\r
48 ;       http://www.OpenRTOS.com - Commercial support, development, porting,\r
49 ;       licensing and training services.\r
50 ;*/\r
51 \r
52 \r
53 ;\r
54 ; This file defines the RegTest tasks as described at the top of main.c\r
55 ;\r
56 \r
57 ;------------------------------------------------------------------------------\r
58 \r
59 #if __CORE__ != __78K0R__\r
60         #error "This file is only for 78K0R Devices"\r
61 #endif\r
62 \r
63 ; Functions implemented in this file\r
64 ;------------------------------------------------------------------------------\r
65 \r
66         PUBLIC    vRegTest1\r
67         PUBLIC    vRegTest2\r
68 \r
69 ; Functions used by this file\r
70 ;------------------------------------------------------------------------------\r
71         EXTERN    vRegTestError\r
72 \r
73 ;------------------------------------------------------------------------------\r
74 ;   Fill all the registers with known values, then check that the registers\r
75 ;   contain the expected value.  An incorrect value being indicative of an\r
76 ;   error in the context switch mechanism.\r
77 ;\r
78 ;   Input:  NONE\r
79 ;\r
80 ;   Call:   Created as a task.\r
81 ;\r
82 ;   Output: NONE\r
83 ;\r
84 ;------------------------------------------------------------------------------\r
85     RSEG CODE:CODE\r
86 vRegTest1:\r
87 \r
88         ; First fill the registers.\r
89         MOVW    AX, #0x1122\r
90         MOVW    BC, #0x3344\r
91         MOVW    DE, #0x5566\r
92         MOVW    HL, #0x7788\r
93         MOV             CS, #0x01\r
94 #if configMEMORY_MODE == 1      \r
95         ; ES is not saved or restored when using the near memory model so only\r
96         ; test it when using the far model.\r
97         MOV             ES, #0x02\r
98 #endif\r
99 \r
100 loop1:\r
101         ; Continuously check that the register values remain at their expected\r
102         ; values.  The BRK is to test the yield.  This task runs at low priority\r
103         ; so will also regularly get preempted.\r
104         BRK\r
105 \r
106         ; Compare with the expected value.\r
107         CMPW    AX, #0x1122\r
108         BZ              +5\r
109         ; Jump over the branch to vRegTestError() if the register contained the\r
110         ; expected value - otherwise flag an error by executing vRegTestError().\r
111         BR              vRegTestError   \r
112 \r
113         ; Repeat for all the registers.\r
114         MOVW    AX, BC\r
115         CMPW    AX, #0x3344\r
116         BZ              +5\r
117         BR              vRegTestError   \r
118         MOVW    AX, DE\r
119         CMPW    AX, #0x5566\r
120         BZ              +5\r
121         BR              vRegTestError   \r
122         MOVW    AX, HL  \r
123         CMPW    AX, #0x7788\r
124         BZ              +5\r
125         BR              vRegTestError\r
126         MOV             A, CS\r
127         CMP             A, #0x01\r
128         BZ              +5\r
129         BR              vRegTestError\r
130 #if configMEMORY_MODE == 1      \r
131         ; ES is not saved or restored when using the near memory model so only\r
132         ; test it when using the far model.\r
133         MOV             A, ES\r
134         CMP             A, #0x02\r
135         BZ              +5\r
136         BR              vRegTestError\r
137 #endif\r
138         MOVW    AX, #0x1122\r
139         BR              loop1\r
140 \r
141 \r
142 ;------------------------------------------------------------------------------\r
143 ;   Fill all the registers with known values, then check that the registers\r
144 ;   contain the expected value.  An incorrect value being indicative of an\r
145 ;   error in the context switch mechanism.\r
146 ;\r
147 ;   Input:  NONE\r
148 ;\r
149 ;   Call:   Created as a task.\r
150 ;\r
151 ;   Output: NONE\r
152 ;\r
153 ;------------------------------------------------------------------------------\r
154     RSEG CODE:CODE\r
155 vRegTest2:\r
156 \r
157         MOVW    AX, #0x99aa\r
158         MOVW    BC, #0xbbcc\r
159         MOVW    DE, #0xddee\r
160         MOVW    HL, #0xff12\r
161         MOV             CS, #0x03\r
162 #if configMEMORY_MODE == 1      \r
163         MOV             ES, #0x04       \r
164 #endif\r
165 \r
166 loop2:\r
167         CMPW    AX, #0x99aa\r
168         BZ              +5\r
169         BR              vRegTestError   \r
170         MOVW    AX, BC\r
171         CMPW    AX, #0xbbcc\r
172         BZ              +5\r
173         BR              vRegTestError   \r
174         MOVW    AX, DE\r
175         CMPW    AX, #0xddee\r
176         BZ              +5\r
177         BR              vRegTestError   \r
178         MOVW    AX, HL  \r
179         CMPW    AX, #0xff12\r
180         BZ              +5\r
181         BR              vRegTestError\r
182         MOV             A, CS\r
183         CMP             A, #0x03\r
184         BZ              +5\r
185         BR              vRegTestError\r
186 #if configMEMORY_MODE == 1              \r
187         MOV             A, ES\r
188         CMP             A, #0x04\r
189         BZ              +5\r
190         BR              vRegTestError\r
191 #endif\r
192         MOVW    AX, #0x99aa\r
193         BR              loop2\r
194 \r
195 \r
196         END\r