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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [sim/] [cppmodel/] [instructions/] [int.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
void EmulatorPimpl::intcc()
19
{
20
    auto flags = registers->get_flags();
21
 
22
    push_word(flags);
23
    push_word(registers->get(CS));
24
    push_word(registers->get(IP) + instr_length);
25
 
26
    flags &= ~(IF | TF);
27
    registers->set_flags(flags, IF | TF);
28
 
29
    // int 3
30
    auto new_cs = mem->read<uint16_t>(VEC_INT + 2);
31
    auto new_ip = mem->read<uint16_t>(VEC_INT + 0);
32
 
33
    registers->set(CS, new_cs);
34
    registers->set(IP, new_ip);
35
    jump_taken = true;
36
}
37
 
38
void EmulatorPimpl::intcd()
39
{
40
    auto flags = registers->get_flags();
41
    auto int_num = fetch_byte();
42
 
43
    push_word(flags);
44
    push_word(registers->get(CS));
45
    push_word(registers->get(IP) + instr_length);
46
 
47
    flags &= ~(IF | TF);
48
    registers->set_flags(flags, IF | TF);
49
 
50
    // int N
51
    auto new_cs = mem->read<uint16_t>(int_num * 4 + 2);
52
    auto new_ip = mem->read<uint16_t>(int_num * 4 + 0);
53
 
54
    registers->set(CS, new_cs);
55
    registers->set(IP, new_ip);
56
    jump_taken = true;
57
}
58
 
59
void EmulatorPimpl::intoce()
60
{
61
    auto flags = registers->get_flags();
62
    if (!(flags & OF))
63
        return;
64
 
65
    push_word(flags);
66
    push_word(registers->get(CS));
67
    push_word(registers->get(IP) + instr_length);
68
 
69
    flags &= ~(IF | TF);
70
    registers->set_flags(flags, IF | TF);
71
 
72
    // into
73
    auto new_cs = mem->read<uint16_t>(VEC_OVERFLOW + 2);
74
    auto new_ip = mem->read<uint16_t>(VEC_OVERFLOW + 0);
75
 
76
    registers->set(CS, new_cs);
77
    registers->set(IP, new_ip);
78
    jump_taken = true;
79
}

powered by: WebSVN 2.1.0

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