Previous 199869 Revisions Next

r20518 Saturday 26th January, 2013 at 21:55:32 UTC by Curt Coder
(MESS) pcw16: Removed runtime tagmap lookups. (nw)
[src/mess/drivers]pcw16.c
[src/mess/includes]pcw16.h

trunk/src/mess/includes/pcw16.h
r20517r20518
77#ifndef PCW16_H_
88#define PCW16_H_
99
10#include "emu.h"
11#include "cpu/z80/z80.h"
1012#include "machine/upd765.h"     /* FDC superio */
13#include "machine/pc_lpt.h"     /* PC-Parallel Port */
14#include "machine/pckeybrd.h"   /* PC-AT keyboard */
15#include "machine/upd765.h"     /* FDC superio */
16#include "machine/ins8250.h"    /* pc com port */
17#include "sound/beep.h"         /* pcw/pcw16 beeper */
18#include "machine/intelfsh.h"
19#include "formats/pc_dsk.h"
20#include "machine/ram.h"
1121
1222#define PCW16_BORDER_HEIGHT 8
1323#define PCW16_BORDER_WIDTH 8
r20517r20518
2333{
2434public:
2535   pcw16_state(const machine_config &mconfig, device_type type, const char *tag)
26      : driver_device(mconfig, type, tag) { }
36      : driver_device(mconfig, type, tag),
37        m_maincpu(*this, "maincpu"),
38        m_flash0(*this, "flash0"),
39        m_flash1(*this, "flash1"),
40        m_fdc(*this, "fdc"),
41        m_uart2(*this, "ns16550_2"),
42        m_speaker(*this, BEEPER_TAG),
43        m_ram(*this, RAM_TAG),
44        m_region_rom(*this, "maincpu"),
45        m_io_extra(*this, "EXTRA")
46   { }
2747
48   required_device<legacy_cpu_device> m_maincpu;
49   required_device<intel_e28f008sa_device> m_flash0;
50   required_device<intel_e28f008sa_device> m_flash1;
51   required_device<pc_fdc_superio_device> m_fdc;
52   required_device<ns16550_device> m_uart2;
53   required_device<beep_device> m_speaker;
54   required_device<ram_device> m_ram;
55   required_memory_region m_region_rom;
56   required_ioport m_io_extra;
57
2858   unsigned long m_interrupt_counter;
2959   int m_banks[4];
3060   int m_4_bit_port;
trunk/src/mess/drivers/pcw16.c
r20517r20518
8787   epp/ecp modes in parallel port not supported yet
8888   so ui disabled */
8989
90/* Core includes */
91#include "emu.h"
92#include "cpu/z80/z80.h"
9390#include "includes/pcw16.h"
9491
95/* Components */
96#include "machine/pc_lpt.h"     /* PC-Parallel Port */
97#include "machine/pckeybrd.h"   /* PC-AT keyboard */
98#include "machine/upd765.h"     /* FDC superio */
99#include "machine/ins8250.h"    /* pc com port */
100#include "sound/beep.h"         /* pcw/pcw16 beeper */
101#include "machine/intelfsh.h"
102
103/* Devices */
104#include "formats/pc_dsk.h"
105#include "machine/ram.h"
106
10792// interrupt counter
10893/* controls which bank of 2mb address space is paged into memory */
10994
r20517r20518
124109   /* any bits set excluding vsync */
125110   if ((m_system_status & (~0x04))!=0)
126111   {
127      machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
112      m_maincpu->set_input_line(0, HOLD_LINE);
128113   }
129114   else
130115   {
131      machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE);
116      m_maincpu->set_input_line(0, CLEAR_LINE);
132117   }
133118}
134119
r20517r20518
163148{
164149   if(type & 0x80) // DRAM
165150   {
166      UINT8* RAM = machine().device<ram_device>(RAM_TAG)->pointer();
167      return RAM[((type & 0x7f)*0x4000) + offset];
151      return m_ram->pointer()[((type & 0x7f)*0x4000) + offset];
168152   }
169153   else  // ROM / Flash
170154   {
171155      if(type < 4)
172156      {
173         UINT8* ROM = memregion("maincpu")->base();
174         return ROM[((type & 0x03)*0x4000)+offset+0x10000];
157         return m_region_rom->base()[((type & 0x03)*0x4000)+offset+0x10000];
175158      }
176159      if(type < 0x40)  // first flash
177160      {
178         intel_e28f008sa_device* flash = machine().device<intel_e28f008sa_device>("flash0");
179         return flash->read(((type & 0x3f)*0x4000)+offset);
161         return m_flash0->read(((type & 0x3f)*0x4000)+offset);
180162      }
181163      else  // second flash
182164      {
183         intel_e28f008sa_device* flash = machine().device<intel_e28f008sa_device>("flash1");
184         return flash->read(((type & 0x3f)*0x4000)+offset);
165         return m_flash1->read(((type & 0x3f)*0x4000)+offset);
185166      }
186167   }
187168}
r20517r20518
190171{
191172   if(type & 0x80) // DRAM
192173   {
193      UINT8* RAM = machine().device<ram_device>(RAM_TAG)->pointer();
194      RAM[((type & 0x7f)*0x4000) + offset] = data;
174      m_ram->pointer()[((type & 0x7f)*0x4000) + offset] = data;
195175   }
196176   else  // ROM / Flash
197177   {
r20517r20518
199179         return;  // first four sectors are write protected
200180      if(type < 0x40)  // first flash
201181      {
202         intel_e28f008sa_device* flash = machine().device<intel_e28f008sa_device>("flash0");
203         flash->write(((type & 0x3f)*0x4000)+offset,data);
182         m_flash0->write(((type & 0x3f)*0x4000)+offset,data);
204183      }
205184      else  // second flash
206185      {
207         intel_e28f008sa_device* flash = machine().device<intel_e28f008sa_device>("flash1");
208         flash->write(((type & 0x3f)*0x4000)+offset,data);
186         m_flash1->write(((type & 0x3f)*0x4000)+offset,data);
209187      }
210188   }
211189}
r20517r20518
556534      }
557535   }
558536   // TODO: fix
559   subdevice<ns16550_device>("ns16550_2")->ri_w((machine().root_device().ioport("EXTRA")->read() & 0x040) ? 0 : 1);
537   m_uart2->ri_w((m_io_extra->read() & 0x040) ? 0 : 1);
560538}
561539
562540
r20517r20518
763741            {
764742               /* I'll pulse it because if I used hold-line I'm not sure
765743               it would clear - to be checked */
766               machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
744               m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
767745            }
768746         }
769747      }
r20517r20518
809787
810788WRITE8_MEMBER(pcw16_state::pcw16_system_control_w)
811789{
812   device_t *speaker = machine().device(BEEPER_TAG);
813790   //logerror("0x0f8: function: %d\n",data);
814791
815792   /* lower 4 bits define function code */
r20517r20518
851828      /* set terminal count */
852829      case 0x05:
853830      {
854         machine().device<pc_fdc_superio_device>("fdc")->tc_w(true);
831         m_fdc->tc_w(true);
855832      }
856833      break;
857834
858835      /* clear terminal count */
859836      case 0x06:
860837      {
861         machine().device<pc_fdc_superio_device>("fdc")->tc_w(false);
838         m_fdc->tc_w(false);
862839      }
863840      break;
864841
865842      /* bleeper on */
866843      case 0x0b:
867844      {
868                  beep_set_state(speaker,1);
845         beep_set_state(m_speaker,1);
869846      }
870847      break;
871848
872849      /* bleeper off */
873850      case 0x0c:
874851      {
875                  beep_set_state(speaker,0);
852         beep_set_state(m_speaker,0);
876853      }
877854      break;
878855
r20517r20518
1006983   /* initialise defaults */
1007984   m_fdc_int_code = 2;
1008985   /* clear terminal count */
1009   machine().device<pc_fdc_superio_device>("fdc")->tc_w(false);
986   m_fdc->tc_w(false);
1010987   /* select first rom page */
1011988   m_banks[0] = 0;
1012989//  pcw16_update_memory(machine);
r20517r20518
10321009   m_system_status = 0;
10331010   m_interrupt_counter = 0;
10341011
1035   machine().device<pc_fdc_superio_device>("fdc")
1036      ->setup_intrq_cb(pc_fdc_superio_device::line_cb(FUNC(pcw16_state::fdc_interrupt), this));
1012   m_fdc->setup_intrq_cb(pc_fdc_superio_device::line_cb(FUNC(pcw16_state::fdc_interrupt), this));
10371013
10381014   /* initialise keyboard */
10391015   at_keyboard_init(machine(), AT_KEYBOARD_TYPE_AT);
r20517r20518
11261102
11271103
11281104/*     YEAR  NAME     PARENT    COMPAT  MACHINE    INPUT     INIT    COMPANY          FULLNAME */
1129COMP( 1995, pcw16,    0,        0,      pcw16,     pcw16, driver_device,    0,      "Amstrad plc",   "PCW16", GAME_NOT_WORKING )
1105COMP( 1995, pcw16,    0,        0,      pcw16,     pcw16, driver_device,    0,      "Amstrad plc",   "PcW16", GAME_NOT_WORKING )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team