CD-ROM images are now working correctly again;

Fixed all the reported bugs regarding the Settings dialog;
MIDI out device is now no longer reset to 0 after hard reset;
Removed all vestiges of the old disk activity flash;
The configuration file is no longer saved when it shouldn't be;
Redone the status bar icon updating so it is only done in win.c;
Made sure all variables in ibm.h are extern;
A lot of other bugfixes;
Added Mouse Systems Mouse emulation (patch from TheCollector1995);
Added IBM PS/1 Model 2133 (486) emulation (patch from TheCollector1995);
Tweaked the CPU dynamic recompiler cycle periods - 486SX 33 and 486DX 33 now work;
Increased compatibility with configuration files from before the previous commit.
This commit is contained in:
OBattler
2017-05-29 01:18:32 +02:00
parent 84480b7347
commit fc2a293536
54 changed files with 740 additions and 372 deletions

View File

@@ -28,6 +28,13 @@ uint32_t oldpc2;
int trap;
uint16_t flags,eflags;
uint32_t oldds,oldss,olddslimit,oldsslimit,olddslimitw,oldsslimitw;
x86seg gdt,ldt,idt,tr;
x86seg _cs,_ds,_es,_ss,_fs,_gs;
x86seg _oldds;
extern int cpl_override;
@@ -40,6 +47,8 @@ uint16_t ea_rseg;
int is486;
int cgate32;
uint32_t cr2, cr3, cr4;
uint32_t dr[8];
uint8_t romext[32768];

View File

@@ -1280,6 +1280,39 @@ int dontprint=0;
#define CACHE_ON() (!(cr0 & (1 << 30)) /*&& (cr0 & 1)*/ && !(flags & T_FLAG))
static int cpu_cycle_period(void)
{
switch(cpu_pci_speed)
{
case 16000000:
return 800;
break;
case 20000000:
case 40000000:
return 1000;
break;
case 25000000:
default:
return 1000;
break;
case 27500000:
return 1100;
break;
case 30000000:
return 1200;
break;
case 333333333:
return 1333;
break;
case 37500000:
return 1500;
break;
case 41666667:
return 1041;
break;
}
}
static int cycles_main = 0;
void exec386_dynarec(int cycs)
{
@@ -1294,8 +1327,42 @@ void exec386_dynarec(int cycs)
while (cycles_main > 0)
{
int cycles_start;
cycles += 1000;
#if 0
switch(cpu_pci_speed)
{
case 16000000:
cycles += 640;
break;
case 20000000:
cycles += 800;
break;
case 25000000:
default:
cycles += 1000;
break;
case 27500000:
cycles += 1100;
break;
case 30000000:
cycles += 1200;
break;
case 333333333:
cycles += 1333;
break;
case 37500000:
cycles += 1500;
break;
case 40000000:
cycles += 1600;
break;
case 41666667:
cycles += 1666;
break;
}
#endif
cycles += cpu_cycle_period();
cycles_start = cycles;
timer_start_period(cycles << TIMER_SHIFT);

View File

@@ -75,12 +75,15 @@ int cpu_hasMMX, cpu_hasMSR;
int cpu_hasCR4;
int cpu_use_dynarec;
int hasfpu;
uint64_t cpu_CR4_mask;
int cpu_cycles_read, cpu_cycles_read_l, cpu_cycles_write, cpu_cycles_write_l;
int cpu_prefetch_cycles, cpu_prefetch_width;
int cpu_waitstates;
int cpu_cache_int_enabled, cpu_cache_ext_enabled;
int cpu_pci_speed;
int is286, is386;
int israpidcad, is_pentium;
@@ -405,7 +408,7 @@ CPU cpus_Cx486[] =
{"6x86MX-PR300", CPU_Cx6x86MX, 18, 233333333, 3, 33333333, 0x600, 0x600, 0x0454, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 21,21,7,7},
{"6x86MX-PR333", CPU_Cx6x86MX, 18, 250000000, 3, 41666667, 0x600, 0x600, 0x0453, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 20,20,9,9},
{"6x86MX-PR366", CPU_Cx6x86MX, 18, 250000000, 3, 33333333, 0x600, 0x600, 0x0452, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 24,24,12,12},
{"6x86MX-PR400", CPU_Cx6x86MX, 18, 285000000, 3, 31666667, 0x600, 0x600, 0x0453, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 18,18,9,9},
{"6x86MX-PR400", CPU_Cx6x86MX, 18, 285000000, 3, 41666667, 0x600, 0x600, 0x0453, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 18,18,9,9},
{"", -1, 0, 0, 0}
};
@@ -617,11 +620,6 @@ void cpu_set()
if (enable_external_fpu)
{
hasfpu = 1;
if (cpu_s->cpu_type == CPU_i486SX)
{
/* The 487SX is a full implementation of the 486DX and takes over the entire CPU's operation. */
cpu_s->cpu_type = CPU_i486DX;
}
}
}

View File

@@ -138,6 +138,7 @@ extern int cpu_cycles_read, cpu_cycles_read_l, cpu_cycles_write, cpu_cycles_writ
extern int cpu_prefetch_cycles, cpu_prefetch_width;
extern int cpu_waitstates;
extern int cpu_cache_int_enabled, cpu_cache_ext_enabled;
extern int cpu_pci_speed;
extern uint64_t tsc;

View File

@@ -8,6 +8,9 @@ int speaker_gated = 0;
int speaker_enable = 0, was_speaker_enable = 0;
int gated,speakval,speakon;
static int16_t speaker_buffer[SOUNDBUFLEN];
static int speaker_pos = 0;

View File

@@ -686,7 +686,6 @@ void ega_poll(void *p)
ega->video_bpp = (ega->gdcreg[5] & 0x20) ? 2 : 4;
}
readflash=0;
ega->firstline = 2000;
ega->lastline = 0;

View File

@@ -870,8 +870,6 @@ void svga_poll(void *p)
if (!svga->override)
svga_doblit(svga->firstline_draw, svga->lastline_draw + 1, wx, wy, svga);
readflash = 0;
svga->firstline = 2000;
svga->lastline = 0;

View File

@@ -43,10 +43,75 @@ int svga_display_line(svga_t *svga)
void svga_render_blank(svga_t *svga)
{
#if 0
int x, xx;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
uint32_t *p;
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
svga->lastline_draw = svga->displine;
if (dl >= 2046)
{
return;
}
for (x = 0; x < svga->hdisp; x++)
{
switch (svga->seqregs[1] & 9)
{
case 0:
for (xx = 0; xx < 9; xx++)
{
p = ((uint32_t *)buffer32->line[dl]);
if (&(p[(x * 9) + xx + 32 + x_add]) != NULL)
{
p[(x * 9) + xx + 32 + x_add] = svga_color_transform(0);
}
}
break;
case 1:
for (xx = 0; xx < 8; xx++)
{
p = ((uint32_t *)buffer32->line[dl]);
if (&(p[(x * 8) + xx + 32 + x_add]) != NULL)
{
p[(x * 8) + xx + 32 + x_add] = svga_color_transform(0);
}
}
break;
case 8:
for (xx = 0; xx < 18; xx++)
{
p = ((uint32_t *)buffer32->line[dl]);
if (&(p[(x * 18) + xx + 32 + x_add]) != NULL)
{
p[(x * 18) + xx + 32 + x_add] = svga_color_transform(0);
}
}
break;
case 9:
for (xx = 0; xx < 16; xx++)
{
p = ((uint32_t *)buffer32->line[dl]);
if (&(p[(x * 16) + xx + 32 + x_add]) != NULL)
{
p[(x * 16) + xx + 32 + x_add] = svga_color_transform(0);
}
}
break;
}
}
#endif
int x, xx;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -57,16 +122,16 @@ void svga_render_blank(svga_t *svga)
switch (svga->seqregs[1] & 9)
{
case 0:
for (xx = 0; xx < 9; xx++) ((uint32_t *)buffer32->line[dl])[(x * 9) + xx + 32 + x_add] = svga_color_transform(0);
for (xx = 0; xx < 9; xx++) ((uint32_t *)buffer32->line[svga->displine + y_add])[(x * 9) + xx + 32 + x_add] = svga_color_transform(0);
break;
case 1:
for (xx = 0; xx < 8; xx++) ((uint32_t *)buffer32->line[dl])[(x * 8) + xx + 32 + x_add] = svga_color_transform(0);
for (xx = 0; xx < 8; xx++) ((uint32_t *)buffer32->line[svga->displine + y_add])[(x * 8) + xx + 32 + x_add] = svga_color_transform(0);
break;
case 8:
for (xx = 0; xx < 18; xx++) ((uint32_t *)buffer32->line[dl])[(x * 18) + xx + 32 + x_add] = svga_color_transform(0);
for (xx = 0; xx < 18; xx++) ((uint32_t *)buffer32->line[svga->displine + y_add])[(x * 18) + xx + 32 + x_add] = svga_color_transform(0);
break;
case 9:
for (xx = 0; xx < 16; xx++) ((uint32_t *)buffer32->line[dl])[(x * 16) + xx + 32 + x_add] = svga_color_transform(0);
for (xx = 0; xx < 16; xx++) ((uint32_t *)buffer32->line[svga->displine + y_add])[(x * 16) + xx + 32 + x_add] = svga_color_transform(0);
break;
}
}

View File

@@ -199,8 +199,8 @@ uint8_t edatlookup[4][4];
int enable_overscan;
int overscan_x, overscan_y;
int force_43;
int enable_flash;
/*Video timing settings -

View File

@@ -81,10 +81,9 @@ extern void (*video_blit_memtoscreen_8_func)(int x, int y, int w, int h);
/* Enable EGA/(S)VGA overscan border. */
extern int enable_overscan;
extern int overscan_x, overscan_y;
/* Forcibly stretch emulated video output to 4:3 or not. */
extern int force_43;
/* Enable disk activity flash. */
extern int enable_flash;
extern int video_timing_b, video_timing_w, video_timing_l;
extern int video_speed;

View File

