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 .
|
17 |
|
|
|
18 |
|
|
.at 0xc3;
|
19 |
|
|
ra_sel SP, jmp retc3;
|
20 |
|
|
.auto_address;
|
21 |
|
|
retc3:
|
22 |
|
|
a_sel RA, alu_op SELA, mar_write, mar_wr_sel Q, segment SS,
|
23 |
|
|
segment_force;
|
24 |
|
|
segment SS, segment_force, mem_read;
|
25 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
26 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SP;
|
27 |
|
|
a_sel MDR, alu_op SELA, load_ip, next_instruction;
|
28 |
|
|
|
29 |
|
|
.at 0xc2;
|
30 |
|
|
ra_sel SP, jmp retc2;
|
31 |
|
|
.auto_address;
|
32 |
|
|
retc2:
|
33 |
|
|
a_sel RA, alu_op SELA, mar_write, mar_wr_sel Q, segment SS,
|
34 |
|
|
segment_force;
|
35 |
|
|
segment SS, segment_force, mem_read;
|
36 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
37 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SP;
|
38 |
|
|
a_sel MDR, alu_op SELA, load_ip, read_immed, ra_sel SP;
|
39 |
|
|
a_sel RA, b_sel IMMEDIATE, alu_op ADD, rd_sel_source
|
40 |
|
|
MICROCODE_RD_SEL, rd_sel SP, next_instruction;
|
41 |
|
|
|
42 |
|
|
.at 0xcb;
|
43 |
|
|
ra_sel SP, jmp retcb;
|
44 |
|
|
.auto_address;
|
45 |
|
|
retcb:
|
46 |
|
|
a_sel RA, alu_op SELA, mar_write, mar_wr_sel Q, segment SS,
|
47 |
|
|
segment_force;
|
48 |
|
|
segment SS, segment_force, mem_read;
|
49 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
50 |
|
|
mar_wr_sel Q, mar_write;
|
51 |
|
|
a_sel MDR, alu_op SELA, load_ip, segment_force, segment SS;
|
52 |
|
|
segment SS, segment_force, mem_read;
|
53 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
54 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SP;
|
55 |
|
|
a_sel MDR, alu_op SELA, segment_force, segment CS,
|
56 |
|
|
segment_wr_en, next_instruction;
|
57 |
|
|
|
58 |
|
|
.at 0xca;
|
59 |
|
|
ra_sel SP, jmp retca;
|
60 |
|
|
.auto_address;
|
61 |
|
|
retca:
|
62 |
|
|
a_sel RA, alu_op SELA, mar_write, mar_wr_sel Q, segment SS,
|
63 |
|
|
segment_force;
|
64 |
|
|
segment SS, segment_force, mem_read;
|
65 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
66 |
|
|
mar_wr_sel Q, mar_write;
|
67 |
|
|
a_sel MDR, alu_op SELA, load_ip, segment_force, segment SS;
|
68 |
|
|
segment SS, segment_force, mem_read;
|
69 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
70 |
|
|
mar_wr_sel Q, mar_write;
|
71 |
|
|
read_immed, a_sel MAR, b_sel IMMEDIATE, alu_op ADD,
|
72 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SP;
|
73 |
|
|
a_sel MDR, alu_op SELA, segment_force, segment CS,
|
74 |
|
|
segment_wr_en, next_instruction;
|
75 |
|
|
|
76 |
|
|
// iret
|
77 |
|
|
.at 0xcf;
|
78 |
|
|
ra_sel SP, jmp retcf;
|
79 |
|
|
.auto_address;
|
80 |
|
|
retcf:
|
81 |
|
|
a_sel RA, alu_op SELA, mar_write, mar_wr_sel Q, segment SS,
|
82 |
|
|
segment_force;
|
83 |
|
|
segment SS, segment_force, mem_read;
|
84 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
85 |
|
|
mar_wr_sel Q, mar_write;
|
86 |
|
|
a_sel MDR, alu_op SELA, load_ip, segment_force, segment SS;
|
87 |
|
|
segment SS, segment_force, mem_read;
|
88 |
|
|
a_sel MDR, alu_op SELA, segment_force, segment CS,
|
89 |
|
|
segment_wr_en;
|
90 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
91 |
|
|
mar_wr_sel Q, mar_write, segment SS, segment_force;
|
92 |
|
|
segment SS, segment_force, mem_read;
|
93 |
|
|
a_sel MDR, alu_op SETFLAGSA, update_flags CF PF AF ZF SF TF IF DF OF;
|
94 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
95 |
|
|
rd_sel SP, rd_sel_source MICROCODE_RD_SEL,
|
96 |
|
|
next_instruction;
|