@@ -20,7 +20,7 @@
|
|||||||
#ifndef MACHINE_AMSTRAD_H
|
#ifndef MACHINE_AMSTRAD_H
|
||||||
#define MACHINE_AMSTRAD_H
|
#define MACHINE_AMSTRAD_H
|
||||||
|
|
||||||
extern int amstrad_latch;
|
extern uint32_t amstrad_latch;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
AMSTRAD_NOLATCH,
|
AMSTRAD_NOLATCH,
|
||||||
|
73
src/io.c
73
src/io.c
@@ -312,12 +312,14 @@ inb(uint16_t port)
|
|||||||
p = q;
|
p = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port & 0x80)
|
if (amstrad_latch & 0x80000000) {
|
||||||
amstrad_latch = AMSTRAD_NOLATCH;
|
if (port & 0x80)
|
||||||
else if (port & 0x4000)
|
amstrad_latch = AMSTRAD_NOLATCH | 0x80000000;
|
||||||
amstrad_latch = AMSTRAD_SW10;
|
else if (port & 0x4000)
|
||||||
else
|
amstrad_latch = AMSTRAD_SW10 | 0x80000000;
|
||||||
amstrad_latch = AMSTRAD_SW9;
|
else
|
||||||
|
amstrad_latch = AMSTRAD_SW9 | 0x80000000;
|
||||||
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
cycles -= io_delay;
|
cycles -= io_delay;
|
||||||
@@ -401,12 +403,14 @@ inw(uint16_t port)
|
|||||||
}
|
}
|
||||||
ret = (ret8[1] << 8) | ret8[0];
|
ret = (ret8[1] << 8) | ret8[0];
|
||||||
|
|
||||||
if (port & 0x80)
|
if (amstrad_latch & 0x80000000) {
|
||||||
amstrad_latch = AMSTRAD_NOLATCH;
|
if (port & 0x80)
|
||||||
else if (port & 0x4000)
|
amstrad_latch = AMSTRAD_NOLATCH | 0x80000000;
|
||||||
amstrad_latch = AMSTRAD_SW10;
|
else if (port & 0x4000)
|
||||||
else
|
amstrad_latch = AMSTRAD_SW10 | 0x80000000;
|
||||||
amstrad_latch = AMSTRAD_SW9;
|
else
|
||||||
|
amstrad_latch = AMSTRAD_SW9 | 0x80000000;
|
||||||
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
cycles -= io_delay;
|
cycles -= io_delay;
|
||||||
@@ -487,17 +491,26 @@ inl(uint16_t port)
|
|||||||
|
|
||||||
ret16[0] = ret & 0xffff;
|
ret16[0] = ret & 0xffff;
|
||||||
ret16[1] = (ret >> 16) & 0xffff;
|
ret16[1] = (ret >> 16) & 0xffff;
|
||||||
for (i = 0; i < 4; i += 2) {
|
p = io[port & 0xffff];
|
||||||
p = io[(port + i) & 0xffff];
|
while (p) {
|
||||||
while(p) {
|
q = p->next;
|
||||||
q = p->next;
|
if (p->inw && !p->inl) {
|
||||||
if (p->inw && !p->inl) {
|
ret16[0] &= p->inw(port, p->priv);
|
||||||
ret16[i >> 1] &= p->inw(port + i, p->priv);
|
found |= 2;
|
||||||
found |= 2;
|
qfound++;
|
||||||
qfound++;
|
}
|
||||||
}
|
p = q;
|
||||||
p = q;
|
}
|
||||||
}
|
|
||||||
|
p = io[(port + 2) & 0xffff];
|
||||||
|
while (p) {
|
||||||
|
q = p->next;
|
||||||
|
if (p->inw && !p->inl) {
|
||||||
|
ret16[1] &= p->inw(port + 2, p->priv);
|
||||||
|
found |= 2;
|
||||||
|
qfound++;
|
||||||
|
}
|
||||||
|
p = q;
|
||||||
}
|
}
|
||||||
ret = (ret16[1] << 16) | ret16[0];
|
ret = (ret16[1] << 16) | ret16[0];
|
||||||
|
|
||||||
@@ -519,12 +532,14 @@ inl(uint16_t port)
|
|||||||
}
|
}
|
||||||
ret = (ret8[3] << 24) | (ret8[2] << 16) | (ret8[1] << 8) | ret8[0];
|
ret = (ret8[3] << 24) | (ret8[2] << 16) | (ret8[1] << 8) | ret8[0];
|
||||||
|
|
||||||
if (port & 0x80)
|
if (amstrad_latch & 0x80000000) {
|
||||||
amstrad_latch = AMSTRAD_NOLATCH;
|
if (port & 0x80)
|
||||||
else if (port & 0x4000)
|
amstrad_latch = AMSTRAD_NOLATCH | 0x80000000;
|
||||||
amstrad_latch = AMSTRAD_SW10;
|
else if (port & 0x4000)
|
||||||
else
|
amstrad_latch = AMSTRAD_SW10 | 0x80000000;
|
||||||
amstrad_latch = AMSTRAD_SW9;
|
else
|
||||||
|
amstrad_latch = AMSTRAD_SW9 | 0x80000000;
|
||||||
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
cycles -= io_delay;
|
cycles -= io_delay;
|
||||||
|
@@ -156,7 +156,7 @@ typedef struct {
|
|||||||
fdc_t *fdc;
|
fdc_t *fdc;
|
||||||
} amstrad_t;
|
} amstrad_t;
|
||||||
|
|
||||||
int amstrad_latch;
|
uint32_t amstrad_latch;
|
||||||
|
|
||||||
static uint8_t key_queue[16];
|
static uint8_t key_queue[16];
|
||||||
static int key_queue_start = 0,
|
static int key_queue_start = 0,
|
||||||
@@ -2255,7 +2255,7 @@ ams_read(uint16_t port, void *priv)
|
|||||||
else if (video_is_mda())
|
else if (video_is_mda())
|
||||||
ret |= 0xc0;
|
ret |= 0xc0;
|
||||||
|
|
||||||
switch (amstrad_latch) {
|
switch (amstrad_latch & 0x7fffffff) {
|
||||||
case AMSTRAD_NOLATCH:
|
case AMSTRAD_NOLATCH:
|
||||||
ret &= ~0x20;
|
ret &= ~0x20;
|
||||||
break;
|
break;
|
||||||
@@ -2293,6 +2293,7 @@ machine_amstrad_init(const machine_t *model, int type)
|
|||||||
ams = (amstrad_t *) malloc(sizeof(amstrad_t));
|
ams = (amstrad_t *) malloc(sizeof(amstrad_t));
|
||||||
memset(ams, 0x00, sizeof(amstrad_t));
|
memset(ams, 0x00, sizeof(amstrad_t));
|
||||||
ams->type = type;
|
ams->type = type;
|
||||||
|
amstrad_latch = 0x80000000;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AMS_PC200:
|
case AMS_PC200:
|
||||||
|
Reference in New Issue
Block a user