Fix LPT port accesses on Amstrad machines - Amstrad machines work again.

This commit is contained in:
SarahW 2017-12-09 22:10:43 +00:00
commit 30017ea58b
3 changed files with 20 additions and 5 deletions

View file

@ -11,15 +11,20 @@ static uint8_t amstrad_dead;
uint8_t amstrad_read(uint16_t port, void *priv) uint8_t amstrad_read(uint16_t port, void *priv)
{ {
uint8_t temp;
pclog("amstrad_read : %04X\n",port); pclog("amstrad_read : %04X\n",port);
switch (port) switch (port)
{ {
case 0x378:
return lpt1_read(port, NULL);
case 0x379: case 0x379:
return 7; return lpt1_read(port, NULL) | 7;
case 0x37a: case 0x37a:
if (romset == ROM_PC1512) return 0x20; temp = lpt1_read(port, NULL) & 0x1f;
if (romset == ROM_PC200) return 0x80; if (romset == ROM_PC1512) return temp | 0x20;
return 0; if (romset == ROM_PC200) return temp | 0x80;
return temp;
case 0xdead: case 0xdead:
return amstrad_dead; return amstrad_dead;
} }
@ -30,6 +35,12 @@ void amstrad_write(uint16_t port, uint8_t val, void *priv)
{ {
switch (port) switch (port)
{ {
case 0x378:
case 0x379:
case 0x37a:
lpt1_write(port, val, NULL);
break;
case 0xdead: case 0xdead:
amstrad_dead = val; amstrad_dead = val;
break; break;
@ -108,6 +119,6 @@ void amstrad_init()
io_sethandler(0x0078, 0x0001, amstrad_mouse_read, NULL, NULL, amstrad_mouse_write, NULL, NULL, NULL); io_sethandler(0x0078, 0x0001, amstrad_mouse_read, NULL, NULL, amstrad_mouse_write, NULL, NULL, NULL);
io_sethandler(0x007a, 0x0001, amstrad_mouse_read, NULL, NULL, amstrad_mouse_write, NULL, NULL, NULL); io_sethandler(0x007a, 0x0001, amstrad_mouse_read, NULL, NULL, amstrad_mouse_write, NULL, NULL, NULL);
io_sethandler(0x0379, 0x0002, amstrad_read, NULL, NULL, NULL, NULL, NULL, NULL); io_sethandler(0x0378, 0x0003, amstrad_read, NULL, NULL, amstrad_write, NULL, NULL, NULL);
io_sethandler(0xdead, 0x0001, amstrad_read, NULL, NULL, amstrad_write, NULL, NULL, NULL); io_sethandler(0xdead, 0x0001, amstrad_read, NULL, NULL, amstrad_write, NULL, NULL, NULL);
} }

View file

@ -5,6 +5,9 @@ extern void lpt2_init(uint16_t port);
extern void lpt2_remove(); extern void lpt2_remove();
extern void lpt2_remove_ams(); extern void lpt2_remove_ams();
void lpt1_write(uint16_t port, uint8_t val, void *priv);
uint8_t lpt1_read(uint16_t port, void *priv);
void lpt1_device_init(); void lpt1_device_init();
void lpt1_device_close(); void lpt1_device_close();

View file

@ -282,6 +282,7 @@ void ams_init()
AMSTRAD = 1; AMSTRAD = 1;
common_init(); common_init();
mem_add_bios(); mem_add_bios();
lpt1_remove();
amstrad_init(); amstrad_init();
keyboard_amstrad_init(); keyboard_amstrad_init();
nvr_init(); nvr_init();