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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [mov.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
// MOV 0x88     r/m := r (8-bit)
19
.at 0x88;
20
    modrm_start, mar_write, mar_wr_sel EA, width W8,
21
        jmp_rm_reg_mem mov88_reg;
22
// MOV 0x89     r/m := r (16-bit)
23
.at 0x89;
24
    modrm_start, mar_write, mar_wr_sel EA,
25
        jmp_rm_reg_mem mov88_reg;
26
.auto_address;
27
mov88_reg:
28
    b_sel RB, alu_op SELB, rd_sel_source MODRM_RM_REG,
29
        width WAUTO, next_instruction;
30
mov88_mem:
31
    b_sel RB, alu_op SELB, mdr_write, segment DS, jmp write_complete;
32
 
33
// MOV 0x8a     r := r/m (8-bit)
34
.at 0x8a;
35
    modrm_start, mar_write, mar_wr_sel EA, ra_modrm_rm_reg, width W8,
36
        jmp_rm_reg_mem mov8a_reg, segment DS, a_sel RA;
37
// MOV 0x8b     r := r/m (16-bit)
38
.at 0x8b;
39
    modrm_start, mar_write, mar_wr_sel EA, ra_modrm_rm_reg,
40
        jmp_rm_reg_mem mov8a_reg, a_sel RA, segment DS;
41
.auto_address;
42
mov8a_reg:
43
    a_sel RA, ra_modrm_rm_reg, alu_op SELA,
44
        rd_sel_source MODRM_REG, width WAUTO,
45
        next_instruction;
46
mov8a_mem:
47
    mem_read, width WAUTO, segment DS;
48
    rd_sel_source MODRM_REG, a_sel MDR, alu_op SELA, width WAUTO,
49
        next_instruction;
50
 
51
// MOV 0xc6     r/m := immed8
52
.at 0xc6;
53
    modrm_start, mar_write, mar_wr_sel EA, jmp_dispatch_reg c6_dispatch;
54
// MOV 0xc7     r/m := immed16
55
.at 0xc7;
56
    modrm_start, mar_write, mar_wr_sel EA, jmp_dispatch_reg c6_dispatch;
57
.auto_address;
58
c6_dispatch:
59
    read_immed, width WAUTO, jmp_rm_reg_mem movc6_reg; // reg == 0
60
    next_instruction; // reg == 1
61
    next_instruction; // reg == 2
62
    next_instruction; // reg == 3
63
    next_instruction; // reg == 4
64
    next_instruction; // reg == 5
65
    next_instruction; // reg == 6
66
    next_instruction; // reg == 7
67
movc6_reg:
68
    b_sel IMMEDIATE, alu_op SELB,
69
        rd_sel_source MODRM_RM_REG, width WAUTO,
70
        next_instruction;
71
movc6_mem:
72
    b_sel IMMEDIATE, alu_op SELB, mdr_write, segment DS, jmp write_complete;
73
 
74
#define MOV_REG_IMMED8(opcode, reg) \
75
    .at opcode; \
76
        read_immed, width W8, jmp mov_ ## reg ## _immed8; \
77
    .auto_address; \
78
    mov_ ## reg ## _immed8: \
79
        rd_sel_source MICROCODE_RD_SEL, rd_sel reg, \
80
            alu_op SELB, b_sel IMMEDIATE, width W8, next_instruction;
81
 
82
MOV_REG_IMMED8(0xb0, AL)
83
MOV_REG_IMMED8(0xb1, CL)
84
MOV_REG_IMMED8(0xb2, DL)
85
MOV_REG_IMMED8(0xb3, BL)
86
MOV_REG_IMMED8(0xb4, AH)
87
MOV_REG_IMMED8(0xb5, CH)
88
MOV_REG_IMMED8(0xb6, DH)
89
MOV_REG_IMMED8(0xb7, BH)
90
 
91
#define MOV_REG_IMMED16(opcode, reg) \
92
    .at opcode; \
93
        read_immed, jmp mov_ ## reg ## _immed16; \
94
    .auto_address; \
95
    mov_ ## reg ## _immed16: \
96
        rd_sel_source MICROCODE_RD_SEL, rd_sel reg, \
97
            alu_op SELB, b_sel IMMEDIATE, next_instruction;
98
 
99
MOV_REG_IMMED16(0xb8, AX)
100
MOV_REG_IMMED16(0xb9, CX)
101
MOV_REG_IMMED16(0xba, DX)
102
MOV_REG_IMMED16(0xbb, BX)
103
MOV_REG_IMMED16(0xbc, SP)
104
MOV_REG_IMMED16(0xbd, BP)
105
MOV_REG_IMMED16(0xbe, SI)
106
MOV_REG_IMMED16(0xbf, DI)
107
 
108
// MOV 0xa0     al := m[immed16]
109
.at 0xa0;
110
    read_immed, mar_write, mar_wr_sel Q, b_sel IMMEDIATE,
111
        alu_op SELB, jmp mova0, segment DS;
112
// MOV 0xa1     ax := m[immed16]
113
.at 0xa1;
114
    read_immed, mar_write, mar_wr_sel Q, b_sel IMMEDIATE,
115
        alu_op SELB, jmp mova0, segment DS;
116
.auto_address;
117
mova0:
118
    segment DS, width WAUTO, mem_read;
119
    rd_sel_source MICROCODE_RD_SEL, rd_sel AL, width WAUTO,
120
        a_sel MDR, alu_op SELA, next_instruction;
121
 
122
// MOV 0xa2     m[immed16] := al
123
.at 0xa2;
124
    read_immed, mar_write, mar_wr_sel Q, b_sel IMMEDIATE,
125
        alu_op SELB, jmp mova2, ra_sel AL;
126
.at 0xa3;
127
    read_immed, mar_write, mar_wr_sel Q, b_sel IMMEDIATE,
128
        alu_op SELB, jmp mova2, ra_sel AL;
129
.auto_address;
130
mova2:
131
    a_sel RA, alu_op SELA, mdr_write, segment DS, jmp write_complete;
132
 
133
// MOV 0x8e     sr := reg/mem
134
.at 0x8e;
135
    modrm_start, mar_write, mar_wr_sel EA, ra_modrm_rm_reg,
136
        jmp_dispatch_reg dispatch_8e;
137
.auto_address;
138
dispatch_8e:
139
    ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem mov8e_reg;
140
    ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem mov8e_reg;
141
    ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem mov8e_reg;
142
    ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem mov8e_reg;
143
    ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem mov8e_reg;
144
    ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem mov8e_reg;
145
    ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem mov8e_reg;
146
    ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem mov8e_reg;
147
mov8e_reg:
148
    segment_wr_en, rd_sel_source MODRM_REG, a_sel RA, alu_op SELA,
149
        ext_int_inhibit, next_instruction;
150
mov8e_mem:
151
    segment DS, mem_read;
152
    rd_sel_source MODRM_REG, segment_wr_en, a_sel MDR, alu_op SELA,
153
        ext_int_inhibit, next_instruction;
154
 
155
// MOV 0x8c     reg/mem := sr
156
.at 0x8c;
157
    modrm_start, mar_write, mar_wr_sel EA, jmp_dispatch_reg dispatch_8c;
158
.auto_address;
159
dispatch_8c:
160
    segment_force, segment ES, jmp_rm_reg_mem mov8c_reg;
161
    segment_force, segment CS, jmp_rm_reg_mem mov8c_reg;
162
    segment_force, segment SS, jmp_rm_reg_mem mov8c_reg;
163
    segment_force, segment DS, jmp_rm_reg_mem mov8c_reg;
164
    segment_force, segment ES, jmp_rm_reg_mem mov8c_reg;
165
    segment_force, segment CS, jmp_rm_reg_mem mov8c_reg;
166
    segment_force, segment SS, jmp_rm_reg_mem mov8c_reg;
167
    segment_force, segment DS, jmp_rm_reg_mem mov8c_reg;
168
mov8c_reg:
169
    rd_sel_source MODRM_RM_REG, b_sel SR, alu_op SELB,
170
        next_instruction;
171
mov8c_mem:
172
    b_sel SR, alu_op SELB, mdr_write, segment DS, jmp write_16_complete;

powered by: WebSVN 2.1.0

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