PCem

changeset 164:9a88154e8608

Implemented NMI mask register for XT machines. Fixed PC200 NMI stuff.
author TomW
date Sat Sep 27 18:39:06 2014 +0100
parents b7ff0dbb7baf
children 0710d7cb935f
files src/808x.c src/Makefile.am src/Makefile.in src/Makefile.mingw src/keyboard_amstrad.c src/model.c src/nmi.c src/nmi.h src/vid_pc200.c
diffstat 9 files changed, 54 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/src/808x.c	Sat Sep 27 12:13:46 2014 +0100
     1.2 +++ b/src/808x.c	Sat Sep 27 18:39:06 2014 +0100
     1.3 @@ -15,6 +15,7 @@
     1.4  #include "cpu.h"
     1.5  #include "keyboard.h"
     1.6  #include "mem.h"
     1.7 +#include "nmi.h"
     1.8  #include "pic.h"
     1.9  #include "timer.h"
    1.10  #include "x86.h"
    1.11 @@ -3427,7 +3428,7 @@
    1.12                          loadcs(readmemw(0,addr+2));
    1.13                          FETCHCLEAR();
    1.14                  }
    1.15 -                else if (nmi && nmi_enable)
    1.16 +                else if (nmi && nmi_enable && nmi_mask)
    1.17                  {
    1.18  //                        output = 3;
    1.19                          writememw(ss,(SP-2)&0xFFFF,flags|0xF000);
     2.1 --- a/src/Makefile.am	Sat Sep 27 12:13:46 2014 +0100
     2.2 +++ b/src/Makefile.am	Sat Sep 27 18:39:06 2014 +0100
     2.3 @@ -19,7 +19,7 @@
     2.4  allegro-midi.c allegro-mouse.c allegro-video.c amstrad.c cdrom-ioctl-linux.c cdrom-null.c \
     2.5  config.c cpu.c dac.c device.c dma.c fdc.c gameport.c headland.c i430vx.c ide.c io.c jim.c \
     2.6  keyboard.c keyboard_amstrad.c keyboard_at.c keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c \
     2.7 -linux-time.c lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c mouse_serial.c neat.c nvr.c \
     2.8 +linux-time.c lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c mouse_serial.c neat.c nmi.c nvr.c \
     2.9  olivetti_m24.c opti.c pc.c pci.c pic.c piix.c pit.c ppi.c rom.c serial.c sis496.c sound.c \
    2.10  sound_ad1848.c sound_adlib.c sound_adlibgold.c sound_cms.c sound_emu8k.c sound_gus.c \
    2.11  sound_mpu401_uart.c sound_opl.c sound_pas16.c sound_sb.c sound_sb_dsp.c sound_sn76489.c \
     3.1 --- a/src/Makefile.in	Sat Sep 27 12:13:46 2014 +0100
     3.2 +++ b/src/Makefile.in	Sat Sep 27 18:39:06 2014 +0100
     3.3 @@ -68,7 +68,7 @@
     3.4  	pcem-lpt.$(OBJEXT) pcem-mcr.$(OBJEXT) pcem-mem.$(OBJEXT) \
     3.5  	pcem-model.$(OBJEXT) pcem-mouse.$(OBJEXT) \
     3.6  	pcem-mouse_ps2.$(OBJEXT) pcem-mouse_serial.$(OBJEXT) \
     3.7 -	pcem-neat.$(OBJEXT) pcem-nvr.$(OBJEXT) \
     3.8 +	pcem-neat.$(OBJEXT) pcem-nmi.$(OBJEXT) pcem-nvr.$(OBJEXT) \
     3.9  	pcem-olivetti_m24.$(OBJEXT) pcem-opti.$(OBJEXT) \
    3.10  	pcem-pc.$(OBJEXT) pcem-pci.$(OBJEXT) pcem-pic.$(OBJEXT) \
    3.11  	pcem-piix.$(OBJEXT) pcem-pit.$(OBJEXT) pcem-ppi.$(OBJEXT) \
    3.12 @@ -231,7 +231,7 @@
    3.13  allegro-midi.c allegro-mouse.c allegro-video.c amstrad.c cdrom-ioctl-linux.c cdrom-null.c \
    3.14  config.c cpu.c dac.c device.c dma.c fdc.c gameport.c headland.c i430vx.c ide.c io.c jim.c \
    3.15  keyboard.c keyboard_amstrad.c keyboard_at.c keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c \
    3.16 -linux-time.c lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c mouse_serial.c neat.c nvr.c \
    3.17 +linux-time.c lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c mouse_serial.c neat.c nmi.c nvr.c \
    3.18  olivetti_m24.c opti.c pc.c pci.c pic.c piix.c pit.c ppi.c rom.c serial.c sis496.c sound.c \
    3.19  sound_ad1848.c sound_adlib.c sound_adlibgold.c sound_cms.c sound_emu8k.c sound_gus.c \
    3.20  sound_mpu401_uart.c sound_opl.c sound_pas16.c sound_sb.c sound_sb_dsp.c sound_sn76489.c \
    3.21 @@ -380,6 +380,7 @@
    3.22  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-mouse_ps2.Po@am__quote@
    3.23  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-mouse_serial.Po@am__quote@
    3.24  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-neat.Po@am__quote@
    3.25 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-nmi.Po@am__quote@
    3.26  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-nvr.Po@am__quote@
    3.27  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-olivetti_m24.Po@am__quote@
    3.28  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcem-opti.Po@am__quote@
    3.29 @@ -1083,6 +1084,20 @@
    3.30  @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    3.31  @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-neat.obj `if test -f 'neat.c'; then $(CYGPATH_W) 'neat.c'; else $(CYGPATH_W) '$(srcdir)/neat.c'; fi`
    3.32  
    3.33 +pcem-nmi.o: nmi.c
    3.34 +@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-nmi.o -MD -MP -MF $(DEPDIR)/pcem-nmi.Tpo -c -o pcem-nmi.o `test -f 'nmi.c' || echo '$(srcdir)/'`nmi.c
    3.35 +@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/pcem-nmi.Tpo $(DEPDIR)/pcem-nmi.Po
    3.36 +@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='nmi.c' object='pcem-nmi.o' libtool=no @AMDEPBACKSLASH@
    3.37 +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    3.38 +@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-nmi.o `test -f 'nmi.c' || echo '$(srcdir)/'`nmi.c
    3.39 +
    3.40 +pcem-nmi.obj: nmi.c
    3.41 +@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-nmi.obj -MD -MP -MF $(DEPDIR)/pcem-nmi.Tpo -c -o pcem-nmi.obj `if test -f 'nmi.c'; then $(CYGPATH_W) 'nmi.c'; else $(CYGPATH_W) '$(srcdir)/nmi.c'; fi`
    3.42 +@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/pcem-nmi.Tpo $(DEPDIR)/pcem-nmi.Po
    3.43 +@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='nmi.c' object='pcem-nmi.obj' libtool=no @AMDEPBACKSLASH@
    3.44 +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    3.45 +@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -c -o pcem-nmi.obj `if test -f 'nmi.c'; then $(CYGPATH_W) 'nmi.c'; else $(CYGPATH_W) '$(srcdir)/nmi.c'; fi`
    3.46 +
    3.47  pcem-nvr.o: nvr.c
    3.48  @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pcem_CFLAGS) $(CFLAGS) -MT pcem-nvr.o -MD -MP -MF $(DEPDIR)/pcem-nvr.Tpo -c -o pcem-nvr.o `test -f 'nvr.c' || echo '$(srcdir)/'`nvr.c
    3.49  @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/pcem-nvr.Tpo $(DEPDIR)/pcem-nvr.Po
     4.1 --- a/src/Makefile.mingw	Sat Sep 27 12:13:46 2014 +0100
     4.2 +++ b/src/Makefile.mingw	Sat Sep 27 18:39:06 2014 +0100
     4.3 @@ -7,7 +7,7 @@
     4.4  	config.o cpu.o dac.o device.o dma.o fdc.o gameport.o \
     4.5  	headland.o i430vx.o ide.o io.o jim.o keyboard.o keyboard_amstrad.o keyboard_at.o \
     4.6  	keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o model.o \
     4.7 -	mouse.o mouse_ps2.o mouse_serial.o neat.o nvr.o olivetti_m24.o \
     4.8 +	mouse.o mouse_ps2.o mouse_serial.o neat.o nmi.o nvr.o olivetti_m24.o \
     4.9       opti.o pc.o pci.o pic.o piix.o pit.o ppi.o rom.o serial.o sis496.o sound.o sound_ad1848.o sound_adlib.o \
    4.10  	sound_adlibgold.o sound_cms.o sound_dbopl.o sound_emu8k.o sound_gus.o sound_mpu401_uart.o sound_opl.o \
    4.11  	sound_pas16.o sound_resid.o sound_sb.o sound_sb_dsp.o sound_sn76489.o sound_speaker.o \
    4.12 @@ -44,4 +44,4 @@
    4.13  	$(CPP) $(CFLAGS) -c $<
    4.14  
    4.15  pc.res: pc.rc
    4.16 -	$(WINDRES) -i pc.rc --input-format=rc -o pc.res -O coff 
    4.17 \ No newline at end of file
    4.18 +	$(WINDRES) -i pc.rc --input-format=rc -o pc.res -O coff 
     5.1 --- a/src/keyboard_amstrad.c	Sat Sep 27 12:13:46 2014 +0100
     5.2 +++ b/src/keyboard_amstrad.c	Sat Sep 27 18:39:06 2014 +0100
     5.3 @@ -141,6 +141,8 @@
     5.4                  else
     5.5                     temp = amstrad_systemstat_2 >> 4;
     5.6                  temp |= (ppispeakon ? 0x20 : 0);
     5.7 +                if (nmi)
     5.8 +                        temp |= 0x40;
     5.9                  break;
    5.10                  
    5.11                  default:
     6.1 --- a/src/model.c	Sat Sep 27 12:13:46 2014 +0100
     6.2 +++ b/src/model.c	Sat Sep 27 18:39:06 2014 +0100
     6.3 @@ -23,6 +23,7 @@
     6.4  #include "mouse_ps2.h"
     6.5  #include "mouse_serial.h"
     6.6  #include "neat.h"
     6.7 +#include "nmi.h"
     6.8  #include "nvr.h"
     6.9  #include "olivetti_m24.h"
    6.10  #include "pci.h"
    6.11 @@ -133,6 +134,7 @@
    6.12          keyboard_xt_init();
    6.13          mouse_serial_init();
    6.14          xtide_init();
    6.15 +	nmi_init();
    6.16  }
    6.17  
    6.18  void pcjr_init()
    6.19 @@ -144,6 +146,7 @@
    6.20          serial1_init(0x2f8, 3);
    6.21          keyboard_pcjr_init();
    6.22          device_add(&sn76489_device);
    6.23 +	nmi_mask = 0x80;
    6.24  }
    6.25  
    6.26  void tandy1k_init()
    6.27 @@ -153,6 +156,7 @@
    6.28          mouse_serial_init();
    6.29          device_add(&sn76489_device);
    6.30          xtide_init();
    6.31 +	nmi_init();
    6.32  }
    6.33  
    6.34  void ams_init()
    6.35 @@ -162,6 +166,7 @@
    6.36          keyboard_amstrad_init();
    6.37          nvr_init();
    6.38          xtide_init();
    6.39 +	nmi_init();
    6.40  }
    6.41  
    6.42  void europc_init()
    6.43 @@ -171,6 +176,7 @@
    6.44          keyboard_xt_init();
    6.45          mouse_serial_init();
    6.46          xtide_init();
    6.47 +	nmi_init();
    6.48  }
    6.49  
    6.50  void olim24_init()
    6.51 @@ -180,6 +186,7 @@
    6.52          nvr_init();
    6.53          olivetti_m24_init();
    6.54          xtide_init();
    6.55 +	nmi_init();
    6.56  }
    6.57  
    6.58  void at_init()
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/nmi.c	Sat Sep 27 18:39:06 2014 +0100
     7.3 @@ -0,0 +1,15 @@
     7.4 +#include "ibm.h"
     7.5 +#include "nmi.h"
     7.6 +
     7.7 +int nmi_mask;
     7.8 +
     7.9 +void nmi_write(uint16_t port, uint8_t val, void *p)
    7.10 +{
    7.11 +        nmi_mask = val & 0x80;
    7.12 +}
    7.13 +
    7.14 +void nmi_init()
    7.15 +{
    7.16 +        io_sethandler(0x00a0, 0x0001, NULL, NULL, NULL, nmi_write, NULL, NULL,  NULL);
    7.17 +        nmi_mask = 0;
    7.18 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/nmi.h	Sat Sep 27 18:39:06 2014 +0100
     8.3 @@ -0,0 +1,5 @@
     8.4 +void nmi_init();
     8.5 +void nmi_write(uint16_t port, uint8_t val, void *p);
     8.6 +extern int nmi_mask;
     8.7 +
     8.8 +
     9.1 --- a/src/vid_pc200.c	Sat Sep 27 12:13:46 2014 +0100
     9.2 +++ b/src/vid_pc200.c	Sat Sep 27 18:39:06 2014 +0100
     9.3 @@ -90,10 +90,11 @@
     9.4                  case 0x3DD:
     9.5                  temp = pc200->reg_3dd;
     9.6                  pc200->reg_3dd &= 0x1f;
     9.7 +		nmi = 0;
     9.8                  return temp;
     9.9                  
    9.10                  case 0x3DE:
    9.11 -                return (pc200->reg_3de & 0xc7) | 0x18; /*External CGA*/
    9.12 +                return (pc200->reg_3de & 0xc7) | 0x10; /*External CGA*/
    9.13                  
    9.14                  case 0x3DF:
    9.15                  return pc200->reg_3df;
    9.16 @@ -113,7 +114,7 @@
    9.17          timer_add(cga_poll, &cga->vidtime, TIMER_ALWAYS_ENABLED, cga);
    9.18          mem_mapping_add(&pc200->mapping, 0xb8000, 0x08000, cga_read, NULL, NULL, cga_write, NULL, NULL,  NULL, 0, cga);
    9.19          io_sethandler(0x03d0, 0x0010, pc200_in, NULL, NULL, pc200_out, NULL, NULL, pc200);
    9.20 -        return cga;
    9.21 +        return pc200;
    9.22  }
    9.23  
    9.24  void pc200_close(void *p)