Files
86Box/src/jim.c
OBattler f6ef1f833c Vastly overhauled the UI, there's now a completely new Settings dialog as well as a status bar with disk activity icons and removable drive menus;
Thoroughly clean up the code to vastly reduce the number of compiler warnings and found and fixed several bugs in the process;
Applied all mainline PCem commits;
Added SCSI hard disk emulation;
Commented out all unfinished machines and graphics cards;
Added the AOpen AP53 and ASUS P/I-P55T2 machines as well as another Tyan 440FX machine, all three with AMI WinBIOS (patch from TheCollector1995);
Added the Diamond Stealth 3D 3000 (S3 ViRGE/VX) graphics card (patch from TheCollector1995);
Added the PS/2 XT IDE (AccuLogic) HDD Controller (patch from TheCollector1995);
Added Microsoft/Logitech Bus Mouse emulation (patch from waltje);
Overhauled the makefiles (patch from waltje);
Added the Adaptec AHA-1542CF SCSI controller (patch from waltje);
Added preliminary (but still unfinished) Adaptec AHA-154x SCSI controller BIOS support (patch from waltje);
Added an ISABugger debugging device (patch from waltje);
Added sanity checks to the Direct3D code.
2017-05-05 01:49:42 +02:00

79 lines
2.3 KiB
C

/* Copyright holders: Sarah Walker
see COPYING for more details
*/
#include <stdio.h>
#include <string.h>
#include "ibm.h"
#include "io.h"
uint8_t europcdat[16];
struct
{
uint8_t dat[16];
int stat;
int addr;
} europc_rtc;
void writejim(uint16_t addr, uint8_t val, void *p)
{
if ((addr&0xFF0)==0x250) europcdat[addr&0xF]=val;
switch (addr)
{
case 0x25A:
switch (europc_rtc.stat)
{
case 0:
europc_rtc.addr=val&0xF;
europc_rtc.stat++;
break;
case 1:
europc_rtc.dat[europc_rtc.addr]=(europc_rtc.dat[europc_rtc.addr]&0xF)|(val<<4);
europc_rtc.stat++;
break;
case 2:
europc_rtc.dat[europc_rtc.addr]=(europc_rtc.dat[europc_rtc.addr]&0xF0)|(val&0xF);
europc_rtc.stat=0;
break;
}
break;
}
}
uint8_t readjim(uint16_t addr, void *p)
{
switch (addr)
{
case 0x250: case 0x251: case 0x252: case 0x253: return 0;
case 0x254: case 0x255: case 0x256: case 0x257: return europcdat[addr&0xF];
case 0x25A:
if (europc_rtc.stat==1)
{
europc_rtc.stat=2;
return europc_rtc.dat[europc_rtc.addr]>>4;
}
if (europc_rtc.stat==2)
{
europc_rtc.stat=0;
return europc_rtc.dat[europc_rtc.addr]&0xF;
}
return 0;
}
return 0;
}
void jim_init()
{
uint8_t viddat;
memset(europc_rtc.dat,0,16);
europc_rtc.dat[0xF]=1;
europc_rtc.dat[3]=1;
europc_rtc.dat[4]=1;
europc_rtc.dat[5]=0x88;
if (gfxcard==GFX_CGA || gfxcard == GFX_COLORPLUS) viddat=0x12;
else if (gfxcard==GFX_MDA || gfxcard==GFX_HERCULES || gfxcard==GFX_INCOLOR) viddat=3;
else viddat=0x10;
europc_rtc.dat[0xB]=viddat;
europc_rtc.dat[0xD]=viddat; /*Checksum*/
io_sethandler(0x250, 0x10, readjim, NULL, NULL, writejim, NULL, NULL, NULL);
}