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.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic,Kiririn (translation to C and port to 86Box)
|
||||
/* license:BSD-3-Clause
|
||||
copyright-holders:Miodrag Milanovic,Kiririn (translation to C and port to 86Box) */
|
||||
/*********************************************************************
|
||||
|
||||
formats/td0_dsk.c
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define BUFSZ 512 // new input buffer
|
||||
#define BUFSZ 512 /* new input buffer */
|
||||
|
||||
/* LZSS Parameters */
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
|
||||
typedef struct {
|
||||
uint16_t r,
|
||||
bufcnt,bufndx,bufpos, // string buffer
|
||||
// the following to allow block reads from input in next_word()
|
||||
ibufcnt,ibufndx; // input buffer counters
|
||||
uint8_t inbuf[BUFSZ]; // input buffer
|
||||
bufcnt,bufndx,bufpos, /* string buffer */
|
||||
/* the following to allow block reads from input in next_word() */
|
||||
ibufcnt,ibufndx; /* input buffer counters */
|
||||
uint8_t inbuf[BUFSZ]; /* input buffer */
|
||||
} tdlzhuf;
|
||||
|
||||
typedef struct
|
||||
@@ -72,8 +72,6 @@ typedef struct
|
||||
uint8_t getlen;
|
||||
} td0dsk_t;
|
||||
|
||||
//static td0dsk_t td0dsk;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t track;
|
||||
@@ -118,7 +116,7 @@ void floppy_image_read(int drive, char *buffer, uint32_t offset, uint32_t len)
|
||||
|
||||
int td0_dsk_identify(int drive)
|
||||
{
|
||||
uint8_t header[2];
|
||||
char header[2];
|
||||
|
||||
floppy_image_read(drive, header, 0, 2);
|
||||
if (header[0]=='T' && header[1]=='D') {
|
||||
@@ -230,7 +228,7 @@ int td0_state_next_word(td0dsk_t *state)
|
||||
if(state->tdctl.ibufcnt == 0)
|
||||
return(-1);
|
||||
}
|
||||
while (state->getlen <= 8) { // typically reads a word at a time
|
||||
while (state->getlen <= 8) { /* typically reads a word at a time */
|
||||
state->getbuf |= state->tdctl.inbuf[state->tdctl.ibufndx++] << (8 - state->getlen);
|
||||
state->getlen += 8;
|
||||
}
|
||||
@@ -427,7 +425,7 @@ void td0_state_init_Decode(td0dsk_t *state)
|
||||
int i;
|
||||
state->getbuf = 0;
|
||||
state->getlen = 0;
|
||||
state->tdctl.ibufcnt= state->tdctl.ibufndx = 0; // input buffer is empty
|
||||
state->tdctl.ibufcnt= state->tdctl.ibufndx = 0; /* input buffer is empty */
|
||||
state->tdctl.bufcnt = 0;
|
||||
td0_state_StartHuff(state);
|
||||
for (i = 0; i < N - F; i++)
|
||||
@@ -439,11 +437,11 @@ void td0_state_init_Decode(td0dsk_t *state)
|
||||
int td0_state_Decode(td0dsk_t *state, uint8_t *buf, int len) /* Decoding/Uncompressing */
|
||||
{
|
||||
int16_t c,pos;
|
||||
int count; // was an unsigned long, seems unnecessary
|
||||
int count; /* was an unsigned long, seems unnecessary */
|
||||
for (count = 0; count < len; ) {
|
||||
if(state->tdctl.bufcnt == 0) {
|
||||
if((c = td0_state_DecodeChar(state)) < 0)
|
||||
return(count); // fatal error
|
||||
return(count); /* fatal error */
|
||||
if (c < 256) {
|
||||
*(buf++) = c;
|
||||
state->text_buf[state->tdctl.r++] = c;
|
||||
@@ -452,13 +450,13 @@ int td0_state_Decode(td0dsk_t *state, uint8_t *buf, int len) /* Decoding/Uncomp
|
||||
}
|
||||
else {
|
||||
if((pos = td0_state_DecodePosition(state)) < 0)
|
||||
return(count); // fatal error
|
||||
return(count); /* fatal error */
|
||||
state->tdctl.bufpos = (state->tdctl.r - pos - 1) & (N - 1);
|
||||
state->tdctl.bufcnt = c - 255 + THRESHOLD;
|
||||
state->tdctl.bufndx = 0;
|
||||
}
|
||||
}
|
||||
else { // still chars from last string
|
||||
else { /* still chars from last string */
|
||||
while( state->tdctl.bufndx < state->tdctl.bufcnt && count < len ) {
|
||||
c = state->text_buf[(state->tdctl.bufpos + state->tdctl.bufndx) & (N - 1)];
|
||||
*(buf++) = c;
|
||||
@@ -467,12 +465,12 @@ int td0_state_Decode(td0dsk_t *state, uint8_t *buf, int len) /* Decoding/Uncomp
|
||||
state->tdctl.r &= (N - 1);
|
||||
count++;
|
||||
}
|
||||
// reset bufcnt after copy string from text_buf[]
|
||||
/* reset bufcnt after copy string from text_buf[] */
|
||||
if(state->tdctl.bufndx >= state->tdctl.bufcnt)
|
||||
state->tdctl.bufndx = state->tdctl.bufcnt = 0;
|
||||
}
|
||||
}
|
||||
return(count); // count == len, success
|
||||
return(count); /* count == len, success */
|
||||
}
|
||||
|
||||
|
||||
@@ -495,8 +493,7 @@ void td0_init()
|
||||
|
||||
void d86f_register_td0(int drive);
|
||||
|
||||
// static const int rates[3] = { 2, 1, 0, 2, 3 }; /* 0 = 250 kbps, 1 = 300 kbps, 2 = 500 kbps, 3 = unknown, 4 = 1000 kbps */
|
||||
const int max_size = 4*1024*1024; // 4MB ought to be large enough for any floppy
|
||||
const int max_size = 4*1024*1024; /* 4MB ought to be large enough for any floppy */
|
||||
const int max_processed_size = 5*1024*1024;
|
||||
uint8_t imagebuf[4*1024*1024];
|
||||
uint8_t processed_buf[5*1024*1024];
|
||||
@@ -632,12 +629,10 @@ int td0_initialize(int drive)
|
||||
int head_count = 0;
|
||||
int track_spt;
|
||||
int offset = 0;
|
||||
int ret = 0;
|
||||
int gap3_len = 0;
|
||||
// int rate = 0;
|
||||
int density = 0;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
int temp_rate = 0;
|
||||
uint32_t file_size;
|
||||
uint16_t len;
|
||||
@@ -651,7 +646,6 @@ int td0_initialize(int drive)
|
||||
uint32_t track_size = 0;
|
||||
uint32_t raw_tsize = 0;
|
||||
uint32_t minimum_gap3 = 0;
|
||||
// uint32_t minimum_gap4 = 12;
|
||||
uint32_t minimum_gap4 = 0;
|
||||
|
||||
if (!td0[drive].f)
|
||||
@@ -698,7 +692,7 @@ int td0_initialize(int drive)
|
||||
offset = 10 + imagebuf[2] + (imagebuf[3] << 8);
|
||||
|
||||
track_spt = imagebuf[offset];
|
||||
if(track_spt == 255) // Empty file?
|
||||
if(track_spt == 255) /* Empty file? */
|
||||
{
|
||||
pclog("TD0: File has no tracks\n");
|
||||
return 0;
|
||||
@@ -738,9 +732,6 @@ int td0_initialize(int drive)
|
||||
|
||||
td0[drive].track_width = (header[7] & 1) ^ 1;
|
||||
|
||||
// rate = (header[5] & 0x7f) >= 3 ? 0 : rates[header[5] & 0x7f];
|
||||
// td0[drive].default_track_flags |= rate;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
memset(td0[drive].side_flags[i], 0, 4);
|
||||
@@ -756,7 +747,7 @@ int td0_initialize(int drive)
|
||||
{
|
||||
track = imagebuf[offset + 1];
|
||||
head = imagebuf[offset + 2] & 1;
|
||||
fm = (header[5] & 0x80) || (imagebuf[offset + 2] & 0x80); // ?
|
||||
fm = (header[5] & 0x80) || (imagebuf[offset + 2] & 0x80); /* ? */
|
||||
td0[drive].side_flags[track][head] = td0[drive].default_track_flags | (fm ? 0 : 8);
|
||||
td0[drive].track_in_file[track][head] = 1;
|
||||
offset += 4;
|
||||
@@ -766,7 +757,6 @@ int td0_initialize(int drive)
|
||||
for(i = 0; i < track_spt; i++)
|
||||
{
|
||||
hs = &imagebuf[offset];
|
||||
size;
|
||||
offset += 6;
|
||||
|
||||
td0[drive].sects[track][head][i].track = hs[0];
|
||||
@@ -792,7 +782,6 @@ int td0_initialize(int drive)
|
||||
else
|
||||
{
|
||||
offset += 3;
|
||||
int j, k;
|
||||
switch(hs[8])
|
||||
{
|
||||
default:
|
||||
@@ -890,7 +879,6 @@ int td0_initialize(int drive)
|
||||
temp_rate = td0[drive].default_track_flags & 7;
|
||||
if ((td0[drive].default_track_flags & 0x27) == 0x20) temp_rate = 4;
|
||||
td0[drive].gap3_len = gap3_sizes[temp_rate][td0[drive].sects[0][0][0].size][td0[drive].track_spt[0][0]];
|
||||
// pclog("GAP3 length for %i %i %i is %i\n", temp_rate, td0[drive].sects[0][0][0].size, td0[drive].track_spt[0][0], td0[drive].gap3_len);
|
||||
if (!td0[drive].gap3_len)
|
||||
{
|
||||
td0[drive].gap3_len = td0[drive].calculated_gap3_lengths[0][0]; /* If we can't determine the GAP3 length, assume the smallest one we possibly know of. */
|
||||
@@ -968,12 +956,10 @@ int td0_track_is_xdf(int drive, int side, int track)
|
||||
td0[drive].current_side_flags[side] = (td0[drive].track_spt[track][side] == 19) ? 0x08 : 0x28;
|
||||
return (td0[drive].track_spt[track][side] == 19) ? 2 : 1;
|
||||
}
|
||||
// pclog("XDF: %i %i %i %i\n", high_sectors, expected_high_count, low_sectors, expected_low_count);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// pclog("XDF: %i sectors per track (%i %i)\n", td0[drive].track_spt[track][side], track, side);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -996,7 +982,6 @@ int td0_track_is_xdf(int drive, int side, int track)
|
||||
td0[drive].xdf_ordered_pos[id[2]][side] = i;
|
||||
}
|
||||
}
|
||||
// pclog("XDF: %i %i\n", effective_sectors, xdf_sectors);
|
||||
if ((effective_sectors == 3) && (xdf_sectors == 3))
|
||||
{
|
||||
td0[drive].current_side_flags[side] = 0x28;
|
||||
@@ -1087,8 +1072,6 @@ void td0_seek(int drive, int track)
|
||||
td0[drive].current_side_flags[0] = td0[drive].side_flags[track][0];
|
||||
td0[drive].current_side_flags[1] = td0[drive].side_flags[track][1];
|
||||
|
||||
// pclog("TD0 Seek: %02X %02X (%02X)\n", td0[drive].current_side_flags[0], td0[drive].current_side_flags[1], td0[drive].disk_flags);
|
||||
|
||||
d86f_reset_index_hole_pos(drive, 0);
|
||||
d86f_reset_index_hole_pos(drive, 1);
|
||||
|
||||
@@ -1128,7 +1111,6 @@ void td0_seek(int drive, int track)
|
||||
id[1] = td0[drive].sects[track][side][actual_sector].head;
|
||||
id[2] = real_sector;
|
||||
id[3] = td0[drive].sects[track][side][actual_sector].size;
|
||||
// pclog("TD0: %i %i %i %i (%i %i) (GPL=%i)\n", id[0], id[1], id[2], id[3], td0[drive].sects[track][side][actual_sector].deleted, td0[drive].sects[track][side][actual_sector].bad_crc, track_gap3);
|
||||
ssize = 128 << ((uint32_t) td0[drive].sects[track][side][actual_sector].size);
|
||||
current_pos = d86f_prepare_sector(drive, side, current_pos, id, td0[drive].sects[track][side][actual_sector].data, ssize, track_gap2, track_gap3, td0[drive].sects[track][side][actual_sector].deleted, td0[drive].sects[track][side][actual_sector].bad_crc);
|
||||
}
|
||||
@@ -1146,7 +1128,6 @@ void td0_seek(int drive, int track)
|
||||
id[3] = is_trackx ? (id[2] & 7) : 2;
|
||||
ssize = 128 << ((uint32_t) id[3]);
|
||||
ordered_pos = td0[drive].xdf_ordered_pos[id[2]][side];
|
||||
// pclog("TD0: XDF: (%i %i) %i %i %i %i (%i %i) (GPL=%i)\n", track, side, id[0], id[1], id[2], id[3], td0[drive].sects[track][side][ordered_pos].deleted, td0[drive].sects[track][side][ordered_pos].bad_crc, track_gap3);
|
||||
if (is_trackx)
|
||||
{
|
||||
current_pos = d86f_prepare_sector(drive, side, xdf_trackx_spos[xdf_type][xdf_sector], id, td0[drive].sects[track][side][ordered_pos].data, ssize, track_gap2, xdf_gap3_sizes[xdf_type][is_trackx], td0[drive].sects[track][side][ordered_pos].deleted, td0[drive].sects[track][side][ordered_pos].bad_crc);
|
||||
@@ -1158,8 +1139,6 @@ void td0_seek(int drive, int track)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pclog("Seeked to track: %i (%02X, %02X)\n", td0[drive].track, td0[drive].current_side_flags[0], td0[drive].current_side_flags[1]);
|
||||
}
|
||||
|
||||
uint16_t td0_disk_flags(int drive)
|
||||
@@ -1208,4 +1187,4 @@ void d86f_register_td0(int drive)
|
||||
d86f_handler[drive].index_hole_pos = null_index_hole_pos;
|
||||
d86f_handler[drive].get_raw_size = common_get_raw_size;
|
||||
d86f_handler[drive].check_crc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user