Previous 15994 Revisions Next

r10865 Saturday 19th March, 2011 at 16:30:43 UTC by Miodrag Milanović
[IBMPC] Using motherboard devices and ISA now
[src/mess/drivers]ibmpc.c
[src/mess/includes]genpc.h
[src/mess/machine]genpc.c pc.c

src/mess/machine/genpc.c
r10864r10865
1414#include "machine/8237dma.h"
1515#include "sound/speaker.h"
1616#include "machine/ram.h"
17#include "imagedev/cassette.h"
1718
1819#define VERBOSE_PIO 0   /* PIO (keyboard controller) */
1920
r10864r10865
646647   install_device(pit8253, 0x0040, 0x0043, 0, 0, pit8253_r, pit8253_w );   
647648   install_device(ppi8255, 0x0060, 0x0063, 0, 0, i8255a_r, i8255a_w );   
648649   install_device(this,    0x0080, 0x0087, 0, 0, pc_page_r, pc_page_w );   
649   install_device_write(this,    0x00a0, 0x00a0, 0, 0, nmi_enable_w);   
650   install_device_write(this,    0x00a0, 0x00a1, 0, 0, nmi_enable_w);   
650651   /* MESS managed RAM */
651652   if ( ram_get_ptr(machine->device(RAM_TAG)) )
652653      memory_set_bankptr( machine, "bank10", ram_get_ptr(machine->device(RAM_TAG)) );   
r10864r10865
685686   nmi_enabled = 0;
686687   speaker_level_w( speaker, 0 );
687688}
689
690
691//**************************************************************************
692//  GLOBAL VARIABLES
693//**************************************************************************
694 
695const device_type IBM5150_MOTHERBOARD = ibm5150_mb_device_config::static_alloc_device_config;
696 
697//**************************************************************************
698//  DEVICE CONFIGURATION
699//**************************************************************************
700static const cassette_config ibm5150_cassette_config =
701{
702   cassette_default_formats,
703   NULL,
704   (cassette_state)(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED),
705   NULL
706};
707
708static MACHINE_CONFIG_FRAGMENT( ibm5150_mb_config )
709   MCFG_FRAGMENT_ADD(ibm5160_mb_config)
710   
711   MCFG_CASSETTE_ADD( "cassette", ibm5150_cassette_config )
712MACHINE_CONFIG_END
713
714 
715//-------------------------------------------------
716//  ibm5150_mb_device_config - constructor
717//-------------------------------------------------
718 
719ibm5150_mb_device_config::ibm5150_mb_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
720        : ibm5160_mb_device_config(mconfig, tag, owner, clock)
721{
722}
723 
724//-------------------------------------------------
725//  static_alloc_device_config - allocate a new
726//  configuration object
727//-------------------------------------------------
728 
729device_config *ibm5150_mb_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
730{
731   return global_alloc(ibm5150_mb_device_config(mconfig, tag, owner, clock));
732}
733 
734//-------------------------------------------------
735//  alloc_device - allocate a new device object
736//-------------------------------------------------
737 
738device_t *ibm5150_mb_device_config::alloc_device(running_machine &machine) const
739{
740   return auto_alloc(&machine, ibm5150_mb_device(machine, *this));
741}
742
743//-------------------------------------------------
744//  machine_config_additions - device-specific
745//  machine configurations
746//-------------------------------------------------
747
748machine_config_constructor ibm5150_mb_device_config::machine_config_additions() const
749{
750   return MACHINE_CONFIG_NAME( ibm5150_mb_config );
751}
752
753//**************************************************************************
754//  LIVE DEVICE
755//**************************************************************************
756 
757//-------------------------------------------------
758//  ibm5150_mb_device - constructor
759//-------------------------------------------------
760 
761ibm5150_mb_device::ibm5150_mb_device(running_machine &_machine, const ibm5150_mb_device_config &config) :
762        ibm5160_mb_device(_machine, config),
763      m_cassette(*this, "cassette")
764{
765}
766 
767void ibm5150_mb_device::device_start()
768{
769   ibm5160_mb_device::device_start();
770}
771void ibm5150_mb_device::device_reset()
772{
773   ibm5160_mb_device::device_reset();
774}
775
776READ8_MEMBER (ibm5150_mb_device::pc_ppi_porta_r)
777{
778   int data = 0xFF;
779   /* KB port A */
780   if (ppi_keyboard_clear)
781   {
782      /*   0  0 - no floppy drives
783         *   1  Not used
784         * 2-3  The number of memory banks on the system board
785         * 4-5  Display mode
786         *      11 = monochrome
787         *      10 - color 80x25
788         *      01 - color 40x25
789         * 6-7  The number of floppy disk drives
790         */
791      data = input_port_read(this, "DSW0") & 0xF3;
792      switch ( ram_get_size(machine->device(RAM_TAG)) )
793      {
794      case 16 * 1024:
795         data |= 0x00;
796         break;
797      case 32 * 1024:   /* Need to verify if this is correct */
798         data |= 0x04;
799         break;
800      case 48 * 1024:   /* Need to verify if this is correct */
801         data |= 0x08;
802         break;
803      default:
804         data |= 0x0C;
805         break;
806      }
807   }
808   else
809   {
810      data = ppi_shift_register;
811   }
812    PIO_LOG(1,"PIO_A_r",("$%02x\n", data));
813    return data;
814}
815
816
817READ8_MEMBER ( ibm5150_mb_device::pc_ppi_portc_r )
818{
819   int timer2_output = pit8253_get_output( pit8253, 2 );
820   int data=0xff;
821
822   data&=~0x80; // no parity error
823   data&=~0x40; // no error on expansion board
824   /* KB port C: equipment flags */
825   if (ppi_portc_switch_high)
826   {
827      /* read hi nibble of SW2 */
828      data = data & 0xf0;
829
830      switch ( ram_get_size(machine->device(RAM_TAG)) - 64 * 1024 )
831      {
832      case 64 * 1024:      data |= 0x00; break;
833      case 128 * 1024:   data |= 0x02; break;
834      case 192 * 1024:   data |= 0x04; break;
835      case 256 * 1024:   data |= 0x06; break;
836      case 320 * 1024:   data |= 0x08; break;
837      case 384 * 1024:   data |= 0x0A; break;
838      case 448 * 1024:   data |= 0x0C; break;
839      case 512 * 1024:   data |= 0x0E; break;
840      case 576 * 1024:   data |= 0x01; break;
841      case 640 * 1024:   data |= 0x03; break;
842      case 704 * 1024:   data |= 0x05; break;
843      case 768 * 1024:   data |= 0x07; break;
844      case 832 * 1024:   data |= 0x09; break;
845      case 896 * 1024:   data |= 0x0B; break;
846      case 960 * 1024:   data |= 0x0D; break;
847      }
848      if ( ram_get_size(machine->device(RAM_TAG)) > 960 * 1024 )
849         data |= 0x0D;
850
851      PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data));
852   }
853   else
854   {
855      /* read lo nibble of S2 */
856      data = (data & 0xf0) | (input_port_read(this, "DSW0") & 0x0f);
857      PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data));
858   }
859
860   if ( ! ( ppi_portb & 0x08 ) )
861   {
862      double tap_val = cassette_input(m_cassette);
863
864      if ( tap_val < 0 )
865      {
866         data &= ~0x10;
867      }
868      else
869      {
870         data |= 0x10;
871      }
872   }
873   else
874   {
875      if ( ppi_portb & 0x01 )
876      {
877         data = ( data & ~0x10 ) | ( timer2_output ? 0x10 : 0x00 );
878      }
879   }
880   data = ( data & ~0x20 ) | ( timer2_output ? 0x20 : 0x00 );
881
882   return data;
883}
884
885
886WRITE8_MEMBER( ibm5150_mb_device::pc_ppi_portb_w )
887{
888   /* KB controller port B */
889   ppi_portb = data;
890   ppi_portc_switch_high = data & 0x08;
891   ppi_keyboard_clear = data & 0x80;
892   ppi_keyb_clock = data & 0x40;
893   pit8253_gate2_w(pit8253, BIT(data, 0));
894   pc_speaker_set_spkrdata( data & 0x02 );
895
896   cassette_change_state( m_cassette, ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
897
898   ppi_clock_signal = ( ppi_keyb_clock ) ? 1 : 0;
899      devcb_call_write_line(&m_kb_set_clock_signal_func,ppi_clock_signal);
900
901
902   /* If PB7 is set clear the shift register and reset the IRQ line */
903   if ( ppi_keyboard_clear )
904   {
905      pic8259_ir1_w(pic8259, 0);
906      ppi_shift_register = 0;
907      ppi_shift_enable = 1;
908   }
909}
src/mess/machine/pc.c
r10864r10865
601601 *
602602 **********************************************************/
603603
604static READ8_DEVICE_HANDLER (ibm5150_ppi_porta_r)
605{
606   int data = 0xFF;
607   running_machine *machine = device->machine;
608   pc_state *st = device->machine->driver_data<pc_state>();
609604
610   /* KB port A */
611   if (st->ppi_keyboard_clear)
612   {
613      /*   0  0 - no floppy drives
614         *   1  Not used
615         * 2-3  The number of memory banks on the system board
616         * 4-5  Display mode
617         *      11 = monochrome
618         *      10 - color 80x25
619         *      01 - color 40x25
620         * 6-7  The number of floppy disk drives
621         */
622      data = input_port_read(device->machine, "DSW0") & 0xF3;
623      switch ( ram_get_size(machine->device(RAM_TAG)) )
624      {
625      case 16 * 1024:
626         data |= 0x00;
627         break;
628      case 32 * 1024:   /* Need to verify if this is correct */
629         data |= 0x04;
630         break;
631      case 48 * 1024:   /* Need to verify if this is correct */
632         data |= 0x08;
633         break;
634      default:
635         data |= 0x0C;
636         break;
637      }
638   }
639   else
640   {
641      data = st->ppi_shift_register;
642   }
643    PIO_LOG(1,"PIO_A_r",("$%02x\n", data));
644    return data;
645}
646
647
648static READ8_DEVICE_HANDLER (ibm5150_ppi_portb_r )
649{
650   int data;
651   running_machine *machine = device->machine;
652
653   data = 0xff;
654   PIO_LOG(1,"PIO_B_r",("$%02x\n", data));
655   return data;
656}
657
658
659static READ8_DEVICE_HANDLER ( ibm5150_ppi_portc_r )
660{
661   pc_state *st = device->machine->driver_data<pc_state>();
662   int timer2_output = pit8253_get_output( st->pit8253, 2 );
663   int data=0xff;
664   running_machine *machine = device->machine;
665
666   data&=~0x80; // no parity error
667   data&=~0x40; // no error on expansion board
668   /* KB port C: equipment flags */
669   if (st->ppi_portc_switch_high)
670   {
671      /* read hi nibble of SW2 */
672      data = data & 0xf0;
673
674      switch ( ram_get_size(machine->device(RAM_TAG)) - 64 * 1024 )
675      {
676      case 64 * 1024:      data |= 0x00; break;
677      case 128 * 1024:   data |= 0x02; break;
678      case 192 * 1024:   data |= 0x04; break;
679      case 256 * 1024:   data |= 0x06; break;
680      case 320 * 1024:   data |= 0x08; break;
681      case 384 * 1024:   data |= 0x0A; break;
682      case 448 * 1024:   data |= 0x0C; break;
683      case 512 * 1024:   data |= 0x0E; break;
684      case 576 * 1024:   data |= 0x01; break;
685      case 640 * 1024:   data |= 0x03; break;
686      case 704 * 1024:   data |= 0x05; break;
687      case 768 * 1024:   data |= 0x07; break;
688      case 832 * 1024:   data |= 0x09; break;
689      case 896 * 1024:   data |= 0x0B; break;
690      case 960 * 1024:   data |= 0x0D; break;
691      }
692      if ( ram_get_size(machine->device(RAM_TAG)) > 960 * 1024 )
693         data |= 0x0D;
694
695      PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data));
696   }
697   else
698   {
699      /* read lo nibble of S2 */
700      data = (data & 0xf0) | (input_port_read(device->machine, "DSW0") & 0x0f);
701      PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data));
702   }
703
704   if ( ! ( st->ppi_portb & 0x08 ) )
705   {
706      double tap_val = cassette_input( device->machine->device("cassette") );
707
708      if ( tap_val < 0 )
709      {
710         data &= ~0x10;
711      }
712      else
713      {
714         data |= 0x10;
715      }
716   }
717   else
718   {
719      if ( st->ppi_portb & 0x01 )
720      {
721         data = ( data & ~0x10 ) | ( timer2_output ? 0x10 : 0x00 );
722      }
723   }
724   data = ( data & ~0x20 ) | ( timer2_output ? 0x20 : 0x00 );
725
726   return data;
727}
728
729
730static WRITE8_DEVICE_HANDLER ( ibm5150_ppi_porta_w )
731{
732   running_machine *machine = device->machine;
733
734   /* KB controller port A */
735   PIO_LOG(1,"PIO_A_w",("$%02x\n", data));
736}
737
738
739static WRITE8_DEVICE_HANDLER ( ibm5150_ppi_portb_w )
740{
741   pc_state *st = device->machine->driver_data<pc_state>();
742   device_t *keyboard = device->machine->device("keyboard");
743
744   /* KB controller port B */
745   st->ppi_portb = data;
746   st->ppi_portc_switch_high = data & 0x08;
747   st->ppi_keyboard_clear = data & 0x80;
748   st->ppi_keyb_clock = data & 0x40;
749   pit8253_gate2_w(st->pit8253, BIT(data, 0));
750   pc_speaker_set_spkrdata( device->machine, data & 0x02 );
751
752   cassette_change_state( device->machine->device("cassette"), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
753
754   st->ppi_clock_signal = ( st->ppi_keyb_clock ) ? 1 : 0;
755   kb_keytronic_clock_w(keyboard, st->ppi_clock_signal);
756
757   /* If PB7 is set clear the shift register and reset the IRQ line */
758   if ( st->ppi_keyboard_clear )
759   {
760      pic8259_ir1_w(st->pic8259, 0);
761      st->ppi_shift_register = 0;
762      st->ppi_shift_enable = 1;
763   }
764}
765
766
767static WRITE8_DEVICE_HANDLER ( ibm5150_ppi_portc_w )
768{
769   running_machine *machine = device->machine;
770
771   /* KB controller port C */
772   PIO_LOG(1,"PIO_C_w",("$%02x\n", data));
773}
774
775
776605WRITE8_HANDLER( ibm5150_kb_set_clock_signal )
777606{
778607   pc_state *st = space->machine->driver_data<pc_state>();
r10864r10865
817646   kb_keytronic_data_w(keyboard, st->ppi_data_signal);
818647}
819648
820
821/* IBM PC has a 8255 which is connected to keyboard and other
822status information */
823I8255A_INTERFACE( ibm5150_ppi8255_interface )
824{
825   DEVCB_HANDLER(ibm5150_ppi_porta_r),
826   DEVCB_HANDLER(ibm5150_ppi_portb_r),
827   DEVCB_HANDLER(ibm5150_ppi_portc_r),
828   DEVCB_HANDLER(ibm5150_ppi_porta_w),
829   DEVCB_HANDLER(ibm5150_ppi_portb_w),
830   DEVCB_HANDLER(ibm5150_ppi_portc_w)
831};
832
833
834649static READ8_DEVICE_HANDLER (ibm5160_ppi_porta_r)
835650{
836651   int data = 0xFF;
r10864r10865
923738I8255A_INTERFACE( ibm5160_ppi8255_interface )
924739{
925740   DEVCB_HANDLER(ibm5160_ppi_porta_r),
926   DEVCB_HANDLER(ibm5150_ppi_portb_r),
741   DEVCB_NULL,
927742   DEVCB_HANDLER(ibm5160_ppi_portc_r),
928   DEVCB_HANDLER(ibm5150_ppi_porta_w),
743   DEVCB_NULL,
929744   DEVCB_HANDLER(ibm5160_ppi_portb_w),
930   DEVCB_HANDLER(ibm5150_ppi_portc_w)
745   DEVCB_NULL
931746};
932747
933748
r10864r10865
980795I8255A_INTERFACE( pc_ppi8255_interface )
981796{
982797   DEVCB_HANDLER(pc_ppi_porta_r),
983   DEVCB_HANDLER(ibm5150_ppi_portb_r),
798   DEVCB_NULL,
984799   DEVCB_HANDLER(ibm5160_ppi_portc_r),
985   DEVCB_HANDLER(ibm5150_ppi_porta_w),
800   DEVCB_NULL,
986801   DEVCB_HANDLER(pc_ppi_portb_w),
987   DEVCB_HANDLER(ibm5150_ppi_portc_w)
802   DEVCB_NULL
988803};
989804
990805
r10864r10865
1067882I8255A_INTERFACE( pcjr_ppi8255_interface )
1068883{
1069884   DEVCB_HANDLER(pcjr_ppi_porta_r),
1070   DEVCB_HANDLER(ibm5150_ppi_portb_r),
885   DEVCB_NULL,
1071886   DEVCB_HANDLER(pcjr_ppi_portc_r),
1072   DEVCB_HANDLER(ibm5150_ppi_porta_w),
887   DEVCB_NULL,
1073888   DEVCB_HANDLER(pcjr_ppi_portb_w),
1074   DEVCB_HANDLER(ibm5150_ppi_portc_w)
889   DEVCB_NULL
1075890};
1076891
1077892
src/mess/includes/genpc.h
r10864r10865
3131                         public motherboard_interface
3232{
3333   friend class ibm5160_mb_device;
34 
34
35protected:   
3536   // construction/destruction
3637   ibm5160_mb_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
3738 
r10864r10865
6061{
6162        friend class ibm5160_mb_device_config;
6263 
64protected:
6365        // construction/destruction
6466        ibm5160_mb_device(running_machine &_machine, const ibm5160_mb_device_config &config);
6567
66protected:
6768        // device-level overrides
6869        virtual void device_start();
6970        virtual void device_reset();
r10864r10865
111112      DECLARE_WRITE_LINE_MEMBER( keyboard_clock_w );
112113      DECLARE_WRITE_LINE_MEMBER( keyboard_data_w );
113114
114      DECLARE_READ8_MEMBER ( pc_ppi_porta_r );
115      DECLARE_READ8_MEMBER ( pc_ppi_portc_r );
116      DECLARE_WRITE8_MEMBER( pc_ppi_portb_w );
115      virtual DECLARE_READ8_MEMBER ( pc_ppi_porta_r );
116      virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r );
117      virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w );
117118
118119      DECLARE_WRITE_LINE_MEMBER( pc_pit8253_out1_changed );
119120      DECLARE_WRITE_LINE_MEMBER( pc_pit8253_out2_changed );
r10864r10865
143144// device type definition
144145extern const device_type IBM5160_MOTHERBOARD;
145146
147
148#define MCFG_IBM5150_MOTHERBOARD_ADD(_tag, _cputag, _config) \
149    MCFG_DEVICE_ADD(_tag, IBM5150_MOTHERBOARD, 0) \
150    MCFG_DEVICE_CONFIG(_config) \
151    ibm5150_mb_device_config::static_set_cputag(device, _cputag); \
152
153// ======================> ibm5150_mb_device_config
154 
155class ibm5150_mb_device_config : public ibm5160_mb_device_config
156{
157   friend class ibm5150_mb_device;
158   friend class ibm5160_mb_device_config;
159 
160   // construction/destruction
161   ibm5150_mb_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
162 
163public:
164   // allocators
165   static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
166   virtual device_t *alloc_device(running_machine &machine) const;
167 
168   // optional information overrides
169   virtual machine_config_constructor machine_config_additions() const;
170};
171 
172 
173// ======================> ibm5150_mb_device
174class ibm5150_mb_device : public ibm5160_mb_device
175{
176        friend class ibm5160_mb_device;
177      friend class ibm5150_mb_device_config;
178 
179        // construction/destruction
180        ibm5150_mb_device(running_machine &_machine, const ibm5150_mb_device_config &config);
181
182protected:
183        // device-level overrides
184        virtual void device_start();
185        virtual void device_reset();
186     
187      required_device<device_t>   m_cassette;
188public:
189      virtual DECLARE_READ8_MEMBER ( pc_ppi_porta_r );
190      virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r );
191      virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w );     
192};
193 
194 
195// device type definition
196extern const device_type IBM5150_MOTHERBOARD;
197
146198#endif /* GENPC_H_ */
src/mess/drivers/ibmpc.c
r10864r10865
8484
8585#include "emu.h"
8686#include "cpu/i86/i86.h"
87#include "sound/speaker.h"
88#include "sound/saa1099.h"
89
90#include "machine/i8255a.h"
91#include "machine/ins8250.h"
92#include "machine/mc146818.h"
93#include "machine/pic8259.h"
94
95#include "machine/pit8253.h"
96#include "video/pc_vga_mess.h"
87#include "machine/ram.h"
88#include "machine/isa.h"
89#include "machine/isa_com.h"
90#include "machine/isa_fdc.h"
91#include "machine/isa_hdc.h"
92#include "machine/kb_keytro.h"
9793#include "video/pc_cga.h"
98#include "video/pc_ega.h"
94#include "includes/genpc.h"
9995
100#include "includes/pc_ide.h"
101#include "machine/pc_fdc.h"
102#include "machine/pc_joy.h"
103#include "machine/pckeybrd.h"
104#include "machine/pc_lpt.h"
105#include "audio/sblaster.h"
106#include "includes/pc_mouse.h"
96class ibmpc_state : public driver_device
97{
98public:
99   ibmpc_state(running_machine &machine, const driver_device_config_base &config)
100      : driver_device(machine, config) { }
107101
108#include "machine/pcshare.h"
109#include "includes/pc.h"
102};
110103
111#include "machine/pc_hdc.h"
112#include "imagedev/flopdrv.h"
113#include "imagedev/harddriv.h"
114#include "imagedev/cassette.h"
115#include "imagedev/cartslot.h"
116#include "formats/pc_dsk.h"
117
118#include "machine/8237dma.h"
119#include "sound/sn76496.h"
120#include "sound/3812intf.h"
121
122#include "machine/kb_keytro.h"
123#include "machine/ram.h"
124
125#define ym3812_StdClock 3579545
126
127/*
128  adlib (YM3812/OPL2 chip), part of many many soundcards (soundblaster)
129  soundblaster: YM3812 also accessible at 0x228/9 (address jumperable)
130  soundblaster pro version 1: 2 YM3812 chips
131   at 0x388 both accessed,
132   at 0x220/1 left?, 0x222/3 right? (jumperable)
133  soundblaster pro version 2: 1 OPL3 chip
134
135  pro audio spectrum +: 2 OPL2
136  pro audio spectrum 16: 1 OPL3
137 */
138#define ADLIB   /* YM3812/OPL2 Chip */
139/*
140  creative labs game blaster (CMS creative music system)
141  2 x saa1099 chips
142  also on sound blaster 1.0
143  option on sound blaster 1.5
144
145  jumperable? normally 0x220
146*/
147#define GAMEBLASTER
148
149
150// IO Expansion, only a little bit for ibm bios self tests
151//#define EXP_ON
152
153104static ADDRESS_MAP_START( pc8_map, ADDRESS_SPACE_PROGRAM, 8 )
154105   ADDRESS_MAP_UNMAP_HIGH
155106   AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10")
r10864r10865
162113
163114static ADDRESS_MAP_START(pc8_io, ADDRESS_SPACE_IO, 8)
164115   ADDRESS_MAP_UNMAP_HIGH
165   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("dma8237", i8237_r, i8237_w)
166   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_r, pic8259_w)
167   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_r, pit8253_w)
168   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255", i8255a_r, i8255a_w)
169   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,         pc_page_w)
170   AM_RANGE(0x00a0, 0x00a0) AM_WRITE( pc_nmi_enable_w )
171   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r,            pc_JOY_w)
172#ifdef EXP_ON
173   AM_RANGE(0x0210, 0x0217) AM_READWRITE(pc_EXP_r,            pc_EXP_w)
174#endif
175   AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc_rtc_r,            pc_rtc_w)
176   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE("lpt_2", pc_lpt_r, pc_lpt_w)
177   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_r, ins8250_w)
178   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w)
179   AM_RANGE(0x0320, 0x0323) AM_READWRITE(pc_HDC1_r,         pc_HDC1_w)
180   AM_RANGE(0x0324, 0x0327) AM_READWRITE(pc_HDC2_r,         pc_HDC2_w)
181   AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */
182   AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE("lpt_1", pc_lpt_r, pc_lpt_w)
183#ifdef ADLIB
184   AM_RANGE(0x0388, 0x0388) AM_DEVREADWRITE("ym3812", ym3812_status_port_r,ym3812_control_port_w)
185   AM_RANGE(0x0389, 0x0389) AM_DEVWRITE("ym3812", ym3812_write_port_w)
186#endif
187   AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w)
188   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_r, ins8250_w)
189   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r,            pc_fdc_w)
190   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w)
191116ADDRESS_MAP_END
192117
193118static INPUT_PORTS_START( ibm5150 )
194   PORT_START("IN0") /* IN0 */
195   PORT_BIT ( 0xf0, 0xf0,    IPT_UNUSED )
196   PORT_BIT ( 0x08, 0x08,    IPT_VBLANK )
197   PORT_BIT ( 0x07, 0x07,    IPT_UNUSED )
198
199   PORT_START("DSW0") /* IN1 */
200   PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives")
201   PORT_DIPSETTING(   0x00, "1" )
202   PORT_DIPSETTING(   0x40, "2" )
203   PORT_DIPSETTING(   0x80, "3" )
204   PORT_DIPSETTING(   0xc0, "4" )
205   PORT_DIPNAME( 0x30, 0x20, "Graphics adapter")
206   PORT_DIPSETTING(   0x00, "EGA/VGA" )
207   PORT_DIPSETTING(   0x10, "Color 40x25" )
208   PORT_DIPSETTING(   0x20, "Color 80x25" )
209   PORT_DIPSETTING(   0x30, "Monochrome" )
210   PORT_DIPNAME( 0x0c, 0x0c, "RAM banks")
211   PORT_DIPSETTING(   0x00, "1 - 16  64 256K" )
212   PORT_DIPSETTING(   0x04, "2 - 32 128 512K" )
213   PORT_DIPSETTING(   0x08, "3 - 48 192 576K" )
214   PORT_DIPSETTING(   0x0c, "4 - 64 256 640K" )
215   PORT_DIPNAME( 0x02, 0x00, "80387 installed")
216   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
217   PORT_DIPSETTING(   0x02, DEF_STR( Yes ) )
218   PORT_DIPNAME( 0x01, 0x01, "Floppy installed")
219   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
220   PORT_DIPSETTING(   0x01, DEF_STR( Yes ) )
221
222   PORT_START("DSW1") /* IN2 */
223   PORT_DIPNAME( 0x80, 0x80, "COM1: enable")
224   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
225   PORT_DIPSETTING(   0x80, DEF_STR( Yes ) )
226   PORT_DIPNAME( 0x40, 0x40, "COM2: enable")
227   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
228   PORT_DIPSETTING(   0x40, DEF_STR( Yes ) )
229   PORT_DIPNAME( 0x20, 0x00, "COM3: enable")
230   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
231   PORT_DIPSETTING(   0x20, DEF_STR( Yes ) )
232   PORT_DIPNAME( 0x10, 0x00, "COM4: enable")
233   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
234   PORT_DIPSETTING(   0x10, DEF_STR( Yes ) )
235   PORT_DIPNAME( 0x08, 0x08, "LPT1: enable")
236   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
237   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
238   PORT_DIPNAME( 0x04, 0x00, "LPT2: enable")
239   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
240   PORT_DIPSETTING(   0x04, DEF_STR( Yes ) )
241   PORT_DIPNAME( 0x02, 0x00, "LPT3: enable")
242   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
243   PORT_DIPSETTING(   0x02, DEF_STR( Yes ) )
244   PORT_DIPNAME( 0x01, 0x00, "Game port enable")
245   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
246   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
247
248   PORT_START("DSW2") /* IN3 */
249   PORT_DIPNAME( 0xf0, 0x80, "Serial mouse")
250   PORT_DIPSETTING(   0x80, "COM1" )
251   PORT_DIPSETTING(   0x40, "COM2" )
252   PORT_DIPSETTING(   0x20, "COM3" )
253   PORT_DIPSETTING(   0x10, "COM4" )
254   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
255   PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)")
256   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
257   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
258   PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)")
259   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
260   PORT_DIPSETTING(   0x04, DEF_STR( Yes ) )
261   PORT_BIT( 0x02, 0x02,   IPT_UNUSED ) /* no turbo switch */
262   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
263
264119   PORT_INCLUDE( kb_keytronic_pc )      /* IN4 - IN11 */
265   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
266   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
120//   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
121//   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
267122   PORT_INCLUDE( pcvideo_cga )
268123INPUT_PORTS_END
269124
270125static const unsigned i86_address_mask = 0x000fffff;
271126
272#if defined(ADLIB)
273/* irq line not connected to pc on adlib cards (and compatibles) */
274static void pc_irqhandler(device_t *device, int linestate) {}
275
276static const ym3812_interface pc_ym3812_interface =
277{
278   pc_irqhandler
279};
280#endif
281
282
283static const pc_lpt_interface pc_lpt_config =
284{
285   DEVCB_CPU_INPUT_LINE("maincpu", 0)
286};
287
288static const floppy_config ibmpc_floppy_config =
289{
290   DEVCB_NULL,
291   DEVCB_NULL,
292   DEVCB_NULL,
293   DEVCB_NULL,
294   DEVCB_NULL,
295   FLOPPY_STANDARD_5_25_DSHD,
296   FLOPPY_OPTIONS_NAME(pc),
297   NULL
298};
299
300127static const kb_keytronic_interface pc_keytronic_intf =
301128{
302   DEVCB_MEMORY_HANDLER("maincpu", IO, ibm5150_kb_set_clock_signal),
303   DEVCB_MEMORY_HANDLER("maincpu", IO, ibm5150_kb_set_data_signal),
129   DEVCB_DEVICE_LINE_MEMBER("mb", ibm5160_mb_device, keyboard_clock_w),   
130   DEVCB_DEVICE_LINE_MEMBER("mb", ibm5160_mb_device, keyboard_data_w)
304131};
305132
306
307#define MCFG_CPU_PC(mem, port, type, clock, vblankfunc)   \
308   MCFG_CPU_ADD("maincpu", type, clock)            \
309   MCFG_CPU_PROGRAM_MAP(mem##_map)   \
310   MCFG_CPU_IO_MAP(port##_io)   \
311   MCFG_CPU_VBLANK_INT_HACK(vblankfunc, 4)               \
312   MCFG_CPU_CONFIG(i86_address_mask)
313
314
315/* F4 Character Displayer */
316static const gfx_layout pc_16_charlayout =
133static const motherboard_interface pc_keytronic_keyboard_intf =
317134{
318   8, 16,               /* 8 x 16 characters */
319   256,               /* 256 characters */
320   1,               /* 1 bits per pixel */
321   { 0 },               /* no bitplanes */
322   /* x offsets */
323   { 0, 1, 2, 3, 4, 5, 6, 7 },
324   /* y offsets */
325   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 2048*8, 2049*8, 2050*8, 2051*8, 2052*8, 2053*8, 2054*8, 2055*8 },
326   8*8               /* every char takes 2 x 8 bytes */
135   DEVCB_DEVICE_LINE("keyboard", kb_keytronic_clock_w),
136   DEVCB_DEVICE_LINE("keyboard", kb_keytronic_data_w)
327137};
328138
329static const gfx_layout pc_8_charlayout =
330{
331   8, 8,               /* 8 x 8 characters */
332   512,               /* 512 characters */
333   1,               /* 1 bits per pixel */
334   { 0 },               /* no bitplanes */
335   /* x offsets */
336   { 0, 1, 2, 3, 4, 5, 6, 7 },
337   /* y offsets */
338   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
339   8*8               /* every char takes 8 bytes */
340};
139static DEVICE_INPUT_DEFAULTS_START(cga)
140   DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x20)
141DEVICE_INPUT_DEFAULTS_END
341142
342static const cassette_config ibm5150_cassette_config =
343{
344   cassette_default_formats,
345   NULL,
346   (cassette_state)(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED),
347   NULL
348};
349
350static GFXDECODE_START( ibm5150 )
351   GFXDECODE_ENTRY( "gfx1", 0x0000, pc_16_charlayout, 3, 1 )
352   GFXDECODE_ENTRY( "gfx1", 0x1000, pc_8_charlayout, 3, 1 )
353GFXDECODE_END
354
355static MACHINE_CONFIG_START( ibm5150, pc_state )
143static MACHINE_CONFIG_START( ibm5150, ibmpc_state )
356144   /* basic machine hardware */
357145   MCFG_CPU_ADD("maincpu", I8088, XTAL_14_31818MHz/3)
358146   MCFG_CPU_PROGRAM_MAP(pc8_map)
359147   MCFG_CPU_IO_MAP(pc8_io)
360148   MCFG_CPU_CONFIG(i86_address_mask)
361149
362   MCFG_MACHINE_START(pc)
363   MCFG_MACHINE_RESET(pc)
364
365   MCFG_PIT8253_ADD( "pit8253", ibm5150_pit8253_config )
366
367   MCFG_I8237_ADD( "dma8237", XTAL_14_31818MHz/3, ibm5150_dma8237_config )
368
369   MCFG_PIC8259_ADD( "pic8259", ibm5150_pic8259_config )
370
371   MCFG_I8255A_ADD( "ppi8255", ibm5150_ppi8255_interface )
372
373   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
374   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
375   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
376   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
377
150   MCFG_IBM5150_MOTHERBOARD_ADD("mb","maincpu",pc_keytronic_keyboard_intf)
151   MCFG_DEVICE_INPUT_DEFAULTS(cga)
152   
378153   /* video hardware */
379154   MCFG_FRAGMENT_ADD( pcvideo_cga )
380   MCFG_GFXDECODE(ibm5150)
381155
382   /* sound hardware */
383   MCFG_SPEAKER_STANDARD_MONO("mono")
384   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
385   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
386#ifdef ADLIB
387   MCFG_SOUND_ADD("ym3812", YM3812, ym3812_StdClock)
388   MCFG_SOUND_CONFIG(pc_ym3812_interface)
389   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
390#endif
391#ifdef GAMEBLASTER
392   MCFG_SOUND_ADD("saa1099.1", SAA1099, 4772720)
393   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
394   MCFG_SOUND_ADD("saa1099.2", SAA1099, 4772720)
395   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
396#endif
156    MCFG_ISA8_BUS_DEVICE("mb:isa", 1, "com", ISA8_COM)
157   MCFG_ISA8_BUS_DEVICE("mb:isa", 2, "fdc", ISA8_FDC)
158   MCFG_ISA8_BUS_DEVICE("mb:isa", 3, "hdc", ISA8_HDC)
397159
398160   /* keyboard */
399161   MCFG_KB_KEYTRONIC_ADD("keyboard", pc_keytronic_intf)
400162
401   /* printer */
402   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
403   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
404   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
163   //MCFG_CASSETTE_ADD( "cassette", ibm5150_cassette_config )
405164
406   /* harddisk */
407   MCFG_FRAGMENT_ADD( pc_hdc )
408
409   MCFG_CASSETTE_ADD( "cassette", ibm5150_cassette_config )
410
411   MCFG_UPD765A_ADD("upd765", pc_fdc_upd765_not_connected_interface)
412
413   MCFG_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
414
415165   /* internal ram */
416166   MCFG_RAM_ADD(RAM_TAG)
417167   MCFG_RAM_DEFAULT_SIZE("640K")
418168MACHINE_CONFIG_END
419169
420170
421static MACHINE_CONFIG_START( ibm5160, pc_state )
171static MACHINE_CONFIG_START( ibm5160, ibmpc_state )
422172   /* basic machine hardware */
423173   MCFG_CPU_ADD("maincpu", I8088, XTAL_14_31818MHz/3)
424174   MCFG_CPU_PROGRAM_MAP(pc8_map)
425175   MCFG_CPU_IO_MAP(pc8_io)
426176   MCFG_CPU_CONFIG(i86_address_mask)
427177
428   MCFG_MACHINE_START(pc)
429   MCFG_MACHINE_RESET(pc)
430
431   MCFG_PIT8253_ADD( "pit8253", ibm5150_pit8253_config )
432
433   MCFG_I8237_ADD( "dma8237", XTAL_14_31818MHz/3, ibm5150_dma8237_config )
434
435   MCFG_PIC8259_ADD( "pic8259", ibm5150_pic8259_config )
436
437   MCFG_I8255A_ADD( "ppi8255", ibm5160_ppi8255_interface )
438
439   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
440   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
441   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
442   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
443
178   MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu",pc_keytronic_keyboard_intf)
179   MCFG_DEVICE_INPUT_DEFAULTS(cga)
180   
444181   /* video hardware */
445182   MCFG_FRAGMENT_ADD( pcvideo_cga )
446   MCFG_GFXDECODE(ibm5150)
447183
448   /* sound hardware */
449   MCFG_SPEAKER_STANDARD_MONO("mono")
450   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
451   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
452#ifdef ADLIB
453   MCFG_SOUND_ADD("ym3812", YM3812, ym3812_StdClock)
454   MCFG_SOUND_CONFIG(pc_ym3812_interface)
455   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
456#endif
457#ifdef GAMEBLASTER
458   MCFG_SOUND_ADD("saa1099.1", SAA1099, 4772720)
459   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
460   MCFG_SOUND_ADD("saa1099.2", SAA1099, 4772720)
461   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
462#endif
184    MCFG_ISA8_BUS_DEVICE("mb:isa", 1, "com", ISA8_COM)
185   MCFG_ISA8_BUS_DEVICE("mb:isa", 2, "fdc", ISA8_FDC)
186   MCFG_ISA8_BUS_DEVICE("mb:isa", 3, "hdc", ISA8_HDC)
463187
464188   /* keyboard */
465189   MCFG_KB_KEYTRONIC_ADD("keyboard", pc_keytronic_intf)
466
467   /* printer */
468   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
469   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
470   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
471
472   /* harddisk */
473   MCFG_FRAGMENT_ADD( pc_hdc )
474
475   MCFG_UPD765A_ADD("upd765", pc_fdc_upd765_not_connected_interface)
476
477   MCFG_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
478
190   
479191   /* internal ram */
480192   MCFG_RAM_ADD(RAM_TAG)
481193   MCFG_RAM_DEFAULT_SIZE("640K")
r10864r10865
688400***************************************************************************/
689401
690402/*     YEAR     NAME        PARENT      COMPAT  MACHINE     INPUT       INIT        COMPANY     FULLNAME */
691COMP(  1981,   ibm5150,    0,         0,      ibm5150,    ibm5150,   ibm5150,    "International Business Machines",  "IBM PC 5150" , 0)
692COMP(  1982,   ibm5155,    ibm5150,   0,      ibm5150,    ibm5150,   ibm5150,    "International Business Machines",  "IBM PC 5155" , 0)
693COMP(  1985,   ibm5140,    ibm5150,   0,      ibm5150,    ibm5150,   ibm5150,    "International Business Machines",  "IBM PC 5140 Convertible" , GAME_NOT_WORKING)
403COMP(  1981,   ibm5150,    0,         0,      ibm5150,    ibm5150,   0,    "International Business Machines",  "IBM PC 5150" , 0)
404COMP(  1982,   ibm5155,    ibm5150,   0,      ibm5150,    ibm5150,   0,    "International Business Machines",  "IBM PC 5155" , 0)
405COMP(  1985,   ibm5140,    ibm5150,   0,      ibm5150,    ibm5150,   0,    "International Business Machines",  "IBM PC 5140 Convertible" , GAME_NOT_WORKING)
694406
695407// xt class (pc but 8086)
696COMP(  1982,   ibm5160,    ibm5150,   0,      ibm5160,    ibm5150,   ibm5150,    "International Business Machines",  "IBM XT 5160" , 0)
408COMP(  1982,   ibm5160,    ibm5150,   0,      ibm5160,    ibm5150,   0,    "International Business Machines",  "IBM XT 5160" , 0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team