@@ -138,6 +138,7 @@ static int *sb_part_icons;
static WCHAR **sbTips;
static int sb_parts = 0;
static int sb_ready = 0;
void updatewindowsize(int x, int y)
@@ -311,6 +312,12 @@ void mainthread(LPVOID param)
winsizey + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1,
TRUE);
if (mousecapture)
{
GetWindowRect(ghwnd, &r);
ClipCursor(&r);
}
win_doresize = 0;
}
@@ -394,7 +401,7 @@ static void init_cdrom_host_drives(void)
for (i='A'; i<='Z'; i++)
{
_swprintf(s, L"%c:\\", i + 0x41);
_swprintf(s, L"%c:\\", i);
if (GetDriveType(s)==DRIVE_CDROM)
{
@@ -465,7 +472,7 @@ void create_cdrom_submenu(HMENU m, int id)
for (i = 0; i < 26; i++)
{
_swprintf(s, L"%c:\\", i + 0x41);
wsprintf(s, L"Host CD/DVD Drive (%c:)", i + 0x41);
if (host_cdrom_drive_available[i])
{
AppendMenu(m, MF_STRING, IDM_CDROM_HOST_DRIVE | (i << 3) | id, s);
@@ -475,21 +482,21 @@ void create_cdrom_submenu(HMENU m, int id)
check_menu_items:
if (!cdrom_drives[id].sound_on)
{
CheckMenuItem(smenu, IDM_CDROM_MUTE | id, MF_CHECKED);
CheckMenuItem(m, IDM_CDROM_MUTE | id, MF_CHECKED);
}
if (cdrom_drives[id].host_drive == 200)
{
CheckMenuItem(smenu, IDM_CDROM_IMAGE | id, MF_CHECKED);
CheckMenuItem(m, IDM_CDROM_IMAGE | id, MF_CHECKED);
}
else if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
{
CheckMenuItem(smenu, IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_CHECKED);
CheckMenuItem(m, IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
}
else
{
cdrom_drives[id].host_drive = 0;
CheckMenuItem(smenu, IDM_CDROM_EMPTY | id, MF_CHECKED);
CheckMenuItem(m, IDM_CDROM_EMPTY | id, MF_CHECKED);
}
}
@@ -667,7 +674,7 @@ int find_status_bar_part(int tag)
int i = 0;
int found = -1;
if (sb_part_meanings == NULL)
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL))
{
return -1;
}
@@ -690,7 +697,7 @@ void update_status_bar_icon(int tag, int active)
int found = -1;
int temp_flags = 0;
if (((tag & 0xf0) >= SB_TEXT) || (sb_icon_flags == NULL) || (sb_part_icons == NULL))
if (((tag & 0xf0) >= SB_TEXT) || !sb_ready || (sb_parts == 0) || (sb_icon_flags == NULL) || (sb_part_icons == NULL))
{
return;
}
@@ -719,7 +726,7 @@ void update_status_bar_icon_state(int tag, int state)
{
int found = -1;
if (((tag & 0xf0) >= SB_HDD) || (sb_icon_flags == NULL) || (sb_part_icons == NULL))
if (((tag & 0xf0) >= SB_HDD) || !sb_ready || (sb_parts == 0) || (sb_icon_flags == NULL) || (sb_part_icons == NULL))
{
return;
}
@@ -866,6 +873,11 @@ void update_tip(int meaning)
int i = 0;
int part = -1;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL))
{
return;
}
for (i = 0; i < sb_parts; i++)
{
if (sb_part_meanings[i] == meaning)
@@ -903,6 +915,11 @@ void status_settextw(wchar_t *wstr)
int i = 0;
int part = -1;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL))
{
return;
}
for (i = 0; i < sb_parts; i++)
{
if (sb_part_meanings[i] == SB_TEXT)
@@ -972,6 +989,8 @@ void update_status_bar_panes(HWND hwnds)
int c_ide_dma = 0;
int c_scsi = 0;
sb_ready = 0;
c_mfm = count_hard_disks(HDD_BUS_MFM);
c_rll = count_hard_disks(HDD_BUS_RLL);
c_xtide = count_hard_disks(HDD_BUS_XTIDE);
@@ -1011,7 +1030,7 @@ void update_status_bar_panes(HWND hwnds)
sb_parts++;
}
}
for (i = 0; i < 16; i++)
for (i = 0; i < HDC_NUM; i++)
{
if (hdc[i].bus == HDD_BUS_SCSI_REMOVABLE)
{
@@ -1044,17 +1063,17 @@ void update_status_bar_panes(HWND hwnds)
}
sb_parts++;
iStatusWidths = (int *) malloc(sb_parts << 2);
sb_part_meanings = (int *) malloc(sb_parts << 2);
sb_part_icons = (int *) malloc(sb_parts << 2);
sb_icon_flags = (int *) malloc(sb_parts << 2);
iStatusWidths = (int *) malloc(sb_parts * sizeof(int));
sb_part_meanings = (int *) malloc(sb_parts * sizeof(int));
sb_part_icons = (int *) malloc(sb_parts * sizeof(int));
sb_icon_flags = (int *) malloc(sb_parts * sizeof(int));
sb_menu_handles = (HMENU *) malloc(sb_parts * sizeof(HMENU));
sbTips = (WCHAR **) malloc(sb_parts * sizeof(WCHAR *));
memset(iStatusWidths, 0, sb_parts << 2);
memset(sb_part_meanings, 0, sb_parts << 2);
memset(sb_part_icons, 0, sb_parts << 2);
memset(sb_icon_flags, 0, sb_parts << 2);
memset(iStatusWidths, 0, sb_parts * sizeof(int));
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
memset(sb_part_icons, 0, sb_parts * sizeof(int));
memset(sb_icon_flags, 0, sb_parts * sizeof(int));
memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU));
sb_parts = 0;
@@ -1225,6 +1244,8 @@ void update_status_bar_panes(HWND hwnds)
SendMessage(hwnds, SB_SETICON, i, (LPARAM) NULL);
}
}
sb_ready = 1;
}
HWND EmulatorStatusBar(HWND hwndParent, int idStatus, HINSTANCE hinst)
@@ -1421,17 +1442,27 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
ghwnd=hwnd;
initpc(argc, argv);
printf("hwndRender;\n");
hwndRender = CreateWindow(L"STATIC", NULL, WS_VISIBLE | WS_CHILD | SS_BITMAP, 0, 0, 1, 1, ghwnd, NULL, hinstance, NULL);
printf("initpc();\n");
initpc(argc, argv);
printf("init_cdrom_host_drives();\n");
init_cdrom_host_drives();
printf("EmulatorStatusBar();\n");
hwndStatus = EmulatorStatusBar(hwnd, IDC_STATUS, hThisInstance);
printf("OriginalStatusBarProcedure;\n");
OriginalStatusBarProcedure = GetWindowLongPtr(hwndStatus, GWLP_WNDPROC);
printf("SetWindowLongPtr;\n");
SetWindowLongPtr(hwndStatus, GWL_WNDPROC, (LONG_PTR) &StatusBarProcedure);
smenu = LoadMenu(hThisInstance, TEXT("StatusBarMenu"));
init_cdrom_host_drives();
printf("initmodules();\n");
initmodules();
if (vid_apis[0][vid_api].init(hwndRender) == 0)
{
@@ -2024,10 +2055,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
GetClipCursor(&oldclip);
GetWindowRect(hwnd, &rect);
rect.left += GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
rect.right = GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
rect.top += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 20;
rect.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
ClipCursor(&rect);
mousecapture = 1;
while (1)
@@ -2069,10 +2097,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (mousecapture)
{
GetWindowRect(hwnd, &rect);
rect.left += GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
rect.right -= GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
rect.top += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 20;
rect.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
ClipCursor(&rect);
}
@@ -2085,6 +2110,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
window_h = rect.bottom - rect.top;
save_window_pos = 1;
}
saveconfig();
break;
case WM_MOVE:
@@ -2124,6 +2151,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
mouse_close();
vid_apis[1][vid_api].close();
video_fullscreen = 0;
saveconfig();
vid_apis[0][vid_api].init(hwndRender);
mouse_init();
endblit();
@@ -2283,10 +2311,20 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_UNCHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
cdrom_drives[id].host_drive = (wcslen(cdrom_image[id].image_path) == 0) ? 0 : 200;
if (cdrom_drives[id].host_drive == 200)
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
update_status_bar_icon_state(SB_CDROM | id, 0);
}
else
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
update_status_bar_icon_state(SB_CDROM | id, 1);
}
cdrom_drives[id].host_drive = 200;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
update_tip(SB_CDROM | id);
saveconfig();
}
@@ -2316,12 +2354,13 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_UNCHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = new_cdrom_drive;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_CHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
update_status_bar_icon_state(SB_CDROM | id, 0);
update_tip(SB_CDROM | id);
saveconfig();
break;

View File

@@ -178,29 +178,6 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
lpdds_back2->Blt(&r_src, lpdds_back, &r_src, DDBLT_WAIT, NULL);
}
if (readflash)
{
readflash = 0;
#ifdef LEGACY_READ_FLASH
if (enable_flash)
{
hr = lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
if (hr == DDERR_SURFACELOST)
{
lpdds_back2->Restore();
lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
for (yy = 8; yy < 14; yy++)
{
p = &(((uint32_t *) ddsd.lpSurface)[yy * ddsd.lPitch]);
for (xx = (w - 40); xx < (w - 8); xx++)
p[xx] = 0xffffffff;
}
}
#endif
}
lpdds_back2->Unlock(NULL);
// pclog("Blit from %i,%i %i,%i to %i,%i %i,%i\n", r_src.left, r_src.top, r_src.right, r_src.bottom, r_dest.left, r_dest.top, r_dest.right, r_dest.bottom);
@@ -276,29 +253,6 @@ static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h)
lpdds_back2->Blt(&r_src, lpdds_back, &r_src, DDBLT_WAIT, NULL);
}
if (readflash)
{
readflash = 0;
if (enable_flash)
{
hr = lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
if (hr == DDERR_SURFACELOST)
{
lpdds_back2->Restore();
lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
for (yy = 8; yy < 14; yy++)
{
p = (uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]);
for (xx = (w - 40); xx < (w - 8); xx++)
p[xx] = 0xffffffff;
}
lpdds_back2->Unlock(NULL);
}
}
hr = lpdds_pri->Blt(&r_dest, lpdds_back2, &r_src, DDBLT_WAIT, NULL);
if (hr == DDERR_SURFACELOST)
{

View File

@@ -227,17 +227,6 @@ static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h
lpdds_back2->Blt(&r_dest, lpdds_back, &r_src, DDBLT_WAIT, NULL);
}
if (readflash && enable_flash)
{
RECT r;
r.left = window_rect.right - 40;
r.right = window_rect.right - 8;
r.top = 8;
r.bottom = 14;
ddbltfx.dwFillColor = 0xffffff;
lpdds_back2->Blt(&r, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
}
hr = lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC);
if (hr == DDERR_SURFACELOST)
{
@@ -314,17 +303,6 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h)
lpdds_back2->Blt(&r_dest, lpdds_back, &r_src, DDBLT_WAIT, NULL);
}
if (readflash && enable_flash)
{
RECT r;
r.left = window_rect.right - 40;
r.right = window_rect.right - 8;
r.top = 8;
r.bottom = 14;
ddbltfx.dwFillColor = 0xffffff;
lpdds_back2->Blt(&r, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
}
lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC);
}

