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: BIC[.B] INSTRUCTION */
|
25 |
|
|
/*---------------------------------------------------------------------------*/
|
26 |
|
|
/* Test the BIC[.B] instruction. */
|
27 |
18 |
olivier.gi |
/* */
|
28 |
|
|
/* Author(s): */
|
29 |
|
|
/* - Olivier Girard, olgirard@gmail.com */
|
30 |
|
|
/* */
|
31 |
|
|
/*---------------------------------------------------------------------------*/
|
32 |
|
|
/* $Rev: 17 $ */
|
33 |
|
|
/* $LastChangedBy: olivier.girard $ */
|
34 |
|
|
/* $LastChangedDate: 2009-08-04 23:15:39 +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 #0xaaaa, r4
|
45 |
|
|
mov #0xffff, r5
|
46 |
|
|
bic r4, r5 ;# Clear bits ~r4 & r5 (~0xaaaa & 0xffff=0x5555)
|
47 |
|
|
|
48 |
|
|
mov #0x0001, r2
|
49 |
|
|
mov #0x5555, r4
|
50 |
|
|
mov #0xffff, r6
|
51 |
|
|
bic r4, r6 ;# Clear bits ~r4 & r6 (~0x5555 & 0xffff=0xaaaa)
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
mov #0x1000, r15
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
/* -------------- TEST INSTRUCTION IN BYTE MODE ------------------- */
|
58 |
|
|
|
59 |
|
|
mov #0x0000, r2
|
60 |
|
|
mov #0x3333, r4
|
61 |
|
|
mov #0x9999, r5
|
62 |
|
|
bic.b r4, r5 ;# Clear bits ~r4 & r5 (~0x3333 & 0x9999=0x0088)
|
63 |
|
|
|
64 |
|
|
mov #0x0001, r2
|
65 |
|
|
mov #0x5555, r4
|
66 |
|
|
mov #0x6666, r6
|
67 |
|
|
bic.b r4, r6 ;# Clear bits ~r4 & r6 (~0x5555 & 0xcccc=0x0022)
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
mov #0x2000, r15
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
/* ------------------ TEST FLAGS IN WORD MODE ---------------------- */
|
74 |
|
|
#
|
75 |
|
|
# Make sure Flags are unaffected by instruction
|
76 |
|
|
#
|
77 |
|
|
|
78 |
|
|
mov #0x0005, r2 ;# V=0, N=1, Z=0, C=1
|
79 |
|
|
mov #0x0aaa, r4 ;#
|
80 |
|
|
mov #0x0666, r5 ;#
|
81 |
|
|
bic r4, r5 ;# Clear bits ~r4 & r5 (~0x0aaa & 0x0666=0x0444)
|
82 |
|
|
mov #0x3000, r15
|
83 |
|
|
|
84 |
|
|
mov #0x0102, r2 ;# V=1, N=0, Z=1, C=0
|
85 |
|
|
mov #0x0aaa, r4 ;#
|
86 |
|
|
mov #0x0666, r5 ;#
|
87 |
|
|
bic r4, r5 ;# Clear bits ~r4 & r5 (~0x0aaa & 0x0666=0x0444)
|
88 |
|
|
mov #0x3001, r15
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
/* ------------------ TEST FLAGS IN BYTE MODE --------------------- */
|
92 |
|
|
#
|
93 |
|
|
# Make sure Flags are unaffected by instruction
|
94 |
|
|
#
|
95 |
|
|
|
96 |
|
|
mov #0x0005, r2 ;# V=0, N=1, Z=0, C=1
|
97 |
|
|
mov #0x550a, r4 ;#
|
98 |
|
|
mov #0x6606, r5 ;#
|
99 |
|
|
bic.b r4, r5 ;# Clear bits ~r4 & r5 (~0x000a & 0x0006=0x0004)
|
100 |
|
|
mov #0x4000, r15
|
101 |
|
|
|
102 |
|
|
mov #0x0102, r2 ;# V=1, N=0, Z=1, C=0
|
103 |
|
|
mov #0x330a, r4 ;#
|
104 |
|
|
mov #0x9906, r5 ;#
|
105 |
|
|
bic.b r4, r5 ;# Clear bits ~r4 & r5 (~0x000a & 0x0006=0x0004)
|
106 |
|
|
mov #0x4001, r15
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
/* ---------------------- END OF TEST --------------- */
|
111 |
|
|
mov #0x5000, r15
|
112 |
|
|
end_of_test:
|
113 |
|
|
nop
|
114 |
|
|
br #0xffff
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
/* ---------------------- INTERRUPT VECTORS --------------- */
|
119 |
|
|
|
120 |
|
|
.section .vectors, "a"
|
121 |
|
|
.word end_of_test ; Interrupt 0 (lowest priority)
|
122 |
|
|
.word end_of_test ; Interrupt 1
|
123 |
|
|
.word end_of_test ; Interrupt 2
|
124 |
|
|
.word end_of_test ; Interrupt 3
|
125 |
|
|
.word end_of_test ; Interrupt 4
|
126 |
|
|
.word end_of_test ; Interrupt 5
|
127 |
|
|
.word end_of_test ; Interrupt 6
|
128 |
|
|
.word end_of_test ; Interrupt 7
|
129 |
|
|
.word end_of_test ; Interrupt 8
|
130 |
|
|
.word end_of_test ; Interrupt 9
|
131 |
|
|
.word end_of_test ; Interrupt 10 Watchdog timer
|
132 |
|
|
.word end_of_test ; Interrupt 11
|
133 |
|
|
.word end_of_test ; Interrupt 12
|
134 |
|
|
.word end_of_test ; Interrupt 13
|
135 |
|
|
.word end_of_test ; Interrupt 14 NMI
|
136 |
|
|
.word main ; Interrupt 15 (highest priority) RESET
|