OpenCores
URL https://opencores.org/ocsvn/s80186/s80186/trunk

Subversion Repositories s80186

[/] [s80186/] [trunk/] [tests/] [instructions/] [TestControl.cpp] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jamieiles
// Copyright Jamie Iles, 2017
2
//
3
// This file is part of s80x86.
4
//
5
// s80x86 is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// s80x86 is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with s80x86.  If not, see <http://www.gnu.org/licenses/>.
17
 
18
#include <gtest/gtest.h>
19
 
20
#include "EmulateFixture.h"
21
#include "Flags.h"
22
 
23
TEST_F(EmulateFixture, ClcClearsCarry)
24
{
25
    write_flags(CF);
26
 
27
    set_instruction({0xf8});
28
 
29
    emulate();
30
 
31
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS);
32
}
33
 
34
TEST_F(EmulateFixture, ClcDoesntSetCarry)
35
{
36
    write_flags(0);
37
 
38
    set_instruction({0xf8});
39
 
40
    emulate();
41
 
42
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS);
43
}
44
 
45
TEST_F(EmulateFixture, CmcInverts0)
46
{
47
    write_flags(0);
48
 
49
    set_instruction({0xf5});
50
 
51
    emulate();
52
 
53
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS | CF);
54
}
55
 
56
TEST_F(EmulateFixture, CmcInverts1)
57
{
58
    write_flags(CF);
59
 
60
    set_instruction({0xf5});
61
 
62
    emulate();
63
 
64
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS);
65
}
66
 
67
TEST_F(EmulateFixture, StcSetsCarry)
68
{
69
    write_flags(0);
70
 
71
    set_instruction({0xf9});
72
 
73
    emulate();
74
 
75
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS | CF);
76
}
77
 
78
TEST_F(EmulateFixture, StcDoesntClearCarry)
79
{
80
    write_flags(CF);
81
 
82
    set_instruction({0xf9});
83
 
84
    emulate();
85
 
86
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS | CF);
87
}
88
 
89
TEST_F(EmulateFixture, CldClearsDirection)
90
{
91
    write_flags(DF);
92
 
93
    set_instruction({0xfc});
94
 
95
    emulate();
96
 
97
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS);
98
}
99
 
100
TEST_F(EmulateFixture, CldDoesntSetDirection)
101
{
102
    write_flags(0);
103
 
104
    set_instruction({0xfc});
105
 
106
    emulate();
107
 
108
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS);
109
}
110
 
111
TEST_F(EmulateFixture, StdSetsDirection)
112
{
113
    write_flags(0);
114
 
115
    set_instruction({0xfd});
116
 
117
    emulate();
118
 
119
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS | DF);
120
}
121
 
122
TEST_F(EmulateFixture, StdDoesntClearDirection)
123
{
124
    write_flags(DF);
125
 
126
    set_instruction({0xfd});
127
 
128
    emulate();
129
 
130
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS | DF);
131
}
132
 
133
TEST_F(EmulateFixture, CliClearsInterrupt)
134
{
135
    write_flags(IF);
136
 
137
    set_instruction({0xfa});
138
 
139
    emulate();
140
 
141
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS);
142
}
143
 
144
TEST_F(EmulateFixture, CliDoesntSetInterrupt)
145
{
146
    write_flags(0);
147
 
148
    set_instruction({0xfa});
149
 
150
    emulate();
151
 
152
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS);
153
}
154
 
155
TEST_F(EmulateFixture, StiSetsInterrupt)
156
{
157
    write_flags(0);
158
 
159
    set_instruction({0xfb});
160
 
161
    emulate();
162
 
163
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS | IF);
164
}
165
 
166
TEST_F(EmulateFixture, StiDoesntClearInterrupt)
167
{
168
    write_flags(IF);
169
 
170
    set_instruction({0xfb});
171
 
172
    emulate();
173
 
174
    ASSERT_PRED_FORMAT2(AssertFlagsEqual, read_flags(), FLAGS_STUCK_BITS | IF);
175
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.