1 |
2 |
olivier.gi |
/*===========================================================================*/
|
2 |
|
|
/* Copyright (C) 2001 Authors */
|
3 |
|
|
/* */
|
4 |
|
|
/* This source file may be used and distributed without restriction provided */
|
5 |
|
|
/* that this copyright statement is not removed from the file and that any */
|
6 |
|
|
/* derivative work contains the original copyright notice and the associated */
|
7 |
|
|
/* disclaimer. */
|
8 |
|
|
/* */
|
9 |
|
|
/* This source file is free software; you can redistribute it and/or modify */
|
10 |
|
|
/* it under the terms of the GNU Lesser General Public License as published */
|
11 |
|
|
/* by the Free Software Foundation; either version 2.1 of the License, or */
|
12 |
|
|
/* (at your option) any later version. */
|
13 |
|
|
/* */
|
14 |
|
|
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
|
15 |
|
|
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
|
16 |
|
|
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
|
17 |
|
|
/* License for more details. */
|
18 |
|
|
/* */
|
19 |
|
|
/* You should have received a copy of the GNU Lesser General Public License */
|
20 |
|
|
/* along with this source; if not, write to the Free Software Foundation, */
|
21 |
|
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
22 |
|
|
/* */
|
23 |
|
|
/*===========================================================================*/
|
24 |
|
|
/* TWO-OPERAND ARITHMETIC: XOR[.B] INSTRUCTION */
|
25 |
|
|
/*---------------------------------------------------------------------------*/
|
26 |
|
|
/* Test the XOR[.B] instruction. */
|
27 |
18 |
olivier.gi |
/* */
|
28 |
|
|
/* Author(s): */
|
29 |
|
|
/* - Olivier Girard, olgirard@gmail.com */
|
30 |
|
|
/* */
|
31 |
|
|
/*---------------------------------------------------------------------------*/
|
32 |
19 |
olivier.gi |
/* $Rev: 19 $ */
|
33 |
|
|
/* $LastChangedBy: olivier.girard $ */
|
34 |
|
|
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $ */
|
35 |
2 |
olivier.gi |
/*===========================================================================*/
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
.global main
|
39 |
|
|
|
40 |
|
|
main:
|
41 |
|
|
/* -------------- TEST INSTRUCTION IN WORD MODE ------------------- */
|
42 |
|
|
|
43 |
|
|
mov #0x0000, r2
|
44 |
|
|
mov #0x3333, r4
|
45 |
|
|
mov #0x8888, r5
|
46 |
|
|
xor r4, r5 ;# XOR r5^r4 (0x8888^0x3333=0xbbbb)
|
47 |
|
|
|
48 |
|
|
mov #0x0001, r2
|
49 |
|
|
mov #0x5555, r4
|
50 |
|
|
mov #0x9999, r6
|
51 |
|
|
xor r4, r6 ;# XOR r6^r4 (0x9999^0x5555=0xcccc)
|
52 |
|
|
|
53 |
|
|
mov #0x1000, r15
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
/* -------------- TEST INSTRUCTION IN BYTE MODE ------------------- */
|
57 |
|
|
|
58 |
|
|
mov #0x0000, r2
|
59 |
|
|
mov #0x3333, r4
|
60 |
|
|
mov #0x8888, r5
|
61 |
|
|
xor.b r4, r5 ;# XOR r5^r4 (0x0088^0x0033=0x00bb)
|
62 |
|
|
|
63 |
|
|
mov #0x0001, r2
|
64 |
|
|
mov #0x5555, r4
|
65 |
|
|
mov #0x9999, r6
|
66 |
|
|
xor.b r4, r6 ;# XOR r6^r4 (0x0099^0x0055=0x00cc)
|
67 |
|
|
|
68 |
|
|
mov #0x2000, r15
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
/* ------------------ TEST FLAGS IN WORD MODE ---------------------- */
|
72 |
|
|
|
73 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=0, C=1
|
74 |
|
|
mov #0x0aaa, r4 ;#
|
75 |
|
|
mov #0x0666, r5 ;#
|
76 |
|
|
xor r4, r5 ;# XOR r5^r4 (0x0666^0x0aaa=0x0ccc)
|
77 |
|
|
mov #0x3000, r15
|
78 |
|
|
|
79 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=1, C=0
|
80 |
|
|
mov #0x0444, r4 ;#
|
81 |
|
|
mov #0x0444, r5 ;#
|
82 |
|
|
xor r4, r5 ;# XOR r5^r4 (0x0444^0x0444=0x0000)
|
83 |
|
|
mov #0x3001, r15
|
84 |
|
|
|
85 |
|
|
mov #0x0000, r2 ;# V=0, N=1, Z=0, C=1
|
86 |
|
|
mov #0x8aaa, r4 ;#
|
87 |
|
|
mov #0x0666, r5 ;#
|
88 |
|
|
xor r4, r5 ;# XOR r5^r4 (0x8aaa^0x0666=0x8ccc)
|
89 |
|
|
mov #0x3002, r15
|
90 |
|
|
|
91 |
|
|
mov #0x0000, r2 ;# V=1, N=0, Z=0, C=1
|
92 |
|
|
mov #0x8aaa, r4 ;#
|
93 |
|
|
mov #0x8666, r5 ;#
|
94 |
|
|
xor r4, r5 ;# XOR r5^r4 (0x8aaa^0x8666=0x0ccc)
|
95 |
|
|
mov #0x3003, r15
|
96 |
|
|
|
97 |
|
|
mov #0x0000, r2 ;# V=1, N=0, Z=1, C=0
|
98 |
|
|
mov #0x8444, r4 ;#
|
99 |
|
|
mov #0x8444, r5 ;#
|
100 |
|
|
xor r4, r5 ;# XOR r5^r4 (0x8444^0x8444=0x0000)
|
101 |
|
|
mov #0x3004, r15
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
/* ------------------ TEST FLAGS IN BYTE MODE --------------------- */
|
105 |
|
|
|
106 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=0, C=1
|
107 |
|
|
mov #0x660a, r4 ;#
|
108 |
|
|
mov #0xaa06, r5 ;#
|
109 |
|
|
xor.b r4, r5 ;# XOR r5^r4 (0x0006^0x000a=0x000c)
|
110 |
|
|
mov #0x4000, r15
|
111 |
|
|
|
112 |
|
|
mov #0x0000, r2 ;# V=0, N=0, Z=1, C=0
|
113 |
|
|
mov #0x6604, r4 ;#
|
114 |
|
|
mov #0xaa04, r5 ;#
|
115 |
|
|
xor.b r4, r5 ;# XOR r5^r4 (0x0004^0x0004=0x0000)
|
116 |
|
|
mov #0x4001, r15
|
117 |
|
|
|
118 |
|
|
mov #0x0000, r2 ;# V=0, N=1, Z=0, C=1
|
119 |
|
|
mov #0x558a, r4 ;#
|
120 |
|
|
mov #0x0006, r5 ;#
|
121 |
|
|
xor.b r4, r5 ;# XOR r5^r4 (0x008a^0x0006=0x008c)
|
122 |
|
|
mov #0x4002, r15
|
123 |
|
|
|
124 |
|
|
mov #0x0000, r2 ;# V=1, N=0, Z=0, C=1
|
125 |
|
|
mov #0x558a, r4 ;#
|
126 |
|
|
mov #0x5586, r5 ;#
|
127 |
|
|
xor.b r4, r5 ;# XOR r5^r4 (0x008a^0x0086=0x000c)
|
128 |
|
|
mov #0x4003, r15
|
129 |
|
|
|
130 |
|
|
mov #0x0000, r2 ;# V=1, N=0, Z=1, C=0
|
131 |
|
|
mov #0x6684, r4 ;#
|
132 |
|
|
mov #0xaa84, r5 ;#
|
133 |
|
|
xor.b r4, r5 ;# XOR r5^r4 (0x0084^0x0084=0x0000)
|
134 |
|
|
mov #0x4004, r15
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
/* ---------------------- END OF TEST --------------- */
|
138 |
|
|
mov #0x5000, r15
|
139 |
|
|
end_of_test:
|
140 |
|
|
nop
|
141 |
|
|
br #0xffff
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
/* ---------------------- INTERRUPT VECTORS --------------- */
|
145 |
|
|
|
146 |
|
|
.section .vectors, "a"
|
147 |
|
|
.word end_of_test ; Interrupt 0 (lowest priority)
|
148 |
|
|
.word end_of_test ; Interrupt 1
|
149 |
|
|
.word end_of_test ; Interrupt 2
|
150 |
|
|
.word end_of_test ; Interrupt 3
|
151 |
|
|
.word end_of_test ; Interrupt 4
|
152 |
|
|
.word end_of_test ; Interrupt 5
|
153 |
|
|
.word end_of_test ; Interrupt 6
|
154 |
|
|
.word end_of_test ; Interrupt 7
|
155 |
|
|
.word end_of_test ; Interrupt 8
|
156 |
|
|
.word end_of_test ; Interrupt 9
|
157 |
|
|
.word end_of_test ; Interrupt 10 Watchdog timer
|
158 |
|
|
.word end_of_test ; Interrupt 11
|
159 |
|
|
.word end_of_test ; Interrupt 12
|
160 |
|
|
.word end_of_test ; Interrupt 13
|
161 |
|
|
.word end_of_test ; Interrupt 14 NMI
|
162 |
|
|
.word main ; Interrupt 15 (highest priority) RESET
|