More sonarlint work

This commit is contained in:
Jasmine Iwanek
2023-06-09 23:46:54 -04:00
parent 0d1d069af4
commit ee695e71f9
218 changed files with 6282 additions and 3845 deletions

View File

@@ -1144,9 +1144,9 @@ pc_reset_hard_init(void)
void
update_mouse_msg(void)
{
wchar_t wcpufamily[2048];
wchar_t wcpu[2048];
wchar_t wmachine[2048];
wchar_t wcpufamily[2048];
wchar_t wcpu[2048];
wchar_t wmachine[2048];
wchar_t *wcp;
mbstowcs(wmachine, machine_getname(), strlen(machine_getname()) + 1);
@@ -1185,7 +1185,7 @@ pc_reset_hard(void)
}
void
pc_close(thread_t *ptr)
pc_close(UNUSED(thread_t *ptr))
{
/* Wait a while so things can shut down. */
plat_delay_ms(200);

View File

@@ -1694,7 +1694,7 @@ acpi_init(const device_t *info)
dev = (acpi_t *) malloc(sizeof(acpi_t));
if (dev == NULL)
return (NULL);
return NULL;
memset(dev, 0x00, sizeof(acpi_t));
cpu_to_acpi = ACPI_TIMER_FREQ / cpuclock;

View File

@@ -102,9 +102,8 @@ apm_close(void *priv)
free(dev);
}
static void
*
apm_init(const device_t *info)
static void *
apm_init(const device_t *info)
{
apm_t *dev = (apm_t *) malloc(sizeof(apm_t));
memset(dev, 0, sizeof(apm_t));

View File

@@ -163,7 +163,7 @@ cdrom_interface_get_from_internal_name(char *s)
int c = 0;
while (controllers[c].device != NULL) {
if (!strcmp((char *) controllers[c].device->internal_name, s))
if (!strcmp(controllers[c].device->internal_name, s))
return c;
c++;
}

View File

@@ -652,7 +652,7 @@ cdi_cue_get_buffer(char *str, char **line, int up)
done = 1;
break;
}
/*FALLTHROUGH*/
[[fallthrough]];
default:
if (up && islower((int) *s))
@@ -787,7 +787,7 @@ cdi_add_track(cd_img_t *cdi, track_t *cur, uint64_t *shift, uint64_t prestart, u
*total_pregap += cur_pregap;
cur->start += *total_pregap;
} else {
temp = prev->file->get_length(prev->file) - ((uint64_t) prev->skip);
temp = prev->file->get_length(prev->file) - (prev->skip);
prev->length = temp / ((uint64_t) prev->sector_size);
if ((temp % prev->sector_size) != 0)
prev->length++;

View File

@@ -324,6 +324,7 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
break;
case 5:
dev->readmsf = 0;
[[fallthrough]];
case 4:
case 3:
dev->readmsf |= CD_DCB(val) << ((dev->cmdrd_count - 3) << 3);

View File

@@ -286,7 +286,7 @@ mem_read_emsb(uint32_t addr, void *priv)
addr = addr - page->virt + page->phys;
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
ret = ram[addr];
ct_82c100_log("mem_read_emsb(%08X = %08X): %02X\n", old_addr, addr, ret);
@@ -305,7 +305,7 @@ mem_read_emsw(uint32_t addr, void *priv)
addr = addr - page->virt + page->phys;
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
ret = *(uint16_t *) &ram[addr];
ct_82c100_log("mem_read_emsw(%08X = %08X): %04X\n", old_addr, addr, ret);
@@ -323,7 +323,7 @@ mem_write_emsb(uint32_t addr, uint8_t val, void *priv)
addr = addr - page->virt + page->phys;
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
ram[addr] = val;
ct_82c100_log("mem_write_emsb(%08X = %08X, %02X)\n", old_addr, addr, val);
@@ -339,7 +339,7 @@ mem_write_emsw(uint32_t addr, uint16_t val, void *priv)
addr = addr - page->virt + page->phys;
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
*(uint16_t *) &ram[addr] = val;
ct_82c100_log("mem_write_emsw(%08X = %08X, %04X)\n", old_addr, addr, val);

View File

@@ -108,7 +108,7 @@ ali1621_smram_recalc(uint8_t val, ali1621_t *dev)
switch (val & 0x30) {
case 0x10: /* Open. */
access_normal = ACCESS_SMRAM_RX;
/* FALLTHROUGH */
[[fallthrough]];
case 0x30: /* Protect. */
access_smm |= ACCESS_SMRAM_R;
break;
@@ -121,7 +121,7 @@ ali1621_smram_recalc(uint8_t val, ali1621_t *dev)
switch (val & 0x30) {
case 0x10: /* Open. */
access_normal |= ACCESS_SMRAM_W;
/* FALLTHROUGH */
[[fallthrough]];
case 0x30: /* Protect. */
access_smm |= ACCESS_SMRAM_W;
break;

View File

@@ -233,7 +233,7 @@ ali6117_reg_write(uint16_t addr, uint8_t val, void *priv)
case 0x12:
val &= 0xf7;
/* FALL-THROUGH */
[[fallthrough]];
case 0x14:
case 0x15:

View File

@@ -165,7 +165,7 @@ get_addr(headland_t *dev, uint32_t addr, headland_mr_t *mr)
static void
hl_ems_disable(headland_t *dev, uint8_t mar, uint32_t base_addr, uint8_t indx)
{
if (base_addr < ((uint32_t) mem_size << 10))
if (base_addr < (mem_size << 10))
mem_mapping_set_exec(&dev->ems_mapping[mar & 0x3f], ram + base_addr);
else
mem_mapping_set_exec(&dev->ems_mapping[mar & 0x3f], NULL);
@@ -197,7 +197,7 @@ hl_ems_update(headland_t *dev, uint8_t mar)
dev->ems_mr[mar & 0x3f].virt_base = virt_addr;
if (indx < 24)
mem_mapping_disable(&dev->upper_mapping[indx]);
if (virt_addr < ((uint32_t) mem_size << 10))
if (virt_addr < (mem_size << 10))
mem_mapping_set_exec(&dev->ems_mapping[mar & 0x3f], ram + virt_addr);
else
mem_mapping_set_exec(&dev->ems_mapping[mar & 0x3f], NULL);
@@ -244,7 +244,7 @@ memmap_state_update(headland_t *dev)
for (uint8_t i = 0; i < 24; i++) {
addr = get_addr(dev, 0x40000 + (i << 14), NULL);
mem_mapping_set_exec(&dev->upper_mapping[i], addr < ((uint32_t) mem_size << 10) ? ram + addr : NULL);
mem_mapping_set_exec(&dev->upper_mapping[i], addr < (mem_size << 10) ? ram + addr : NULL);
}
memmap_state_default(dev, ht_romcs);
@@ -513,7 +513,7 @@ mem_read_b(uint32_t addr, void *priv)
uint8_t ret = 0xff;
addr = get_addr(dev, addr, mr);
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
ret = ram[addr];
return ret;
@@ -527,7 +527,7 @@ mem_read_w(uint32_t addr, void *priv)
uint16_t ret = 0xffff;
addr = get_addr(dev, addr, mr);
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
ret = *(uint16_t *) &ram[addr];
return ret;
@@ -541,7 +541,7 @@ mem_read_l(uint32_t addr, void *priv)
uint32_t ret = 0xffffffff;
addr = get_addr(dev, addr, mr);
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
ret = *(uint32_t *) &ram[addr];
return ret;
@@ -554,7 +554,7 @@ mem_write_b(uint32_t addr, uint8_t val, void *priv)
headland_t *dev = mr->headland;
addr = get_addr(dev, addr, mr);
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
ram[addr] = val;
}
@@ -565,7 +565,7 @@ mem_write_w(uint32_t addr, uint16_t val, void *priv)
headland_t *dev = mr->headland;
addr = get_addr(dev, addr, mr);
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
*(uint16_t *) &ram[addr] = val;
}
@@ -576,7 +576,7 @@ mem_write_l(uint32_t addr, uint32_t val, void *priv)
headland_t *dev = mr->headland;
addr = get_addr(dev, addr, mr);
if (addr < ((uint32_t) mem_size << 10))
if (addr < (mem_size << 10))
*(uint32_t *) &ram[addr] = val;
}

View File

@@ -165,15 +165,14 @@ i420ex_smram_handler_phase1(i420ex_t *dev)
static void
i420ex_drb_recalc(i420ex_t *dev)
{
int i;
uint32_t boundary;
for (i = 4; i >= 0; i--)
for (uint8_t i = 4; i >= 0; i--)
row_disable(i);
for (i = 0; i <= 4; i++) {
boundary = ((uint32_t) dev->regs[0x60 + i]) & 0xff;
row_set_boundary(i, boundary);
for (uint8_t i = 0; i <= 4; i++) {
boundary = ((uint32_t) dev->regs[0x60 + i]) & 0xff;
row_set_boundary(i, boundary);
}
flushmmucache();

View File

@@ -1068,6 +1068,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
case INTEL_440ZX:
case INTEL_440GX:
regs[addr] = val;
break;
default:
break;
}
@@ -1077,6 +1079,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
case INTEL_440BX:
case INTEL_440ZX:
regs[0x77] = val & 0x03;
break;
default:
break;
}

View File

@@ -228,7 +228,7 @@ opti283_write(uint16_t addr, uint8_t val, void *priv)
case 0x14:
reset_on_hlt = !!(val & 0x40);
/* FALLTHROUGH */
[[fallthrough]];
case 0x11:
case 0x12:
case 0x13:

View File

@@ -638,6 +638,7 @@ pci_isa_bridge_write(int func, int addr, uint8_t val, void *priv)
break;
}
sis_5571_log("SiS5571-USB: dev->pci_conf[%02x] = %02x\n", addr, val);
break;
default:
break;

View File

@@ -1474,7 +1474,7 @@ pipc_write(int func, int addr, uint8_t val, void *priv)
case 0xd2:
if (dev->local == VIA_PIPC_686B)
smbus_piix4_setclock(dev->smbus, (val & 0x04) ? 65536 : 16384);
/* fall-through */
[[fallthrough]];
case 0x90:
case 0x91:

View File

@@ -448,7 +448,7 @@ load_machine(void)
cpu_f = cpu_get_family(legacy_table_entry->family);
if (cpu_f) {
/* Save the new values. */
ini_section_set_string(cat, "cpu_family", (char *) legacy_table_entry->family);
ini_section_set_string(cat, "cpu_family", legacy_table_entry->family);
ini_section_set_int(cat, "cpu_speed", legacy_table_entry->rspeed);
ini_section_set_double(cat, "cpu_multi", legacy_table_entry->multi);
}
@@ -500,7 +500,7 @@ load_machine(void)
cpu_waitstates = ini_section_get_int(cat, "cpu_waitstates", 0);
p = (char *) ini_section_get_string(cat, "fpu_type", "none");
p = ini_section_get_string(cat, "fpu_type", "none");
fpu_type = fpu_get_type(cpu_f, cpu, p);
mem_size = ini_section_get_int(cat, "mem_size", 64);
@@ -911,7 +911,7 @@ load_ports(void)
lpt_ports[c].enabled = !!ini_section_get_int(cat, temp, (c == 0) ? 1 : 0);
sprintf(temp, "lpt%d_device", c + 1);
p = (char *) ini_section_get_string(cat, temp, "none");
p = ini_section_get_string(cat, temp, "none");
lpt_ports[c].device = lpt_device_get_from_internal_name(p);
}
@@ -2226,7 +2226,7 @@ save_machine(void)
p = machine_get_internal_name();
ini_section_set_string(cat, "machine", p);
ini_section_set_string(cat, "cpu_family", (char *) cpu_f->internal_name);
ini_section_set_string(cat, "cpu_family", cpu_f->internal_name);
ini_section_set_int(cat, "cpu_speed", cpu_f->cpus[cpu].rspeed);
ini_section_set_double(cat, "cpu_multi", cpu_f->cpus[cpu].multi);
if (cpu_override)
@@ -2254,7 +2254,7 @@ save_machine(void)
i = 0;
while (cpu_legacy_table[c].tables[legacy_mfg][i].family) {
legacy_table_entry = (cpu_legacy_table_t *) &cpu_legacy_table[c].tables[legacy_mfg][i];
legacy_table_entry = &cpu_legacy_table[c].tables[legacy_mfg][i];
/* Match the family name, speed and multiplier. */
if (!strcmp(cpu_f->internal_name, legacy_table_entry->family)) {
@@ -2294,7 +2294,7 @@ save_machine(void)
if (fpu_type == 0)
ini_section_delete_var(cat, "fpu_type");
else
ini_section_set_string(cat, "fpu_type", (char *) fpu_get_internal_name(cpu_f, cpu, fpu_type));
ini_section_set_string(cat, "fpu_type", fpu_get_internal_name(cpu_f, cpu, fpu_type));
// Write the mem_size explicitly to the setttings in order to help managers to display it without having the actual machine table
ini_section_delete_var(cat, "mem_size");
@@ -2613,7 +2613,7 @@ save_ports(void)
ini_section_delete_var(cat, temp);
else
ini_section_set_string(cat, temp,
(char *) lpt_device_get_internal_name(lpt_ports[c].device));
lpt_device_get_internal_name(lpt_ports[c].device));
}
ini_delete_section_if_empty(config, cat);
@@ -2738,7 +2738,7 @@ save_other_peripherals(void)
ini_section_delete_var(cat, temp);
else
ini_section_set_string(cat, temp,
(char *) isamem_get_internal_name(isamem_type[c]));
isamem_get_internal_name(isamem_type[c]));
}
if (isartc_type == 0)
@@ -2836,7 +2836,7 @@ save_hard_disks(void)
if (!hdd_is_valid(c) || (hdd[c].bus != HDD_BUS_IDE && hdd[c].bus != HDD_BUS_ESDI))
ini_section_delete_var(cat, temp);
else
ini_section_set_string(cat, temp, (char *) hdd_preset_get_internal_name(hdd[c].speed_preset));
ini_section_set_string(cat, temp, hdd_preset_get_internal_name(hdd[c].speed_preset));
}
ini_delete_section_if_empty(config, cat);

View File

