Changed several char arrays all around the code to const char pointers, debloats the executable file from 8.7 MB to 5.6 MB;
Replaced the Cirrus Logic code with the latest code from TheCollector1995 - the CL-GD 5428 is now fully working, as is the CL-GD 5429; Minor clean-up in the AHA/BusLogic BIOS commands code; Slightly rewritten mem_readb_phys_dma() and mem_writeb_phys_dma().
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* CPU type handler.
|
* CPU type handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)cpu.h 1.0.6 2018/02/01
|
* Version: @(#)cpu.h 1.0.7 2018/02/18
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* leilei,
|
* leilei,
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[32];
|
const char *name;
|
||||||
int cpu_type;
|
int cpu_type;
|
||||||
int speed;
|
int speed;
|
||||||
int rspeed;
|
int rspeed;
|
||||||
|
|||||||
30
src/device.c
30
src/device.c
@@ -9,13 +9,13 @@
|
|||||||
* Implementation of the generic device interface to handle
|
* Implementation of the generic device interface to handle
|
||||||
* all devices attached to the emulator.
|
* all devices attached to the emulator.
|
||||||
*
|
*
|
||||||
* Version: @(#)device.c 1.0.7 2017/11/04
|
* Version: @(#)device.c 1.0.8 2018/02/18
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
* Copyright 2008-2016 Sarah Walker.
|
* Copyright 2008-2018 Sarah Walker.
|
||||||
* Copyright 2016,2017 Miran Grca.
|
* Copyright 2016-2018 Miran Grca.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -207,7 +207,7 @@ device_get_config_string(char *s)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name))
|
if (! strcmp(s, c->name))
|
||||||
return(config_get_string(device_current->name, s, c->default_string));
|
return(config_get_string((char *) device_current->name, s, (char *) c->default_string));
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ device_get_config_int(char *s)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name))
|
if (! strcmp(s, c->name))
|
||||||
return(config_get_int(device_current->name, s, c->default_int));
|
return(config_get_int((char *) device_current->name, s, c->default_int));
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ device_get_config_int_ex(char *s, int default_int)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name))
|
if (! strcmp(s, c->name))
|
||||||
return(config_get_int(device_current->name, s, default_int));
|
return(config_get_int((char *) device_current->name, s, default_int));
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ device_get_config_hex16(char *s)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name))
|
if (! strcmp(s, c->name))
|
||||||
return(config_get_hex16(device_current->name, s, c->default_int));
|
return(config_get_hex16((char *) device_current->name, s, c->default_int));
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ device_get_config_hex20(char *s)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name))
|
if (! strcmp(s, c->name))
|
||||||
return(config_get_hex20(device_current->name, s, c->default_int));
|
return(config_get_hex20((char *) device_current->name, s, c->default_int));
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@@ -287,7 +287,7 @@ device_get_config_mac(char *s, int default_int)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name))
|
if (! strcmp(s, c->name))
|
||||||
return(config_get_mac(device_current->name, s, default_int));
|
return(config_get_mac((char *) device_current->name, s, default_int));
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ device_set_config_int(char *s, int val)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name)) {
|
if (! strcmp(s, c->name)) {
|
||||||
config_set_int(device_current->name, s, val);
|
config_set_int((char *) device_current->name, s, val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +319,7 @@ device_set_config_hex16(char *s, int val)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name)) {
|
if (! strcmp(s, c->name)) {
|
||||||
config_set_hex16(device_current->name, s, val);
|
config_set_hex16((char *) device_current->name, s, val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ device_set_config_hex20(char *s, int val)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name)) {
|
if (! strcmp(s, c->name)) {
|
||||||
config_set_hex20(device_current->name, s, val);
|
config_set_hex20((char *) device_current->name, s, val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ device_set_config_mac(char *s, int val)
|
|||||||
|
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name)) {
|
if (! strcmp(s, c->name)) {
|
||||||
config_set_mac(device_current->name, s, val);
|
config_set_mac((char *) device_current->name, s, val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ machine_get_config_int(char *s)
|
|||||||
c = d->config;
|
c = d->config;
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name))
|
if (! strcmp(s, c->name))
|
||||||
return(config_get_int(d->name, s, c->default_int));
|
return(config_get_int((char *) d->name, s, c->default_int));
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@@ -439,7 +439,7 @@ machine_get_config_string(char *s)
|
|||||||
c = d->config;
|
c = d->config;
|
||||||
while (c && c->type != -1) {
|
while (c && c->type != -1) {
|
||||||
if (! strcmp(s, c->name))
|
if (! strcmp(s, c->name))
|
||||||
return(config_get_string(d->name, s, c->default_string));
|
return(config_get_string((char *) d->name, s, (char *) c->default_string));
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|||||||
22
src/device.h
22
src/device.h
@@ -9,15 +9,15 @@
|
|||||||
* Implementation of the generic device interface to handle
|
* Implementation of the generic device interface to handle
|
||||||
* all devices attached to the emulator.
|
* all devices attached to the emulator.
|
||||||
*
|
*
|
||||||
* Version: @(#)device.h 1.0.7 2017/11/25
|
* Version: @(#)device.h 1.0.8 2018/02/18
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
* Copyright 2008-2016 Sarah Walker.
|
* Copyright 2008-2018 Sarah Walker.
|
||||||
* Copyright 2016,2017 Miran Grca.
|
* Copyright 2016-2018 Miran Grca.
|
||||||
* Copyright 2017 Fred N. van Kempen.
|
* Copyright 2017,2018 Fred N. van Kempen.
|
||||||
*/
|
*/
|
||||||
#ifndef EMU_DEVICE_H
|
#ifndef EMU_DEVICE_H
|
||||||
# define EMU_DEVICE_H
|
# define EMU_DEVICE_H
|
||||||
@@ -50,13 +50,13 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char description[256];
|
const char *description;
|
||||||
int value;
|
int value;
|
||||||
} device_config_selection_t;
|
} device_config_selection_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char description[256];
|
const char *description;
|
||||||
char extensions[25][25];
|
const char *extensions[5];
|
||||||
} device_config_file_filter_t;
|
} device_config_file_filter_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -66,10 +66,10 @@ typedef struct {
|
|||||||
} device_config_spinner_t;
|
} device_config_spinner_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[256];
|
const char *name;
|
||||||
char description[256];
|
const char *description;
|
||||||
int type;
|
int type;
|
||||||
char default_string[256];
|
const char *default_string;
|
||||||
int default_int;
|
int default_int;
|
||||||
device_config_selection_t selection[16];
|
device_config_selection_t selection[16];
|
||||||
device_config_file_filter_t file_filter[16];
|
device_config_file_filter_t file_filter[16];
|
||||||
@@ -77,7 +77,7 @@ typedef struct {
|
|||||||
} device_config_t;
|
} device_config_t;
|
||||||
|
|
||||||
typedef struct _device_ {
|
typedef struct _device_ {
|
||||||
char name[50];
|
const char *name;
|
||||||
uint32_t flags; /* system flags */
|
uint32_t flags; /* system flags */
|
||||||
uint32_t local; /* flags local to device */
|
uint32_t local; /* flags local to device */
|
||||||
|
|
||||||
|
|||||||
@@ -774,11 +774,10 @@ void DMAPageWrite(uint32_t PhysAddress, const uint8_t *DataWrite, uint32_t Total
|
|||||||
#if 0
|
#if 0
|
||||||
mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1);
|
mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1);
|
||||||
memcpy(&ram[PhysAddress], DataWrite, TotalSize);
|
memcpy(&ram[PhysAddress], DataWrite, TotalSize);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < TotalSize; i++)
|
for (i = 0; i < TotalSize; i++)
|
||||||
mem_writeb_phys_dma(PhysAddress + i, DataWrite[i]);
|
mem_writeb_phys_dma(PhysAddress + i, DataWrite[i]);
|
||||||
#endif
|
|
||||||
|
|
||||||
mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1);
|
mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/lpt.c
16
src/lpt.c
@@ -17,8 +17,8 @@ char lpt_device_names[3][16];
|
|||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
char name[64];
|
const char *name;
|
||||||
char internal_name[16];
|
const char *internal_name;
|
||||||
lpt_device_t *device;
|
lpt_device_t *device;
|
||||||
} lpt_devices[] =
|
} lpt_devices[] =
|
||||||
{
|
{
|
||||||
@@ -31,15 +31,15 @@ static struct
|
|||||||
|
|
||||||
char *lpt_device_get_name(int id)
|
char *lpt_device_get_name(int id)
|
||||||
{
|
{
|
||||||
if (strlen(lpt_devices[id].name) == 0)
|
if (strlen((char *) lpt_devices[id].name) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
return lpt_devices[id].name;
|
return (char *) lpt_devices[id].name;
|
||||||
}
|
}
|
||||||
char *lpt_device_get_internal_name(int id)
|
char *lpt_device_get_internal_name(int id)
|
||||||
{
|
{
|
||||||
if (strlen(lpt_devices[id].internal_name) == 0)
|
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
return lpt_devices[id].internal_name;
|
return (char *) lpt_devices[id].internal_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lpt_device_t *lpt_device_ts[3];
|
static lpt_device_t *lpt_device_ts[3];
|
||||||
@@ -53,10 +53,10 @@ void lpt_devices_init()
|
|||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
while (strcmp(lpt_devices[c].internal_name, lpt_device_names[i]) && strlen(lpt_devices[c].internal_name) != 0)
|
while (strcmp((char *) lpt_devices[c].internal_name, lpt_device_names[i]) && strlen((char *) lpt_devices[c].internal_name) != 0)
|
||||||
c++;
|
c++;
|
||||||
|
|
||||||
if (strlen(lpt_devices[c].internal_name) == 0)
|
if (strlen((char *) lpt_devices[c].internal_name) == 0)
|
||||||
lpt_device_ts[i] = NULL;
|
lpt_device_ts[i] = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
28
src/mem.c
28
src/mem.c
@@ -894,16 +894,14 @@ uint8_t mem_readb_phys(uint32_t addr)
|
|||||||
/* Version of mem_readby_phys that doesn't go through the CPU paging mechanism. */
|
/* Version of mem_readby_phys that doesn't go through the CPU paging mechanism. */
|
||||||
uint8_t mem_readb_phys_dma(uint32_t addr)
|
uint8_t mem_readb_phys_dma(uint32_t addr)
|
||||||
{
|
{
|
||||||
mem_logical_addr = 0xffffffff;
|
/* mem_logical_addr = 0xffffffff; */
|
||||||
|
|
||||||
if (_mem_read_b[addr >> 14]) {
|
if (_mem_exec[addr >> 14])
|
||||||
if (_mem_mapping_r[addr >> 14] && (_mem_mapping_r[addr >> 14]->flags & MEM_MAPPING_INTERNAL)) {
|
return _mem_exec[addr >> 14][addr & 0x3fff];
|
||||||
return _mem_exec[addr >> 14][addr & 0x3fff];
|
else if (_mem_read_b[addr >> 14])
|
||||||
} else
|
return _mem_read_b[addr >> 14](addr, _mem_priv_r[addr >> 14]);
|
||||||
return _mem_read_b[addr >> 14](addr, _mem_priv_r[addr >> 14]);
|
else
|
||||||
}
|
return 0xff;
|
||||||
|
|
||||||
return 0xff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t mem_readw_phys(uint32_t addr)
|
uint16_t mem_readw_phys(uint32_t addr)
|
||||||
@@ -927,14 +925,12 @@ void mem_writeb_phys(uint32_t addr, uint8_t val)
|
|||||||
/* Version of mem_readby_phys that doesn't go through the CPU paging mechanism. */
|
/* Version of mem_readby_phys that doesn't go through the CPU paging mechanism. */
|
||||||
void mem_writeb_phys_dma(uint32_t addr, uint8_t val)
|
void mem_writeb_phys_dma(uint32_t addr, uint8_t val)
|
||||||
{
|
{
|
||||||
mem_logical_addr = 0xffffffff;
|
/* mem_logical_addr = 0xffffffff; */
|
||||||
|
|
||||||
if (_mem_write_b[addr >> 14]) {
|
if (_mem_exec[addr >> 14])
|
||||||
if (_mem_mapping_w[addr >> 14] && (_mem_mapping_w[addr >> 14]->flags & MEM_MAPPING_INTERNAL)) {
|
_mem_exec[addr >> 14][addr & 0x3fff] = val;
|
||||||
_mem_exec[addr >> 14][addr & 0x3fff] = val;
|
else if (_mem_write_b[addr >> 14])
|
||||||
} else
|
_mem_write_b[addr >> 14](addr, val, _mem_priv_w[addr >> 14]);
|
||||||
_mem_write_b[addr >> 14](addr, val, _mem_priv_w[addr >> 14]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mem_writew_phys(uint32_t addr, uint16_t val)
|
void mem_writew_phys(uint32_t addr, uint16_t val)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* it should be malloc'ed and then linked to the NETCARD def.
|
* it should be malloc'ed and then linked to the NETCARD def.
|
||||||
* Will be done later.
|
* Will be done later.
|
||||||
*
|
*
|
||||||
* Version: @(#)network.c 1.0.20 2018/01/26
|
* Version: @(#)network.c 1.0.21 2018/02/18
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -287,7 +287,7 @@ network_dev_to_id(char *devname)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (i=0; i<network_ndev; i++) {
|
for (i=0; i<network_ndev; i++) {
|
||||||
if (! strcmp(network_devs[i].device, devname)) {
|
if (! strcmp((char *) network_devs[i].device, devname)) {
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,7 +322,7 @@ network_card_available(int card)
|
|||||||
char *
|
char *
|
||||||
network_card_getname(int card)
|
network_card_getname(int card)
|
||||||
{
|
{
|
||||||
return(net_cards[card].name);
|
return((char *) net_cards[card].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ network_card_has_config(int card)
|
|||||||
char *
|
char *
|
||||||
network_card_get_internal_name(int card)
|
network_card_get_internal_name(int card)
|
||||||
{
|
{
|
||||||
return(net_cards[card].internal_name);
|
return((char *) net_cards[card].internal_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -358,8 +358,8 @@ network_card_get_from_internal_name(char *s)
|
|||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (strlen(net_cards[c].internal_name)) {
|
while (strlen((char *) net_cards[c].internal_name)) {
|
||||||
if (! strcmp(net_cards[c].internal_name, s))
|
if (! strcmp((char *) net_cards[c].internal_name, s))
|
||||||
return(c);
|
return(c);
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Definitions for the network module.
|
* Definitions for the network module.
|
||||||
*
|
*
|
||||||
* Version: @(#)network.h 1.0.11 2018/01/26
|
* Version: @(#)network.h 1.0.12 2018/02/18
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*/
|
*/
|
||||||
@@ -36,8 +36,8 @@ typedef void (*NETRXCB)(void *, uint8_t *, int);
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[64];
|
const char *name;
|
||||||
char internal_name[32];
|
const char *internal_name;
|
||||||
device_t *device;
|
device_t *device;
|
||||||
void *priv;
|
void *priv;
|
||||||
int (*poll)(void *);
|
int (*poll)(void *);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Handling of the SCSI controllers.
|
* Handling of the SCSI controllers.
|
||||||
*
|
*
|
||||||
* Version: @(#)scsi.c 1.0.14 2018/01/21
|
* Version: @(#)scsi.c 1.0.15 2018/02/18
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -57,8 +57,8 @@ mutex_t *scsiMutex;
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[64];
|
const char *name;
|
||||||
char internal_name[32];
|
const char *internal_name;
|
||||||
device_t *device;
|
device_t *device;
|
||||||
void (*reset)(void *p);
|
void (*reset)(void *p);
|
||||||
} SCSI_CARD;
|
} SCSI_CARD;
|
||||||
@@ -98,7 +98,7 @@ int scsi_card_available(int card)
|
|||||||
|
|
||||||
char *scsi_card_getname(int card)
|
char *scsi_card_getname(int card)
|
||||||
{
|
{
|
||||||
return(scsi_cards[card].name);
|
return((char *) scsi_cards[card].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ int scsi_card_has_config(int card)
|
|||||||
|
|
||||||
char *scsi_card_get_internal_name(int card)
|
char *scsi_card_get_internal_name(int card)
|
||||||
{
|
{
|
||||||
return(scsi_cards[card].internal_name);
|
return((char *) scsi_cards[card].internal_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -126,8 +126,8 @@ int scsi_card_get_from_internal_name(char *s)
|
|||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (strlen(scsi_cards[c].internal_name)) {
|
while (strlen((char *) scsi_cards[c].internal_name)) {
|
||||||
if (!strcmp(scsi_cards[c].internal_name, s))
|
if (!strcmp((char *) scsi_cards[c].internal_name, s))
|
||||||
return(c);
|
return(c);
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,12 @@
|
|||||||
* made by Adaptec, Inc. These controllers were designed for
|
* made by Adaptec, Inc. These controllers were designed for
|
||||||
* the ISA bus.
|
* the ISA bus.
|
||||||
*
|
*
|
||||||
* Version: @(#)scsi_aha154x.c 1.0.36 2017/12/09
|
* Version: @(#)scsi_aha154x.c 1.0.37 2018/02/17
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Original Buslogic version by SA1988 and Miran Grca.
|
* Original Buslogic version by SA1988 and Miran Grca.
|
||||||
*
|
*
|
||||||
* Copyright 2017 Fred N. van Kempen.
|
* Copyright 2017,2018 Fred N. van Kempen.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "../timer.h"
|
#include "../timer.h"
|
||||||
#include "../device.h"
|
#include "../device.h"
|
||||||
#include "../plat.h"
|
#include "../plat.h"
|
||||||
|
#include "../cpu/cpu.h"
|
||||||
#include "scsi.h"
|
#include "scsi.h"
|
||||||
#include "scsi_aha154x.h"
|
#include "scsi_aha154x.h"
|
||||||
#include "scsi_x54x.h"
|
#include "scsi_x54x.h"
|
||||||
@@ -91,6 +92,7 @@ aha_log(const char *fmt, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if (aha_do_log) {
|
if (aha_do_log) {
|
||||||
|
pclog("In %s mode: ",(msw&1)?((eflags&VM_FLAG)?"V86":"protected"):"real");
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
pclog_ex(fmt, ap);
|
pclog_ex(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@@ -782,7 +784,7 @@ aha_init(device_t *info)
|
|||||||
switch(dev->Base) {
|
switch(dev->Base) {
|
||||||
case 0x0330:
|
case 0x0330:
|
||||||
dev->bios_path =
|
dev->bios_path =
|
||||||
L"roms/scsi/adaptec/aha1540b320_330.bin";
|
L"roms/scsi/adaptec/aha1540b310.bin";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0334:
|
case 0x0334:
|
||||||
@@ -790,9 +792,12 @@ aha_init(device_t *info)
|
|||||||
L"roms/scsi/adaptec/aha1540b320_334.bin";
|
L"roms/scsi/adaptec/aha1540b320_334.bin";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dev->fw_rev = "A001";
|
dev->fw_rev = "A005"; /* The 3.2 microcode says A012. */
|
||||||
/* This is configurable from the configuration for the 154xB, the rest of the controllers read it from the EEPROM. */
|
/* This is configurable from the configuration for the 154xB, the rest of the controllers read it from the EEPROM. */
|
||||||
dev->HostID = device_get_config_int("hostid");
|
dev->HostID = device_get_config_int("hostid");
|
||||||
|
dev->int_geom_writable = 2;
|
||||||
|
dev->rom_shram = 0x3F80; /* shadow RAM address base */
|
||||||
|
dev->rom_shramsz = 128; /* size of shadow RAM */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AHA_154xC:
|
case AHA_154xC:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* The generic SCSI device command handler.
|
* The generic SCSI device command handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)scsi_device.c 1.0.11 2018/01/21
|
* Version: @(#)scsi_device.c 1.0.12 2018/02/17
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -284,20 +284,6 @@ int scsi_device_cdb_length(uint8_t scsi_id, uint8_t scsi_lun)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int scsi_device_block_shift(uint8_t scsi_id, uint8_t scsi_lun)
|
|
||||||
{
|
|
||||||
uint8_t lun_type = SCSIDevices[scsi_id][scsi_lun].LunType;
|
|
||||||
|
|
||||||
switch (lun_type)
|
|
||||||
{
|
|
||||||
case SCSI_CDROM:
|
|
||||||
return 11; /* 2048 bytes per block */
|
|
||||||
default:
|
|
||||||
return 9; /* 512 bytes per block */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void scsi_device_command_phase0(uint8_t scsi_id, uint8_t scsi_lun, int cdb_len, uint8_t *cdb)
|
void scsi_device_command_phase0(uint8_t scsi_id, uint8_t scsi_lun, int cdb_len, uint8_t *cdb)
|
||||||
{
|
{
|
||||||
uint8_t lun_type = SCSIDevices[scsi_id][scsi_lun].LunType;
|
uint8_t lun_type = SCSIDevices[scsi_id][scsi_lun].LunType;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Definitions for the generic SCSI device command handler.
|
* Definitions for the generic SCSI device command handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)scsi_device.h 1.0.4 2017/10/10
|
* Version: @(#)scsi_device.h 1.0.5 2018/02/17
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -44,7 +44,6 @@ extern int scsi_device_read_capacity(uint8_t id, uint8_t lun,
|
|||||||
extern int scsi_device_present(uint8_t id, uint8_t lun);
|
extern int scsi_device_present(uint8_t id, uint8_t lun);
|
||||||
extern int scsi_device_valid(uint8_t id, uint8_t lun);
|
extern int scsi_device_valid(uint8_t id, uint8_t lun);
|
||||||
extern int scsi_device_cdb_length(uint8_t id, uint8_t lun);
|
extern int scsi_device_cdb_length(uint8_t id, uint8_t lun);
|
||||||
extern int scsi_device_block_shift(uint8_t id, uint8_t lun);
|
|
||||||
extern void scsi_device_command(uint8_t id, uint8_t lun, int cdb_len,
|
extern void scsi_device_command(uint8_t id, uint8_t lun, int cdb_len,
|
||||||
uint8_t *cdb);
|
uint8_t *cdb);
|
||||||
extern void scsi_device_command_phase0(uint8_t scsi_id, uint8_t scsi_lun,
|
extern void scsi_device_command_phase0(uint8_t scsi_id, uint8_t scsi_lun,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* series of SCSI Host Adapters made by Mylex.
|
* series of SCSI Host Adapters made by Mylex.
|
||||||
* These controllers were designed for various buses.
|
* These controllers were designed for various buses.
|
||||||
*
|
*
|
||||||
* Version: @(#)scsi_x54x.c 1.0.12 2018/02/15
|
* Version: @(#)scsi_x54x.c 1.0.13 2018/02/17
|
||||||
*
|
*
|
||||||
* Authors: TheCollector1995, <mariogplayer@gmail.com>
|
* Authors: TheCollector1995, <mariogplayer@gmail.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "../device.h"
|
#include "../device.h"
|
||||||
#include "../timer.h"
|
#include "../timer.h"
|
||||||
#include "../plat.h"
|
#include "../plat.h"
|
||||||
|
#include "../cpu/cpu.h"
|
||||||
#include "scsi.h"
|
#include "scsi.h"
|
||||||
#include "scsi_device.h"
|
#include "scsi_device.h"
|
||||||
#include "scsi_aha154x.h"
|
#include "scsi_aha154x.h"
|
||||||
@@ -81,6 +82,7 @@ x54x_log(const char *fmt, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if (x54x_do_log) {
|
if (x54x_do_log) {
|
||||||
|
pclog("In %s mode: ",(msw&1)?((eflags&VM_FLAG)?"V86":"protected"):"real");
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
pclog_ex(fmt, ap);
|
pclog_ex(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@@ -303,7 +305,6 @@ x54x_bios_command(x54x_t *x54x, uint8_t max_id, BIOSCMD *cmd, int8_t islba)
|
|||||||
uint32_t dma_address;
|
uint32_t dma_address;
|
||||||
uint32_t lba;
|
uint32_t lba;
|
||||||
int sector_len = cmd->secount;
|
int sector_len = cmd->secount;
|
||||||
int block_shift;
|
|
||||||
uint8_t ret;
|
uint8_t ret;
|
||||||
|
|
||||||
if (islba)
|
if (islba)
|
||||||
@@ -345,8 +346,6 @@ x54x_bios_command(x54x_t *x54x, uint8_t max_id, BIOSCMD *cmd, int8_t islba)
|
|||||||
dev->CmdBuffer = NULL;
|
dev->CmdBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
block_shift = scsi_device_block_shift(cmd->id, cmd->lun);
|
|
||||||
|
|
||||||
switch(cmd->command) {
|
switch(cmd->command) {
|
||||||
case 0x00: /* Reset Disk System, in practice it's a nop */
|
case 0x00: /* Reset Disk System, in practice it's a nop */
|
||||||
return(0);
|
return(0);
|
||||||
@@ -380,9 +379,7 @@ x54x_bios_command(x54x_t *x54x, uint8_t max_id, BIOSCMD *cmd, int8_t islba)
|
|||||||
case 0x02: /* Read Desired Sectors to Memory */
|
case 0x02: /* Read Desired Sectors to Memory */
|
||||||
target_check(cmd->id, cmd->lun);
|
target_check(cmd->id, cmd->lun);
|
||||||
|
|
||||||
dev->BufferLength = sector_len << block_shift;
|
dev->BufferLength = -1;
|
||||||
dev->CmdBuffer = (uint8_t *)malloc(dev->BufferLength);
|
|
||||||
memset(dev->CmdBuffer, 0x00, dev->BufferLength);
|
|
||||||
|
|
||||||
cdb[0] = GPCMD_READ_10;
|
cdb[0] = GPCMD_READ_10;
|
||||||
cdb[1] = (cmd->lun & 7) << 5;
|
cdb[1] = (cmd->lun & 7) << 5;
|
||||||
@@ -390,8 +387,8 @@ x54x_bios_command(x54x_t *x54x, uint8_t max_id, BIOSCMD *cmd, int8_t islba)
|
|||||||
cdb[3] = (lba >> 16) & 0xff;
|
cdb[3] = (lba >> 16) & 0xff;
|
||||||
cdb[4] = (lba >> 8) & 0xff;
|
cdb[4] = (lba >> 8) & 0xff;
|
||||||
cdb[5] = lba & 0xff;
|
cdb[5] = lba & 0xff;
|
||||||
cdb[7] = (sector_len >> 8) & 0xff;
|
cdb[7] = 0;
|
||||||
cdb[8] = sector_len & 0xff;
|
cdb[8] = sector_len;
|
||||||
#if 0
|
#if 0
|
||||||
x54x_log("BIOS CMD(READ, %08lx, %d)\n", lba, cmd->secount);
|
x54x_log("BIOS CMD(READ, %08lx, %d)\n", lba, cmd->secount);
|
||||||
#endif
|
#endif
|
||||||
@@ -401,6 +398,8 @@ x54x_bios_command(x54x_t *x54x, uint8_t max_id, BIOSCMD *cmd, int8_t islba)
|
|||||||
if (dev->Phase == SCSI_PHASE_STATUS)
|
if (dev->Phase == SCSI_PHASE_STATUS)
|
||||||
goto skip_read_phase1;
|
goto skip_read_phase1;
|
||||||
|
|
||||||
|
dev->CmdBuffer = (uint8_t *)malloc(dev->BufferLength);
|
||||||
|
|
||||||
scsi_device_command_phase1(cmd->id, cmd->lun);
|
scsi_device_command_phase1(cmd->id, cmd->lun);
|
||||||
if (sector_len > 0) {
|
if (sector_len > 0) {
|
||||||
x54x_log("BIOS DMA: Reading %i bytes at %08X\n",
|
x54x_log("BIOS DMA: Reading %i bytes at %08X\n",
|
||||||
@@ -420,9 +419,7 @@ skip_read_phase1:
|
|||||||
case 0x03: /* Write Desired Sectors from Memory */
|
case 0x03: /* Write Desired Sectors from Memory */
|
||||||
target_check(cmd->id, cmd->lun);
|
target_check(cmd->id, cmd->lun);
|
||||||
|
|
||||||
dev->BufferLength = sector_len << block_shift;
|
dev->BufferLength = -1;
|
||||||
dev->CmdBuffer = (uint8_t *)malloc(dev->BufferLength);
|
|
||||||
memset(dev->CmdBuffer, 0x00, dev->BufferLength);
|
|
||||||
|
|
||||||
cdb[0] = GPCMD_WRITE_10;
|
cdb[0] = GPCMD_WRITE_10;
|
||||||
cdb[1] = (cmd->lun & 7) << 5;
|
cdb[1] = (cmd->lun & 7) << 5;
|
||||||
@@ -430,8 +427,8 @@ skip_read_phase1:
|
|||||||
cdb[3] = (lba >> 16) & 0xff;
|
cdb[3] = (lba >> 16) & 0xff;
|
||||||
cdb[4] = (lba >> 8) & 0xff;
|
cdb[4] = (lba >> 8) & 0xff;
|
||||||
cdb[5] = lba & 0xff;
|
cdb[5] = lba & 0xff;
|
||||||
cdb[7] = (sector_len >> 8) & 0xff;
|
cdb[7] = 0;
|
||||||
cdb[8] = sector_len & 0xff;
|
cdb[8] = sector_len;
|
||||||
#if 0
|
#if 0
|
||||||
x54x_log("BIOS CMD(WRITE, %08lx, %d)\n", lba, cmd->secount);
|
x54x_log("BIOS CMD(WRITE, %08lx, %d)\n", lba, cmd->secount);
|
||||||
#endif
|
#endif
|
||||||
@@ -441,6 +438,8 @@ skip_read_phase1:
|
|||||||
if (dev->Phase == SCSI_PHASE_STATUS)
|
if (dev->Phase == SCSI_PHASE_STATUS)
|
||||||
goto skip_write_phase1;
|
goto skip_write_phase1;
|
||||||
|
|
||||||
|
dev->CmdBuffer = (uint8_t *)malloc(dev->BufferLength);
|
||||||
|
|
||||||
if (sector_len > 0) {
|
if (sector_len > 0) {
|
||||||
x54x_log("BIOS DMA: Reading %i bytes at %08X\n",
|
x54x_log("BIOS DMA: Reading %i bytes at %08X\n",
|
||||||
dev->BufferLength, dma_address);
|
dev->BufferLength, dma_address);
|
||||||
@@ -467,8 +466,8 @@ skip_write_phase1:
|
|||||||
cdb[3] = (lba >> 16) & 0xff;
|
cdb[3] = (lba >> 16) & 0xff;
|
||||||
cdb[4] = (lba >> 8) & 0xff;
|
cdb[4] = (lba >> 8) & 0xff;
|
||||||
cdb[5] = lba & 0xff;
|
cdb[5] = lba & 0xff;
|
||||||
cdb[7] = (sector_len >> 8) & 0xff;
|
cdb[7] = 0;
|
||||||
cdb[8] = sector_len & 0xff;
|
cdb[8] = sector_len;
|
||||||
|
|
||||||
scsi_device_command_phase0(cmd->id, cmd->lun, 12, cdb);
|
scsi_device_command_phase0(cmd->id, cmd->lun, 12, cdb);
|
||||||
|
|
||||||
@@ -503,7 +502,7 @@ skip_write_phase1:
|
|||||||
|
|
||||||
x54x_log("BIOS DMA: Reading 6 bytes at %08X\n", dma_address);
|
x54x_log("BIOS DMA: Reading 6 bytes at %08X\n", dma_address);
|
||||||
DMAPageWrite(dma_address,
|
DMAPageWrite(dma_address,
|
||||||
dev->CmdBuffer, dev->BufferLength);
|
dev->CmdBuffer, 4 /* dev->BufferLength */);
|
||||||
|
|
||||||
if (dev->CmdBuffer != NULL) {
|
if (dev->CmdBuffer != NULL) {
|
||||||
free(dev->CmdBuffer);
|
free(dev->CmdBuffer);
|
||||||
@@ -569,7 +568,7 @@ skip_write_phase1:
|
|||||||
|
|
||||||
x54x_log("BIOS DMA: Reading 6 bytes at %08X\n", dma_address);
|
x54x_log("BIOS DMA: Reading 6 bytes at %08X\n", dma_address);
|
||||||
DMAPageWrite(dma_address,
|
DMAPageWrite(dma_address,
|
||||||
dev->CmdBuffer, dev->BufferLength);
|
dev->CmdBuffer, 4 /* dev->BufferLength */);
|
||||||
|
|
||||||
if (dev->CmdBuffer != NULL) {
|
if (dev->CmdBuffer != NULL) {
|
||||||
free(dev->CmdBuffer);
|
free(dev->CmdBuffer);
|
||||||
@@ -1290,6 +1289,7 @@ x54x_cmd_thread(void *priv)
|
|||||||
if ((dev->Status & STAT_INIT) || (!dev->MailboxInit && !dev->BIOSMailboxInit) || (!dev->MailboxReq && !dev->BIOSMailboxReq)) {
|
if ((dev->Status & STAT_INIT) || (!dev->MailboxInit && !dev->BIOSMailboxInit) || (!dev->MailboxReq && !dev->BIOSMailboxReq)) {
|
||||||
/* If we did not get anything, wait a while. */
|
/* If we did not get anything, wait a while. */
|
||||||
thread_wait_event((event_t *) wait_evt, 10);
|
thread_wait_event((event_t *) wait_evt, 10);
|
||||||
|
thread_reset_event((event_t *) wait_evt);
|
||||||
|
|
||||||
scsi_mutex_wait(0);
|
scsi_mutex_wait(0);
|
||||||
continue;
|
continue;
|
||||||
@@ -1443,11 +1443,10 @@ static void
|
|||||||
x54x_reset(x54x_t *dev)
|
x54x_reset(x54x_t *dev)
|
||||||
{
|
{
|
||||||
clear_irq(dev);
|
clear_irq(dev);
|
||||||
if (dev->int_geom_writable)
|
if (dev->int_geom_writable == 1)
|
||||||
dev->Geometry = 0x80;
|
dev->Geometry = 0x80;
|
||||||
else
|
else
|
||||||
dev->Geometry = 0x00;
|
dev->Geometry = 0x00;
|
||||||
dev->Geometry = 0x00;
|
|
||||||
dev->Command = 0xFF;
|
dev->Command = 0xFF;
|
||||||
dev->CmdParam = 0;
|
dev->CmdParam = 0;
|
||||||
dev->CmdParamLeft = 0;
|
dev->CmdParamLeft = 0;
|
||||||
@@ -1800,7 +1799,7 @@ x54x_out(uint16_t port, uint8_t val, void *priv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (dev->int_geom_writable)
|
if (dev->int_geom_writable == 1)
|
||||||
dev->Geometry = val;
|
dev->Geometry = val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1964,6 +1963,7 @@ x54x_init(device_t *info)
|
|||||||
|
|
||||||
x54x_thread_start(dev);
|
x54x_thread_start(dev);
|
||||||
thread_wait_event((event_t *) thread_started, -1);
|
thread_wait_event((event_t *) thread_started, -1);
|
||||||
|
thread_reset_event((event_t *) thread_started);
|
||||||
|
|
||||||
return(dev);
|
return(dev);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Sound emulation core.
|
* Sound emulation core.
|
||||||
*
|
*
|
||||||
* Version: @(#)sound.c 1.0.13 2018/02/15
|
* Version: @(#)sound.c 1.0.14 2018/02/18
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[64];
|
const char *name;
|
||||||
char internal_name[24];
|
const char *internal_name;
|
||||||
device_t *device;
|
device_t *device;
|
||||||
} SOUND_CARD;
|
} SOUND_CARD;
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ int sound_card_available(int card)
|
|||||||
|
|
||||||
char *sound_card_getname(int card)
|
char *sound_card_getname(int card)
|
||||||
{
|
{
|
||||||
return sound_cards[card].name;
|
return (char *) sound_cards[card].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_t *sound_card_getdevice(int card)
|
device_t *sound_card_getdevice(int card)
|
||||||
@@ -129,16 +129,16 @@ int sound_card_has_config(int card)
|
|||||||
|
|
||||||
char *sound_card_get_internal_name(int card)
|
char *sound_card_get_internal_name(int card)
|
||||||
{
|
{
|
||||||
return sound_cards[card].internal_name;
|
return (char *) sound_cards[card].internal_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sound_card_get_from_internal_name(char *s)
|
int sound_card_get_from_internal_name(char *s)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (strlen(sound_cards[c].internal_name))
|
while (strlen((char *) sound_cards[c].internal_name))
|
||||||
{
|
{
|
||||||
if (!strcmp(sound_cards[c].internal_name, s))
|
if (!strcmp((char *) sound_cards[c].internal_name, s))
|
||||||
return c;
|
return c;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
|||||||
/* Copyright holders: Sarah Walker
|
|
||||||
see COPYING for more details
|
|
||||||
*/
|
|
||||||
extern device_t gd5429_device;
|
|
||||||
1413
src/video/vid_cl54xx.c
Normal file
1413
src/video/vid_cl54xx.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,3 +2,4 @@
|
|||||||
see COPYING for more details
|
see COPYING for more details
|
||||||
*/
|
*/
|
||||||
extern device_t gd5428_device;
|
extern device_t gd5428_device;
|
||||||
|
extern device_t gd5429_device;
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,220 +0,0 @@
|
|||||||
// ID
|
|
||||||
#define CIRRUS_ID_CLGD6225 (0x02<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5402 (0x06<<2) /* Also Acumos AVGA2 */
|
|
||||||
#define CIRRUS_ID_CLGD7542 (0x0B<<2) /* Nordic */
|
|
||||||
#define CIRRUS_ID_CLGD7543 (0x0C<<2) /* Viking - guess */
|
|
||||||
#define CIRRUS_ID_CLGD7541 (0x0D<<2) /* Nordic Lite */
|
|
||||||
#define CIRRUS_ID_CLGD6215 (0x12<<2)
|
|
||||||
#define CIRRUS_ID_CLGD6235 (0x22<<2) /* Also 5402 */
|
|
||||||
#define CIRRUS_ID_CLGD5422 (0x23<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5426 (0x24<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5424 (0x25<<2) /* Also 5422-80 */
|
|
||||||
#define CIRRUS_ID_CLGD5428 (0x26<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5429 (0x27<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5430 (0x28<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5430VL (0x28<<2)+10000 /* gets fixed in code */
|
|
||||||
#define CIRRUS_ID_CLGD5432 0xA2
|
|
||||||
#define CIRRUS_ID_CLGD5434O (0x29<<2) /* O = obsolete, never used? */
|
|
||||||
#define CIRRUS_ID_CLGD5434 (0x2A<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5436 (0x2B<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5436U (0x3A<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5440 (0x2C<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5442 (0x2D<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5446 (0x2E<<2)
|
|
||||||
#define CIRRUS_ID_CLGD5455 (0x2F<<2) /* Laguna 3D */
|
|
||||||
#define CIRRUS_ID_CLGD6205 (0x32<<2) /* Laguna 3D */
|
|
||||||
#define CIRRUS_ID_CLGD5462 (0x34<<2) /* Laguna */
|
|
||||||
#define CIRRUS_ID_CLGD5464 (0xD5) /* Laguna BD */
|
|
||||||
#define CIRRUS_ID_CLGD5465 (0xD6) /* Laguna 3D */
|
|
||||||
|
|
||||||
// sequencer 0x07
|
|
||||||
#define CIRRUS_SR7_BPP_VGA 0x00
|
|
||||||
#define CIRRUS_SR7_BPP_SVGA 0x01
|
|
||||||
#define CIRRUS_SR7_BPP_MASK 0x0e
|
|
||||||
#define CIRRUS_SR7_BPP_8 0x00
|
|
||||||
#define CIRRUS_SR7_BPP_16_DOUBLEVCLK 0x02
|
|
||||||
#define CIRRUS_SR7_BPP_24 0x04
|
|
||||||
#define CIRRUS_SR7_BPP_16 0x06
|
|
||||||
#define CIRRUS_SR7_BPP_32 0x08
|
|
||||||
#define CIRRUS_SR7_ISAADDR_MASK 0xe0
|
|
||||||
|
|
||||||
// sequencer 0x0f
|
|
||||||
#define CIRRUS_MEMSIZE_512k 0x08
|
|
||||||
#define CIRRUS_MEMSIZE_1M 0x10
|
|
||||||
#define CIRRUS_MEMSIZE_2M 0x18
|
|
||||||
#define CIRRUS_MEMFLAGS_BANKSWITCH 0x80 // bank switching is enabled.
|
|
||||||
|
|
||||||
// sequencer 0x12
|
|
||||||
#define CIRRUS_CURSOR_SHOW 0x01
|
|
||||||
#define CIRRUS_CURSOR_HIDDENPEL 0x02
|
|
||||||
#define CIRRUS_CURSOR_LARGE 0x04 // 64x64 if set, 32x32 if clear
|
|
||||||
|
|
||||||
// sequencer 0x17
|
|
||||||
#define CIRRUS_BUSTYPE_VLBFAST 0x10
|
|
||||||
#define CIRRUS_BUSTYPE_PCI 0x20
|
|
||||||
#define CIRRUS_BUSTYPE_VLBSLOW 0x30
|
|
||||||
#define CIRRUS_BUSTYPE_ISA 0x38
|
|
||||||
#define CIRRUS_MMIO_ENABLE 0x04
|
|
||||||
#define CIRRUS_MMIO_USE_PCIADDR 0x40 // 0xb8000 if cleared.
|
|
||||||
#define CIRRUS_MEMSIZEEXT_DOUBLE 0x80
|
|
||||||
|
|
||||||
// control 0x0b
|
|
||||||
#define CIRRUS_BANKING_DUAL 0x01
|
|
||||||
#define CIRRUS_BANKING_GRANULARITY_16K 0x20 // set:16k, clear:4k
|
|
||||||
|
|
||||||
// control 0x30
|
|
||||||
#define CIRRUS_BLTMODE_BACKWARDS 0x01
|
|
||||||
#define CIRRUS_BLTMODE_MEMSYSDEST 0x02
|
|
||||||
#define CIRRUS_BLTMODE_MEMSYSSRC 0x04
|
|
||||||
#define CIRRUS_BLTMODE_TRANSPARENTCOMP 0x08
|
|
||||||
#define CIRRUS_BLTMODE_PATTERNCOPY 0x40
|
|
||||||
#define CIRRUS_BLTMODE_COLOREXPAND 0x80
|
|
||||||
#define CIRRUS_BLTMODE_PIXELWIDTHMASK 0x30
|
|
||||||
#define CIRRUS_BLTMODE_PIXELWIDTH8 0x00
|
|
||||||
#define CIRRUS_BLTMODE_PIXELWIDTH16 0x10
|
|
||||||
#define CIRRUS_BLTMODE_PIXELWIDTH24 0x20
|
|
||||||
#define CIRRUS_BLTMODE_PIXELWIDTH32 0x30
|
|
||||||
|
|
||||||
// control 0x31
|
|
||||||
#define CIRRUS_BLT_BUSY 0x01
|
|
||||||
#define CIRRUS_BLT_START 0x02
|
|
||||||
#define CIRRUS_BLT_RESET 0x04
|
|
||||||
#define CIRRUS_BLT_FIFOUSED 0x10
|
|
||||||
#define CIRRUS_BLT_AUTOSTART 0x80
|
|
||||||
|
|
||||||
// control 0x32
|
|
||||||
#define CIRRUS_ROP_0 0x00
|
|
||||||
#define CIRRUS_ROP_SRC_AND_DST 0x05
|
|
||||||
#define CIRRUS_ROP_NOP 0x06
|
|
||||||
#define CIRRUS_ROP_SRC_AND_NOTDST 0x09
|
|
||||||
#define CIRRUS_ROP_NOTDST 0x0b
|
|
||||||
#define CIRRUS_ROP_SRC 0x0d
|
|
||||||
#define CIRRUS_ROP_1 0x0e
|
|
||||||
#define CIRRUS_ROP_NOTSRC_AND_DST 0x50
|
|
||||||
#define CIRRUS_ROP_SRC_XOR_DST 0x59
|
|
||||||
#define CIRRUS_ROP_SRC_OR_DST 0x6d
|
|
||||||
#define CIRRUS_ROP_NOTSRC_OR_NOTDST 0x90
|
|
||||||
#define CIRRUS_ROP_SRC_NOTXOR_DST 0x95
|
|
||||||
#define CIRRUS_ROP_SRC_OR_NOTDST 0xad
|
|
||||||
#define CIRRUS_ROP_NOTSRC 0xd0
|
|
||||||
#define CIRRUS_ROP_NOTSRC_OR_DST 0xd6
|
|
||||||
#define CIRRUS_ROP_NOTSRC_AND_NOTDST 0xda
|
|
||||||
|
|
||||||
#define CIRRUS_ROP_NOP_INDEX 2
|
|
||||||
#define CIRRUS_ROP_SRC_INDEX 5
|
|
||||||
|
|
||||||
// control 0x33
|
|
||||||
#define CIRRUS_BLTMODEEXT_SOLIDFILL 0x04
|
|
||||||
#define CIRRUS_BLTMODEEXT_COLOREXPINV 0x02
|
|
||||||
#define CIRRUS_BLTMODEEXT_DWORDGRANULARITY 0x01
|
|
||||||
|
|
||||||
// memory-mapped IO
|
|
||||||
#define CIRRUS_MMIO_BLTBGCOLOR 0x00 // dword
|
|
||||||
#define CIRRUS_MMIO_BLTFGCOLOR 0x04 // dword
|
|
||||||
#define CIRRUS_MMIO_BLTWIDTH 0x08 // word
|
|
||||||
#define CIRRUS_MMIO_BLTHEIGHT 0x0a // word
|
|
||||||
#define CIRRUS_MMIO_BLTDESTPITCH 0x0c // word
|
|
||||||
#define CIRRUS_MMIO_BLTSRCPITCH 0x0e // word
|
|
||||||
#define CIRRUS_MMIO_BLTDESTADDR 0x10 // dword
|
|
||||||
#define CIRRUS_MMIO_BLTSRCADDR 0x14 // dword
|
|
||||||
#define CIRRUS_MMIO_BLTWRITEMASK 0x17 // byte
|
|
||||||
#define CIRRUS_MMIO_BLTMODE 0x18 // byte
|
|
||||||
#define CIRRUS_MMIO_BLTROP 0x1a // byte
|
|
||||||
#define CIRRUS_MMIO_BLTMODEEXT 0x1b // byte
|
|
||||||
#define CIRRUS_MMIO_BLTTRANSPARENTCOLOR 0x1c // word?
|
|
||||||
#define CIRRUS_MMIO_BLTTRANSPARENTCOLORMASK 0x20 // word?
|
|
||||||
#define CIRRUS_MMIO_LINEARDRAW_START_X 0x24 // word
|
|
||||||
#define CIRRUS_MMIO_LINEARDRAW_START_Y 0x26 // word
|
|
||||||
#define CIRRUS_MMIO_LINEARDRAW_END_X 0x28 // word
|
|
||||||
#define CIRRUS_MMIO_LINEARDRAW_END_Y 0x2a // word
|
|
||||||
#define CIRRUS_MMIO_LINEARDRAW_LINESTYLE_INC 0x2c // byte
|
|
||||||
#define CIRRUS_MMIO_LINEARDRAW_LINESTYLE_ROLLOVER 0x2d // byte
|
|
||||||
#define CIRRUS_MMIO_LINEARDRAW_LINESTYLE_MASK 0x2e // byte
|
|
||||||
#define CIRRUS_MMIO_LINEARDRAW_LINESTYLE_ACCUM 0x2f // byte
|
|
||||||
#define CIRRUS_MMIO_BRESENHAM_K1 0x30 // word
|
|
||||||
#define CIRRUS_MMIO_BRESENHAM_K3 0x32 // word
|
|
||||||
#define CIRRUS_MMIO_BRESENHAM_ERROR 0x34 // word
|
|
||||||
#define CIRRUS_MMIO_BRESENHAM_DELTA_MAJOR 0x36 // word
|
|
||||||
#define CIRRUS_MMIO_BRESENHAM_DIRECTION 0x38 // byte
|
|
||||||
#define CIRRUS_MMIO_LINEDRAW_MODE 0x39 // byte
|
|
||||||
#define CIRRUS_MMIO_BLTSTATUS 0x40 // byte
|
|
||||||
|
|
||||||
#define CIRRUS_PNPMMIO_SIZE 0x1000
|
|
||||||
|
|
||||||
#define CIRRUS_BLTBUFSIZE (2048 * 4) /* one line width */
|
|
||||||
|
|
||||||
typedef struct clgd_t
|
|
||||||
{
|
|
||||||
mem_mapping_t mmio_mapping;
|
|
||||||
|
|
||||||
svga_t svga;
|
|
||||||
cl_ramdac_t ramdac;
|
|
||||||
|
|
||||||
rom_t bios_rom;
|
|
||||||
|
|
||||||
PALETTE hiddenpal;
|
|
||||||
|
|
||||||
uint32_t vram_size;
|
|
||||||
uint8_t vram_code;
|
|
||||||
|
|
||||||
uint32_t linear_mmio_mask;
|
|
||||||
|
|
||||||
uint32_t bank[2];
|
|
||||||
uint32_t limit[2];
|
|
||||||
|
|
||||||
uint32_t ramptr;
|
|
||||||
int src_counter;
|
|
||||||
uint8_t *src_ptr;
|
|
||||||
uint8_t *src_ptr_end;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint8_t bpp;
|
|
||||||
uint32_t bg_col, fg_col;
|
|
||||||
uint16_t width, height;
|
|
||||||
uint16_t dst_pitch, src_pitch;
|
|
||||||
int32_t dst_addr, src_addr;
|
|
||||||
uint8_t mask, mode, rop, modeext;
|
|
||||||
uint32_t blttc, blttcmask;
|
|
||||||
uint16_t ld_start_x, ld_start_y, ld_end_x, ld_end_y;
|
|
||||||
uint8_t ld_ls_inc, ld_ls_ro, ld_ls_mask, ld_ls_ac;
|
|
||||||
uint16_t bres_k1, bres_k3, bres_err, bres_dm;
|
|
||||||
uint8_t bres_dir, ld_mode, blt_status;
|
|
||||||
|
|
||||||
uint32_t dst_addr_backup, src_addr_backup;
|
|
||||||
uint16_t width_backup, height_internal;
|
|
||||||
int x_count;
|
|
||||||
uint8_t buf[CIRRUS_BLTBUFSIZE];
|
|
||||||
|
|
||||||
uint16_t pixel_width, pixel_height;
|
|
||||||
} blt;
|
|
||||||
} clgd_t;
|
|
||||||
|
|
||||||
typedef void (*cirrus_bitblt_rop_t) (clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t * dst, const uint8_t * src,
|
|
||||||
int dstpitch, int srcpitch,
|
|
||||||
int bltwidth, int bltheight);
|
|
||||||
|
|
||||||
typedef void (*cirrus_fill_t)(clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t *dst, int dst_pitch, int width, int height);
|
|
||||||
|
|
||||||
cirrus_bitblt_rop_t cirrus_rop;
|
|
||||||
|
|
||||||
extern device_t gd5422_device;
|
|
||||||
extern device_t gd5429_device;
|
|
||||||
extern device_t gd5430_device;
|
|
||||||
extern device_t dia5430_device;
|
|
||||||
extern device_t gd5434_device;
|
|
||||||
extern device_t gd5436_device;
|
|
||||||
extern device_t gd5440_device;
|
|
||||||
extern device_t gd5446_device;
|
|
||||||
extern device_t gd6235_device;
|
|
||||||
|
|
||||||
clgd_t *clgd;
|
|
||||||
|
|
||||||
void clgd_recalctimings(svga_t *svga);
|
|
||||||
|
|
||||||
void cirrus_update_memory_access(clgd_t *clgd);
|
|
||||||
|
|
||||||
void cirrus_write(uint32_t addr, uint8_t val, void *p);
|
|
||||||
uint8_t cirrus_read(uint32_t addr, void *p);
|
|
||||||
@@ -1,847 +0,0 @@
|
|||||||
/*
|
|
||||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
||||||
* running old operating systems and software designed for IBM
|
|
||||||
* PC systems and compatibles from 1981 through fairly recent
|
|
||||||
* system designs based on the PCI bus.
|
|
||||||
*
|
|
||||||
* This file is part of the 86Box distribution.
|
|
||||||
*
|
|
||||||
* This is the CL-GD 5446 blitter, directly from QEMU.
|
|
||||||
*
|
|
||||||
* Version: @(#)vid_cl_gd_blit.c 1.0.2 2017/11/04
|
|
||||||
*
|
|
||||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
|
||||||
*
|
|
||||||
* Copyright 2016,2017 Miran Grca.
|
|
||||||
*/
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#include "../86box.h"
|
|
||||||
#include "../io.h"
|
|
||||||
#include "../mem.h"
|
|
||||||
#include "../rom.h"
|
|
||||||
#include "../device.h"
|
|
||||||
#include "video.h"
|
|
||||||
#include "vid_svga.h"
|
|
||||||
#include "vid_svga_render.h"
|
|
||||||
#include "vid_cl_ramdac.h"
|
|
||||||
#include "vid_cl_gd.h"
|
|
||||||
#include "vid_cl_gd_blit.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Same for all the svga->vrammask which are -s>cirrus_addr_mask in the original.
|
|
||||||
|
|
||||||
// Eventually this needs to be configurable
|
|
||||||
#define clgd_vram_size clgd->vram_size
|
|
||||||
|
|
||||||
#define true 1
|
|
||||||
#define false 0
|
|
||||||
#define bool int
|
|
||||||
|
|
||||||
#define glue(a,b) glue_hidden(a,b)
|
|
||||||
#define glue_hidden(a,b) a ## b
|
|
||||||
|
|
||||||
static uint8_t rop_to_index[256];
|
|
||||||
|
|
||||||
int cl_gd_ABS(int sval)
|
|
||||||
{
|
|
||||||
if (sval < 0)
|
|
||||||
{
|
|
||||||
return -sval;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return sval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool blit_region_is_unsafe(clgd_t *clgd, svga_t *svga, int32_t pitch, int32_t addr)
|
|
||||||
{
|
|
||||||
if (pitch < 0)
|
|
||||||
{
|
|
||||||
int64_t min = addr + ((int64_t)clgd->blt.height-1) * pitch;
|
|
||||||
int32_t max = addr + clgd->blt.width;
|
|
||||||
if (min < 0 || max >= clgd_vram_size) return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int64_t max = addr + ((int64_t)clgd->blt.height-1) * pitch + clgd->blt.width;
|
|
||||||
if (max >= clgd_vram_size) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool blit_is_unsafe(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
if (clgd->blt.width > 0) fatal("CL-clgd: Blit width is 0!\n");
|
|
||||||
if (clgd->blt.height > 0) fatal("CL-clgd: Blit height is 0!\n");
|
|
||||||
|
|
||||||
if (clgd->blt.width > CIRRUS_BLTBUFSIZE) return true;
|
|
||||||
|
|
||||||
if (blit_region_is_unsafe(clgd, svga, clgd->blt.dst_pitch, clgd->blt.dst_addr & svga->vram_display_mask)) return true;
|
|
||||||
if (blit_region_is_unsafe(clgd, svga, clgd->blt.src_pitch, clgd->blt.src_addr & svga->vram_display_mask)) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cirrus_bitblt_rop_nop(clgd_t *clgd, svga_t *svga, uint8_t *dst, const uint8_t *src, int dstpitch, int srcpitch, int bltwidth, int bltheight)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cirrus_bitblt_fill_nop(clgd_t *clgd, svga_t *svga, uint8_t *dst, int dstpitch, int bltwidth, int bltheight)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ROP_NAME 0
|
|
||||||
#define ROP_FN(d, s) 0
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME src_and_dst
|
|
||||||
#define ROP_FN(d, s) (s) & (d)
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME src_and_notdst
|
|
||||||
#define ROP_FN(d, s) (s) & (~(d))
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME notdst
|
|
||||||
#define ROP_FN(d, s) ~(d)
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME src
|
|
||||||
#define ROP_FN(d, s) s
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME 1
|
|
||||||
#define ROP_FN(d, s) ~0
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME notsrc_and_dst
|
|
||||||
#define ROP_FN(d, s) (~(s)) & (d)
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME src_xor_dst
|
|
||||||
#define ROP_FN(d, s) (s) ^ (d)
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME src_or_dst
|
|
||||||
#define ROP_FN(d, s) (s) | (d)
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME notsrc_or_notdst
|
|
||||||
#define ROP_FN(d, s) (~(s)) | (~(d))
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME src_notxor_dst
|
|
||||||
#define ROP_FN(d, s) ~((s) ^ (d))
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME src_or_notdst
|
|
||||||
#define ROP_FN(d, s) (s) | (~(d))
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME notsrc
|
|
||||||
#define ROP_FN(d, s) (~(s))
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME notsrc_or_dst
|
|
||||||
#define ROP_FN(d, s) (~(s)) | (d)
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
#define ROP_NAME notsrc_and_notdst
|
|
||||||
#define ROP_FN(d, s) (~(s)) & (~(d))
|
|
||||||
#include "vid_cl_gd_vga_rop.h"
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_fwd_rop[16] = {
|
|
||||||
cirrus_bitblt_rop_fwd_0,
|
|
||||||
cirrus_bitblt_rop_fwd_src_and_dst,
|
|
||||||
cirrus_bitblt_rop_nop,
|
|
||||||
cirrus_bitblt_rop_fwd_src_and_notdst,
|
|
||||||
cirrus_bitblt_rop_fwd_notdst,
|
|
||||||
cirrus_bitblt_rop_fwd_src,
|
|
||||||
cirrus_bitblt_rop_fwd_1,
|
|
||||||
cirrus_bitblt_rop_fwd_notsrc_and_dst,
|
|
||||||
cirrus_bitblt_rop_fwd_src_xor_dst,
|
|
||||||
cirrus_bitblt_rop_fwd_src_or_dst,
|
|
||||||
cirrus_bitblt_rop_fwd_notsrc_or_notdst,
|
|
||||||
cirrus_bitblt_rop_fwd_src_notxor_dst,
|
|
||||||
cirrus_bitblt_rop_fwd_src_or_notdst,
|
|
||||||
cirrus_bitblt_rop_fwd_notsrc,
|
|
||||||
cirrus_bitblt_rop_fwd_notsrc_or_dst,
|
|
||||||
cirrus_bitblt_rop_fwd_notsrc_and_notdst,
|
|
||||||
};
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_bkwd_rop[16] = {
|
|
||||||
cirrus_bitblt_rop_bkwd_0,
|
|
||||||
cirrus_bitblt_rop_bkwd_src_and_dst,
|
|
||||||
cirrus_bitblt_rop_nop,
|
|
||||||
cirrus_bitblt_rop_bkwd_src_and_notdst,
|
|
||||||
cirrus_bitblt_rop_bkwd_notdst,
|
|
||||||
cirrus_bitblt_rop_bkwd_src,
|
|
||||||
cirrus_bitblt_rop_bkwd_1,
|
|
||||||
cirrus_bitblt_rop_bkwd_notsrc_and_dst,
|
|
||||||
cirrus_bitblt_rop_bkwd_src_xor_dst,
|
|
||||||
cirrus_bitblt_rop_bkwd_src_or_dst,
|
|
||||||
cirrus_bitblt_rop_bkwd_notsrc_or_notdst,
|
|
||||||
cirrus_bitblt_rop_bkwd_src_notxor_dst,
|
|
||||||
cirrus_bitblt_rop_bkwd_src_or_notdst,
|
|
||||||
cirrus_bitblt_rop_bkwd_notsrc,
|
|
||||||
cirrus_bitblt_rop_bkwd_notsrc_or_dst,
|
|
||||||
cirrus_bitblt_rop_bkwd_notsrc_and_notdst,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define TRANSP_ROP(name) {\
|
|
||||||
name ## _8,\
|
|
||||||
name ## _16,\
|
|
||||||
}
|
|
||||||
#define TRANSP_NOP(func) {\
|
|
||||||
func,\
|
|
||||||
func,\
|
|
||||||
}
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_fwd_transp_rop[16][2] = {
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_0),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_src_and_dst),
|
|
||||||
TRANSP_NOP(cirrus_bitblt_rop_nop),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_src_and_notdst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_notdst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_src),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_1),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_notsrc_and_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_src_xor_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_src_or_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_notsrc_or_notdst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_src_notxor_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_src_or_notdst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_notsrc),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_notsrc_or_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_fwd_transp_notsrc_and_notdst),
|
|
||||||
};
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_bkwd_transp_rop[16][2] = {
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_0),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_src_and_dst),
|
|
||||||
TRANSP_NOP(cirrus_bitblt_rop_nop),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_src_and_notdst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_notdst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_src),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_1),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_notsrc_and_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_src_xor_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_src_or_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_notsrc_or_notdst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_src_notxor_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_src_or_notdst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_notsrc),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_notsrc_or_dst),
|
|
||||||
TRANSP_ROP(cirrus_bitblt_rop_bkwd_transp_notsrc_and_notdst),
|
|
||||||
};
|
|
||||||
|
|
||||||
#define ROP2(name) {\
|
|
||||||
name ## _8,\
|
|
||||||
name ## _16,\
|
|
||||||
name ## _24,\
|
|
||||||
name ## _32,\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ROP_NOP2(func) {\
|
|
||||||
func,\
|
|
||||||
func,\
|
|
||||||
func,\
|
|
||||||
func,\
|
|
||||||
}
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_patternfill[16][4] = {
|
|
||||||
ROP2(cirrus_patternfill_0),
|
|
||||||
ROP2(cirrus_patternfill_src_and_dst),
|
|
||||||
ROP_NOP2(cirrus_bitblt_rop_nop),
|
|
||||||
ROP2(cirrus_patternfill_src_and_notdst),
|
|
||||||
ROP2(cirrus_patternfill_notdst),
|
|
||||||
ROP2(cirrus_patternfill_src),
|
|
||||||
ROP2(cirrus_patternfill_1),
|
|
||||||
ROP2(cirrus_patternfill_notsrc_and_dst),
|
|
||||||
ROP2(cirrus_patternfill_src_xor_dst),
|
|
||||||
ROP2(cirrus_patternfill_src_or_dst),
|
|
||||||
ROP2(cirrus_patternfill_notsrc_or_notdst),
|
|
||||||
ROP2(cirrus_patternfill_src_notxor_dst),
|
|
||||||
ROP2(cirrus_patternfill_src_or_notdst),
|
|
||||||
ROP2(cirrus_patternfill_notsrc),
|
|
||||||
ROP2(cirrus_patternfill_notsrc_or_dst),
|
|
||||||
ROP2(cirrus_patternfill_notsrc_and_notdst),
|
|
||||||
};
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_colorexpand_transp[16][4] = {
|
|
||||||
ROP2(cirrus_colorexpand_transp_0),
|
|
||||||
ROP2(cirrus_colorexpand_transp_src_and_dst),
|
|
||||||
ROP_NOP2(cirrus_bitblt_rop_nop),
|
|
||||||
ROP2(cirrus_colorexpand_transp_src_and_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_src),
|
|
||||||
ROP2(cirrus_colorexpand_transp_1),
|
|
||||||
ROP2(cirrus_colorexpand_transp_notsrc_and_dst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_src_xor_dst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_src_or_dst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_notsrc_or_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_src_notxor_dst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_src_or_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_notsrc),
|
|
||||||
ROP2(cirrus_colorexpand_transp_notsrc_or_dst),
|
|
||||||
ROP2(cirrus_colorexpand_transp_notsrc_and_notdst),
|
|
||||||
};
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_colorexpand[16][4] = {
|
|
||||||
ROP2(cirrus_colorexpand_0),
|
|
||||||
ROP2(cirrus_colorexpand_src_and_dst),
|
|
||||||
ROP_NOP2(cirrus_bitblt_rop_nop),
|
|
||||||
ROP2(cirrus_colorexpand_src_and_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_src),
|
|
||||||
ROP2(cirrus_colorexpand_1),
|
|
||||||
ROP2(cirrus_colorexpand_notsrc_and_dst),
|
|
||||||
ROP2(cirrus_colorexpand_src_xor_dst),
|
|
||||||
ROP2(cirrus_colorexpand_src_or_dst),
|
|
||||||
ROP2(cirrus_colorexpand_notsrc_or_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_src_notxor_dst),
|
|
||||||
ROP2(cirrus_colorexpand_src_or_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_notsrc),
|
|
||||||
ROP2(cirrus_colorexpand_notsrc_or_dst),
|
|
||||||
ROP2(cirrus_colorexpand_notsrc_and_notdst),
|
|
||||||
};
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_colorexpand_pattern_transp[16][4] = {
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_0),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_src_and_dst),
|
|
||||||
ROP_NOP2(cirrus_bitblt_rop_nop),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_src_and_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_src),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_1),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_notsrc_and_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_src_xor_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_src_or_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_notsrc_or_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_src_notxor_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_src_or_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_notsrc),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_notsrc_or_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_transp_notsrc_and_notdst),
|
|
||||||
};
|
|
||||||
|
|
||||||
const cirrus_bitblt_rop_t cirrus_colorexpand_pattern[16][4] = {
|
|
||||||
ROP2(cirrus_colorexpand_pattern_0),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_src_and_dst),
|
|
||||||
ROP_NOP2(cirrus_bitblt_rop_nop),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_src_and_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_src),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_1),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_notsrc_and_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_src_xor_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_src_or_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_notsrc_or_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_src_notxor_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_src_or_notdst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_notsrc),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_notsrc_or_dst),
|
|
||||||
ROP2(cirrus_colorexpand_pattern_notsrc_and_notdst),
|
|
||||||
};
|
|
||||||
|
|
||||||
const cirrus_fill_t cirrus_fill[16][4] = {
|
|
||||||
ROP2(cirrus_fill_0),
|
|
||||||
ROP2(cirrus_fill_src_and_dst),
|
|
||||||
ROP_NOP2(cirrus_bitblt_fill_nop),
|
|
||||||
ROP2(cirrus_fill_src_and_notdst),
|
|
||||||
ROP2(cirrus_fill_notdst),
|
|
||||||
ROP2(cirrus_fill_src),
|
|
||||||
ROP2(cirrus_fill_1),
|
|
||||||
ROP2(cirrus_fill_notsrc_and_dst),
|
|
||||||
ROP2(cirrus_fill_src_xor_dst),
|
|
||||||
ROP2(cirrus_fill_src_or_dst),
|
|
||||||
ROP2(cirrus_fill_notsrc_or_notdst),
|
|
||||||
ROP2(cirrus_fill_src_notxor_dst),
|
|
||||||
ROP2(cirrus_fill_src_or_notdst),
|
|
||||||
ROP2(cirrus_fill_notsrc),
|
|
||||||
ROP2(cirrus_fill_notsrc_or_dst),
|
|
||||||
ROP2(cirrus_fill_notsrc_and_notdst),
|
|
||||||
};
|
|
||||||
|
|
||||||
inline void cirrus_bitblt_fgcol(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
unsigned int color;
|
|
||||||
switch (clgd->blt.pixel_width)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
clgd->blt.fg_col = (clgd->blt.fg_col & 0xffffff00);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
color = (clgd->blt.fg_col & 0xffff00ff) | (svga->gdcreg[0x11] << 8);
|
|
||||||
clgd->blt.fg_col = le16_to_cpu(color);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
clgd->blt.fg_col = (clgd->blt.fg_col & 0xff00ffff) | (svga->gdcreg[0x11] << 8) | (svga->gdcreg[0x13] << 16);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case 4:
|
|
||||||
color = (clgd->blt.fg_col & 0x00ffffff) | (svga->gdcreg[0x11] << 8) | (svga->gdcreg[0x13] << 16) | (svga->gdcreg[0x15] << 24);
|
|
||||||
clgd->blt.fg_col = le32_to_cpu(color);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void cirrus_bitblt_bgcol(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
unsigned int color;
|
|
||||||
switch (clgd->blt.pixel_width)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
clgd->blt.bg_col = (clgd->blt.bg_col & 0xffffff00);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
color = (clgd->blt.bg_col & 0xffff00ff) | (svga->gdcreg[0x10] << 8);
|
|
||||||
clgd->blt.bg_col = le16_to_cpu(color);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
clgd->blt.bg_col = (clgd->blt.bg_col & 0xff00ffff) | (svga->gdcreg[0x10] << 8) | (svga->gdcreg[0x12] << 16);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case 4:
|
|
||||||
color = (clgd->blt.bg_col & 0x00ffffff) | (svga->gdcreg[0x10] << 8) | (svga->gdcreg[0x12] << 16) | (svga->gdcreg[0x14] << 24);
|
|
||||||
clgd->blt.bg_col = le32_to_cpu(color);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cirrus_invalidate_region(clgd_t *clgd, svga_t *svga, int off_begin, int off_pitch, int bytesperline, int lines)
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
int off_cur;
|
|
||||||
int off_cur_end;
|
|
||||||
|
|
||||||
for (y = 0; y < lines; y++)
|
|
||||||
{
|
|
||||||
off_cur = off_begin;
|
|
||||||
off_cur_end = ((off_cur + bytesperline) & svga->vram_display_mask);
|
|
||||||
// Memory region set dirty
|
|
||||||
off_begin += off_pitch;
|
|
||||||
for (x = (off_cur >> 12); x <= (off_cur_end >> 12); x++)
|
|
||||||
{
|
|
||||||
svga->changedvram[x]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int cirrus_bitblt_common_patterncopy(clgd_t *clgd, svga_t *svga, const uint8_t * src)
|
|
||||||
{
|
|
||||||
uint8_t *dst;
|
|
||||||
|
|
||||||
dst = svga->vram + (clgd->blt.dst_addr & svga->vram_display_mask);
|
|
||||||
|
|
||||||
if (blit_is_unsafe(clgd, svga)) return 0;
|
|
||||||
|
|
||||||
(*cirrus_rop) (clgd, svga, dst, src, clgd->blt.dst_pitch, 0, clgd->blt.width, clgd->blt.height);
|
|
||||||
cirrus_invalidate_region(clgd, svga, clgd->blt.dst_addr, clgd->blt.dst_pitch, clgd->blt.width, clgd->blt.height);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fill */
|
|
||||||
|
|
||||||
int cirrus_bitblt_solidfill(clgd_t *clgd, svga_t *svga, int blt_rop)
|
|
||||||
{
|
|
||||||
cirrus_fill_t rop_func;
|
|
||||||
|
|
||||||
if (blit_is_unsafe(clgd, svga)) return 0;
|
|
||||||
|
|
||||||
rop_func = cirrus_fill[rop_to_index[blt_rop]][clgd->blt.pixel_width - 1];
|
|
||||||
rop_func(clgd, svga, svga->vram + (clgd->blt.dst_addr & svga->vram_display_mask), clgd->blt.dst_pitch, clgd->blt.width, clgd->blt.height);
|
|
||||||
cirrus_invalidate_region(clgd, svga, clgd->blt.dst_addr, clgd->blt.dst_pitch, clgd->blt.width, clgd->blt.height);
|
|
||||||
cirrus_bitblt_reset(clgd, svga);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cirrus_bitblt_videotovideo_patterncopy(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
return cirrus_bitblt_common_patterncopy(clgd, svga, svga->vram + ((clgd->blt.src_addr & ~7) & svga->vram_display_mask));
|
|
||||||
}
|
|
||||||
|
|
||||||
void cirrus_do_copy(clgd_t *clgd, svga_t *svga, int dst, int src, int w, int h)
|
|
||||||
{
|
|
||||||
int sx = 0, sy = 0;
|
|
||||||
int dx = 0, dy = 0;
|
|
||||||
int notify = 0;
|
|
||||||
|
|
||||||
/* make sure to only copy if it's a plain copy ROP */
|
|
||||||
if (*cirrus_rop == cirrus_bitblt_rop_fwd_src ||
|
|
||||||
*cirrus_rop == cirrus_bitblt_rop_bkwd_src)
|
|
||||||
{
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
clgd_recalctimings(svga);
|
|
||||||
width = svga->video_res_x;
|
|
||||||
height = svga->video_res_y;
|
|
||||||
|
|
||||||
/* extra x, y */
|
|
||||||
sx = (src % cl_gd_ABS(clgd->blt.src_pitch)) / svga->bpp;
|
|
||||||
sy = (src / cl_gd_ABS(clgd->blt.src_pitch));
|
|
||||||
dx = (dst % cl_gd_ABS(clgd->blt.dst_pitch)) / svga->bpp;
|
|
||||||
dy = (dst / cl_gd_ABS(clgd->blt.dst_pitch));
|
|
||||||
|
|
||||||
/* normalize width */
|
|
||||||
w /= svga->bpp;
|
|
||||||
|
|
||||||
/* if we're doing a backward copy, we have to adjust
|
|
||||||
our x/y to be the upper left corner (instead of the lower right corner) */
|
|
||||||
if (clgd->blt.dst_pitch < 0)
|
|
||||||
{
|
|
||||||
sx -= (clgd->blt.width / svga->bpp) - 1;
|
|
||||||
dx -= (clgd->blt.width / svga->bpp) - 1;
|
|
||||||
sy -= clgd->blt.height - 1;
|
|
||||||
dy -= clgd->blt.height - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* are we in the visible portion of memory? */
|
|
||||||
if (sx >= 0 && sy >= 0 && dx >= 0 && dy >= 0 &&
|
|
||||||
(sx + w) <= width && (sy + h) <= height &&
|
|
||||||
(dx + w) <= width && (dy + h) <= height)
|
|
||||||
{
|
|
||||||
notify = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we have to flush all prending changes so that the copy
|
|
||||||
is generated at the appropriate moment in time */
|
|
||||||
if (notify)
|
|
||||||
{
|
|
||||||
svga->fullchange = changeframecount;
|
|
||||||
svga_recalctimings(svga);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we don't have to notify the display that this portion has
|
|
||||||
changed since qemu_console_copy implies this */
|
|
||||||
|
|
||||||
cirrus_invalidate_region(clgd, svga, clgd->blt.dst_addr, clgd->blt.dst_pitch, clgd->blt.width, clgd->blt.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
int cirrus_bitblt_videotovideo_copy(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
if (blit_is_unsafe(clgd, svga)) return 0;
|
|
||||||
|
|
||||||
cirrus_do_copy(clgd, svga, clgd->blt.dst_addr - svga->firstline, clgd->blt.src_addr - svga->firstline,
|
|
||||||
clgd->blt.width, clgd->blt.height);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cirrus_bitblt_cputovideo_next(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
int copy_count;
|
|
||||||
uint8_t *end_ptr;
|
|
||||||
|
|
||||||
if (clgd->src_counter > 0)
|
|
||||||
{
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_PATTERNCOPY)
|
|
||||||
{
|
|
||||||
cirrus_bitblt_common_patterncopy(clgd, svga, clgd->blt.buf);
|
|
||||||
the_end:
|
|
||||||
clgd->src_counter = 0;
|
|
||||||
cirrus_bitblt_reset(clgd, svga);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* at least one scan line */
|
|
||||||
do
|
|
||||||
{
|
|
||||||
(*cirrus_rop)(clgd, svga, svga->vram + (clgd->blt.dst_addr & svga->vram_display_mask), clgd->blt.buf, 0, 0, clgd->blt.width, 1);
|
|
||||||
cirrus_invalidate_region(clgd, svga, clgd->blt.dst_addr, 0 , clgd->blt.width, 1);
|
|
||||||
clgd->blt.dst_addr += clgd->blt.dst_pitch;
|
|
||||||
clgd->src_counter -= clgd->blt.src_pitch;
|
|
||||||
if (clgd->src_counter <= 0) goto the_end;
|
|
||||||
/* more bytes than needed can be transferred because of
|
|
||||||
word alignment, so we keep them for the next line */
|
|
||||||
/* XXX: keep alignment to speed up transfer */
|
|
||||||
end_ptr = clgd->blt.buf + clgd->blt.src_pitch;
|
|
||||||
copy_count = clgd->src_ptr_end - end_ptr;
|
|
||||||
memmove(clgd->blt.buf, end_ptr, copy_count);
|
|
||||||
clgd->src_ptr = clgd->blt.buf + copy_count;
|
|
||||||
clgd->src_ptr_end = clgd->blt.buf + clgd->blt.src_pitch;
|
|
||||||
}
|
|
||||||
while (clgd->src_ptr >= clgd->src_ptr_end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cirrus_bitblt_reset(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
int need_update;
|
|
||||||
|
|
||||||
svga->gdcreg[0x31] &= ~(CIRRUS_BLT_START | CIRRUS_BLT_BUSY | CIRRUS_BLT_FIFOUSED);
|
|
||||||
need_update = clgd->src_ptr != &clgd->blt.buf[0]
|
|
||||||
|| clgd->src_ptr_end != &clgd->blt.buf[0];
|
|
||||||
clgd->src_ptr = &clgd->blt.buf[0];
|
|
||||||
clgd->src_ptr_end = &clgd->blt.buf[0];
|
|
||||||
clgd->src_counter = 0;
|
|
||||||
if (!need_update)
|
|
||||||
return;
|
|
||||||
mem_mapping_set_handler(&clgd->svga.mapping, cirrus_read, NULL, NULL, cirrus_write, NULL, NULL);
|
|
||||||
mem_mapping_set_p(&clgd->svga.mapping, clgd);
|
|
||||||
cirrus_update_memory_access(clgd);
|
|
||||||
}
|
|
||||||
|
|
||||||
int cirrus_bitblt_cputovideo(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
int w;
|
|
||||||
|
|
||||||
clgd->blt.mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;
|
|
||||||
clgd->src_ptr = &clgd->blt.buf[0];
|
|
||||||
clgd->src_ptr_end = &clgd->blt.buf[0];
|
|
||||||
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_PATTERNCOPY)
|
|
||||||
{
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_COLOREXPAND)
|
|
||||||
{
|
|
||||||
clgd->blt.src_pitch = 8;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* XXX: check for 24 bpp */
|
|
||||||
clgd->blt.src_pitch = 8 * 8 * clgd->blt.pixel_width;
|
|
||||||
}
|
|
||||||
clgd->src_counter = clgd->blt.src_pitch;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_COLOREXPAND)
|
|
||||||
{
|
|
||||||
w = clgd->blt.width / clgd->blt.pixel_width;
|
|
||||||
if (clgd->blt.modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)
|
|
||||||
clgd->blt.src_pitch = ((w + 31) >> 5);
|
|
||||||
else
|
|
||||||
clgd->blt.src_pitch = ((w + 7) >> 3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* always align input size to 32 bit */
|
|
||||||
clgd->blt.src_pitch = (clgd->blt.width + 3) & ~3;
|
|
||||||
}
|
|
||||||
clgd->src_counter = clgd->blt.src_pitch * clgd->blt.height;
|
|
||||||
}
|
|
||||||
clgd->src_ptr = clgd->blt.buf;
|
|
||||||
clgd->src_ptr_end = clgd->blt.buf + clgd->blt.src_pitch;
|
|
||||||
cirrus_update_memory_access(clgd);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cirrus_bitblt_videotocpu(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
/* XXX */
|
|
||||||
#ifdef DEBUG_BITBLT
|
|
||||||
printf("cirrus: bitblt (video to cpu) is not implemented yet\n");
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cirrus_bitblt_videotovideo(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_PATTERNCOPY)
|
|
||||||
{
|
|
||||||
ret = cirrus_bitblt_videotovideo_patterncopy(clgd, svga);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = cirrus_bitblt_videotovideo_copy(clgd, svga);
|
|
||||||
}
|
|
||||||
if (ret)
|
|
||||||
cirrus_bitblt_reset(clgd, svga);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cirrus_bitblt_start(clgd_t *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
uint8_t blt_rop;
|
|
||||||
|
|
||||||
svga->gdcreg[0x31] |= CIRRUS_BLT_BUSY;
|
|
||||||
|
|
||||||
clgd->blt.width = (svga->gdcreg[0x20] | (svga->gdcreg[0x21] << 8)) + 1;
|
|
||||||
clgd->blt.height = (svga->gdcreg[0x22] | (svga->gdcreg[0x23] << 8)) + 1;
|
|
||||||
clgd->blt.dst_pitch = (svga->gdcreg[0x24] | (svga->gdcreg[0x25] << 8));
|
|
||||||
clgd->blt.src_pitch = (svga->gdcreg[0x26] | (svga->gdcreg[0x27] << 8));
|
|
||||||
clgd->blt.dst_addr = (svga->gdcreg[0x28] | (svga->gdcreg[0x29] << 8) | (svga->gdcreg[0x2a] << 16));
|
|
||||||
clgd->blt.src_addr = (svga->gdcreg[0x2c] | (svga->gdcreg[0x2d] << 8) | (svga->gdcreg[0x2e] << 16));
|
|
||||||
clgd->blt.mode = svga->gdcreg[0x30];
|
|
||||||
clgd->blt.modeext = svga->gdcreg[0x33];
|
|
||||||
blt_rop = svga->gdcreg[0x32];
|
|
||||||
|
|
||||||
switch (clgd->blt.mode & CIRRUS_BLTMODE_PIXELWIDTHMASK)
|
|
||||||
{
|
|
||||||
case CIRRUS_BLTMODE_PIXELWIDTH8:
|
|
||||||
clgd->blt.pixel_width = 1;
|
|
||||||
break;
|
|
||||||
case CIRRUS_BLTMODE_PIXELWIDTH16:
|
|
||||||
clgd->blt.pixel_width = 2;
|
|
||||||
break;
|
|
||||||
case CIRRUS_BLTMODE_PIXELWIDTH24:
|
|
||||||
clgd->blt.pixel_width = 3;
|
|
||||||
break;
|
|
||||||
case CIRRUS_BLTMODE_PIXELWIDTH32:
|
|
||||||
clgd->blt.pixel_width = 4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
goto bitblt_ignore;
|
|
||||||
}
|
|
||||||
clgd->blt.mode &= ~CIRRUS_BLTMODE_PIXELWIDTHMASK;
|
|
||||||
|
|
||||||
if ((clgd->blt.mode & (CIRRUS_BLTMODE_MEMSYSSRC | CIRRUS_BLTMODE_MEMSYSDEST)) == (CIRRUS_BLTMODE_MEMSYSSRC | CIRRUS_BLTMODE_MEMSYSDEST))
|
|
||||||
{
|
|
||||||
goto bitblt_ignore;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((clgd->blt.modeext & CIRRUS_BLTMODEEXT_SOLIDFILL) &&
|
|
||||||
(clgd->blt.mode & (CIRRUS_BLTMODE_MEMSYSDEST | CIRRUS_BLTMODE_TRANSPARENTCOMP | CIRRUS_BLTMODE_PATTERNCOPY | CIRRUS_BLTMODE_COLOREXPAND)) ==
|
|
||||||
(CIRRUS_BLTMODE_PATTERNCOPY | CIRRUS_BLTMODE_COLOREXPAND))
|
|
||||||
{
|
|
||||||
cirrus_bitblt_fgcol(clgd, svga);
|
|
||||||
cirrus_bitblt_solidfill(clgd, svga, blt_rop);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((clgd->blt.mode & (CIRRUS_BLTMODE_COLOREXPAND | CIRRUS_BLTMODE_PATTERNCOPY)) == CIRRUS_BLTMODE_COLOREXPAND)
|
|
||||||
{
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP)
|
|
||||||
{
|
|
||||||
if (clgd->blt.modeext & CIRRUS_BLTMODEEXT_COLOREXPINV)
|
|
||||||
cirrus_bitblt_bgcol(clgd, svga);
|
|
||||||
else
|
|
||||||
cirrus_bitblt_fgcol(clgd, svga);
|
|
||||||
cirrus_rop = cirrus_colorexpand_transp[rop_to_index[blt_rop]][clgd->blt.pixel_width - 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cirrus_bitblt_fgcol(clgd, svga);
|
|
||||||
cirrus_bitblt_bgcol(clgd, svga);
|
|
||||||
cirrus_rop = cirrus_colorexpand[rop_to_index[blt_rop]][clgd->blt.pixel_width - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (clgd->blt.mode & CIRRUS_BLTMODE_PATTERNCOPY)
|
|
||||||
{
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_COLOREXPAND)
|
|
||||||
{
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP)
|
|
||||||
{
|
|
||||||
if (clgd->blt.modeext & CIRRUS_BLTMODEEXT_COLOREXPINV)
|
|
||||||
cirrus_bitblt_bgcol(clgd, svga);
|
|
||||||
else
|
|
||||||
cirrus_bitblt_fgcol(clgd, svga);
|
|
||||||
cirrus_rop = cirrus_colorexpand_pattern_transp[rop_to_index[blt_rop]][clgd->blt.pixel_width - 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cirrus_bitblt_fgcol(clgd, svga);
|
|
||||||
cirrus_bitblt_bgcol(clgd, svga);
|
|
||||||
cirrus_rop = cirrus_colorexpand_pattern[rop_to_index[blt_rop]][clgd->blt.pixel_width - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cirrus_rop = cirrus_patternfill[rop_to_index[blt_rop]][clgd->blt.pixel_width - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP)
|
|
||||||
{
|
|
||||||
if (clgd->blt.pixel_width > 2)
|
|
||||||
{
|
|
||||||
goto bitblt_ignore;
|
|
||||||
}
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_BACKWARDS)
|
|
||||||
{
|
|
||||||
clgd->blt.dst_pitch = -clgd->blt.dst_pitch;
|
|
||||||
clgd->blt.src_pitch = -clgd->blt.src_pitch;
|
|
||||||
cirrus_rop = cirrus_bkwd_transp_rop[rop_to_index[blt_rop]][clgd->blt.pixel_width - 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cirrus_rop = cirrus_fwd_transp_rop[rop_to_index[blt_rop]][clgd->blt.pixel_width - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_BACKWARDS)
|
|
||||||
{
|
|
||||||
clgd->blt.dst_pitch = -clgd->blt.dst_pitch;
|
|
||||||
clgd->blt.src_pitch = -clgd->blt.src_pitch;
|
|
||||||
cirrus_rop = cirrus_bkwd_rop[rop_to_index[blt_rop]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cirrus_rop = cirrus_fwd_rop[rop_to_index[blt_rop]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// setup bitblt engine.
|
|
||||||
if (clgd->blt.mode & CIRRUS_BLTMODE_MEMSYSSRC)
|
|
||||||
{
|
|
||||||
if (!cirrus_bitblt_cputovideo(clgd, svga)) goto bitblt_ignore;
|
|
||||||
}
|
|
||||||
else if (clgd->blt.mode & CIRRUS_BLTMODE_MEMSYSDEST)
|
|
||||||
{
|
|
||||||
if (!cirrus_bitblt_videotocpu(clgd, svga)) goto bitblt_ignore;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!cirrus_bitblt_videotovideo(clgd, svga)) goto bitblt_ignore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
bitblt_ignore:;
|
|
||||||
cirrus_bitblt_reset(clgd, svga);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cirrus_write_bitblt(clgd_t *clgd, svga_t *svga, uint8_t reg_value)
|
|
||||||
{
|
|
||||||
uint8_t old_value;
|
|
||||||
|
|
||||||
old_value = svga->gdcreg[0x31];
|
|
||||||
svga->gdcreg[0x31] = reg_value;
|
|
||||||
|
|
||||||
if (((old_value & CIRRUS_BLT_RESET) != 0) &&
|
|
||||||
((reg_value & CIRRUS_BLT_RESET) == 0))
|
|
||||||
{
|
|
||||||
cirrus_bitblt_reset(clgd, svga);
|
|
||||||
}
|
|
||||||
else if (((old_value & CIRRUS_BLT_START) == 0) &&
|
|
||||||
((reg_value & CIRRUS_BLT_START) != 0))
|
|
||||||
{
|
|
||||||
cirrus_bitblt_start(clgd, svga);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void init_rops()
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
for(i = 0;i < 256; i++)
|
|
||||||
rop_to_index[i] = CIRRUS_ROP_NOP_INDEX; /* nop rop */
|
|
||||||
rop_to_index[CIRRUS_ROP_0] = 0;
|
|
||||||
rop_to_index[CIRRUS_ROP_SRC_AND_DST] = 1;
|
|
||||||
rop_to_index[CIRRUS_ROP_NOP] = 2;
|
|
||||||
rop_to_index[CIRRUS_ROP_SRC_AND_NOTDST] = 3;
|
|
||||||
rop_to_index[CIRRUS_ROP_NOTDST] = 4;
|
|
||||||
rop_to_index[CIRRUS_ROP_SRC] = 5;
|
|
||||||
rop_to_index[CIRRUS_ROP_1] = 6;
|
|
||||||
rop_to_index[CIRRUS_ROP_NOTSRC_AND_DST] = 7;
|
|
||||||
rop_to_index[CIRRUS_ROP_SRC_XOR_DST] = 8;
|
|
||||||
rop_to_index[CIRRUS_ROP_SRC_OR_DST] = 9;
|
|
||||||
rop_to_index[CIRRUS_ROP_NOTSRC_OR_NOTDST] = 10;
|
|
||||||
rop_to_index[CIRRUS_ROP_SRC_NOTXOR_DST] = 11;
|
|
||||||
rop_to_index[CIRRUS_ROP_SRC_OR_NOTDST] = 12;
|
|
||||||
rop_to_index[CIRRUS_ROP_NOTSRC] = 13;
|
|
||||||
rop_to_index[CIRRUS_ROP_NOTSRC_OR_DST] = 14;
|
|
||||||
rop_to_index[CIRRUS_ROP_NOTSRC_AND_NOTDST] = 15;
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#define le32_to_cpu(x) (x)
|
|
||||||
#define le16_to_cpu(x) (x)
|
|
||||||
|
|
||||||
void cirrus_bitblt_cputovideo_next(clgd_t *clgd, svga_t *svga);
|
|
||||||
void cirrus_bitblt_reset(clgd_t *clgd, svga_t *svga);
|
|
||||||
void cirrus_bitblt_start(clgd_t *clgd, svga_t *svga);
|
|
||||||
void cirrus_write_bitblt(clgd_t *clgd, svga_t *svga, uint8_t reg_value);
|
|
||||||
void init_rops();
|
|
||||||
@@ -1,207 +0,0 @@
|
|||||||
/*
|
|
||||||
* QEMU Cirrus CLGD 54xx VGA Emulator.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2004 Fabrice Bellard
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
inline void glue(rop_8_,ROP_NAME)(uint8_t *dst, uint8_t src)
|
|
||||||
{
|
|
||||||
*dst = ROP_FN(*dst, src);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void glue(rop_16_,ROP_NAME)(uint16_t *dst, uint16_t src)
|
|
||||||
{
|
|
||||||
*dst = ROP_FN(*dst, src);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void glue(rop_32_,ROP_NAME)(uint32_t *dst, uint32_t src)
|
|
||||||
{
|
|
||||||
*dst = ROP_FN(*dst, src);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ROP_OP(d, s) glue(rop_8_,ROP_NAME)(d, s)
|
|
||||||
#define ROP_OP_16(d, s) glue(rop_16_,ROP_NAME)(d, s)
|
|
||||||
#define ROP_OP_32(d, s) glue(rop_32_,ROP_NAME)(d, s)
|
|
||||||
#undef ROP_FN
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t *dst,const uint8_t *src,
|
|
||||||
int dstpitch,int srcpitch,
|
|
||||||
int bltwidth,int bltheight)
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
dstpitch -= bltwidth;
|
|
||||||
srcpitch -= bltwidth;
|
|
||||||
|
|
||||||
if (bltheight > 1 && (dstpitch < 0 || srcpitch < 0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (y = 0; y < bltheight; y++) {
|
|
||||||
for (x = 0; x < bltwidth; x++) {
|
|
||||||
ROP_OP(dst, *src);
|
|
||||||
dst++;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
dst += dstpitch;
|
|
||||||
src += srcpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(cirrus_bitblt_rop_bkwd_, ROP_NAME)(clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t *dst,const uint8_t *src,
|
|
||||||
int dstpitch,int srcpitch,
|
|
||||||
int bltwidth,int bltheight)
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
dstpitch += bltwidth;
|
|
||||||
srcpitch += bltwidth;
|
|
||||||
for (y = 0; y < bltheight; y++) {
|
|
||||||
for (x = 0; x < bltwidth; x++) {
|
|
||||||
ROP_OP(dst, *src);
|
|
||||||
dst--;
|
|
||||||
src--;
|
|
||||||
}
|
|
||||||
dst += dstpitch;
|
|
||||||
src += srcpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_8)(clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t *dst,const uint8_t *src,
|
|
||||||
int dstpitch,int srcpitch,
|
|
||||||
int bltwidth,int bltheight)
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
uint8_t p;
|
|
||||||
dstpitch -= bltwidth;
|
|
||||||
srcpitch -= bltwidth;
|
|
||||||
for (y = 0; y < bltheight; y++) {
|
|
||||||
for (x = 0; x < bltwidth; x++) {
|
|
||||||
p = *dst;
|
|
||||||
ROP_OP(&p, *src);
|
|
||||||
if (p != svga->gdcreg[0x34]) *dst = p;
|
|
||||||
dst++;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
dst += dstpitch;
|
|
||||||
src += srcpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_8)(clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t *dst,const uint8_t *src,
|
|
||||||
int dstpitch,int srcpitch,
|
|
||||||
int bltwidth,int bltheight)
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
uint8_t p;
|
|
||||||
dstpitch += bltwidth;
|
|
||||||
srcpitch += bltwidth;
|
|
||||||
for (y = 0; y < bltheight; y++) {
|
|
||||||
for (x = 0; x < bltwidth; x++) {
|
|
||||||
p = *dst;
|
|
||||||
ROP_OP(&p, *src);
|
|
||||||
if (p != svga->gdcreg[0x34]) *dst = p;
|
|
||||||
dst--;
|
|
||||||
src--;
|
|
||||||
}
|
|
||||||
dst += dstpitch;
|
|
||||||
src += srcpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_16)(clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t *dst,const uint8_t *src,
|
|
||||||
int dstpitch,int srcpitch,
|
|
||||||
int bltwidth,int bltheight)
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
uint8_t p1, p2;
|
|
||||||
dstpitch -= bltwidth;
|
|
||||||
srcpitch -= bltwidth;
|
|
||||||
for (y = 0; y < bltheight; y++) {
|
|
||||||
for (x = 0; x < bltwidth; x+=2) {
|
|
||||||
p1 = *dst;
|
|
||||||
p2 = *(dst+1);
|
|
||||||
ROP_OP(&p1, *src);
|
|
||||||
ROP_OP(&p2, *(src + 1));
|
|
||||||
if ((p1 != svga->gdcreg[0x34]) || (p2 != svga->gdcreg[0x35])) {
|
|
||||||
*dst = p1;
|
|
||||||
*(dst+1) = p2;
|
|
||||||
}
|
|
||||||
dst+=2;
|
|
||||||
src+=2;
|
|
||||||
}
|
|
||||||
dst += dstpitch;
|
|
||||||
src += srcpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_16)(clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t *dst,const uint8_t *src,
|
|
||||||
int dstpitch,int srcpitch,
|
|
||||||
int bltwidth,int bltheight)
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
uint8_t p1, p2;
|
|
||||||
dstpitch += bltwidth;
|
|
||||||
srcpitch += bltwidth;
|
|
||||||
for (y = 0; y < bltheight; y++) {
|
|
||||||
for (x = 0; x < bltwidth; x+=2) {
|
|
||||||
p1 = *(dst-1);
|
|
||||||
p2 = *dst;
|
|
||||||
ROP_OP(&p1, *(src - 1));
|
|
||||||
ROP_OP(&p2, *src);
|
|
||||||
if ((p1 != svga->gdcreg[0x34]) || (p2 != svga->gdcreg[0x35])) {
|
|
||||||
*(dst-1) = p1;
|
|
||||||
*dst = p2;
|
|
||||||
}
|
|
||||||
dst-=2;
|
|
||||||
src-=2;
|
|
||||||
}
|
|
||||||
dst += dstpitch;
|
|
||||||
src += srcpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEPTH 8
|
|
||||||
#include "vid_cl_gd_vga_rop2.h"
|
|
||||||
|
|
||||||
#define DEPTH 16
|
|
||||||
#include "vid_cl_gd_vga_rop2.h"
|
|
||||||
|
|
||||||
#define DEPTH 24
|
|
||||||
#include "vid_cl_gd_vga_rop2.h"
|
|
||||||
|
|
||||||
#define DEPTH 32
|
|
||||||
#include "vid_cl_gd_vga_rop2.h"
|
|
||||||
|
|
||||||
#undef ROP_NAME
|
|
||||||
#undef ROP_OP
|
|
||||||
#undef ROP_OP_16
|
|
||||||
#undef ROP_OP_32
|
|
||||||
@@ -1,281 +0,0 @@
|
|||||||
/*
|
|
||||||
* QEMU Cirrus CLGD 54xx VGA Emulator.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2004 Fabrice Bellard
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if DEPTH == 8
|
|
||||||
#define PUTPIXEL() ROP_OP(&d[0], col)
|
|
||||||
#elif DEPTH == 16
|
|
||||||
#define PUTPIXEL() ROP_OP_16((uint16_t *)&d[0], col)
|
|
||||||
#elif DEPTH == 24
|
|
||||||
#define PUTPIXEL() ROP_OP(&d[0], col); \
|
|
||||||
ROP_OP(&d[1], (col >> 8)); \
|
|
||||||
ROP_OP(&d[2], (col >> 16))
|
|
||||||
#elif DEPTH == 32
|
|
||||||
#define PUTPIXEL() ROP_OP_32(((uint32_t *)&d[0]), col)
|
|
||||||
#else
|
|
||||||
#error unsupported DEPTH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
|
|
||||||
(clgd_t *clgd, svga_t *svga, uint8_t * dst,
|
|
||||||
const uint8_t * src,
|
|
||||||
int dstpitch, int srcpitch,
|
|
||||||
int bltwidth, int bltheight)
|
|
||||||
{
|
|
||||||
uint8_t *d;
|
|
||||||
int x, y, pattern_y, pattern_pitch, pattern_x;
|
|
||||||
unsigned int col;
|
|
||||||
const uint8_t *src1;
|
|
||||||
#if DEPTH == 24
|
|
||||||
int skipleft = svga->gdcreg[0x2f] & 0x1f;
|
|
||||||
#else
|
|
||||||
int skipleft = (svga->gdcreg[0x2f] & 0x07) * (DEPTH / 8);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DEPTH == 8
|
|
||||||
pattern_pitch = 8;
|
|
||||||
#elif DEPTH == 16
|
|
||||||
pattern_pitch = 16;
|
|
||||||
#else
|
|
||||||
pattern_pitch = 32;
|
|
||||||
#endif
|
|
||||||
pattern_y = clgd->blt.src_addr & 7;
|
|
||||||
for(y = 0; y < bltheight; y++) {
|
|
||||||
pattern_x = skipleft;
|
|
||||||
d = dst + skipleft;
|
|
||||||
src1 = src + pattern_y * pattern_pitch;
|
|
||||||
for (x = skipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
||||||
#if DEPTH == 8
|
|
||||||
col = src1[pattern_x];
|
|
||||||
pattern_x = (pattern_x + 1) & 7;
|
|
||||||
#elif DEPTH == 16
|
|
||||||
col = ((uint16_t *)(src1 + pattern_x))[0];
|
|
||||||
pattern_x = (pattern_x + 2) & 15;
|
|
||||||
#elif DEPTH == 24
|
|
||||||
{
|
|
||||||
const uint8_t *src2 = src1 + pattern_x * 3;
|
|
||||||
col = src2[0] | (src2[1] << 8) | (src2[2] << 16);
|
|
||||||
pattern_x = (pattern_x + 1) & 7;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
col = ((uint32_t *)(src1 + pattern_x))[0];
|
|
||||||
pattern_x = (pattern_x + 4) & 31;
|
|
||||||
#endif
|
|
||||||
PUTPIXEL();
|
|
||||||
d += (DEPTH / 8);
|
|
||||||
}
|
|
||||||
pattern_y = (pattern_y + 1) & 7;
|
|
||||||
dst += dstpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NOTE: srcpitch is ignored */
|
|
||||||
void
|
|
||||||
glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
|
|
||||||
(clgd_t *clgd, svga_t *svga, uint8_t * dst,
|
|
||||||
const uint8_t * src,
|
|
||||||
int dstpitch, int srcpitch,
|
|
||||||
int bltwidth, int bltheight)
|
|
||||||
{
|
|
||||||
uint8_t *d;
|
|
||||||
int x, y;
|
|
||||||
unsigned bits, bits_xor;
|
|
||||||
unsigned int col;
|
|
||||||
unsigned bitmask;
|
|
||||||
unsigned index;
|
|
||||||
#if DEPTH == 24
|
|
||||||
int dstskipleft = svga->gdcreg[0x2f] & 0x1f;
|
|
||||||
int srcskipleft = dstskipleft / 3;
|
|
||||||
#else
|
|
||||||
int srcskipleft = svga->gdcreg[0x2f] & 0x07;
|
|
||||||
int dstskipleft = srcskipleft * (DEPTH / 8);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (clgd->blt.modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) {
|
|
||||||
bits_xor = 0xff;
|
|
||||||
col = clgd->blt.bg_col;
|
|
||||||
} else {
|
|
||||||
bits_xor = 0x00;
|
|
||||||
col = clgd->blt.fg_col;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(y = 0; y < bltheight; y++) {
|
|
||||||
bitmask = 0x80 >> srcskipleft;
|
|
||||||
bits = *src++ ^ bits_xor;
|
|
||||||
d = dst + dstskipleft;
|
|
||||||
for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
||||||
if ((bitmask & 0xff) == 0) {
|
|
||||||
bitmask = 0x80;
|
|
||||||
bits = *src++ ^ bits_xor;
|
|
||||||
}
|
|
||||||
index = (bits & bitmask);
|
|
||||||
if (index) {
|
|
||||||
PUTPIXEL();
|
|
||||||
}
|
|
||||||
d += (DEPTH / 8);
|
|
||||||
bitmask >>= 1;
|
|
||||||
}
|
|
||||||
dst += dstpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
|
|
||||||
(clgd_t *clgd, svga_t *svga, uint8_t * dst,
|
|
||||||
const uint8_t * src,
|
|
||||||
int dstpitch, int srcpitch,
|
|
||||||
int bltwidth, int bltheight)
|
|
||||||
{
|
|
||||||
uint32_t colors[2];
|
|
||||||
uint8_t *d;
|
|
||||||
int x, y;
|
|
||||||
unsigned bits;
|
|
||||||
unsigned int col;
|
|
||||||
unsigned bitmask;
|
|
||||||
int srcskipleft = svga->gdcreg[0x2f] & 0x07;
|
|
||||||
int dstskipleft = srcskipleft * (DEPTH / 8);
|
|
||||||
|
|
||||||
colors[0] = clgd->blt.bg_col;
|
|
||||||
colors[1] = clgd->blt.fg_col;
|
|
||||||
for(y = 0; y < bltheight; y++) {
|
|
||||||
bitmask = 0x80 >> srcskipleft;
|
|
||||||
bits = *src++;
|
|
||||||
d = dst + dstskipleft;
|
|
||||||
for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
||||||
if ((bitmask & 0xff) == 0) {
|
|
||||||
bitmask = 0x80;
|
|
||||||
bits = *src++;
|
|
||||||
}
|
|
||||||
col = colors[!!(bits & bitmask)];
|
|
||||||
PUTPIXEL();
|
|
||||||
d += (DEPTH / 8);
|
|
||||||
bitmask >>= 1;
|
|
||||||
}
|
|
||||||
dst += dstpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
|
|
||||||
(clgd_t *clgd, svga_t *svga, uint8_t * dst,
|
|
||||||
const uint8_t * src,
|
|
||||||
int dstpitch, int srcpitch,
|
|
||||||
int bltwidth, int bltheight)
|
|
||||||
{
|
|
||||||
uint8_t *d;
|
|
||||||
int x, y, bitpos, pattern_y;
|
|
||||||
unsigned int bits, bits_xor;
|
|
||||||
unsigned int col;
|
|
||||||
#if DEPTH == 24
|
|
||||||
int dstskipleft = svga->gdcreg[0x2f] & 0x1f;
|
|
||||||
int srcskipleft = dstskipleft / 3;
|
|
||||||
#else
|
|
||||||
int srcskipleft = svga->gdcreg[0x2f] & 0x07;
|
|
||||||
int dstskipleft = srcskipleft * (DEPTH / 8);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (clgd->blt.modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) {
|
|
||||||
bits_xor = 0xff;
|
|
||||||
col = clgd->blt.bg_col;
|
|
||||||
} else {
|
|
||||||
bits_xor = 0x00;
|
|
||||||
col = clgd->blt.fg_col;
|
|
||||||
}
|
|
||||||
pattern_y = clgd->blt.src_addr & 7;
|
|
||||||
|
|
||||||
for(y = 0; y < bltheight; y++) {
|
|
||||||
bits = src[pattern_y] ^ bits_xor;
|
|
||||||
bitpos = 7 - srcskipleft;
|
|
||||||
d = dst + dstskipleft;
|
|
||||||
for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
||||||
if ((bits >> bitpos) & 1) {
|
|
||||||
PUTPIXEL();
|
|
||||||
}
|
|
||||||
d += (DEPTH / 8);
|
|
||||||
bitpos = (bitpos - 1) & 7;
|
|
||||||
}
|
|
||||||
pattern_y = (pattern_y + 1) & 7;
|
|
||||||
dst += dstpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
|
|
||||||
(clgd_t *clgd, svga_t *svga, uint8_t * dst,
|
|
||||||
const uint8_t * src,
|
|
||||||
int dstpitch, int srcpitch,
|
|
||||||
int bltwidth, int bltheight)
|
|
||||||
{
|
|
||||||
uint32_t colors[2];
|
|
||||||
uint8_t *d;
|
|
||||||
int x, y, bitpos, pattern_y;
|
|
||||||
unsigned int bits;
|
|
||||||
unsigned int col;
|
|
||||||
int srcskipleft = svga->gdcreg[0x2f] & 0x07;
|
|
||||||
int dstskipleft = srcskipleft * (DEPTH / 8);
|
|
||||||
|
|
||||||
colors[0] = clgd->blt.bg_col;
|
|
||||||
colors[1] = clgd->blt.fg_col;
|
|
||||||
pattern_y = clgd->blt.src_addr & 7;
|
|
||||||
|
|
||||||
for(y = 0; y < bltheight; y++) {
|
|
||||||
bits = src[pattern_y];
|
|
||||||
bitpos = 7 - srcskipleft;
|
|
||||||
d = dst + dstskipleft;
|
|
||||||
for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
||||||
col = colors[(bits >> bitpos) & 1];
|
|
||||||
PUTPIXEL();
|
|
||||||
d += (DEPTH / 8);
|
|
||||||
bitpos = (bitpos - 1) & 7;
|
|
||||||
}
|
|
||||||
pattern_y = (pattern_y + 1) & 7;
|
|
||||||
dst += dstpitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
glue(glue(glue(cirrus_fill_, ROP_NAME), _),DEPTH)
|
|
||||||
(clgd_t *clgd, svga_t *svga,
|
|
||||||
uint8_t *dst, int dst_pitch,
|
|
||||||
int width, int height)
|
|
||||||
{
|
|
||||||
uint8_t *d, *d1;
|
|
||||||
uint32_t col;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
col = clgd->blt.fg_col;
|
|
||||||
|
|
||||||
d1 = dst;
|
|
||||||
for(y = 0; y < height; y++) {
|
|
||||||
d = d1;
|
|
||||||
for(x = 0; x < width; x += (DEPTH / 8)) {
|
|
||||||
PUTPIXEL();
|
|
||||||
d += (DEPTH / 8);
|
|
||||||
}
|
|
||||||
d1 += dst_pitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef DEPTH
|
|
||||||
#undef PUTPIXEL
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
||||||
* running old operating systems and software designed for IBM
|
|
||||||
* PC systems and compatibles from 1981 through fairly recent
|
|
||||||
* system designs based on the PCI bus.
|
|
||||||
*
|
|
||||||
* This file is part of the 86Box distribution.
|
|
||||||
*
|
|
||||||
* Emulation of the Cirrus Logic RAMDAC.
|
|
||||||
*
|
|
||||||
* Version: @(#)vid_cl_ramdac.c 1.0.2 2017/11/04
|
|
||||||
*
|
|
||||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
|
||||||
*
|
|
||||||
* Copyright 2016,2017 Miran Grca.
|
|
||||||
*/
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#include "../86box.h"
|
|
||||||
#include "../mem.h"
|
|
||||||
#include "../rom.h"
|
|
||||||
#include "../device.h"
|
|
||||||
#include "video.h"
|
|
||||||
#include "vid_svga.h"
|
|
||||||
#include "vid_cl_ramdac.h"
|
|
||||||
#include "vid_cl_gd.h"
|
|
||||||
#include "vid_cl_gd_blit.h"
|
|
||||||
|
|
||||||
|
|
||||||
void cl_ramdac_out(uint16_t addr, uint8_t val, cl_ramdac_t *ramdac, void *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
clgd_t *real_clgd = (clgd_t *) clgd;
|
|
||||||
//pclog("OUT RAMDAC %04X %02X\n",addr,val);
|
|
||||||
switch (addr)
|
|
||||||
{
|
|
||||||
case 0x3C6:
|
|
||||||
if (ramdac->state == 4)
|
|
||||||
{
|
|
||||||
ramdac->state = 0;
|
|
||||||
ramdac->ctrl = val;
|
|
||||||
svga_recalctimings(svga);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ramdac->state = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x3C7: case 0x3C8:
|
|
||||||
ramdac->state = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x3C9:
|
|
||||||
if (svga->seqregs[0x12] & CIRRUS_CURSOR_HIDDENPEL)
|
|
||||||
{
|
|
||||||
ramdac->state = 0;
|
|
||||||
svga->fullchange = changeframecount;
|
|
||||||
switch (svga->dac_pos)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
real_clgd->hiddenpal[svga->dac_write & 0xf].r = val & 63;
|
|
||||||
svga->dac_pos++;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
real_clgd->hiddenpal[svga->dac_write & 0xf].g = val & 63;
|
|
||||||
svga->dac_pos++;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
real_clgd->hiddenpal[svga->dac_write & 0xf].b = val & 63;
|
|
||||||
svga->dac_pos = 0;
|
|
||||||
svga->dac_write = (svga->dac_write + 1) & 255;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ramdac->state = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
svga_out(addr, val, svga);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t cl_ramdac_in(uint16_t addr, cl_ramdac_t *ramdac, void *clgd, svga_t *svga)
|
|
||||||
{
|
|
||||||
clgd_t *real_clgd = (clgd_t *) clgd;
|
|
||||||
//pclog("IN RAMDAC %04X\n",addr);
|
|
||||||
switch (addr)
|
|
||||||
{
|
|
||||||
case 0x3C6:
|
|
||||||
if (ramdac->state == 4)
|
|
||||||
{
|
|
||||||
ramdac->state = 0;
|
|
||||||
return ramdac->ctrl;
|
|
||||||
}
|
|
||||||
ramdac->state++;
|
|
||||||
break;
|
|
||||||
case 0x3C7: case 0x3C8:
|
|
||||||
ramdac->state = 0;
|
|
||||||
break;
|
|
||||||
case 0x3C9:
|
|
||||||
if (svga->seqregs[0x12] & CIRRUS_CURSOR_HIDDENPEL)
|
|
||||||
{
|
|
||||||
ramdac->state = 0;
|
|
||||||
switch (svga->dac_pos)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
svga->dac_pos++;
|
|
||||||
return real_clgd->hiddenpal[svga->dac_read & 0xf].r;
|
|
||||||
case 1:
|
|
||||||
svga->dac_pos++;
|
|
||||||
return real_clgd->hiddenpal[svga->dac_read & 0xf].g;
|
|
||||||
case 2:
|
|
||||||
svga->dac_pos=0;
|
|
||||||
svga->dac_read = (svga->dac_read + 1) & 255;
|
|
||||||
return real_clgd->hiddenpal[(svga->dac_read - 1) & 15].b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ramdac->state = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return svga_in(addr, svga);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
typedef struct cl_ramdac_t
|
|
||||||
{
|
|
||||||
int state;
|
|
||||||
uint8_t ctrl;
|
|
||||||
} cl_ramdac_t;
|
|
||||||
|
|
||||||
void cl_ramdac_out(uint16_t addr, uint8_t val, cl_ramdac_t *ramdac, void *clgd, svga_t *svga);
|
|
||||||
uint8_t cl_ramdac_in(uint16_t addr, cl_ramdac_t *ramdac, void *clgd, svga_t *svga);
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Define all known video cards.
|
* Define all known video cards.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_table.c 1.0.18 2018/02/12
|
* Version: @(#)vid_table.c 1.0.19 2018/02/18
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "vid_ati28800.h"
|
#include "vid_ati28800.h"
|
||||||
#include "vid_ati_mach64.h"
|
#include "vid_ati_mach64.h"
|
||||||
#include "vid_cga.h"
|
#include "vid_cga.h"
|
||||||
#include "vid_cl5428.h"
|
#include "vid_cl54xx.h"
|
||||||
#include "vid_compaq_cga.h"
|
#include "vid_compaq_cga.h"
|
||||||
#include "vid_ega.h"
|
#include "vid_ega.h"
|
||||||
#include "vid_et4000.h"
|
#include "vid_et4000.h"
|
||||||
@@ -69,8 +69,8 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[64];
|
const char *name;
|
||||||
char internal_name[24];
|
const char *internal_name;
|
||||||
device_t *device;
|
device_t *device;
|
||||||
int legacy_id;
|
int legacy_id;
|
||||||
video_timings_t timing;
|
video_timings_t timing;
|
||||||
@@ -136,10 +136,11 @@ video_cards[] = {
|
|||||||
{"[PCI] Trident TGUI9440", "tgui9440_pci", &tgui9440_pci_device, GFX_TGUI9440_PCI, {VIDEO_BUS, 4, 8, 16, 4, 8, 16}},
|
{"[PCI] Trident TGUI9440", "tgui9440_pci", &tgui9440_pci_device, GFX_TGUI9440_PCI, {VIDEO_BUS, 4, 8, 16, 4, 8, 16}},
|
||||||
{"[VLB] ATI Graphics Pro Turbo (Mach64 GX)", "mach64gx_vlb", &mach64gx_vlb_device, GFX_MACH64GX_VLB, {VIDEO_BUS, 2, 2, 1, 20, 20, 21}},
|
{"[VLB] ATI Graphics Pro Turbo (Mach64 GX)", "mach64gx_vlb", &mach64gx_vlb_device, GFX_MACH64GX_VLB, {VIDEO_BUS, 2, 2, 1, 20, 20, 21}},
|
||||||
{"[VLB] Cardex Tseng ET4000/w32p", "et4000w32p_vlb", &et4000w32p_cardex_vlb_device, GFX_ET4000W32_CARDEX_VLB, {VIDEO_BUS, 4, 4, 4, 10, 10, 10}},
|
{"[VLB] Cardex Tseng ET4000/w32p", "et4000w32p_vlb", &et4000w32p_cardex_vlb_device, GFX_ET4000W32_CARDEX_VLB, {VIDEO_BUS, 4, 4, 4, 10, 10, 10}},
|
||||||
|
{"[VLB] Cirrus Logic CL-GD 5429", "cl_gd5429_vlb", &gd5429_device, GFX_CL_GD5429, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}},
|
||||||
#if defined(DEV_BRANCH) && defined(USE_STEALTH32)
|
#if defined(DEV_BRANCH) && defined(USE_STEALTH32)
|
||||||
{"[VLB] Diamond Stealth 32 (Tseng ET4000/w32p)","stealth32_vlb", &et4000w32p_vlb_device, GFX_ET4000W32_VLB, {VIDEO_BUS, 4, 4, 4, 10, 10, 10}},
|
{"[VLB] Diamond Stealth 32 (Tseng ET4000/w32p)","stealth32_vlb", &et4000w32p_vlb_device, GFX_ET4000W32_VLB, {VIDEO_BUS, 4, 4, 4, 10, 10, 10}},
|
||||||
#endif
|
#endif
|
||||||
{"[VLB] Diamond SpeedStar PRO (CL-GD5428)", "cl_gd5428_vlb", &gd5428_device, GFX_CL_GD5428, {VIDEO_BUS, 4, 8, 16, 4, 8, 16}},
|
{"[VLB] Diamond SpeedStar PRO (CL-GD5428)", "cl_gd5428_vlb", &gd5428_device, GFX_CL_GD5428, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}},
|
||||||
{"[VLB] Diamond Stealth 3D 2000 (S3 ViRGE)", "stealth3d_2000_vlb", &s3_virge_vlb_device, GFX_VIRGE_VLB, {VIDEO_BUS, 2, 2, 3, 28, 28, 45}},
|
{"[VLB] Diamond Stealth 3D 2000 (S3 ViRGE)", "stealth3d_2000_vlb", &s3_virge_vlb_device, GFX_VIRGE_VLB, {VIDEO_BUS, 2, 2, 3, 28, 28, 45}},
|
||||||
{"[VLB] Diamond Stealth 3D 3000 (S3 ViRGE/VX)", "stealth3d_3000_vlb", &s3_virge_988_vlb_device, GFX_VIRGEVX_VLB, {VIDEO_BUS, 2, 2, 4, 26, 26, 42}},
|
{"[VLB] Diamond Stealth 3D 3000 (S3 ViRGE/VX)", "stealth3d_3000_vlb", &s3_virge_988_vlb_device, GFX_VIRGEVX_VLB, {VIDEO_BUS, 2, 2, 4, 26, 26, 42}},
|
||||||
{"[VLB] Diamond Stealth 64 DRAM (S3 Trio64)", "stealth64d_vlb", &s3_diamond_stealth64_vlb_device, GFX_STEALTH64_VLB, {VIDEO_BUS, 2, 2, 4, 26, 26, 42}},
|
{"[VLB] Diamond Stealth 64 DRAM (S3 Trio64)", "stealth64d_vlb", &s3_diamond_stealth64_vlb_device, GFX_STEALTH64_VLB, {VIDEO_BUS, 2, 2, 4, 26, 26, 42}},
|
||||||
@@ -193,7 +194,7 @@ video_card_available(int card)
|
|||||||
char *
|
char *
|
||||||
video_card_getname(int card)
|
video_card_getname(int card)
|
||||||
{
|
{
|
||||||
return(video_cards[card].name);
|
return((char *) video_cards[card].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -226,7 +227,7 @@ video_card_getid(char *s)
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (video_cards[c].legacy_id != -1) {
|
while (video_cards[c].legacy_id != -1) {
|
||||||
if (!strcmp(video_cards[c].name, s))
|
if (!strcmp((char *) video_cards[c].name, s))
|
||||||
return(c);
|
return(c);
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@@ -260,7 +261,7 @@ video_new_to_old(int card)
|
|||||||
char *
|
char *
|
||||||
video_get_internal_name(int card)
|
video_get_internal_name(int card)
|
||||||
{
|
{
|
||||||
return(video_cards[card].internal_name);
|
return((char *) video_cards[card].internal_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -270,7 +271,7 @@ video_get_video_from_internal_name(char *s)
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (video_cards[c].legacy_id != -1) {
|
while (video_cards[c].legacy_id != -1) {
|
||||||
if (!strcmp(video_cards[c].internal_name, s))
|
if (!strcmp((char *) video_cards[c].internal_name, s))
|
||||||
return(video_cards[c].legacy_id);
|
return(video_cards[c].legacy_id);
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Definitions for the video controller module.
|
* Definitions for the video controller module.
|
||||||
*
|
*
|
||||||
* Version: @(#)video.h 1.0.16 2018/02/12
|
* Version: @(#)video.h 1.0.17 2018/02/18
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -68,7 +68,8 @@ enum {
|
|||||||
GFX_MACH64GX_VLB, /* ATI Graphics Pro Turbo (Mach64) VLB */
|
GFX_MACH64GX_VLB, /* ATI Graphics Pro Turbo (Mach64) VLB */
|
||||||
GFX_MACH64GX_PCI, /* ATI Graphics Pro Turbo (Mach64) PCI */
|
GFX_MACH64GX_PCI, /* ATI Graphics Pro Turbo (Mach64) PCI */
|
||||||
GFX_MACH64VT2, /* ATI Mach64 VT2 */
|
GFX_MACH64VT2, /* ATI Mach64 VT2 */
|
||||||
GFX_CL_GD5428, /* Diamond SpeedStar PRO (Cirrus Logic CL-GD5428) */
|
GFX_CL_GD5428, /* Diamond SpeedStar PRO (Cirrus Logic CL-GD 5428) */
|
||||||
|
GFX_CL_GD5429, /* Cirrus Logic CL-GD 5428 */
|
||||||
#if defined(DEV_BRANCH) && defined(USE_RIVA)
|
#if defined(DEV_BRANCH) && defined(USE_RIVA)
|
||||||
GFX_RIVATNT, /* nVidia Riva TNT */
|
GFX_RIVATNT, /* nVidia Riva TNT */
|
||||||
GFX_RIVATNT2, /* nVidia Riva TNT2 */
|
GFX_RIVATNT2, /* nVidia Riva TNT2 */
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile for Win32 (MinGW32) environment.
|
# Makefile for Win32 (MinGW32) environment.
|
||||||
#
|
#
|
||||||
# Version: @(#)Makefile.mingw 1.0.101 2018/02/11
|
# Version: @(#)Makefile.mingw 1.0.102 2018/02/18
|
||||||
#
|
#
|
||||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -455,8 +455,7 @@ SNDOBJ := sound.o \
|
|||||||
wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \
|
wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \
|
||||||
wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \
|
wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \
|
||||||
wave8580_PST.o wave.o \
|
wave8580_PST.o wave.o \
|
||||||
midi.o $(FSYNTHOBJ) $(MUNTOBJ) \
|
midi.o midi_system.o \
|
||||||
midi_system.o \
|
|
||||||
snd_speaker.o \
|
snd_speaker.o \
|
||||||
snd_pssj.o \
|
snd_pssj.o \
|
||||||
snd_lpt_dac.o snd_lpt_dss.o \
|
snd_lpt_dac.o snd_lpt_dss.o \
|
||||||
@@ -486,7 +485,7 @@ VIDOBJ := video.o \
|
|||||||
vid_ati18800.o vid_ati28800.o \
|
vid_ati18800.o vid_ati28800.o \
|
||||||
vid_ati_mach64.o vid_ati68860_ramdac.o \
|
vid_ati_mach64.o vid_ati68860_ramdac.o \
|
||||||
vid_ics2595.o \
|
vid_ics2595.o \
|
||||||
vid_cl5428.o \
|
vid_cl54xx.o \
|
||||||
vid_et4000.o vid_sc1502x_ramdac.o \
|
vid_et4000.o vid_sc1502x_ramdac.o \
|
||||||
vid_et4000w32.o vid_stg_ramdac.o \
|
vid_et4000w32.o vid_stg_ramdac.o \
|
||||||
vid_oti067.o \
|
vid_oti067.o \
|
||||||
@@ -506,7 +505,8 @@ PLATOBJ := win.o \
|
|||||||
OBJ := $(MAINOBJ) $(INTELOBJ) $(CPUOBJ) $(MCHOBJ) $(DEVOBJ) \
|
OBJ := $(MAINOBJ) $(INTELOBJ) $(CPUOBJ) $(MCHOBJ) $(DEVOBJ) \
|
||||||
$(FDDOBJ) $(CDROMOBJ) $(ZIPOBJ) $(HDDOBJ) \
|
$(FDDOBJ) $(CDROMOBJ) $(ZIPOBJ) $(HDDOBJ) \
|
||||||
$(USBOBJ) $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) \
|
$(USBOBJ) $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) \
|
||||||
$(PLATOBJ) $(UIOBJ) $(DEVBROBJ)
|
$(PLATOBJ) $(UIOBJ) $(FSYNTHOBJ) $(MUNTOBJ) \
|
||||||
|
$(DEVBROBJ)
|
||||||
ifdef EXOBJ
|
ifdef EXOBJ
|
||||||
OBJ += $(EXOBJ)
|
OBJ += $(EXOBJ)
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
*
|
*
|
||||||
* Windows device configuration dialog implementation.
|
* Windows device configuration dialog implementation.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_devconf.c 1.0.11 2017/12/13
|
* Version: @(#)win_devconf.c 1.0.12 2018/02/18
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
* Copyright 2008-2017 Sarah Walker.
|
* Copyright 2008-2018 Sarah Walker.
|
||||||
* Copyright 2016,2017 Miran Grca.
|
* Copyright 2016-2018 Miran Grca.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -72,7 +72,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
switch (config->type)
|
switch (config->type)
|
||||||
{
|
{
|
||||||
case CONFIG_BINARY:
|
case CONFIG_BINARY:
|
||||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
SendMessage(h, BM_SETCHECK, val_int, 0);
|
SendMessage(h, BM_SETCHECK, val_int, 0);
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_SELECTION:
|
case CONFIG_SELECTION:
|
||||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
while (selection->description[0])
|
while (selection->description[0])
|
||||||
@@ -97,7 +97,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_MIDI:
|
case CONFIG_MIDI:
|
||||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
num = plat_midi_get_num_devs();
|
num = plat_midi_get_num_devs();
|
||||||
for (c = 0; c < num; c++)
|
for (c = 0; c < num; c++)
|
||||||
@@ -113,7 +113,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_SPINNER:
|
case CONFIG_SPINNER:
|
||||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
_swprintf(ws, L"%i", val_int);
|
_swprintf(ws, L"%i", val_int);
|
||||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)ws);
|
SendMessage(h, WM_SETTEXT, 0, (LPARAM)ws);
|
||||||
@@ -123,7 +123,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case CONFIG_FNAME:
|
case CONFIG_FNAME:
|
||||||
{
|
{
|
||||||
wchar_t* str = config_get_wstring(config_device->name, config->name, 0);
|
wchar_t* str = config_get_wstring((char *) config_device->name, (char *) config->name, 0);
|
||||||
if (str)
|
if (str)
|
||||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)str);
|
SendMessage(h, WM_SETTEXT, 0, (LPARAM)str);
|
||||||
id += 3;
|
id += 3;
|
||||||
@@ -131,7 +131,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_HEX16:
|
case CONFIG_HEX16:
|
||||||
val_int = config_get_hex16(config_device->name, config->name, config->default_int);
|
val_int = config_get_hex16((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
while (selection->description[0])
|
while (selection->description[0])
|
||||||
@@ -148,7 +148,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_HEX20:
|
case CONFIG_HEX20:
|
||||||
val_int = config_get_hex20(config_device->name, config->name, config->default_int);
|
val_int = config_get_hex20((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
while (selection->description[0])
|
while (selection->description[0])
|
||||||
@@ -189,7 +189,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
switch (config->type)
|
switch (config->type)
|
||||||
{
|
{
|
||||||
case CONFIG_BINARY:
|
case CONFIG_BINARY:
|
||||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
if (val_int != SendMessage(h, BM_GETCHECK, 0, 0))
|
if (val_int != SendMessage(h, BM_GETCHECK, 0, 0))
|
||||||
changed = 1;
|
changed = 1;
|
||||||
@@ -198,7 +198,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_SELECTION:
|
case CONFIG_SELECTION:
|
||||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_MIDI:
|
case CONFIG_MIDI:
|
||||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case CONFIG_FNAME:
|
case CONFIG_FNAME:
|
||||||
{
|
{
|
||||||
char* str = config_get_string(config_device->name, config->name, (char*)"");
|
char* str = config_get_string((char *) config_device->name, (char *) config->name, (char*)"");
|
||||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)s);
|
SendMessage(h, WM_GETTEXT, 511, (LPARAM)s);
|
||||||
if (strcmp(str, s))
|
if (strcmp(str, s))
|
||||||
changed = 1;
|
changed = 1;
|
||||||
@@ -234,7 +234,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_SPINNER:
|
case CONFIG_SPINNER:
|
||||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
if (val_int > config->spinner.max)
|
if (val_int > config->spinner.max)
|
||||||
val_int = config->spinner.max;
|
val_int = config->spinner.max;
|
||||||
else if (val_int < config->spinner.min)
|
else if (val_int < config->spinner.min)
|
||||||
@@ -251,7 +251,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_HEX16:
|
case CONFIG_HEX16:
|
||||||
val_int = config_get_hex16(config_device->name, config->name, config->default_int);
|
val_int = config_get_hex16((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_HEX20:
|
case CONFIG_HEX20:
|
||||||
val_int = config_get_hex20(config_device->name, config->name, config->default_int);
|
val_int = config_get_hex20((char *) config_device->name, (char *) config->name, config->default_int);
|
||||||
|
|
||||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
switch (config->type)
|
switch (config->type)
|
||||||
{
|
{
|
||||||
case CONFIG_BINARY:
|
case CONFIG_BINARY:
|
||||||
config_set_int(config_device->name, config->name, SendMessage(h, BM_GETCHECK, 0, 0));
|
config_set_int((char *) config_device->name, (char *) config->name, SendMessage(h, BM_GETCHECK, 0, 0));
|
||||||
|
|
||||||
id++;
|
id++;
|
||||||
break;
|
break;
|
||||||
@@ -310,21 +310,21 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
for (; c > 0; c--)
|
for (; c > 0; c--)
|
||||||
selection++;
|
selection++;
|
||||||
config_set_int(config_device->name, config->name, selection->value);
|
config_set_int((char *) config_device->name, (char *) config->name, selection->value);
|
||||||
|
|
||||||
id += 2;
|
id += 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_MIDI:
|
case CONFIG_MIDI:
|
||||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
config_set_int(config_device->name, config->name, c);
|
config_set_int((char *) config_device->name, (char *) config->name, c);
|
||||||
|
|
||||||
id += 2;
|
id += 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONFIG_FNAME:
|
case CONFIG_FNAME:
|
||||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)ws);
|
SendMessage(h, WM_GETTEXT, 511, (LPARAM)ws);
|
||||||
config_set_wstring(config_device->name, config->name, ws);
|
config_set_wstring((char *) config_device->name, (char *) config->name, ws);
|
||||||
|
|
||||||
id += 3;
|
id += 3;
|
||||||
break;
|
break;
|
||||||
@@ -337,7 +337,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
else if (c < config->spinner.min)
|
else if (c < config->spinner.min)
|
||||||
c = config->spinner.min;
|
c = config->spinner.min;
|
||||||
|
|
||||||
config_set_int(config_device->name, config->name, c);
|
config_set_int((char *) config_device->name, (char *) config->name, c);
|
||||||
|
|
||||||
id += 2;
|
id += 2;
|
||||||
break;
|
break;
|
||||||
@@ -346,7 +346,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
for (; c > 0; c--)
|
for (; c > 0; c--)
|
||||||
selection++;
|
selection++;
|
||||||
config_set_hex16(config_device->name, config->name, selection->value);
|
config_set_hex16((char *) config_device->name, (char *) config->name, selection->value);
|
||||||
|
|
||||||
id += 2;
|
id += 2;
|
||||||
break;
|
break;
|
||||||
@@ -355,7 +355,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
for (; c > 0; c--)
|
for (; c > 0; c--)
|
||||||
selection++;
|
selection++;
|
||||||
config_set_hex20(config_device->name, config->name, selection->value);
|
config_set_hex20((char *) config_device->name, (char *) config->name, selection->value);
|
||||||
|
|
||||||
id += 2;
|
id += 2;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Windows 86Box Settings dialog handler.
|
* Windows 86Box Settings dialog handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings.c 1.0.38 2018/02/07
|
* Version: @(#)win_settings.c 1.0.39 2018/02/18
|
||||||
*
|
*
|
||||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -545,7 +545,7 @@ static void win_settings_machine_recalc_cpu_m(HWND hdlg)
|
|||||||
c = 0;
|
c = 0;
|
||||||
while (machines[romstomachine[temp_romset]].cpu[temp_cpu_m].cpus[c].cpu_type != -1)
|
while (machines[romstomachine[temp_romset]].cpu[temp_cpu_m].cpus[c].cpu_type != -1)
|
||||||
{
|
{
|
||||||
stransi = machines[romstomachine[temp_romset]].cpu[temp_cpu_m].cpus[c].name;
|
stransi = (char *) machines[romstomachine[temp_romset]].cpu[temp_cpu_m].cpus[c].name;
|
||||||
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
|
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
|
||||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
||||||
c++;
|
c++;
|
||||||
|
|||||||
11
src/zip.c
11
src/zip.c
@@ -455,6 +455,7 @@ static const mode_sense_pages_t zip_250_mode_sense_pages_changeable =
|
|||||||
static mode_sense_pages_t zip_mode_sense_pages_saved[ZIP_NUM];
|
static mode_sense_pages_t zip_mode_sense_pages_saved[ZIP_NUM];
|
||||||
|
|
||||||
|
|
||||||
|
#define ENABLE_ZIP_LOG 1
|
||||||
#ifdef ENABLE_ZIP_LOG
|
#ifdef ENABLE_ZIP_LOG
|
||||||
int zip_do_log = ENABLE_ZIP_LOG;
|
int zip_do_log = ENABLE_ZIP_LOG;
|
||||||
#endif
|
#endif
|
||||||
@@ -1424,9 +1425,6 @@ void zip_command(uint8_t id, uint8_t *cdb)
|
|||||||
int32_t *BufLen;
|
int32_t *BufLen;
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
#if 0
|
|
||||||
int CdbLength;
|
|
||||||
#endif
|
|
||||||
if (zip_drives[id].bus_type == ZIP_BUS_SCSI) {
|
if (zip_drives[id].bus_type == ZIP_BUS_SCSI) {
|
||||||
BufLen = &SCSIDevices[zip_drives[id].scsi_device_id][zip_drives[id].scsi_device_lun].BufferLength;
|
BufLen = &SCSIDevices[zip_drives[id].scsi_device_id][zip_drives[id].scsi_device_lun].BufferLength;
|
||||||
zip[id].status &= ~ERR_STAT;
|
zip[id].status &= ~ERR_STAT;
|
||||||
@@ -1446,10 +1444,9 @@ void zip_command(uint8_t id, uint8_t *cdb)
|
|||||||
zip_log("ZIP %i: Command 0x%02X, Sense Key %02X, Asc %02X, Ascq %02X, Unit attention: %i\n", id, cdb[0], zip_sense_key, zip_asc, zip_ascq, zip[id].unit_attention);
|
zip_log("ZIP %i: Command 0x%02X, Sense Key %02X, Asc %02X, Ascq %02X, Unit attention: %i\n", id, cdb[0], zip_sense_key, zip_asc, zip_ascq, zip[id].unit_attention);
|
||||||
zip_log("ZIP %i: Request length: %04X\n", id, zip[id].request_length);
|
zip_log("ZIP %i: Request length: %04X\n", id, zip[id].request_length);
|
||||||
|
|
||||||
#if 0
|
zip_log("ZIP %i: CDB: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", id,
|
||||||
for (CdbLength = 1; CdbLength < zip[id].cdb_len; CdbLength++)
|
cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7],
|
||||||
zip_log("ZIP %i: CDB[%d] = %d\n", id, CdbLength, cdb[CdbLength]);
|
cdb[8], cdb[9], cdb[10], cdb[11]);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zip[id].sector_len = 0;
|
zip[id].sector_len = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user