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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [push.us] - 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 .
17
 
18
pushff_reg:
19
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
20
        rd_sel_source MICROCODE_RD_SEL, mar_write, mar_wr_sel Q,
21
        jmp pushff_reg_save, ra_modrm_rm_reg, segment DS;
22
pushff_mem:
23
    segment DS, mem_read, jmp pushff_mem_save, ra_sel SP;
24
pushff_reg_save:
25
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
26
    segment_force, segment SS, mem_write, a_sel MAR, next_instruction;
27
pushff_mem_save:
28
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
29
        rd_sel_source MICROCODE_RD_SEL, mar_write, mar_wr_sel Q,
30
        segment_force, segment SS;
31
    segment_force, segment SS, mem_write, a_sel MAR, alu_op SELA,
32
        next_instruction;
33
 
34
#define PUSH_GPR(opcode, reg)                                           \
35
.at opcode;                                                             \
36
    ra_sel reg, jmp push_gpr;
37
 
38
#define PUSH_SR(opcode, reg)                                            \
39
.at opcode;                                                             \
40
    segment_force, segment reg, jmp push_sr;
41
 
42
PUSH_SR(0x06, ES)
43
PUSH_SR(0x0e, CS)
44
PUSH_SR(0x16, SS)
45
PUSH_SR(0x1e, DS)
46
 
47
PUSH_GPR(0x50, AX)
48
PUSH_GPR(0x51, CX)
49
PUSH_GPR(0x52, DX)
50
PUSH_GPR(0x53, BX)
51
PUSH_GPR(0x55, BP)
52
PUSH_GPR(0x56, SI)
53
PUSH_GPR(0x57, DI)
54
 
55
.auto_address;
56
push_gpr:
57
    a_sel RA, alu_op SELA, mdr_write, ra_sel SP;
58
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
59
        mar_write, mar_wr_sel Q, segment_force, segment SS;
60
    segment_force, segment SS, mem_write, a_sel MAR, rd_sel SP,
61
        rd_sel_source MICROCODE_RD_SEL, next_instruction;
62
 
63
// push SP, emulate broken 8086 behaviour: the decremented value gets pushed
64
// rather than the original value
65
.at 0x54;
66
    ra_sel SP, jmp push_sp;
67
.auto_address;
68
push_sp:
69
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
70
        mar_write, mar_wr_sel Q, mdr_write, segment_force, segment SS;
71
    segment_force, segment SS, mem_write, a_sel MAR, rd_sel SP,
72
        rd_sel_source MICROCODE_RD_SEL, next_instruction;
73
 
74
push_sr:
75
    b_sel SR, alu_op SELB, mdr_write, ra_sel SP;
76
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
77
        mar_write, mar_wr_sel Q, segment_force, segment SS;
78
    segment_force, segment SS, mem_write, a_sel MAR, rd_sel SP,
79
        rd_sel_source MICROCODE_RD_SEL, next_instruction;
80
 
81
.at 0x68;
82
    read_immed, ra_sel SP, jmp push_immed16;
83
.auto_address;
84
push_immed16:
85
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, mar_write,
86
        mar_wr_sel Q, rd_sel SP, rd_sel_source MICROCODE_RD_SEL;
87
    b_sel IMMEDIATE, alu_op SELB, mdr_write, segment_force, segment SS;
88
    segment_force, segment SS, mem_write, next_instruction;
89
 
90
.at 0x6a;
91
    width W8, read_immed, jmp push_immed8;
92
.auto_address;
93
push_immed8:
94
    ra_sel SP;
95
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, mar_write,
96
        mar_wr_sel Q, rd_sel SP, rd_sel_source MICROCODE_RD_SEL;
97
    b_sel IMMEDIATE, alu_op SELB, mdr_write, segment_force, segment SS;
98
    segment_force, segment SS, mem_write, next_instruction;
99
 
100
.at 0x9c;
101
    alu_op GETFLAGS, mdr_write, ra_sel SP, jmp pushf;
