Files
86Box-fork/src/intel.c
OBattler b78b2fecaa Timer counters now 64-bit;
Cleaned up floppy code a lot and reverted to single poller;
Fixed segment present bit and limit checking at read/write within segment;
The ASUS boards now have memregs too;
RTC code improved based on suggestion by Sarah Walker;
Fixed SVGA odd/even emulation and added chain odd/even support;
Removed non-existent CPU's.
2016-07-19 02:44:32 +02:00

82 lines
2.0 KiB
C

#include "ibm.h"
#include "cpu.h"
#include "io.h"
#include "mem.h"
#include "pit.h"
#include "timer.h"
#include "intel.h"
uint8_t batman_brdconfig(uint16_t port, void *p)
{
// pclog("batman_brdconfig read port=%04x\n", port);
switch (port)
{
case 0x73:
return 0xff;
case 0x75:
return 0xdf;
}
return 0;
}
static uint16_t batman_timer_latch;
static int64_t batman_timer = 0;
static void batman_timer_over(void *p)
{
batman_timer = 0;
}
static void batman_timer_write(uint16_t addr, uint8_t val, void *p)
{
if (addr & 1)
batman_timer_latch = (batman_timer_latch & 0xff) | (val << 8);
else
batman_timer_latch = (batman_timer_latch & 0xff00) | val;
batman_timer = batman_timer_latch * TIMER_USEC;
}
static uint8_t batman_timer_read(uint16_t addr, void *p)
{
uint16_t batman_timer_latch;
cycles -= (int)PITCONST;
timer_clock();
if (batman_timer < 0)
return 0;
batman_timer_latch = batman_timer / TIMER_USEC;
if (addr & 1)
return batman_timer_latch >> 8;
return batman_timer_latch & 0xff;
}
void intel_batman_init()
{
io_sethandler(0x0073, 0x0001, batman_brdconfig, NULL, NULL, NULL, NULL, NULL, NULL);
io_sethandler(0x0075, 0x0001, batman_brdconfig, NULL, NULL, NULL, NULL, NULL, NULL);
io_sethandler(0x0078, 0x0002, batman_timer_read, NULL, NULL, batman_timer_write, NULL, NULL, NULL);
timer_add(batman_timer_over, &batman_timer, &batman_timer, NULL);
}
uint8_t endeavor_brdconfig(uint16_t port, void *p)
{
// pclog("endeavor_brdconfig read port=%04x\n", port);
switch (port)
{
case 0x79:
return 0xff;
}
return 0;
}
void intel_endeavor_init()
{
io_sethandler(0x0079, 0x0001, endeavor_brdconfig, NULL, NULL, NULL, NULL, NULL, NULL);
}