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

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [inc.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
// Multiplexed inc/dec
19
.at 0xfe;
20
    width W8, modrm_start, mar_write, mar_wr_sel EA,
21
        jmp_dispatch_reg dispatch_fe;
22
.auto_address;
23
dispatch_fe:
24
    width W8, ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem inc_fe_reg; // reg == 0
25
    width W8, ra_modrm_rm_reg, segment DS, jmp_rm_reg_mem dec_fe_reg; // reg == 1
26
    next_instruction; // reg == 2
27
    next_instruction; // reg == 3
28
    next_instruction; // reg == 4
29
    next_instruction; // reg == 5
30
    next_instruction; // reg == 6
31
    jmp invalid_opcode; // reg == 7
32
 
33
inc_fe_reg:
34
    a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op ADD,
35
        rd_sel_source MODRM_RM_REG, update_flags OF SF ZF AF PF,
36
        width WAUTO, next_instruction;
37
inc_fe_mem:
38
    width WAUTO, segment DS, mem_read;
39
    a_sel MDR, b_sel IMMEDIATE, immediate 0x1, alu_op ADD,
40
        mdr_write, update_flags OF SF ZF AF PF, width WAUTO, segment DS,
41
        jmp write_complete;
42
 
43
dec_fe_reg:
44
    a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
45
        rd_sel_source MODRM_RM_REG, update_flags OF SF ZF AF PF,
46
        width WAUTO, next_instruction;
47
dec_fe_mem:
48
    width WAUTO, segment DS, mem_read;
49
    a_sel MDR, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
50
        mdr_write, update_flags OF SF ZF AF PF, width WAUTO, segment DS,
51
        jmp write_complete;
52
 
53
#define INC_REG(opcode, reg)                                            \
54
.at opcode;                                                             \
55
    ra_sel reg, jmp inc ## reg;                                         \
56
inc ## reg:                                                             \
57
    a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op ADD,               \
58
        rd_sel_source MICROCODE_RD_SEL, rd_sel reg,          \
59
        update_flags OF SF ZF AF PF, next_instruction;
60
 
61
#define DEC_REG(opcode, reg)                                            \
62
.at opcode;                                                             \
63
    ra_sel reg, jmp dec ## reg;                                         \
64
dec ## reg:                                                             \
65
    a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,               \
66
        rd_sel_source MICROCODE_RD_SEL, rd_sel reg,          \
67
        update_flags OF SF ZF AF PF, next_instruction;
68
 
69
INC_REG(0x40, AX)
70
INC_REG(0x41, CX)
71
INC_REG(0x42, DX)
72
INC_REG(0x43, BX)
73
INC_REG(0x44, SP)
74
INC_REG(0x45, BP)
75
INC_REG(0x46, SI)
76
INC_REG(0x47, DI)
77
 
78
DEC_REG(0x48, AX)
79
DEC_REG(0x49, CX)
80
DEC_REG(0x4a, DX)
81
DEC_REG(0x4b, BX)
82
DEC_REG(0x4c, SP)
83
DEC_REG(0x4d, BP)
84
DEC_REG(0x4e, SI)
85
DEC_REG(0x4f, DI)

powered by: WebSVN 2.1.0

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