@@ -133,13 +133,13 @@ enum {
# define LOOKUP_INV -1
#endif
typedef struct {
typedef struct fpu_t {
const char *name;
const char *internal_name;
const int type;
} FPU;
typedef struct {
typedef struct cpu_t {
const char *name;
uint64_t cpu_type;
const FPU *fpus;

View File

@@ -60,7 +60,7 @@ ddma_reg_read(uint16_t addr, void *priv)
ddma_channel_t *dev = (ddma_channel_t *) priv;
uint8_t ret = 0xff;
int ch = dev->channel;
int dmab = (ch >= 4) ? 0xc0 : 0x00;
uint8_t dmab = (ch >= 4) ? 0xc0 : 0x00;
switch (addr & 0x0f) {
case 0x00:
@@ -94,8 +94,8 @@ ddma_reg_write(uint16_t addr, uint8_t val, void *priv)
{
ddma_channel_t *dev = (ddma_channel_t *) priv;
int ch = dev->channel;
int page_regs[4] = { 7, 3, 1, 2 };
int dmab = (ch >= 4) ? 0xc0 : 0x00;
uint8_t page_regs[4] = { 7, 3, 1, 2 };
uint8_t dmab = (ch >= 4) ? 0xc0 : 0x00;
switch (addr & 0x0f) {
case 0x00:

View File

@@ -143,7 +143,7 @@ device_add_common(const device_t *dev, const device_t *cd, void *p, void *params
int c;
for (c = 0; c < 256; c++) {
if (!inst && (devices[c] == (device_t *) dev)) {
if (!inst && (devices[c] == dev)) {
device_log("DEVICE: device already exists!\n");
return (NULL);
}
@@ -349,7 +349,7 @@ device_available(const device_t *dev)
int i = 0;
if (dev != NULL) {
config = (device_config_t *) dev->config;
config = dev->config;
if (config != NULL) {
while (config->type != -1) {
if (config->type == CONFIG_BIOS) {
@@ -359,7 +359,7 @@ device_available(const device_t *dev)
while (bios->files_no != 0) {
i = 0;
for (int bf = 0; bf < bios->files_no; bf++)
i += !!rom_present((char *) bios->files[bf]);
i += !!rom_present(bios->files[bf]);
if (i == bios->files_no)
roms_present++;
bios++;
@@ -389,11 +389,11 @@ device_get_bios_file(const device_t *dev, const char *internal_name, int file_no
device_config_bios_t *bios = NULL;
if (dev != NULL) {
config = (device_config_t *) dev->config;
config = dev->config;
if (config != NULL) {
while (config->type != -1) {
if (config->type == CONFIG_BIOS) {
bios = (device_config_bios_t *) config->bios;
bios = config->bios;
/* Go through the ROM's in the device configuration. */
while (bios->files_no != 0) {
@@ -427,7 +427,7 @@ device_has_config(const device_t *dev)
if (dev->config == NULL)
return 0;
config = (device_config_t *) dev->config;
config = dev->config;
while (config->type != -1) {
if (config->type != CONFIG_MAC)

View File

@@ -463,7 +463,7 @@ kbc_at_poll_at(atkbc_t *dev)
case STATE_KBC_AMI_OUT:
if (dev->status & STAT_OFULL)
break;
/* FALLTHROUGH */
[[fallthrough]];
case STATE_MAIN_IBF:
default:
at_main_ibf:
@@ -586,7 +586,7 @@ kbc_at_poll_ps2(atkbc_t *dev)
case STATE_KBC_AMI_OUT:
if (dev->status & STAT_OFULL)
break;
/* FALLTHROUGH */
[[fallthrough]];
case STATE_MAIN_IBF:
default:
ps2_main_ibf:
@@ -1027,6 +1027,9 @@ write64_generic(void *priv, uint8_t val)
kbc_at_log("ATkbc: pulse %01X\n", val & 0x0f);
pulse_output(dev, val & 0x0f);
return 0;
default:
break;
}
kbc_at_log("ATkbc: bad command %02X\n", val);
@@ -1328,12 +1331,13 @@ write64_siemens(void *priv, uint8_t val)
static uint8_t
write60_quadtel(void *priv, UNUSED(uint8_t val))
{
atkbc_t *dev = (atkbc_t *) priv;
const atkbc_t *dev = (atkbc_t *) priv;
switch (dev->command) {
case 0xcf: /*??? - sent by MegaPC BIOS*/
kbc_at_log("ATkbc: ??? - sent by MegaPC BIOS\n");
return 0;
default:
break;
}

View File

@@ -135,7 +135,7 @@ kbc_at_dev_poll(void *priv)
dev->port->wantcmd = 0;
break;
}
/* FALLTHROUGH */
[[fallthrough]];
case DEV_STATE_MAIN_WANT_IN:
/* Output command response and then return to main loop #2. */
if ((dev->port->out_new == -1) && (dev->cmd_queue_start != dev->cmd_queue_end)) {

View File

@@ -226,7 +226,6 @@ lt_read(uint16_t port, void *priv)
return (dev->control_val | 0x0F) & ~IRQ_MASK;
else
return 0xff;
break;
default:
break;

View File

@@ -507,7 +507,7 @@ sermouse_command_timer(void *priv)
break;
case PHASE_ACK:
serial_write_fifo(dev->serial, 0x06);
/* FALLTHROUGH */
[[fallthrough]];
case PHASE_BAUD_RATE:
sermouse_command_phase_idle(dev);
sermouse_timer_on(dev, dev->report_period, 1);
@@ -645,7 +645,7 @@ ltsermouse_write(UNUSED(struct serial_s *serial), void *priv, uint8_t data)
switch (data) {
default:
mouse_serial_log("Serial mouse: Invalid period %02X, using 1200 bps\n", data);
/*FALLTHROUGH*/
[[fallthrough]];
case 0x6E:
dev->transmit_period = sermouse_transmit_period(dev, 1200, -1);
break;

View File

@@ -193,7 +193,7 @@ smbus_ali7101_write(uint16_t addr, uint8_t val, void *priv)
case 0x4: /* block R/W */
timer_bytes++; /* count the SMBus length byte now */
/* fall-through */
[[fallthrough]];
default: /* unknown */
dev->next_stat = 0x20; /* raise DEV_ERR */

View File

@@ -195,7 +195,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv)
timer_bytes++;
}
/* fall-through */
[[fallthrough]];
case 0xc: /* I2C process call */
if (!read) { /* word write (only when writing) */
@@ -214,7 +214,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv)
case 0x5: /* block R/W */
timer_bytes++; /* count the SMBus length byte now */
/* fall-through */
[[fallthrough]];
case 0xd: /* I2C block R/W */
i2c_write(i2c_smbus, smbus_addr, dev->cmd);
@@ -247,7 +247,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv)
i2c_write(i2c_smbus, smbus_addr, dev->cmd);
timer_bytes++;
/* fall-through */
[[fallthrough]];
case 0xe: /* I2C with 7-bit address */
if (!read) { /* word write (only when writing) */

View File

@@ -338,7 +338,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv)
esdi->command &= ~0x03;
if (val & 0x02)
fatal("Read with ECC\n");
/*FALLTHROUGH*/
[[fallthrough]];
case 0xa0:
esdi->status = STAT_BUSY;
@@ -397,7 +397,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv)
default:
esdi_at_log("WD1007: bad command %02X\n", val);
/*FALLTHROUGH*/
[[fallthrough]];
case 0xe8: /*???*/
esdi->status = STAT_BUSY;
esdi_set_callback(esdi, 200 * HDC_TIME);

View File

@@ -1655,7 +1655,7 @@ ide_writeb(uint16_t addr, uint8_t val, void *priv)
disabled, the Read Multiple operation is rejected with an Aborted Com-
mand error. */
ide->blockcount = 0;
/*FALLTHROUGH*/
[[fallthrough]];
case WIN_READ:
case WIN_READ_NORETRY:
@@ -1704,7 +1704,7 @@ ide_writeb(uint16_t addr, uint8_t val, void *priv)
/* Turn on the activity indicator *here* so that it gets turned on
less times. */
ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1);
/*FALLTHROUGH*/
[[fallthrough]];
case WIN_WRITE:
case WIN_WRITE_NORETRY:
@@ -1843,6 +1843,9 @@ ide_bad_command:
return;
}
return;
default:
break;
}
}
@@ -2062,6 +2065,9 @@ ide_readb(uint16_t addr, void *priv)
ide_irq_lower(ide);
temp = ide_status(ide, ide_drives[ch ^ 1], ch);
break;
default:
break;
}
ide_log("ide_readb(%04X, %08X) = %02X\n", addr, priv, temp);

View File

@@ -623,6 +623,8 @@ st506_callback(void *priv)
st506_complete(dev);
break;
}
[[fallthrough]];
case CMD_FORMAT_TRACK:
case CMD_FORMAT_BAD_TRACK:
switch (dev->state) {
@@ -1604,7 +1606,7 @@ st506_init(const device_t *info)
case ST506_XT_TYPE_ST11R: /* Seagate ST-11R (RLL) */
dev->spt = RLL_SECTORS;
/*FALLTHROUGH*/
[[fallthrough]];
case ST506_XT_TYPE_ST11M: /* Seagate ST-11M (MFM) */
dev->nr_err = ERR_NOT_AVAILABLE;

View File

@@ -509,7 +509,7 @@ hdc_callback(void *priv)
case CMD_READ_VERIFY:
no_data = 1;
/*FALLTHROUGH*/
[[fallthrough]];
case CMD_READ_SECTORS:
if (!drive->present) {
@@ -534,7 +534,7 @@ hdc_callback(void *priv)
dev->buf_len = 512;
dev->state = STATE_SEND;
/*FALLTHROUGH*/
[[fallthrough]];
case STATE_SEND:
/* Activate the status icon. */
@@ -642,7 +642,7 @@ do_send:
dev->buf_len = 512;
dev->state = STATE_RECV;
/*FALLTHROUGH*/
[[fallthrough]];
case STATE_RECV:
/* Activate the status icon. */

View File

@@ -655,7 +655,7 @@ mo_update_request_length(mo_t *dev, int len, int block_len)
break;
}
}
/*FALLTHROUGH*/
[[fallthrough]];
default:
dev->packet_len = len;
break;
@@ -1342,7 +1342,7 @@ mo_command(scsi_common_t *sc, uint8_t *cdb)
mo_invalid_field(dev);
return;
}
/*FALLTHROUGH*/
[[fallthrough]];
case GPCMD_SCSI_RESERVE:
case GPCMD_SCSI_RELEASE:
case GPCMD_TEST_UNIT_READY:

View File

@@ -821,7 +821,8 @@ zip_update_request_length(zip_t *dev, int len, int block_len)
break;
}
}
/*FALLTHROUGH*/
[[fallthrough]];
default:
dev->packet_len = len;
break;
@@ -1408,7 +1409,7 @@ zip_command(scsi_common_t *sc, uint8_t *cdb)
zip_invalid_field(dev);
return;
}
/*FALLTHROUGH*/
[[fallthrough]];
case GPCMD_SCSI_RESERVE:
case GPCMD_SCSI_RELEASE:
case GPCMD_TEST_UNIT_READY:
@@ -1571,6 +1572,7 @@ zip_command(scsi_common_t *sc, uint8_t *cdb)
zip_command_complete(dev);
break;
}
[[fallthrough]];
case GPCMD_WRITE_6:
case GPCMD_WRITE_10:
case GPCMD_WRITE_AND_VERIFY_10:

View File

@@ -118,7 +118,7 @@ dma_sg_next_addr(dma_t *dev)
dev->eot = dev->count >> 31;
dev->count &= 0xfffe;
dev->cb = (uint16_t) dev->count;
dev->cc = (int) dev->count;
dev->cc = dev->count;
if (!dev->count)
dev->count = 65536;
if (ts == 2)
@@ -133,9 +133,7 @@ dma_sg_next_addr(dma_t *dev)
static void
dma_block_transfer(int channel)
{
int bit16;
bit16 = (channel >= 4);
int bit16 = (channel >= 4);
if (dma_advanced)
bit16 = !!(dma_transfer_size(&(dma[channel])) == 2);
@@ -1280,7 +1278,7 @@ dma_sg(uint8_t *data, int transfer_length, int out, void *priv)
uint8_t
_dma_read(uint32_t addr, dma_t *dma_c)
{
uint8_t temp;
uint8_t temp = 0;
if (dma_advanced) {
if (dma_c->sg_status & 1)
@@ -1296,7 +1294,7 @@ _dma_read(uint32_t addr, dma_t *dma_c)
static uint16_t
_dma_readw(uint32_t addr, dma_t *dma_c)
{
uint16_t temp;
uint16_t temp = 0;
if (dma_advanced) {
if (dma_c->sg_status & 1)

View File

@@ -916,7 +916,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc_bad_command(fdc);
break;
}
/*FALLTHROUGH*/
[[fallthrough]];
case 0x07: /*Recalibrate*/
fdc->pnum = 0;
fdc->ptot = 1;
@@ -959,7 +959,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc_bad_command(fdc);
break;
}
/*FALLTHROUGH*/
[[fallthrough]];
case 0x10: /*Get version*/
case 0x14: /*Unlock*/
case 0x94: /*Lock*/
@@ -1081,7 +1081,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
case 0x16: /* Verify */
if (fdc->params[0] & 0x80)
fdc->sc = fdc->params[7];
/*FALLTHROUGH*/
[[fallthrough]];
case 0x06: /* Read data */
case 0x0c: /* Read deleted data */
fdc_io_command_phase1(fdc, 0);

View File

@@ -64,7 +64,7 @@
#define FLAG_IGNORE_DENSEL 512
#define FLAG_PS2 1024
typedef struct {
typedef struct fdd_t {
int type;
int track;
int densel;
@@ -586,6 +586,9 @@ fdd_get_bitcell_period(int rate)
case 3: /*Extended density*/
bit_rate = 1000;
break;
default:
break;
}
return 1000000 / bit_rate * 2; /*Bitcell period in ns*/

View File

@@ -180,7 +180,7 @@ typedef struct sector_t {
* specifies the entire bitcell count
*/
typedef struct d86f_t {
FILE *f;
FILE *fp;
uint8_t state;
uint8_t fill;
uint8_t sector_count;
@@ -1659,7 +1659,7 @@ d86f_write_sector_data(int drive, int side, int mfm, uint16_t am)
d86f_handler[drive].write_data(drive, side, dev->data_find.bytes_obtained - 1, dev->current_byte[side]);
} else {
/* We're in the data field of the sector, use a CRC byte. */
dev->current_byte[side] = dev->calc_crc.bytes[(dev->data_find.bytes_obtained & 1)];
dev->current_byte[side] = dev->calc_crc.bytes[dev->data_find.bytes_obtained & 1];
}
dev->current_bit[side] = (15 - (dev->data_find.bits_obtained & 15)) >> 1;
@@ -1951,7 +1951,7 @@ d86f_format_track(int drive, int side, int do_write)
if (dev->datac == 3)
fdc_stop_id_request(d86f_fdc);
}
/*FALLTHROUGH*/
[[fallthrough]];
case FMT_PRETRK_SYNC:
case FMT_SECTOR_DATA_SYNC:
@@ -2294,7 +2294,7 @@ d86f_turbo_poll(int drive, int side)
case STATE_0D_SPIN_TO_INDEX:
dev->sector_count = 0;
dev->datac = 5;
/*FALLTHROUGH*/
[[fallthrough]];
case STATE_02_SPIN_TO_INDEX:
dev->state++;
@@ -2339,7 +2339,7 @@ d86f_turbo_poll(int drive, int side)
dev->last_sector.id.r = dev->req_sector.id.r;
dev->last_sector.id.n = dev->req_sector.id.n;
d86f_handler[drive].set_sector(drive, side, dev->last_sector.id.c, dev->last_sector.id.h, dev->last_sector.id.r, dev->last_sector.id.n);
/*FALLTHROUGH*/
[[fallthrough]];
case STATE_0A_FIND_ID:
dev->turbo_pos = 0;
@@ -2905,12 +2905,12 @@ d86f_read_track(int drive, int track, int thin_track, int side, uint16_t *da, ui
if (dev->track_offset[logical_track]) {
if (!thin_track) {
if (fseek(dev->f, dev->track_offset[logical_track], SEEK_SET) == -1)
if (fseek(dev->fp, dev->track_offset[logical_track], SEEK_SET) == -1)
fatal("d86f_read_track(): Error seeking to offset dev->track_offset[logical_track]\n");
if (fread(&(dev->side_flags[side]), 1, 2, dev->f) != 2)
if (fread(&(dev->side_flags[side]), 1, 2, dev->fp) != 2)
fatal("d86f_read_track(): Error reading side flags\n");
if (d86f_has_extra_bit_cells(drive)) {
if (fread(&(dev->extra_bit_cells[side]), 1, 4, dev->f) != 4)
if (fread(&(dev->extra_bit_cells[side]), 1, 4, dev->fp) != 4)
fatal("d86f_read_track(): Error reading number of extra bit cells\n");
/* If RPM shift is 0% and direction is 1, do not adjust extra bit cells,
as that is the whole track length. */
@@ -2922,13 +2922,13 @@ d86f_read_track(int drive, int track, int thin_track, int side, uint16_t *da, ui
}
} else
dev->extra_bit_cells[side] = 0;
(void) !fread(&(dev->index_hole_pos[side]), 4, 1, dev->f);
(void) !fread(&(dev->index_hole_pos[side]), 4, 1, dev->fp);
} else
fseek(dev->f, dev->track_offset[logical_track] + d86f_track_header_size(drive), SEEK_SET);
fseek(dev->fp, dev->track_offset[logical_track] + d86f_track_header_size(drive), SEEK_SET);
array_size = d86f_get_array_size(drive, side, 0);
(void) !fread(da, 1, array_size, dev->f);
(void) !fread(da, 1, array_size, dev->fp);
if (d86f_has_surface_desc(drive))
(void) !fread(sa, 1, array_size, dev->f);
(void) !fread(sa, 1, array_size, dev->fp);
} else {
if (!thin_track) {
switch ((dev->disk_flags >> 1) & 3) {
@@ -3125,22 +3125,22 @@ d86f_writeback(int drive)
#endif
header_size = d86f_header_size(drive);
if (!dev->f)
if (!dev->fp)
return;
/* First write the track offsets table. */
if (fseek(dev->f, 0, SEEK_SET) == -1)
if (fseek(dev->fp, 0, SEEK_SET) == -1)
fatal("86F write_back(): Error seeking to the beginning of the file\n");
if (fread(header, 1, header_size, dev->f) != header_size)
if (fread(header, 1, header_size, dev->fp) != header_size)
fatal("86F write_back(): Error reading header size\n");
if (fseek(dev->f, 8, SEEK_SET) == -1)
if (fseek(dev->fp, 8, SEEK_SET) == -1)
fatal("86F write_back(): Error seeking\n");
size = d86f_get_track_table_size(drive);
if (fwrite(dev->track_offset, 1, size, dev->f) != size)
if (fwrite(dev->track_offset, 1, size, dev->fp) != size)
fatal("86F write_back(): Error writing data\n");
d86f_write_tracks(drive, &dev->f, NULL);
d86f_write_tracks(drive, &dev->fp, NULL);
#ifdef D86F_COMPRESS
if (dev->is_compressed) {
@@ -3152,16 +3152,16 @@ d86f_writeback(int drive)
/* Write the header to the original file. */
fwrite(header, 1, header_size, cf);
fseek(dev->f, 0, SEEK_END);
len = ftell(dev->f);
fseek(dev->fp, 0, SEEK_END);
len = ftell(dev->fp);
len -= header_size;
fseek(dev->f, header_size, SEEK_SET);
fseek(dev->fp, header_size, SEEK_SET);
/* Compress data from the temporary uncompressed file to the original, compressed file. */
dev->filebuf = (uint8_t *) malloc(len);
dev->outbuf = (uint8_t *) malloc(len - 1);
fread(dev->filebuf, 1, len, dev->f);
fread(dev->filebuf, 1, len, dev->fp);
ret = lzf_compress(dev->filebuf, len, dev->outbuf, len - 1);
if (!ret)
@@ -3421,7 +3421,7 @@ d86f_export(int drive, char *fn)
uint32_t tt[512];
d86f_t *dev = d86f[drive];
d86f_t *temp86;
FILE *f;
FILE *fp;
int tracks = 86;
int inc = 1;
uint32_t magic = 0x46423638;
@@ -3430,19 +3430,19 @@ d86f_export(int drive, char *fn)
memset(tt, 0, 512 * sizeof(uint32_t));
f = plat_fopen(fn, "wb");
if (!f)
fp = plat_fopen(fn, "wb");
if (!fp)
return 0;
/* Allocate a temporary drive for conversion. */
temp86 = (d86f_t *) malloc(sizeof(d86f_t));
memcpy(temp86, dev, sizeof(d86f_t));
fwrite(&magic, 4, 1, f);
fwrite(&version, 2, 1, f);
fwrite(&disk_flags, 2, 1, f);
fwrite(&magic, 4, 1, fp);
fwrite(&version, 2, 1, fp);
fwrite(&disk_flags, 2, 1, fp);
fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), f);
fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), fp);
/* In the case of a thick track drive, always increment track
by two, since two tracks are going to get output at once. */
@@ -3455,17 +3455,17 @@ d86f_export(int drive, char *fn)
else
fdd_do_seek(drive, i);
dev->cur_track = i;
d86f_write_tracks(drive, &f, tt);
d86f_write_tracks(drive, &fp, tt);
}
fclose(f);
fclose(fp);
f = plat_fopen(fn, "rb+");
fp = plat_fopen(fn, "rb+");
fseek(f, 8, SEEK_SET);
fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), f);
fseek(fp, 8, SEEK_SET);
fwrite(tt, 1, ((d86f_get_sides(drive) == 2) ? 2048 : 1024), fp);
fclose(f);
fclose(fp);
fdd_do_seek(drive, fdd_current_track(drive));
@@ -3492,10 +3492,10 @@ d86f_load(int drive, char *fn)
writeprot[drive] = 0;
dev->f = plat_fopen(fn, "rb+");
if (!dev->f) {
dev->f = plat_fopen(fn, "rb");
if (!dev->f) {
dev->fp = plat_fopen(fn, "rb+");
if (!dev->fp) {
dev->fp = plat_fopen(fn, "rb");
if (!dev->fp) {
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
return;
@@ -3508,16 +3508,16 @@ d86f_load(int drive, char *fn)
}
fwriteprot[drive] = writeprot[drive];
fseek(dev->f, 0, SEEK_END);
len = ftell(dev->f);
fseek(dev->f, 0, SEEK_SET);
fseek(dev->fp, 0, SEEK_END);
len = ftell(dev->fp);
fseek(dev->fp, 0, SEEK_SET);
(void) !fread(&magic, 4, 1, dev->f);
(void) !fread(&magic, 4, 1, dev->fp);
if (len < 16) {
/* File is WAY too small, abort. */
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
return;
@@ -3526,13 +3526,13 @@ d86f_load(int drive, char *fn)
if ((magic != 0x46423638) && (magic != 0x66623638)) {
/* File is not of the valid format, abort. */
d86f_log("86F: Unrecognized magic bytes: %08X\n", magic);
fclose(dev->f);
fclose(dev->fp);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
return;
}
if (fread(&(dev->version), 1, 2, dev->f) != 2)
if (fread(&(dev->version), 1, 2, dev->fp) != 2)
fatal("d86f_load(): Error reading format version\n");
if (dev->version != D86FVER) {
@@ -3544,8 +3544,8 @@ d86f_load(int drive, char *fn)
} else {
d86f_log("86F: Unrecognized file version: %i.%02i\n", dev->version >> 8, dev->version & 0xff);
}
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
return;
@@ -3553,7 +3553,7 @@ d86f_load(int drive, char *fn)
d86f_log("86F: Recognized file version: %i.%02i\n", dev->version >> 8, dev->version & 0xff);
}
(void) !fread(&(dev->disk_flags), 2, 1, dev->f);
(void) !fread(&(dev->disk_flags), 2, 1, dev->fp);
if (d86f_has_surface_desc(drive)) {
for (uint8_t i = 0; i < 2; i++)
@@ -3572,31 +3572,31 @@ d86f_load(int drive, char *fn)
if (len < 51052) {
#endif
/* File too small, abort. */
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
return;
}
#ifdef DO_CRC64
fseek(dev->f, 8, SEEK_SET);
fread(&read_crc64, 1, 8, dev->f);
fseek(dev->fp, 8, SEEK_SET);
fread(&read_crc64, 1, 8, dev->fp);
fseek(dev->f, 0, SEEK_SET);
fseek(dev->fp, 0, SEEK_SET);
crc64 = 0xffffffffffffffff;
dev->filebuf = malloc(len);
fread(dev->filebuf, 1, len, dev->f);
fread(dev->filebuf, 1, len, dev->fp);
*(uint64_t *) &(dev->filebuf[8]) = 0xffffffffffffffff;
crc64 = (uint64_t) crc64speed(0, dev->filebuf, len);
free(dev->filebuf);
if (crc64 != read_crc64) {
d86f_log("86F: CRC64 error\n");
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
return;
@@ -3608,11 +3608,11 @@ d86f_load(int drive, char *fn)
memcpy(temp_file_name, drive ? nvr_path("TEMP$$$1.$$$") : nvr_path("TEMP$$$0.$$$"), 256);
memcpy(dev->original_file_name, fn, strlen(fn) + 1);
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
dev->f = plat_fopen(temp_file_name, "wb");
if (!dev->f) {
dev->fp = plat_fopen(temp_file_name, "wb");
if (!dev->fp) {
d86f_log("86F: Unable to create temporary decompressed file\n");
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
@@ -3621,9 +3621,9 @@ d86f_load(int drive, char *fn)
tf = plat_fopen(fn, "rb");
for (i = 0; i < 8; i++) {
for (uint8_t i = 0; i < 8; i++) {
fread(&temp, 1, 2, tf);
fwrite(&temp, 1, 2, dev->f);
fwrite(&temp, 1, 2, dev->fp);
}
dev->filebuf = (uint8_t *) malloc(len);
@@ -3631,14 +3631,14 @@ d86f_load(int drive, char *fn)
fread(dev->filebuf, 1, len, tf);
temp = lzf_decompress(dev->filebuf, len, dev->outbuf, 67108864);
if (temp) {
fwrite(dev->outbuf, 1, temp, dev->f);
fwrite(dev->outbuf, 1, temp, dev->fp);
}
free(dev->outbuf);
free(dev->filebuf);
fclose(tf);
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
if (!temp) {
d86f_log("86F: Error decompressing file\n");
@@ -3648,15 +3648,15 @@ d86f_load(int drive, char *fn)
return;
}
dev->f = plat_fopen(temp_file_name, "rb+");
dev->fp = plat_fopen(temp_file_name, "rb+");
}
#endif
if (dev->disk_flags & 0x100) {
/* Zoned disk. */
d86f_log("86F: Disk is zoned (Apple or Sony)\n");
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
#ifdef D86F_COMPRESS
if (dev->is_compressed)
plat_remove(temp_file_name);
@@ -3669,8 +3669,8 @@ d86f_load(int drive, char *fn)
if (dev->disk_flags & 0x600) {
/* Zone type is not 0 but the disk is fixed-RPM. */
d86f_log("86F: Disk is fixed-RPM but zone type is not 0\n");
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
#ifdef D86F_COMPRESS
if (dev->is_compressed)
plat_remove(temp_file_name);
@@ -3686,29 +3686,29 @@ d86f_load(int drive, char *fn)
}
if (writeprot[drive]) {
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
#ifdef D86F_COMPRESS
if (dev->is_compressed)
dev->f = plat_fopen(temp_file_name, "rb");
dev->fp = plat_fopen(temp_file_name, "rb");
else
#endif
dev->f = plat_fopen(fn, "rb");
dev->fp = plat_fopen(fn, "rb");
}
/* OK, set the drive data, other code needs it. */
d86f[drive] = dev;
fseek(dev->f, 8, SEEK_SET);
fseek(dev->fp, 8, SEEK_SET);
(void) !fread(dev->track_offset, 1, d86f_get_track_table_size(drive), dev->f);
(void) !fread(dev->track_offset, 1, d86f_get_track_table_size(drive), dev->fp);
if (!(dev->track_offset[0])) {
/* File has no track 0 side 0, abort. */
d86f_log("86F: No Track 0 side 0\n");
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
d86f[drive] = NULL;
@@ -3718,8 +3718,8 @@ d86f_load(int drive, char *fn)
if ((d86f_get_sides(drive) == 2) && !(dev->track_offset[1])) {
/* File is 2-sided but has no track 0 side 1, abort. */
d86f_log("86F: No Track 0 side 1\n");
fclose(dev->f);
dev->f = NULL;
fclose(dev->fp);
dev->fp = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
d86f[drive] = NULL;
@@ -3727,12 +3727,12 @@ d86f_load(int drive, char *fn)
}
/* Load track 0 flags as default. */
if (fseek(dev->f, dev->track_offset[0], SEEK_SET) == -1)
if (fseek(dev->fp, dev->track_offset[0], SEEK_SET) == -1)
fatal("d86f_load(): Track 0: Error seeking to the beginning of the file\n");
if (fread(&(dev->side_flags[0]), 1, 2, dev->f) != 2)
if (fread(&(dev->side_flags[0]), 1, 2, dev->fp) != 2)
fatal("d86f_load(): Track 0: Error reading side flags\n");
if (dev->disk_flags & 0x80) {
if (fread(&(dev->extra_bit_cells[0]), 1, 4, dev->f) != 4)
if (fread(&(dev->extra_bit_cells[0]), 1, 4, dev->fp) != 4)
fatal("d86f_load(): Track 0: Error reading the amount of extra bit cells\n");
if ((dev->disk_flags & 0x1060) != 0x1000) {
if (dev->extra_bit_cells[0] < -32768)
@@ -3745,12 +3745,12 @@ d86f_load(int drive, char *fn)
}
if (d86f_get_sides(drive) == 2) {
if (fseek(dev->f, dev->track_offset[1], SEEK_SET) == -1)
if (fseek(dev->fp, dev->track_offset[1], SEEK_SET) == -1)
fatal("d86f_load(): Track 1: Error seeking to the beginning of the file\n");
if (fread(&(dev->side_flags[1]), 1, 2, dev->f) != 2)
if (fread(&(dev->side_flags[1]), 1, 2, dev->fp) != 2)
fatal("d86f_load(): Track 1: Error reading side flags\n");
if (dev->disk_flags & 0x80) {
if (fread(&(dev->extra_bit_cells[1]), 1, 4, dev->f) != 4)
if (fread(&(dev->extra_bit_cells[1]), 1, 4, dev->fp) != 4)
fatal("d86f_load(): Track 4: Error reading the amount of extra bit cells\n");
if ((dev->disk_flags & 0x1060) != 0x1000) {
if (dev->extra_bit_cells[1] < -32768)
@@ -3781,10 +3781,10 @@ d86f_load(int drive, char *fn)
dev->extra_bit_cells[1] = 0;
}
fseek(dev->f, 0, SEEK_END);
dev->file_size = ftell(dev->f);
fseek(dev->fp, 0, SEEK_END);
dev->file_size = ftell(dev->fp);
fseek(dev->f, 0, SEEK_SET);
fseek(dev->fp, 0, SEEK_SET);
d86f_register_86f(drive);
@@ -3847,9 +3847,9 @@ d86f_close(int drive)
}
}
if (dev->f) {
fclose(dev->f);
dev->f = NULL;
if (dev->fp) {
fclose(dev->fp);
dev->fp = NULL;
}
#ifdef D86F_COMPRESS
if (dev->is_compressed)

View File

@@ -36,8 +36,8 @@
#include <86box/fdc.h>
#include <fdi2raw.h>
typedef struct {
FILE *f;
typedef struct fdi_t {
FILE *fp;
FDI *h;
int lasttrack;
@@ -291,7 +291,7 @@ fdi_seek(int drive, int track)
d86f_set_cur_track(drive, track);
if (dev->f == NULL)
if (dev->fp == NULL)
return;
if (track < 0)
@@ -327,16 +327,16 @@ fdi_load(int drive, char *fn)
d86f_unregister(drive);
dev->f = plat_fopen(fn, "rb");
if (fread(header, 1, 25, dev->f) != 25)
dev->fp = plat_fopen(fn, "rb");
if (fread(header, 1, 25, dev->fp) != 25)
fatal("fdi_load(): Error reading header\n");
if (fseek(dev->f, 0, SEEK_SET) == -1)
if (fseek(dev->fp, 0, SEEK_SET) == -1)
fatal("fdi_load(): Error seeking to the beginning of the file\n");
header[25] = 0;
if (strcmp(header, "Formatted Disk Image file") != 0) {
/* This is a Japanese FDI file. */
fdi_log("fdi_load(): Japanese FDI file detected, redirecting to IMG loader\n");
fclose(dev->f);
fclose(dev->fp);
free(dev);
img_load(drive, fn);
return;
@@ -345,7 +345,7 @@ fdi_load(int drive, char *fn)
/* Set up the drive unit. */
fdi[drive] = dev;
dev->h = fdi2raw_header(dev->f);
dev->h = fdi2raw_header(dev->fp);
dev->lasttrack = fdi2raw_get_last_track(dev->h);
dev->sides = fdi2raw_get_last_head(dev->h) + 1;
@@ -386,8 +386,8 @@ fdi_close(int drive)
if (dev->h)
fdi2raw_header_free(dev->h);
if (dev->f)
fclose(dev->f);
if (dev->fp)
fclose(dev->fp);
/* Release the memory. */
free(dev);

View File

@@ -31,7 +31,7 @@
#include <86box/fdd_imd.h>
#include <86box/fdc.h>
typedef struct {
typedef struct imd_track_t {
uint8_t is_present;
uint32_t file_offs;
uint8_t params[5];
@@ -47,8 +47,8 @@ typedef struct {
uint8_t max_sector_size;
} imd_track_t;
typedef struct {
FILE *f;
typedef struct imd_t {
FILE *fp;
char *buffer;
uint32_t start_offs;
int track_count;
@@ -150,7 +150,7 @@ track_is_xdf(int drive, int side, int track)
effective_sectors = xdf_sectors = high_sectors = low_sectors = 0;
for (i = 0; i < 256; i++)
for (uint16_t i = 0; i < 256; i++)
dev->xdf_ordered_pos[i][side] = 0;
if (dev->tracks[track][side].params[2] & 0xC0)
@@ -175,7 +175,7 @@ track_is_xdf(int drive, int side, int track)
expected_low_count = 0;
}
for (i = 0; i < dev->tracks[track][side].params[3]; i++) {
for (uint8_t i = 0; i < dev->tracks[track][side].params[3]; i++) {
if ((r_map[i] >= 0x81) && (r_map[i] <= max_high_id)) {
high_sectors++;
dev->xdf_ordered_pos[(int) r_map[i]][side] = i;
@@ -196,7 +196,7 @@ track_is_xdf(int drive, int side, int track)
n_map = (uint8_t *) (dev->buffer + dev->tracks[track][side].n_map_offs);
for (i = 0; i < dev->tracks[track][side].params[3]; i++) {
for (uint8_t i = 0; i < dev->tracks[track][side].params[3]; i++) {
effective_sectors++;
if (!(r_map[i]) && !(n_map[i]))
effective_sectors--;
@@ -310,7 +310,7 @@ imd_seek(int drive, int track)
uint8_t *data;
int flags = 0x00;
if (dev->f == NULL)
if (dev->fp == NULL)
return;
if (!dev->track_width && fdd_doublestep_40(drive))
@@ -526,26 +526,26 @@ imd_writeback(int drive)
for (int side = 0; side < dev->sides; side++) {
if (dev->tracks[track][side].is_present) {
fseek(dev->f, dev->tracks[track][side].file_offs, SEEK_SET);
fseek(dev->fp, dev->tracks[track][side].file_offs, SEEK_SET);
h = dev->tracks[track][side].params[2];
spt = dev->tracks[track][side].params[3];
n = dev->tracks[track][side].params[4];
fwrite(dev->tracks[track][side].params, 1, 5, dev->f);
fwrite(dev->tracks[track][side].params, 1, 5, dev->fp);
if (h & 0x80)
fwrite(dev->buffer + dev->tracks[track][side].c_map_offs, 1, spt, dev->f);
fwrite(dev->buffer + dev->tracks[track][side].c_map_offs, 1, spt, dev->fp);
if (h & 0x40)
fwrite(dev->buffer + dev->tracks[track][side].h_map_offs, 1, spt, dev->f);
fwrite(dev->buffer + dev->tracks[track][side].h_map_offs, 1, spt, dev->fp);
if (n == 0xFF) {
n_map = dev->buffer + dev->tracks[track][side].n_map_offs;
fwrite(n_map, 1, spt, dev->f);
fwrite(n_map, 1, spt, dev->fp);
}
for (uint8_t i = 0; i < spt; i++) {
ssize = (n == 0xFF) ? n_map[i] : n;
ssize = 128 << ssize;
fwrite(dev->buffer + dev->tracks[track][side].sector_data_offs[i], 1, ssize, dev->f);
fwrite(dev->buffer + dev->tracks[track][side].sector_data_offs[i], 1, ssize, dev->fp);
}
}
}
@@ -637,10 +637,10 @@ imd_load(int drive, char *fn)
dev = (imd_t *) malloc(sizeof(imd_t));
memset(dev, 0x00, sizeof(imd_t));
dev->f = plat_fopen(fn, "rb+");
if (dev->f == NULL) {
dev->f = plat_fopen(fn, "rb");
if (dev->f == NULL) {
dev->fp = plat_fopen(fn, "rb+");
if (dev->fp == NULL) {
dev->fp = plat_fopen(fn, "rb");
if (dev->fp == NULL) {
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
return;
@@ -652,40 +652,40 @@ imd_load(int drive, char *fn)
writeprot[drive] = 1;
fwriteprot[drive] = writeprot[drive];
if (fseek(dev->f, 0, SEEK_SET) == -1)
if (fseek(dev->fp, 0, SEEK_SET) == -1)
fatal("imd_load(): Error seeking to the beginning of the file\n");
if (fread(&magic, 1, 4, dev->f) != 4)
if (fread(&magic, 1, 4, dev->fp) != 4)
fatal("imd_load(): Error reading the magic number\n");
if (magic != 0x20444D49) {
imd_log("IMD: Not a valid ImageDisk image\n");
fclose(dev->f);
fclose(dev->fp);
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
} else
imd_log("IMD: Valid ImageDisk image\n");
if (fseek(dev->f, 0, SEEK_END) == -1)
if (fseek(dev->fp, 0, SEEK_END) == -1)
fatal("imd_load(): Error seeking to the end of the file\n");
fsize = ftell(dev->f);
fsize = ftell(dev->fp);
if (fsize <= 0) {
imd_log("IMD: Too small ImageDisk image\n");
fclose(dev->f);
fclose(dev->fp);
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
}
if (fseek(dev->f, 0, SEEK_SET) == -1)
if (fseek(dev->fp, 0, SEEK_SET) == -1)
fatal("imd_load(): Error seeking to the beginning of the file again\n");
dev->buffer = malloc(fsize);
if (fread(dev->buffer, 1, fsize, dev->f) != fsize)
if (fread(dev->buffer, 1, fsize, dev->fp) != fsize)
fatal("imd_load(): Error reading data\n");
buffer = dev->buffer;
buffer2 = memchr(buffer, 0x1A, fsize);
if (buffer2 == NULL) {
imd_log("IMD: No ASCII EOF character\n");
fclose(dev->f);
fclose(dev->fp);
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
@@ -696,7 +696,7 @@ imd_load(int drive, char *fn)
buffer2++;
if ((buffer2 - buffer) == fsize) {
imd_log("IMD: File ends after ASCII EOF character\n");
fclose(dev->f);
fclose(dev->fp);
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
@@ -775,7 +775,7 @@ imd_load(int drive, char *fn)
dev->tracks[track][side].data_offs = last_offset;
for (i = 0; i < track_spt; i++) {
for (int i = 0; i < track_spt; i++) {
data_size = buffer2[i];
data_size = 128 << data_size;
dev->tracks[track][side].sector_data_offs[i] = last_offset;
@@ -784,7 +784,7 @@ imd_load(int drive, char *fn)
/* Invalid sector data type, possibly a malformed HxC IMG image (it outputs data errored
sectors with a variable amount of bytes, against the specification). */
imd_log("IMD: Invalid sector data type %02X\n", dev->buffer[dev->tracks[track][side].sector_data_offs[i]]);
fclose(dev->f);
fclose(dev->fp);
free(dev);
imd[drive] = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
@@ -807,7 +807,7 @@ imd_load(int drive, char *fn)
} else {
dev->tracks[track][side].data_offs = last_offset;
for (i = 0; i < track_spt; i++) {
for (int i = 0; i < track_spt; i++) {
data_size = sector_size;
data_size = 128 << data_size;
dev->tracks[track][side].sector_data_offs[i] = last_offset;
@@ -816,7 +816,7 @@ imd_load(int drive, char *fn)
/* Invalid sector data type, possibly a malformed HxC IMG image (it outputs data errored
sectors with a variable amount of bytes, against the specification). */
imd_log("IMD: Invalid sector data type %02X\n", dev->buffer[dev->tracks[track][side].sector_data_offs[i]]);
fclose(dev->f);
fclose(dev->fp);
free(dev);
imd[drive] = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
@@ -865,7 +865,7 @@ imd_load(int drive, char *fn)
if (size_diff < gap_sum) {
/* If we can't fit the sectors with a reasonable minimum gap even at 2% slower RPM, abort. */
imd_log("IMD: Unable to fit the %i sectors in a track\n", track_spt);
fclose(dev->f);
fclose(dev->fp);
free(dev);
imd[drive] = NULL;
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
@@ -931,10 +931,10 @@ imd_close(int drive)
d86f_unregister(drive);
if (dev->f != NULL) {
if (dev->fp != NULL) {
free(dev->buffer);
fclose(dev->f);
fclose(dev->fp);
}
/* Release the memory. */

View File

@@ -40,8 +40,8 @@
#include <86box/fdd_img.h>
#include <86box/fdc.h>
typedef struct {
FILE *f;
typedef struct img_t {
FILE *fp;
uint8_t track_data[2][688128];
int sectors, tracks, sides;
uint8_t sector_size;
@@ -418,17 +418,17 @@ write_back(int drive)
int ssize = 128 << ((int) dev->sector_size);
int size;
if (dev->f == NULL)
if (dev->fp == NULL)
return;
if (dev->disk_at_once)
return;
if (fseek(dev->f, dev->base + (dev->track * dev->sectors * ssize * dev->sides), SEEK_SET) == -1)
if (fseek(dev->fp, dev->base + (dev->track * dev->sectors * ssize * dev->sides), SEEK_SET) == -1)
pclog("IMG write_back(): Error seeking to the beginning of the file\n");
for (int side = 0; side < dev->sides; side++) {
size = dev->sectors * ssize;
if (fwrite(dev->track_data[side], 1, size, dev->f) != size)
if (fwrite(dev->track_data[side], 1, size, dev->fp) != size)
fatal("IMG write_back(): Error writing data\n");
}
}
@@ -507,7 +507,7 @@ img_seek(int drive, int track)
int ssize = 128 << ((int) dev->sector_size);
uint32_t cur_pos = 0;
if (dev->f == NULL)
if (dev->fp == NULL)
return;
if (!dev->track_width && fdd_doublestep_40(drive))
@@ -519,7 +519,7 @@ img_seek(int drive, int track)
is_t0 = (track == 0) ? 1 : 0;
if (!dev->disk_at_once) {
if (fseek(dev->f, dev->base + (track * dev->sectors * ssize * dev->sides), SEEK_SET) == -1)
if (fseek(dev->fp, dev->base + (track * dev->sectors * ssize * dev->sides), SEEK_SET) == -1)
fatal("img_seek(): Error seeking\n");
}
@@ -528,7 +528,7 @@ img_seek(int drive, int track)
cur_pos = (track * dev->sectors * ssize * dev->sides) + (side * dev->sectors * ssize);
memcpy(dev->track_data[side], dev->disk_data + cur_pos, (size_t) dev->sectors * ssize);
} else {
read_bytes = fread(dev->track_data[side], 1, (size_t) dev->sectors * ssize, dev->f);
read_bytes = fread(dev->track_data[side], 1, (size_t) dev->sectors * ssize, dev->fp);
if (read_bytes < (dev->sectors * ssize))
memset(dev->track_data[side] + read_bytes, 0xf6, (dev->sectors * ssize) - read_bytes);
}
@@ -682,10 +682,10 @@ img_load(int drive, char *fn)
dev = (img_t *) malloc(sizeof(img_t));
memset(dev, 0x00, sizeof(img_t));
dev->f = plat_fopen(fn, "rb+");
if (dev->f == NULL) {
dev->f = plat_fopen(fn, "rb");
if (dev->f == NULL) {
dev->fp = plat_fopen(fn, "rb+");
if (dev->fp == NULL) {
dev->fp = plat_fopen(fn, "rb");
if (dev->fp == NULL) {
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
@@ -710,23 +710,23 @@ img_load(int drive, char *fn)
if (!strcasecmp(ext, "FDI")) {
/* This is a Japanese FDI image, so let's read the header */
img_log("img_load(): File is a Japanese FDI image...\n");
fseek(dev->f, 0x10, SEEK_SET);
(void) !fread(&bpb_bps, 1, 2, dev->f);
fseek(dev->f, 0x0C, SEEK_SET);
(void) !fread(&size, 1, 4, dev->f);
fseek(dev->fp, 0x10, SEEK_SET);
(void) !fread(&bpb_bps, 1, 2, dev->fp);
fseek(dev->fp, 0x0C, SEEK_SET);
(void) !fread(&size, 1, 4, dev->fp);
bpb_total = size / bpb_bps;
fseek(dev->f, 0x08, SEEK_SET);
(void) !fread(&(dev->base), 1, 4, dev->f);
fseek(dev->f, dev->base + 0x15, SEEK_SET);
bpb_mid = fgetc(dev->f);
fseek(dev->fp, 0x08, SEEK_SET);
(void) !fread(&(dev->base), 1, 4, dev->fp);
fseek(dev->fp, dev->base + 0x15, SEEK_SET);
bpb_mid = fgetc(dev->fp);
if (bpb_mid < 0xF0)
bpb_mid = 0xF0;
fseek(dev->f, 0x14, SEEK_SET);
bpb_sectors = fgetc(dev->f);
fseek(dev->f, 0x18, SEEK_SET);
bpb_sides = fgetc(dev->f);
fseek(dev->f, dev->base, SEEK_SET);
first_byte = fgetc(dev->f);
fseek(dev->fp, 0x14, SEEK_SET);
bpb_sectors = fgetc(dev->fp);
fseek(dev->fp, 0x18, SEEK_SET);
bpb_sides = fgetc(dev->fp);
fseek(dev->fp, dev->base, SEEK_SET);
first_byte = fgetc(dev->fp);
fdi = 1;
cqm = 0;
@@ -734,53 +734,53 @@ img_load(int drive, char *fn)
fdf = 0;
} else {
/* Read the first four bytes. */
fseek(dev->f, 0x00, SEEK_SET);
first_byte = fgetc(dev->f);
fseek(dev->f, 0x01, SEEK_SET);
second_byte = fgetc(dev->f);
fseek(dev->f, 0x02, SEEK_SET);
third_byte = fgetc(dev->f);
fseek(dev->f, 0x03, SEEK_SET);
fourth_byte = fgetc(dev->f);
fseek(dev->fp, 0x00, SEEK_SET);
first_byte = fgetc(dev->fp);
fseek(dev->fp, 0x01, SEEK_SET);
second_byte = fgetc(dev->fp);
fseek(dev->fp, 0x02, SEEK_SET);
third_byte = fgetc(dev->fp);
fseek(dev->fp, 0x03, SEEK_SET);
fourth_byte = fgetc(dev->fp);
if ((first_byte == 0x1A) && (second_byte == 'F') && (third_byte == 'D') && (fourth_byte == 'F')) {
/* This is a FDF image. */
img_log("img_load(): File is a FDF image...\n");
fwriteprot[drive] = writeprot[drive] = 1;
fclose(dev->f);
dev->f = plat_fopen(fn, "rb");
fclose(dev->fp);
dev->fp = plat_fopen(fn, "rb");
fdf = 1;
cqm = 0;
dev->disk_at_once = 1;
fseek(dev->f, 0x50, SEEK_SET);
(void) !fread(&dev->tracks, 1, 4, dev->f);
fseek(dev->fp, 0x50, SEEK_SET);
(void) !fread(&dev->tracks, 1, 4, dev->fp);
/* Decode the entire file - pass 1, no write to buffer, determine length. */
fseek(dev->f, 0x80, SEEK_SET);
fseek(dev->fp, 0x80, SEEK_SET);
size = 0;
track_bytes = 0;
bpos = dev->disk_data;
while (!feof(dev->f)) {
while (!feof(dev->fp)) {
if (!track_bytes) {
/* Skip first 3 bytes - their meaning is unknown to us but could be a checksum. */
first_byte = fgetc(dev->f);
(void) !fread(&track_bytes, 1, 2, dev->f);
first_byte = fgetc(dev->fp);
(void) !fread(&track_bytes, 1, 2, dev->fp);
img_log("Block header: %02X %04X ", first_byte, track_bytes);
/* Read the length of encoded data block. */
(void) !fread(&track_bytes, 1, 2, dev->f);
(void) !fread(&track_bytes, 1, 2, dev->fp);
img_log("%04X\n", track_bytes);
}
if (feof(dev->f))
if (feof(dev->fp))
break;
if (first_byte == 0xFF)
break;
if (first_byte) {
run = fgetc(dev->f);
run = fgetc(dev->fp);
/* I *HAVE* to read something because fseek tries to be smart and never hits EOF, causing an infinite loop. */
track_bytes--;
@@ -788,12 +788,12 @@ img_load(int drive, char *fn)
if (run & 0x80) {
/* Repeat. */
track_bytes--;
rep_byte = fgetc(dev->f);
rep_byte = fgetc(dev->fp);
} else {
/* Literal. */
track_bytes -= (run & 0x7f);
literal = (uint8_t *) malloc(run & 0x7f);
(void) !fread(literal, 1, (run & 0x7f), dev->f);
(void) !fread(literal, 1, (run & 0x7f), dev->fp);
free(literal);
}
size += (run & 0x7f);
@@ -803,12 +803,12 @@ img_load(int drive, char *fn)
/* Literal block. */
size += (track_bytes - fdf_suppress_final_byte);
literal = (uint8_t *) malloc(track_bytes);
(void) !fread(literal, 1, track_bytes, dev->f);
(void) !fread(literal, 1, track_bytes, dev->fp);
free(literal);
track_bytes = 0;
}
if (feof(dev->f))
if (feof(dev->fp))
break;
}
@@ -816,28 +816,28 @@ img_load(int drive, char *fn)
dev->disk_data = (uint8_t *) malloc(size);
/* Decode the entire file - pass 2, write to buffer. */
fseek(dev->f, 0x80, SEEK_SET);
fseek(dev->fp, 0x80, SEEK_SET);
track_bytes = 0;
bpos = dev->disk_data;
while (!feof(dev->f)) {
while (!feof(dev->fp)) {
if (!track_bytes) {
/* Skip first 3 bytes - their meaning is unknown to us but could be a checksum. */
first_byte = fgetc(dev->f);
(void) !fread(&track_bytes, 1, 2, dev->f);
first_byte = fgetc(dev->fp);
(void) !fread(&track_bytes, 1, 2, dev->fp);
img_log("Block header: %02X %04X ", first_byte, track_bytes);
/* Read the length of encoded data block. */
(void) !fread(&track_bytes, 1, 2, dev->f);
(void) !fread(&track_bytes, 1, 2, dev->fp);
img_log("%04X\n", track_bytes);
}
if (feof(dev->f))
if (feof(dev->fp))
break;
if (first_byte == 0xFF)
break;
if (first_byte) {
run = fgetc(dev->f);
run = fgetc(dev->fp);
real_run = (run & 0x7f);
/* I *HAVE* to read something because fseek tries to be smart and never hits EOF, causing an infinite loop. */
@@ -848,14 +848,14 @@ img_load(int drive, char *fn)
track_bytes--;
if (!track_bytes)
real_run -= fdf_suppress_final_byte;
rep_byte = fgetc(dev->f);
rep_byte = fgetc(dev->fp);
if (real_run)
memset(bpos, rep_byte, real_run);
} else {
/* Literal. */
track_bytes -= real_run;
literal = (uint8_t *) malloc(real_run);
(void) !fread(literal, 1, real_run, dev->f);
(void) !fread(literal, 1, real_run, dev->fp);
if (!track_bytes)
real_run -= fdf_suppress_final_byte;
if (run & 0x7f)
@@ -866,14 +866,14 @@ img_load(int drive, char *fn)
} else {
/* Literal block. */
literal = (uint8_t *) malloc(track_bytes);
(void) !fread(literal, 1, track_bytes, dev->f);
(void) !fread(literal, 1, track_bytes, dev->fp);
memcpy(bpos, literal, track_bytes - fdf_suppress_final_byte);
free(literal);
bpos += (track_bytes - fdf_suppress_final_byte);
track_bytes = 0;
}
if (feof(dev->f))
if (feof(dev->fp))
break;
}
@@ -892,48 +892,48 @@ img_load(int drive, char *fn)
if (((first_byte == 'C') && (second_byte == 'Q')) || ((first_byte == 'c') && (second_byte == 'q'))) {
img_log("img_load(): File is a CopyQM image...\n");
fwriteprot[drive] = writeprot[drive] = 1;
fclose(dev->f);
dev->f = plat_fopen(fn, "rb");
fclose(dev->fp);
dev->fp = plat_fopen(fn, "rb");
fseek(dev->f, 0x03, SEEK_SET);
(void) !fread(&bpb_bps, 1, 2, dev->f);
fseek(dev->fp, 0x03, SEEK_SET);
(void) !fread(&bpb_bps, 1, 2, dev->fp);
#if 0
fseek(dev->f, 0x0B, SEEK_SET);
(void) !fread(&bpb_total, 1, 2, dev->f);
fseek(dev->fp, 0x0B, SEEK_SET);
(void) !fread(&bpb_total, 1, 2, dev->fp);
#endif
fseek(dev->f, 0x10, SEEK_SET);
bpb_sectors = fgetc(dev->f);
fseek(dev->f, 0x12, SEEK_SET);
bpb_sides = fgetc(dev->f);
fseek(dev->f, 0x5B, SEEK_SET);
dev->tracks = fgetc(dev->f);
fseek(dev->fp, 0x10, SEEK_SET);
bpb_sectors = fgetc(dev->fp);
fseek(dev->fp, 0x12, SEEK_SET);
bpb_sides = fgetc(dev->fp);
fseek(dev->fp, 0x5B, SEEK_SET);
dev->tracks = fgetc(dev->fp);
bpb_total = ((uint16_t) bpb_sectors) * ((uint16_t) bpb_sides) * dev->tracks;
fseek(dev->f, 0x74, SEEK_SET);
dev->interleave = fgetc(dev->f);
fseek(dev->f, 0x76, SEEK_SET);
dev->skew = fgetc(dev->f);
fseek(dev->fp, 0x74, SEEK_SET);
dev->interleave = fgetc(dev->fp);
fseek(dev->fp, 0x76, SEEK_SET);
dev->skew = fgetc(dev->fp);
dev->disk_data = (uint8_t *) malloc(((uint32_t) bpb_total) * ((uint32_t) bpb_bps));
memset(dev->disk_data, 0xf6, ((uint32_t) bpb_total) * ((uint32_t) bpb_bps));
fseek(dev->f, 0x6F, SEEK_SET);
(void) !fread(&comment_len, 1, 2, dev->f);
fseek(dev->fp, 0x6F, SEEK_SET);
(void) !fread(&comment_len, 1, 2, dev->fp);
fseek(dev->f, -1, SEEK_END);
size = ftell(dev->f) + 1;
fseek(dev->fp, -1, SEEK_END);
size = ftell(dev->fp) + 1;
fseek(dev->f, 133 + comment_len, SEEK_SET);
fseek(dev->fp, 133 + comment_len, SEEK_SET);
cur_pos = 0;
while (!feof(dev->f)) {
(void) !fread(&block_len, 1, 2, dev->f);
while (!feof(dev->fp)) {
(void) !fread(&block_len, 1, 2, dev->fp);
if (!feof(dev->f)) {
if (!feof(dev->fp)) {
if (block_len < 0) {
rep_byte = fgetc(dev->f);
rep_byte = fgetc(dev->fp);
block_len = -block_len;
if ((cur_pos + block_len) > ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)) {
block_len = ((uint32_t) bpb_total) * ((uint32_t) bpb_bps) - cur_pos;
@@ -946,10 +946,10 @@ img_load(int drive, char *fn)
} else if (block_len > 0) {
if ((cur_pos + block_len) > ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)) {
block_len = ((uint32_t) bpb_total) * ((uint32_t) bpb_bps) - cur_pos;
(void) !fread(dev->disk_data + cur_pos, 1, block_len, dev->f);
(void) !fread(dev->disk_data + cur_pos, 1, block_len, dev->fp);
break;
} else {
(void) !fread(dev->disk_data + cur_pos, 1, block_len, dev->f);
(void) !fread(dev->disk_data + cur_pos, 1, block_len, dev->fp);
cur_pos += block_len;
}
}
@@ -969,22 +969,22 @@ img_load(int drive, char *fn)
fwriteprot[drive] = writeprot[drive] = 1;
} else
img_log("img_load(): File is a raw image...\n");
fseek(dev->f, dev->base + 0x0B, SEEK_SET);
(void) !fread(&bpb_bps, 1, 2, dev->f);
fseek(dev->f, dev->base + 0x13, SEEK_SET);
(void) !fread(&bpb_total, 1, 2, dev->f);
fseek(dev->f, dev->base + 0x15, SEEK_SET);
bpb_mid = fgetc(dev->f);
fseek(dev->f, dev->base + 0x18, SEEK_SET);
bpb_sectors = fgetc(dev->f);
fseek(dev->f, dev->base + 0x1A, SEEK_SET);
bpb_sides = fgetc(dev->f);
fseek(dev->fp, dev->base + 0x0B, SEEK_SET);
(void) !fread(&bpb_bps, 1, 2, dev->fp);
fseek(dev->fp, dev->base + 0x13, SEEK_SET);
(void) !fread(&bpb_total, 1, 2, dev->fp);
fseek(dev->fp, dev->base + 0x15, SEEK_SET);
bpb_mid = fgetc(dev->fp);
fseek(dev->fp, dev->base + 0x18, SEEK_SET);
bpb_sectors = fgetc(dev->fp);
fseek(dev->fp, dev->base + 0x1A, SEEK_SET);
bpb_sides = fgetc(dev->fp);
cqm = 0;
}
fseek(dev->f, -1, SEEK_END);
size = ftell(dev->f) + 1;
fseek(dev->fp, -1, SEEK_END);
size = ftell(dev->fp) + 1;
if (ddi)
size -= 0x2400;
@@ -1125,7 +1125,7 @@ jump_if_fdf:
dev->tracks = 86;
} else {
img_log("Image is bigger than can fit on an ED floppy, ejecting...\n");
fclose(dev->f);
fclose(dev->fp);
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
@@ -1138,9 +1138,9 @@ jump_if_fdf:
/* The BPB readings appear to be valid, so let's set the values. */
if (fdi) {
/* The image is a Japanese FDI, therefore we read the number of tracks from the header. */
if (fseek(dev->f, 0x1C, SEEK_SET) == -1)
if (fseek(dev->fp, 0x1C, SEEK_SET) == -1)
fatal("Japanese FDI: Failed when seeking to 0x1C\n");
(void) !fread(&(dev->tracks), 1, 4, dev->f);
(void) !fread(&(dev->tracks), 1, 4, dev->fp);
} else {
if (!cqm && !fdf) {
/* Number of tracks = number of total sectors divided by sides times sectors per track. */
@@ -1182,7 +1182,7 @@ jump_if_fdf:
if (temp_rate == 0xFF) {
img_log("Image is bigger than can fit on an ED floppy, ejecting...\n");
fclose(dev->f);
fclose(dev->fp);
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
@@ -1199,7 +1199,7 @@ jump_if_fdf:
}
if (!dev->gap3_size) {
img_log("ERROR: Floppy image of unknown format was inserted into drive %c:!\n", drive + 0x41);
fclose(dev->f);
fclose(dev->fp);
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
@@ -1259,9 +1259,9 @@ img_close(int drive)
d86f_unregister(drive);
if (dev->f != NULL) {
fclose(dev->f);
dev->f = NULL;
if (dev->fp != NULL) {
fclose(dev->fp);
dev->fp = NULL;
}
if (dev->disk_data != NULL)

View File

@@ -62,7 +62,7 @@
#define NSIDES 2
#define NSECTORS 256
typedef struct {
typedef struct sector_t {
uint8_t track; /* ID: track number */
uint8_t side; /* side number */
uint8_t sector; /* sector number 1.. */
@@ -70,8 +70,8 @@ typedef struct {
uint8_t *data; /* allocated data for it */
} sector_t;
typedef struct {
FILE *f;
typedef struct json_t {
FILE *fp;
/* Geometry. */
uint8_t tracks; /* number of tracks */
@@ -215,7 +215,7 @@ load_image(json_t *dev)
int level;
char *ptr;
if (dev->f == NULL) {
if (dev->fp == NULL) {
json_log("JSON: no file loaded!\n");
return 0;
}
@@ -232,8 +232,8 @@ load_image(json_t *dev)
level = state = 0;
while (state >= 0) {
/* Get a character from the input. */
c = fgetc(dev->f);
if ((c == EOF) || ferror(dev->f)) {
c = fgetc(dev->fp);
if ((c == EOF) || ferror(dev->fp)) {
state = -1;
break;
}
@@ -372,6 +372,9 @@ load_image(json_t *dev)
}
dev->track++;
break;
default:
break;
}
}
@@ -396,7 +399,7 @@ json_seek(int drive, int track)
int rsec;
int asec;
if (dev->f == NULL) {
if (dev->fp == NULL) {
json_log("JSON: seek: no file loaded!\n");
return;
}
@@ -530,8 +533,8 @@ json_load(int drive, char *fn)
memset(dev, 0x00, sizeof(json_t));
/* Open the image file. */
dev->f = plat_fopen(fn, "rb");
if (dev->f == NULL) {
dev->fp = plat_fopen(fn, "rb");
if (dev->fp == NULL) {
free(dev);
memset(fn, 0x00, sizeof(char));
return;
@@ -546,7 +549,7 @@ json_load(int drive, char *fn)
/* Load all sectors from the image file. */
if (!load_image(dev)) {
json_log("JSON: failed to initialize\n");
(void) fclose(dev->f);
(void) fclose(dev->fp);
free(dev);
images[drive] = NULL;
memset(fn, 0x00, sizeof(char));
@@ -608,8 +611,8 @@ json_load(int drive, char *fn)
if (temp_rate == 0xff) {
json_log("JSON: invalid image (temp_rate=0xff)\n");
(void) fclose(dev->f);
dev->f = NULL;
(void) fclose(dev->fp);
dev->fp = NULL;
free(dev);
images[drive] = NULL;
memset(fn, 0x00, sizeof(char));
@@ -630,8 +633,8 @@ json_load(int drive, char *fn)
if (!dev->gap3_len) {
json_log("JSON: image of unknown format was inserted into drive %c:!\n",
'C' + drive);
(void) fclose(dev->f);
dev->f = NULL;
(void) fclose(dev->fp);
dev->fp = NULL;
free(dev);
images[drive] = NULL;
memset(fn, 0x00, sizeof(char));
@@ -692,8 +695,8 @@ json_close(int drive)
}
}
if (dev->f != NULL)
(void) fclose(dev->f);
if (dev->fp != NULL)
(void) fclose(dev->fp);
/* Release the memory. */
free(dev);

View File

@@ -32,7 +32,7 @@
#include <86box/fdc.h>
#pragma pack(push, 1)
typedef struct {
typedef struct mfm_header_t {
uint8_t hdr_name[7];
uint16_t tracks_no;
@@ -45,14 +45,14 @@ typedef struct {
uint32_t track_list_offset;
} mfm_header_t;
typedef struct {
typedef struct mfm_track_t {
uint16_t track_no;
uint8_t side_no;
uint32_t track_size;
uint32_t track_offset;
} mfm_track_t;
typedef struct {
typedef struct mfm_adv_track_t {
uint16_t track_no;
uint8_t side_no;
uint16_t rpm;
@@ -62,8 +62,8 @@ typedef struct {
} mfm_adv_track_t;
#pragma pack(pop)
typedef struct {
FILE *f;
typedef struct mfm_t {
FILE *fp;
mfm_header_t hdr;
mfm_track_t *tracks;
@@ -345,12 +345,12 @@ mfm_read_side(int drive, int side)
memset(dev->track_data[side], 0x00, track_bytes);
else {
if (dev->hdr.if_type & 0x80)
ret = fseek(dev->f, dev->adv_tracks[track_index].track_offset, SEEK_SET);
ret = fseek(dev->fp, dev->adv_tracks[track_index].track_offset, SEEK_SET);
else
ret = fseek(dev->f, dev->tracks[track_index].track_offset, SEEK_SET);
ret = fseek(dev->fp, dev->tracks[track_index].track_offset, SEEK_SET);
if (ret == -1)
fatal("mfm_read_side(): Error seeking to the beginning of the file\n");
if (fread(dev->track_data[side], 1, track_bytes, dev->f) != track_bytes)
if (fread(dev->track_data[side], 1, track_bytes, dev->fp) != track_bytes)
fatal("mfm_read_side(): Error reading track bytes\n");
}
@@ -373,7 +373,7 @@ mfm_seek(int drive, int track)
dev->cur_track = track;
d86f_set_cur_track(drive, track);
if (dev->f == NULL)
if (dev->fp == NULL)
return;
if (track < 0)
@@ -399,8 +399,8 @@ mfm_load(int drive, char *fn)
dev = (mfm_t *) malloc(sizeof(mfm_t));
memset(dev, 0x00, sizeof(mfm_t));
dev->f = plat_fopen(fn, "rb");
if (dev->f == NULL) {
dev->fp = plat_fopen(fn, "rb");
if (dev->fp == NULL) {
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
@@ -410,7 +410,7 @@ mfm_load(int drive, char *fn)
/* Read the header. */
size = sizeof(mfm_header_t);
if (fread(&dev->hdr, 1, size, dev->f) != size)
if (fread(&dev->hdr, 1, size, dev->fp) != size)
fatal("mfm_load(): Error reading header\n");
/* Calculate tracks * sides, allocate the tracks array, and read it. */
@@ -418,12 +418,12 @@ mfm_load(int drive, char *fn)
if (dev->hdr.if_type & 0x80) {
dev->adv_tracks = (mfm_adv_track_t *) malloc(dev->total_tracks * sizeof(mfm_adv_track_t));
size = dev->total_tracks * sizeof(mfm_adv_track_t);
if (fread(dev->adv_tracks, 1, size, dev->f) != size)
if (fread(dev->adv_tracks, 1, size, dev->fp) != size)
fatal("mfm_load(): Error reading advanced tracks\n");
} else {
dev->tracks = (mfm_track_t *) malloc(dev->total_tracks * sizeof(mfm_track_t));
size = dev->total_tracks * sizeof(mfm_track_t);
if (fread(dev->tracks, 1, size, dev->f) != size)
if (fread(dev->tracks, 1, size, dev->fp) != size)
fatal("mfm_load(): Error reading tracks\n");
}
@@ -504,8 +504,8 @@ mfm_close(int drive)
if (dev->adv_tracks)
free(dev->adv_tracks);
if (dev->f)
fclose(dev->f);
if (dev->fp)
fclose(dev->fp);
/* Release the memory. */
free(dev);

View File

@@ -60,7 +60,7 @@
/* update when cumulative frequency */
/* reaches to this value */
typedef struct {
typedef struct tdlzhuf_t {
uint16_t r;
uint16_t bufcnt; /* string buffer */
uint16_t bufndx; /* string buffer */
@@ -72,7 +72,7 @@ typedef struct {
uint8_t inbuf[BUFSZ]; /* input buffer */
} tdlzhuf;
typedef struct {
typedef struct td0dsk_t {
FILE *fdd_file;
off_t fdd_file_offset;
@@ -93,7 +93,7 @@ typedef struct {
uint8_t getlen;
} td0dsk_t;
typedef struct {
typedef struct td0_sector_t {
uint8_t track;
uint8_t head;
uint8_t sector;
@@ -103,8 +103,8 @@ typedef struct {
uint8_t *data;
} td0_sector_t;
typedef struct {
FILE *f;
typedef struct td0_t {
FILE *fp;
int tracks;
int track_width;
@@ -227,9 +227,9 @@ fdd_image_read(int drive, char *buffer, uint32_t offset, uint32_t len)
{
td0_t *dev = td0[drive];
if (fseek(dev->f, offset, SEEK_SET) == -1)
if (fseek(dev->fp, offset, SEEK_SET) == -1)
fatal("fdd_image_read(): Error seeking to the beginning of the file\n");
if (fread(buffer, 1, len, dev->f) != len)
if (fread(buffer, 1, len, dev->fp) != len)
fatal("fdd_image_read(): Error reading data\n");
}
@@ -627,13 +627,13 @@ td0_initialize(int drive)
int size_diff;
int gap_sum;
if (dev->f == NULL) {
if (dev->fp == NULL) {
td0_log("TD0: Attempted to initialize without loading a file first\n");
return 0;
}
fseek(dev->f, 0, SEEK_END);
file_size = ftell(dev->f);
fseek(dev->fp, 0, SEEK_END);
file_size = ftell(dev->fp);
if (file_size < 12) {
td0_log("TD0: File is too small to even contain the header\n");
@@ -645,21 +645,21 @@ td0_initialize(int drive)
return 0;
}
fseek(dev->f, 0, SEEK_SET);
(void) !fread(header, 1, 12, dev->f);
fseek(dev->fp, 0, SEEK_SET);
(void) !fread(header, 1, 12, dev->fp);
head_count = header[9];
if (header[0] == 't') {
td0_log("TD0: File is compressed\n");
disk_decode.fdd_file = dev->f;
disk_decode.fdd_file = dev->fp;
state_init_Decode(&disk_decode);
disk_decode.fdd_file_offset = 12;
state_Decode(&disk_decode, dev->imagebuf, TD0_MAX_BUFSZ);
} else {
td0_log("TD0: File is uncompressed\n");
if (fseek(dev->f, 12, SEEK_SET) == -1)
if (fseek(dev->fp, 12, SEEK_SET) == -1)
fatal("td0_initialize(): Error seeking to offet 12\n");
if (fread(dev->imagebuf, 1, file_size - 12, dev->f) != (file_size - 12))
if (fread(dev->imagebuf, 1, file_size - 12, dev->fp) != (file_size - 12))
fatal("td0_initialize(): Error reading image buffer\n");
}
@@ -710,6 +710,9 @@ td0_initialize(int drive)
dev->default_track_flags = (density == 1) ? 0x00 : ((density == 2) ? 0x03 : 0x02);
dev->max_sector_size = (density == 1) ? 6 : ((density == 2) ? 7 : 5); /* 16384, 8192, or 4096 bytes. */
break;
default:
break;
}
dev->disk_flags = header[5] & 0x06;
@@ -1064,7 +1067,7 @@ td0_seek(int drive, int track)
int fm;
int sector_adjusted;
if (dev->f == NULL)
if (dev->fp == NULL)
return;
if (!dev->track_width && fdd_doublestep_40(drive))
@@ -1182,8 +1185,8 @@ td0_abort(int drive)
free(dev->imagebuf);
if (dev->processed_buf)
free(dev->processed_buf);
if (dev->f)
fclose(dev->f);
if (dev->fp)
fclose(dev->fp);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
free(dev);
td0[drive] = NULL;
@@ -1203,8 +1206,8 @@ td0_load(int drive, char *fn)
memset(dev, 0x00, sizeof(td0_t));
td0[drive] = dev;
dev->f = plat_fopen(fn, "rb");
if (dev->f == NULL) {
dev->fp = plat_fopen(fn, "rb");
if (dev->fp == NULL) {
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
return;
}
@@ -1285,8 +1288,8 @@ td0_close(int drive)
memset(dev->sects[i][j], 0, sizeof(td0_sector_t));
}
if (dev->f != NULL)
fclose(dev->f);
if (dev->fp != NULL)
fclose(dev->fp);
/* Release resources. */
free(dev);

View File

@@ -36,7 +36,9 @@
#include <fdi2raw.h>
#include <86box/plat_unused.h>
#ifdef DEBUG
#undef DEBUG
#endif
#define VERBOSE
#undef VERBOSE
@@ -96,24 +98,24 @@ static int fdi_allocated;
#ifdef DEBUG
static void
fdi_free(void *p)
fdi_free(void *priv)
{
int size;
if (!p)
if (!priv)
return;
size = ((int *) p)[-1];
size = ((int *) priv)[-1];
fdi_allocated -= size;
write_log("%d freed (%d)\n", size, fdi_allocated);
free((int *) p - 1);
free((int *) priv - 1);
}
static void *
fdi_malloc(int size)
{
void *p = xmalloc(size + sizeof(int));
((int *) p)[0] = size;
void *priv = xmalloc(size + sizeof(int));
((int *) prv)[0] = size;
fdi_allocated += size;
write_log("%d allocated (%d)\n", size, fdi_allocated);
return (int *) p + 1;
return (int *) priv + 1;
}
#else
# define fdi_free free
@@ -1290,6 +1292,9 @@ track_atari_st(struct fdi *fdi, int max_sector)
case 10:
gap3 = 24;
break;
default:
break;
}
s15(fdi);
for (int i = 0; i < max_sector; i++) {
@@ -1944,8 +1949,8 @@ decode_lowlevel_track(FDI *fdi, int track, struct fdi_cache *cache)
uint32_t maxidx;
uint32_t totalavg;
uint32_t weakbits;
int i;
int j;
int k;
int len;
int pulses;
int indexoffset;
@@ -1974,7 +1979,7 @@ decode_lowlevel_track(FDI *fdi, int track, struct fdi_cache *cache)
maxp = (uint32_t *) fdi_decompress(pulses, p1 + 6, p1 + len, &max_free);
len += get_u24(p1 + 6) & 0x3fffff;
/* Computes the real min and max values */
for (i = 0; i < pulses; i++) {
for (int i = 0; i < pulses; i++) {
maxp[i] = avgp[i] + minp[i] - maxp[i];
minp[i] = avgp[i] - minp[i];
}
@@ -2000,7 +2005,7 @@ decode_lowlevel_track(FDI *fdi, int track, struct fdi_cache *cache)
} else {
idxp = fdi_malloc(pulses * 2);
idx_free = 1;
for (i = 0; i < pulses; i++) {
for (int i = 0; i < pulses; i++) {
idxp[i * 2 + 0] = 2;
idxp[i * 2 + 1] = 0;
}
@@ -2011,43 +2016,43 @@ decode_lowlevel_track(FDI *fdi, int track, struct fdi_cache *cache)
maxidx = 0;
indexoffset = 0;
p1 = idxp;
for (i = 0; i < pulses; i++) {
for (int i = 0; i < pulses; i++) {
if ((uint32_t) p1[idx_off1] + (uint32_t) p1[idx_off2] > maxidx)
maxidx = p1[idx_off1] + p1[idx_off2];
p1 += idx_off3;
}
p1 = idxp;
for (i = 0; (i < pulses) && (p1[idx_off2] != 0); i++) /* falling edge, replace with idx_off1 for rising edge */
for (k = 0; (k < pulses) && (p1[idx_off2] != 0); k++) /* falling edge, replace with idx_off1 for rising edge */
p1 += idx_off3;
if (i < pulses) {
j = i;
if (k < pulses) {
j = k;
do {
i++;
k++;
p1 += idx_off3;
if (i >= pulses) {
i = 0;
if (k >= pulses) {
k = 0;
p1 = idxp;
}
} while ((i != j) && (p1[idx_off2] == 0)); /* falling edge, replace with idx_off1 for rising edge */
if (i != j) /* index pulse detected */
} while ((k != j) && (p1[idx_off2] == 0)); /* falling edge, replace with idx_off1 for rising edge */
if (k != j) /* index pulse detected */
{
while ((i != j) && (p1[idx_off1] > p1[idx_off2])) { /* falling edge, replace with "<" for rising edge */
i++;
while ((k != j) && (p1[idx_off1] > p1[idx_off2])) { /* falling edge, replace with "<" for rising edge */
k++;
p1 += idx_off3;
if (i >= pulses) {
i = 0;
if (k >= pulses) {
k = 0;
p1 = idxp;
}
}
if (i != j)
indexoffset = i; /* index position detected */
if (k != j)
indexoffset = k; /* index position detected */
}
}
p1 = idxp;
p2 = avgp;
totalavg = 0;
weakbits = 0;
for (i = 0; i < pulses; i++) {
for (int i = 0; i < pulses; i++) {
uint32_t sum = p1[idx_off1] + p1[idx_off2];
if (sum >= maxidx) {
totalavg += *p2;

View File

@@ -120,13 +120,20 @@ typedef struct _gdbstub_client_ {
int socket;
struct sockaddr_in addr;
char packet[16384], response[16384];
int has_packet : 1, first_packet_received : 1, ida_mode : 1, waiting_stop : 1,
packet_pos, response_pos;
char packet[16384], response[16384];
uint8_t has_packet : 1;
uint8_t first_packet_received : 1;
uint8_t ida_mode : 1;
uint8_t waiting_stop : 1;
int packet_pos;
int response_pos;
event_t *processed_event, *response_event;
event_t *processed_event;
event_t *response_event;
uint16_t last_io_base, last_io_len, last_io_value;
uint16_t last_io_base;
uint16_t last_io_len;
uint16_t last_io_value;
struct _gdbstub_client_ *next;
} gdbstub_client_t;
@@ -339,7 +346,8 @@ static gdbstub_breakpoint_t *first_rwatch = NULL;
static gdbstub_breakpoint_t *first_wwatch = NULL;
static gdbstub_breakpoint_t *first_awatch = NULL;
int gdbstub_step = 0, gdbstub_next_asap = 0;
int gdbstub_step = 0;
int gdbstub_next_asap = 0;
uint64_t gdbstub_watch_pages[(((uint32_t) -1) >> (MEM_GRANULARITY_BITS + 6)) + 1];
static void
@@ -461,6 +469,9 @@ gdbstub_num_decode(char *p, int *dest, int mode)
else
return 0;
break;
default:
break;
}
p++;
}
@@ -1491,7 +1502,6 @@ gdbstub_client_thread(void *priv)
gdbstub_client_t *client = (gdbstub_client_t *) priv;
uint8_t buf[256];
ssize_t bytes_read;
int i;
gdbstub_log("GDB Stub: New connection from %s:%d\n", inet_ntoa(client->addr.sin_addr), client->addr.sin_port);
@@ -1500,7 +1510,7 @@ gdbstub_client_thread(void *priv)
/* Read data from client. */
while ((bytes_read = recv(client->socket, (char *) buf, sizeof(buf), 0)) > 0) {
for (i = 0; i < bytes_read; i++) {
for (ssize_t i = 0; i < bytes_read; i++) {
switch (buf[i]) {
case '$': /* packet start */
/* Wait for any existing packets to be processed. */

View File

@@ -194,7 +194,7 @@ typedef struct _mem_mapping_ {
/* There is never a needed to pass a pointer to the mapping itself, it is much preferable to
prepare a structure with the requires data (usually, the base address and mask) instead. */
void *p; /* backpointer to device */
void *priv; /* backpointer to device */
} mem_mapping_t;
#ifdef USE_NEW_DYNAREC
@@ -207,9 +207,9 @@ extern uint64_t *byte_code_present_mask;
# define EVICT_NOT_IN_LIST ((uint32_t) -1)
typedef struct page_t {
void (*write_b)(uint32_t addr, uint8_t val, struct page_t *p);
void (*write_w)(uint32_t addr, uint16_t val, struct page_t *p);
void (*write_l)(uint32_t addr, uint32_t val, struct page_t *p);
void (*write_b)(uint32_t addr, uint8_t val, struct page_t *page);
void (*write_w)(uint32_t addr, uint16_t val, struct page_t *page);
void (*write_l)(uint32_t addr, uint32_t val, struct page_t *page);
uint8_t *mem;
@@ -218,9 +218,11 @@ typedef struct page_t {
/*Head of codeblock tree associated with this page*/
uint16_t head;
uint64_t code_present_mask, dirty_mask;
uint64_t code_present_mask;
uint64_t dirty_mask;
uint32_t evict_prev, evict_next;
uint32_t evict_prev;
uint32_t evict_next;
uint64_t *byte_dirty_mask;
uint64_t *byte_code_present_mask;
@@ -228,31 +230,33 @@ typedef struct page_t {
extern uint32_t purgable_page_list_head;
__attribute__((always_inline)) static inline int
page_in_evict_list(page_t *p)
page_in_evict_list(page_t *page)
{
return (p->evict_prev != EVICT_NOT_IN_LIST);
return (page->evict_prev != EVICT_NOT_IN_LIST);
}
void page_remove_from_evict_list(page_t *p);
void page_add_to_evict_list(page_t *p);
void page_remove_from_evict_list(page_t *page);
void page_add_to_evict_list(page_t *page);
#else
typedef struct _page_ {
void (*write_b)(uint32_t addr, uint8_t val, struct _page_ *p);
void (*write_w)(uint32_t addr, uint16_t val, struct _page_ *p);
void (*write_l)(uint32_t addr, uint32_t val, struct _page_ *p);
void (*write_b)(uint32_t addr, uint8_t val, struct _page_ *page);
void (*write_w)(uint32_t addr, uint16_t val, struct _page_ *page);
void (*write_l)(uint32_t addr, uint32_t val, struct _page_ *page);
uint8_t *mem;
uint64_t code_present_mask[4],
dirty_mask[4];
uint64_t code_present_mask[4];
uint64_t dirty_mask[4];
struct codeblock_t *block[4], *block_2[4];
struct codeblock_t *block[4];
struct codeblock_t *block_2[4];
/*Head of codeblock tree associated with this page*/
struct codeblock_t *head;
} page_t;
#endif
extern uint8_t *ram, *ram2;
extern uint8_t *ram;
extern uint8_t *ram2;
extern uint32_t rammask;
extern uint8_t *rom;
@@ -336,37 +340,37 @@ extern void addwritelookup(uint32_t virt, uint32_t phys);
extern void mem_mapping_set(mem_mapping_t *,
uint32_t base,
uint32_t size,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p),
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv),
uint8_t *exec,
uint32_t flags,
void *p);
void *priv);
extern void mem_mapping_add(mem_mapping_t *,
uint32_t base,
uint32_t size,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p),
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv),
uint8_t *exec,
uint32_t flags,
void *p);
void *priv);
extern void mem_mapping_set_handler(mem_mapping_t *,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p));
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv));
extern void mem_mapping_set_p(mem_mapping_t *, void *p);
extern void mem_mapping_set_p(mem_mapping_t *, void *priv);
extern void mem_mapping_set_addr(mem_mapping_t *,
uint32_t base, uint32_t size);
@@ -407,9 +411,9 @@ extern uint64_t mmutranslate_noabrt(uint32_t addr, int rw);
extern void mem_invalidate_range(uint32_t start_addr, uint32_t end_addr);
extern void mem_write_ramb_page(uint32_t addr, uint8_t val, page_t *p);
extern void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *p);
extern void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *p);
extern void mem_write_ramb_page(uint32_t addr, uint8_t val, page_t *page);
extern void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *page);
extern void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *page);
extern void mem_flush_write_page(uint32_t addr, uint32_t virt);
extern void mem_reset_page_blocks(void);

View File

@@ -40,10 +40,11 @@ typedef struct midi_in_handler_t {
int cnt;
uint32_t len;
void (*msg)(void *p, uint8_t *msg, uint32_t len);
int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort);
struct midi_in_handler_t *p;
struct midi_in_handler_t *prev, *next;
void (*msg)(void *priv, uint8_t *msg, uint32_t len);
int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort);
struct midi_in_handler_t *priv;
struct midi_in_handler_t *prev;
struct midi_in_handler_t *next;
} midi_in_handler_t;
typedef struct midi_t {
@@ -77,7 +78,7 @@ extern void midi_raw_out_byte(uint8_t val);
extern void midi_clear_buffer(void);
extern void midi_poll(void);
extern void midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort), void *p);
extern void midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort), void *priv);
extern void midi_in_handlers_clear(void);
extern void midi_in_msg(uint8_t *msg, uint32_t len);
extern void midi_in_sysex(uint8_t *buffer, uint32_t len);

View File

@@ -69,7 +69,7 @@ enum {
PCI_CARD_SOUND = 0x13,
PCI_CARD_IDE = 0x14,
PCI_CARD_NETWORK = 0x15,
PCI_CARD_BRIDGE = 0x16,
PCI_CARD_BRIDGE = 0x16
};
enum {

View File

@@ -47,8 +47,8 @@ typedef struct pc_timer_t {
double period; /* This is used for large period timers to count
the microseconds and split the period. */
void (*callback)(void *p);
void *p;
void (*callback)(void *priv);
void *priv;
struct pc_timer_t *prev;
struct pc_timer_t *next;
@@ -76,7 +76,7 @@ extern void timer_init(void);
/*Add new timer. If start_timer is set, timer will be enabled with a zero
timestamp - this is useful for permanently enabled timers*/
extern void timer_add(pc_timer_t *timer, void (*callback)(void *p), void *p, int start_timer);
extern void timer_add(pc_timer_t *timer, void (*callback)(void *priv), void *priv, int start_timer);
/*1us in 32:32 format*/
extern uint64_t TIMER_USEC;
@@ -162,16 +162,16 @@ timer_get_remaining_u64(pc_timer_t *timer)
/*Set timer callback function*/
static __inline void
timer_set_callback(pc_timer_t *timer, void (*callback)(void *p))
timer_set_callback(pc_timer_t *timer, void (*callback)(void *priv))
{
timer->callback = callback;
}
/*Set timer private data*/
static __inline void
timer_set_p(pc_timer_t *timer, void *p)
timer_set_p(pc_timer_t *timer, void *priv)
{
timer->p = p;
timer->priv = priv;
}
/* The API for big timer periods starts here. */
@@ -209,7 +209,7 @@ timer_process_inline(void)
if (timer->flags & TIMER_SPLIT)
timer_advance_ex(timer, 0); /* We're splitting a > 1 s period into multiple <= 1 s periods. */
else if (timer->callback != NULL) /* Make sure it's no NULL, so that we can have a NULL callback when no operation is needed. */
timer->callback(timer->p);
timer->callback(timer->priv);
}
timer_target = timer_head->ts.ts32.integer;

View File

@@ -39,14 +39,18 @@ typedef struct ibm8514_t {
struct {
uint16_t subsys_cntl;
uint16_t setup_md;
uint8_t advfunc_cntl, ext_advfunc_cntl;
uint16_t cur_y, cur_y_bitres;
uint16_t cur_x, cur_x_bitres;
uint8_t advfunc_cntl;
uint8_t ext_advfunc_cntl;
uint16_t cur_y;
uint16_t cur_y_bitres;
uint16_t cur_x;
uint16_t cur_x_bitres;
int16_t desty_axstp;
int16_t destx_distp;
int16_t err_term;
int16_t maj_axis_pcnt;
uint16_t cmd, cmd_back;
uint16_t cmd;
uint16_t cmd_back;
uint16_t short_stroke;
uint16_t bkgd_color;
uint16_t frgd_color;
@@ -57,63 +61,120 @@ typedef struct ibm8514_t {
uint16_t frgd_mix;
uint16_t multifunc_cntl;
uint16_t multifunc[16];
int16_t clip_left, clip_top;
int16_t clip_left;
int16_t clip_top;
uint8_t pix_trans[2];
int poly_draw;
int ssv_state;
int16_t x1, x2, x3, y1, y2;
int sys_cnt, sys_cnt2;
int x1;
int x2;
int x3;
int y1;
int y2;
int sys_cnt;
int sys_cnt2;
int temp_cnt;
int16_t cx, cy, oldcy;
int16_t sx, sy;
int16_t dx, dy;
int16_t cx;
int16_t cy;
int16_t oldcy;
int16_t sx;
int16_t sy;
int16_t dx;
int16_t dy;
int16_t err;
uint32_t src, dest;
uint32_t newsrc_blt, newdest_blt;
uint32_t newdest_in, newdest_out;
uint8_t *writemono, *nibbleset;
int x_count, xx_count, y_count;
int input, output;
uint32_t src;
uint16_t dest;
uint32_t newsrc_blt;
uint16_t newdest_blt;
uint32_t newdest_in;
uint16_t newdest_out;
uint8_t *writemono;
uint8_t *nibbleset;
int x_count;
int xx_count;
int y_count;
int input;
int output;
uint16_t cur_x_bit12, cur_y_bit12;
uint16_t cur_x_bit12;
uint16_t cur_y_bit12;
int ssv_len;
uint8_t ssv_dir;
uint8_t ssv_draw;
int odd_in, odd_out;
int odd_in;
int odd_out;
uint16_t scratch;
int fill_state, xdir, ydir;
int fill_state;
int xdir;
int ydir;
uint32_t ge_offset;
} accel;
uint16_t test;
int ibm_mode;
int ibm_mode;
int v_total, dispend, v_syncstart, split,
h_disp, h_disp_old, h_total, h_disp_time, rowoffset,
dispon, hdisp_on, linecountff,
vc, linepos, oddeven, cursoron, blink, scrollcache,
firstline, lastline, firstline_draw, lastline_draw,
displine, fullchange;
uint32_t ma, maback;
int v_total;
int dispend;
int v_syncstart;
int split;
int h_disp;
int h_disp_old;
int h_total;
int h_disp_time;
int rowoffset;
int dispon;
int hdisp_on;
int linecountff;
int vc;
int linepos;
int oddeven;
int cursoron;
int blink;
int scrollcache;
int firstline;
int lastline;
int firstline_draw;
int lastline_draw;
int displine;
int fullchange;
uint32_t ma;
uint32_t maback;
uint8_t *vram, *changedvram, linedbl;
uint8_t *vram;
uint8_t *changedvram;
uint8_t linedbl;
uint8_t data_available, data_available2;
uint8_t scanmodulos, rowcount;
int htotal, hdisp, vtadj, vdadj, vsadj, sc,
vtb, vdb, vsb, vsyncstart, vsyncwidth;
int vtotal, vdisp;
int disp_cntl, interlace;
uint8_t subsys_cntl, subsys_stat;
uint8_t data_available;
uint8_t data_available2;
uint8_t scanmodulos;
uint8_t rowcount;
int htotal;
int hdisp;
int vtadj;
int vdadj;
int vsadj;
int sc;
int vtb;
int vdb;
int vsb;
int vsyncstart;
int vsyncwidth;
int vtotal;
int vdisp;
int disp_cntl;
int interlace;
uint8_t subsys_cntl;
uint8_t subsys_stat;
atomic_int force_busy, force_busy2;
atomic_int force_busy;
atomic_int force_busy2;
int blitter_busy;
uint64_t blitter_time;
uint64_t status_time;
int pitch;
int ext_pitch;
int ext_crt_pitch;
int pitch;
int ext_pitch;
int ext_crt_pitch;
} ibm8514_t;
#endif /*VIDEO_8514A_H*/

View File

@@ -32,8 +32,12 @@ enum {
typedef struct ati_eeprom_t {
uint16_t data[256];
int oldclk, oldena;
int opcode, state, count, out;
int oldclk;
int oldena;
int opcode;
int state;
int count;
int out;
int wp;
uint32_t dat;
int type;

View File

@@ -28,21 +28,31 @@ typedef struct cga_t {
uint8_t cgastat;
uint8_t cgamode, cgacol;
uint8_t cgamode;
uint8_t cgacol;
int fontbase;
int linepos, displine;
int sc, vc;
int linepos;
int displine;
int sc;
int vc;
int cgadispon;
int con, coff, cursoron, cgablink;
int vsynctime, vadj;
uint16_t ma, maback;
int con;
int coff;
int cursoron;
int cgablink;
int vsynctime;
int vadj;
uint16_t ma;
uint16_t maback;
int oddeven;
uint64_t dispontime, dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
pc_timer_t timer;
int firstline, lastline;
int firstline;
int lastline;
int drawcursor;

View File

@@ -27,11 +27,26 @@ typedef struct ega_t {
rom_t bios_rom;
uint8_t crtcreg, gdcaddr, attraddr, attrff,
attr_palette_enable, seqaddr, miscout,
writemask, la, lb, lc, ld,
stat, colourcompare, colournocare, scrblank,
plane_mask, pad, pad0, pad1;
uint8_t crtcreg;
uint8_t gdcaddr;
uint8_t attraddr;
uint8_t attrff;
uint8_t attr_palette_enable;
uint8_t seqaddr;
uint8_t miscout;
uint8_t writemask;
uint8_t la;
uint8_t lb;
uint8_t lc;
uint8_t ld;
uint8_t stat;
uint8_t colourcompare;
uint8_t colournocare;
uint8_t scrblank;
uint8_t plane_mask;
uint8_t pad;
uint8_t pad0;
uint8_t pad1;
uint8_t crtc[32];
uint8_t gdcreg[16];
uint8_t attrregs[32];
@@ -41,25 +56,72 @@ typedef struct ega_t {
uint8_t *vram;
int vidclock, fast, extvram, vres,
readmode, writemode, readplane, vrammask,
chain4, chain2_read, chain2_write, con,
oddeven_page, oddeven_chain, vc, sc,
dispon, hdisp_on, cursoron, blink, fullchange,
linepos, vslines, linecountff, oddeven,
lowres, interlace, linedbl, lindebl, rowcount,
vtotal, dispend, vsyncstart, split,
hdisp, hdisp_old, htotal, hdisp_time, rowoffset,
vblankstart, scrollcache, firstline, lastline,
firstline_draw, lastline_draw, x_add, y_add,
displine, res_x, res_y, bpp, index;
int vidclock;
int fast;
int extvram;
int vres;
int readmode;
int writemode;
int readplane;
int vrammask;
int chain4;
int chain2_read;
int chain2_write;
int con;
int oddeven_page;
int oddeven_chain;
int vc;
int sc;
int dispon;
int hdisp_on;
int cursoron;
int blink;
int fullchange;
int linepos;
int vslines;
int linecountff;
int oddeven;
int lowres;
int interlace;
int linedbl;
int lindebl;
int rowcount;
int vtotal;
int dispend;
int vsyncstart;
int split;
int hdisp;
int hdisp_old;
int htotal;
int hdisp_time;
int rowoffset;
int vblankstart;
int scrollcache;
int firstline;
int lastline;
int firstline_draw;
int lastline_draw;
int x_add;
int y_add;
int displine;
int res_x;
int res_y;
int bpp;
int index;
uint32_t charseta, charsetb, ma_latch, ma,
maback, ca, vram_limit, overscan_color;
uint32_t charseta;
uint32_t charsetb;
uint32_t ma_latch;
uint32_t ma;
uint32_t maback;
uint32_t ca;
uint32_t vram_limit;
uint32_t overscan_color;
uint32_t *pallook;
uint64_t dispontime, dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
pc_timer_t timer;
double clock;
@@ -97,18 +159,22 @@ extern void ega_recalctimings(struct ega_t *ega);
extern void ega_recalc_remap_func(struct ega_t *ega);
#endif
extern void ega_out(uint16_t addr, uint8_t val, void *p);
extern uint8_t ega_in(uint16_t addr, void *p);
extern void ega_poll(void *p);
extern void ega_write(uint32_t addr, uint8_t val, void *p);
extern uint8_t ega_read(uint32_t addr, void *p);
extern void ega_out(uint16_t addr, uint8_t val, void *priv);
extern uint8_t ega_in(uint16_t addr, void *priv);
extern void ega_poll(void *priv);
extern void ega_write(uint32_t addr, uint8_t val, void *priv);
extern uint8_t ega_read(uint32_t addr, void *priv);
extern int firstline_draw, lastline_draw;
extern int firstline_draw;
extern int lastline_draw;
extern int displine;
extern int sc;
extern uint32_t ma, ca;
extern int con, cursoron, cgablink;
extern uint32_t ma;
extern uint32_t ca;
extern int con;
extern int cursoron;
extern int cgablink;
extern int scrollcache;

View File

@@ -25,30 +25,32 @@
typedef struct {
mem_mapping_t mapping;
uint8_t crtc[32], charbuffer[4096];
uint8_t crtc[32];
uint8_t charbuffer[4096];
int crtcreg;
uint8_t ctrl,
ctrl2,
stat;
uint8_t ctrl;
uint8_t ctrl2;
uint8_t stat;
uint64_t dispontime,
dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
pc_timer_t timer;
int firstline,
lastline;
int firstline;
int lastline;
int linepos,
displine;
int vc,
sc;
uint16_t ma,
maback;
int con, coff,
cursoron;
int dispon,
blink;
int linepos;
int displine;
int vc;
int sc;
uint16_t ma;
uint16_t maback;
int con;
int coff;
int cursoron;
int dispon;
int blink;
int vsynctime;
int vadj;

View File

@@ -11,18 +11,27 @@ typedef struct mda_t {
uint8_t crtc[32];
int crtcreg;
uint8_t ctrl, stat;
uint8_t ctrl;
uint8_t stat;
uint64_t dispontime, dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
pc_timer_t timer;
int firstline, lastline;
int firstline;
int lastline;
int linepos, displine;
int vc, sc;
uint16_t ma, maback;
int con, coff, cursoron;
int dispon, blink;
int linepos;
int displine;
int vc;
int sc;
uint16_t ma;
uint16_t maback;
int con;
int coff;
int cursoron;
int dispon;
int blink;
int vsynctime;
int vadj;
int monitor_index;

View File

@@ -59,10 +59,10 @@ typedef struct pgc {
mem_mapping_t mapping;
mem_mapping_t cga_mapping;
pgc_cl_t *clist,
*clcur;
const pgc_cmd_t *master,
*commands;
pgc_cl_t *clist;
pgc_cl_t *clcur;
const pgc_cmd_t *master;
const pgc_cmd_t *commands;
uint8_t mapram[2048]; /* host <> PGC communication buffer */
uint8_t *cga_vram;
@@ -73,10 +73,18 @@ typedef struct pgc {
uint32_t userpal[256];
uint32_t maxw, maxh; /* maximum framebuffer size */
uint32_t visw, vish; /* maximum screen size */
uint32_t screenw, screenh;
int16_t pan_x, pan_y;
uint16_t win_x1, win_x2, win_y1, win_y2;
uint16_t vp_x1, vp_x2, vp_y1, vp_y2;
uint32_t screenw;
uint32_t screenh;
int16_t pan_x;
int16_t pan_y;
uint16_t win_x1;
uint16_t win_x2;
uint16_t win_y1;
uint16_t win_y2;
uint16_t vp_x1;
uint16_t vp_x2;
uint16_t vp_y1;
uint16_t vp_y2;
int16_t fill_pattern[16];
int16_t line_pattern;
uint8_t draw_mode;
@@ -86,7 +94,9 @@ typedef struct pgc {
uint8_t tjust_v; /* vert alignment 1=bottom 2=ctr 3=top*/
int32_t tsize; /* horizontal spacing */
int32_t x, y, z; /* drawing position */
int32_t x;
int32_t y;
int32_t z; /* drawing position */
thread_t *pgc_thread;
event_t *pgc_wake_thread;
@@ -98,18 +108,23 @@ typedef struct pgc {
int ascii_mode;
int result_count;
int fontbase;
int linepos,
displine;
int fontbase;
int linepos;
int displine;
int vc;
int cgadispon;
int con, coff, cursoron, cgablink;
int vsynctime, vadj;
uint16_t ma, maback;
int con;
int coff;
int cursoron;
int cgablink;
int vsynctime;
int vadj;
uint16_t ma;
uint16_t maback;
int oddeven;
uint64_t dispontime,
dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
pc_timer_t timer;
double native_pixel_clock;
@@ -140,10 +155,14 @@ extern void pgc_init(pgc_t *,
extern void pgc_sto_raster(pgc_t *, int16_t *x, int16_t *y);
extern void pgc_ito_raster(pgc_t *, int32_t *x, int32_t *y);
extern void pgc_dto_raster(pgc_t *, double *x, double *y);
// extern int pgc_input_byte(pgc_t *, uint8_t *val);
// extern int pgc_output_byte(pgc_t *, uint8_t val);
#if 0
extern int pgc_input_byte(pgc_t *, uint8_t *val);
extern int pgc_output_byte(pgc_t *, uint8_t val);
#endif
extern int pgc_output_string(pgc_t *, const char *val);
// extern int pgc_error_byte(pgc_t *, uint8_t val);
#if 0
extern int pgc_error_byte(pgc_t *, uint8_t val);
#endif
extern int pgc_error_string(pgc_t *, const char *val);
extern int pgc_error(pgc_t *, int err);

View File

@@ -36,11 +36,18 @@
# define FLAG_512K_MASK 512
struct monitor_t;
typedef struct {
int ena,
x, y, xoff, yoff, cur_xsize, cur_ysize,
v_acc, h_acc;
uint32_t addr, pitch;
typedef struct hwcursor_t {
int ena;
int x;
int y;
int xoff;
int yoff;
int cur_xsize;
int cur_ysize;
int v_acc;
int h_acc;
uint32_t addr;
uint32_t pitch;
} hwcursor_t;
typedef union {
@@ -55,25 +62,78 @@ typedef struct svga_t {
xga_t xga;
mem_mapping_t mapping;
uint8_t fast, chain4, chain2_write, chain2_read,
ext_overscan, bus_size,
lowres, interlace, linedbl, rowcount,
set_reset_disabled, bpp, ramdac_type, fb_only,
readmode, writemode, readplane,
hwcursor_oddeven, dac_hwcursor_oddeven, overlay_oddeven,
fcr, hblank_overscan;
uint8_t fast;
uint8_t chain4;
uint8_t chain2_write;
uint8_t chain2_read;
uint8_t ext_overscan;
uint8_t bus_size;
uint8_t lowres;
uint8_t interlace;
uint8_t linedbl;
uint8_t rowcount;
uint8_t set_reset_disabled;
uint8_t bpp;
uint8_t ramdac_type;
uint8_t fb_only;
uint8_t readmode;
uint8_t writemode;
uint8_t readplane;
uint8_t hwcursor_oddeven;
uint8_t dac_hwcursor_oddeven;
uint8_t overlay_oddeven;
uint8_t fcr;
uint8_t hblank_overscan;
int dac_addr, dac_pos, dac_r, dac_g,
vtotal, dispend, vsyncstart, split, vblankstart,
hdisp, hdisp_old, htotal, hdisp_time, rowoffset,
dispon, hdisp_on,
vc, sc, linepos, vslines, linecountff, oddeven,
con, cursoron, blink, scrollcache, char_width,
firstline, lastline, firstline_draw, lastline_draw,
displine, fullchange, x_add, y_add, pan,
vram_display_mask, vidclock, dots_per_clock, hblank_ext,
hwcursor_on, dac_hwcursor_on, overlay_on, set_override,
hblankstart, hblankend, hblank_sub, hblank_end_val, hblank_end_len;
int dac_addr;
int dac_pos;
int dac_r;
int dac_g;
int vtotal;
int dispend;
int vsyncstart;
int split;
int vblankstart;
int hdisp;
int hdisp_old;
int htotal;
int hdisp_time;
int rowoffset;
int dispon;
int hdisp_on;
int vc;
int sc;
int linepos;
int vslines;
int linecountff;
int oddeven;
int con;
int cursoron;
int blink;
int scrollcache;
int char_width;
int firstline;
int lastline;
int firstline_draw;
int lastline_draw;
int displine;
int fullchange;
int x_add;
int y_add;
int pan;
int vram_display_mask;
int vidclock;
int dots_per_clock;
int hblank_ext;
int hwcursor_on;
int dac_hwcursor_on;
int overlay_on;
int set_override;
int hblankstart;
int hblankend;
int hblank_sub;
int hblank_end_val;
int hblank_end_len;
/*The three variables below allow us to implement memory maps like that seen on a 1MB Trio64 :
0MB-1MB - VRAM
@@ -84,29 +144,41 @@ typedef struct svga_t {
For the example memory map, decode_mask would be 4MB-1 (4MB address space), vram_max would be 2MB
(present video memory only responds to first 2MB), vram_mask would be 1MB-1 (video memory wraps at 1MB)
*/
uint32_t decode_mask, vram_max,
vram_mask,
charseta, charsetb,
adv_flags, ma_latch,
ca_adj, ma, maback,
write_bank, read_bank,
extra_banks[2],
banked_mask,
ca, overscan_color,
*map8, pallook[512];
uint32_t decode_mask;
uint32_t vram_max;
uint32_t vram_mask;
uint32_t charseta;
uint32_t charsetb;
uint32_t adv_flags;
uint32_t ma_latch;
uint32_t ca_adj;
uint32_t ma;
uint32_t maback;
uint32_t write_bank;
uint32_t read_bank;
uint32_t extra_banks[2];
uint32_t banked_mask;
uint32_t ca;
uint32_t overscan_color;
uint32_t *map8;
uint32_t pallook[512];
PALETTE vgapal;
uint64_t dispontime, dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
latch_t latch;
pc_timer_t timer;
double clock;
hwcursor_t hwcursor, hwcursor_latch,
dac_hwcursor, dac_hwcursor_latch,
overlay, overlay_latch;
hwcursor_t hwcursor;
hwcursor_t hwcursor_latch;
hwcursor_t dac_hwcursor;
hwcursor_t dac_hwcursor_latch;
hwcursor_t overlay;
hwcursor_t overlay_latch;
void (*render)(struct svga_t *svga);
void (*recalctimings_ex)(struct svga_t *svga);
@@ -137,20 +209,35 @@ typedef struct svga_t {
/*If set then another device is driving the monitor output and the SVGA
card should not attempt to display anything */
int override;
void *p;
void *priv;
uint8_t crtc[256], gdcreg[256], attrregs[32], seqregs[256],
egapal[16],
*vram, *changedvram;
uint8_t crtc[256];
uint8_t gdcreg[256];
uint8_t attrregs[32];
uint8_t seqregs[256];
uint8_t egapal[16];
uint8_t *vram;
uint8_t *changedvram;
uint8_t crtcreg, gdcaddr,
attrff, attr_palette_enable, attraddr, seqaddr,
miscout, cgastat, scrblank,
plane_mask, writemask,
colourcompare, colournocare,
dac_mask, dac_status,
dpms, dpms_ui,
ksc5601_sbyte_mask, ksc5601_udc_area_msb[2];
uint8_t crtcreg;
uint8_t gdcaddr;
uint8_t attrff;
uint8_t attr_palette_enable;
uint8_t attraddr;
uint8_t seqaddr;
uint8_t miscout;
uint8_t cgastat;
uint8_t scrblank;
uint8_t plane_mask;
uint8_t writemask;
uint8_t colourcompare;
uint8_t colournocare;
uint8_t dac_mask;
uint8_t dac_status;
uint8_t dpms;
uint8_t dpms_ui;
uint8_t ksc5601_sbyte_mask;
uint8_t ksc5601_udc_area_msb[2];
int ksc5601_swap_mode;
uint16_t ksc5601_english_font_type;
@@ -172,7 +259,8 @@ typedef struct svga_t {
int remap_required;
uint32_t (*remap_func)(struct svga_t *svga, uint32_t in_addr);
void *ramdac, *clock_gen;
void *ramdac;
void *clock_gen;
/* Monitor Index */
uint8_t monitor_index;

View File

@@ -20,12 +20,16 @@
#ifndef VIDEO_SVGA_RENDER_H
#define VIDEO_SVGA_RENDER_H
extern int firstline_draw, lastline_draw;
extern int firstline_draw;
extern int lastline_draw;
extern int displine;
extern int sc;
extern uint32_t ma, ca;
extern int con, cursoron, cgablink;
extern uint32_t ma;
extern uint32_t ca;
extern int con;
extern int cursoron;
extern int cgablink;
extern int scrollcache;

View File

@@ -18,6 +18,6 @@
#ifndef VIDEO_VOODOO_BANSHEE_H
#define VIDEO_VOODOO_BANSHEE_H
void banshee_set_overlay_addr(void *p, uint32_t addr);
void banshee_set_overlay_addr(void *priv, uint32_t addr);
#endif /*VIDEO_VOODOO_BANSHEE_H*/

View File

@@ -38,7 +38,9 @@ typedef struct voodoo_x86_data_t {
int is_tiled;
} voodoo_x86_data_t;
// static voodoo_x86_data_t voodoo_x86_data[2][BLOCK_NUM];
#if 0
static voodoo_x86_data_t voodoo_x86_data[2][BLOCK_NUM];
#endif
static int last_block[4] = { 0, 0 };
static int next_block_to_write[4] = { 0, 0 };
@@ -234,10 +236,12 @@ codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *pa
addlong(1);
addbyte(0x28); /*SUB DL, CL*/
addbyte(0xca);
// addbyte(0x8a); /*MOV DL, params->tex_shift[RSI+ECX*4]*/
// addbyte(0x94);
// addbyte(0x8e);
// addlong(offsetof(voodoo_params_t, tex_shift));
#if 0
addbyte(0x8a); /*MOV DL, params->tex_shift[RSI+ECX*4]*/
addbyte(0x94);
addbyte(0x8e);
addlong(offsetof(voodoo_params_t, tex_shift));
#endif
addbyte(0xd3); /*SHL EBP, CL*/
addbyte(0xe5);
addbyte(0x8b); /*MOV EAX, state->tex_s[RDI]*/
@@ -656,24 +660,29 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
int depth_jump_pos = 0;
int depth_jump_pos2 = 0;
int loop_jump_pos = 0;
// xmm_01_w = (__m128i)0x0001000100010001ull;
// xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull;
// xmm_ff_b = (__m128i)0x00000000ffffffffull;
#if 0
xmm_01_w = (__m128i)0x0001000100010001ull;
xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull;
xmm_ff_b = (__m128i)0x00000000ffffffffull;
#endif
xmm_01_w = _mm_set_epi32(0, 0, 0x00010001, 0x00010001);
xmm_ff_w = _mm_set_epi32(0, 0, 0x00ff00ff, 0x00ff00ff);
xmm_ff_b = _mm_set_epi32(0, 0, 0, 0x00ffffff);
minus_254 = _mm_set_epi32(0, 0, 0xff02ff02, 0xff02ff02);
// *(uint64_t *)&const_1_48 = 0x45b0000000000000ull;
// block_pos = 0;
// voodoo_get_depth = &code_block[block_pos];
#if 0
*(uint64_t *)&const_1_48 = 0x45b0000000000000ull;
block_pos = 0;
voodoo_get_depth = &code_block[block_pos];
#endif
/*W at (%esp+4)
Z at (%esp+12)
new_depth at (%esp+16)*/
// if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER))
// {
// addbyte(0xC3); /*RET*/
// return;
// }
#if 0
if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER)) {
addbyte(0xC3); /*RET*/
return;
}
#endif
addbyte(0x55); /*PUSH RBP*/
addbyte(0x57); /*PUSH RDI*/
addbyte(0x56); /*PUSH RSI*/
@@ -796,7 +805,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x75); /*JNZ got_depth*/
depth_jump_pos = block_pos;
addbyte(0);
// addbyte(4+5+2+3+2+5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3);
#if 0
addbyte(4+5+2+3+2+5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3);
#endif
addbyte(0x8b); /*MOV EDX, w*/
addbyte(0x97);
addlong(offsetof(voodoo_state_t, w));
@@ -810,7 +821,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x74); /*JZ got_depth*/
depth_jump_pos2 = block_pos;
addbyte(0);
// addbyte(5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3);
#if 0
addbyte(5+5+3+2+2+2+/*3+*/3+2+6+4+5+2+3);
#endif
addbyte(0xb9); /*MOV ECX, 19*/
addlong(19);
addbyte(0x0f); /*BSR EAX, EDX*/
@@ -2224,10 +2237,12 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(10);
addbyte(0x01); /*ADD EAX, EBX*/
addbyte(0xd8);
/* int fog_idx = (w_depth >> 10) & 0x3f;
#if 0
int fog_idx = (w_depth >> 10) & 0x3f;
fog_a = params->fogTable[fog_idx].fog;
fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10;*/
fog_a = params->fogTable[fog_idx].fog;
fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10;
#endif
break;
case FOG_Z:
@@ -2239,7 +2254,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(12);
addbyte(0x25); /*AND EAX, 0xff*/
addlong(0xff);
// fog_a = (z >> 20) & 0xff;
#if 0
fog_a = (z >> 20) & 0xff;
#endif
break;
case FOG_ALPHA:
@@ -2261,7 +2278,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x0f); /*CMOVAE EAX, EBX*/
addbyte(0x43);
addbyte(0xc3);
// fog_a = CLAMP(ia >> 12);
#if 0
fog_a = CLAMP(ia >> 12);
#endif
break;
case FOG_W:
@@ -2282,7 +2301,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x0f); /*CMOVAE EAX, EBX*/
addbyte(0x43);
addbyte(0xc3);
// fog_a = CLAMP(w >> 32);
#if 0
fog_a = CLAMP(w >> 32);
#endif
break;
}
addbyte(0x01); /*ADD EAX, EAX*/
@@ -3164,12 +3185,11 @@ int voodoo_recomp = 0;
static inline void *
voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int odd_even)
{
int c;
int b = last_block[odd_even];
voodoo_x86_data_t *voodoo_x86_data = voodoo->codegen_data;
voodoo_x86_data_t *data;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
data = &voodoo_x86_data[odd_even + c * 4]; //&voodoo_x86_data[odd_even][b];
if (state->xdir == data->xdir && params->alphaMode == data->alphaMode && params->fbzMode == data->fbzMode && params->fogMode == data->fogMode && params->fbzColorPath == data->fbzColorPath && (voodoo->trexInit1[0] & (1 << 18)) == data->trexInit1 && params->textureMode[0] == data->textureMode[0] && params->textureMode[1] == data->textureMode[1] && (params->tLOD[0] & LOD_MASK) == data->tLOD[0] && (params->tLOD[1] & LOD_MASK) == data->tLOD[1] && ((params->col_tiled || params->aux_tiled) ? 1 : 0) == data->is_tiled) {
@@ -3181,7 +3201,9 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat
}
voodoo_recomp++;
data = &voodoo_x86_data[odd_even + next_block_to_write[odd_even] * 4];
// code_block = data->code_block;
#if 0
code_block = data->code_block;
#endif
voodoo_generate(data->code_block, voodoo, params, state, depth_op);
@@ -3205,11 +3227,9 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat
void
voodoo_codegen_init(voodoo_t *voodoo)
{
int c;
voodoo->codegen_data = plat_mmap(sizeof(voodoo_x86_data_t) * BLOCK_NUM * 4, 1);
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
int d[4];
int _ds = c & 0xf;
int dt = c >> 4;

View File

@@ -639,24 +639,29 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
int depth_jump_pos = 0;
int depth_jump_pos2 = 0;
int loop_jump_pos = 0;
// xmm_01_w = (__m128i)0x0001000100010001ull;
// xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull;
// xmm_ff_b = (__m128i)0x00000000ffffffffull;
#if 0
xmm_01_w = (__m128i)0x0001000100010001ull;
xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull;
xmm_ff_b = (__m128i)0x00000000ffffffffull;
#endif
xmm_01_w = _mm_set_epi32(0, 0, 0x00010001, 0x00010001);
xmm_ff_w = _mm_set_epi32(0, 0, 0x00ff00ff, 0x00ff00ff);
xmm_ff_b = _mm_set_epi32(0, 0, 0, 0x00ffffff);
minus_254 = _mm_set_epi32(0, 0, 0xff02ff02, 0xff02ff02);
// *(uint64_t *)&const_1_48 = 0x45b0000000000000ull;
// block_pos = 0;
// voodoo_get_depth = &code_block[block_pos];
#if 0
*(uint64_t *)&const_1_48 = 0x45b0000000000000ull;
block_pos = 0;
voodoo_get_depth = &code_block[block_pos];
#endif
/*W at (%esp+4)
Z at (%esp+12)
new_depth at (%esp+16)*/
// if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER))
// {
// addbyte(0xC3); /*RET*/
// return;
// }
#if 0
if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depth_op == DEPTHOP_NEVER)) {
addbyte(0xC3); /*RET*/
return;
}
#endif
addbyte(0x55); /*PUSH EBP*/
addbyte(0x57); /*PUSH EDI*/
addbyte(0x56); /*PUSH ESI*/
@@ -871,16 +876,19 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
fatal("Bad depth_op\n");
} else if ((params->fbzMode & FBZ_DEPTH_ENABLE) && (depthop == DEPTHOP_NEVER)) {
addbyte(0xC3); /*RET*/
// addbyte(0x30); /*XOR EAX, EAX*/
// addbyte(0xc0);
#if 0
addbyte(0x30); /*XOR EAX, EAX*/
addbyte(0xc0);
#endif
}
#if 0
else {
addbyte(0xb0); /*MOV AL, 1*/
addbyte(1);
}
// else
// {
// addbyte(0xb0); /*MOV AL, 1*/
// addbyte(1);
// }
// voodoo_combine = &code_block[block_pos];
voodoo_combine = &code_block[block_pos];
#endif
/*XMM0 = colour*/
/*XMM2 = 0 (for unpacking*/
@@ -2076,12 +2084,13 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x05);
addlong((uint32_t) &xmm_ff_b);
}
// #if 0
// addbyte(0x66); /*MOVD state->out[EDI], XMM0*/
// addbyte(0x0f);
// addbyte(0x7e);
// addbyte(0x87);
// addlong(offsetof(voodoo_state_t, out));
#if 0
addbyte(0x66); /*MOVD state->out[EDI], XMM0*/
addbyte(0x0f);
addbyte(0x7e);
addbyte(0x87);
addlong(offsetof(voodoo_state_t, out));
#endif
if (params->fogMode & FOG_ENABLE) {
if (params->fogMode & FOG_CONSTANT) {
addbyte(0x66); /*MOVD XMM3, params->fogColor[ESI]*/
@@ -2093,11 +2102,18 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x0f);
addbyte(0xdc);
addbyte(0xc3);
/* src_r += params->fogColor.r;
src_g += params->fogColor.g;
src_b += params->fogColor.b; */
#if 0
src_r += params->fogColor.r;
src_g += params->fogColor.g;
src_b += params->fogColor.b; */
#endif
} else {
/*int fog_r, fog_g, fog_b, fog_a; */
#if 0
int fog_r;
int fog_g;
int fog_b;
int fog_a;
#endif
addbyte(0x66); /*PUNPCKLBW XMM0, XMM2*/
addbyte(0x0f);
@@ -2168,10 +2184,12 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x01); /*ADD EAX, EBX*/
addbyte(0xd8);
/* int fog_idx = (w_depth >> 10) & 0x3f;
#if 0
int fog_idx = (w_depth >> 10) & 0x3f;
fog_a = params->fogTable[fog_idx].fog;
fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10;*/
fog_a = params->fogTable[fog_idx].fog;
fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10;
#endif
break;
case FOG_Z:
@@ -2183,7 +2201,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(12);
addbyte(0x25); /*AND EAX, 0xff*/
addlong(0xff);
// fog_a = (z >> 20) & 0xff;
#if 0
fog_a = (z >> 20) & 0xff;
#endif
break;
case FOG_ALPHA:
@@ -2205,7 +2225,9 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x0f); /*CMOVAE EAX, EBX*/
addbyte(0x43);
addbyte(0xc3);
// fog_a = CLAMP(ia >> 12);
#if 0
fog_a = CLAMP(ia >> 12);
#endif
break;
case FOG_W:
@@ -2226,13 +2248,16 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x0f); /*CMOVAE EAX, EBX*/
addbyte(0x43);
addbyte(0xc3);
// fog_a = CLAMP(w >> 32);
#if 0
fog_a = CLAMP(w >> 32);
#endif
break;
}
addbyte(0x01); /*ADD EAX, EAX*/
addbyte(0xc0);
// fog_a++;
#if 0
fog_a++;
#endif
addbyte(0x66); /*PMULLW XMM3, alookup+4[EAX*8]*/
addbyte(0x0f);
addbyte(0xd5);
@@ -2244,9 +2269,11 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x71);
addbyte(0xe3);
addbyte(7);
/* fog_r = (fog_r * fog_a) >> 8;
fog_g = (fog_g * fog_a) >> 8;
fog_b = (fog_b * fog_a) >> 8;*/
#if 0
fog_r = (fog_r * fog_a) >> 8;
fog_g = (fog_g * fog_a) >> 8;
fog_b = (fog_b * fog_a) >> 8;
#endif
if (params->fogMode & FOG_MULT) {
addbyte(0xf3); /*MOV XMM0, XMM3*/
@@ -2258,9 +2285,11 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x0f);
addbyte(0xfd);
addbyte(0xc3);
/* src_r += fog_r;
src_g += fog_g;
src_b += fog_b;*/
#if 0
src_r += fog_r;
src_g += fog_g;
src_b += fog_b;
#endif
}
addbyte(0x66); /*PACKUSWB XMM0, XMM0*/
addbyte(0x0f);
@@ -2268,9 +2297,11 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0xc0);
}
/* src_r = CLAMP(src_r);
src_g = CLAMP(src_g);
src_b = CLAMP(src_b);*/
#if 0
src_r = CLAMP(src_r);
src_g = CLAMP(src_g);
src_b = CLAMP(src_b);
#endif
}
if ((params->alphaMode & 1) && (alpha_func != AFUNC_NEVER) && (alpha_func != AFUNC_ALWAYS)) {
@@ -2696,12 +2727,13 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x67);
addbyte(0xc0);
}
// #endif
// addbyte(0x8b); /*MOV EDX, x (ESP+12)*/
// addbyte(0x54);
// addbyte(0x24);
// addbyte(12);
#if 0
addbyte(0x8b); /*MOV EDX, x (ESP+12)*/
addbyte(0x54);
addbyte(0x24);
addbyte(12);
#endif
addbyte(0x8b); /*MOV EDX, state->x[EDI]*/
addbyte(0x97);
@@ -2716,9 +2748,11 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0xc0);
if (params->fbzMode & FBZ_RGB_WMASK) {
// addbyte(0x89); /*MOV state->rgb_out[EDI], EAX*/
// addbyte(0x87);
// addlong(offsetof(voodoo_state_t, rgb_out));
#if 0
addbyte(0x89); /*MOV state->rgb_out[EDI], EAX*/
addbyte(0x87);
addlong(offsetof(voodoo_state_t, rgb_out));
#endif
if (dither) {
addbyte(0x8b); /*MOV ESI, real_y (ESP+16)*/
@@ -3118,7 +3152,9 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat
}
voodoo_recomp++;
data = &codegen_data[odd_even + next_block_to_write[odd_even] * 4];
// code_block = data->code_block;
#if 0
code_block = data->code_block;
#endif
voodoo_generate(data->code_block, voodoo, params, state, depth_op);
@@ -3142,11 +3178,9 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat
void
voodoo_codegen_init(voodoo_t *voodoo)
{
int c;
voodoo->codegen_data = plat_mmap(sizeof(voodoo_x86_data_t) * BLOCK_NUM * 4, 1);
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
int d[4];
int _ds = c & 0xf;
int dt = c >> 4;

View File

@@ -596,7 +596,9 @@ typedef struct voodoo_t {
uint32_t vidOverlayDudxOffsetSrcWidth;
uint32_t vidOverlayDvdy;
uint32_t vidOverlayDvdyOffset;
// uint32_t vidDesktopOverlayStride;
#if 0
uint32_t vidDesktopOverlayStride;
#endif
int start_x;
int start_y;

View File

@@ -20,7 +20,7 @@
#include <86box/rom.h>
typedef struct {
typedef struct xga_hwcursor_t {
int ena;
int x;
int y;
@@ -37,11 +37,14 @@ typedef struct xga_t {
mem_mapping_t video_mapping;
rom_t bios_rom;
rom_t vga_bios_rom;
xga_hwcursor_t hwcursor, hwcursor_latch;
xga_hwcursor_t hwcursor;
xga_hwcursor_t hwcursor_latch;
PALETTE extpal;
uint8_t test, atest[2], testpixel;
;
uint8_t test;
uint8_t atest[2];
uint8_t testpixel;
uint8_t pos_regs[8];
uint8_t disp_addr;
uint8_t cfg_reg;
@@ -54,33 +57,43 @@ typedef struct xga_t {
uint8_t regs_idx;
uint8_t hwc_hotspot_x;
uint8_t hwc_hotspot_y;
uint8_t disp_cntl_1, disp_cntl_2;
uint8_t clk_sel_1, clk_sel_2;
uint8_t disp_cntl_1;
uint8_t disp_cntl_2;
uint8_t clk_sel_1;
uint8_t clk_sel_2;
uint8_t hwc_control;
uint8_t bus_arb;
uint8_t isa_pos_enable;
uint8_t hwcursor_oddeven;
uint8_t cfg_reg_instance;
uint8_t rowcount;
uint8_t pal_idx, pal_idx_prefetch;
uint8_t pal_idx;
uint8_t pal_idx_prefetch;
uint8_t pal_seq;
uint8_t pal_mask;
uint8_t pal_r, pal_r_prefetch;
uint8_t pal_g, pal_g_prefetch;
uint8_t pal_b, pal_b_prefetch;
uint8_t pal_r;
uint8_t pal_r_prefetch;
uint8_t pal_g;
uint8_t pal_g_prefetch;
uint8_t pal_b;
uint8_t pal_b_prefetch;
uint8_t sprite_data[1024];
uint8_t scrollcache;
uint8_t direct_color;
uint8_t dma_channel;
uint8_t instance_isa, instance_num, ext_mem_addr;
uint8_t *vram, *changedvram;
uint8_t instance_isa;
uint8_t instance_num;
uint8_t ext_mem_addr;
uint8_t *vram;
uint8_t *changedvram;
int16_t hwc_pos_x;
int16_t hwc_pos_y;
uint16_t pos_idx;
uint16_t htotal;
uint16_t sprite_idx, sprite_idx_prefetch;
uint16_t sprite_idx;
uint16_t sprite_idx_prefetch;
uint16_t hdisp;
uint16_t vtotal;
uint16_t vdispend;
@@ -88,41 +101,74 @@ typedef struct xga_t {
uint16_t vsyncstart;
uint16_t linecmp;
uint16_t pix_map_width;
uint16_t sprite_pal_addr_idx, old_pal_addr_idx;
uint16_t sprite_pal_addr_idx;
uint16_t old_pal_addr_idx;
uint16_t sprite_pal_addr_idx_prefetch;
int v_total, dispend, v_syncstart, split, v_blankstart,
h_disp, h_disp_old, h_total, h_disp_time, rowoffset,
dispon, h_disp_on, vc, sc, linepos, oddeven, firstline, lastline,
firstline_draw, lastline_draw, displine, fullchange, interlace,
char_width, hwcursor_on;
int pal_pos, pal_pos_prefetch;
int v_total;
int dispend;
int v_syncstart;
int split;
int v_blankstart;
int h_disp;
int h_disp_old;
int h_total;
int h_disp_time;
int rowoffset;
int dispon;
int h_disp_on;
int vc;
int sc;
int linepos;
int oddeven;
int firstline;
int lastline;
int firstline_draw;
int lastline_draw;
int displine;
int fullchange;
int interlace;
int char_width;
int hwcursor_on;
int pal_pos;
int pal_pos_prefetch;
int on;
int op_mode_reset, linear_endian_reverse;
int sprite_pos, sprite_pos_prefetch, cursor_data_on;
int pal_test, a5_test;
int type, bus;
int op_mode_reset;
int linear_endian_reverse;
int sprite_pos;
int sprite_pos_prefetch;
int cursor_data_on;
int pal_test;
int a5_test;
int type;
int bus;
uint32_t linear_base, linear_size, banked_mask;
uint32_t linear_base;
uint32_t linear_size;
uint32_t banked_mask;
uint32_t base_addr_1mb;
uint32_t hwc_color0, hwc_color1;
uint32_t hwc_color0;
uint32_t hwc_color1;
uint32_t disp_start_addr;
uint32_t ma_latch;
uint32_t vram_size;
uint32_t vram_mask;
uint32_t rom_addr;
uint32_t ma, maback;
uint32_t ma;
uint32_t maback;
uint32_t extpallook[256];
uint32_t read_bank, write_bank;
uint32_t read_bank;
uint32_t write_bank;
uint32_t px_map_base;
uint64_t dispontime, dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
struct
{
struct {
uint8_t control;
uint8_t px_map_idx;
uint8_t frgd_mix, bkgd_mix;
uint8_t frgd_mix;
uint8_t bkgd_mix;
uint8_t cc_cond;
uint8_t octant;
uint8_t draw_mode;
@@ -133,15 +179,19 @@ typedef struct xga_t {
uint8_t short_stroke_vector4;
int16_t bres_err_term;
int16_t bres_k1, bres_k2;
int16_t bres_k1;
int16_t bres_k2;
uint16_t blt_width;
uint16_t blt_height;
uint16_t mask_map_origin_x_off;
uint16_t mask_map_origin_y_off;
uint16_t src_map_x, src_map_y;
uint16_t dst_map_x, dst_map_y;
uint16_t pat_map_x, pat_map_y;
uint16_t src_map_x;
uint16_t src_map_y;
uint16_t dst_map_x;
uint16_t dst_map_y;
uint16_t pat_map_x;
uint16_t pat_map_y;
int ssv_state;
int pat_src;
@@ -149,7 +199,14 @@ typedef struct xga_t {
int dst_map;
int bkgd_src;
int fore_src;
int x, y, sx, sy, dx, dy, px, py;
int x;
int y;
int sx;
int sy;
int dx;
int dy;
int px;
int py;
int pattern;
int command_len;
@@ -157,7 +214,8 @@ typedef struct xga_t {
uint32_t color_cmp;
uint32_t carry_chain;
uint32_t plane_mask;
uint32_t frgd_color, bkgd_color;
uint32_t frgd_color;
uint32_t bkgd_color;
uint32_t command;
uint32_t dir_cmd;

View File

@@ -74,6 +74,7 @@
#include <86box/vid_mda.h>
#include <86box/machine.h>
#include <86box/m_amstrad.h>
#include <86box/plat_unused.h>
#define STAT_PARITY 0x80
#define STAT_RTIMEOUT 0x40
@@ -84,60 +85,64 @@
#define STAT_IFULL 0x02
#define STAT_OFULL 0x01
typedef struct {
rom_t bios_rom; /* 1640 */
cga_t cga; /* 1640/200 */
mda_t mda; /* 1512/200/PPC512/640*/
ega_t ega; /* 1640 */
uint8_t emulation; /* Which display are we emulating? */
uint8_t dipswitches; /* DIP switches 1-3 */
uint8_t crtc_index; /* CRTC index readback
* Bit 7: CGA control port written
* Bit 6: Operation control port written
* Bit 5: CRTC register written
* Bits 0-4: Last CRTC register selected */
uint8_t operation_ctrl;
uint8_t reg_3df, type;
uint8_t crtc[32];
int crtcreg;
int cga_enabled; /* 1640 */
uint8_t cgacol,
cgamode,
stat;
uint8_t plane_write, /* 1512/200 */
plane_read, /* 1512/200 */
border, /* 1512/200 */
invert; /* 512/640 */
int fontbase; /* 1512/200 */
int linepos,
displine;
int sc, vc;
int cgadispon;
int con, coff,
cursoron,
cgablink;
int vsynctime;
int fullchange;
int vadj;
uint16_t ma, maback;
int dispon;
int blink;
uint64_t dispontime, /* 1512/1640 */
dispofftime; /* 1512/1640 */
pc_timer_t timer; /* 1512/1640 */
int firstline,
lastline;
uint8_t *vram;
void *ams;
typedef struct amsvid_t {
rom_t bios_rom; /* 1640 */
cga_t cga; /* 1640/200 */
mda_t mda; /* 1512/200/PPC512/640*/
ega_t ega; /* 1640 */
uint8_t emulation; /* Which display are we emulating? */
uint8_t dipswitches; /* DIP switches 1-3 */
uint8_t crtc_index; /* CRTC index readback
* Bit 7: CGA control port written
* Bit 6: Operation control port written
* Bit 5: CRTC register written
* Bits 0-4: Last CRTC register selected */
uint8_t operation_ctrl;
uint8_t reg_3df;
uint8_t type;
uint8_t crtc[32];
int crtcreg;
int cga_enabled; /* 1640 */
uint8_t cgacol;
uint8_t cgamode;
uint8_t stat;
uint8_t plane_write; /* 1512/200 */
uint8_t plane_read; /* 1512/200 */
uint8_t border; /* 1512/200 */
uint8_t invert; /* 512/640 */
int fontbase; /* 1512/200 */
int linepos;
int displine;
int sc;
int vc;
int cgadispon;
int con;
int coff;
int cursoron;
int cgablink;
int vsynctime;
int fullchange;
int vadj;
uint16_t ma;
uint16_t maback;
int dispon;
int blink;
uint64_t dispontime; /* 1512/1640 */
uint64_t dispofftime; /* 1512/1640 */
pc_timer_t timer; /* 1512/1640 */
int firstline;
int lastline;
uint8_t *vram;
void *ams;
} amsvid_t;
typedef struct {
typedef struct amstrad_t {
/* Machine stuff. */
uint8_t dead;
uint8_t stat1,
stat2;
uint8_t type,
language;
uint8_t stat1;
uint8_t stat2;
uint8_t type;
uint8_t language;
/* Keyboard stuff. */
int8_t wantirq;
@@ -147,8 +152,8 @@ typedef struct {
pc_timer_t send_delay_timer;
/* Mouse stuff. */
uint8_t mousex,
mousey;
uint8_t mousex;
uint8_t mousey;
int oldb;
/* Video stuff. */
@@ -160,7 +165,7 @@ uint32_t amstrad_latch;
static uint8_t key_queue[16];
static int key_queue_start = 0;
static int key_queue_end = 0;
static int key_queue_end = 0;
static uint8_t crtc_mask[32] = {
0xff, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x7f, 0x7f,
0xf3, 0x1f, 0x7f, 0x1f, 0x3f, 0xff, 0x3f, 0xff,
@@ -263,6 +268,9 @@ vid_out_1512(uint16_t addr, uint8_t val, void *priv)
case 0x03df:
vid->border = val;
return;
default:
return;
}
}
@@ -287,6 +295,9 @@ vid_in_1512(uint16_t addr, void *priv)
case 0x03da:
ret = vid->stat;
break;
default:
break;
}
return ret;
@@ -780,9 +791,15 @@ vid_out_1640(uint16_t addr, uint8_t val, void *priv)
mem_mapping_set_addr(&vid->ega.mapping,
0xb8000, 0x08000);
break;
default:
break;
}
}
return;
default:
break;
}
if (vid->cga_enabled)
@@ -924,6 +941,9 @@ ams_inform(amsvid_t *vid)
case PC200_LCDM:
video_inform(VIDEO_FLAG_TYPE_MDA, &timing_pc200);
break;
default:
break;
}
}
@@ -1013,6 +1033,9 @@ set_lcd_cols(uint8_t mode_reg)
lcdcols[c][0][0] = lcdcols[c][1][0] = blue;
lcdcols[c][0][1] = lcdcols[c][1][1] = blue;
break;
default:
break;
}
}
}
@@ -1043,6 +1066,9 @@ vid_in_200(uint16_t addr, void *priv)
case 0x03df:
return (vid->reg_3df);
default:
break;
}
if (addr >= 0x3D0 && addr <= 0x3DF)
@@ -1176,6 +1202,9 @@ vid_out_200(uint16_t addr, uint8_t val, void *priv)
mem_mapping_enable(&vid->cga.mapping);
}
return;
default:
break;
}
if (addr >= 0x3D0 && addr <= 0x3DF)
@@ -1272,7 +1301,7 @@ lcdm_poll(amsvid_t *vid)
drawcursor = ((mda->ma == ca) && mda->con && mda->cursoron);
blink = ((mda->blink & 16) && (mda->ctrl & 0x20) && (attr & 0x80) && !drawcursor);
lcd_draw_char_80(vid, &((uint32_t *) (buffer32->line[mda->displine]))[x * 8], chr, attr, drawcursor, blink, mda->sc, 0, mda->ctrl);
lcd_draw_char_80(vid, &((buffer32->line[mda->displine]))[x * 8], chr, attr, drawcursor, blink, mda->sc, 0, mda->ctrl);
mda->ma++;
}
}
@@ -1422,7 +1451,7 @@ lcdc_poll(amsvid_t *vid)
dat = (cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000)] << 8) | cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000) + 1];
cga->ma++;
for (uint8_t c = 0; c < 16; c++) {
buffer32->line[(cga->displine << 1)][(x << 4) + c] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + c] = (dat & 0x8000) ? blue : green;
buffer32->line[cga->displine << 1][(x << 4) + c] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + c] = (dat & 0x8000) ? blue : green;
dat <<= 1;
}
}
@@ -1568,9 +1597,9 @@ lcdc_poll(amsvid_t *vid)
}
static void
vid_poll_200(void *p)
vid_poll_200(void *priv)
{
amsvid_t *vid = (amsvid_t *) p;
amsvid_t *vid = (amsvid_t *) priv;
switch (vid->emulation) {
case PC200_LCDM:
@@ -1579,6 +1608,9 @@ vid_poll_200(void *p)
case PC200_LCDC:
lcdc_poll(vid);
return;
default:
break;
}
}
@@ -1614,6 +1646,9 @@ vid_init_200(amstrad_t *ams)
break;
/* The other combination is 'IDA disabled' (0x20) - see
* m_amstrad.c */
default:
break;
}
else
switch (vid->emulation) {
@@ -1635,6 +1670,9 @@ vid_init_200(amstrad_t *ams)
case PC200_LCDM:
vid->dipswitches = 0x10;
break;
default:
break;
}
cga = &vid->cga;
@@ -1969,7 +2007,7 @@ const device_t vid_pc3086_device = {
};
static void
ms_write(uint16_t addr, uint8_t val, void *priv)
ms_write(uint16_t addr, UNUSED(uint8_t val), void *priv)
{
amstrad_t *ams = (amstrad_t *) priv;
@@ -1997,7 +2035,7 @@ ms_read(uint16_t addr, void *priv)
}
static int
ms_poll(int x, int y, int z, int b, void *priv)
ms_poll(int x, int y, UNUSED(int z), int b, void *priv)
{
amstrad_t *ams = (amstrad_t *) priv;
@@ -2222,6 +2260,9 @@ ams_write(uint16_t port, uint8_t val, void *priv)
case 0xdead:
ams->dead = val;
break;
default:
break;
}
}
@@ -2285,6 +2326,9 @@ ams_read(uint16_t port, void *priv)
case AMSTRAD_SW10:
ret |= 0x20;
break;
default:
break;
}
break;
@@ -2300,6 +2344,9 @@ ams_read(uint16_t port, void *priv)
case 0xdead:
ret = ams->dead;
break;
default:
break;
}
return ret;
@@ -2482,6 +2529,9 @@ machine_amstrad_init(const machine_t *model, int type)
case AMS_PC3086:
ams->fdc = device_add(&fdc_at_actlow_device);
break;
default:
break;
}
ams->language = 7;
@@ -2539,6 +2589,9 @@ machine_amstrad_init(const machine_t *model, int type)
device_context_restore();
device_add(&paradise_pvga1a_pc3086_device);
break;
default:
break;
}
else if ((type == AMS_PC200) || (type == AMS_PPC512))
io_sethandler(0x03de, 1,

View File

@@ -48,6 +48,7 @@
#include <86box/scsi_ncr53c8xx.h>
#include <86box/hwm.h>
#include <86box/machine.h>
#include <86box/plat_unused.h>
int
machine_at_acc386_init(const machine_t *model)
@@ -812,7 +813,7 @@ machine_at_greenb_init(const machine_t *model)
}
static void
machine_at_sis_85c496_common_init(const machine_t *model)
machine_at_sis_85c496_common_init(UNUSED(const machine_t *model))
{
device_add(&ide_pci_2ch_device);
@@ -1281,7 +1282,9 @@ machine_at_abpb4_init(const machine_t *model)
device_add(&ali1489_device);
device_add(&w83787f_device);
device_add(&keyboard_at_device);
// device_add(&intel_flash_bxt_device);
#if 0
device_add(&intel_flash_bxt_device);
#endif
device_add(&sst_flash_29ee010_device);
return ret;
@@ -1788,7 +1791,7 @@ machine_at_tg486gp_init(const machine_t *model)
int
machine_at_tg486g_init(const machine_t *model)
{
int ret, i;
int ret;
ret = bios_load_linear("roms/machines/tg486g/tg486g.bin",
0x000c0000, 262144, 0);
@@ -1803,7 +1806,7 @@ machine_at_tg486g_init(const machine_t *model)
device_add(&keyboard_ps2_tg_ami_pci_device);
if (gfxcard[0] != VID_INTERNAL) {
for (i = 0; i < 32768; i++)
for (uint16_t i = 0; i < 32768; i++)
rom[i] = mem_readb_phys(0x000c0000 + i);
}
mem_mapping_set_addr(&bios_mapping, 0x0c0000, 0x40000);

View File

@@ -52,11 +52,12 @@
#include <86box/fdd.h>
#include <86box/fdc.h>
#include <86box/machine.h>
#include <86box/plat_unused.h>
static serial_t *cmd_uart;
static void
cbm_io_write(uint16_t port, uint8_t val, void *p)
cbm_io_write(UNUSED(uint16_t port), uint8_t val, UNUSED(void *priv))
{
lpt1_remove();
lpt2_remove();
@@ -71,6 +72,9 @@ cbm_io_write(uint16_t port, uint8_t val, void *p)
case 3:
lpt1_init(LPT2_ADDR);
break;
default:
break;
}
switch (val & 0xc) {
@@ -80,6 +84,9 @@ cbm_io_write(uint16_t port, uint8_t val, void *p)
case 0x8:
serial_setup(cmd_uart, COM1_ADDR, COM1_IRQ);
break;
default:
break;
}
}

View File

@@ -41,6 +41,7 @@
#include <86box/video.h>
#include <86box/vid_cga.h>
#include <86box/vid_cga_comp.h>
#include <86box/plat_unused.h>
static video_timings_t timing_compaq_plasma = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
@@ -127,7 +128,7 @@ compaq_plasma_recalctimings(compaq_plasma_t *self)
}
static void
compaq_plasma_waitstates(void *p)
compaq_plasma_waitstates(UNUSED(void *priv))
{
int ws_array[16] = { 3, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8 };
int ws;
@@ -205,6 +206,9 @@ compaq_plasma_out(uint16_t addr, uint8_t val, void *priv)
else
mem_mapping_enable(&self->cga.mapping);
break;
default:
break;
}
}
@@ -249,22 +253,25 @@ compaq_plasma_in(uint16_t addr, void *priv)
case 0x23c6:
ret = 0;
break;
default:
break;
}
return ret;
}
static void
compaq_plasma_poll(void *p)
compaq_plasma_poll(void *priv)
{
compaq_plasma_t *self = (compaq_plasma_t *) p;
uint8_t chr, attr;
compaq_plasma_t *self = (compaq_plasma_t *) priv;
uint8_t chr;
uint8_t attr;
uint8_t sc;
uint16_t ma = (self->cga.crtc[13] | (self->cga.crtc[12] << 8)) & 0x7fff;
uint16_t ca = (self->cga.crtc[15] | (self->cga.crtc[14] << 8)) & 0x7fff;
uint16_t addr;
int drawcursor;
int x, c;
int cursorline;
int blink = 0;
int underline = 0;
@@ -272,8 +279,10 @@ compaq_plasma_poll(void *p)
uint32_t fg = (self->cga.cgacol & 0x0f) ? amber : black;
uint32_t bg = black;
uint32_t cols[2];
uint8_t dat2, pattern;
uint32_t ink0 = 0, ink1 = 0;
uint8_t dat2;
uint8_t pattern;
uint32_t ink0 = 0;
uint32_t ink1 = 0;
/* Switch between internal plasma and external CRT display. */
if ((cpq_st_display_internal != -1) && (cpq_st_display_internal != self->internal_monitor)) {
@@ -304,25 +313,25 @@ compaq_plasma_poll(void *p)
} else {
addr = ((self->cga.displine >> 1) & 1) * 0x2000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1);
}
for (x = 0; x < 80; x++) {
dat2 = self->cga.vram[(addr & 0x7FFF)];
for (uint8_t x = 0; x < 80; x++) {
dat2 = self->cga.vram[addr & 0x7FFF];
addr++;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
ink = (dat2 & 0x80) ? fg : bg;
if (!(self->cga.cgamode & 8))
ink = black;
((uint32_t *) buffer32->line[self->cga.displine])[x * 8 + c] = ink;
(buffer32->line[self->cga.displine])[x * 8 + c] = ink;
dat2 <<= 1;
}
}
} else {
addr = ((self->cga.displine >> 1) & 1) * 0x2000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1);
for (x = 0; x < 80; x++) {
dat2 = self->cga.vram[(addr & 0x7fff)];
for (uint8_t x = 0; x < 80; x++) {
dat2 = self->cga.vram[addr & 0x7fff];
addr++;
for (c = 0; c < 4; c++) {
for (uint8_t c = 0; c < 4; c++) {
pattern = (dat2 & 0xC0) >> 6;
if (!(self->cga.cgamode & 8))
pattern = 0;
@@ -352,6 +361,9 @@ compaq_plasma_poll(void *p)
case 3:
ink0 = ink1 = amber;
break;
default:
break;
}
buffer32->line[self->cga.displine][x * 8 + 2 * c] = ink0;
buffer32->line[self->cga.displine][x * 8 + 2 * c + 1] = ink1;
@@ -371,7 +383,7 @@ compaq_plasma_poll(void *p)
cursorline = ((self->cga.crtc[0x0a] & 0x0f) * 2 <= sc) && ((self->cga.crtc[0x0b] & 0x0F) * 2 >= sc);
/* for each text column */
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
/* video output enabled */
if (self->cga.cgamode & 8) {
chr = self->cga.vram[(addr + 2 * x) & 0x7fff];
@@ -405,13 +417,13 @@ compaq_plasma_poll(void *p)
/* character underline active and 7th row of pixels in character height being drawn */
if (underline && (sc == 7)) {
/* for each pixel in character width */
for (c = 0; c < 8; c++)
for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 3) + c] = mdaattr[attr][blink][1];
} else if (drawcursor) {
for (c = 0; c < 8; c++)
for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 3) + c] = cols[(fontdatm[chr + self->cga.fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black);
} else {
for (c = 0; c < 8; c++)
for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 3) + c] = cols[(fontdatm[chr + self->cga.fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0];
}
@@ -427,7 +439,7 @@ compaq_plasma_poll(void *p)
else
cursorline = ((self->cga.crtc[0x0a] & 0x0f) * 2 <= sc) && ((self->cga.crtc[0x0b] & 0x0F) * 2 >= sc);
for (x = 0; x < 40; x++) {
for (uint8_t x = 0; x < 40; x++) {
if (self->cga.cgamode & 8) {
chr = self->cga.vram[(addr + 2 * x) & 0x7fff];
attr = self->cga.vram[(addr + 2 * x + 1) & 0x7fff];
@@ -460,14 +472,14 @@ compaq_plasma_poll(void *p)
/* character underline active and 7th row of pixels in character height being drawn */
if (underline && (sc == 7)) {
/* for each pixel in character width */
for (c = 0; c < 8; c++)
for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 4) + (c * 2)] = buffer32->line[self->cga.displine][(x << 4) + (c * 2) + 1] = mdaattr[attr][blink][1];
} else if (drawcursor) {
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[self->cga.displine][(x << 4) + c * 2] = buffer32->line[self->cga.displine][(x << 4) + c * 2 + 1] = cols[(fontdatm[chr][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black);
}
} else {
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[self->cga.displine][(x << 4) + c * 2] = buffer32->line[self->cga.displine][(x << 4) + c * 2 + 1] = cols[(fontdatm[chr][sc] & (1 << (c ^ 7))) ? 1 : 0];
}
}
@@ -530,9 +542,7 @@ compaq_plasma_poll(void *p)
static void
compaq_plasma_mdaattr_rebuild(void)
{
int c;
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
mdaattr[c][0][0] = mdaattr[c][1][0] = mdaattr[c][1][1] = 16;
if (c & 8)
mdaattr[c][0][1] = 15 + 16;
@@ -636,7 +646,7 @@ compaq_plasma_recalcattrs(compaq_plasma_t *self)
}
static void *
compaq_plasma_init(const device_t *info)
compaq_plasma_init(UNUSED(const device_t *info))
{
compaq_plasma_t *self = malloc(sizeof(compaq_plasma_t));
memset(self, 0, sizeof(compaq_plasma_t));
@@ -674,18 +684,18 @@ compaq_plasma_init(const device_t *info)
}
static void
compaq_plasma_close(void *p)
compaq_plasma_close(void *priv)
{
compaq_plasma_t *self = (compaq_plasma_t *) p;
compaq_plasma_t *self = (compaq_plasma_t *) priv;
free(self->cga.vram);
free(self);
}
static void
compaq_plasma_speed_changed(void *p)
compaq_plasma_speed_changed(void *priv)
{
compaq_plasma_t *self = (compaq_plasma_t *) p;
compaq_plasma_t *self = (compaq_plasma_t *) priv;
compaq_plasma_recalctimings(self);
}
@@ -727,7 +737,7 @@ const device_t compaq_plasma_device = {
};
static uint8_t
read_ram(uint32_t addr, void *priv)
read_ram(uint32_t addr, UNUSED(void *priv))
{
addr = (addr & 0x7ffff) + 0x80000;
addreadlookup(mem_logical_addr, addr);
@@ -736,7 +746,7 @@ read_ram(uint32_t addr, void *priv)
}
static uint16_t
read_ramw(uint32_t addr, void *priv)
read_ramw(uint32_t addr, UNUSED(void *priv))
{
addr = (addr & 0x7ffff) + 0x80000;
addreadlookup(mem_logical_addr, addr);
@@ -745,7 +755,7 @@ read_ramw(uint32_t addr, void *priv)
}
static uint32_t
read_raml(uint32_t addr, void *priv)
read_raml(uint32_t addr, UNUSED(void *priv))
{
addr = (addr & 0x7ffff) + 0x80000;
addreadlookup(mem_logical_addr, addr);
@@ -754,7 +764,7 @@ read_raml(uint32_t addr, void *priv)
}
static void
write_ram(uint32_t addr, uint8_t val, void *priv)
write_ram(uint32_t addr, uint8_t val, UNUSED(void *priv))
{
addr = (addr & 0x7ffff) + 0x80000;
addwritelookup(mem_logical_addr, addr);
@@ -763,7 +773,7 @@ write_ram(uint32_t addr, uint8_t val, void *priv)
}
static void
write_ramw(uint32_t addr, uint16_t val, void *priv)
write_ramw(uint32_t addr, uint16_t val, UNUSED(void *priv))
{
addr = (addr & 0x7ffff) + 0x80000;
addwritelookup(mem_logical_addr, addr);
@@ -772,7 +782,7 @@ write_ramw(uint32_t addr, uint16_t val, void *priv)
}
static void
write_raml(uint32_t addr, uint32_t val, void *priv)
write_raml(uint32_t addr, uint32_t val, UNUSED(void *priv))
{
addr = (addr & 0x7ffff) + 0x80000;
addwritelookup(mem_logical_addr, addr);
@@ -830,6 +840,9 @@ machine_at_compaq_init(const machine_t *model, int type)
machine_at_common_init(model);
device_add(&keyboard_at_compaq_device);
break;
default:
break;
}
}

View File

@@ -211,7 +211,9 @@ machine_at_p2bls_init(const machine_t *model)
device_add(&piix4e_device);
device_add(&keyboard_ps2_ami_pci_device);
device_add(&w83977ef_device);
// device_add(ics9xxx_get(ICS9150_08)); /* setting proper speeds requires some interaction with the AS97127F ASIC */
#if 0
device_add(ics9xxx_get(ICS9150_08)); /* setting proper speeds requires some interaction with the AS97127F ASIC */
#endif
device_add(&sst_flash_39sf020_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 256);
device_add(&w83781d_device); /* fans: Chassis, CPU, Power; temperatures: MB, unused, CPU */

View File

@@ -81,7 +81,9 @@ machine_at_award_common_init(const machine_t *model)
if (fdc_type == FDC_INTERNAL)
device_add(&fdc_at_device);
// device_add(&keyboard_ps2_pci_device);
#if 0
device_add(&keyboard_ps2_pci_device);
#endif
device_add(&keyboard_ps2_ami_pci_device);
}

View File

@@ -61,7 +61,9 @@ machine_at_thor_common_init(const machine_t *model, int mr)
if (gfxcard[0] == VID_INTERNAL)
device_add(&s3_phoenix_trio64vplus_onboard_pci_device);
// device_add(&keyboard_ps2_ami_pci_device);
#if 0
device_add(&keyboard_ps2_ami_pci_device);
#endif
device_add(&keyboard_ps2_intel_ami_pci_device);
device_add(&i430fx_device);
device_add(&piix_device);

View File

@@ -166,6 +166,7 @@
#include <86box/fdc_ext.h>
#include <86box/machine.h>
#include <86box/m_at_t3100e.h>
#include <86box/plat_unused.h>
extern uint8_t *ram; /* Physical RAM */
@@ -191,12 +192,12 @@ static unsigned t3100e_ems_page_reg[] = {
0x4208,
0x8208,
0xc208, /* The first four map the first 2Mb */
/* of RAM into the page frame */
/* of RAM into the page frame */
0x218,
0x4218,
0x8218,
0xc218, /* The next four map the next 2Mb */
/* of RAM */
/* of RAM */
0x258,
0x4258,
0x8258,
@@ -221,7 +222,7 @@ struct t3100e_ems_regs {
/* Bit 0 is 0 for colour, 1 for mono */
} t3100e_ems;
void t3100e_ems_out(uint16_t addr, uint8_t val, void *p);
void t3100e_ems_out(uint16_t addr, uint8_t val, void *priv);
#ifdef ENABLE_T3100E_LOG
int t3100e_do_log = ENABLE_T3100E_LOG;
@@ -331,11 +332,15 @@ port_to_page(uint16_t addr)
return 14;
case 0xC268:
return 15;
default:
break;
}
return -1;
}
/* Used to dump the memory mapping table, for debugging
/* Used to dump the memory mapping table, for debugging */
#if 0
void dump_mappings(void)
{
mem_mapping_t *mm = base_mapping.next;
@@ -377,7 +382,8 @@ void dump_mappings(void)
mm = mm->next;
}
}*/
}
#endif
void
t3100e_map_ram(uint8_t val)
@@ -437,7 +443,9 @@ t3100e_map_ram(uint8_t val)
&t3100e_ems);
}
// dump_mappings();
#if 0
dump_mappings();
#endif
}
void
@@ -470,9 +478,9 @@ t3100e_turbo_set(uint8_t value)
}
uint8_t
t3100e_sys_in(uint16_t addr, void *p)
t3100e_sys_in(UNUSED(uint16_t addr), void *priv)
{
struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) p;
struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) priv;
/* The low 4 bits always seem to be 0x0C. The high 4 are a
* notification sent by the keyboard controller when it detects
@@ -483,9 +491,11 @@ t3100e_sys_in(uint16_t addr, void *p)
/* Handle writes to the T3100e system control port at 0x8084 */
void
t3100e_sys_out(uint16_t addr, uint8_t val, void *p)
t3100e_sys_out(UNUSED(uint16_t addr), uint8_t val, UNUSED(void *priv))
{
// struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *)p;
#if 0
struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) priv;
#endif
switch (val & 0xE0) {
case 0x00: /* Set serial port IRQs. Not implemented */
@@ -551,6 +561,9 @@ t3100e_config_get(void)
value |= 0x10;
break; /* Tri-mode */
/* All others will be treated as 1.4M */
default:
break;
}
break;
case 4:
@@ -574,7 +587,11 @@ t3100e_config_get(void)
prt_switch = 0; /* No external drive */
}
break;
default:
break;
} /* End switch */
switch (prt_switch) {
case 0:
value |= 4;
@@ -585,15 +602,18 @@ t3100e_config_get(void)
case 2:
value |= 6;
break; /* External floppy is B: */
default:
break;
}
return value;
}
/* Read EMS page register */
uint8_t
t3100e_ems_in(uint16_t addr, void *p)
t3100e_ems_in(uint16_t addr, void *priv)
{
struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) p;
struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) priv;
int page = port_to_page(addr);
if (page >= 0)
@@ -606,9 +626,9 @@ t3100e_ems_in(uint16_t addr, void *p)
/* Write EMS page register */
void
t3100e_ems_out(uint16_t addr, uint8_t val, void *p)
t3100e_ems_out(uint16_t addr, uint8_t val, void *priv)
{
struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) p;
struct t3100e_ems_regs *regs = (struct t3100e_ems_regs *) priv;
int pg = port_to_page(addr);
if (pg == -1)
@@ -654,9 +674,13 @@ ems_read_ramw(uint32_t addr, void *priv)
if (pg < 0)
return 0xFFFF;
// t3100e_log("ems_read_ramw addr=%05x ", addr);
#if 0
t3100e_log("ems_read_ramw addr=%05x ", addr);
#endif
addr = regs->page_exec[pg] + (addr & 0x3FFF);
// t3100e_log("-> %06x val=%04x\n", addr, *(uint16_t *)&ram[addr]);
#if 0
// t3100e_log("-> %06x val=%04x\n", addr, *(uint16_t *) &ram[addr]);
#endif
return *(uint16_t *) &ram[addr];
}
@@ -693,9 +717,13 @@ ems_write_ramw(uint32_t addr, uint16_t val, void *priv)
if (pg < 0)
return;
// t3100e_log("ems_write_ramw addr=%05x ", addr);
#if 0
t3100e_log("ems_write_ramw addr=%05x ", addr);
#endif
addr = regs->page_exec[pg] + (addr & 0x3FFF);
// t3100e_log("-> %06x val=%04x\n", addr, val);
#if 0
t3100e_log("-> %06x val=%04x\n", addr, val);
#endif
*(uint16_t *) &ram[addr] = val;
}

View File

@@ -66,6 +66,7 @@
#include <86box/video.h>
#include <86box/vid_cga.h>
#include <86box/m_at_t3100e.h>
#include <86box/plat_unused.h>
#define T3100E_XSIZE 640
#define T3100E_YSIZE 400
@@ -134,14 +135,14 @@ typedef struct t3100e_t {
static video_timings_t timing_t3100e = { VIDEO_ISA, 8, 16, 32, 8, 16, 32 };
void t3100e_recalctimings(t3100e_t *t3100e);
void t3100e_write(uint32_t addr, uint8_t val, void *p);
uint8_t t3100e_read(uint32_t addr, void *p);
void t3100e_write(uint32_t addr, uint8_t val, void *priv);
uint8_t t3100e_read(uint32_t addr, void *priv);
void t3100e_recalcattrs(t3100e_t *t3100e);
void
t3100e_out(uint16_t addr, uint8_t val, void *p)
t3100e_out(uint16_t addr, uint8_t val, void *priv)
{
t3100e_t *t3100e = (t3100e_t *) p;
t3100e_t *t3100e = (t3100e_t *) priv;
switch (addr) {
/* Emulated CRTC, register select */
case 0x3d0:
@@ -168,21 +169,20 @@ t3100e_out(uint16_t addr, uint8_t val, void *p)
t3100e_recalctimings(t3100e);
return;
/* CGA control register */
case 0x3D8:
cga_out(addr, val, &t3100e->cga);
return;
/* CGA colour register */
case 0x3D9:
case 0x3D8: /* CGA control register */
case 0x3D9: /* CGA colour register */
cga_out(addr, val, &t3100e->cga);
return;
default:
break;
}
}
uint8_t
t3100e_in(uint16_t addr, void *p)
t3100e_in(uint16_t addr, void *priv)
{
t3100e_t *t3100e = (t3100e_t *) p;
t3100e_t *t3100e = (t3100e_t *) priv;
uint8_t val;
switch (addr) {
@@ -196,24 +196,28 @@ t3100e_in(uint16_t addr, void *p)
val |= 0x30; /* Plasma / CRT */
return val;
}
break;
default:
break;
}
return cga_in(addr, &t3100e->cga);
}
void
t3100e_write(uint32_t addr, uint8_t val, void *p)
t3100e_write(uint32_t addr, uint8_t val, void *priv)
{
t3100e_t *t3100e = (t3100e_t *) p;
t3100e_t *t3100e = (t3100e_t *) priv;
t3100e->vram[addr & 0x7fff] = val;
cycles -= 4;
}
uint8_t
t3100e_read(uint32_t addr, void *p)
t3100e_read(uint32_t addr, void *priv)
{
t3100e_t *t3100e = (t3100e_t *) p;
t3100e_t *t3100e = (t3100e_t *) priv;
cycles -= 4;
return t3100e->vram[addr & 0x7fff];
@@ -242,7 +246,6 @@ void
t3100e_text_row80(t3100e_t *t3100e)
{
uint32_t cols[2];
int c;
uint8_t chr;
uint8_t attr;
int drawcursor;
@@ -287,12 +290,12 @@ t3100e_text_row80(t3100e_t *t3100e)
cols[0] = normcols[attr][0];
}
if (drawcursor) {
for (c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[t3100e->displine])[(x << 3) + c] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black);
for (uint8_t c = 0; c < 8; c++) {
(buffer32->line[t3100e->displine])[(x << 3) + c] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black);
}
} else {
for (c = 0; c < 8; c++)
((uint32_t *) buffer32->line[t3100e->displine])[(x << 3) + c] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0];
for (uint8_t c = 0; c < 8; c++)
(buffer32->line[t3100e->displine])[(x << 3) + c] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0];
}
++ma;
}
@@ -349,11 +352,11 @@ t3100e_text_row40(t3100e_t *t3100e)
}
if (drawcursor) {
for (c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[t3100e->displine])[(x << 4) + c * 2] = ((uint32_t *) buffer32->line[t3100e->displine])[(x << 4) + c * 2 + 1] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black);
(buffer32->line[t3100e->displine])[(x << 4) + c * 2] = (buffer32->line[t3100e->displine])[(x << 4) + c * 2 + 1] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black);
}
} else {
for (c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[t3100e->displine])[(x << 4) + c * 2] = ((uint32_t *) buffer32->line[t3100e->displine])[(x << 4) + c * 2 + 1] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0];
(buffer32->line[t3100e->displine])[(x << 4) + c * 2] = (buffer32->line[t3100e->displine])[(x << 4) + c * 2 + 1] = cols[(fontdatm[bold][sc] & (1 << (c ^ 7))) ? 1 : 0];
}
}
++ma;
@@ -386,8 +389,8 @@ t3100e_cgaline6(t3100e_t *t3100e)
ink = (dat & 0x80) ? fg : bg;
if (!(t3100e->cga.cgamode & 8))
ink = black;
((uint32_t *) buffer32->line[t3100e->displine])[x * 8 + c] = ink;
dat = dat << 1;
(buffer32->line[t3100e->displine])[x * 8 + c] = ink;
dat = dat << 1;
}
}
}
@@ -445,18 +448,21 @@ t3100e_cgaline4(t3100e_t *t3100e)
case 3:
ink0 = ink1 = amber;
break;
default:
break;
}
((uint32_t *) buffer32->line[t3100e->displine])[x * 8 + 2 * c] = ink0;
((uint32_t *) buffer32->line[t3100e->displine])[x * 8 + 2 * c + 1] = ink1;
dat = dat << 2;
(buffer32->line[t3100e->displine])[x * 8 + 2 * c] = ink0;
(buffer32->line[t3100e->displine])[x * 8 + 2 * c + 1] = ink1;
dat = dat << 2;
}
}
}
void
t3100e_poll(void *p)
t3100e_poll(void *priv)
{
t3100e_t *t3100e = (t3100e_t *) p;
t3100e_t *t3100e = (t3100e_t *) priv;
if (t3100e->video_options != st_video_options) {
t3100e->video_options = st_video_options;
@@ -646,7 +652,7 @@ t3100e_recalcattrs(t3100e_t *t3100e)
}
void *
t3100e_init(const device_t *info)
t3100e_init(UNUSED(const device_t *info))
{
t3100e_t *t3100e = malloc(sizeof(t3100e_t));
memset(t3100e, 0, sizeof(t3100e_t));
@@ -680,18 +686,18 @@ t3100e_init(const device_t *info)
}
void
t3100e_close(void *p)
t3100e_close(void *priv)
{
t3100e_t *t3100e = (t3100e_t *) p;
t3100e_t *t3100e = (t3100e_t *) priv;
free(t3100e->vram);
free(t3100e);
}
void
t3100e_speed_changed(void *p)
t3100e_speed_changed(void *priv)
{
t3100e_t *t3100e = (t3100e_t *) p;
t3100e_t *t3100e = (t3100e_t *) priv;
t3100e_recalctimings(t3100e);
}

View File

@@ -50,11 +50,12 @@
#include <86box/rom.h>
#include <86box/video.h>
#include <86box/vid_cga.h>
#include <86box/plat_unused.h>
static void
elt_vid_off_poll(void *p)
elt_vid_off_poll(void *priv)
{
cga_t *cga = p;
cga_t *cga = priv;
uint8_t hdisp = cga->crtc[1];
/* Don't display anything.
@@ -65,9 +66,9 @@ elt_vid_off_poll(void *p)
}
static void
sysstat_out(uint16_t port, uint8_t val, void *p)
sysstat_out(UNUSED(uint16_t port), uint8_t val, void *priv)
{
cga_t *cga = p;
cga_t *cga = priv;
switch (val) {
case 0:
@@ -88,9 +89,9 @@ sysstat_out(uint16_t port, uint8_t val, void *p)
}
static uint8_t
sysstat_in(uint16_t port, void *p)
sysstat_in(UNUSED(uint16_t port), void *priv)
{
cga_t *cga = p;
cga_t *cga = priv;
uint8_t ret = 0x0a; /* No idea what these bits are */
/* External CRT. We don't emulate the LCD/CRT switching, let's just
@@ -103,9 +104,9 @@ sysstat_in(uint16_t port, void *p)
}
static void
elt_vid_out(uint16_t addr, uint8_t val, void *p)
elt_vid_out(uint16_t addr, uint8_t val, void *priv)
{
cga_t *cga = p;
cga_t *cga = priv;
/* The Equity LT chipset's CRTC contains more registers than the
* regular CGA. The BIOS writes one of them, register 36 (0x24).
@@ -122,22 +123,23 @@ elt_vid_out(uint16_t addr, uint8_t val, void *p)
case 0x3d1:
if (cga->crtcreg >= 32)
return;
/* FALLTHROUGH */
[[fallthrough]];
default:
cga->crtcreg &= 31;
cga_out(addr, val, p);
cga_out(addr, val, priv);
}
}
static uint8_t
elt_vid_in(uint16_t addr, void *p)
elt_vid_in(uint16_t addr, void *priv)
{
cga_t *cga = p;
cga_t *cga = priv;
/* Just make sure we don't ever let regular CGA code run with crtcreg
* pointing out of crtcregs[] bounds. */
cga->crtcreg &= 31;
return cga_in(addr, p);
return cga_in(addr, priv);
}
static void

View File

@@ -104,6 +104,7 @@
#include <86box/hdc.h>
#include <86box/video.h>
#include <86box/machine.h>
#include <86box/plat_unused.h>
#define EUROPC_DEBUG 0 /* current debugging level */
@@ -125,7 +126,7 @@
#define MRTC_CHECK_HI 0x0e /* Checksum, high byte */
#define MRTC_CTRLSTAT 0x0f /* RTC control/status, binary */
typedef struct {
typedef struct europc_t {
uint16_t jim; /* JIM base address */
uint8_t regs[16]; /* JIM internal regs (8) */
@@ -372,13 +373,17 @@ jim_set(europc_t *sys, uint8_t reg, uint8_t val)
switch (val) {
case 0x1f: /* 0001 1111 */
case 0x0b: /* 0000 1011 */
// europc_jim.mode=AGA_MONO;
#if 0
europc_jim.mode=AGA_MONO;
#endif
europc_log("EuroPC: AGA Monochrome mode!\n");
break;
case 0x18: /* 0001 1000 */
case 0x1a: /* 0001 1010 */
// europc_jim.mode=AGA_COLOR;
#if 0
europc_jim.mode=AGA_COLOR;
#endif
break;
case 0x0e: /* 0000 1100 */
@@ -392,7 +397,9 @@ jim_set(europc_t *sys, uint8_t reg, uint8_t val)
break;
default:
// europc_jim.mode=AGA_OFF;
#if 0
europc_jim.mode=AGA_OFF;
#endif
break;
}
break;
@@ -400,15 +407,21 @@ jim_set(europc_t *sys, uint8_t reg, uint8_t val)
case 4: /* CPU Speed control */
switch (val & 0xc0) {
case 0x00: /* 4.77 MHz */
// cpu_set_clockscale(0, 1.0/2);
#if 0
cpu_set_clockscale(0, 1.0/2);
#endif
break;
case 0x40: /* 7.16 MHz */
// cpu_set_clockscale(0, 3.0/4);
#if 0
cpu_set_clockscale(0, 3.0/4);
#endif
break;
default: /* 9.54 MHz */
// cpu_set_clockscale(0, 1);break;
#if 0
cpu_set_clockscale(0, 1);break;
#endif
break;
}
break;
@@ -465,6 +478,9 @@ jim_write(uint16_t addr, uint8_t val, void *priv)
sys->nvr_stat = 0;
nvr_dosave++;
break;
default:
break;
}
break;
@@ -511,6 +527,9 @@ jim_read(uint16_t addr, void *priv)
r = (sys->nvr.regs[sys->nvr_addr] & 0x0f);
sys->nvr_stat = 0;
break;
default:
break;
}
break;
@@ -528,7 +547,7 @@ jim_read(uint16_t addr, void *priv)
/* Initialize the mainboard 'device' of the machine. */
static void *
europc_boot(const device_t *info)
europc_boot(UNUSED(const device_t *info))
{
europc_t *sys = &europc;
uint8_t b;
@@ -573,6 +592,9 @@ europc_boot(const device_t *info)
case 640:
b |= 0x00;
break;
default:
break;
}
sys->nvr.regs[MRTC_CONF_C] = b;
@@ -590,6 +612,9 @@ europc_boot(const device_t *info)
case 2: /* 8088, 9.56 MHz */
b |= 0x80;
break;
default:
break;
}
sys->nvr.regs[MRTC_CONF_D] = b;
@@ -642,7 +667,7 @@ europc_boot(const device_t *info)
}
static void
europc_close(void *priv)
europc_close(UNUSED(void *priv))
{
nvr_t *nvr = &europc.nvr;

View File

@@ -49,6 +49,7 @@
#include <86box/video.h>
#include <86box/vid_cga_comp.h>
#include <86box/machine.h>
#include <86box/plat_unused.h>
#define PCJR_RGB 0
#define PCJR_COMPOSITE 1
@@ -62,7 +63,7 @@
#define STAT_IFULL 0x02
#define STAT_OFULL 0x01
typedef struct {
typedef struct pcjr_t {
/* Video Controller stuff. */
mem_mapping_t mapping;
uint8_t crtc[32];
@@ -73,20 +74,28 @@ typedef struct {
int memctrl;
uint8_t stat;
int addr_mode;
uint8_t *vram,
*b8000;
int linepos, displine;
int sc, vc;
int dispon;
int con, coff, cursoron, blink;
int vsynctime;
int fullchange;
int vadj;
uint16_t ma, maback;
uint64_t dispontime, dispofftime;
pc_timer_t timer;
int firstline, lastline;
int composite;
uint8_t *vram;
uint8_t *b8000;
int linepos;
int displine;
int sc;
int vc;
int dispon;
int con;
int coff;
int cursoron;
int blink;
int vsynctime;
int fullchange;
int vadj;
uint16_t ma;
uint16_t maback;
uint64_t dispontime;
uint64_t dispofftime;
pc_timer_t timer;
int firstline;
int lastline;
int composite;
/* Keyboard Controller stuff. */
int latched;
@@ -145,9 +154,9 @@ recalc_timings(pcjr_t *pcjr)
}
static void
vid_out(uint16_t addr, uint8_t val, void *p)
vid_out(uint16_t addr, uint8_t val, void *priv)
{
pcjr_t *pcjr = (pcjr_t *) p;
pcjr_t *pcjr = (pcjr_t *) priv;
uint8_t old;
switch (addr) {
@@ -184,13 +193,16 @@ vid_out(uint16_t addr, uint8_t val, void *p)
pcjr->addr_mode = val >> 6;
recalc_address(pcjr);
break;
default:
break;
}
}
static uint8_t
vid_in(uint16_t addr, void *p)
vid_in(uint16_t addr, void *priv)
{
pcjr_t *pcjr = (pcjr_t *) p;
pcjr_t *pcjr = (pcjr_t *) priv;
uint8_t ret = 0xff;
switch (addr) {
@@ -207,15 +219,18 @@ vid_in(uint16_t addr, void *p)
pcjr->stat ^= 0x10;
ret = pcjr->stat;
break;
default:
break;
}
return ret;
}
static void
vid_write(uint32_t addr, uint8_t val, void *p)
vid_write(uint32_t addr, uint8_t val, void *priv)
{
pcjr_t *pcjr = (pcjr_t *) p;
pcjr_t *pcjr = (pcjr_t *) priv;
if (pcjr->memctrl == -1)
return;
@@ -224,9 +239,9 @@ vid_write(uint32_t addr, uint8_t val, void *p)
}
static uint8_t
vid_read(uint32_t addr, void *p)
vid_read(uint32_t addr, void *priv)
{
pcjr_t *pcjr = (pcjr_t *) p;
pcjr_t *pcjr = (pcjr_t *) priv;
if (pcjr->memctrl == -1)
return 0xff;
@@ -235,13 +250,12 @@ vid_read(uint32_t addr, void *p)
}
static void
vid_poll(void *p)
vid_poll(void *priv)
{
pcjr_t *pcjr = (pcjr_t *) p;
pcjr_t *pcjr = (pcjr_t *) priv;
uint16_t ca = (pcjr->crtc[15] | (pcjr->crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
@@ -268,8 +282,8 @@ vid_poll(void *p)
}
pcjr->lastline = pcjr->displine;
cols[0] = (pcjr->array[2] & 0xf) + 16;
for (c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[pcjr->displine])[c] = cols[0];
for (uint8_t c = 0; c < 8; c++) {
(buffer32->line[pcjr->displine])[c] = cols[0];
if (pcjr->array[0] & 1) {
buffer32->line[pcjr->displine << 1][c + (pcjr->crtc[1] << 3) + 8] = buffer32->line[(pcjr->displine << 1) + 1][c + (pcjr->crtc[1] << 3) + 8] = cols[0];
} else {
@@ -288,6 +302,9 @@ vid_poll(void *p)
case 3: /*High resolution graphics*/
offset = (pcjr->sc & 3) * 0x2000;
break;
default:
break;
}
switch ((pcjr->array[0] & 0x13) | ((pcjr->array[3] & 0x08) << 5)) {
case 0x13: /*320x200x16*/
@@ -314,7 +331,7 @@ vid_poll(void *p)
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
chr = (dat >> 7) & 1;
chr |= ((dat >> 14) & 2);
buffer32->line[pcjr->displine << 1][(x << 3) + 8 + c] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 8 + c] = pcjr->array[(chr & pcjr->array[1]) + 16] + 16;
@@ -337,16 +354,16 @@ vid_poll(void *p)
cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16] + 16;
}
if (pcjr->sc & 8) {
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[0];
}
} else {
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
if (drawcursor) {
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] ^= 15;
buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] ^= 15;
}
@@ -370,17 +387,17 @@ vid_poll(void *p)
}
pcjr->ma++;
if (pcjr->sc & 8) {
for (c = 0; c < 8; c++) {
buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[0];
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[0];
}
} else {
for (c = 0; c < 8; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
if (drawcursor) {
for (c = 0; c < 16; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 4) + c + 8] ^= 15;
for (uint8_t c = 0; c < 16; c++) {
buffer32->line[pcjr->displine << 1][(x << 4) + c + 8] ^= 15;
buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + c + 8] ^= 15;
}
}
@@ -394,8 +411,8 @@ vid_poll(void *p)
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
for (c = 0; c < 8; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
dat <<= 2;
}
}
@@ -406,12 +423,15 @@ vid_poll(void *p)
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
for (c = 0; c < 16; c++) {
buffer32->line[(pcjr->displine << 1)][(x << 4) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15];
for (uint8_t c = 0; c < 16; c++) {
buffer32->line[pcjr->displine << 1][(x << 4) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15];
dat <<= 1;
}
}
break;
default:
break;
}
} else {
if (pcjr->array[3] & 4) {
@@ -438,7 +458,7 @@ vid_poll(void *p)
else
x = (pcjr->crtc[1] << 4) + 16;
if (pcjr->composite) {
Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[(pcjr->displine << 1)]);
Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[pcjr->displine << 1]);
Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[(pcjr->displine << 1) + 1]);
} else {
video_process_8(x, pcjr->displine << 1);
@@ -550,7 +570,7 @@ vid_poll(void *p)
pcjr->sc &= 31;
pcjr->ma = pcjr->maback;
}
if ((pcjr->sc == (pcjr->crtc[10] & 31) || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == ((pcjr->crtc[10] & 31) >> 1))))
if (pcjr->sc == (pcjr->crtc[10] & 31) || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == ((pcjr->crtc[10] & 31) >> 1)))
pcjr->con = 1;
}
}
@@ -591,6 +611,9 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
case 0x60:
sn76489_mute = 0;
break;
default:
break;
}
break;
@@ -598,6 +621,9 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
nmi_mask = val & 0x80;
pit_devs[0].set_using_timer(pit_devs[0].data, 1, !(val & 0x20));
break;
default:
break;
}
}
@@ -637,6 +663,9 @@ kbd_read(uint16_t port, void *priv)
pcjr->latched = 0;
ret = 0;
break;
default:
break;
}
return ret;
@@ -765,7 +794,7 @@ const device_t pcjr_device = {
};
int
machine_pcjr_init(const machine_t *model)
machine_pcjr_init(UNUSED(const machine_t *model))
{
int display_type;
pcjr_t *pcjr;

View File

@@ -153,6 +153,9 @@ ps1_write(uint16_t port, uint8_t val, void *priv)
case 2:
lpt1_init(LPT2_ADDR);
break;
default:
break;
}
}
ps->ps1_102 = val;
@@ -174,6 +177,9 @@ ps1_write(uint16_t port, uint8_t val, void *priv)
case 0x0190:
ps->ps1_190 = val;
break;
default:
break;
}
}

View File

@@ -161,54 +161,54 @@ enum {
* block is transferred.
*/
#pragma pack(push, 1)
typedef struct {
typedef struct ssb_t {
/* Status byte 0. */
uint8_t track_0 : 1, /* T0 */
mbz1 : 1, /* 0 */
mbz2 : 1, /* 0 */
cylinder_err : 1, /* CE */
write_fault : 1, /* WF */
mbz3 : 1, /* 0 */
seek_end : 1, /* SE */
not_ready : 1; /* NR */
uint8_t track_0 : 1; /* T0 */
uint8_t mbz1 : 1; /* 0 */
uint8_t mbz2 : 1; /* 0 */
uint8_t cylinder_err : 1; /* CE */
uint8_t write_fault : 1; /* WF */
uint8_t mbz3 : 1; /* 0 */
uint8_t seek_end : 1; /* SE */
uint8_t not_ready : 1; /* NR */
/* Status byte 1. */
uint8_t id_not_found : 1, /* ID */
mbz4 : 1, /* 0 */
mbz5 : 1, /* 0 */
wrong_cyl : 1, /* WC */
all_bit_set : 1, /* BT */
mark_not_found : 1, /* AM */
ecc_crc_err : 1, /* ET */
ecc_crc_field : 1; /* EF */
uint8_t id_not_found : 1; /* ID */
uint8_t mbz4 : 1; /* 0 */
uint8_t mbz5 : 1; /* 0 */
uint8_t wrong_cyl : 1; /* WC */
uint8_t all_bit_set : 1; /* BT */
uint8_t mark_not_found : 1; /* AM */
uint8_t ecc_crc_err : 1; /* ET */
uint8_t ecc_crc_field : 1; /* EF */
/* Status byte 2. */
uint8_t headsel_state : 4, /* headsel state[4] */
defective_sector : 1, /* DS */
retried_ok : 1, /* RG */
need_reset : 1, /* RR */
uint8_t headsel_state : 4; /* headsel state[4] */
uint8_t defective_sector : 1; /* DS */
uint8_t retried_ok : 1; /* RG */
uint8_t need_reset : 1; /* RR */
#if 1
valid : 1; /* 0 (abused as VALID) */
uint8_t valid : 1; /* 0 (abused as VALID) */
#else
mbz6 : 1; /* 0 */
uint8_t mbz6 : 1; /* 0 */
#endif
/* Most recent ID field seen. */
uint8_t last_cyl_low; /* Cyl_Low[8] */
uint8_t last_head : 4, /* HD[4] */
mbz7 : 1, /* 0 */
last_cyl_high : 2, /* Cyl_high[2] */
last_def_sect : 1; /* DS */
uint8_t last_sect; /* Sect[8] */
uint8_t last_cyl_low; /* Cyl_Low[8] */
uint8_t last_head : 4; /* HD[4] */
uint8_t mbz7 : 1; /* 0 */
uint8_t last_cyl_high : 2; /* Cyl_high[2] */
uint8_t last_def_sect : 1; /* DS */
uint8_t last_sect; /* Sect[8] */
uint8_t sect_size; /* Size[8] = 02 */
/* Current position. */
uint8_t curr_cyl_high : 2, /* Cyl_High_[2] */
mbz8 : 1, /* 0 */
mbz9 : 1, /* 0 */
curr_head : 4; /* HD_2[4] */
uint8_t curr_cyl_low; /* Cyl_Low_2[8] */
uint8_t curr_cyl_high : 2; /* Cyl_High_[2] */
uint8_t mbz8 : 1; /* 0 */
uint8_t mbz9 : 1; /* 0 */
uint8_t curr_head : 4; /* HD_2[4] */
uint8_t curr_cyl_low; /* Cyl_Low_2[8] */
uint8_t sect_corr; /* sectors corrected */
@@ -290,21 +290,21 @@ typedef struct {
* bits 0.
*/
#pragma pack(push, 1)
typedef struct {
uint8_t cyl_high : 2, /* cylinder [9:8] bits */
defective_sector : 1, /* DS */
mbz1 : 1, /* 0 */
head : 4; /* head number */
typedef struct fcb_t {
uint8_t cyl_high : 2; /* cylinder [9:8] bits */
uint8_t defective_sector : 1; /* DS */
uint8_t mbz1 : 1; /* 0 */
uint8_t head : 4; /* head number */
uint8_t cyl_low; /* cylinder [7:0] bits */
uint8_t cyl_low; /* cylinder [7:0] bits */
uint8_t sector; /* sector number */
uint8_t sector; /* sector number */
uint8_t mbz2 : 1, /* 0 */
mbo : 1, /* 1 */
mbz3 : 6; /* 000000 */
uint8_t mbz2 : 1; /* 0 */
uint8_t mbo : 1; /* 1 */
uint8_t mbz3 : 6; /* 000000 */
uint8_t fill; /* filler byte */
uint8_t fill; /* filler byte */
} fcb_t;
#pragma pack(pop)
@@ -316,31 +316,31 @@ typedef struct {
* through a DMA or PIO operation.
*/
#pragma pack(push, 1)
typedef struct {
uint8_t ec_p : 1, /* EC/P (ecc/park) */
mbz1 : 1, /* 0 */
auto_seek : 1, /* AS (auto-seek) */
no_data : 1, /* ND (no data) */
cmd : 4; /* command code[4] */
typedef struct ccb_t{
uint8_t ec_p : 1; /* EC/P (ecc/park) */
uint8_t mbz1 : 1; /* 0 */
uint8_t auto_seek : 1; /* AS (auto-seek) */
uint8_t no_data : 1; /* ND (no data) */
uint8_t cmd : 4; /* command code[4] */
uint8_t cyl_high : 2, /* cylinder [9:8] bits */
mbz2 : 2, /* 00 */
head : 4; /* head number */
uint8_t cyl_high : 2; /* cylinder [9:8] bits */
uint8_t mbz2 : 2; /* 00 */
uint8_t head : 4; /* head number */
uint8_t cyl_low; /* cylinder [7:0] bits */
uint8_t sector; /* sector number */
uint8_t mbz3 : 1, /* 0 */
mbo1 : 1, /* 1 */
mbz4 : 6; /* 000000 */
uint8_t mbz3 : 1; /* 0 */
uint8_t mbo1 : 1; /* 1 */
uint8_t mbz4 : 6; /* 000000 */
uint8_t count; /* blk count/interleave */
} ccb_t;
#pragma pack(pop)
/* Define the hard drive geometry table. */
typedef struct {
typedef struct geom_t {
uint16_t cyl;
uint8_t hpc;
uint8_t spt;
@@ -349,54 +349,54 @@ typedef struct {
} geom_t;
/* Define an attached drive. */
typedef struct {
int8_t id, /* drive ID on bus */
present, /* drive is present */
hdd_num, /* index to global disk table */
type; /* drive type ID */
typedef struct drive_t {
int8_t id; /* drive ID on bus */
int8_t present; /* drive is present */
int8_t hdd_num; /* index to global disk table */
int8_t type; /* drive type ID */
uint16_t cur_cyl; /* last known position of heads */
uint8_t spt, /* active drive parameters */
hpc;
uint8_t spt; /* active drive parameters */
uint8_t hpc;
uint16_t tracks;
uint8_t cfg_spt, /* configured drive parameters */
cfg_hpc;
uint8_t cfg_spt; /* configured drive parameters */
uint8_t cfg_hpc;
uint16_t cfg_tracks;
} drive_t;
typedef struct {
typedef struct hdc_t {
uint16_t base; /* controller base I/O address */
int8_t irq; /* controller IRQ channel */
int8_t dma; /* controller DMA channel */
/* Registers. */
uint8_t attn, /* ATTENTION register */
ctrl, /* Control register (ACR) */
status, /* Status register (ASR) */
intstat; /* Interrupt Status register (ISR) */
uint8_t attn; /* ATTENTION register */
uint8_t ctrl; /* Control register (ACR) */
uint8_t status; /* Status register (ASR) */
uint8_t intstat; /* Interrupt Status register (ISR) */
uint8_t *reg_91; /* handle to system board's register 0x91 */
/* Controller state. */
uint64_t callback;
pc_timer_t timer;
int8_t state, /* controller state */
reset; /* reset state counter */
int8_t state; /* controller state */
int8_t reset; /* reset state counter */
/* Data transfer. */
int16_t buf_idx, /* buffer index and pointer */
buf_len;
int16_t buf_idx; /* buffer index and pointer */
int16_t buf_len;
uint8_t *buf_ptr;
/* Current operation parameters. */
ssb_t ssb; /* sense block */
ccb_t ccb; /* command control block */
uint16_t track; /* requested track# */
uint8_t head, /* requested head# */
sector; /* requested sector# */
int count; /* requested sector count */
ssb_t ssb; /* sense block */
ccb_t ccb; /* command control block */
uint16_t track; /* requested track# */
uint8_t head; /* requested head# */
uint8_t sector; /* requested sector# */
int count; /* requested sector count */
drive_t drives[XTA_NUM]; /* the attached drive(s) */
@@ -602,8 +602,10 @@ do_seek(hdc_t *dev, drive_t *drive, uint16_t cyl)
static void
do_format(hdc_t *dev, drive_t *drive, ccb_t *ccb)
{
int start_cyl, end_cyl;
int intr = 0, val;
int start_cyl;
int end_cyl;
int intr = 0;
int val;
off64_t addr;
#if 0
fcb_t *fcb;
@@ -697,8 +699,7 @@ do_fmt:
/* Done with this track. */
dev->state = STATE_FDONE;
/*FALLTHROUGH*/
[[fallthrough]];
case STATE_FDONE:
/* One more track done. */
if (++start_cyl == end_cyl) {
@@ -712,6 +713,9 @@ do_fmt:
/* This saves us a LOT of code. */
dev->state = STATE_FINIT;
goto do_fmt;
default:
break;
}
/* If we errored out, go back idle. */
@@ -870,6 +874,9 @@ do_send:
/* This saves us a LOT of code. */
dev->state = STATE_SEND;
goto do_send;
default:
break;
}
break;
@@ -1012,6 +1019,9 @@ do_recv:
/* This saves us a LOT of code. */
dev->state = STATE_RECV;
goto do_recv;
default:
break;
}
break;
@@ -1125,6 +1135,9 @@ hdc_read(uint16_t port, void *priv)
ret = dev->intstat;
dev->intstat = 0x00;
break;
default:
break;
}
return ret;
@@ -1231,11 +1244,14 @@ hdc_write(uint16_t port, uint8_t val, void *priv)
set_intr(dev, 1);
}
break;
default:
break;
}
}
static void *
ps1_hdc_init(const device_t *info)
ps1_hdc_init(UNUSED(const device_t *info))
{
drive_t *drive;
hdc_t *dev;

View File

@@ -72,6 +72,9 @@ ps2_write(uint16_t port, uint8_t val, void *priv)
case 2:
lpt1_init(LPT2_ADDR);
break;
default:
break;
}
}
ps2->ps2_102 = val;
@@ -93,6 +96,9 @@ ps2_write(uint16_t port, uint8_t val, void *priv)
case 0x0190:
ps2->ps2_190 = val;
break;
default:
break;
}
}
@@ -131,6 +137,9 @@ ps2_read(uint16_t port, void *priv)
case 0x0190:
temp = ps2->ps2_190;
break;
default:
break;
}
return temp;

View File

@@ -68,15 +68,16 @@
#include <86box/serial.h>
#include <86box/video.h>
#include <86box/machine.h>
#include <86box/plat_unused.h>
static struct
{
static struct ps2_t {
uint8_t adapter_setup;
uint8_t option[4];
uint8_t pos_vga;
uint8_t setup;
uint8_t sys_ctrl_port_a;
uint8_t subaddr_lo, subaddr_hi;
uint8_t subaddr_lo;
uint8_t subaddr_hi;
uint8_t memory_bank[8];
@@ -88,11 +89,12 @@ static struct
mem_mapping_t cache_mapping;
uint8_t (*planar_read)(uint16_t port);
void (*planar_write)(uint16_t port, uint8_t val);
void (*planar_write)(uint16_t port, uint8_t val);
uint8_t mem_regs[3];
uint32_t split_addr, split_size;
uint32_t split_addr;
uint32_t split_size;
uint32_t split_phys;
uint8_t mem_pos_regs[8];
@@ -158,7 +160,7 @@ ps2_mca_log(const char *fmt, ...)
#endif
static uint8_t
ps2_read_cache_ram(uint32_t addr, void *priv)
ps2_read_cache_ram(uint32_t addr, UNUSED(void *priv))
{
ps2_mca_log("ps2_read_cache_ram: addr=%08x %i %04x:%04x\n", addr, ps2_cache_valid[addr >> 3], CS, cpu_state.pc);
if (!ps2_cache_valid[addr >> 3]) {
@@ -170,7 +172,7 @@ ps2_read_cache_ram(uint32_t addr, void *priv)
return ps2_cache[addr];
}
static uint16_t
ps2_read_cache_ramw(uint32_t addr, void *priv)
ps2_read_cache_ramw(uint32_t addr, UNUSED(void *priv))
{
ps2_mca_log("ps2_read_cache_ramw: addr=%08x %i %04x:%04x\n", addr, ps2_cache_valid[addr >> 3], CS, cpu_state.pc);
if (!ps2_cache_valid[addr >> 3]) {
@@ -182,7 +184,7 @@ ps2_read_cache_ramw(uint32_t addr, void *priv)
return *(uint16_t *) &ps2_cache[addr];
}
static uint32_t
ps2_read_cache_raml(uint32_t addr, void *priv)
ps2_read_cache_raml(uint32_t addr, UNUSED(void *priv))
{
ps2_mca_log("ps2_read_cache_raml: addr=%08x %i %04x:%04x\n", addr, ps2_cache_valid[addr >> 3], CS, cpu_state.pc);
if (!ps2_cache_valid[addr >> 3]) {
@@ -194,7 +196,7 @@ ps2_read_cache_raml(uint32_t addr, void *priv)
return *(uint32_t *) &ps2_cache[addr];
}
static void
ps2_write_cache_ram(uint32_t addr, uint8_t val, void *priv)
ps2_write_cache_ram(uint32_t addr, uint8_t val, UNUSED(void *priv))
{
ps2_mca_log("ps2_write_cache_ram: addr=%08x val=%02x %04x:%04x %i\n", addr, val, CS, cpu_state.pc);
ps2_cache[addr] = val;
@@ -268,6 +270,9 @@ model_50_read(uint16_t port)
return ps2.subaddr_lo;
case 0x107:
return ps2.subaddr_hi;
default:
break;
}
return 0xff;
}
@@ -292,6 +297,9 @@ model_55sx_read(uint16_t port)
return ps2.subaddr_lo;
case 0x107:
return ps2.subaddr_hi;
default:
break;
}
return 0xff;
}
@@ -316,6 +324,9 @@ model_70_type3_read(uint16_t port)
return ps2.subaddr_lo;
case 0x107:
return ps2.subaddr_hi;
default:
break;
}
return 0xff;
}
@@ -340,6 +351,9 @@ model_80_read(uint16_t port)
return ps2.subaddr_lo;
case 0x107:
return ps2.subaddr_hi;
default:
break;
}
return 0xff;
}
@@ -373,6 +387,9 @@ model_50_write(uint16_t port, uint8_t val)
case 2:
lpt1_init(LPT2_ADDR);
break;
default:
break;
}
}
ps2.option[0] = val;
@@ -392,6 +409,9 @@ model_50_write(uint16_t port, uint8_t val)
case 0x107:
ps2.subaddr_hi = val;
break;
default:
break;
}
}
@@ -458,11 +478,12 @@ model_55sx_mem_recalc(void)
mem_set_mem_state(0xe0000, 0x20000, state);
/* if (!(ps2.option[3] & 0x08))
{
#if 0
if (!(ps2.option[3] & 0x08)) {
ps2_mca_log("Memory not yet configured\n");
return;
} */
}
#endif
ps2_mca_log("Enable shadow mapping at %06X-%06X\n", (mem_size * 1024), (mem_size * 1024) + (remap_size * 1024) - 1);
@@ -503,6 +524,9 @@ model_55sx_write(uint16_t port, uint8_t val)
case 2:
lpt1_init(LPT2_ADDR);
break;
default:
break;
}
}
ps2.option[0] = val;
@@ -529,6 +553,9 @@ model_55sx_write(uint16_t port, uint8_t val)
case 0x107:
ps2.subaddr_hi = val;
break;
default:
break;
}
}
@@ -560,6 +587,9 @@ model_70_type3_write(uint16_t port, uint8_t val)
case 2:
lpt1_init(LPT2_ADDR);
break;
default:
break;
}
}
ps2.option[0] = val;
@@ -581,6 +611,9 @@ model_70_type3_write(uint16_t port, uint8_t val)
case 0x107:
ps2.subaddr_hi = val;
break;
default:
break;
}
}
@@ -612,6 +645,9 @@ model_80_write(uint16_t port, uint8_t val)
case 2:
lpt1_init(LPT2_ADDR);
break;
default:
break;
}
}
ps2.option[0] = val;
@@ -631,17 +667,22 @@ model_80_write(uint16_t port, uint8_t val)
case 0x107:
ps2.subaddr_hi = val;
break;
default:
break;
}
}
uint8_t
ps2_mca_read(uint16_t port, void *p)
ps2_mca_read(uint16_t port, UNUSED(void *priv))
{
uint8_t temp;
switch (port) {
case 0x91:
// fatal("Read 91 setup=%02x adapter=%02x\n", ps2.setup, ps2.adapter_setup);
#if 0
fatal("Read 91 setup=%02x adapter=%02x\n", ps2.setup, ps2.adapter_setup);
#endif
if (!(ps2.setup & PS2_SETUP_IO))
temp = 0x00;
else if (!(ps2.setup & PS2_SETUP_VGA))
@@ -740,7 +781,7 @@ ps2_mca_read(uint16_t port, void *p)
}
static void
ps2_mca_write(uint16_t port, uint8_t val, void *p)
ps2_mca_write(uint16_t port, uint8_t val, UNUSED(void *priv))
{
ps2_mca_log("ps2_write: port=%04x val=%02x %04x:%04x\n", port, val, CS, cpu_state.pc);
@@ -763,7 +804,7 @@ ps2_mca_write(uint16_t port, uint8_t val, void *p)
case 0x101:
if (!(ps2.setup & PS2_SETUP_IO))
ps2.planar_write(port, val);
else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP))
else if ((ps2.setup & PS2_SETUP_VGA) && (ps2.adapter_setup & PS2_ADAPTER_SETUP))
mca_write(port, val);
break;
case 0x102:
@@ -804,6 +845,9 @@ ps2_mca_write(uint16_t port, uint8_t val, void *p)
else if (ps2.adapter_setup & PS2_ADAPTER_SETUP)
mca_write(port, val);
break;
default:
break;
}
}
@@ -824,13 +868,13 @@ ps2_mca_board_common_init(void)
}
static uint8_t
ps2_mem_expansion_read(int port, void *p)
ps2_mem_expansion_read(int port, UNUSED(void *priv))
{
return ps2.mem_pos_regs[port & 7];
}
static void
ps2_mem_expansion_write(int port, uint8_t val, void *p)
ps2_mem_expansion_write(int port, uint8_t val, UNUSED(void *priv))
{
if (port < 0x102 || port == 0x104)
return;
@@ -844,7 +888,7 @@ ps2_mem_expansion_write(int port, uint8_t val, void *p)
}
static uint8_t
ps2_mem_expansion_feedb(void *p)
ps2_mem_expansion_feedb(UNUSED(void *priv))
{
return (ps2.mem_pos_regs[2] & 1);
}
@@ -888,6 +932,9 @@ ps2_mca_mem_fffc_init(int start_mb)
case 8:
ps2.mem_pos_regs[4] = 0xaa; /* 10 10 10 10 = 2 2 2 2 */
break;
default:
break;
}
mca_add(ps2_mem_expansion_read, ps2_mem_expansion_write, ps2_mem_expansion_feedb, NULL, NULL);
@@ -988,9 +1035,6 @@ ps2_mca_board_model_55sx_init(int has_sec_nvram, int slots)
ps2.memory_bank[1] = 0x61;
break;
case 6:
ps2.memory_bank[0] = 0x01;
ps2.memory_bank[1] = 0x51;
break;
case 7: /*Not supported*/
ps2.memory_bank[0] = 0x01;
ps2.memory_bank[1] = 0x51;
@@ -999,6 +1043,9 @@ ps2_mca_board_model_55sx_init(int has_sec_nvram, int slots)
ps2.memory_bank[0] = 0x01;
ps2.memory_bank[1] = 0x01;
break;
default:
break;
}
mca_init(slots);
@@ -1071,18 +1118,21 @@ mem_encoding_update(void)
}
static uint8_t
mem_encoding_read(uint16_t addr, void *p)
mem_encoding_read(uint16_t addr, UNUSED(void *priv))
{
switch (addr) {
case 0xe0:
return ps2.mem_regs[0];
case 0xe1:
return ps2.mem_regs[1];
default:
break;
}
return 0xff;
}
static void
mem_encoding_write(uint16_t addr, uint8_t val, void *p)
mem_encoding_write(uint16_t addr, uint8_t val, UNUSED(void *priv))
{
switch (addr) {
case 0xe0:
@@ -1091,12 +1141,15 @@ mem_encoding_write(uint16_t addr, uint8_t val, void *p)
case 0xe1:
ps2.mem_regs[1] = val;
break;
default:
break;
}
mem_encoding_update();
}
static uint8_t
mem_encoding_read_cached(uint16_t addr, void *p)
mem_encoding_read_cached(uint16_t addr, UNUSED(void *priv))
{
switch (addr) {
case 0xe0:
@@ -1105,12 +1158,15 @@ mem_encoding_read_cached(uint16_t addr, void *p)
return ps2.mem_regs[1];
case 0xe2:
return ps2.mem_regs[2];
default:
break;
}
return 0xff;
}
static void
mem_encoding_write_cached(uint16_t addr, uint8_t val, void *p)
mem_encoding_write_cached(uint16_t addr, uint8_t val, UNUSED(void *priv))
{
uint8_t old;
@@ -1145,6 +1201,9 @@ mem_encoding_write_cached(uint16_t addr, uint8_t val, void *p)
ram_mid_mapping.flags &= ~MEM_MAPPING_ROM_WS;
#endif
break;
default:
break;
}
ps2_mca_log("mem_encoding_write: addr=%02x val=%02x %04x:%04x %02x %02x\n", addr, val, CS, cpu_state.pc, ps2.mem_regs[1], ps2.mem_regs[2]);
mem_encoding_update();
@@ -1253,7 +1312,7 @@ ps2_mca_board_model_70_type34_init(int is_type4, int slots)
}
static void
ps2_mca_board_model_80_type2_init(int is486)
ps2_mca_board_model_80_type2_init(int is486ps2)
{
ps2_mca_board_common_init();
@@ -1313,7 +1372,7 @@ ps2_mca_board_model_80_type2_init(int is486)
NULL);
mem_mapping_disable(&ps2.split_mapping);
if ((mem_size > 4096) && !is486) {
if ((mem_size > 4096) && !is486ps2) {
/* Only 4 MB supported on planar, create a memory expansion card for the rest */
if (mem_size > 12288)
ps2_mca_mem_d071_init(4);

View File

@@ -43,6 +43,7 @@
#include <86box/video.h>
#include <86box/vid_cga_comp.h>
#include <86box/machine.h>
#include <86box/plat_unused.h>
enum {
TANDY_RGB = 0,
@@ -62,7 +63,7 @@ enum {
EEPROM_WRITE
};
typedef struct {
typedef struct t1kvid_t {
mem_mapping_t mapping;
mem_mapping_t vram_mapping;
@@ -72,36 +73,41 @@ typedef struct {
int array_index;
uint8_t array[256];
int memctrl;
uint8_t mode, col;
uint8_t mode;
uint8_t col;
uint8_t stat;
uint8_t *vram, *b8000;
uint8_t *vram;
uint8_t *b8000;
uint32_t b8000_mask;
uint32_t b8000_limit;
uint8_t planar_ctrl;
int linepos,
displine;
int sc, vc;
int dispon;
int con, coff,
cursoron,
blink;
int linepos;
int displine;
int sc;
int vc;
int dispon;
int con;
int coff;
int cursoron;
int blink;
int fullchange;
int vsynctime;
int vadj;
uint16_t ma, maback;
uint16_t ma;
uint16_t maback;
uint64_t dispontime,
dispofftime;
uint64_t dispontime;
uint64_t dispofftime;
pc_timer_t timer;
int firstline,
lastline;
int firstline;
int lastline;
int composite;
} t1kvid_t;
typedef struct {
typedef struct t1keep_t {
char *path;
int state;
@@ -112,7 +118,7 @@ typedef struct {
uint16_t store[64];
} t1keep_t;
typedef struct {
typedef struct tandy_t {
mem_mapping_t ram_mapping;
mem_mapping_t rom_mapping; /* SL2 */
@@ -573,6 +579,9 @@ vid_out(uint16_t addr, uint8_t val, void *priv)
vid->planar_ctrl = val;
recalc_mapping(dev);
break;
default:
break;
}
}
@@ -598,6 +607,9 @@ vid_in(uint16_t addr, void *priv)
case 0x03da:
ret = vid->stat;
break;
default:
break;
}
return ret;
@@ -696,7 +708,7 @@ vid_poll(void *priv)
} else {
buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->col & 15) + 16;
if (vid->mode & 1) {
buffer32->line[(vid->displine << 1)][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = (vid->col & 15) + 16;
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = (vid->col & 15) + 16;
} else {
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = (vid->col & 15) + 16;
}
@@ -773,7 +785,7 @@ vid_poll(void *priv)
}
if (drawcursor) {
for (c = 0; c < 8; c++) {
buffer32->line[(vid->displine << 1)][(x << 3) + c + 8] ^= 15;
buffer32->line[vid->displine << 1][(x << 3) + c + 8] ^= 15;
buffer32->line[(vid->displine << 1) + 1][(x << 3) + c + 8] ^= 15;
}
}
@@ -796,19 +808,19 @@ vid_poll(void *priv)
vid->ma++;
if (vid->sc & 8) {
for (c = 0; c < 8; c++)
buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = cols[0];
buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = cols[0];
} else {
for (c = 0; c < 8; c++) {
if (vid->sc == 8) {
buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][7] & (1 << (c ^ 7))) ? 1 : 0];
} else {
buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][vid->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
}
if (drawcursor) {
for (c = 0; c < 16; c++) {
buffer32->line[(vid->displine << 1)][(x << 4) + c + 8] ^= 15;
buffer32->line[vid->displine << 1][(x << 4) + c + 8] ^= 15;
buffer32->line[(vid->displine << 1) + 1][(x << 4) + c + 8] ^= 15;
}
}
@@ -837,7 +849,7 @@ vid_poll(void *priv)
dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000) + 1];
vid->ma++;
for (c = 0; c < 8; c++) {
buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[vid->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
dat <<= 2;
}
}
@@ -848,7 +860,7 @@ vid_poll(void *priv)
dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 1) * 0x2000) + 1];
vid->ma++;
for (c = 0; c < 16; c++) {
buffer32->line[(vid->displine << 1)][(x << 4) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15];
buffer32->line[vid->displine << 1][(x << 4) + c + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15];
dat <<= 1;
}
}
@@ -879,7 +891,7 @@ vid_poll(void *priv)
else
x = (vid->crtc[1] << 4) + 16;
if (!dev->is_sl2 && vid->composite) {
Composite_Process(vid->mode, 0, x >> 2, buffer32->line[(vid->displine << 1)]);
Composite_Process(vid->mode, 0, x >> 2, buffer32->line[vid->displine << 1]);
Composite_Process(vid->mode, 0, x >> 2, buffer32->line[(vid->displine << 1) + 1]);
} else {
video_process_8(x, vid->displine << 1);
@@ -967,7 +979,7 @@ vid_poll(void *priv)
if (!enable_overscan)
xs_temp -= 16;
if (((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
if ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get()) {
xsize = xs_temp;
ysize = ys_temp;
set_screen_size(xsize, ysize + (enable_overscan ? 16 : 0));
@@ -1021,7 +1033,7 @@ vid_poll(void *priv)
vid->sc &= 31;
vid->ma = vid->maback;
}
if ((vid->sc == (vid->crtc[10] & 31) || ((vid->crtc[8] & 3) == 3 && vid->sc == ((vid->crtc[10] & 31) >> 1))))
if (vid->sc == (vid->crtc[10] & 31) || ((vid->crtc[8] & 3) == 3 && vid->sc == ((vid->crtc[10] & 31) >> 1)))
vid->con = 1;
}
}
@@ -1139,7 +1151,7 @@ const device_t vid_device_sl = {
};
static void
eep_write(uint16_t addr, uint8_t val, void *priv)
eep_write(UNUSED(uint16_t addr), uint8_t val, void *priv)
{
t1keep_t *eep = (t1keep_t *) priv;
@@ -1166,6 +1178,9 @@ eep_write(uint16_t addr, uint8_t val, void *priv)
eep->state = EEPROM_GET_OPERATION;
eep->count = 0;
break;
default:
break;
}
break;
@@ -1211,6 +1226,9 @@ eep_write(uint16_t addr, uint8_t val, void *priv)
eep->store[eep->addr] = eep->data;
}
break;
default:
break;
}
eep->clk = val & 4;
@@ -1233,6 +1251,9 @@ eep_init(const device_t *info)
case TYPE_TANDY1000SL2:
eep->path = "tandy1000sl2.bin";
break;
default:
break;
}
f = nvr_fopen(eep->path, "rb");
@@ -1319,6 +1340,10 @@ tandy_write(uint16_t addr, uint8_t val, void *priv)
dev->rom_offset = ((val ^ 4) & 7) * 0x10000;
mem_mapping_set_exec(&dev->rom_mapping,
&dev->rom[dev->rom_offset]);
break;
default:
break;
}
}
@@ -1340,6 +1365,9 @@ tandy_read(uint16_t addr, void *priv)
case 0xffea:
ret = (dev->rom_bank ^ 0x10);
break;
default:
break;
}
return ret;
@@ -1475,6 +1503,9 @@ machine_tandy1k_init(const machine_t *model, int type)
device_add(&pssj_device);
device_add(&eep_1000sl2_device);
break;
default:
break;
}
standalone_gameport_type = &gameport_device;

