2
// Copyright (C) 2009 Parth Malwankar <parth.malwankar@gmail.com>
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
20
import org.scalatest.FunSuite
23
import nazgul.decoder._
24
import nazgul.decoder.argdata._
25
import nazgul.opcodes._
26
import nazgul.registers._
27
import nazgul.core.OperatingMode._
28
import nazgul.core.exceptions._
30
import nazgul.core.EFlags
32
class E16SAHFTest extends FunSuite {
35
val i = Common.decodeBytesAsInst(Mode16, 0x9e)
37
pc.core.ah = EFlags.SF_MASK.toByte
39
assert(pc.core.eflags.sf === false)
40
i.encodedOp.op.execute(pc, i)
41
assert(pc.core.eflags.sf === true)
46
val i = Common.decodeBytesAsInst(Mode16, 0x9e)
48
pc.core.ah = EFlags.ZF_MASK.toByte
50
assert(pc.core.eflags.zf === false)
51
i.encodedOp.op.execute(pc, i)
52
assert(pc.core.eflags.zf === true)
57
val i = Common.decodeBytesAsInst(Mode16, 0x9e)
59
pc.core.ah = EFlags.AF_MASK.toByte
61
assert(pc.core.eflags.af === false)
62
i.encodedOp.op.execute(pc, i)
63
assert(pc.core.eflags.af === true)
68
val i = Common.decodeBytesAsInst(Mode16, 0x9e)
70
pc.core.ah = EFlags.PF_MASK.toByte
72
assert(pc.core.eflags.pf === false)
73
i.encodedOp.op.execute(pc, i)
74
assert(pc.core.eflags.pf === true)
79
val i = Common.decodeBytesAsInst(Mode16, 0x9e)
81
pc.core.ah = EFlags.CF_MASK.toByte
83
assert(pc.core.eflags.cf === false)
84
i.encodedOp.op.execute(pc, i)
85
assert(pc.core.eflags.cf === true)