View File

@@ -52,7 +52,7 @@ void cdrom_eject(uint8_t id)
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
if ((cdrom_drives[id].host_drive >= 65) && (cdrom_drives[id].host_drive <= 90))
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drive << 3), MF_UNCHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive;
cdrom_drives[id].host_drive=0;
@@ -89,9 +89,20 @@ void cdrom_reload(uint8_t id)
/* Signal disc change to the emulated machine. */
cdrom_insert(id);
}
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = 200;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
if (wcslen(cdrom_image[id].image_path) == 0)
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_CHECKED);
cdrom_drives[id].host_drive = 0;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
update_status_bar_icon_state(SB_CDROM | id, 1);
}
else
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = 200;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
update_status_bar_icon_state(SB_CDROM | id, 0);
}
}
else
{
@@ -103,10 +114,10 @@ void cdrom_reload(uint8_t id)
cdrom_insert(id);
}
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
cdrom_drive = new_cdrom_drive;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_CHECKED);
cdrom_drives[id].host_drive = new_cdrom_drive;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
update_status_bar_icon_state(SB_CDROM | id, 0);
}
update_status_bar_icon_state(SB_CDROM | id, 0);
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
update_tip(SB_CDROM | id);
saveconfig();

View File

@@ -49,8 +49,8 @@ void midi_init()
{
MMRESULT hr = MMSYSERR_NOERROR;
memset(midi_rt_buf, 0, 1024);
memset(midi_cmd_buf, 0, 1024);
memset(midi_rt_buf, 0, sizeof(midi_rt_buf));
memset(midi_cmd_buf, 0, sizeof(midi_cmd_buf));
midi_cmd_pos = midi_cmd_len = 0;
midi_status = 0;
@@ -81,7 +81,7 @@ void midi_close()
{
midiOutReset(midi_out_device);
midiOutClose(midi_out_device);
midi_out_device = NULL;
/* midi_out_device = NULL; */
CloseHandle(m_event);
}
}

View File

@@ -87,6 +87,7 @@ static void win_settings_init(void)
/* Machine category */
temp_model = model;
temp_cpu_m = cpu_manufacturer;
temp_wait_states = cpu_waitstates;
temp_cpu = cpu;
temp_mem_size = mem_size;
temp_dynarec = cpu_use_dynarec;
@@ -149,6 +150,7 @@ static int win_settings_changed(void)
/* Machine category */
i = i || (model != temp_model);
i = i || (cpu_manufacturer != temp_cpu_m);
i = i || (cpu_waitstates != temp_wait_states);
i = i || (cpu != temp_cpu);
i = i || (mem_size != temp_mem_size);
i = i || (temp_dynarec != cpu_use_dynarec);
@@ -243,6 +245,7 @@ static void win_settings_save(void)
model = temp_model;
romset = model_getromset();
cpu_manufacturer = temp_cpu_m;
cpu_waitstates = temp_wait_states;
cpu = temp_cpu;
mem_size = temp_mem_size;
cpu_use_dynarec = temp_dynarec;
@@ -297,6 +300,8 @@ static void win_settings_save(void)
mem_resize();
loadbios();
update_status_bar_panes(hwndStatus);
resetpchard();
cpu_set();
@@ -308,8 +313,6 @@ static void win_settings_save(void)
speedchanged();
if (joystick_type != 7) gameport_update_joystick_type();
update_status_bar_panes(hwndStatus);
}
@@ -399,6 +402,10 @@ static void win_settings_machine_recalc_cpu_m(HWND hdlg)
c++;
}
EnableWindow(h, TRUE);
if (temp_cpu > c)
{
temp_cpu = c;
}
SendMessage(h, CB_SETCURSEL, temp_cpu, 0);
win_settings_machine_recalc_cpu(hdlg);
@@ -440,6 +447,10 @@ static void win_settings_machine_recalc_model(HWND hdlg)
c++;
}
EnableWindow(h, TRUE);
if (temp_cpu_m > c)
{
temp_cpu_m = c;
}
SendMessage(h, CB_SETCURSEL, temp_cpu_m, 0);
if (c == 1)
{
@@ -519,7 +530,7 @@ static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM w
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
SendMessage(h, CB_SETCURSEL, cpu_waitstates, 0);
SendMessage(h, CB_SETCURSEL, temp_wait_states, 0);
h=GetDlgItem(hdlg, IDC_CHECK_DYNAREC);
SendMessage(h, BM_SETCHECK, temp_dynarec, 0);
@@ -644,7 +655,7 @@ static void recalc_vid_list(HWND hdlg)
{
mbstowcs(szText, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText);
if (video_new_to_old(c) == gfxcard)
if (video_new_to_old(c) == temp_gfxcard)
{
SendMessage(h, CB_SETCURSEL, d, 0);
@@ -1682,7 +1693,12 @@ static int get_selected_hard_disk(HWND hdlg)
int i, j = 0;
HWND h;
for (i = 0; i < 6; i++)
if (hd_listview_items == 0)
{
return 0;
}
for (i = 0; i < hd_listview_items; i++)
{
h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS);
j = ListView_GetItemState(h, i, LVIS_SELECTED);
@@ -2318,7 +2334,9 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
uint32_t base = 0x1000;
uint64_t signature = 0xD778A82044445459ll;
char buf[512];
char *big_buf;
int b = 0;
uint64_t r = 0;
switch (message)
{
@@ -2547,9 +2565,27 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
memset(buf, 0, 512);
size >>= 9;
for (i = 0; i < size; i++)
r = (size >> 11) << 11;
size -= r;
r >>= 11;
if (size)
{
fwrite(buf, 512, 1, f);
for (i = 0; i < size; i++)
{
fwrite(buf, 1, 512, f);
}
}
if (r)
{
big_buf = (char *) malloc(1048576);
memset(big_buf, 0, 1048576);
for (i = 0; i < r; i++)
{
fwrite(big_buf, 1, 1048576, f);
}
free(big_buf);
}
fclose(f);

View File

@@ -60,11 +60,10 @@ CDROM_Interface_Image::BinaryFile::~BinaryFile()
delete file;
}
bool CDROM_Interface_Image::BinaryFile::read(Bit8u *buffer, int seek, int count)
bool CDROM_Interface_Image::BinaryFile::read(Bit8u *buffer, uint64_t seek, uint64_t count)
{
uint64_t offs = 0;
offs = ftello64(file);
fseeko64(file, offs, SEEK_SET);
fseeko64(file, seek, SEEK_SET);
offs = fread(buffer, 1, count, file);
return (offs == count);
}
@@ -186,8 +185,9 @@ bool CDROM_Interface_Image::ReadSector(Bit8u *buffer, bool raw, unsigned long se
int track = GetTrack(sector) - 1;
if (track < 0) return false;
int seek = tracks[track].skip + (sector - tracks[track].start) * tracks[track].sectorSize;
int length = (raw ? RAW_SECTOR_SIZE : COOKED_SECTOR_SIZE);
uint64_t seek = tracks[track].skip + (sector - tracks[track].start);
seek *= (uint64_t) tracks[track].sectorSize;
uint64_t length = (raw ? RAW_SECTOR_SIZE : COOKED_SECTOR_SIZE);
if (tracks[track].sectorSize != RAW_SECTOR_SIZE && raw) return false;
if (tracks[track].sectorSize == RAW_SECTOR_SIZE && !tracks[track].mode2 && !raw) seek += 16;
if (tracks[track].mode2 && !raw) seek += 24;

View File

@@ -103,7 +103,7 @@ class CDROM_Interface_Image : public CDROM_Interface
private:
class TrackFile {
public:
virtual bool read(Bit8u *buffer, int seek, int count) = 0;
virtual bool read(Bit8u *buffer, uint64_t seek, uint64_t count) = 0;
virtual uint64_t getLength() = 0;
virtual ~TrackFile() { };
};
@@ -112,7 +112,7 @@ private:
public:
BinaryFile(const char *filename, bool &error);
~BinaryFile();
bool read(Bit8u *buffer, int seek, int count);
bool read(Bit8u *buffer, uint64_t seek, uint64_t count);
uint64_t getLength();
private:
BinaryFile();

View File

@@ -995,7 +995,6 @@ int image_open(uint8_t id, wchar_t *fn)
cdrom_image[id].image_inited = 1;
}
update_status_bar_icon_state(0x10 | id, 0);
return 0;
}

View File

@@ -1056,7 +1056,6 @@ int ioctl_open(uint8_t id, char d)
ioctl_read_capacity(id, NULL);
CloseHandle(cdrom_ioctl_windows[id].hIOCTL);
cdrom_ioctl_windows[id].hIOCTL = NULL;
update_status_bar_icon_state(0x10 | id, 0);
}
return 0;
}

View File

@@ -101,7 +101,7 @@ void cdrom_set_null_handler(uint8_t id)
{
cdrom_drives[id].handler = &null_cdrom;
cdrom_drives[id].host_drive = 0;
update_status_bar_icon_state(0x10 | id, 1);
memset(cdrom_image[id].image_path, 0, sizeof(cdrom_image[id].image_path));
}
static CDROM null_cdrom =