View File

@@ -52,7 +52,7 @@ int
machine_v86p_init(const machine_t *model)
{
int ret;
int rom = 0;
int rom_id = 0;
ret = bios_load_interleavedr("roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_122089_Even.rom",
"roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_122089_Odd.rom",
@@ -60,7 +60,7 @@ machine_v86p_init(const machine_t *model)
if (!ret) {
/* Try an older version of the BIOS. */
rom = 1;
rom_id = 1;
ret = bios_load_interleavedr("roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_090489_Even.rom",
"roms/machines/v86p/INTEL8086AWD_BIOS_S3.1_V86P_090489_Odd.rom",
0x000f8000, 65536, 0);
@@ -68,7 +68,7 @@ machine_v86p_init(const machine_t *model)
if (!ret) {
/* Try JVERNET's BIOS. */
rom = 2;
rom_id = 2;
ret = bios_load_linear("roms/machines/v86p/V86P.ROM",
0x000f0000, 65536, 0);
}
@@ -76,7 +76,7 @@ machine_v86p_init(const machine_t *model)
if (bios_only || !ret)
return ret;
if (rom == 2)
if (rom_id == 2)
loadfont("roms/machines/v86p/V86P.FON", 8);
else
loadfont("roms/machines/v86p/v86pfont.rom", 8);

View File

@@ -19,6 +19,7 @@
#include <86box/fdc_ext.h>
#include <86box/gameport.h>
#include <86box/keyboard.h>
#include <86box/plat_unused.h>
static int laserxt_emspage[4];
static int laserxt_emscontrol[4];
@@ -37,7 +38,7 @@ get_laserxt_ems_addr(uint32_t addr)
}
static void
laserxt_write(uint16_t port, uint8_t val, void *priv)
laserxt_write(uint16_t port, uint8_t val, UNUSED(void *priv))
{
uint32_t paddr;
uint32_t vaddr;
@@ -73,11 +74,14 @@ laserxt_write(uint16_t port, uint8_t val, void *priv)
mem_mapping_set_addr(&laserxt_ems_mapping[3], 0xCC000 + (((laserxt_ems_baseaddr_index + 1) & 0x0C) << 14), 0x4000);
flushmmucache();
break;
default:
break;
}
}
static uint8_t
laserxt_read(uint16_t port, void *priv)
laserxt_read(uint16_t port, UNUSED(void *priv))
{
switch (port) {
case 0x0208:
@@ -90,13 +94,15 @@ laserxt_read(uint16_t port, void *priv)
case 0x8209:
case 0xC209:
return laserxt_emscontrol[port >> 14];
default:
break;
}
return 0xff;
}
static void
mem_write_laserxtems(uint32_t addr, uint8_t val, void *priv)
mem_write_laserxtems(uint32_t addr, uint8_t val, UNUSED(void *priv))
{
addr = get_laserxt_ems_addr(addr);
if (addr < (mem_size << 10))
@@ -104,7 +110,7 @@ mem_write_laserxtems(uint32_t addr, uint8_t val, void *priv)
}
static uint8_t
mem_read_laserxtems(uint32_t addr, void *priv)
mem_read_laserxtems(uint32_t addr, UNUSED(void *priv))
{
uint8_t val = 0xFF;
addr = get_laserxt_ems_addr(addr);

View File

@@ -57,6 +57,7 @@
#include <86box/vid_ogc.h>
#include <86box/vid_colorplus.h>
#include <86box/vid_cga_comp.h>
#include <86box/plat_unused.h>
#define STAT_PARITY 0x80
#define STAT_RTIMEOUT 0x40
@@ -115,7 +116,7 @@ enum MM58274_ADDR {
static struct tm intclk;
typedef struct {
typedef struct m24_kbd_t {
/* Keyboard stuff. */
int wantirq;
uint8_t command;
@@ -123,18 +124,20 @@ typedef struct {
uint8_t out;
uint8_t output_port;
uint8_t id;
int param,
param_total;
int param;
int param_total;
uint8_t params[16];
uint8_t scan[7];
/* Mouse stuff. */
int mouse_mode;
int x, y, b;
int x;
int y;
int b;
pc_timer_t send_delay_timer;
} m24_kbd_t;
typedef struct {
typedef struct m19_vid_t {
ogc_t ogc;
colorplus_t colorplus;
int mode;
@@ -635,6 +638,10 @@ m24_kbd_write(uint16_t port, uint8_t val, void *priv)
if (val == 0x02)
m24_kbd_adddata(0x00);
break;
default:
break;
}
}
@@ -725,7 +732,7 @@ m24_kbd_reset(void *priv)
}
static int
ms_poll(int x, int y, int z, int b, void *priv)
ms_poll(int x, int y, UNUSED(int z), int b, void *priv)
{
m24_kbd_t *m24_kbd = (m24_kbd_t *) priv;
@@ -1492,12 +1499,16 @@ m19_vid_init(m19_vid_t *vid)
{
device_context(&m19_vid_device);
/* int display_type; */
#if 0
int display_type;
#endif
vid->mode = OLIVETTI_OGC_MODE;
video_inform(VIDEO_FLAG_TYPE_CGA, &timing_m19_vid);
/* display_type = device_get_config_int("display_type"); */
#if 0
display_type = device_get_config_int("display_type");
#endif
/* OGC emulation part begin */
loadfont_ex("roms/machines/m19/BIOS.BIN", 1, 90);
@@ -1508,7 +1519,9 @@ m19_vid_init(m19_vid_t *vid)
vid->ogc.cga.vram = malloc(0x8000);
/* cga_comp_init(vid->ogc.cga.revision); */
#if 0
cga_comp_init(vid->ogc.cga.revision);
#endif
vid->ogc.cga.rgb_type = device_get_config_int("rgb_type");
cga_palette = (vid->ogc.cga.rgb_type << 1);
@@ -1525,11 +1538,15 @@ m19_vid_init(m19_vid_t *vid)
/* Plantronics emulation part begin*/
/* composite is not working yet */
vid->colorplus.cga.composite = 0; //(display_type != CGA_RGB);
/* vid->colorplus.cga.snow_enabled = device_get_config_int("snow_enabled"); */
#if 0
vid->colorplus.cga.snow_enabled = device_get_config_int("snow_enabled");
#endif
vid->colorplus.cga.vram = malloc(0x8000);
/* vid->colorplus.cga.cgamode = 0x1; */
#if 0
vid->colorplus.cga.cgamode = 0x1;
#endif
/* Plantronics emulation part end*/
timer_add(&vid->ogc.cga.timer, ogc_poll, &vid->ogc, 1);
@@ -1602,7 +1619,7 @@ const device_t m19_vid_device = {
};
static uint8_t
m24_read(uint16_t port, void *priv)
m24_read(uint16_t port, UNUSED(void *priv))
{
uint8_t ret = 0x00;
int fdd_count = 0;
@@ -1706,13 +1723,16 @@ m24_read(uint16_t port, void *priv)
/* 1 = 720 kB (3.5"), 0 = 360 kB (5.25") */
ret |= (fdd_doublestep_40(0) || fdd_doublestep_40(1)) ? 0x1 : 0x0;
break;
default:
break;
}
return ret;
}
static uint8_t
m240_read(uint16_t port, void *priv)
m240_read(uint16_t port, UNUSED(void *priv))
{
uint8_t ret = 0x00;
int fdd_count = 0;
@@ -1761,6 +1781,9 @@ m240_read(uint16_t port, void *priv)
ret |= fdd_doublestep_40(1) ? 0x40 : 0x00;
ret |= fdd_doublestep_40(0) ? 0x20 : 0x00;
break;
default:
break;
}
return ret;

View File

@@ -39,9 +39,9 @@
#include <86box/chipset.h>
#include <86box/io.h>
#include <86box/video.h>
#include <86box/plat_unused.h>
typedef struct
{
typedef struct philips_t {
uint8_t reg;
} philips_t;
@@ -80,6 +80,9 @@ philips_write(uint16_t port, uint8_t val, void *priv)
else
cpu_dynamic_switch(0);
break;
default:
break;
}
philips_log("Philips XT Mainboard: Write %02x at %02x\n", val, port);
@@ -100,6 +103,9 @@ philips_read(uint16_t port, void *priv)
case 0xc0:
ret = dev->reg;
break;
default:
break;
}
philips_log("Philips XT Mainboard: Read %02x at %02x\n", ret, port);
@@ -116,7 +122,7 @@ philips_close(void *priv)
}
static void *
philips_init(const device_t *info)
philips_init(UNUSED(const device_t *info))
{
philips_t *dev = (philips_t *) malloc(sizeof(philips_t));
memset(dev, 0, sizeof(philips_t));

View File

@@ -135,7 +135,7 @@ enum TC8521_ADDR {
TC8521_LEAPYEAR = 0x1B
};
typedef struct {
typedef struct t1000_t {
/* ROM drive */
uint8_t *romdrive;
uint8_t rom_ctl;
@@ -237,7 +237,7 @@ tc8521_time_get(uint8_t *regs, struct tm *tm)
/* This is called every second through the NVR/RTC hook. */
static void
tc8521_tick(nvr_t *nvr)
tc8521_tick(UNUSED(nvr_t *nvr))
{
t1000_log("TC8521: ping\n");
}
@@ -336,7 +336,7 @@ tc8521_init(nvr_t *nvr, int size)
/* Given an EMS page ID, return its physical address in RAM. */
static uint32_t
ems_execaddr(t1000_t *sys, int pg, uint16_t val)
ems_execaddr(t1000_t *sys, UNUSED(int pg), uint16_t val)
{
if (!(val & 0x80))
return 0; /* Bit 7 reset => not mapped */
@@ -595,6 +595,9 @@ read_ctl(uint16_t addr, void *priv)
case 0x52:
ret = (sys->is_640k ? 0x80 : 0);
break;
default:
break;
}
break;
@@ -656,8 +659,14 @@ write_ctl(uint16_t addr, uint8_t val, void *priv)
case 0x52:
ems_set_640k(sys, val);
break;
default:
break;
}
break;
default:
break;
}
}
@@ -689,6 +698,9 @@ t1000_read_nvram(uint16_t addr, void *priv)
tmp |= 0x2e; /* Bits 5, 3, 2, 1 always 1 */
tmp |= (sys->nvr_active & 0x40) >> 6; /* Ready state */
break;
default:
break;
}
return tmp;
@@ -733,6 +745,9 @@ t1000_write_nvram(uint16_t addr, uint8_t val, void *priv)
if (val == 0x80)
sys->nvr_addr = -1;
break;
default:
break;
}
}
@@ -757,7 +772,7 @@ write_t1200_nvram(uint32_t addr, uint8_t value, void *priv)
/* Port 0xC8 controls the ROM drive */
static uint8_t
t1000_read_rom_ctl(uint16_t addr, void *priv)
t1000_read_rom_ctl(UNUSED(uint16_t addr), void *priv)
{
t1000_t *sys = (t1000_t *) priv;
@@ -765,7 +780,7 @@ t1000_read_rom_ctl(uint16_t addr, void *priv)
}
static void
t1000_write_rom_ctl(uint16_t addr, uint8_t val, void *priv)
t1000_write_rom_ctl(UNUSED(uint16_t addr), uint8_t val, void *priv)
{
t1000_t *sys = (t1000_t *) priv;

View File

@@ -51,12 +51,14 @@
#include <86box/video.h>
#include <86box/vid_cga.h>
#include <86box/m_xt_t1000.h>
#include <86box/plat_unused.h>
#define T1000_XSIZE 640
#define T1000_YSIZE 200
/* Mapping of attributes to colours */
static uint32_t blue, grey;
static uint32_t blue;
static uint32_t grey;
static uint8_t boldcols[256]; /* Which attributes use the bold font */
static uint32_t blinkcols[256][2];
static uint32_t normcols[256][2];
@@ -124,14 +126,14 @@ typedef struct t1000_t {
} t1000_t;
static void t1000_recalctimings(t1000_t *t1000);
static void t1000_write(uint32_t addr, uint8_t val, void *p);
static uint8_t t1000_read(uint32_t addr, void *p);
static void t1000_write(uint32_t addr, uint8_t val, void *priv);
static uint8_t t1000_read(uint32_t addr, void *priv);
static void t1000_recalcattrs(t1000_t *t1000);
static void
t1000_out(uint16_t addr, uint8_t val, void *p)
t1000_out(uint16_t addr, uint8_t val, void *priv)
{
t1000_t *t1000 = (t1000_t *) p;
t1000_t *t1000 = (t1000_t *) priv;
switch (addr) {
/* Emulated CRTC, register select */
case 0x3d0:
@@ -158,21 +160,20 @@ t1000_out(uint16_t addr, uint8_t val, void *p)
t1000_recalctimings(t1000);
return;
/* CGA control register */
case 0x3D8:
cga_out(addr, val, &t1000->cga);
return;
/* CGA colour register */
case 0x3D9:
case 0x3D8: /* CGA control register */
case 0x3D9: /* CGA colour register */
cga_out(addr, val, &t1000->cga);
return;
default:
break;
}
}
static uint8_t
t1000_in(uint16_t addr, void *p)
t1000_in(uint16_t addr, void *priv)
{
t1000_t *t1000 = (t1000_t *) p;
t1000_t *t1000 = (t1000_t *) priv;
uint8_t val;
switch (addr) {
@@ -186,24 +187,29 @@ t1000_in(uint16_t addr, void *p)
val |= 0x20; /* LCD / CRT */
return val;
}
break;
default:
break;
}
return cga_in(addr, &t1000->cga);
}
static void
t1000_write(uint32_t addr, uint8_t val, void *p)
t1000_write(uint32_t addr, uint8_t val, void *priv)
{
t1000_t *t1000 = (t1000_t *) p;
t1000_t *t1000 = (t1000_t *) priv;
t1000->vram[addr & 0x3fff] = val;
cycles -= 4;
}
static uint8_t
t1000_read(uint32_t addr, void *p)
t1000_read(uint32_t addr, void *priv)
{
t1000_t *t1000 = (t1000_t *) p;
t1000_t *t1000 = (t1000_t *) priv;
cycles -= 4;
return t1000->vram[addr & 0x3fff];
@@ -213,7 +219,8 @@ static void
t1000_recalctimings(t1000_t *t1000)
{
double disptime;
double _dispontime, _dispofftime;
double _dispontime;
double _dispofftime;
if (!t1000->internal) {
cga_recalctimings(&t1000->cga);
@@ -231,7 +238,6 @@ static void
t1000_text_row80(t1000_t *t1000)
{
uint32_t cols[2];
int c;
uint8_t chr;
uint8_t attr;
int drawcursor;
@@ -277,12 +283,12 @@ t1000_text_row80(t1000_t *t1000)
cols[0] = normcols[attr][0];
}
if (drawcursor) {
for (c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[t1000->displine])[(x << 3) + c] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (blue ^ grey);
for (uint8_t c = 0; c < 8; c++) {
(buffer32->line[t1000->displine])[(x << 3) + c] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (blue ^ grey);
}
} else {
for (c = 0; c < 8; c++)
((uint32_t *) buffer32->line[t1000->displine])[(x << 3) + c] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0];
for (uint8_t c = 0; c < 8; c++)
(buffer32->line[t1000->displine])[(x << 3) + c] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0];
}
++ma;
}
@@ -293,8 +299,8 @@ static void
t1000_text_row40(t1000_t *t1000)
{
uint32_t cols[2];
int x, c;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
int drawcursor;
int cursorline;
int bold;
@@ -313,7 +319,7 @@ t1000_text_row40(t1000_t *t1000)
} else {
cursorline = ((t1000->cga.crtc[10] & 0x0F) <= sc) && ((t1000->cga.crtc[11] & 0x0F) >= sc);
}
for (x = 0; x < 40; x++) {
for (uint8_t x = 0; x < 40; x++) {
chr = t1000->vram[(addr + 2 * x) & 0x3FFF];
attr = t1000->vram[(addr + 2 * x + 1) & 0x3FFF];
drawcursor = ((ma == ca) && cursorline && (t1000->cga.cgamode & 8) && (t1000->cga.cgablink & 16));
@@ -338,12 +344,12 @@ t1000_text_row40(t1000_t *t1000)
cols[0] = normcols[attr][0];
}
if (drawcursor) {
for (c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[t1000->displine])[(x << 4) + c * 2] = ((uint32_t *) buffer32->line[t1000->displine])[(x << 4) + c * 2 + 1] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (blue ^ grey);
for (uint8_t c = 0; c < 8; c++) {
(buffer32->line[t1000->displine])[(x << 4) + c * 2] = (buffer32->line[t1000->displine])[(x << 4) + c * 2 + 1] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (blue ^ grey);
}
} else {
for (c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[t1000->displine])[(x << 4) + c * 2] = ((uint32_t *) buffer32->line[t1000->displine])[(x << 4) + c * 2 + 1] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0];
for (uint8_t c = 0; c < 8; c++) {
(buffer32->line[t1000->displine])[(x << 4) + c * 2] = (buffer32->line[t1000->displine])[(x << 4) + c * 2 + 1] = cols[(fontdat[bold][sc] & (1 << (c ^ 7))) ? 1 : 0];
}
}
++ma;
@@ -354,7 +360,6 @@ t1000_text_row40(t1000_t *t1000)
static void
t1000_cgaline6(t1000_t *t1000)
{
int x, c;
uint8_t dat;
uint32_t ink = 0;
uint16_t addr;
@@ -365,15 +370,15 @@ t1000_cgaline6(t1000_t *t1000)
addr = ((t1000->displine) & 1) * 0x2000 + (t1000->displine >> 1) * 80 + ((ma & ~1) << 1);
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
dat = t1000->vram[addr & 0x3FFF];
addr++;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
ink = (dat & 0x80) ? fg : bg;
if (!(t1000->cga.cgamode & 8))
ink = grey;
((uint32_t *) buffer32->line[t1000->displine])[x * 8 + c] = ink;
(buffer32->line[t1000->displine])[x * 8 + c] = ink;
dat = dat << 1;
}
}
@@ -384,19 +389,20 @@ t1000_cgaline6(t1000_t *t1000)
static void
t1000_cgaline4(t1000_t *t1000)
{
int x, c;
uint8_t dat, pattern;
uint32_t ink0, ink1;
uint8_t dat;
uint8_t pattern;
uint32_t ink0;
uint32_t ink1;
uint16_t addr;
uint16_t ma = (t1000->cga.crtc[13] | (t1000->cga.crtc[12] << 8)) & 0x3fff;
addr = ((t1000->displine) & 1) * 0x2000 + (t1000->displine >> 1) * 80 + ((ma & ~1) << 1);
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
dat = t1000->vram[addr & 0x3FFF];
addr++;
for (c = 0; c < 4; c++) {
for (uint8_t c = 0; c < 4; c++) {
pattern = (dat & 0xC0) >> 6;
if (!(t1000->cga.cgamode & 8))
pattern = 0;
@@ -428,17 +434,17 @@ t1000_cgaline4(t1000_t *t1000)
ink0 = ink1 = blue;
break;
}
((uint32_t *) buffer32->line[t1000->displine])[x * 8 + 2 * c] = ink0;
((uint32_t *) buffer32->line[t1000->displine])[x * 8 + 2 * c + 1] = ink1;
dat = dat << 2;
(buffer32->line[t1000->displine])[x * 8 + 2 * c] = ink0;
(buffer32->line[t1000->displine])[x * 8 + 2 * c + 1] = ink1;
dat = dat << 2;
}
}
}
static void
t1000_poll(void *p)
t1000_poll(void *priv)
{
t1000_t *t1000 = (t1000_t *) p;
t1000_t *t1000 = (t1000_t *) priv;
if (t1000->video_options != st_video_options || t1000->enabled != st_enabled) {
t1000->video_options = st_video_options;
@@ -643,7 +649,7 @@ t1000_recalcattrs(t1000_t *t1000)
}
static void *
t1000_init(const device_t *info)
t1000_init(UNUSED(const device_t *info))
{
t1000_t *t1000 = malloc(sizeof(t1000_t));
memset(t1000, 0, sizeof(t1000_t));
@@ -681,18 +687,18 @@ t1000_init(const device_t *info)
}
static void
t1000_close(void *p)
t1000_close(void *priv)
{
t1000_t *t1000 = (t1000_t *) p;
t1000_t *t1000 = (t1000_t *) priv;
free(t1000->vram);
free(t1000);
}
static void
t1000_speed_changed(void *p)
t1000_speed_changed(void *priv)
{
t1000_t *t1000 = (t1000_t *) p;
t1000_t *t1000 = (t1000_t *) priv;
t1000_recalctimings(t1000);
}

View File

@@ -24,6 +24,7 @@
#include <86box/video.h>
#include <86box/machine.h>
#include "cpu.h"
#include <86box/plat_unused.h>
#include <86box/m_xt_xi8088.h>
@@ -67,7 +68,7 @@ xi8088_bios_128kb(void)
}
static void *
xi8088_init(const device_t *info)
xi8088_init(UNUSED(const device_t *info))
{
xi8088.turbo = 1;
xi8088.turbo_setting = device_get_config_int("turbo_setting");

View File

@@ -46,6 +46,7 @@
#include <86box/machine.h>
#include <86box/io.h>
#include <86box/vid_cga.h>
#include <86box/plat_unused.h>
typedef struct {
mem_mapping_t scratchpad_mapping;
@@ -53,21 +54,21 @@ typedef struct {
} zenith_t;
static uint8_t
zenith_scratchpad_read(uint32_t addr, void *p)
zenith_scratchpad_read(uint32_t addr, void *priv)
{
zenith_t *dev = (zenith_t *) p;
zenith_t *dev = (zenith_t *) priv;
return dev->scratchpad_ram[addr & 0x3fff];
}
static void
zenith_scratchpad_write(uint32_t addr, uint8_t val, void *p)
zenith_scratchpad_write(uint32_t addr, uint8_t val, void *priv)
{
zenith_t *dev = (zenith_t *) p;
zenith_t *dev = (zenith_t *) priv;
dev->scratchpad_ram[addr & 0x3fff] = val;
}
static void *
zenith_scratchpad_init(const device_t *info)
zenith_scratchpad_init(UNUSED(const device_t *info))
{
zenith_t *dev;
@@ -85,9 +86,9 @@ zenith_scratchpad_init(const device_t *info)
}
static void
zenith_scratchpad_close(void *p)
zenith_scratchpad_close(void *priv)
{
zenith_t *dev = (zenith_t *) p;
zenith_t *dev = (zenith_t *) priv;
free(dev->scratchpad_ram);
free(dev);

View File

@@ -42,6 +42,7 @@
#include <86box/machine.h>
#include <86box/isamem.h>
#include <86box/pci.h>
#include <86box/plat_unused.h>
int bios_only = 0;
int machine;
@@ -78,8 +79,10 @@ machine_init_ex(int m)
gameport_instance_id = 0;
/* Set up the architecture flags. */
// AT = IS_AT(machine);
// PCI = IS_ARCH(machine, MACHINE_BUS_PCI);
#if 0
AT = IS_AT(machine);
PCI = IS_ARCH(machine, MACHINE_BUS_PCI);
#endif
cpu_set();
pc_speed_changed();
@@ -141,14 +144,14 @@ int
machine_available(int m)
{
int ret;
device_t *d = (device_t *) machine_get_device(m);
device_t *dev = (device_t *) machine_get_device(m);
bios_only = 1;
ret = device_available(d);
ret = device_available(dev);
/* Do not check via machine_init_ex() if the device is not NULL and
it has a CONFIG_BIOS field. */
if ((d == NULL) || (ret != -1))
if ((dev == NULL) || (ret != -1))
ret = machine_init_ex(m);
bios_only = 0;
@@ -167,7 +170,7 @@ pit_irq0_timer(int new_out, int old_out)
}
void
machine_common_init(const machine_t *model)
machine_common_init(UNUSED(const machine_t *model))
{
/* System devices first. */
pic_init();

View File

@@ -34,6 +34,7 @@
#include <86box/keyboard.h>
#include <86box/sound.h>
#include <86box/video.h>
#include <86box/plat_unused.h>
// Temporarily here till we move everything out into the right files
extern const device_t pcjr_device;
@@ -12953,7 +12954,7 @@ machine_get_p1(void)
}
void
machine_load_p1(int m)
machine_load_p1(UNUSED(int m))
{
machine_p1 = machines[machine].kbc_p1;
}
@@ -12965,7 +12966,7 @@ machine_get_gpio(void)
}
void
machine_load_gpio(int m)
machine_load_gpio(UNUSED(int m))
{
machine_gpio = machines[machine].gpio;
}

View File

@@ -98,9 +98,9 @@ flash_read(uint32_t addr, void *priv)
}
static uint16_t
flash_readw(uint32_t addr, void *p)
flash_readw(uint32_t addr, void *priv)
{
flash_t *dev = (flash_t *) p;
flash_t *dev = (flash_t *) priv;
uint16_t *q;
addr &= biosmask;
@@ -111,9 +111,9 @@ flash_readw(uint32_t addr, void *p)
}
static uint32_t
flash_readl(uint32_t addr, void *p)
flash_readl(uint32_t addr, void *priv)
{
flash_t *dev = (flash_t *) p;
flash_t *dev = (flash_t *) priv;
uint32_t *q;
addr &= biosmask;
@@ -124,9 +124,9 @@ flash_readl(uint32_t addr, void *p)
}
static void
flash_write(uint32_t addr, uint8_t val, void *p)
flash_write(uint32_t addr, uint8_t val, void *priv)
{
flash_t *dev = (flash_t *) p;
flash_t *dev = (flash_t *) priv;
addr &= biosmask;
@@ -189,7 +189,7 @@ catalyst_flash_reset(void *priv)
static void *
catalyst_flash_init(UNUSED(const device_t *info))
{
FILE *f;
FILE *fp;
flash_t *dev;
dev = malloc(sizeof(flash_t));
@@ -207,24 +207,24 @@ catalyst_flash_init(UNUSED(const device_t *info))
dev->command = CMD_RESET;
f = nvr_fopen(flash_path, "rb");
if (f) {
(void) !fread(dev->array, 0x20000, 1, f);
fclose(f);
fp = nvr_fopen(flash_path, "rb");
if (fp) {
(void) !fread(dev->array, 0x20000, 1, fp);
fclose(fp);
}
return dev;
}
static void
catalyst_flash_close(void *p)
catalyst_flash_close(void *priv)
{
FILE *f;
flash_t *dev = (flash_t *) p;
FILE *fp;
flash_t *dev = (flash_t *) priv;
f = nvr_fopen(flash_path, "wb");
fwrite(dev->array, 0x20000, 1, f);
fclose(f);
fp = nvr_fopen(flash_path, "wb");
fwrite(dev->array, 0x20000, 1, fp);
fclose(fp);
free(dev->array);
dev->array = NULL;

View File

@@ -221,10 +221,9 @@ flash_write(uint32_t addr, uint8_t val, void *priv)
}
static void
flash_writew(uint32_t addr, uint16_t val, void *p)
flash_writew(uint32_t addr, uint16_t val, void *priv)
{
flash_t *dev = (flash_t *) p;
int i;
flash_t *dev = (flash_t *) priv;
uint32_t bb_mask = biosmask & 0xffffe000;
if (biosmask == 0x7ffff)
bb_mask &= 0xffff8000;
@@ -239,7 +238,7 @@ flash_writew(uint32_t addr, uint16_t val, void *p)
switch (dev->command) {
case CMD_ERASE_SETUP:
if (val == CMD_ERASE_CONFIRM) {
for (i = 0; i < 6; i++) {
for (uint8_t i = 0; i < 6; i++) {
if ((i == dev->program_addr) && (addr >= dev->block_start[i]) && (addr <= dev->block_end[i]))
memset(&(dev->array[dev->block_start[i]]), 0xff, dev->block_len[i]);
}
@@ -264,7 +263,7 @@ flash_writew(uint32_t addr, uint16_t val, void *p)
dev->status = 0;
break;
case CMD_ERASE_SETUP:
for (i = 0; i < 7; i++) {
for (uint8_t i = 0; i < 7; i++) {
if ((addr >= dev->block_start[i]) && (addr <= dev->block_end[i]))
dev->program_addr = i;
}
@@ -292,7 +291,7 @@ flash_writel(UNUSED(uint32_t addr), UNUSED(uint32_t val), UNUSED(void *priv))
static void
intel_flash_add_mappings(flash_t *dev)
{
int max = 2;
uint8_t max = 2;
uint32_t base;
uint32_t fbase;
uint32_t sub = 0x20000;
@@ -305,7 +304,7 @@ intel_flash_add_mappings(flash_t *dev)
max = 4;
}
for (int i = 0; i < max; i++) {
for (uint8_t i = 0; i < max; i++) {
if (biosmask == 0x7ffff)
base = 0x80000 + (i << 16);
else if (biosmask == 0x3ffff)
@@ -348,7 +347,7 @@ intel_flash_reset(void *priv)
static void *
intel_flash_init(const device_t *info)
{
FILE *f;
FILE *fp;
flash_t *dev;
uint8_t type = info->local & 0xff;
@@ -513,19 +512,19 @@ intel_flash_init(const device_t *info)
dev->command = CMD_READ_ARRAY;
dev->status = 0;
f = nvr_fopen(flash_path, "rb");
if (f) {
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, f);
fp = nvr_fopen(flash_path, "rb");
if (fp) {
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, fp);
if (dev->block_len[BLOCK_MAIN2])
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, f);
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, fp);
if (dev->block_len[BLOCK_MAIN3])
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, f);
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, fp);
if (dev->block_len[BLOCK_MAIN4])
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, f);
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, fp);
(void) !fread(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, f);
(void) !fread(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, f);
fclose(f);
(void) !fread(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, fp);
(void) !fread(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, fp);
fclose(fp);
}
return dev;
@@ -534,21 +533,21 @@ intel_flash_init(const device_t *info)
static void
intel_flash_close(void *priv)
{
FILE *f;
FILE *fp;
flash_t *dev = (flash_t *) priv;
f = nvr_fopen(flash_path, "wb");
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, f);
fp = nvr_fopen(flash_path, "wb");
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, fp);
if (dev->block_len[BLOCK_MAIN2])
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, f);
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, fp);
if (dev->block_len[BLOCK_MAIN3])
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, f);
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, fp);
if (dev->block_len[BLOCK_MAIN4])
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, f);
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, fp);
fwrite(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, f);
fwrite(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, f);
fclose(f);
fwrite(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, fp);
fwrite(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, fp);
fclose(fp);
free(dev->array);
dev->array = NULL;