102
.auto_address;
103
pushf:
104
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
105
        mar_wr_sel Q, mar_write, segment_force, segment SS,
106
        rd_sel SP, rd_sel_source MICROCODE_RD_SEL;
107
    segment_force, segment SS, mem_write, next_instruction;
108
 
109
.at 0x60;
110
    ra_sel SP, jmp pusha;
111
.auto_address;
112
pusha:
113
    a_sel RA, ra_sel AX, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
114
        mar_write, mar_wr_sel Q;
115
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
116
    segment_force, segment SS, mem_write,
117
        ra_sel CX, a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
118
        mar_wr_sel Q, mar_write;
119
 
120
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
121
    segment_force, segment SS, mem_write,
122
        ra_sel DX, a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
123
        mar_wr_sel Q, mar_write;
124
 
125
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
126
    segment_force, segment SS, mem_write,
127
        ra_sel BX, a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
128
        mar_wr_sel Q, mar_write;
129
 
130
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
131
    segment_force, segment SS, mem_write,
132
        ra_sel SP, a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
133
        mar_wr_sel Q, mar_write;
134
 
135
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
136
    segment_force, segment SS, mem_write,
137
        ra_sel BP, a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
138
        mar_wr_sel Q, mar_write;
139
 
140
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
141
    segment_force, segment SS, mem_write,
142
        ra_sel SI, a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
143
        mar_wr_sel Q, mar_write;
144
 
145
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
146
    segment_force, segment SS, mem_write,
147
        ra_sel DI, a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op SUB,
148
        mar_wr_sel Q, mar_write;
149
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
150
    segment_force, segment SS, mem_write,
151
        rd_sel_source MICROCODE_RD_SEL, rd_sel SP, a_sel MAR, alu_op SELA,
152
        next_instruction;
153
 
154
.at 0x61;
155
    ra_sel SP, jmp popa;
156
.auto_address;
157
popa:
158
    a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, segment_force,
159
        segment SS;
160
 
161
    segment_force, segment SS, mem_read,
162
        rd_sel_source MICROCODE_RD_SEL, rd_sel DI, a_sel MDR;
163
    a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD, mar_wr_sel Q,
164
        mar_write, segment_force, segment SS;
165
 
166
    segment_force, segment SS, mem_read,
167
        rd_sel_source MICROCODE_RD_SEL, rd_sel SI, a_sel MDR;
168
    a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD, mar_wr_sel Q,
169
        mar_write, segment_force, segment SS;
170
 
171
    segment_force, segment SS, mem_read,
172
    // Skip over SP
173
        rd_sel_source MICROCODE_RD_SEL, rd_sel BP, a_sel MDR;
174
    a_sel MAR, b_sel IMMEDIATE, immediate 0x4, alu_op ADD, mar_wr_sel Q,
175
        mar_write, segment_force, segment SS;
176
 
177
    segment_force, segment SS, mem_read,
178
        rd_sel_source MICROCODE_RD_SEL, rd_sel BX, a_sel MDR;
179
    a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD, mar_wr_sel Q,
180
        mar_write, segment_force, segment SS;
181
 
182
    segment_force, segment SS, mem_read,
183
        rd_sel_source MICROCODE_RD_SEL, rd_sel DX, a_sel MDR;
184
    a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD, mar_wr_sel Q,
185
        mar_write, segment_force, segment SS;
186
 
187
    segment_force, segment SS, mem_read,
188
        rd_sel_source MICROCODE_RD_SEL, rd_sel CX, a_sel MDR;
189
    a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD, mar_wr_sel Q,
190
        mar_write, segment_force, segment SS;
191
 
192
    segment_force, segment SS, mem_read,
193
        rd_sel_source MICROCODE_RD_SEL, rd_sel AX, a_sel MDR;
194
    a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
195
        rd_sel_source MICROCODE_RD_SEL, rd_sel SP, next_instruction;

powered by: WebSVN 2.1.0

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