View File

@@ -866,9 +866,9 @@ static void loadconfig_machine(void)
mem_size = config_get_int(cat, "mem_size", 4096);
if (mem_size < ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram))
mem_size = ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram);
if (mem_size > 1048576)
if (mem_size > 262144)
{
mem_size = 1048576;
mem_size = 262144;
}
cpu_use_dynarec = !!config_get_int(cat, "cpu_use_dynarec", 0);
@@ -967,7 +967,7 @@ static void loadconfig_sound(void)
{
strcpy(temps, p);
}
if (!strcmp(temps, "nukedopl"))
if (!strcmp(temps, "nukedopl") || !strcmp(temps, "1"))
{
opl3_type = 1;
}
@@ -991,11 +991,11 @@ static void loadconfig_network(void)
{
strcpy(temps, p);
}
if (!strcmp(temps, "slirp"))
if (!strcmp(temps, "slirp") || !strcmp(temps, "2"))
{
network_type = NET_TYPE_SLIRP;
}
else if (!strcmp(temps, "pcap"))
else if (!strcmp(temps, "pcap") || !strcmp(temps, "1"))
{
network_type = NET_TYPE_PCAP;
}
@@ -1206,6 +1206,33 @@ static int hard_disk_is_valid(int c)
}
static int tally_char(char *string, char c)
{
int i = 0;
int tally = 0;
if (string == NULL)
{
return 0;
}
if (strlen(string) == 0)
{
return 0;
}
for (i = 0; i < strlen(string); i++)
{
if (string[i] == c)
{
tally++;
}
}
return tally;
}
/* Hard disks */
static void loadconfig_hard_disks(void)
{
@@ -1226,7 +1253,15 @@ static void loadconfig_hard_disks(void)
p = config_get_string(cat, temps, NULL);
if (p == NULL)
p = "0, 0, 0, 0, none";
sscanf(p, "%" PRIu64 ", %" PRIu64", %" PRIu64 ", %i, %s", &hdc[c].spt, &hdc[c].hpc, &hdc[c].tracks, &hdc[c].wp, s);
if (tally_char(p, ',') == 3)
{
sscanf(p, "%" PRIu64 ", %" PRIu64", %" PRIu64 ", %s", &hdc[c].spt, &hdc[c].hpc, &hdc[c].tracks, s);
hdc[c].wp = 0;
}
else
{
sscanf(p, "%" PRIu64 ", %" PRIu64", %" PRIu64 ", %i, %s", &hdc[c].spt, &hdc[c].hpc, &hdc[c].tracks, &hdc[c].wp, s);
}
hdc[c].bus = config_string_to_bus(s, 0);
@@ -1313,11 +1348,20 @@ static void loadconfig_hard_disks(void)
{
sprintf(temps2, "%01u:%01u", c >> 1, c & 1);
p = config_get_string(cat, temps, temps2);
sscanf(p, "%01u:%01u", &board, &dev);
board &= 3;
dev &= 1;
hdc[c].ide_channel = (board << 1) + dev;
if (strstr(p, ":") == NULL)
{
sscanf(p, "%i", &hdc[c].ide_channel);
hdc[c].ide_channel &= 7;
}
else
{
sscanf(p, "%01u:%01u", &board, &dev);
board &= 3;
dev &= 1;
hdc[c].ide_channel = (board << 1) + dev;
}
if (hdc[c].ide_channel > 7)
{
@@ -1335,6 +1379,7 @@ static void loadconfig_hard_disks(void)
{
sprintf(temps2, "%02u:%02u", c, 0);
p = config_get_string(cat, temps, temps2);
sscanf(p, "%02u:%02u", &hdc[c].scsi_id, &hdc[c].scsi_lun);
if (hdc[c].scsi_id > 15)
@@ -1459,11 +1504,20 @@ static void loadconfig_removable_devices(void)
{
sprintf(temps2, "%01u:%01u", (c + 2) >> 1, (c + 2) & 1);
p = config_get_string(cat, temps, temps2);
sscanf(p, "%02u:%02u", &board, &dev);
board &= 3;
dev &= 1;
cdrom_drives[c].ide_channel = (board << 1) + dev;
if (strstr(p, ":") == NULL)
{
sscanf(p, "%i", &hdc[c].ide_channel);
cdrom_drives[c].ide_channel &= 7;
}
else
{
sscanf(p, "%02u:%02u", &board, &dev);
board &= 3;
dev &= 1;
cdrom_drives[c].ide_channel = (board << 1) + dev;
}
if (cdrom_drives[c].ide_channel > 7)
{
@@ -1748,7 +1802,7 @@ static void saveconfig_machine(void)
config_set_int(cat, "cpu_enable_fpu", enable_external_fpu);
}
if (enable_sync == 0)
if (enable_sync == 1)
{
config_delete_var(cat, "enable_sync");
}
@@ -1942,7 +1996,7 @@ static void saveconfig_network(void)
}
else
{
config_set_string(cat, "net_type", (network_type == NET_TYPE_SLIRP) ? "pcap" : "slirp");
config_set_string(cat, "net_type", (network_type == NET_TYPE_SLIRP) ? "slirp" : "pcap");
}
if (network_pcap[0] != '\0')

View File

@@ -17,6 +17,9 @@
#include "fdd.h"
#include "timer.h"
wchar_t discfns[4][256];
extern int driveempty[4];
int disc_poll_time[FDD_NUM] = { 16, 16, 16, 16 };
int disc_track[FDD_NUM];

View File

@@ -3041,7 +3041,7 @@ void d86f_load(int drive, wchar_t *fn)
d86f[drive].f = _wfopen(fn, L"rb");
if (!d86f[drive].f)
{
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
writeprot[drive] = 1;
@@ -3062,7 +3062,7 @@ void d86f_load(int drive, wchar_t *fn)
{
/* File is WAY too small, abort. */
fclose(d86f[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
@@ -3071,7 +3071,7 @@ void d86f_load(int drive, wchar_t *fn)
/* File is not of the valid format, abort. */
d86f_log("86F: Unrecognized magic bytes: %08X\n", magic);
fclose(d86f[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
@@ -3109,7 +3109,7 @@ void d86f_load(int drive, wchar_t *fn)
{
/* File too small, abort. */
fclose(d86f[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
@@ -3131,7 +3131,7 @@ void d86f_load(int drive, wchar_t *fn)
{
d86f_log("86F: CRC64 error\n");
fclose(d86f[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
#endif
@@ -3147,7 +3147,7 @@ void d86f_load(int drive, wchar_t *fn)
if (!d86f[drive].f)
{
d86f_log("86F: Unable to create temporary decompressed file\n");
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
@@ -3177,7 +3177,7 @@ void d86f_load(int drive, wchar_t *fn)
{
d86f_log("86F: Error decompressing file\n");
_wremove(temp_file_name);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
@@ -3193,7 +3193,7 @@ void d86f_load(int drive, wchar_t *fn)
{
_wremove(temp_file_name);
}
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
@@ -3206,7 +3206,7 @@ void d86f_load(int drive, wchar_t *fn)
{
_wremove(temp_file_name);
}
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
@@ -3239,16 +3239,16 @@ void d86f_load(int drive, wchar_t *fn)
/* File has no track 0 side 0, abort. */
d86f_log("86F: No Track 0 side 0\n");
fclose(d86f[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
if ((d86f_get_sides(drive) == 2) && !(d86f[drive].track_offset[1]))
{
/* File is 2-sided but has no track 0 side 1, abort. */
d86f_log("86F: No Track 0 side 0\n");
d86f_log("86F: No Track 0 side 1\n");
fclose(d86f[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}

View File

@@ -248,7 +248,7 @@ void fdi_load(int drive, wchar_t *fn)
fdi[drive].f = _wfopen(fn, L"rb");
if (!fdi[drive].f)
{
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}

View File

@@ -80,7 +80,7 @@ void imd_load(int drive, wchar_t *fn)
imd[drive].f = _wfopen(fn, L"rb");
if (!imd[drive].f)
{
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
writeprot[drive] = 1;
@@ -97,7 +97,7 @@ void imd_load(int drive, wchar_t *fn)
{
pclog("IMD: Not a valid ImageDisk image\n");
fclose(imd[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
else
@@ -118,7 +118,7 @@ void imd_load(int drive, wchar_t *fn)
{
pclog("IMD: No ASCII EOF character\n");
fclose(imd[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
else
@@ -131,7 +131,7 @@ void imd_load(int drive, wchar_t *fn)
{
pclog("IMD: File ends after ASCII EOF character\n");
fclose(imd[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
else
@@ -250,7 +250,7 @@ void imd_load(int drive, wchar_t *fn)
/* If we can't fit the sectors with a reasonable minimum gap even at 2% slower RPM, abort. */
pclog("IMD: Unable to fit the %i sectors in a track\n", track_spt);
fclose(imd[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
}

View File

@@ -337,7 +337,7 @@ void img_load(int drive, wchar_t *fn)
img[drive].f = _wfopen(fn, L"rb");
if (!img[drive].f)
{
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
writeprot[drive] = 1;
@@ -736,7 +736,7 @@ jump_if_fdf:
{
pclog("Image is bigger than can fit on an ED floppy, ejecting...\n");
fclose(img[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
}
@@ -798,7 +798,7 @@ jump_if_fdf:
{
pclog("Image is bigger than can fit on an ED floppy, ejecting...\n");
fclose(img[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
@@ -815,7 +815,7 @@ jump_if_fdf:
{
pclog("ERROR: Floppy image of unknown format was inserted into drive %c:!\n", drive + 0x41);
fclose(img[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}

View File

@@ -511,7 +511,7 @@ void td0_load(int drive, wchar_t *fn)
td0[drive].f = _wfopen(fn, L"rb");
if (!td0[drive].f)
{
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
fwriteprot[drive] = writeprot[drive];
@@ -521,7 +521,7 @@ void td0_load(int drive, wchar_t *fn)
{
pclog("TD0: Not a valid Teledisk image\n");
fclose(td0[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
else
@@ -536,7 +536,7 @@ void td0_load(int drive, wchar_t *fn)
{
pclog("TD0: Failed to initialize\n");
fclose(td0[drive].f);
update_status_bar_icon_state(drive, 1);
memset(discfns[drive], 0, sizeof(discfns[drive]));
return;
}
else

View File

@@ -12,9 +12,12 @@ static uint8_t dmaregs[16];
static uint8_t dma16regs[16];
static uint8_t dmapages[16];
DMA dma, dma16;
void dma_reset(void)
{
#if 0
int c;
dma.wp = 0;
for (c = 0; c < 16; c++)
@@ -41,6 +44,12 @@ void dma_reset(void)
dma16.cb[c] = 0;
}
dma16.m = 0;
#endif
memset(dmaregs, 0, 16);
memset(dma16regs, 0, 16);
memset(dmapages, 0, 16);
memset(&dma, 0, sizeof(DMA));
memset(&dma16, 0, sizeof(DMA));
}
uint8_t dma_read(uint16_t addr, void *priv)

View File

@@ -130,6 +130,8 @@ typedef struct FDC
uint16_t base_address;
} FDC;
int disctime;
static FDC fdc;
void fdc_callback();
@@ -958,7 +960,6 @@ bad_command:
}
disctime = 0;
update_status_bar_icon(SB_FLOPPY | fdc.drive, 1);
readflash = 1;
fdc.inread = 1;
break;

View File

@@ -9,15 +9,15 @@
/*Memory*/
uint8_t *ram;
uint32_t rammask;
extern uint8_t *ram;
extern uint32_t rammask;
int readlookup[256],readlookupp[256];
uintptr_t *readlookup2;
int readlnext;
int writelookup[256],writelookupp[256];
uintptr_t *writelookup2;
int writelnext;
extern int readlookup[256],readlookupp[256];
extern uintptr_t *readlookup2;
extern int readlnext;
extern int writelookup[256],writelookupp[256];
extern uintptr_t *writelookup2;
extern int writelnext;
extern int mmu_perm;
@@ -162,7 +162,7 @@ struct
#define cycles cpu_state._cycles
uint32_t cpu_cur_status;
extern uint32_t cpu_cur_status;
#define CPU_STATUS_USE32 (1 << 0)
#define CPU_STATUS_STACK32 (1 << 1)
@@ -186,18 +186,18 @@ COMPILE_TIME_ASSERT(sizeof(cpu_state) <= 128)
/*x86reg regs[8];*/
uint16_t flags,eflags;
uint32_t oldds,oldss,olddslimit,oldsslimit,olddslimitw,oldsslimitw;
extern uint16_t flags,eflags;
extern uint32_t oldds,oldss,olddslimit,oldsslimit,olddslimitw,oldsslimitw;
extern int ins,output;
extern int cycdiff;
x86seg gdt,ldt,idt,tr;
x86seg _cs,_ds,_es,_ss,_fs,_gs;
x86seg _oldds;
extern x86seg gdt,ldt,idt,tr;
extern x86seg _cs,_ds,_es,_ss,_fs,_gs;
extern x86seg _oldds;
uint32_t pccache;
uint8_t *pccache2;
extern uint32_t pccache;
extern uint8_t *pccache2;
/*Segments -
_cs,_ds,_es,_ss are the segment structures
CS,DS,ES,SS is the 16-bit data
@@ -229,8 +229,8 @@ union
#define cr0 CR0.l
#define msw CR0.w
uint32_t cr2, cr3, cr4;
uint32_t dr[8];
extern uint32_t cr2, cr3, cr4;
extern uint32_t dr[8];
#define C_FLAG 0x0001
#define P_FLAG 0x0004
@@ -328,7 +328,7 @@ typedef struct DMA
uint8_t ps2_mode[4];
} DMA;
DMA dma,dma16;
extern DMA dma, dma16;
/*PPI*/
@@ -338,7 +338,7 @@ typedef struct PPI
uint8_t pa,pb;
} PPI;
PPI ppi;
extern PPI ppi;
/*PIC*/
@@ -350,13 +350,13 @@ typedef struct PIC
int read;
} PIC;
PIC pic,pic2;
extern PIC pic, pic2;
extern int pic_intpending;
int disctime;
wchar_t discfns[4][256];
int driveempty[4];
extern int disctime;
extern wchar_t discfns[4][256];
extern int driveempty[4];
#define MDA ((gfxcard==GFX_MDA || gfxcard==GFX_HERCULES || gfxcard==GFX_HERCULESPLUS || gfxcard==GFX_INCOLOR || gfxcard==GFX_GENIUS) && (romset<ROM_TANDY || romset>=ROM_IBMAT))
#define VGA ((gfxcard>=GFX_TVGA || romset==ROM_ACER386) && gfxcard!=GFX_COLORPLUS && gfxcard!=GFX_INCOLOR && gfxcard!=GFX_WY700 && gfxcard!=GFX_GENIUS && gfxcard!=GFX_COMPAQ_EGA && gfxcard!=GFX_SUPER_EGA && gfxcard!=GFX_HERCULESPLUS && romset!=ROM_PC1640 && romset!=ROM_PC1512 && romset!=ROM_TANDY && romset!=ROM_PC200)
@@ -456,14 +456,15 @@ enum
ROM_CMDPC60,
ROM_S1668, /*Tyan Titan-Pro ATX / 440FX / AMI BIOS / SMC FDC37C669*/
ROM_IBMPS1_2133,
ROM_MAX
};
extern int romspresent[ROM_MAX];
int hasfpu;
int romset;
extern int hasfpu;
extern int romset;
enum
{
@@ -525,7 +526,6 @@ int cpuspeed;
/*Video*/
int readflash;
extern int egareads,egawrites;
extern int vid_resize;
extern int vid_api;
@@ -534,12 +534,12 @@ extern int changeframecount;
/*Sound*/
int ppispeakon;
float CGACONST;
float MDACONST;
float VGACONST1,VGACONST2;
float RTCCONST;
int gated,speakval,speakon;
extern int ppispeakon;
extern float CGACONST;
extern float MDACONST;
extern float VGACONST1,VGACONST2;
extern float RTCCONST;
extern int gated,speakval,speakon;
#define SOUNDBUFLEN (48000/20)
@@ -556,7 +556,7 @@ int gated,speakval,speakon;
#define SND_WSS 9 /*Windows Sound System*/
#define SND_PAS16 10 /*Pro Audio Spectrum 16*/
wchar_t pcempath[512];
extern wchar_t pcempath[512];
/*Hard disk*/
@@ -604,8 +604,6 @@ typedef struct {
extern hard_disk_t hdc[HDC_NUM];
FILE *shdf[HDC_NUM];
uint64_t hdt[128][3];
uint64_t hdt_mfm[128][3];
@@ -613,7 +611,7 @@ int image_is_hdi(const wchar_t *s);
int image_is_hdx(const wchar_t *s, int check_signature);
/*Keyboard*/
int keybsenddelay;
extern int keybsenddelay;
/*CD-ROM*/
@@ -681,7 +679,7 @@ extern int path_len;
wchar_t *nvr_concat(wchar_t *to_concat);
int mem_a20_state;
extern int mem_a20_state;
#ifdef ENABLE_LOG_TOGGLES
@@ -735,6 +733,7 @@ extern void execx86(int cycs);
extern void flushmmucache(void);
extern void flushmmucache_cr3(void);
extern int idivl(int32_t val);
extern void initmodules(void);
extern void initpc(int argc, wchar_t *argv[]);
extern void loadcscall(uint16_t seg);
extern void loadcsjmp(uint16_t seg, uint32_t oxpc);

View File

@@ -761,6 +761,7 @@ void resetide(void)
idecallback[0]=idecallback[1]=0;
idecallback[2]=idecallback[3]=0;
idecallback[4]=0;
c = 0;
for (d = 0; d < HDC_NUM; d++)
@@ -774,7 +775,7 @@ void resetide(void)
}
if ((hdc[d].bus == HDD_BUS_XTIDE) && (hdc[d].xtide_channel < XTIDE_NUM))
{
pclog("Found XTIDE hard disk on channel %i\n", hdc[d].xtide_channel);
pclog("Found XT IDE hard disk on channel %i\n", hdc[d].xtide_channel);
loadhd(&ide_drives[hdc[d].xtide_channel | 8], d, hdc[d].fn);
c++;
if (c >= (IDE_NUM + XTIDE_NUM)) break;
@@ -802,12 +803,12 @@ void resetide(void)
{
ide_set_signature(&ide_drives[d | 8]);
if (ide_drives[d].type == IDE_HDD)
if (ide_drives[d | 8].type == IDE_HDD)
{
ide_drives[d].mdma_mode = 0;
ide_drives[d | 8].mdma_mode = 0;
}
ide_drives[d].error = 1;
ide_drives[d | 8].error = 1;
}
for (d = 0; d < 5; d++)

View File

@@ -6,6 +6,7 @@
#include "keyboard.h"
int keybsendcallback = 0;
int keybsenddelay;
typedef struct
{

View File

@@ -46,8 +46,23 @@ mem_mapping_t bios_mapping[8];
mem_mapping_t bios_high_mapping[8];
static mem_mapping_t romext_mapping;
uint8_t *ram;
uint32_t rammask;
uint32_t pccache;
uint8_t *pccache2;
int readlookup[256],readlookupp[256];
uintptr_t *readlookup2;
int readlnext;
int writelookup[256],writelookupp[256];
uintptr_t *writelookup2;
int writelnext;
int shadowbios,shadowbios_write;
int mem_a20_state;
static unsigned char isram[0x10000];
static uint8_t ff_array[0x1000];
@@ -467,6 +482,14 @@ int loadbios()
biosmask = 0x1ffff;
return 1;
case ROM_IBMPS1_2133:
f = romfopen(L"roms/ibmps1_2133/PS1_2133_52G2974_ROM.bin", L"rb");
if (!f) break;
fread(rom, 0x20000, 1, f);
fclose(f);
biosmask = 0x1ffff;
return 1;
case ROM_DESKPRO_386:
f=romfopen(L"roms/deskpro386/109592-005.U11.bin",L"rb");
ff=romfopen(L"roms/deskpro386/109591-005.U13.bin",L"rb");

View File

@@ -89,6 +89,7 @@ void at_ide_init();
void deskpro386_init();
void ps1_m2011_init();
void ps1_m2121_init();
void ps1_m2133_init();
void ps2_m30_286_init();
void ps2_model_50_init();
void ps2_model_55sx_init();
@@ -129,6 +130,8 @@ PCI_RESET pci_reset_handler;
int serial_enabled[2] = { 0, 0 };
int lpt_enabled = 0, bugger_enabled = 0;
int romset;
MODEL models[] =
{
{"IBM PC", ROM_IBMPC, "ibmpc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL},
@@ -176,6 +179,7 @@ MODEL models[] =
{"Amstrad MegaPC 386DX", ROM_MEGAPCDX, "megapcdx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, at_wd76c10_init, NULL},
{"MR 386DX clone", ROM_MR386DX_OPTI495, "mr386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_opti495_init, NULL},
{"AMI 386DX clone", ROM_AMI386DX_OPTI495, "ami386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_opti495_init, NULL},
{"IBM PS/1 model 2133", ROM_IBMPS1_2133, "ibmps1_2133", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 64, 1, ps1_m2133_init, NULL},
{"AMI 486 clone", ROM_AMI486, "ami486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_ali1429_init, NULL},
{"AMI WinBIOS 486", ROM_WIN486, "win486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_ali1429_init, NULL},
{"DTK PKM-0038S E-2", ROM_DTK486, "dtk486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 64, 1, at_dtk486_init, NULL},
@@ -187,19 +191,19 @@ MODEL models[] =
{"Intel Advanced/EV", ROM_ENDEAVOR, "endeavor", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_endeavor_init, NULL},
{"Intel Advanced/ZP", ROM_ZAPPA, "zappa", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_endeavor_init, NULL},
{"PC Partner MB500N", ROM_MB500N, "mb500n", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 128, 1, at_mb500n_init, NULL},
{"Intel Advanced/ATX", ROM_THOR, "thor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_endeavor_init, NULL},
{"MR Intel Advanced/ATX", ROM_MRTHOR, "mrthor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_endeavor_init, NULL},
{"ASUS P/I-P54TP4XE", ROM_P54TP4XE, "p54tp4xe", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_p54tp4xe_init, NULL},
{"AOpen AP53", ROM_AP53, "ap53", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_ap53_init, NULL},
{"ASUS P/I-P55T2S", ROM_P55T2S, "p55t2s", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_p55t2s_init, NULL},
{"Acer M3a", ROM_ACERM3A, "acerm3a", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_acerm3a_init, NULL},
{"Acer V35N", ROM_ACERV35N, "acerv3n", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_acerv35n_init, NULL},
{"ASUS P/I-P55T2P4", ROM_P55T2P4, "p55r2p4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 512, 1, at_p55t2p4_init, NULL},
{"Intel Advanced/ATX", ROM_THOR, "thor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_endeavor_init, NULL},
{"MR Intel Advanced/ATX", ROM_MRTHOR, "mrthor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_endeavor_init, NULL},
{"ASUS P/I-P54TP4XE", ROM_P54TP4XE, "p54tp4xe", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_p54tp4xe_init, NULL},
{"AOpen AP53", ROM_AP53, "ap53", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_ap53_init, NULL},
{"ASUS P/I-P55T2S", ROM_P55T2S, "p55t2s", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_p55t2s_init, NULL},
{"Acer M3a", ROM_ACERM3A, "acerm3a", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_acerm3a_init, NULL},
{"Acer V35N", ROM_ACERV35N, "acerv3n", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_acerv35n_init, NULL},
{"ASUS P/I-P55T2P4", ROM_P55T2P4, "p55r2p4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_p55t2p4_init, NULL},
{"Award 430VX PCI", ROM_430VX, "430vx", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_i430vx_init, NULL},
{"Epox P55-VA", ROM_P55VA, "p55va", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_p55va_init, NULL},
{"ASUS P/I-P55TVP4", ROM_P55TVP4, "p55tvp4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_p55tvp4_init, NULL},
{"Tyan Titan-Pro AT", ROM_440FX, "440fx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 1024, 1, at_i440fx_init, NULL},
{"Tyan Titan-Pro ATX", ROM_S1668, "tpatx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 1024, 1, at_s1668_init, NULL},
{"Tyan Titan-Pro AT", ROM_440FX, "440fx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_i440fx_init, NULL},
{"Tyan Titan-Pro ATX", ROM_S1668, "tpatx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE | MODEL_PCI, 1, 256, 1, at_s1668_init, NULL},
{"", -1, "", {"", 0, "", 0, "", 0}, 0,0,0, 0}
};
@@ -445,6 +449,13 @@ void ps1_m2121_init()
fdc_set_ps1();
}
void ps1_m2133_init()
{
ps1_common_init();
ps1mb_m2133_init();
fdc_set_ps1();
}
void ps2_m30_286_init()
{
AT = 1;

View File

@@ -14,8 +14,8 @@ static mouse_t *mouse_list[] = {
&mouse_bus, /* 3 Logitech Bus Mouse 2-button */
&mouse_amstrad, /* 4 Amstrad PC System Mouse */
&mouse_olim24, /* 5 Olivetti M24 System Mouse */
#if 0
&mouse_msystems, /* 6 Mouse Systems */
#if 0
&mouse_genius, /* 7 Genius Bus Mouse */
#endif
NULL

View File

@@ -28,6 +28,7 @@ typedef struct mouse_serial_t {
delay;
int oldb;
SERIAL *serial;
int is_ms_format;
} mouse_serial_t;
@@ -50,11 +51,12 @@ sermouse_timer(void *priv)
mouse_serial_t *ms = (mouse_serial_t *)priv;
ms->delay = 0;
if (ms->pos == -1) {
ms->pos = 0;
if (ms->pos == -1)
{
ms->pos = 0;
/* This identifies a two-button Microsoft Serial mouse. */
serial_write_fifo(ms->serial, 'M');
/* This identifies a two-button Microsoft Serial mouse. */
serial_write_fifo(ms->serial, 'M');
}
}
@@ -130,3 +132,61 @@ mouse_t mouse_serial_microsoft = {
sermouse_close,
sermouse_poll
};
static uint8_t
mssystems_mouse_poll(int x, int y, int z, int b, void *priv)
{
mouse_serial_t *ms = (mouse_serial_t *)priv;
uint8_t data[5];
if (!x && !y && b == ms->oldb) return(1);
ms->oldb = b;
y=-y;
if (x>127) x = 127;
if (y>127) y = 127;
if (x<-128) x = -128;
if (y<-128) y = -128;
data[0] = 0x80 | ((((b & 0x04) >> 1) + ((b & 0x02) << 1) + (b & 0x01)) ^ 0x07);
data[1] = x;
data[2] = y;
data[3] = 0;
data[4] = 0;
pclog("Mouse_Systems_Serial: data %02X %02X %02X\n", data[0], data[1], data[2]);
serial_write_fifo(ms->serial, data[0]);
serial_write_fifo(ms->serial, data[1]);
serial_write_fifo(ms->serial, data[2]);
serial_write_fifo(ms->serial, data[3]);
serial_write_fifo(ms->serial, data[4]);
return(0);
}
static void *
mssystems_mouse_init(void)
{
mouse_serial_t *ms = (mouse_serial_t *)malloc(sizeof(mouse_serial_t));
memset(ms, 0x00, sizeof(mouse_serial_t));
ms->port = SERMOUSE_PORT;
/* Attach a serial port to the mouse. */
ms->serial = serial_attach(ms->port, sermouse_callback, ms);
timer_add(sermouse_timer, &ms->delay, &ms->delay, ms);
return(ms);
}
mouse_t mouse_msystems = {
"Mouse Systems Mouse (serial)",
"mssystems",
MOUSE_TYPE_MSYSTEMS,
mssystems_mouse_init,
sermouse_close,
mssystems_mouse_poll
};

View File

@@ -22,6 +22,7 @@
extern mouse_t mouse_serial_microsoft;
extern mouse_t mouse_msystems;
#endif /*MOUSE_SERIAL_H*/

View File

@@ -144,6 +144,16 @@ network_pcap_init(netdev_t *list)
}
/* Initialize the (Win)Pcap module for use. */
void
network_pcap_reset(void)
{
/* Try loading the DLL. */
pcap_handle = dynld_module("wpcap.dll", pcap_imports);
return;
}
/* Initialize WinPcap for us. */
int
network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
@@ -156,11 +166,26 @@ network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
/* Did we already load the DLL? */
if (pcap_handle == NULL) return(-1);
#if 1
/* Get the value of our capture interface. */
dev = network_pcap;
if (dev == NULL) {
pclog(" PCap device is a null pointer!\n");
return(-1);
}
if ((dev[0] == '\0') || !strcmp(dev, "none")) {
pclog(" No network device configured!\n");
return(-1);
}
pclog(" Network interface: '%s'\n", dev);
#endif
strcpy(temp, f_pcap_lib_version());
dev = strchr(temp, '(');
if (dev != NULL) *(dev-1) = '\0';
pclog("PCAP: initializing, %s\n", temp);
#if 0
/* Get the value of our capture interface. */
dev = network_pcap;
if ((dev[0] == '\0') || !strcmp(dev, "none")) {
@@ -168,6 +193,7 @@ network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
return(-1);
}
pclog(" Network interface: '%s'\n", dev);
#endif
pcap = f_pcap_open_live(dev, /* interface name */
1518, /* maximum packet size */

View File

@@ -63,8 +63,10 @@ network_init(void)
{
int i;
#if 0
network_type = NET_TYPE_NONE;
network_card = 0;
#endif
/* Create a first device entry that's always there, as needed by UI. */
strcpy(network_devs[0].device, "none");
@@ -75,6 +77,8 @@ network_init(void)
i = network_pcap_init(&network_devs[network_ndev]);
if (i > 0)
network_ndev += i;
if (network_type != NET_TYPE_PCAP) network_pcap_close();
}
@@ -153,7 +157,7 @@ network_reset(void)
/* If no active card, we're done. */
if ((network_type==NET_TYPE_NONE) || (network_card==0)) return;
i = network_pcap_init(&network_devs[network_ndev]);
if (network_type==NET_TYPE_PCAP) network_pcap_reset();
pclog("NETWORK: set up for %s, card='%s'\n",
(network_type==NET_TYPE_SLIRP)?"SLiRP":"WinPcap",

View File

@@ -63,6 +63,7 @@ extern void network_reset(void);
extern void network_tx(uint8_t *, int);
extern int network_pcap_init(netdev_t *);
extern void network_pcap_reset(void);
extern int network_pcap_setup(uint8_t *, NETRXCB, void *);
extern void network_pcap_close(void);
extern void network_pcap_in(uint8_t *, int);

View File

@@ -245,6 +245,7 @@ void loadnvr()
case ROM_MRTHOR: f = nvrfopen(L"mrthor.nvr", L"rb"); nvrmask = 127; break;
case ROM_ZAPPA: f = nvrfopen(L"zappa.nvr", L"rb"); nvrmask = 127; break;
case ROM_S1668: f = nvrfopen(L"tpatx.nvr", L"rb"); nvrmask = 127; break;
case ROM_IBMPS1_2133: f = nvrfopen(L"ibmps1_2133.nvr", L"rb"); nvrmask = 127; break;
default: return;
}
if (!f)
@@ -329,6 +330,7 @@ void savenvr()
case ROM_MRTHOR: f = nvrfopen(L"mrthor.nvr", L"wb"); break;
case ROM_ZAPPA: f = nvrfopen(L"zappa.nvr", L"wb"); break;
case ROM_S1668: f = nvrfopen(L"tpatx.nvr", L"wb"); break;
case ROM_IBMPS1_2133: f = nvrfopen(L"ibmps1_2133.nvr", L"wb"); break;
default: return;
}
fwrite(nvrram,128,1,f);

View File

@@ -64,6 +64,8 @@
#endif
wchar_t pcempath[512];
wchar_t nvr_path[1024];
int path_len;
@@ -261,8 +263,6 @@ void pc_reset(void)
setpitclock(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed);
else
setpitclock(14318184.0);
ali1429_reset();
}
@@ -271,7 +271,7 @@ void initpc(int argc, wchar_t *argv[])
{
wchar_t *p;
wchar_t *config_file = NULL;
int c, i;
int c;
FILE *ff;
get_executable_name(pcempath, 511);
pclog("executable_name = %ws\n", pcempath);
@@ -330,13 +330,6 @@ void initpc(int argc, wchar_t *argv[])
}
}
/* Initialize modules. */
network_init();
mouse_init();
midi_init();
serial_init();
disc_random_init();
if (config_file == NULL)
{
append_filename_w(config_file_default, pcempath, L"86box.cfg", 511);
@@ -348,8 +341,22 @@ void initpc(int argc, wchar_t *argv[])
loadconfig(config_file);
pclog("Config loaded\n");
#if 0
if (config_file)
saveconfig();
#endif
}
void initmodules(void)
{
int i;
/* Initialize modules. */
network_init();
mouse_init();
midi_init();
serial_init();
disc_random_init();
joystick_init();
@@ -464,7 +471,9 @@ void resetpchard(void)
suppress_overscan = 0;
savenvr();
#if 0
saveconfig();
#endif
device_close_all();
mouse_emu_close();
@@ -499,7 +508,7 @@ void resetpchard(void)
for (i = 0; i < CDROM_NUM; i++)
{
if (cdrom_drives[i].bus_type)
if (cdrom_drives[i].bus_type == CDROM_BUS_SCSI)
{
SCSIReset(cdrom_drives[i].scsi_device_id, cdrom_drives[i].scsi_device_lun);
}

View File

@@ -8,6 +8,8 @@ int intclear;
int keywaiting=0;
int pic_intpending;
PIC pic, pic2;
void pic_updatepending()
{
uint16_t temp_pending = 0;

View File

@@ -25,6 +25,11 @@ double PITCONST;
float cpuclock;
float isa_timing, bus_timing;
float CGACONST;
float MDACONST;
float VGACONST1,VGACONST2;
float RTCCONST;
int firsttime=1;
void setpitclock(float clock)
{

View File

@@ -13,6 +13,9 @@
#include "plat_keyboard.h"
#include "plat_mouse.h"
PPI ppi;
int ppispeakon;
void ppi_reset()
{
ppi.pa=0x0;

View File

@@ -304,3 +304,23 @@ void ps1mb_m2121_init()
mem_remap_top_384k();
}
void ps1mb_m2133_init()
{
io_sethandler(0x0091, 0x0001, ps1_m2121_read, NULL, NULL, ps1_m2121_write, NULL, NULL, NULL);
io_sethandler(0x0092, 0x0001, ps1_m2121_read, NULL, NULL, ps1_m2121_write, NULL, NULL, NULL);
io_sethandler(0x0094, 0x0001, ps1_m2121_read, NULL, NULL, ps1_m2121_write, NULL, NULL, NULL);
io_sethandler(0x0102, 0x0004, ps1_m2121_read, NULL, NULL, ps1_m2121_write, NULL, NULL, NULL);
io_sethandler(0x0190, 0x0001, ps1_m2121_read, NULL, NULL, ps1_m2121_write, NULL, NULL, NULL);
ps1_190 = 0;
lpt1_remove();
lpt2_remove();
lpt1_init(0x3bc);
serial_remove(1);
serial_remove(2);
mem_remap_top_384k();
}

View File

@@ -3,3 +3,4 @@
*/
void ps1mb_init();
void ps1mb_m2121_init();
void ps1mb_m2133_init();

View File

@@ -120,4 +120,10 @@ void SCSIReset(uint8_t id, uint8_t lun)
SCSIDevices[id][lun].LunType = SCSI_NONE;
}
}
if(SCSIDevices[id][lun].CmdBuffer != NULL)
{
free(SCSIDevices[id][lun].CmdBuffer);
SCSIDevices[id][lun].CmdBuffer = NULL;
}
}

View File

@@ -230,7 +230,7 @@ extern int prev_status;
struct
{
uint8_t CmdBuffer[390144];
uint8_t *CmdBuffer;
uint32_t CmdBufferLength;
int LunType;
uint32_t InitLength;

View File

@@ -1101,6 +1101,14 @@ aha_buf_alloc(Req_t *req, int Is24bit)
pclog("Data Buffer write: length %d, pointer 0x%04X\n",
DataLength, DataPointer);
if (SCSIDevices[req->TargetID][req->LUN].CmdBuffer != NULL)
{
free(SCSIDevices[req->TargetID][req->LUN].CmdBuffer);
SCSIDevices[req->TargetID][req->LUN].CmdBuffer = NULL;
}
SCSIDevices[req->TargetID][req->LUN].CmdBuffer = (uint8_t *) malloc(DataLength);
memset(SCSIDevices[req->TargetID][req->LUN].CmdBuffer, 0, DataLength);
if ((req->CmdBlock.common.ControlByte != 0x03) && DataLength) {
if (req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND ||
req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND_RES) {
@@ -1280,6 +1288,12 @@ aha_buf_free(Req_t *req)
req->CmdBlock.new.DataLength);
}
}
if (SCSIDevices[req->TargetID][req->LUN].CmdBuffer != NULL)
{
free(SCSIDevices[req->TargetID][req->LUN].CmdBuffer);
SCSIDevices[req->TargetID][req->LUN].CmdBuffer = NULL;
}
}
@@ -1955,9 +1969,6 @@ aha_req_setup(aha_t *dev, uint32_t CCBPointer, Mailbox32_t *Mailbox32)
SCSIStatus = SCSI_STATUS_OK;
SCSIDevices[Id][Lun].InitLength = 0;
/* Do this here, so MODE SELECT data does not get lost in transit. */
memset(SCSIDevices[Id][Lun].CmdBuffer, 0, 390144);
aha_buf_alloc(req, req->Is24bit);
if (SCSIDevices[Id][Lun].LunType == SCSI_NONE) {

View File

@@ -757,6 +757,14 @@ BuslogicDataBufferAllocate(Req_t *req, int Is24bit)
pclog("Data Buffer write: length %d, pointer 0x%04X\n",
DataLength, DataPointer);
if (SCSIDevices[req->TargetID][req->LUN].CmdBuffer != NULL)
{
free(SCSIDevices[req->TargetID][req->LUN].CmdBuffer);
SCSIDevices[req->TargetID][req->LUN].CmdBuffer = NULL;
}
SCSIDevices[req->TargetID][req->LUN].CmdBuffer = (uint8_t *) malloc(DataLength);
memset(SCSIDevices[req->TargetID][req->LUN].CmdBuffer, 0, DataLength);
if ((req->CmdBlock.common.ControlByte != 0x03) && DataLength) {
if (req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND ||
req->CmdBlock.common.Opcode == SCATTER_GATHER_COMMAND_RES) {
@@ -936,6 +944,12 @@ BuslogicDataBufferFree(Req_t *req)
req->CmdBlock.new.DataLength);
}
}
if (SCSIDevices[req->TargetID][req->LUN].CmdBuffer != NULL)
{
free(SCSIDevices[req->TargetID][req->LUN].CmdBuffer);
SCSIDevices[req->TargetID][req->LUN].CmdBuffer = NULL;
}
}
@@ -1799,9 +1813,6 @@ BuslogicSCSIRequestSetup(Buslogic_t *bl, uint32_t CCBPointer, Mailbox32_t *Mailb
SCSIStatus = SCSI_STATUS_OK;
SCSIDevices[Id][Lun].InitLength = 0;
/* Do this here, so MODE SELECT data does not get lost in transit. */
memset(SCSIDevices[Id][Lun].CmdBuffer, 0, 390144);
BuslogicDataBufferAllocate(req, req->Is24bit);
if (SCSIDevices[Id][Lun].LunType == SCSI_NONE) {

View File

@@ -45,6 +45,8 @@
scsi_hard_disk_t shdc[HDC_NUM];
FILE *shdf[HDC_NUM];
uint8_t scsi_hard_disks[16][8] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
@@ -202,7 +204,8 @@ void scsi_disk_insert(uint8_t id)
shdc[id].unit_attention = (hdc[id].bus == HDD_BUS_SCSI_REMOVABLE) ? 1 : 0;
}
char empty_sector[512];
static char empty_sector[512];
static char *empty_sector_1mb;
void scsi_loadhd(int scsi_id, int scsi_lun, int id)
{
@@ -212,7 +215,7 @@ void scsi_loadhd(int scsi_id, int scsi_lun, int id)
uint64_t full_size = 0;
uint64_t spt = 0, hpc = 0, tracks = 0;
int c;
uint64_t i = 0, s = 0;;
uint64_t i = 0, s = 0, t = 0;
wchar_t *fn = hdc[id].fn;
memset(empty_sector, 0, sizeof(empty_sector));
@@ -423,15 +426,35 @@ scsi_hd_load_error:
}
fseeko64(shdf[id], 0, SEEK_END);
if (ftello64(shdf[id]) != (full_size + shdc[id].base))
if (ftello64(shdf[id]) < (full_size + shdc[id].base))
{
s = (full_size + shdc[id].base) - ftello64(shdf[id]);
prepare_new_hard_disk:
s >>= 9;
for (i = 0; i < s; i++)
t = (s >> 11) << 11;
s -= t;
t >>= 11;
empty_sector_1mb = (char *) malloc(1048576);
memset(empty_sector_1mb, 0, 1048576);
if (s > 0)
{
fwrite(empty_sector, 1, 512, shdf[id]);
for (i = 0; i < s; i++)
{
fwrite(empty_sector, 1, 512, shdf[id]);
}
}
if (t > 0)
{
for (i = 0; i < t; i++)
{
fwrite(empty_sector_1mb, 1, 1045876, shdf[id]);
}
}
free(empty_sector_1mb);
}
shdc[id].last_sector = (uint32_t) (full_size >> 9) - 1;
@@ -447,7 +470,7 @@ void scsi_reloadhd(int id)
uint64_t full_size = 0;
uint64_t spt = 0, hpc = 0, tracks = 0;
int c;
uint64_t i = 0, s = 0;;
uint64_t i = 0, s = 0, t = 0;
wchar_t *fn = hdc[id].fn;
memset(empty_sector, 0, sizeof(empty_sector));
@@ -627,15 +650,35 @@ scsi_hd_reload_error:
}
fseeko64(shdf[id], 0, SEEK_END);
if (ftello64(shdf[id]) != (full_size + shdc[id].base))
if (ftello64(shdf[id]) < (full_size + shdc[id].base))
{
s = (full_size + shdc[id].base) - ftello64(shdf[id]);
reload_prepare_new_hard_disk:
s >>= 9;
for (i = 0; i < s; i++)
t = (s >> 11) << 11;
s -= t;
t >>= 11;
empty_sector_1mb = (char *) malloc(1048576);
memset(empty_sector_1mb, 0, 1048576);
if (s > 0)
{
fwrite(empty_sector, 1, 512, shdf[id]);
for (i = 0; i < s; i++)
{
fwrite(empty_sector, 1, 512, shdf[id]);
}
}
if (t > 0)
{
for (i = 0; i < t; i++)
{
fwrite(empty_sector_1mb, 1, 1045876, shdf[id]);
}
}
free(empty_sector_1mb);
}
shdc[id].last_sector = (uint32_t) (full_size >> 9) - 1;
@@ -874,24 +917,6 @@ static void scsi_hd_not_ready(uint8_t id)
scsi_hd_cmd_error(id);
}
#if 0
static void scsi_hd_icmd_required(uint8_t id)
{
scsi_hd_sense_key = SENSE_NOT_READY;
scsi_hd_asc = ASC_NOT_READY;
scsi_hd_ascq = ASCQ_INITIALIZING_COMMAND_REQUIRED;
scsi_hd_cmd_error(id);
}
static void scsi_hd_capacity_data_changed(uint8_t id)
{
scsi_hd_sense_key = SENSE_UNIT_ATTENTION;
scsi_hd_asc = ASC_CAPACITY_DATA_CHANGED;
scsi_hd_ascq = ASCQ_CAPACITY_DATA_CHANGED;
scsi_hd_cmd_error(id);
}
#endif
static void scsi_hd_write_protected(uint8_t id)
{
scsi_hd_sense_key = SENSE_UNIT_ATTENTION;
@@ -1166,11 +1191,10 @@ void scsi_hd_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_l
scsi_hd_request_sense(id, buffer, alloc_length);
}
int scsi_hd_read_from_dma(uint8_t id);
void scsi_hd_command(uint8_t id, uint8_t *cdb)
{
uint8_t *hdbufferb = (uint8_t *) shdc[id].buffer;
/* uint8_t *hdbufferb = (uint8_t *) shdc[id].buffer; */
uint8_t *hdbufferb = SCSIDevices[hdc[id].scsi_id][hdc[id].scsi_lun].CmdBuffer;
uint32_t len;
int pos=0;
int max_len;
@@ -1362,8 +1386,6 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
max_len = shdc[id].sector_len;
shdc[id].requested_blocks = max_len;
scsi_hd_read_from_dma(id);
pos64 = (uint64_t) shdc[id].sector_pos;
if (shdc[id].requested_blocks > 0)
@@ -1545,72 +1567,6 @@ atapi_out:
void scsi_hd_callback(uint8_t id);
int scsi_hd_read_from_scsi_dma(uint8_t scsi_id, uint8_t scsi_lun)
{
uint8_t *hdbufferb;
uint8_t id = scsi_hard_disks[scsi_id][scsi_lun];
hdbufferb = (uint8_t *) shdc[id].buffer;
if (id > HDC_NUM)
{
return 0;
}
scsi_hd_log("Reading from SCSI DMA: SCSI ID %02X, init length %i\n", scsi_id, SCSIDevices[scsi_id][scsi_lun].InitLength);
memcpy(hdbufferb, SCSIDevices[scsi_id][scsi_lun].CmdBuffer, SCSIDevices[scsi_id][scsi_lun].InitLength);
return 1;
}
int scsi_hd_read_from_dma(uint8_t id)
{
int ret = 0;
ret = scsi_hd_read_from_scsi_dma(hdc[id].scsi_id, hdc[id].scsi_lun);
if (!ret)
{
return 0;
}
return 0;
}
int scsi_hd_write_to_scsi_dma(uint8_t scsi_id, uint8_t scsi_lun)
{
uint8_t *hdbufferb;
uint8_t id = scsi_hard_disks[scsi_id][scsi_lun];
if (id > HDC_NUM)
{
return 0;
}
hdbufferb = (uint8_t *) shdc[id].buffer;
scsi_hd_log("Writing to SCSI DMA: SCSI ID %02X, init length %i\n", scsi_id, SCSIDevices[scsi_id][scsi_lun].InitLength);
memcpy(SCSIDevices[scsi_id][scsi_lun].CmdBuffer, hdbufferb, SCSIDevices[scsi_id][scsi_lun].InitLength);
scsi_hd_log("SCSI HD %i: Data from HD buffer: %02X %02X %02X %02X %02X %02X %02X %02X\n", id, hdbufferb[0], hdbufferb[1], hdbufferb[2], hdbufferb[3], hdbufferb[4], hdbufferb[5], hdbufferb[6], hdbufferb[7]);
scsi_hd_log("SCSI HD %i: Data from SCSI DMA : %02X %02X %02X %02X %02X %02X %02X %02X\n", id, SCSIDevices[scsi_id][scsi_lun].CmdBuffer[0], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[1], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[2], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[3], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[4], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[5], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[6], SCSIDevices[scsi_id][scsi_lun].CmdBuffer[7]);
return 1;
}
int scsi_hd_write_to_dma(uint8_t id)
{
int ret = 0;
ret = scsi_hd_write_to_scsi_dma(hdc[id].scsi_id, hdc[id].scsi_lun);
if (!ret)
{
return 0;
}
return 1;
}
/* If the result is 1, issue an IRQ, otherwise not. */
void scsi_hd_callback(uint8_t id)
{
@@ -1622,12 +1578,6 @@ void scsi_hd_callback(uint8_t id)
shdc[id].phase = 1;
shdc[id].status = READY_STAT | DRQ_STAT | (shdc[id].status & ERR_STAT);
return;
case CDROM_PHASE_COMMAND:
scsi_hd_log("SCSI HD %i: PHASE_COMMAND\n", id);
shdc[id].status = BUSY_STAT | (shdc[id].status &ERR_STAT);
memcpy(shdc[id].hd_cdb, (uint8_t *) shdc[id].buffer, shdc[id].cdb_len);
scsi_hd_command(id, shdc[id].hd_cdb);
return;
case CDROM_PHASE_COMPLETE:
scsi_hd_log("SCSI HD %i: PHASE_COMPLETE\n", id);
shdc[id].status = READY_STAT;
@@ -1642,7 +1592,6 @@ void scsi_hd_callback(uint8_t id)
return;
case CDROM_PHASE_DATA_OUT_DMA:
scsi_hd_log("SCSI HD %i: PHASE_DATA_OUT_DMA\n", id);
scsi_hd_read_from_dma(id);
shdc[id].packet_status = CDROM_PHASE_COMPLETE;
shdc[id].status = READY_STAT;
shdc[id].phase = 3;
@@ -1655,7 +1604,6 @@ void scsi_hd_callback(uint8_t id)
return;
case CDROM_PHASE_DATA_IN_DMA:
scsi_hd_log("SCSI HD %i: PHASE_DATA_IN_DMA\n", id);
scsi_hd_write_to_dma(id);
shdc[id].packet_status = CDROM_PHASE_COMPLETE;
shdc[id].status = READY_STAT;
shdc[id].phase = 3;

View File

@@ -20,7 +20,6 @@ typedef struct {
uint8_t sense[256];
uint8_t previous_command;
uint8_t error;
uint16_t buffer[390144];
uint32_t sector_pos;
uint32_t sector_len;
uint32_t last_sector;
@@ -41,3 +40,5 @@ extern void scsi_disk_insert(uint8_t id);
extern void scsi_loadhd(int scsi_id, int scsi_lun, int id);
extern void scsi_reloadhd(int id);
extern void scsi_unloadhd(int scsi_id, int scsi_lun, int id);
extern FILE *shdf[HDC_NUM];