View File

@@ -69,7 +69,7 @@ page_t *pages; /* RAM page table */
page_t **page_lookup; /* pagetable lookup */
uint32_t pages_sz; /* #pages in table */
uint8_t *ram;
uint8_t *ram; /* the virtual RAM */
uint8_t *ram2; /* the virtual RAM */
uint8_t page_ff[4096];
uint32_t rammask;
@@ -522,7 +522,7 @@ mmutranslate_noabrt_pae(uint32_t addr, int rw)
addr4 = (temp & ~0xfffULL) + ((addr >> 9) & 0xff8);
temp = rammap64(addr4) & 0x000000ffffffffffULL;
;
temp3 = temp & temp4;
if (!(temp & 1) || ((CPL == 3) && !(temp3 & 4) && !cpl_override) || (rw && !(temp3 & 2) && ((CPL == 3) || (cr0 & WP_FLAG))))
@@ -705,7 +705,7 @@ read_mem_b(uint32_t addr)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_b)
ret = map->read_b(addr, map->p);
ret = map->read_b(addr, map->priv);
resub_cycles(old_cycles);
@@ -728,9 +728,9 @@ read_mem_w(uint32_t addr)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_w)
ret = map->read_w(addr, map->p);
ret = map->read_w(addr, map->priv);
else if (map && map->read_b)
ret = map->read_b(addr, map->p) | (map->read_b(addr + 1, map->p) << 8);
ret = map->read_b(addr, map->priv) | (map->read_b(addr + 1, map->priv) << 8);
}
resub_cycles(old_cycles);
@@ -749,7 +749,7 @@ write_mem_b(uint32_t addr, uint8_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->write_b)
map->write_b(addr, val, map->p);
map->write_b(addr, val, map->priv);
resub_cycles(old_cycles);
}
@@ -770,10 +770,10 @@ write_mem_w(uint32_t addr, uint16_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map) {
if (map->write_w)
map->write_w(addr, val, map->p);
map->write_w(addr, val, map->priv);
else if (map->write_b) {
map->write_b(addr, val, map->p);
map->write_b(addr + 1, val >> 8, map->p);
map->write_b(addr, val, map->priv);
map->write_b(addr + 1, val >> 8, map->priv);
}
}
}
@@ -805,7 +805,7 @@ readmembl(uint32_t addr)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_b)
return map->read_b(addr, map->p);
return map->read_b(addr, map->priv);
return 0xff;
}
@@ -839,7 +839,7 @@ writemembl(uint32_t addr, uint8_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->write_b)
map->write_b(addr, val, map->p);
map->write_b(addr, val, map->priv);
}
/* Read a byte from memory without MMU translation - result of previous MMU translation passed as value. */
@@ -862,7 +862,7 @@ readmembl_no_mmut(uint32_t addr, uint32_t a64)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_b)
return map->read_b(addr, map->p);
return map->read_b(addr, map->priv);
return 0xff;
}
@@ -892,7 +892,7 @@ writemembl_no_mmut(uint32_t addr, uint32_t a64, uint8_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->write_b)
map->write_b(addr, val, map->p);
map->write_b(addr, val, map->priv);
}
uint16_t
@@ -944,10 +944,10 @@ readmemwl(uint32_t addr)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_w)
return map->read_w(addr, map->p);
return map->read_w(addr, map->priv);
if (map && map->read_b) {
return map->read_b(addr, map->p) | ((uint16_t) (map->read_b(addr + 1, map->p)) << 8);
return map->read_b(addr, map->priv) | ((uint16_t) (map->read_b(addr + 1, map->priv)) << 8);
}
return 0xffff;
@@ -1016,13 +1016,13 @@ writememwl(uint32_t addr, uint16_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->write_w) {
map->write_w(addr, val, map->p);
map->write_w(addr, val, map->priv);
return;
}
if (map && map->write_b) {
map->write_b(addr, val, map->p);
map->write_b(addr + 1, val >> 8, map->p);
map->write_b(addr, val, map->priv);
map->write_b(addr + 1, val >> 8, map->priv);
return;
}
}
@@ -1064,10 +1064,10 @@ readmemwl_no_mmut(uint32_t addr, uint32_t *a64)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_w)
return map->read_w(addr, map->p);
return map->read_w(addr, map->priv);
if (map && map->read_b) {
return map->read_b(addr, map->p) | ((uint16_t) (map->read_b(addr + 1, map->p)) << 8);
return map->read_b(addr, map->priv) | ((uint16_t) (map->read_b(addr + 1, map->priv)) << 8);
}
return 0xffff;
@@ -1119,13 +1119,13 @@ writememwl_no_mmut(uint32_t addr, uint32_t *a64, uint16_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->write_w) {
map->write_w(addr, val, map->p);
map->write_w(addr, val, map->priv);
return;
}
if (map && map->write_b) {
map->write_b(addr, val, map->p);
map->write_b(addr + 1, val >> 8, map->p);
map->write_b(addr, val, map->priv);
map->write_b(addr + 1, val >> 8, map->priv);
return;
}
}
@@ -1193,13 +1193,13 @@ readmemll(uint32_t addr)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_l)
return map->read_l(addr, map->p);
return map->read_l(addr, map->priv);
if (map && map->read_w)
return map->read_w(addr, map->p) | ((uint32_t) (map->read_w(addr + 2, map->p)) << 16);
return map->read_w(addr, map->priv) | ((uint32_t) (map->read_w(addr + 2, map->priv)) << 16);
if (map && map->read_b)
return map->read_b(addr, map->p) | ((uint32_t) (map->read_b(addr + 1, map->p)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->p)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->p)) << 24);
return map->read_b(addr, map->priv) | ((uint32_t) (map->read_b(addr + 1, map->priv)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->priv)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->priv)) << 24);
return 0xffffffff;
}
@@ -1280,19 +1280,19 @@ writememll(uint32_t addr, uint32_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->write_l) {
map->write_l(addr, val, map->p);
map->write_l(addr, val, map->priv);
return;
}
if (map && map->write_w) {
map->write_w(addr, val, map->p);
map->write_w(addr + 2, val >> 16, map->p);
map->write_w(addr, val, map->priv);
map->write_w(addr + 2, val >> 16, map->priv);
return;
}
if (map && map->write_b) {
map->write_b(addr, val, map->p);
map->write_b(addr + 1, val >> 8, map->p);
map->write_b(addr + 2, val >> 16, map->p);
map->write_b(addr + 3, val >> 24, map->p);
map->write_b(addr, val, map->priv);
map->write_b(addr + 1, val >> 8, map->priv);
map->write_b(addr + 2, val >> 16, map->priv);
map->write_b(addr + 3, val >> 24, map->priv);
return;
}
}
@@ -1334,13 +1334,13 @@ readmemll_no_mmut(uint32_t addr, uint32_t *a64)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_l)
return map->read_l(addr, map->p);
return map->read_l(addr, map->priv);
if (map && map->read_w)
return map->read_w(addr, map->p) | ((uint32_t) (map->read_w(addr + 2, map->p)) << 16);
return map->read_w(addr, map->priv) | ((uint32_t) (map->read_w(addr + 2, map->priv)) << 16);
if (map && map->read_b)
return map->read_b(addr, map->p) | ((uint32_t) (map->read_b(addr + 1, map->p)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->p)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->p)) << 24);
return map->read_b(addr, map->priv) | ((uint32_t) (map->read_b(addr + 1, map->priv)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->priv)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->priv)) << 24);
return 0xffffffff;
}
@@ -1391,19 +1391,19 @@ writememll_no_mmut(uint32_t addr, uint32_t *a64, uint32_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->write_l) {
map->write_l(addr, val, map->p);
map->write_l(addr, val, map->priv);
return;
}
if (map && map->write_w) {
map->write_w(addr, val, map->p);
map->write_w(addr + 2, val >> 16, map->p);
map->write_w(addr, val, map->priv);
map->write_w(addr + 2, val >> 16, map->priv);
return;
}
if (map && map->write_b) {
map->write_b(addr, val, map->p);
map->write_b(addr + 1, val >> 8, map->p);
map->write_b(addr + 2, val >> 16, map->p);
map->write_b(addr + 3, val >> 24, map->p);
map->write_b(addr, val, map->priv);
map->write_b(addr + 1, val >> 8, map->priv);
map->write_b(addr + 2, val >> 16, map->priv);
map->write_b(addr + 3, val >> 24, map->priv);
return;
}
}
@@ -1469,7 +1469,7 @@ readmemql(uint32_t addr)
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->read_l)
return map->read_l(addr, map->p) | ((uint64_t) map->read_l(addr + 4, map->p) << 32);
return map->read_l(addr, map->priv) | ((uint64_t) map->read_l(addr + 4, map->priv) << 32);
return readmemll(addr) | ((uint64_t) readmemll(addr + 4) << 32);
}
@@ -1548,26 +1548,26 @@ writememql(uint32_t addr, uint64_t val)
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
if (map && map->write_l) {
map->write_l(addr, val, map->p);
map->write_l(addr + 4, val >> 32, map->p);
map->write_l(addr, val, map->priv);
map->write_l(addr + 4, val >> 32, map->priv);
return;
}
if (map && map->write_w) {
map->write_w(addr, val, map->p);
map->write_w(addr + 2, val >> 16, map->p);
map->write_w(addr + 4, val >> 32, map->p);
map->write_w(addr + 6, val >> 48, map->p);
map->write_w(addr, val, map->priv);
map->write_w(addr + 2, val >> 16, map->priv);
map->write_w(addr + 4, val >> 32, map->priv);
map->write_w(addr + 6, val >> 48, map->priv);
return;
}
if (map && map->write_b) {
map->write_b(addr, val, map->p);
map->write_b(addr + 1, val >> 8, map->p);
map->write_b(addr + 2, val >> 16, map->p);
map->write_b(addr + 3, val >> 24, map->p);
map->write_b(addr + 4, val >> 32, map->p);
map->write_b(addr + 5, val >> 40, map->p);
map->write_b(addr + 6, val >> 48, map->p);
map->write_b(addr + 7, val >> 56, map->p);
map->write_b(addr, val, map->priv);
map->write_b(addr + 1, val >> 8, map->priv);
map->write_b(addr + 2, val >> 16, map->priv);
map->write_b(addr + 3, val >> 24, map->priv);
map->write_b(addr + 4, val >> 32, map->priv);
map->write_b(addr + 5, val >> 40, map->priv);
map->write_b(addr + 6, val >> 48, map->priv);
map->write_b(addr + 7, val >> 56, map->priv);
return;
}
}
@@ -1634,7 +1634,7 @@ mem_readb_phys(uint32_t addr)
if (map->exec)
ret = map->exec[(addr - map->base) & map->mask];
else if (map->read_b)
ret = map->read_b(addr, map->p);
ret = map->read_b(addr, map->priv);
}
return ret;
@@ -1653,7 +1653,7 @@ mem_readw_phys(uint32_t addr)
p = (uint16_t *) &(map->exec[(addr - map->base) & map->mask]);
ret = *p;
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->read_w))
ret = map->read_w(addr, map->p);
ret = map->read_w(addr, map->priv);
else {
ret = mem_readb_phys(addr + 1) << 8;
ret |= mem_readb_phys(addr);
@@ -1675,7 +1675,7 @@ mem_readl_phys(uint32_t addr)
p = (uint32_t *) &(map->exec[(addr - map->base) & map->mask]);
ret = *p;
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->read_l))
ret = map->read_l(addr, map->p);
ret = map->read_l(addr, map->priv);
else {
ret = mem_readw_phys(addr + 2) << 16;
ret |= mem_readw_phys(addr);
@@ -1714,7 +1714,7 @@ mem_writeb_phys(uint32_t addr, uint8_t val)
if (map->exec)
map->exec[(addr - map->base) & map->mask] = val;
else if (map->write_b)
map->write_b(addr, val, map->p);
map->write_b(addr, val, map->priv);
}
}
@@ -1730,7 +1730,7 @@ mem_writew_phys(uint32_t addr, uint16_t val)
p = (uint16_t *) &(map->exec[(addr - map->base) & map->mask]);
*p = val;
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->write_w))
map->write_w(addr, val, map->p);
map->write_w(addr, val, map->priv);
else {
mem_writeb_phys(addr, val & 0xff);
mem_writeb_phys(addr + 1, (val >> 8) & 0xff);
@@ -1749,7 +1749,7 @@ mem_writel_phys(uint32_t addr, uint32_t val)
p = (uint32_t *) &(map->exec[(addr - map->base) & map->mask]);
*p = val;
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->write_l))
map->write_l(addr, val, map->p);
map->write_l(addr, val, map->priv);
else {
mem_writew_phys(addr, val & 0xffff);
mem_writew_phys(addr + 2, (val >> 16) & 0xffff);
@@ -2051,7 +2051,7 @@ mem_write_ram(uint32_t addr, uint8_t val, UNUSED(void *priv))
}
void
mem_write_ramw(uint32_t addr, uint16_t val, void *priv)
mem_write_ramw(uint32_t addr, uint16_t val, UNUSED(void *priv))
{
#ifdef ENABLE_MEM_LOG
if ((addr >= 0xa0000) && (addr <= 0xbffff))
@@ -2145,7 +2145,7 @@ mem_write_remapped(uint32_t addr, uint8_t val, UNUSED(void *priv))
}
static void
mem_write_remappedw(uint32_t addr, uint16_t val, void *priv)
mem_write_remappedw(uint32_t addr, uint16_t val, UNUSED(void *priv))
{
uint32_t oldaddr = addr;
addr = 0xA0000 + (addr - remap_start_addr);
@@ -2181,7 +2181,7 @@ mem_write_remapped2(uint32_t addr, uint8_t val, UNUSED(void *priv))
}
static void
mem_write_remappedw2(uint32_t addr, uint16_t val, void *priv)
mem_write_remappedw2(uint32_t addr, uint16_t val, UNUSED(void *priv))
{
uint32_t oldaddr = addr;
addr = 0xD0000 + (addr - remap_start_addr2);
@@ -2384,15 +2384,15 @@ void
mem_mapping_set(mem_mapping_t *map,
uint32_t base,
uint32_t size,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p),
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv),
uint8_t *exec,
uint32_t fl,
void *p)
void *priv)
{
if (size != 0x00000000)
map->enable = 1;
@@ -2409,7 +2409,7 @@ mem_mapping_set(mem_mapping_t *map,
map->write_l = write_l;
map->exec = exec;
map->flags = fl;
map->p = p;
map->priv = priv;
map->next = NULL;
mem_log("mem_mapping_add(): Linked list structure: %08X -> %08X -> %08X\n", map->prev, map, map->next);
@@ -2422,15 +2422,15 @@ void
mem_mapping_add(mem_mapping_t *map,
uint32_t base,
uint32_t size,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p),
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv),
uint8_t *exec,
uint32_t fl,
void *p)
void *priv)
{
/* Do a sanity check */
if ((base_mapping == NULL) && (last_mapping != NULL)) {
@@ -2461,7 +2461,7 @@ mem_mapping_add(mem_mapping_t *map,
last_mapping = map;
mem_mapping_set(map, base, size, read_b, read_w, read_l,
write_b, write_w, write_l, exec, fl, p);
write_b, write_w, write_l, exec, fl, priv);
}
void
@@ -2472,12 +2472,12 @@ mem_mapping_do_recalc(mem_mapping_t *map)
void
mem_mapping_set_handler(mem_mapping_t *map,
uint8_t (*read_b)(uint32_t addr, void *p),
uint16_t (*read_w)(uint32_t addr, void *p),
uint32_t (*read_l)(uint32_t addr, void *p),
void (*write_b)(uint32_t addr, uint8_t val, void *p),
void (*write_w)(uint32_t addr, uint16_t val, void *p),
void (*write_l)(uint32_t addr, uint32_t val, void *p))
uint8_t (*read_b)(uint32_t addr, void *priv),
uint16_t (*read_w)(uint32_t addr, void *priv),
uint32_t (*read_l)(uint32_t addr, void *priv),
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
void (*write_l)(uint32_t addr, uint32_t val, void *priv))
{
map->read_b = read_b;
map->read_w = read_w;
@@ -2521,9 +2521,9 @@ mem_mapping_set_mask(mem_mapping_t *map, uint32_t mask)
}
void
mem_mapping_set_p(mem_mapping_t *map, void *p)
mem_mapping_set_p(mem_mapping_t *map, void *priv)
{
map->p = p;
map->priv = priv;
}
void

