Previous 199869 Revisions Next

r20850 Friday 8th February, 2013 at 22:25:26 UTC by Wilbert Pol
(MESS) bbc.c: Some tagmap lookup reduction. (nw)
[src/mess/includes]bbc.h
[src/mess/machine]bbc.c

trunk/src/mess/machine/bbc.c
r20849r20850
3737/* for the model A just address the 4 on board ROM sockets */
3838WRITE8_MEMBER(bbc_state::bbc_page_selecta_w)
3939{
40   membank("bank4")->set_base(machine().root_device().memregion("user1")->base()+((data&0x03)<<14));
40   membank("bank4")->set_base(m_region_user1->base()+((data&0x03)<<14));
4141}
4242
4343
4444WRITE8_MEMBER(bbc_state::bbc_memorya1_w)
4545{
46   memregion("maincpu")->base()[offset]=data;
46   m_region_maincpu->base()[offset]=data;
4747}
4848
4949/*************************
r20849r20850
5757   m_rombank=data&0x0f;
5858   if (m_rombank!=1)
5959   {
60      membank("bank4")->set_base(machine().root_device().memregion("user1")->base() + (m_rombank << 14));
60      membank("bank4")->set_base(m_region_user1->base() + (m_rombank << 14));
6161   }
6262   else
6363   {
64      membank("bank4")->set_base(machine().root_device().memregion("user2")->base() + ((m_DFSType) << 14));
64      membank("bank4")->set_base(m_region_user2->base() + ((m_DFSType) << 14));
6565   }
6666}
6767
r20849r20850
7070{
7171   if (m_RAMSize)
7272   {
73      memregion("maincpu")->base()[offset + 0x4000] = data;
73      m_region_maincpu->base()[offset + 0x4000] = data;
7474   }
7575   else
7676   {
77      memregion("maincpu")->base()[offset] = data;
77      m_region_maincpu->base()[offset] = data;
7878   }
7979
8080}
r20849r20850
9494   if (m_rombank == 1)
9595   {
9696      // special DFS case for Acorn DFS E00 Hack that can write to the DFS RAM Bank;
97      if (m_DFSType == 3) memregion("user2")->base()[((m_DFSType) << 14) + offset] = data;
97      if (m_DFSType == 3) m_region_user2->base()[((m_DFSType) << 14) + offset] = data;
9898   } else
9999   {
100100      switch (m_SWRAMtype)
101101      {
102         case 1: if (bbc_SWRAMtype1[m_userport]) memregion("user1")->base()[(m_userport << 14) + offset] = data;
103         case 2: if (bbc_SWRAMtype2[m_rombank])  memregion("user1")->base()[(m_rombank << 14) + offset] = data;
104         case 3: if (bbc_SWRAMtype3[m_rombank])  memregion("user1")->base()[(m_rombank << 14) + offset] = data;
102         case 1: if (bbc_SWRAMtype1[m_userport]) m_region_user1->base()[(m_userport << 14) + offset] = data;
103         case 2: if (bbc_SWRAMtype2[m_rombank])  m_region_user1->base()[(m_rombank << 14) + offset] = data;
104         case 3: if (bbc_SWRAMtype3[m_rombank])  m_region_user1->base()[(m_rombank << 14) + offset] = data;
105105      }
106106   }
107107}
r20849r20850
138138      if (m_pagedRAM)
139139      {
140140         /* if paged ram then set 8000 to afff to read from the ram 8000 to afff */
141         membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + 0x8000);
141         membank("bank4")->set_base(m_region_maincpu->base() + 0x8000);
142142      }
143143      else
144144      {
145145         /* if paged rom then set the rom to be read from 8000 to afff */
146         membank("bank4")->set_base(machine().root_device().memregion("user1")->base() + (m_rombank << 14));
146         membank("bank4")->set_base(m_region_user1->base() + (m_rombank << 14));
147147      };
148148
149149      /* set the rom to be read from b000 to bfff */
r20849r20850
155155      m_vdusel=(data>>7)&0x01;
156156      bbcbp_setvideoshadow(machine(), m_vdusel);
157157      //need to make the video display do a full screen refresh for the new memory area
158      membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base()+0x3000);
158      membank("bank2")->set_base(m_region_maincpu->base()+0x3000);
159159   }
160160}
161161
r20849r20850
166166
167167WRITE8_MEMBER(bbc_state::bbc_memorybp1_w)
168168{
169   memregion("maincpu")->base()[offset]=data;
169   m_region_maincpu->base()[offset]=data;
170170}
171171
172172
r20849r20850
182182
183183DIRECT_UPDATE_MEMBER(bbc_state::bbcbp_direct_handler)
184184{
185   UINT8 *ram = memregion("maincpu")->base();
185   UINT8 *ram = m_region_maincpu->base();
186186   if (m_vdusel == 0)
187187   {
188188      // not in shadow ram mode so just read normal ram
r20849r20850
207207
208208WRITE8_MEMBER(bbc_state::bbc_memorybp2_w)
209209{
210   UINT8 *ram = memregion("maincpu")->base();
210   UINT8 *ram = m_region_maincpu->base();
211211   if (m_vdusel==0)
212212   {
213213      // not in shadow ram mode so just write to normal ram
r20849r20850
235235{
236236   if (m_pagedRAM)
237237   {
238      memregion("maincpu")->base()[offset+0x8000]=data;
238      m_region_maincpu->base()[offset+0x8000]=data;
239239   }
240240}
241241
r20849r20850
255255{
256256   if (m_pagedRAM)
257257   {
258      memregion("maincpu")->base()[offset+0x8000]=data;
258      m_region_maincpu->base()[offset+0x8000]=data;
259259   }
260260   else
261261   {
262262      if (bbc_b_plus_sideways_ram_banks[m_rombank])
263263      {
264         memregion("user1")->base()[offset+(m_rombank<<14)]=data;
264         m_region_user1->base()[offset+(m_rombank<<14)]=data;
265265      }
266266   }
267267}
r20849r20850
270270{
271271   if (bbc_b_plus_sideways_ram_banks[m_rombank])
272272   {
273      memregion("user1")->base()[offset+(m_rombank<<14)+0x3000]=data;
273      m_region_user1->base()[offset+(m_rombank<<14)+0x3000]=data;
274274   }
275275}
276276
r20849r20850
360360
361361   if (m_ACCCON_Y)
362362   {
363      membank("bank7")->set_base(machine().root_device().memregion("maincpu")->base() + 0x9000);
363      membank("bank7")->set_base(m_region_maincpu->base() + 0x9000);
364364   }
365365   else
366366   {
367      membank("bank7")->set_base(machine().root_device().memregion("user1")->base() + 0x40000);
367      membank("bank7")->set_base(m_region_user1->base() + 0x40000);
368368   }
369369
370370   bbcbp_setvideoshadow(machine(), m_ACCCON_D);
r20849r20850
372372
373373   if (m_ACCCON_X)
374374   {
375      membank("bank2")->set_base(machine().root_device().memregion( "maincpu" )->base() + 0xb000 );
375      membank("bank2")->set_base(m_region_maincpu->base() + 0xb000 );
376376   }
377377   else
378378   {
379      membank("bank2")->set_base(machine().root_device().memregion( "maincpu" )->base() + 0x3000 );
379      membank("bank2")->set_base(m_region_maincpu->base() + 0x3000 );
380380   }
381381
382382   /* ACCCON_TST controls paging of rom reads in the 0xFC00-0xFEFF reigon */
r20849r20850
384384   /* if 1 the the ROM is paged in for reads but writes still go to I/O   */
385385   if (m_ACCCON_TST)
386386   {
387      membank("bank8")->set_base(machine().root_device().memregion("user1")->base()+0x43c00);
387      membank("bank8")->set_base(m_region_user1->base()+0x43c00);
388388      space.install_read_bank(0xFC00,0xFEFF,"bank8");
389389   }
390390   else
r20849r20850
410410
411411   if (m_pagedRAM)
412412   {
413      membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + 0x8000);
413      membank("bank4")->set_base(m_region_maincpu->base() + 0x8000);
414414      membank("bank5")->set_entry(m_rombank);
415415   }
416416   else
417417   {
418      membank("bank4")->set_base(machine().root_device().memregion("user1")->base() + ((m_rombank) << 14));
418      membank("bank4")->set_base(m_region_user1->base() + ((m_rombank) << 14));
419419      membank("bank5")->set_entry(m_rombank);
420420   }
421421}
r20849r20850
424424
425425WRITE8_MEMBER(bbc_state::bbc_memorybm1_w)
426426{
427   memregion("maincpu")->base()[offset] = data;
427   m_region_maincpu->base()[offset] = data;
428428}
429429
430430
r20849r20850
432432{
433433   if (m_ACCCON_X)
434434   {
435      membank( "bank2" )->set_base( memregion( "maincpu" )->base() + 0xb000 );
435      membank( "bank2" )->set_base( m_region_maincpu->base() + 0xb000 );
436436   }
437437   else
438438   {
439439      if (m_ACCCON_E && bbcm_vdudriverset(machine()))
440440      {
441         membank( "bank2" )->set_base( machine().root_device().memregion( "maincpu" )->base() + 0xb000 );
441         membank( "bank2" )->set_base( m_region_maincpu->base() + 0xb000 );
442442      }
443443      else
444444      {
445         membank( "bank2" )->set_base( machine().root_device().memregion( "maincpu" )->base() + 0x3000 );
445         membank( "bank2" )->set_base( m_region_maincpu->base() + 0x3000 );
446446      }
447447   }
448448
r20849r20850
453453
454454WRITE8_MEMBER(bbc_state::bbc_memorybm2_w)
455455{
456   UINT8 *ram = memregion("maincpu")->base();
456   UINT8 *ram = m_region_maincpu->base();
457457   if (m_ACCCON_X)
458458   {
459459      ram[offset + 0xb000] = data;
r20849r20850
481481{
482482   if (m_pagedRAM)
483483   {
484      memregion("maincpu")->base()[offset+0x8000]=data;
484      m_region_maincpu->base()[offset+0x8000]=data;
485485   }
486486   else
487487   {
488488      if (bbc_master_sideways_ram_banks[m_rombank])
489489      {
490         memregion("user1")->base()[offset+(m_rombank<<14)]=data;
490         m_region_user1->base()[offset+(m_rombank<<14)]=data;
491491      }
492492   }
493493}
r20849r20850
497497{
498498   if (bbc_master_sideways_ram_banks[m_rombank])
499499   {
500      memregion("user1")->base()[offset+(m_rombank<<14)+0x1000]=data;
500      m_region_user1->base()[offset+(m_rombank<<14)+0x1000]=data;
501501   }
502502}
503503
r20849r20850
506506{
507507   if (m_ACCCON_Y)
508508   {
509      memregion("maincpu")->base()[offset+0x9000]=data;
509      m_region_maincpu->base()[offset+0x9000]=data;
510510   }
511511}
512512
r20849r20850
541541   /* Now handled in bbcm_ACCCON_write PHS - 2008-10-11 */
542542//  if ( m_ACCCON_TST )
543543//  {
544//      return memregion("user1")->base()[offset+0x43c00];
544//      return m_region_user1->base()[offset+0x43c00];
545545//  };
546546
547547   if (offset<=0x0ff) /* FRED */
r20849r20850
19151915***************************************/
19161916DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbcb_cart )
19171917{
1918   UINT8 *mem = machine().root_device().memregion("user1")->base();
1918   UINT8 *mem = m_region_user1->base();
19191919   int size, read_;
19201920   int addr = 0;
19211921   int index = 0;
r20849r20850
19911991
19921992MACHINE_RESET_MEMBER(bbc_state,bbca)
19931993{
1994   UINT8 *ram = machine().root_device().memregion("maincpu")->base();
1994   UINT8 *ram = m_region_maincpu->base();
19951995   m_RAMSize = 1;
19961996   membank("bank1")->set_base(ram);
19971997   membank("bank3")->set_base(ram);
19981998
1999   membank("bank4")->set_base(machine().root_device().memregion("user1")->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
2000   membank("bank7")->set_base(memregion("user1")->base()+0x10000);  /* bank 7 points at the OS rom  from c000 to ffff */
1999   membank("bank4")->set_base(m_region_user1->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
2000   membank("bank7")->set_base(m_region_user1->base()+0x10000);  /* bank 7 points at the OS rom  from c000 to ffff */
20012001
20022002   bbcb_IC32_initialise(this);
20032003}
r20849r20850
20242024
20252025MACHINE_RESET_MEMBER(bbc_state,bbcb)
20262026{
2027   UINT8 *ram = memregion("maincpu")->base();
2027   UINT8 *ram = m_region_maincpu->base();
20282028   m_DFSType=    (machine().root_device().ioport("BBCCONFIG")->read() >> 0) & 0x07;
20292029   m_SWRAMtype = (machine().root_device().ioport("BBCCONFIG")->read() >> 3) & 0x03;
20302030   m_RAMSize=    (machine().root_device().ioport("BBCCONFIG")->read() >> 5) & 0x01;
r20849r20850
20432043      m_memorySize=16;
20442044   }
20452045
2046   membank("bank4")->set_base(machine().root_device().memregion("user1")->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
2047   membank("bank7")->set_base(machine().root_device().memregion("user1")->base() + 0x40000);  /* bank 7 points at the OS rom  from c000 to ffff */
2046   membank("bank4")->set_base(m_region_user1->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
2047   membank("bank7")->set_base(m_region_user1->base() + 0x40000);  /* bank 7 points at the OS rom  from c000 to ffff */
20482048
20492049   bbcb_IC32_initialise(this);
20502050
r20849r20850
20642064{
20652065   m_mc6850_clock = 0;
20662066
2067   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcbp_direct_handler), this));
2067   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcbp_direct_handler), this));
20682068
20692069   /* bank 6 is the paged ROMs     from b000 to bfff */
2070   membank("bank6")->configure_entries(0, 16, memregion("user1")->base() + 0x3000, 1<<14);
2070   membank("bank6")->configure_entries(0, 16, m_region_user1->base() + 0x3000, 1<<14);
20712071}
20722072
20732073MACHINE_RESET_MEMBER(bbc_state,bbcbp)
20742074{
2075   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
2076   membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base()+0x03000);  /* bank 2 screen/shadow ram     from 3000 to 7fff */
2077   membank("bank4")->set_base(machine().root_device().memregion("user1")->base());         /* bank 4 is paged ROM or RAM   from 8000 to afff */
2075   membank("bank1")->set_base(m_region_maincpu->base());
2076   membank("bank2")->set_base(m_region_maincpu->base()+0x03000);  /* bank 2 screen/shadow ram     from 3000 to 7fff */
2077   membank("bank4")->set_base(m_region_user1->base());         /* bank 4 is paged ROM or RAM   from 8000 to afff */
20782078   membank("bank6")->set_entry(0);
2079   membank("bank7")->set_base(memregion("user1")->base()+0x40000); /* bank 7 points at the OS rom  from c000 to ffff */
2079   membank("bank7")->set_base(m_region_user1->base()+0x40000); /* bank 7 points at the OS rom  from c000 to ffff */
20802080
20812081   bbcb_IC32_initialise(this);
20822082
r20849r20850
20902090{
20912091   m_mc6850_clock = 0;
20922092
2093   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcm_direct_handler), this));
2093   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcm_direct_handler), this));
20942094
20952095   /* bank 5 is the paged ROMs     from 9000 to bfff */
2096   membank("bank5")->configure_entries(0, 16, machine().root_device().memregion("user1")->base()+0x01000, 1<<14);
2096   membank("bank5")->configure_entries(0, 16, m_region_user1->base()+0x01000, 1<<14);
20972097
20982098   /* Set ROM/IO bank to point to rom */
2099   membank( "bank8" )->set_base( memregion("user1")->base()+0x43c00);
2100   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xFC00, 0xFEFF, "bank8");
2099   membank( "bank8" )->set_base( m_region_user1->base()+0x43c00);
2100   m_maincpu->space(AS_PROGRAM).install_read_bank(0xFC00, 0xFEFF, "bank8");
21012101}
21022102
21032103MACHINE_RESET_MEMBER(bbc_state,bbcm)
21042104{
2105   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());           /* bank 1 regular lower ram     from 0000 to 2fff */
2106   membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x3000);  /* bank 2 screen/shadow ram     from 3000 to 7fff */
2107   membank("bank4")->set_base(machine().root_device().memregion("user1")->base());         /* bank 4 is paged ROM or RAM   from 8000 to 8fff */
2105   membank("bank1")->set_base(m_region_maincpu->base());           /* bank 1 regular lower ram     from 0000 to 2fff */
2106   membank("bank2")->set_base(m_region_maincpu->base() + 0x3000);  /* bank 2 screen/shadow ram     from 3000 to 7fff */
2107   membank("bank4")->set_base(m_region_user1->base());         /* bank 4 is paged ROM or RAM   from 8000 to 8fff */
21082108   membank("bank5")->set_entry(0);
2109   membank("bank7")->set_base(memregion("user1")->base() + 0x40000); /* bank 6 OS rom of RAM          from c000 to dfff */
2109   membank("bank7")->set_base(m_region_user1->base() + 0x40000); /* bank 6 OS rom of RAM          from c000 to dfff */
21102110
21112111   bbcb_IC32_initialise(this);
21122112
trunk/src/mess/includes/bbc.h
r20849r20850
2424{
2525public:
2626   bbc_state(const machine_config &mconfig, device_type type, const char *tag)
27      : driver_device(mconfig, type, tag),
28         m_maincpu(*this, "maincpu"),
29         m_sn(*this, "sn76489"),
30         m_trom(*this, "saa505x"),
31         m_ACCCON_IRR(CLEAR_LINE),
32         m_via_system_irq(CLEAR_LINE),
33         m_via_user_irq(CLEAR_LINE),
34         m_acia_irq(CLEAR_LINE)
27      : driver_device(mconfig, type, tag)
28      , m_maincpu(*this, "maincpu")
29      , m_sn(*this, "sn76489")
30      , m_trom(*this, "saa505x")
31      , m_ACCCON_IRR(CLEAR_LINE)
32      , m_via_system_irq(CLEAR_LINE)
33      , m_via_user_irq(CLEAR_LINE)
34      , m_acia_irq(CLEAR_LINE)
35      , m_region_maincpu(*this, "maincpu")
36      , m_region_user1(*this, "user1")
37      , m_region_user2(*this, "user2")
3538   { }
3639
3740   required_device<cpu_device> m_maincpu;
r20849r20850
306309   DECLARE_WRITE_LINE_MEMBER(bbc_vsync);
307310
308311   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( bbcb_cart );
312
313protected:
314   required_memory_region m_region_maincpu;
315   required_memory_region m_region_user1;
316   optional_memory_region m_region_user2;
309317};
310318
311319

Previous 199869 Revisions Next


© 1997-2024 The MAME Team