Files
86Box/src/cpu/x86_ops_io.h

143 lines
3.0 KiB
C
Raw Normal View History

2022-11-19 10:40:32 -05:00
static int
opIN_AL_imm(uint32_t fetchdat)
2022-02-20 02:26:27 -05:00
{
2022-11-19 10:40:32 -05:00
uint16_t port = (uint16_t) getbytef();
check_io_perm(port, 1);
2022-11-19 10:40:32 -05:00
AL = inb(port);
CLOCK_CYCLES(12);
PREFETCH_RUN(12, 2, -1, 1, 0, 0, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
opIN_AX_imm(uint32_t fetchdat)
{
2022-11-19 10:40:32 -05:00
uint16_t port = (uint16_t) getbytef();
check_io_perm(port, 2);
2022-11-19 10:40:32 -05:00
AX = inw(port);
CLOCK_CYCLES(12);
PREFETCH_RUN(12, 2, -1, 1, 0, 0, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
opIN_EAX_imm(uint32_t fetchdat)
{
2022-11-19 10:40:32 -05:00
uint16_t port = (uint16_t) getbytef();
check_io_perm(port, 4);
2022-11-19 10:40:32 -05:00
EAX = inl(port);
CLOCK_CYCLES(12);
PREFETCH_RUN(12, 2, -1, 0, 1, 0, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
opOUT_AL_imm(uint32_t fetchdat)
{
2022-11-19 10:40:32 -05:00
uint16_t port = (uint16_t) getbytef();
check_io_perm(port, 1);
2022-11-19 10:40:32 -05:00
outb(port, AL);
CLOCK_CYCLES(10);
PREFETCH_RUN(10, 2, -1, 0, 0, 1, 0, 0);
if (port == 0x64)
return x86_was_reset;
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
opOUT_AX_imm(uint32_t fetchdat)
{
2022-11-19 10:40:32 -05:00
uint16_t port = (uint16_t) getbytef();
check_io_perm(port, 2);
2022-11-19 10:40:32 -05:00
outw(port, AX);
CLOCK_CYCLES(10);
PREFETCH_RUN(10, 2, -1, 0, 0, 1, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
opOUT_EAX_imm(uint32_t fetchdat)
{
2022-11-19 10:40:32 -05:00
uint16_t port = (uint16_t) getbytef();
check_io_perm(port, 4);
2022-11-19 10:40:32 -05:00
outl(port, EAX);
CLOCK_CYCLES(10);
PREFETCH_RUN(10, 2, -1, 0, 0, 0, 1, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
2025-01-26 15:15:53 -05:00
opIN_AL_DX(UNUSED(uint32_t fetchdat))
2022-02-20 02:26:27 -05:00
{
check_io_perm(DX, 1);
2022-11-19 10:40:32 -05:00
AL = inb(DX);
CLOCK_CYCLES(12);
PREFETCH_RUN(12, 1, -1, 1, 0, 0, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
2025-01-26 15:15:53 -05:00
opIN_AX_DX(UNUSED(uint32_t fetchdat))
{
check_io_perm(DX, 2);
2022-11-19 10:40:32 -05:00
AX = inw(DX);
CLOCK_CYCLES(12);
PREFETCH_RUN(12, 1, -1, 1, 0, 0, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
2025-01-26 15:15:53 -05:00
opIN_EAX_DX(UNUSED(uint32_t fetchdat))
{
check_io_perm(DX, 4);
2022-11-19 10:40:32 -05:00
EAX = inl(DX);
CLOCK_CYCLES(12);
PREFETCH_RUN(12, 1, -1, 0, 1, 0, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
2025-01-26 15:15:53 -05:00
opOUT_AL_DX(UNUSED(uint32_t fetchdat))
{
check_io_perm(DX, 1);
2022-11-19 10:40:32 -05:00
outb(DX, AL);
CLOCK_CYCLES(11);
PREFETCH_RUN(11, 1, -1, 0, 0, 1, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return x86_was_reset;
}
2022-11-19 10:40:32 -05:00
static int
2025-01-26 15:15:53 -05:00
opOUT_AX_DX(UNUSED(uint32_t fetchdat))
{
check_io_perm(DX, 2);
2022-11-19 10:40:32 -05:00
outw(DX, AX);
CLOCK_CYCLES(11);
PREFETCH_RUN(11, 1, -1, 0, 0, 1, 0, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}
2022-11-19 10:40:32 -05:00
static int
2025-01-26 15:15:53 -05:00
opOUT_EAX_DX(UNUSED(uint32_t fetchdat))
{
check_io_perm(DX, 4);
2022-11-19 10:40:32 -05:00
outl(DX, EAX);
PREFETCH_RUN(11, 1, -1, 0, 0, 0, 1, 0);
if (nmi && nmi_enable && nmi_mask)
return 1;
return 0;
}