View File

@@ -140,11 +140,11 @@ rom_getfile(char *fn, char *s, int size)
int
rom_present(char *fn)
{
FILE *f;
FILE *fp;
f = rom_fopen(fn, "rb");
if (f != NULL) {
(void) fclose(f);
fp = rom_fopen(fn, "rb");
if (fp != NULL) {
(void) fclose(fp);
return 1;
}
@@ -205,10 +205,9 @@ rom_readl(uint32_t addr, void *priv)
int
rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
{
FILE *f = rom_fopen(fn, "rb");
int i;
FILE *fp = rom_fopen(fn, "rb");
if (f == NULL) {
if (fp == NULL) {
rom_log("ROM: image '%s' not found\n", fn);
return 0;
}
@@ -220,19 +219,19 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t
addr &= 0x03ffff;
if (ptr != NULL) {
if (fseek(f, off, SEEK_SET) == -1)
if (fseek(fp, off, SEEK_SET) == -1)
fatal("rom_load_linear(): Error seeking to the beginning of the file\n");
for (i = 0; i < (sz >> 1); i++) {
if (fread(ptr + (addr + (i << 1)), 1, 1, f) != 1)
for (int i = 0; i < (sz >> 1); i++) {
if (fread(ptr + (addr + (i << 1)), 1, 1, fp) != 1)
fatal("rom_load_linear(): Error reading even data\n");
}
for (i = 0; i < (sz >> 1); i++) {
if (fread(ptr + (addr + (i << 1) + 1), 1, 1, f) != 1)
for (int i = 0; i < (sz >> 1); i++) {
if (fread(ptr + (addr + (i << 1) + 1), 1, 1, fp) != 1)
fatal("rom_load_linear(): Error reading od data\n");
}
}
(void) fclose(f);
(void) fclose(fp);
return 1;
}
@@ -241,9 +240,9 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t
int
rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
{
FILE *f = rom_fopen(fn, "rb");
FILE *fp = rom_fopen(fn, "rb");
if (f == NULL) {
if (fp == NULL) {
rom_log("ROM: image '%s' not found\n", fn);
return 0;
}
@@ -255,13 +254,13 @@ rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
addr &= 0x03ffff;
if (ptr != NULL) {
if (fseek(f, off, SEEK_SET) == -1)
if (fseek(fp, off, SEEK_SET) == -1)
fatal("rom_load_linear(): Error seeking to the beginning of the file\n");
if (fread(ptr + addr, 1, sz, f) > sz)
if (fread(ptr + addr, 1, sz, fp) > sz)
fatal("rom_load_linear(): Error reading data\n");
}
(void) fclose(f);
(void) fclose(fp);
return 1;
}
@@ -270,9 +269,9 @@ rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
int
rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
{
FILE *f = rom_fopen(fn, "rb");
FILE *fp = rom_fopen(fn, "rb");
if (f == NULL) {
if (fp == NULL) {
rom_log("ROM: image '%s' not found\n", fn);
return 0;
}
@@ -284,22 +283,22 @@ rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t
addr &= 0x03ffff;
}
(void) fseek(f, 0, SEEK_END);
if (ftell(f) < sz) {
(void) fclose(f);
(void) fseek(fp, 0, SEEK_END);
if (ftell(fp) < sz) {
(void) fclose(fp);
return 0;
}
if (ptr != NULL) {
if (fseek(f, off, SEEK_SET) == -1)
if (fseek(fp, off, SEEK_SET) == -1)
fatal("rom_load_linear_inverted(): Error seeking to the beginning of the file\n");
if (fread(ptr + addr + 0x10000, 1, sz >> 1, f) > (sz >> 1))
if (fread(ptr + addr + 0x10000, 1, sz >> 1, fp) > (sz >> 1))
fatal("rom_load_linear_inverted(): Error reading the upper half of the data\n");
if (fread(ptr + addr, sz >> 1, 1, f) > (sz >> 1))
if (fread(ptr + addr, sz >> 1, 1, fp) > (sz >> 1))
fatal("rom_load_linear_inverted(): Error reading the lower half of the data\n");
}
(void) fclose(f);
(void) fclose(fp);
return 1;
}
@@ -308,18 +307,18 @@ rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t
int
rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr, int sz, int off, uint8_t *ptr)
{
FILE *fl = rom_fopen(fnl, "rb");
FILE *fh = rom_fopen(fnh, "rb");
FILE *fpl = rom_fopen(fnl, "rb");
FILE *fph = rom_fopen(fnh, "rb");
if (fl == NULL || fh == NULL) {
if (fl == NULL)
if (fpl == NULL || fph == NULL) {
if (fpl == NULL)
rom_log("ROM: image '%s' not found\n", fnl);
else
(void) fclose(fl);
if (fh == NULL)
(void) fclose(fpl);
if (fph == NULL)
rom_log("ROM: image '%s' not found\n", fnh);
else
(void) fclose(fh);
(void) fclose(fph);
return 0;
}
@@ -332,16 +331,16 @@ rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr, int sz, in
}
if (ptr != NULL) {
(void) fseek(fl, off, SEEK_SET);
(void) fseek(fh, off, SEEK_SET);
(void) fseek(fpl, off, SEEK_SET);
(void) fseek(fph, off, SEEK_SET);
for (int c = 0; c < sz; c += 2) {
ptr[addr + c] = fgetc(fl) & 0xff;
ptr[addr + c + 1] = fgetc(fh) & 0xff;
ptr[addr + c] = fgetc(fpl) & 0xff;
ptr[addr + c + 1] = fgetc(fph) & 0xff;
}
}
(void) fclose(fh);
(void) fclose(fl);
(void) fclose(fph);
(void) fclose(fpl);
return 1;
}

View File

@@ -30,11 +30,12 @@
#include <86box/mem.h>
#include <86box/spd.h>
#include <86box/row.h>
#include <86box/plat_unused.h>
/* 0 1 2 3 4 5 6 7 */
static uint8_t rows_num, rows_default,
rows_bits;
static uint8_t rows_num;
static uint8_t rows_default;
static uint8_t rows_bits;
static uint32_t row_unit;
static uint8_t drb_defaults[16];
static row_t *rows;
@@ -112,7 +113,7 @@ row_writel(uint32_t addr, uint32_t val, void *priv)
void
row_allocate(uint8_t row_id, uint8_t set)
{
uint32_t c, offset;
uint32_t offset;
/* Do nothing if size is either zero or invalid. */
if ((rows[row_id].host_size == 0x00000000) || (rows[row_id].host_size == 0xffffffff))
@@ -121,7 +122,7 @@ row_allocate(uint8_t row_id, uint8_t set)
if (rows[row_id].ram_size == 0x00000000)
return;
for (c = (rows[row_id].host_base >> 12); c < ((rows[row_id].host_base + rows[row_id].host_size) >> 12); c++) {
for (uint32_t c = (rows[row_id].host_base >> 12); c < ((rows[row_id].host_base + rows[row_id].host_size) >> 12); c++) {
offset = c - (rows[row_id].host_base >> 12);
pages[c].mem = set ? (rows[row_id].buf + rows[row_id].ram_base + ((offset << 12) & rows[row_id].ram_mask)) : page_ff;
@@ -129,22 +130,22 @@ row_allocate(uint8_t row_id, uint8_t set)
pages[c].write_w = set ? mem_write_ramw_page : NULL;
pages[c].write_l = set ? mem_write_raml_page : NULL;
#ifdef USE_NEW_DYNAREC
pages[c].evict_prev = EVICT_NOT_IN_LIST;
pages[c].byte_dirty_mask = &byte_dirty_mask[offset * 64];
pages[c].byte_code_present_mask = &byte_code_present_mask[offset * 64];
pages[c].evict_prev = EVICT_NOT_IN_LIST;
pages[c].byte_dirty_mask = &byte_dirty_mask[offset * 64];
pages[c].byte_code_present_mask = &byte_code_present_mask[offset * 64];
#endif
}
if (rows[row_id].host_base >= 0x00100000) {
mem_set_mem_state_both(rows[row_id].host_base, rows[row_id].host_base + rows[row_id].host_size,
mem_set_mem_state_both(rows[row_id].host_base, rows[row_id].host_base + rows[row_id].host_size,
set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL));
} else {
if (0x000a0000 > rows[row_id].host_base) {
mem_set_mem_state_both(rows[row_id].host_base, 0x000a0000 - rows[row_id].host_base,
mem_set_mem_state_both(rows[row_id].host_base, 0x000a0000 - rows[row_id].host_base,
set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL));
}
if ((rows[row_id].host_base + rows[row_id].host_size) > 0x00100000) {
mem_set_mem_state_both(0x00100000, (rows[row_id].host_base + rows[row_id].host_size) - 0x00100000,
mem_set_mem_state_both(0x00100000, (rows[row_id].host_base + rows[row_id].host_size) - 0x00100000,
set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL));
}
}
@@ -208,15 +209,15 @@ row_set_boundary(uint8_t row_id, uint32_t boundary)
void
row_reset(void *priv)
row_reset(UNUSED(void *priv))
{
int i;
uint32_t boundary, shift;
uint32_t boundary;
uint32_t shift;
for (i = (rows_num - 1); i >= 0; i--)
for (uint8_t i = (rows_num - 1); i >= 0; i--)
row_disable(i);
for (i = 0; i < rows_num; i++) {
for (uint8_t i = 0; i < rows_num; i++) {
shift = (i & 1) << 2;
boundary = ((uint32_t) drb_defaults[i]) + (((((uint32_t) drb_defaults[(i >> 1) + 8]) >> shift) & 0xf) << 8);
row_set_boundary(i, boundary);
@@ -225,7 +226,7 @@ row_reset(void *priv)
void
row_close(void *priv)
row_close(UNUSED(void *priv))
{
free(rows);
rows = NULL;
@@ -235,14 +236,18 @@ row_close(void *priv)
void *
row_init(const device_t *info)
{
uint32_t cur_drb = 0, cur_drbe = 0;
uint32_t last_drb = 0, last_drbe = 0;
uint8_t phys_drbs[16];
int i, max = info->local & 0xff;
int c;
uint32_t shift, drb;
uint32_t boundary, mask;
row_t *new_rows = NULL;
uint32_t cur_drb = 0;
uint32_t cur_drbe = 0;
uint32_t last_drb = 0;
uint32_t last_drbe = 0;
uint8_t phys_drbs[16];
int i;
int max = info->local & 0xff;
uint32_t shift;
uint32_t drb;
uint32_t boundary;
uint32_t mask;
row_t *new_rows = NULL;
rows_bits = ((info->local >> 24) & 0xff);
mask = (1 << rows_bits) - 1;
@@ -268,7 +273,7 @@ row_init(const device_t *info)
mem_mapping_disable(&ram_2gb_mapping);
#endif
for (c = 0; c < pages_sz; c++) {
for (uint32_t c = 0; c < pages_sz; c++) {
pages[c].mem = page_ff;
pages[c].write_b = NULL;
pages[c].write_w = NULL;

View File

@@ -31,8 +31,8 @@
#define SPD_ROLLUP(x) ((x) >= 16 ? ((x) -15) : (x))
int spd_present = 0;
spd_t *spd_modules[SPD_MAX_SLOTS];
uint8_t spd_present = 0;
spd_t *spd_modules[SPD_MAX_SLOTS];
static const device_t spd_device;
@@ -548,8 +548,8 @@ spd_write_drbs_ali1621(uint8_t *regs, uint8_t reg_min, uint8_t reg_max)
regs[drb + 3] |= 0x06;
switch (size) {
case 4:
default:
case 4:
regs[drb + 2] = 0x00;
break;
case 8:

View File

@@ -58,6 +58,7 @@
#include <86box/network.h>
#include <86box/net_3c501.h>
#include <86box/bswap.h>
#include <86box/plat_unused.h>
/* Maximum number of times we report a link down to the guest (failure to send frame) */
#define ELNK_MAX_LINKDOWN_REPORTED 3
@@ -192,7 +193,7 @@ typedef struct ELNK_INTR_STAT {
uint8_t unused : 5;
} EL_INTR_STAT;
typedef struct {
typedef struct threec501_t {
uint32_t base_address;
int base_irq;
uint32_t bios_addr;
@@ -390,6 +391,7 @@ padr_bcast(threec501_t *dev, const uint8_t *buf)
static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
struct ether_header *hdr = (struct ether_header *) buf;
int result = (dev->RcvCmd.adr_match == EL_ADRM_BCAST) && !memcmp(hdr->ether_dhost, aBCAST, 6);
return result;
}
@@ -401,6 +403,7 @@ padr_mcast(threec501_t *dev, const uint8_t *buf)
{
struct ether_header *hdr = (struct ether_header *) buf;
int result = (dev->RcvCmd.adr_match == EL_ADRM_MCAST) && ETHER_IS_MULTICAST(hdr->ether_dhost);
return result;
}
@@ -692,7 +695,6 @@ elnkAsyncTransmit(threec501_t *dev)
#ifdef ENABLE_3COM501_LOG
threec501_log("3Com501: illegal giant frame (%u bytes) -> signalling error\n", cb);
#endif
;
}
} else {
/* Signal a transmit error pretending there was a collision. */
@@ -921,6 +923,9 @@ threec501_read(uint16_t addr, void *priv)
retval = dev->abPacketBuf[ELNK_GP(dev)];
dev->uGPBufPtr = (dev->uGPBufPtr + 1) & ELNK_GP_MASK;
break;
default:
break;
}
elnkUpdateIrq(dev);
@@ -1007,6 +1012,9 @@ threec501_write(uint16_t addr, uint8_t value, void *priv)
dev->abPacketBuf[ELNK_GP(dev)] = value;
dev->uGPBufPtr = (dev->uGPBufPtr + 1) & ELNK_GP_MASK;
break;
default:
break;
}
#ifdef ENABLE_3COM501_LOG
@@ -1068,7 +1076,7 @@ elnkR3TimerRestore(void *priv)
}
static void *
threec501_nic_init(const device_t *info)
threec501_nic_init(UNUSED(const device_t *info))
{
uint32_t mac;
threec501_t *dev;

View File

@@ -62,8 +62,9 @@
#include <86box/net_dp8390.h>
#include <86box/net_3c503.h>
#include <86box/bswap.h>
#include <86box/plat_unused.h>
typedef struct {
typedef struct threec503_t {
dp8390_t *dp8390;
mem_mapping_t ram_mapping;
uint32_t base_address;
@@ -129,6 +130,9 @@ threec503_interrupt(void *priv, int set)
case 5:
dev->regs.idcfr = 0x80;
break;
default:
break;
}
if (set)
@@ -174,6 +178,9 @@ threec503_set_drq(threec503_t *dev)
case 3:
dev->regs.idcfr = 4;
break;
default:
break;
}
}
@@ -223,6 +230,9 @@ threec503_nic_lo_read(uint16_t addr, void *priv)
case 0x03:
retval = 0xff;
break;
default:
break;
}
break;
@@ -237,6 +247,9 @@ threec503_nic_lo_read(uint16_t addr, void *priv)
case 0x03:
retval = 0xff;
break;
default:
break;
}
return retval;
@@ -272,6 +285,9 @@ threec503_nic_lo_write(uint16_t addr, uint8_t val, void *priv)
case 0x03:
break;
default:
break;
}
break;
@@ -279,6 +295,9 @@ threec503_nic_lo_write(uint16_t addr, uint8_t val, void *priv)
case 0x02:
case 0x03:
break;
default:
break;
}
threec503_log("3Com503: write addr %x, value %x\n", addr, val);
@@ -338,7 +357,6 @@ threec503_nic_hi_read(uint16_t addr, void *priv)
}
return dev->regs.bcfr;
break;
case 0x04:
switch (dev->bios_addr) {
@@ -357,10 +375,12 @@ threec503_nic_hi_read(uint16_t addr, void *priv)
case 0xc8000:
dev->regs.pcfr = 0x10;
break;
default:
break;
}
return dev->regs.pcfr;
break;
case 0x05:
return dev->regs.gacfr;
@@ -397,6 +417,9 @@ threec503_nic_hi_read(uint16_t addr, void *priv)
threec503_set_drq(dev);
return dp8390_chipmem_read(dev->dp8390, dev->regs.da++, 1);
default:
break;
}
return 0;
@@ -527,6 +550,9 @@ threec503_nic_hi_write(uint16_t addr, uint8_t val, void *priv)
dp8390_chipmem_write(dev->dp8390, dev->regs.da++, val, 1);
break;
default:
break;
}
}
@@ -543,7 +569,7 @@ threec503_nic_ioset(threec503_t *dev, uint16_t addr)
}
static void *
threec503_nic_init(const device_t *info)
threec503_nic_init(UNUSED(const device_t *info))
{
uint32_t mac;
threec503_t *dev;
@@ -605,7 +631,9 @@ threec503_nic_init(const device_t *info)
threec503_ram_read, NULL, NULL,
threec503_ram_write, NULL, NULL,
NULL, MEM_MAPPING_EXTERNAL, dev);
// mem_mapping_disable(&dev->ram_mapping);
#if 0
mem_mapping_disable(&dev->ram_mapping);
#endif
dev->regs.gacfr = 0x09; /* Start with RAM mapping enabled. */
/* Attach ourselves to the network module. */

View File

@@ -29,6 +29,7 @@
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/net_dp8390.h>
#include <86box/plat_unused.h>
static void dp8390_tx(dp8390_t *dev, uint32_t val);
static int dp8390_rx_common(void *priv, uint8_t *buf, int io_len);
@@ -242,7 +243,7 @@ dp8390_write_cr(dp8390_t *dev, uint32_t val)
}
static void
dp8390_tx(dp8390_t *dev, uint32_t val)
dp8390_tx(dp8390_t *dev, UNUSED(uint32_t val))
{
dev->CR.tx_packet = 0;
dev->TSR.tx_ok = 1;
@@ -506,7 +507,7 @@ dp8390_page0_read(dp8390_t *dev, uint32_t off, unsigned int len)
}
void
dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
uint8_t val2;
@@ -697,7 +698,7 @@ dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
/* Handle reads/writes to the first page of the DS8390 register file. */
uint32_t
dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len)
dp8390_page1_read(dp8390_t *dev, uint32_t off, UNUSED(unsigned int len))
{
dp8390_log("DP8390: Page1 read from register 0x%02x, len=%u\n",
off, len);
@@ -734,7 +735,7 @@ dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len)
}
void
dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
dp8390_log("DP8390: Page1 write to register 0x%02x, len=%u, value=0x%04x\n",
off, len, val);
@@ -778,7 +779,7 @@ dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
/* Handle reads/writes to the second page of the DS8390 register file. */
uint32_t
dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len)
dp8390_page2_read(dp8390_t *dev, uint32_t off, UNUSED(unsigned int len))
{
dp8390_log("DP8390: Page2 read from register 0x%02x, len=%u\n",
off, len);
@@ -835,7 +836,7 @@ dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len)
}
void
dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
/* Maybe all writes here should be BX_PANIC()'d, since they
affect internal operation, but let them through for now
@@ -999,7 +1000,7 @@ dp8390_soft_reset(dp8390_t *dev)
}
static void *
dp8390_init(const device_t *info)
dp8390_init(UNUSED(const device_t *info))
{
dp8390_t *dp8390 = (dp8390_t *) malloc(sizeof(dp8390_t));
memset(dp8390, 0, sizeof(dp8390_t));

View File

@@ -7,6 +7,7 @@
#endif
#include <86box/net_event.h>
#include <86box/plat_unused.h>
#ifndef _WIN32
static void
@@ -40,7 +41,7 @@ net_event_set(net_evt_t *event)
}
void
net_event_clear(net_evt_t *event)
net_event_clear(UNUSED(net_evt_t *event))
{
#ifdef _WIN32
/* Do nothing on WIN32 since we use an auto-reset event */

View File

@@ -68,6 +68,7 @@
#include <86box/net_ne2000.h>
#include <86box/bswap.h>
#include <86box/isapnp.h>
#include <86box/plat_unused.h>
/* ROM BIOS file paths. */
#define ROM_PATH_NE1000 "roms/network/ne1000/ne1000.rom"
@@ -93,28 +94,33 @@ static uint8_t rtl8019as_pnp_rom[] = {
0x79, 0x00 /* end tag, dummy checksum (filled in by isapnp_add_card) */
};
typedef struct {
typedef struct nic_t {
dp8390_t *dp8390;
const char *name;
int board;
int is_pci, is_mca, is_8bit;
int is_pci;
int is_mca;
int is_8bit;
uint32_t base_address;
int base_irq;
uint32_t bios_addr,
bios_size,
bios_mask;
int card; /* PCI card slot */
int has_bios, pad;
bar_t pci_bar[2];
uint8_t pci_regs[PCI_REGSIZE];
uint8_t eeprom[128]; /* for RTL8029AS */
rom_t bios_rom;
void *pnp_card;
uint8_t pnp_csnsav;
uint8_t maclocal[6]; /* configured MAC (local) address */
uint32_t bios_addr;
uint32_t bios_size;
uint32_t bios_mask;
int card; /* PCI card slot */
int has_bios;
int pad;
bar_t pci_bar[2];
uint8_t pci_regs[PCI_REGSIZE];
uint8_t eeprom[128]; /* for RTL8029AS */
rom_t bios_rom;
void *pnp_card;
uint8_t pnp_csnsav;
uint8_t maclocal[6]; /* configured MAC (local) address */
/* RTL8019AS/RTL8029AS registers */
uint8_t config0, config2, config3;
uint8_t config0;
uint8_t config2;
uint8_t config3;
uint8_t _9346cr;
uint32_t pad0;
@@ -308,7 +314,7 @@ asic_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len)
/* Writes to this page are illegal. */
static uint32_t
page3_read(nic_t *dev, uint32_t off, unsigned int len)
page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len))
{
if (dev->board >= NE2K_RTL8019AS)
switch (off) {
@@ -346,7 +352,7 @@ page3_read(nic_t *dev, uint32_t off, unsigned int len)
}
static void
page3_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len)
page3_write(nic_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
if (dev->board >= NE2K_RTL8019AS) {
nelog(3, "%s: Page2 write to register 0x%02x, len=%u, value=0x%04x\n",
@@ -535,6 +541,9 @@ nic_pnp_read_vendor_reg(uint8_t ld, uint8_t reg, void *priv)
case 0xF5:
return dev->pnp_csnsav;
default:
break;
}
return 0x00;
@@ -623,7 +632,7 @@ nic_update_bios(nic_t *dev)
}
static uint8_t
nic_pci_read(int func, int addr, void *priv)
nic_pci_read(UNUSED(int func), int addr, void *priv)
{
nic_t *dev = (nic_t *) priv;
uint8_t ret = 0x00;
@@ -707,6 +716,9 @@ nic_pci_read(int func, int addr, void *priv)
case 0x3D: /* PCI_IPR */
ret = dev->pci_regs[addr];
break;
default:
break;
}
nelog(2, "%s: PCI_Read(%d, %04x) = %02x\n", dev->name, func, addr, ret);
@@ -715,7 +727,7 @@ nic_pci_read(int func, int addr, void *priv)
}
static void
nic_pci_write(int func, int addr, uint8_t val, void *priv)
nic_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
{
nic_t *dev = (nic_t *) priv;
uint8_t valxor;
@@ -737,7 +749,7 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv)
case 0x10: /* PCI_BAR */
val &= 0xe0; /* 0xe0 acc to RTL DS */
val |= 0x01; /* re-enable IOIN bit */
/*FALLTHROUGH*/
[[fallthrough]];
case 0x11: /* PCI_BAR */
case 0x12: /* PCI_BAR */
@@ -767,7 +779,9 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv)
case 0x32: /* PCI_ROMBAR */
case 0x33: /* PCI_ROMBAR */
dev->pci_bar[1].addr_regs[addr & 3] = val;
/* dev->pci_bar[1].addr_regs[1] &= dev->bios_mask; */
#if 0
dev->pci_bar[1].addr_regs[1] &= dev->bios_mask;
#endif
dev->pci_bar[1].addr &= 0xffff8001;
dev->bios_addr = dev->pci_bar[1].addr & 0xffff8000;
nic_update_bios(dev);
@@ -778,6 +792,9 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv)
dev->base_irq = val;
dev->pci_regs[addr] = dev->base_irq;
return;
default:
break;
}
}
@@ -1000,6 +1017,9 @@ nic_init(const device_t *info)
dp8390_set_id(dev->dp8390, 0x50, (dev->board == NE2K_RTL8019AS) ? 0x70 : 0x43);
dp8390_mem_alloc(dev->dp8390, 0x4000, 0x8000);
break;
default:
break;
}
memcpy(dev->dp8390->physaddr, dev->maclocal, sizeof(dev->maclocal));

View File

@@ -37,6 +37,7 @@
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/net_event.h>
#include <86box/plat_unused.h>
enum {
NET_EVENT_STOP = 0,
@@ -53,7 +54,7 @@ enum {
#define NULL_PKT_BATCH NET_QUEUE_LEN
typedef struct {
typedef struct net_null_t {
uint8_t mac_addr[6];
netcard_t *card;
thread_t *poll_tid;
@@ -158,7 +159,7 @@ net_null_thread(void *priv)
#endif
void *
net_null_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf)
net_null_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv), UNUSED(char *netdrv_errbuf))
{
net_null_log("Null Network: Init\n");

Some files were not shown because too many files have changed in this diff Show More