Previous 199869 Revisions Next

r21161 Monday 18th February, 2013 at 14:57:32 UTC by Miodrag Milanović
Some mess modernization (nw)
[src/mess/drivers]4004clk.c a2600.c apc.c apexc.c atari400.c craft.c dectalk.c gizmondo.c hp49gp.c ip20.c ip22.c jr100.c juicebox.c mini2440.c mmodular.c multi8.c mz2500.c n64.c nanos.c ng_aes.c palmz22.c pasogo.c pasopia7.c pc6001.c pc8801.c pc88va.c pc9801.c pdp11.c pegasus.c pockstat.c ptcsol.c scv.c sgi_ip2.c sgi_ip6.c smc777.c socrates.c ssem.c supercon.c supracan.c ti990_10.c ti990_4.c vii.c vk100.c vt100.c vtech1.c

trunk/src/mess/drivers/mz2500.c
r21160r21161
196196   DECLARE_WRITE_LINE_MEMBER(pit8253_clk0_irq);
197197   DECLARE_WRITE_LINE_MEMBER(mz2500_rtc_alarm_irq);
198198
199   void draw_80x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr);
200   void draw_40x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr);
201   void draw_cg4_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
202   void draw_cg16_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri);
203   void draw_cg256_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri);
204   void draw_tv_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect);
205   void draw_cg_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
199   void draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr);
200   void draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr);
201   void draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
202   void draw_cg16_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri);
203   void draw_cg256_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri);
204   void draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect);
205   void draw_cg_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
206206
207   void mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,UINT16  pen,UINT8 width,UINT8 height);
208   void mz2500_reconfigure_screen();
209   UINT8 pal_256_param(int index, int param);
210   void mz2500_reset(mz2500_state *state, UINT8 type);
207211};
208212
209213
r21160r21161
212216#define WRAM_RESET 0
213217#define IPL_RESET 1
214218
215static void mz2500_reset(mz2500_state *state, UINT8 type);
216219static const UINT8 bank_reset_val[2][8] =
217220{
218221   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
r21160r21161
236239*/
237240
238241/* helper function, to draw stuff without getting crazy with height / width conditions :) */
239static void mz2500_draw_pixel(running_machine &machine, bitmap_ind16 &bitmap,int x,int y,UINT16  pen,UINT8 width,UINT8 height)
242void mz2500_state::mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,UINT16  pen,UINT8 width,UINT8 height)
240243{
241244   if(width && height)
242245   {
243      bitmap.pix16(y*2+0, x*2+0) = machine.pens[pen];
244      bitmap.pix16(y*2+0, x*2+1) = machine.pens[pen];
245      bitmap.pix16(y*2+1, x*2+0) = machine.pens[pen];
246      bitmap.pix16(y*2+1, x*2+1) = machine.pens[pen];
246      bitmap.pix16(y*2+0, x*2+0) = machine().pens[pen];
247      bitmap.pix16(y*2+0, x*2+1) = machine().pens[pen];
248      bitmap.pix16(y*2+1, x*2+0) = machine().pens[pen];
249      bitmap.pix16(y*2+1, x*2+1) = machine().pens[pen];
247250   }
248251   else if(width)
249252   {
250      bitmap.pix16(y, x*2+0) = machine.pens[pen];
251      bitmap.pix16(y, x*2+1) = machine.pens[pen];
253      bitmap.pix16(y, x*2+0) = machine().pens[pen];
254      bitmap.pix16(y, x*2+1) = machine().pens[pen];
252255   }
253256   else if(height)
254257   {
255      bitmap.pix16(y*2+0, x) = machine.pens[pen];
256      bitmap.pix16(y*2+1, x) = machine.pens[pen];
258      bitmap.pix16(y*2+0, x) = machine().pens[pen];
259      bitmap.pix16(y*2+1, x) = machine().pens[pen];
257260   }
258261   else
259      bitmap.pix16(y, x) = machine.pens[pen];
262      bitmap.pix16(y, x) = machine().pens[pen];
260263}
261264
262void mz2500_state::draw_80x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr)
265void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr)
263266{
264267   UINT8 *vram = m_main_ram; // TODO
265268   int x,y,count,xi,yi;
r21160r21161
337340               if(pen)
338341               {
339342                  if((res_y) >= 0 && (res_y) < 200*y_step)
340                     mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),0,0);
343                     mz2500_draw_pixel(bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),0,0);
341344               }
342345            }
343346         }
r21160r21161
348351   }
349352}
350353
351void mz2500_state::draw_40x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr)
354void mz2500_state::draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr)
352355{
353356   UINT8 *vram = m_main_ram; // TODO
354357   int x,y,count,xi,yi;
r21160r21161
427430               if(pen)
428431               {
429432                  if((res_y) >= 0 && (res_y) < 200*y_step)
430                     mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),m_scr_x_size == 640,0);
433                     mz2500_draw_pixel(bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),m_scr_x_size == 640,0);
431434               }
432435            }
433436         }
r21160r21161
438441   }
439442}
440443
441void mz2500_state::draw_cg4_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
444void mz2500_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
442445{
443446   UINT32 count;
444447   UINT8 *vram = m_main_ram; // TODO
r21160r21161
471474
472475            {
473476               //if(pri == ((m_clut256[pen] & 0x100) >> 8))
474               mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen,0,0);
477               mz2500_draw_pixel(bitmap,res_x,res_y,pen,0,0);
475478            }
476479         }
477480         count++;
r21160r21161
479482   }
480483}
481484
482void mz2500_state::draw_cg16_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri)
485void mz2500_state::draw_cg16_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri)
483486{
484487   UINT32 count;
485488   UINT8 *vram = m_main_ram; //TODO
r21160r21161
526529               pen |= pen_bit[pen_i];
527530
528531            if(pri == ((m_clut16[pen] & 0x10) >> 4) && m_clut16[pen] != 0x00 && pen_mask) //correct?
529               mz2500_draw_pixel(machine,bitmap,res_x,res_y,(m_clut16[pen] & 0x0f)+0x10,(x_size == 320 && m_scr_x_size == 640),cg_interlace == 2);
532               mz2500_draw_pixel(bitmap,res_x,res_y,(m_clut16[pen] & 0x0f)+0x10,(x_size == 320 && m_scr_x_size == 640),cg_interlace == 2);
530533         }
531534         count++;
532535         count&=((base_mask<<8) | 0xff);
r21160r21161
536539   }
537540}
538541
539void mz2500_state::draw_cg256_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri)
542void mz2500_state::draw_cg256_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri)
540543{
541544   UINT32 count;
542545   UINT8 *vram = m_main_ram;
r21160r21161
583586               pen |= pen_bit[pen_i];
584587
585588            if(pri == ((m_clut256[pen] & 0x100) >> 8))
586               mz2500_draw_pixel(machine,bitmap,res_x,res_y,(m_clut256[pen] & 0xff)+0x100,m_scr_x_size == 640,cg_interlace == 2);
589               mz2500_draw_pixel(bitmap,res_x,res_y,(m_clut256[pen] & 0xff)+0x100,m_scr_x_size == 640,cg_interlace == 2);
587590         }
588591         count++;
589592         count&=((base_mask<<8) | 0xff);
r21160r21161
593596   }
594597}
595598
596void mz2500_state::draw_tv_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
599void mz2500_state::draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect)
597600{
598601   UINT16 base_addr;
599602
r21160r21161
603606//  popmessage("%d %d %d %d",m_tv_hs,(m_tv_he),m_tv_vs,(m_tv_ve));
604607
605608   if(m_text_col_size)
606      draw_80x25(machine,bitmap,cliprect,base_addr);
609      draw_80x25(bitmap,cliprect,base_addr);
607610   else
608611   {
609612      int tv_mode;
r21160r21161
613616      switch(tv_mode & 3)
614617      {
615618         case 0: //mixed 6bpp mode, TODO
616            draw_40x25(machine,bitmap,cliprect,0,base_addr);
619            draw_40x25(bitmap,cliprect,0,base_addr);
617620            break;
618621         case 1:
619            draw_40x25(machine,bitmap,cliprect,0,base_addr);
622            draw_40x25(bitmap,cliprect,0,base_addr);
620623            break;
621624         case 2:
622            draw_40x25(machine,bitmap,cliprect,1,base_addr);
625            draw_40x25(bitmap,cliprect,1,base_addr);
623626            break;
624627         case 3:
625            draw_40x25(machine,bitmap,cliprect,1,base_addr);
626            draw_40x25(machine,bitmap,cliprect,0,base_addr);
628            draw_40x25(bitmap,cliprect,1,base_addr);
629            draw_40x25(bitmap,cliprect,0,base_addr);
627630            break;
628631         //default: popmessage("%02x %02x %02x",tv_mode & 3,m_text_reg[1],m_text_reg[2]); break;
629632      }
630633   }
631634}
632635
633void mz2500_state::draw_cg_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
636void mz2500_state::draw_cg_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
634637{
635638   //popmessage("%02x %02x",m_cg_reg[0x0e],m_cg_reg[0x18]);
636639
r21160r21161
639642      case 0x00:
640643         break;
641644      case 0x03:
642         draw_cg4_screen(machine,bitmap,cliprect,0);
645         draw_cg4_screen(bitmap,cliprect,0);
643646         break;
644647      case 0x14:
645         draw_cg16_screen(machine,bitmap,cliprect,0,320,pri);
646         draw_cg16_screen(machine,bitmap,cliprect,1,320,pri);
648         draw_cg16_screen(bitmap,cliprect,0,320,pri);
649         draw_cg16_screen(bitmap,cliprect,1,320,pri);
647650         break;
648651      case 0x15:
649         draw_cg16_screen(machine,bitmap,cliprect,1,320,pri);
650         draw_cg16_screen(machine,bitmap,cliprect,0,320,pri);
652         draw_cg16_screen(bitmap,cliprect,1,320,pri);
653         draw_cg16_screen(bitmap,cliprect,0,320,pri);
651654         break;
652655      case 0x17:
653         draw_cg16_screen(machine,bitmap,cliprect,0,640,pri);
656         draw_cg16_screen(bitmap,cliprect,0,640,pri);
654657         break;
655658      case 0x1d:
656         draw_cg256_screen(machine,bitmap,cliprect,0,pri);
659         draw_cg256_screen(bitmap,cliprect,0,pri);
657660         break;
658661      case 0x97:
659         draw_cg16_screen(machine,bitmap,cliprect,2,640,pri);
662         draw_cg16_screen(bitmap,cliprect,2,640,pri);
660663         break;
661664      default:
662665         popmessage("Unsupported CG mode %02x, contact MESS dev",m_cg_reg[0x0e]);
r21160r21161
671674   if(m_screen_enable)
672675      return 0;
673676
674   draw_cg_screen(machine(),bitmap,cliprect,0);
675   draw_tv_screen(machine(),bitmap,cliprect);
676   draw_cg_screen(machine(),bitmap,cliprect,1);
677   draw_cg_screen(bitmap,cliprect,0);
678   draw_tv_screen(bitmap,cliprect);
679   draw_cg_screen(bitmap,cliprect,1);
677680   //  popmessage("%02x (%02x %02x) (%02x %02x) (%02x %02x) (%02x %02x)",m_cg_reg[0x0f],m_cg_reg[0x10],m_cg_reg[0x11],m_cg_reg[0x12],m_cg_reg[0x13],m_cg_reg[0x14],m_cg_reg[0x15],m_cg_reg[0x16],m_cg_reg[0x17]);
678681   //  popmessage("%02x",m_text_reg[0x0f]);
679682
r21160r21161
681684   return 0;
682685}
683686
684static void mz2500_reconfigure_screen(running_machine &machine)
687void mz2500_state::mz2500_reconfigure_screen()
685688{
686   mz2500_state *state = machine.driver_data<mz2500_state>();
687689   rectangle visarea;
688690
689   if((state->m_cg_reg[0x0e] & 0x1f) == 0x17 || (state->m_cg_reg[0x0e] & 0x1f) == 0x03 || state->m_text_col_size)
690      state->m_scr_x_size = 640;
691   if((m_cg_reg[0x0e] & 0x1f) == 0x17 || (m_cg_reg[0x0e] & 0x1f) == 0x03 || m_text_col_size)
692      m_scr_x_size = 640;
691693   else
692      state->m_scr_x_size = 320;
694      m_scr_x_size = 320;
693695
694   if((state->m_cg_reg[0x0e] & 0x1f) == 0x03)
695      state->m_scr_y_size = 400;
696   if((m_cg_reg[0x0e] & 0x1f) == 0x03)
697      m_scr_y_size = 400;
696698   else
697      state->m_scr_y_size = 200 * ((state->m_text_font_reg) ? 1 : 2);
699      m_scr_y_size = 200 * ((m_text_font_reg) ? 1 : 2);
698700
699   visarea.set(0, state->m_scr_x_size - 1, 0, state->m_scr_y_size - 1);
701   visarea.set(0, m_scr_x_size - 1, 0, m_scr_y_size - 1);
700702
701   //popmessage("%d %d %d %d %02x",vs,ve,hs,he,state->m_cg_reg[0x0e]);
703   //popmessage("%d %d %d %d %02x",vs,ve,hs,he,m_cg_reg[0x0e]);
702704
703   machine.primary_screen->configure(720, 480, visarea, machine.primary_screen->frame_period().attoseconds);
705   machine().primary_screen->configure(720, 480, visarea, machine().primary_screen->frame_period().attoseconds);
704706
705707   /* calculate CG window parameters here */
706   state->m_cg_vs = (state->m_cg_reg[0x08]) | ((state->m_cg_reg[0x09]<<8) & 1);
707   state->m_cg_ve = (state->m_cg_reg[0x0a]) | ((state->m_cg_reg[0x0b]<<8) & 1);
708   state->m_cg_hs = ((state->m_cg_reg[0x0c] & 0x7f)*8);
709   state->m_cg_he = ((state->m_cg_reg[0x0d] & 0x7f)*8);
708   m_cg_vs = (m_cg_reg[0x08]) | ((m_cg_reg[0x09]<<8) & 1);
709   m_cg_ve = (m_cg_reg[0x0a]) | ((m_cg_reg[0x0b]<<8) & 1);
710   m_cg_hs = ((m_cg_reg[0x0c] & 0x7f)*8);
711   m_cg_he = ((m_cg_reg[0x0d] & 0x7f)*8);
710712
711   if(state->m_scr_x_size == 320)
713   if(m_scr_x_size == 320)
712714   {
713      state->m_cg_hs /= 2;
714      state->m_cg_he /= 2;
715      m_cg_hs /= 2;
716      m_cg_he /= 2;
715717   }
716718
717719   /* calculate TV window parameters here */
718720   {
719721      int x_offs,y_offs;
720722
721      state->m_monitor_type = ((state->m_text_reg[0x0f] & 0x08) >> 3);
723      m_monitor_type = ((m_text_reg[0x0f] & 0x08) >> 3);
722724
723      switch((state->m_monitor_type|state->m_text_col_size<<1) & 3)
725      switch((m_monitor_type|m_text_col_size<<1) & 3)
724726      {
725727         default:
726728         case 0: x_offs = 64; break;
r21160r21161
728730         case 2: x_offs = 72; break;
729731         case 3: x_offs = 88; break;
730732      }
731      //printf("%d %d %d\n",x_offs,(state->m_text_reg[7] & 0x7f) * 8,(state->m_text_reg[8] & 0x7f)* 8);
733      //printf("%d %d %d\n",x_offs,(m_text_reg[7] & 0x7f) * 8,(m_text_reg[8] & 0x7f)* 8);
732734
733      y_offs = (state->m_monitor_type) ? 76 : 34;
735      y_offs = (m_monitor_type) ? 76 : 34;
734736
735      state->m_tv_hs = ((state->m_text_reg[7] & 0x7f)*8) - x_offs;
736      state->m_tv_he = ((state->m_text_reg[8] & 0x7f)*8) - x_offs;
737      state->m_tv_vs = (state->m_text_reg[3]*2) - y_offs;
738      state->m_tv_ve = (state->m_text_reg[5]*2) - y_offs;
737      m_tv_hs = ((m_text_reg[7] & 0x7f)*8) - x_offs;
738      m_tv_he = ((m_text_reg[8] & 0x7f)*8) - x_offs;
739      m_tv_vs = (m_text_reg[3]*2) - y_offs;
740      m_tv_ve = (m_text_reg[5]*2) - y_offs;
739741
740      if(state->m_scr_x_size == 320)
742      if(m_scr_x_size == 320)
741743      {
742         state->m_tv_hs /= 2;
743         state->m_tv_he /= 2;
744         m_tv_hs /= 2;
745         m_tv_he /= 2;
744746      }
745747
746      if(state->m_scr_y_size == 200)
748      if(m_scr_y_size == 200)
747749      {
748         state->m_tv_vs /= 2;
749         state->m_tv_ve /= 2;
750         m_tv_vs /= 2;
751         m_tv_ve /= 2;
750752      }
751753   }
752754}
r21160r21161
10501052[0x0f] ---- x--- sets monitor type interlace / progressive
10511053*/
10521054
1053static UINT8 pal_256_param(int index, int param)
1055UINT8 mz2500_state::pal_256_param(int index, int param)
10541056{
10551057   UINT8 val = 0;
10561058
r21160r21161
10841086         #endif
10851087         //popmessage("%d %02x %d %02x %d %d",m_text_reg[3],m_text_reg[4],m_text_reg[5],m_text_reg[6],m_text_reg[7]*8,m_text_reg[8]*8);
10861088
1087         mz2500_reconfigure_screen(machine());
1089         mz2500_reconfigure_screen();
10881090
10891091         if(m_text_reg_index == 0x0a) // set 256 color palette
10901092         {
r21160r21161
11401142      case 3:
11411143         /* Font size reg */
11421144         m_text_font_reg = data & 1;
1143         mz2500_reconfigure_screen(machine());
1145         mz2500_reconfigure_screen();
11441146         break;
11451147   }
11461148}
r21160r21161
13891391   }
13901392
13911393   {
1392      mz2500_reconfigure_screen(machine());
1394      mz2500_reconfigure_screen();
13931395   }
13941396
13951397   if(m_cg_reg_index & 0x80) //enable auto-inc
r21160r21161
17221724   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
17231725INPUT_PORTS_END
17241726
1725static void mz2500_reset(mz2500_state *state, UINT8 type)
1727void mz2500_state::mz2500_reset(mz2500_state *state, UINT8 type)
17261728{
17271729   int i;
17281730
17291731   for(i=0;i<8;i++)
1730      state->m_bank_val[i] = bank_reset_val[type][i];
1732      m_bank_val[i] = bank_reset_val[type][i];
17311733}
17321734
17331735static const gfx_layout mz2500_pcg_layout_1bpp =
r21160r21161
19451947   {
19461948      m_text_col_size = ((data & 0x20) >> 5);
19471949      m_prev_col_val = m_text_col_size;
1948      mz2500_reconfigure_screen(machine());
1950      mz2500_reconfigure_screen();
19491951   }
19501952   m_key_mux = data & 0x1f;
19511953}
trunk/src/mess/drivers/ip20.c
r21160r21161
6767   required_device<wd33c93_device> m_wd33c93;
6868   required_device<scc8530_t> m_scc;
6969   required_device<eeprom_device> m_eeprom;
70   inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... );
7071};
7172
7273
7374#define VERBOSE_LEVEL ( 2 )
7475
75INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ... )
76inline void ATTR_PRINTF(3,4) ip20_state::verboselog(int n_level, const char *s_fmt, ... )
7677{
7778   if( VERBOSE_LEVEL >= n_level )
7879   {
r21160r21161
8182      va_start( v, s_fmt );
8283      vsprintf( buf, s_fmt, v );
8384      va_end( v );
84      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
85      logerror( "%08x: %s", machine().device("maincpu")->safe_pc(), buf );
8586   }
8687}
8788
r21160r21161
122123   offset <<= 2;
123124   if( offset >= 0x0e00 && offset <= 0x0e7c )
124125   {
125      verboselog(machine(), 2, "RTC RAM[0x%02x] Read: %02x\n", ( offset - 0xe00 ) >> 2, m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ] );
126      verboselog(2, "RTC RAM[0x%02x] Read: %02x\n", ( offset - 0xe00 ) >> 2, m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ] );
126127      return m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ];
127128   }
128129   switch( offset )
129130   {
130131   case 0x05c:
131      verboselog(machine(), 2, "HPC Unknown Read: %08x (%08x) (returning 0x000000a5 as kludge)\n", 0x1fb80000 + offset, mem_mask );
132      verboselog(2, "HPC Unknown Read: %08x (%08x) (returning 0x000000a5 as kludge)\n", 0x1fb80000 + offset, mem_mask );
132133      return 0x0000a500;
133134   case 0x00ac:
134      verboselog(machine(), 2, "HPC Parallel Buffer Pointer Read: %08x (%08x)\n", m_HPC.nParBufPtr, mem_mask );
135      verboselog(2, "HPC Parallel Buffer Pointer Read: %08x (%08x)\n", m_HPC.nParBufPtr, mem_mask );
135136      return m_HPC.nParBufPtr;
136137   case 0x00c0:
137      verboselog(machine(), 2, "HPC Endianness Read: %08x (%08x)\n", 0x0000001f, mem_mask );
138      verboselog(2, "HPC Endianness Read: %08x (%08x)\n", 0x0000001f, mem_mask );
138139      return 0x0000001f;
139140   case 0x0120:
140141      if (ACCESSING_BITS_8_15)
r21160r21161
155156         return 0;
156157      }
157158   case 0x01b0:
158      verboselog(machine(), 2, "HPC Misc. Status Read: %08x (%08x)\n", m_HPC.nMiscStatus, mem_mask );
159      verboselog(2, "HPC Misc. Status Read: %08x (%08x)\n", m_HPC.nMiscStatus, mem_mask );
159160      return m_HPC.nMiscStatus;
160161   case 0x01bc:
161162//      verboselog(machine, 2, "HPC CPU Serial EEPROM Read\n" );
162163      return m_eeprom->read_bit() << 4;
163164   case 0x01c4:
164      verboselog(machine(), 2, "HPC Local IO Register 0 Mask Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask );
165      verboselog(2, "HPC Local IO Register 0 Mask Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask );
165166      return m_HPC.nLocalIOReg0Mask;
166167   case 0x01cc:
167      verboselog(machine(), 2, "HPC Local IO Register 1 Mask Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask );
168      verboselog(2, "HPC Local IO Register 1 Mask Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask );
168169      return m_HPC.nLocalIOReg1Mask;
169170   case 0x01d4:
170      verboselog(machine(), 2, "HPC VME Interrupt Mask 0 Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask );
171      verboselog(2, "HPC VME Interrupt Mask 0 Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask );
171172      return m_HPC.nVMEIntMask0;
172173   case 0x01d8:
173      verboselog(machine(), 2, "HPC VME Interrupt Mask 1 Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask );
174      verboselog(2, "HPC VME Interrupt Mask 1 Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask );
174175      return m_HPC.nVMEIntMask1;
175176   case 0x0d00:
176      verboselog(machine(), 2, "HPC DUART0 Channel B Control Read\n" );
177      verboselog(2, "HPC DUART0 Channel B Control Read\n" );
177178//      return 0x00000004;
178179      return 0x7c; //m_scc->reg_r(space, 0);
179180   case 0x0d04:
180      verboselog(machine(), 2, "HPC DUART0 Channel B Data Read\n" );
181      verboselog(2, "HPC DUART0 Channel B Data Read\n" );
181182//      return 0;
182183      return m_scc->reg_r(space, 2);
183184   case 0x0d08:
184      verboselog(machine(), 2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask  );
185      verboselog(2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask  );
185186//      return 0x40;
186187      return 0x7c; //m_scc->reg_r(space, 1);
187188   case 0x0d0c:
188      verboselog(machine(), 2, "HPC DUART0 Channel A Data Read\n" );
189      verboselog(2, "HPC DUART0 Channel A Data Read\n" );
189190//      return 0;
190191      return m_scc->reg_r(space, 3);
191192   case 0x0d10:
192193//      verboselog(machine, 2, "HPC DUART1 Channel B Control Read\n" );
193194      return 0x00000004;
194195   case 0x0d14:
195      verboselog(machine(), 2, "HPC DUART1 Channel B Data Read\n" );
196      verboselog(2, "HPC DUART1 Channel B Data Read\n" );
196197      return 0;
197198   case 0x0d18:
198      verboselog(machine(), 2, "HPC DUART1 Channel A Control Read\n" );
199      verboselog(2, "HPC DUART1 Channel A Control Read\n" );
199200      return 0;
200201   case 0x0d1c:
201      verboselog(machine(), 2, "HPC DUART1 Channel A Data Read\n" );
202      verboselog(2, "HPC DUART1 Channel A Data Read\n" );
202203      return 0;
203204   case 0x0d20:
204      verboselog(machine(), 2, "HPC DUART2 Channel B Control Read\n" );
205      verboselog(2, "HPC DUART2 Channel B Control Read\n" );
205206      return 0x00000004;
206207   case 0x0d24:
207      verboselog(machine(), 2, "HPC DUART2 Channel B Data Read\n" );
208      verboselog(2, "HPC DUART2 Channel B Data Read\n" );
208209      return 0;
209210   case 0x0d28:
210      verboselog(machine(), 2, "HPC DUART2 Channel A Control Read\n" );
211      verboselog(2, "HPC DUART2 Channel A Control Read\n" );
211212      return 0;
212213   case 0x0d2c:
213      verboselog(machine(), 2, "HPC DUART2 Channel A Data Read\n" );
214      verboselog(2, "HPC DUART2 Channel A Data Read\n" );
214215      return 0;
215216   case 0x0d30:
216      verboselog(machine(), 2, "HPC DUART3 Channel B Control Read\n" );
217      verboselog(2, "HPC DUART3 Channel B Control Read\n" );
217218      return 0x00000004;
218219   case 0x0d34:
219      verboselog(machine(), 2, "HPC DUART3 Channel B Data Read\n" );
220      verboselog(2, "HPC DUART3 Channel B Data Read\n" );
220221      return 0;
221222   case 0x0d38:
222      verboselog(machine(), 2, "HPC DUART3 Channel A Control Read\n" );
223      verboselog(2, "HPC DUART3 Channel A Control Read\n" );
223224      return 0;
224225   case 0x0d3c:
225      verboselog(machine(), 2, "HPC DUART3 Channel A Data Read\n" );
226      verboselog(2, "HPC DUART3 Channel A Data Read\n" );
226227      return 0;
227228   }
228   verboselog(machine(), 0, "Unmapped HPC read: 0x%08x (%08x)\n", 0x1fb80000 + offset, mem_mask );
229   verboselog(0, "Unmapped HPC read: 0x%08x (%08x)\n", 0x1fb80000 + offset, mem_mask );
229230   return 0;
230231}
231232
r21160r21161
234235   offset <<= 2;
235236   if( offset >= 0x0e00 && offset <= 0x0e7c )
236237   {
237      verboselog(machine(), 2, "RTC RAM[0x%02x] Write: %02x\n", ( offset - 0xe00 ) >> 2, data & 0x000000ff );
238      verboselog(2, "RTC RAM[0x%02x] Write: %02x\n", ( offset - 0xe00 ) >> 2, data & 0x000000ff );
238239      m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ] = data & 0x000000ff;
239240      switch( ( offset - 0xe00 ) >> 2 )
240241      {
r21160r21161
284285      break;
285286
286287   case 0x00ac:
287      verboselog(machine(), 2, "HPC Parallel Buffer Pointer Write: %08x (%08x)\n", data, mem_mask );
288      verboselog(2, "HPC Parallel Buffer Pointer Write: %08x (%08x)\n", data, mem_mask );
288289      m_HPC.nParBufPtr = data;
289290      break;
290291   case 0x0120:
291292      if (ACCESSING_BITS_8_15)
292293      {
293         verboselog(machine(), 2, "HPC SCSI Controller Register Write: %08x\n", ( data >> 8 ) & 0x000000ff );
294         verboselog(2, "HPC SCSI Controller Register Write: %08x\n", ( data >> 8 ) & 0x000000ff );
294295         m_wd33c93->write( space, 0, ( data >> 8 ) & 0x000000ff );
295296      }
296297      else
r21160r21161
301302   case 0x0124:
302303      if (ACCESSING_BITS_8_15)
303304      {
304         verboselog(machine(), 2, "HPC SCSI Controller Data Write: %08x\n", ( data >> 8 ) & 0x000000ff );
305         verboselog(2, "HPC SCSI Controller Data Write: %08x\n", ( data >> 8 ) & 0x000000ff );
305306         m_wd33c93->write( space, 1, ( data >> 8 ) & 0x000000ff );
306307      }
307308      else
r21160r21161
310311      }
311312      break;
312313   case 0x01b0:
313      verboselog(machine(), 2, "HPC Misc. Status Write: %08x (%08x)\n", data, mem_mask );
314      verboselog(2, "HPC Misc. Status Write: %08x (%08x)\n", data, mem_mask );
314315      if( data & 0x00000001 )
315316      {
316         verboselog(machine(), 2, "  Force DSP hard reset\n" );
317         verboselog(2, "  Force DSP hard reset\n" );
317318      }
318319      if( data & 0x00000002 )
319320      {
320         verboselog(machine(), 2, "  Force IRQA\n" );
321         verboselog(2, "  Force IRQA\n" );
321322      }
322323      if( data & 0x00000004 )
323324      {
324         verboselog(machine(), 2, "  Set IRQA polarity high\n" );
325         verboselog(2, "  Set IRQA polarity high\n" );
325326      }
326327      else
327328      {
328         verboselog(machine(), 2, "  Set IRQA polarity low\n" );
329         verboselog(2, "  Set IRQA polarity low\n" );
329330      }
330331      if( data & 0x00000008 )
331332      {
332         verboselog(machine(), 2, "  SRAM size: 32K\n" );
333         verboselog(2, "  SRAM size: 32K\n" );
333334      }
334335      else
335336      {
336         verboselog(machine(), 2, "  SRAM size:  8K\n" );
337         verboselog(2, "  SRAM size:  8K\n" );
337338      }
338339      m_HPC.nMiscStatus = data;
339340      break;
r21160r21161
341342//      verboselog(machine, 2, "HPC CPU Serial EEPROM Write: %08x (%08x)\n", data, mem_mask );
342343      if( data & 0x00000001 )
343344      {
344         verboselog(machine(), 2, "    CPU board LED on\n" );
345         verboselog(2, "    CPU board LED on\n" );
345346      }
346347      m_eeprom->write_bit((data & 0x00000008) ? 1 : 0 );
347348      m_eeprom->set_cs_line((data & 0x00000002) ? ASSERT_LINE : CLEAR_LINE );
348349      m_eeprom->set_clock_line((data & 0x00000004) ? CLEAR_LINE : ASSERT_LINE );
349350      break;
350351   case 0x01c4:
351      verboselog(machine(), 2, "HPC Local IO Register 0 Mask Write: %08x (%08x)\n", data, mem_mask );
352      verboselog(2, "HPC Local IO Register 0 Mask Write: %08x (%08x)\n", data, mem_mask );
352353      m_HPC.nLocalIOReg0Mask = data;
353354      break;
354355   case 0x01cc:
355      verboselog(machine(), 2, "HPC Local IO Register 1 Mask Write: %08x (%08x)\n", data, mem_mask );
356      verboselog(2, "HPC Local IO Register 1 Mask Write: %08x (%08x)\n", data, mem_mask );
356357      m_HPC.nLocalIOReg1Mask = data;
357358      break;
358359   case 0x01d4:
359      verboselog(machine(), 2, "HPC VME Interrupt Mask 0 Write: %08x (%08x)\n", data, mem_mask );
360      verboselog(2, "HPC VME Interrupt Mask 0 Write: %08x (%08x)\n", data, mem_mask );
360361      m_HPC.nVMEIntMask0 = data;
361362      break;
362363   case 0x01d8:
363      verboselog(machine(), 2, "HPC VME Interrupt Mask 1 Write: %08x (%08x)\n", data, mem_mask );
364      verboselog(2, "HPC VME Interrupt Mask 1 Write: %08x (%08x)\n", data, mem_mask );
364365      m_HPC.nVMEIntMask1 = data;
365366      break;
366367   case 0x0d00:
367      verboselog(machine(), 2, "HPC DUART0 Channel B Control Write: %08x (%08x)\n", data, mem_mask );
368      verboselog(2, "HPC DUART0 Channel B Control Write: %08x (%08x)\n", data, mem_mask );
368369      m_scc->reg_w(space, 0, data);
369370      break;
370371   case 0x0d04:
371      verboselog(machine(), 2, "HPC DUART0 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
372      verboselog(2, "HPC DUART0 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
372373      m_scc->reg_w(space, 2, data);
373374      break;
374375   case 0x0d08:
375      verboselog(machine(), 2, "HPC DUART0 Channel A Control Write: %08x (%08x)\n", data, mem_mask );
376      verboselog(2, "HPC DUART0 Channel A Control Write: %08x (%08x)\n", data, mem_mask );
376377      m_scc->reg_w(space, 1, data);
377378      break;
378379   case 0x0d0c:
379      verboselog(machine(), 2, "HPC DUART0 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
380      verboselog(2, "HPC DUART0 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
380381      m_scc->reg_w(space, 3, data);
381382      break;
382383   case 0x0d10:
383384      if( ( data & 0x000000ff ) >= 0x00000020 )
384385      {
385//          verboselog(machine(), 2, "HPC DUART1 Channel B Control Write: %08x (%08x) %c\n", data, mem_mask, data & 0x000000ff );
386//          verboselog(2, "HPC DUART1 Channel B Control Write: %08x (%08x) %c\n", data, mem_mask, data & 0x000000ff );
386387         //mame_printf_info( "%c", data & 0x000000ff );
387388      }
388389      else
389390      {
390//          verboselog(machine(), 2, "HPC DUART1 Channel B Control Write: %08x (%08x)\n", data, mem_mask );
391//          verboselog(2, "HPC DUART1 Channel B Control Write: %08x (%08x)\n", data, mem_mask );
391392      }
392393      break;
393394   case 0x0d14:
394395      if( ( data & 0x000000ff ) >= 0x00000020 || ( data & 0x000000ff ) == 0x0d || ( data & 0x000000ff ) == 0x0a )
395396      {
396         verboselog(machine(), 2, "HPC DUART1 Channel B Data Write: %08x (%08x) %c\n", data, mem_mask, data & 0x000000ff );
397         verboselog(2, "HPC DUART1 Channel B Data Write: %08x (%08x) %c\n", data, mem_mask, data & 0x000000ff );
397398         mame_printf_info( "%c", data & 0x000000ff );
398399      }
399400      else
400401      {
401         verboselog(machine(), 2, "HPC DUART1 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
402         verboselog(2, "HPC DUART1 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
402403      }
403404      break;
404405   case 0x0d18:
405406      mame_printf_info("HPC DUART1 Channel A Control Write: %08x (%08x)\n", data, mem_mask );
406407      break;
407408   case 0x0d1c:
408      verboselog(machine(), 2, "HPC DUART1 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
409      verboselog(2, "HPC DUART1 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
409410      break;
410411   case 0x0d20:
411412      mame_printf_info("HPC DUART2 Channel B Control Write: %08x (%08x)\n", data, mem_mask );
412413      break;
413414   case 0x0d24:
414      verboselog(machine(), 2, "HPC DUART2 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
415      verboselog(2, "HPC DUART2 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
415416      break;
416417   case 0x0d28:
417418      mame_printf_info("HPC DUART2 Channel A Control Write: %08x (%08x)\n", data, mem_mask );
418419      break;
419420   case 0x0d2c:
420      verboselog(machine(), 2, "HPC DUART2 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
421      verboselog(2, "HPC DUART2 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
421422      break;
422423   case 0x0d30:
423424      mame_printf_info("HPC DUART3 Channel B Control Write: %08x (%08x)\n", data, mem_mask );
424425      break;
425426   case 0x0d34:
426      verboselog(machine(), 2, "HPC DUART3 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
427      verboselog(2, "HPC DUART3 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
427428      break;
428429   case 0x0d38:
429430      mame_printf_info("HPC DUART3 Channel A Control Write: %08x (%08x)\n", data, mem_mask );
430431      break;
431432   case 0x0d3c:
432      verboselog(machine(), 2, "HPC DUART3 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
433      verboselog(2, "HPC DUART3 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
433434      break;
434435   default:
435436      mame_printf_info("Unmapped HPC write: 0x%08x (%08x): %08x\n", 0x1fb80000 + offset, mem_mask, data);
trunk/src/mess/drivers/vt100.c
r21160r21161
6363   INTERRUPT_GEN_MEMBER(vt100_vertical_interrupt);
6464   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
6565   IRQ_CALLBACK_MEMBER(vt100_irq_callback);
66   UINT8 bit_sel(UINT8 data);
6667};
6768
6869
r21160r21161
107108   return ret;
108109}
109110
110static UINT8 bit_sel(UINT8 data)
111UINT8 vt100_state::bit_sel(UINT8 data)
111112{
112113   if (!BIT(data,7)) return 0x70;
113114   if (!BIT(data,6)) return 0x60;
trunk/src/mess/drivers/mmodular.c
r21160r21161
205205   TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq2);
206206   TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq_academy);
207207   void common_chess_start();
208   UINT8 convert_imputmask(UINT8 input);
209   UINT8 convertMCIV2LED(UINT8 codedchar);
210   void write_IOenable(unsigned char data,address_space &space);
208211};
209212
210static UINT8 convert_imputmask(UINT8 input)
213UINT8 polgar_state::convert_imputmask(UINT8 input)
211214{
212215   input^=0xff;
213216   switch (input) {
r21160r21161
513516   logerror("LEDs  Offset = %d Data = %d\n",offset,data);
514517}
515518
516static UINT8 convertMCIV2LED(UINT8 codedchar)
519UINT8 polgar_state::convertMCIV2LED(UINT8 codedchar)
517520{
518521   UINT8 data = 0;
519522   if (BIT(codedchar,0)) data |= 0x80;
r21160r21161
857860
858861}
859862
860static void write_IOenable(unsigned char data,address_space &space) {
863void polgar_state::write_IOenable(unsigned char data,address_space &space)
864{
861865   hd44780_device * hd44780 = space.machine().device<hd44780_device>("hd44780");
862866   device_t *speaker = space.machine().device("beep");
863867
trunk/src/mess/drivers/multi8.c
r21160r21161
7070   virtual void palette_init();
7171   UINT32 screen_update_multi8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7272   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
73   void multi8_draw_pixel(bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width);
7374};
7475
7576#define mc6845_h_char_total     (m_crtc_vreg[0])
r21160r21161
101102   m_p_chargen = memregion("chargen")->base();
102103}
103104
104static void multi8_draw_pixel(running_machine &machine, bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width)
105void multi8_state::multi8_draw_pixel(bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width)
105106{
106   if(!machine.primary_screen->visible_area().contains(x, y))
107   if(!machine().primary_screen->visible_area().contains(x, y))
107108      return;
108109
109110   if(width)
r21160r21161
148149            else
149150               color = (pen_b) | (pen_r << 1) | (pen_g << 2);
150151
151            multi8_draw_pixel(machine(),bitmap, y, x*8+xi,m_pen_clut[color], 0);
152            multi8_draw_pixel(bitmap, y, x*8+xi,m_pen_clut[color], 0);
152153         }
153154         count++;
154155      }
r21160r21161
176177                  pen = (m_p_chargen[tile*8+yi] >> (7-xi) & 1) ? color : 0;
177178
178179               if(pen)
179                  multi8_draw_pixel(machine(),bitmap, y*mc6845_tile_height+yi, x*8+xi, pen, (m_display_reg & 0x40) == 0x00);
180                  multi8_draw_pixel(bitmap, y*mc6845_tile_height+yi, x*8+xi, pen, (m_display_reg & 0x40) == 0x00);
180181            }
181182         }
182183
r21160r21161
201202               for (yc=0; yc<(mc6845_tile_height-(mc6845_cursor_y_start & 7)); yc++)
202203               {
203204                  for (xc=0; xc<8; xc++)
204                     multi8_draw_pixel(machine(),bitmap, y*mc6845_tile_height+yc, x*8+xc,0x07,(m_display_reg & 0x40) == 0x00);
205                     multi8_draw_pixel(bitmap, y*mc6845_tile_height+yc, x*8+xc,0x07,(m_display_reg & 0x40) == 0x00);
205206
206207               }
207208            }
trunk/src/mess/drivers/vtech1.c
r21160r21161
199199   DECLARE_READ8_MEMBER(vtech1_printer_r);
200200   DECLARE_WRITE8_MEMBER(vtech1_strobe_w);
201201   DECLARE_READ8_MEMBER(vtech1_mc6847_videoram_r);
202   void vtech1_get_track();
203   void vtech1_put_track();
202204};
203205
204206
r21160r21161
283285      vtech1->m_fdc_wrprot[id] = 0x80;
284286}
285287
286static void vtech1_get_track(running_machine &machine)
288void vtech1_state::vtech1_get_track()
287289{
288   vtech1_state *vtech1 = machine.driver_data<vtech1_state>();
289   device_image_interface *image = dynamic_cast<device_image_interface *>(floppy_get_device(machine,vtech1->m_drive));
290   device_image_interface *image = dynamic_cast<device_image_interface *>(floppy_get_device(machine(),m_drive));
290291
291292   /* drive selected or and image file ok? */
292   if (vtech1->m_drive >= 0 && image->exists())
293   if (m_drive >= 0 && image->exists())
293294   {
294295      int size, offs;
295296      size = TRKSIZE_VZ;
296      offs = TRKSIZE_VZ * vtech1->m_fdc_track_x2[vtech1->m_drive]/2;
297      offs = TRKSIZE_VZ * m_fdc_track_x2[m_drive]/2;
297298      image->fseek(offs, SEEK_SET);
298      size = image->fread(vtech1->m_fdc_data, size);
299      size = image->fread(m_fdc_data, size);
299300      if (LOG_VTECH1_FDC)
300301         logerror("get track @$%05x $%04x bytes\n", offs, size);
301302   }
302   vtech1->m_fdc_offs = 0;
303   vtech1->m_fdc_write = 0;
303   m_fdc_offs = 0;
304   m_fdc_write = 0;
304305}
305306
306static void vtech1_put_track(running_machine &machine)
307void vtech1_state::vtech1_put_track()
307308{
308   vtech1_state *vtech1 = machine.driver_data<vtech1_state>();
309309
310310
311311   /* drive selected and image file ok? */
312   if (vtech1->m_drive >= 0 && floppy_get_device(machine,vtech1->m_drive) != NULL)
312   if (m_drive >= 0 && floppy_get_device(machine(),m_drive) != NULL)
313313   {
314314      int size, offs;
315      device_image_interface *image = dynamic_cast<device_image_interface *>(floppy_get_device(machine,vtech1->m_drive));
316      offs = TRKSIZE_VZ * vtech1->m_fdc_track_x2[vtech1->m_drive]/2;
317      image->fseek(offs + vtech1->m_fdc_start, SEEK_SET);
318      size = image->fwrite(&vtech1->m_fdc_data[vtech1->m_fdc_start], vtech1->m_fdc_write);
315      device_image_interface *image = dynamic_cast<device_image_interface *>(floppy_get_device(machine(),m_drive));
316      offs = TRKSIZE_VZ * m_fdc_track_x2[m_drive]/2;
317      image->fseek(offs + m_fdc_start, SEEK_SET);
318      size = image->fwrite(&m_fdc_data[m_fdc_start], m_fdc_write);
319319      if (LOG_VTECH1_FDC)
320         logerror("put track @$%05X+$%X $%04X/$%04X bytes\n", offs, vtech1->m_fdc_start, size, vtech1->m_fdc_write);
320         logerror("put track @$%05X+$%X $%04X/$%04X bytes\n", offs, m_fdc_start, size, m_fdc_write);
321321   }
322322}
323323
r21160r21161
380380      {
381381         m_drive = drive;
382382         if (m_drive >= 0)
383            vtech1_get_track(machine());
383            vtech1_get_track();
384384      }
385385      if (m_drive >= 0)
386386      {
r21160r21161
394394            if (LOG_VTECH1_FDC)
395395               logerror("vtech1_fdc_w(%d) $%02X drive %d: stepout track #%2d.%d\n", offset, data, m_drive, m_fdc_track_x2[m_drive]/2,5*(m_fdc_track_x2[m_drive]&1));
396396            if ((m_fdc_track_x2[m_drive] & 1) == 0)
397               vtech1_get_track(machine());
397               vtech1_get_track();
398398         }
399399         else
400400         if ((PHI0(data) && !(PHI1(data) || PHI2(data) || PHI3(data)) && PHI3(m_fdc_latch)) ||
r21160r21161
407407            if (LOG_VTECH1_FDC)
408408               logerror("vtech1_fdc_w(%d) $%02X drive %d: stepin track #%2d.%d\n", offset, data, m_drive, m_fdc_track_x2[m_drive]/2,5*(m_fdc_track_x2[m_drive]&1));
409409            if ((m_fdc_track_x2[m_drive] & 1) == 0)
410               vtech1_get_track(machine());
410               vtech1_get_track();
411411         }
412412         if ((data & 0x40) == 0)
413413         {
r21160r21161
452452            {
453453               /* data written to track before? */
454454               if (m_fdc_write)
455                  vtech1_put_track(machine());
455                  vtech1_put_track();
456456            }
457457            m_fdc_bits = 8;
458458            m_fdc_write = 0;
trunk/src/mess/drivers/apexc.c
r21160r21161
3535   INTERRUPT_GEN_MEMBER(apexc_interrupt);
3636   DECLARE_READ8_MEMBER(tape_read);
3737   DECLARE_WRITE8_MEMBER(tape_write);
38   void apexc_draw_led(bitmap_ind16 &bitmap, int x, int y, int state);
39   void apexc_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color);
40   void apexc_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color);
41   void apexc_teletyper_init();
42   void apexc_teletyper_linefeed();
43   void apexc_teletyper_putchar(int character);
3844};
3945
40
41static void apexc_teletyper_init(running_machine &machine);
42static void apexc_teletyper_putchar(running_machine &machine, int character);
43
44
4546void apexc_state::machine_start()
4647{
47   apexc_teletyper_init(machine());
48   apexc_teletyper_init();
4849}
4950
5051
r21160r21161
287288   if (image->exists())
288289      image->fwrite(& data5, 1);
289290
290   apexc_teletyper_putchar(machine(), data & 0x1f);    /* display on screen */
291   apexc_teletyper_putchar(data & 0x1f);    /* display on screen */
291292}
292293
293294/*
r21160r21161
567568}
568569
569570/* draw a small 8*8 LED (well, there were no LEDs at the time, so let's call this a lamp ;-) ) */
570static void apexc_draw_led(bitmap_ind16 &bitmap, int x, int y, int state)
571void apexc_state::apexc_draw_led(bitmap_ind16 &bitmap, int x, int y, int state)
571572{
572573   int xx, yy;
573574
r21160r21161
577578}
578579
579580/* write a single char on screen */
580static void apexc_draw_char(running_machine &machine, bitmap_ind16 &bitmap, char character, int x, int y, int color)
581void apexc_state::apexc_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color)
581582{
582   drawgfx_transpen(bitmap, bitmap.cliprect(), machine.gfx[0], character-32, color, 0, 0,
583   drawgfx_transpen(bitmap, bitmap.cliprect(), machine().gfx[0], character-32, color, 0, 0,
583584            x+1, y, 0);
584585}
585586
586587/* write a string on screen */
587static void apexc_draw_string(running_machine &machine, bitmap_ind16 &bitmap, const char *buf, int x, int y, int color)
588void apexc_state::apexc_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color)
588589{
589590   while (* buf)
590591   {
591      apexc_draw_char(machine, bitmap, *buf, x, y, color);
592      apexc_draw_char(bitmap, *buf, x, y, color);
592593
593594      x += 8;
594595      buf++;
r21160r21161
602603   char the_char;
603604
604605   bitmap.fill(0, /*machine().visible_area*/panel_window);
605   apexc_draw_string(machine(), bitmap, "power", 8, 0, 0);
606   apexc_draw_string(machine(), bitmap, "running", 8, 8, 0);
607   apexc_draw_string(machine(), bitmap, "data :", 0, 24, 0);
606   apexc_draw_string(bitmap, "power", 8, 0, 0);
607   apexc_draw_string(bitmap, "running", 8, 8, 0);
608   apexc_draw_string(bitmap, "data :", 0, 24, 0);
608609
609610   copybitmap(bitmap, *m_bitmap, 0, 0, 0, 0, teletyper_window);
610611
r21160r21161
617618   {
618619      apexc_draw_led(bitmap, i*8, 32, (m_panel_data_reg << i) & 0x80000000UL);
619620      the_char = '0' + ((i + 1) % 10);
620      apexc_draw_char(machine(), bitmap, the_char, i*8, 40, 0);
621      apexc_draw_char(bitmap, the_char, i*8, 40, 0);
621622      if (((i + 1) % 10) == 0)
622623      {
623624         the_char = '0' + ((i + 1) / 10);
624         apexc_draw_char(machine(), bitmap, the_char, i*8, 48, 0);
625         apexc_draw_char(bitmap, the_char, i*8, 48, 0);
625626      }
626627   }
627628   return 0;
628629}
629630
630static void apexc_teletyper_init(running_machine &machine)
631void apexc_state::apexc_teletyper_init()
631632{
632   apexc_state *state = machine.driver_data<apexc_state>();
633633
634   state->m_letters = FALSE;
635   state->m_pos = 0;
634   m_letters = FALSE;
635   m_pos = 0;
636636}
637637
638static void apexc_teletyper_linefeed(running_machine &machine)
638void apexc_state::apexc_teletyper_linefeed()
639639{
640   apexc_state *state = machine.driver_data<apexc_state>();
641640   UINT8 buf[teletyper_window_width];
642641   int y;
643642
644643   for (y=teletyper_window_offset_y; y<teletyper_window_offset_y+teletyper_window_height-teletyper_scroll_step; y++)
645644   {
646      extract_scanline8(*state->m_bitmap, teletyper_window_offset_x, y+teletyper_scroll_step, teletyper_window_width, buf);
647      draw_scanline8(*state->m_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, machine.pens);
645      extract_scanline8(*m_bitmap, teletyper_window_offset_x, y+teletyper_scroll_step, teletyper_window_width, buf);
646      draw_scanline8(*m_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, machine().pens);
648647   }
649648
650   state->m_bitmap->fill(0, teletyper_scroll_clear_window);
649   m_bitmap->fill(0, teletyper_scroll_clear_window);
651650}
652651
653static void apexc_teletyper_putchar(running_machine &machine, int character)
652void apexc_state::apexc_teletyper_putchar(int character)
654653{
655654   static const char ascii_table[2][32] =
656655   {
r21160r21161
676675      }
677676   };
678677
679   apexc_state *state = machine.driver_data<apexc_state>();
680678   char buffer[2] = "x";
681679
682680   character &= 0x1f;
r21160r21161
685683   {
686684   case 19:
687685      /* Line Space */
688      apexc_teletyper_linefeed(machine);
686      apexc_teletyper_linefeed();
689687      break;
690688
691689   case 24:
692690      /* Carriage Return */
693      state->m_pos = 0;
691      m_pos = 0;
694692      break;
695693
696694   case 27:
697695      /* Figures */
698      state->m_letters = FALSE;
696      m_letters = FALSE;
699697      break;
700698
701699   case 31:
702700      /* Letters */
703      state->m_letters = TRUE;
701      m_letters = TRUE;
704702      break;
705703
706704   default:
707705      /* Any printable character... */
708706
709      if (state->m_pos >= 32)
707      if (m_pos >= 32)
710708      {   /* if past right border, wrap around */
711         apexc_teletyper_linefeed(machine);  /* next line */
712         state->m_pos = 0;                   /* return to start of line */
709         apexc_teletyper_linefeed();  /* next line */
710         m_pos = 0;                   /* return to start of line */
713711      }
714712
715713      /* print character */
716      buffer[0] = ascii_table[state->m_letters][character];   /* lookup ASCII equivalent in table */
714      buffer[0] = ascii_table[m_letters][character];   /* lookup ASCII equivalent in table */
717715      buffer[1] = '\0';                               /* terminate string */
718      apexc_draw_string(machine, *state->m_bitmap, buffer, 8*state->m_pos, 176, 0);   /* print char */
719      state->m_pos++;                                         /* step carriage forward */
716      apexc_draw_string(*m_bitmap, buffer, 8*m_pos, 176, 0);   /* print char */
717      m_pos++;                                         /* step carriage forward */
720718
721719      break;
722720   }
trunk/src/mess/drivers/supracan.c
r21160r21161
208208   TIMER_CALLBACK_MEMBER(supracan_line_off_callback);
209209   TIMER_CALLBACK_MEMBER(supracan_video_callback);
210210   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(supracan_cart);
211   inline void verboselog(const char *tag, int n_level, const char *s_fmt, ...);
212   int supracan_tilemap_get_region(int layer);
213   void supracan_tilemap_get_info_common(int layer, tile_data &tileinfo, int count);
214   void supracan_tilemap_get_info_roz(int layer, tile_data &tileinfo, int count);
215   int get_tilemap_dimensions(int &xsize, int &ysize, int layer);
216   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
217   void mark_active_tilemap_all_dirty(int layer);
218   void supracan_suprnova_draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound/*, int columnscroll, UINT32* scrollram*/, int transmask);
211219};
212220
213221
214222
215223#if ENABLE_VERBOSE_LOG
216INLINE void verboselog(const char *tag, running_machine &machine, int n_level, const char *s_fmt, ...)
224inline void supracan_state::verboselog(const char *tag, int n_level, const char *s_fmt, ...)
217225{
218226   if( VERBOSE_LEVEL >= n_level )
219227   {
r21160r21161
222230      va_start( v, s_fmt );
223231      vsprintf( buf, s_fmt, v );
224232      va_end( v );
225      logerror( "%06x: %s: %s", machine.device(tag)->safe_pc(), tag, buf );
233      logerror( "%06x: %s: %s", machine().device(tag)->safe_pc(), tag, buf );
226234   }
227235}
228236
r21160r21161
230238#define verboselog(w,x,y,z,...)
231239#endif
232240
233static int supracan_tilemap_get_region(running_machine &machine, int layer)
241int supracan_state::supracan_tilemap_get_region(int layer)
234242{
235   supracan_state *state = machine.driver_data<supracan_state>();
236243
237244   // HACK!!!
238245   if (layer==2)
r21160r21161
245252   {
246253      // roz layer
247254
248      int gfx_mode = (state->m_roz_mode & 3);
255      int gfx_mode = (m_roz_mode & 3);
249256
250257      switch(gfx_mode)
251258      {
r21160r21161
259266   else
260267   {
261268      // normal layers
262      int gfx_mode = (state->m_tilemap_mode[layer] & 0x7000) >> 12;
269      int gfx_mode = (m_tilemap_mode[layer] & 0x7000) >> 12;
263270
264271      switch(gfx_mode)
265272      {
r21160r21161
274281
275282}
276283
277static void supracan_tilemap_get_info_common(running_machine &machine, int layer, tile_data &tileinfo, int count)
284void supracan_state::supracan_tilemap_get_info_common(int layer, tile_data &tileinfo, int count)
278285{
279   supracan_state *state = machine.driver_data<supracan_state>();
280286
281   UINT16* supracan_vram = state->m_vram;
287   UINT16* supracan_vram = m_vram;
282288
283   UINT32 base = (state->m_tilemap_base_addr[layer]);
284   int gfx_mode = (state->m_tilemap_mode[layer] & 0x7000) >> 12;
285   int region = supracan_tilemap_get_region(machine, layer);
289   UINT32 base = (m_tilemap_base_addr[layer]);
290   int gfx_mode = (m_tilemap_mode[layer] & 0x7000) >> 12;
291   int region = supracan_tilemap_get_region(layer);
286292
287293   count += base;
288294
r21160r21161
311317         break;
312318
313319      default:
314         verboselog("maincpu", machine, 0, "Unsupported tilemap mode: %d\n", (state->m_tilemap_mode[layer] & 0x7000) >> 12);
320         verboselog("maincpu", 0, "Unsupported tilemap mode: %d\n", (m_tilemap_mode[layer] & 0x7000) >> 12);
315321         break;
316322   }
317323
r21160r21161
325331   int flipxy = (supracan_vram[count] & 0x0c00)>>10;
326332   int palette = ((supracan_vram[count] & 0xf000) >> 12) + palette_bank;
327333
328   SET_TILE_INFO(region, tile, palette, TILE_FLIPXY(flipxy));
334   SET_TILE_INFO_MEMBER(region, tile, palette, TILE_FLIPXY(flipxy));
329335}
330336
331337// I wonder how different this really is.. my guess, not at all.
332static void supracan_tilemap_get_info_roz(running_machine &machine, int layer, tile_data &tileinfo, int count)
338void supracan_state::supracan_tilemap_get_info_roz(int layer, tile_data &tileinfo, int count)
333339{
334   supracan_state *state = machine.driver_data<supracan_state>();
335340
336   UINT16* supracan_vram = state->m_vram;
341   UINT16* supracan_vram = m_vram;
337342
338   UINT32 base = state->m_roz_base_addr;
343   UINT32 base = m_roz_base_addr;
339344
340345
341346   int region = 1;
342347   UINT16 tile_bank = 0;
343348   UINT16 palette_bank = 0;
344349
345   region = supracan_tilemap_get_region(machine, layer);
350   region = supracan_tilemap_get_region(layer);
346351
347   switch(state->m_roz_mode & 3) //FIXME: fix gfx bpp order
352   switch(m_roz_mode & 3) //FIXME: fix gfx bpp order
348353   {
349354      case 0:
350355         // hack: case for startup logo
r21160r21161
356361            if (count & 0x20) tile ^= 1;
357362            tile |= (count & 0xc0)>>2;
358363
359            SET_TILE_INFO(region, tile, 0, 0);
364            SET_TILE_INFO_MEMBER(region, tile, 0, 0);
360365            return;
361366         }
362367
363368
364369      case 1:
365         tile_bank = (state->m_roz_tile_bank & 0xf000) >> 3;
370         tile_bank = (m_roz_tile_bank & 0xf000) >> 3;
366371         break;
367372
368373      case 2:
369         tile_bank = (state->m_roz_tile_bank & 0xf000) >> 3;
374         tile_bank = (m_roz_tile_bank & 0xf000) >> 3;
370375         break;
371376
372377      case 3:
373         tile_bank = (state->m_roz_tile_bank & 0xf000) >> 3;
378         tile_bank = (m_roz_tile_bank & 0xf000) >> 3;
374379         break;
375380   }
376381
r21160r21161
380385   int flipxy = (supracan_vram[count] & 0x0c00)>>10;
381386   int palette = ((supracan_vram[count] & 0xf000) >> 12) + palette_bank;
382387
383   SET_TILE_INFO(region, tile, palette, TILE_FLIPXY(flipxy));
388   SET_TILE_INFO_MEMBER(region, tile, palette, TILE_FLIPXY(flipxy));
384389}
385390
386391
387392
388393TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap0_tile_info)
389394{
390   supracan_tilemap_get_info_common(machine(), 0, tileinfo, tile_index);
395   supracan_tilemap_get_info_common(0, tileinfo, tile_index);
391396}
392397
393398TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap1_tile_info)
394399{
395   supracan_tilemap_get_info_common(machine(), 1, tileinfo, tile_index);
400   supracan_tilemap_get_info_common(1, tileinfo, tile_index);
396401}
397402
398403TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap2_tile_info)
399404{
400   supracan_tilemap_get_info_common(machine(), 2, tileinfo, tile_index);
405   supracan_tilemap_get_info_common(2, tileinfo, tile_index);
401406}
402407
403408TILE_GET_INFO_MEMBER(supracan_state::get_supracan_roz_tile_info)
404409{
405   supracan_tilemap_get_info_roz(machine(), 3, tileinfo, tile_index);
410   supracan_tilemap_get_info_roz(3, tileinfo, tile_index);
406411}
407412
408413
r21160r21161
435440   m_tilemap_sizes[3][3] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
436441}
437442
438static int get_tilemap_dimensions(running_machine &machine, int &xsize, int &ysize, int layer)
443int supracan_state::get_tilemap_dimensions(int &xsize, int &ysize, int layer)
439444{
440   supracan_state *state = (supracan_state *)machine.driver_data<supracan_state>();
441445   int select;
442446
443447   xsize = 32;
444448   ysize = 32;
445449
446   if (layer==3) select = (state->m_roz_mode & 0x0f00);
447   else select = state->m_tilemap_flags[layer] & 0x0f00;
450   if (layer==3) select = (m_roz_mode & 0x0f00);
451   else select = m_tilemap_flags[layer] & 0x0f00;
448452
449453   switch(select)
450454   {
r21160r21161
464468         return 3;
465469
466470      default:
467         verboselog("maincpu", machine, 0, "Unsupported tilemap size for layer %d: %04x\n", layer, select);
471         verboselog("maincpu", 0, "Unsupported tilemap size for layer %d: %04x\n", layer, select);
468472         return 0;
469473   }
470474}
r21160r21161
472476
473477
474478
475static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
479void supracan_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
476480{
477   supracan_state *state = machine.driver_data<supracan_state>();
478   UINT16 *supracan_vram = state->m_vram;
481   UINT16 *supracan_vram = m_vram;
479482
480483//      [0]
481484//      -e-- ---- ---- ---- sprite enable?
r21160r21161
495498//      -ooo oooo oooo oooo Sprite address
496499
497500   UINT32 skip_count = 0;
498   UINT32 start_word = (state->m_sprite_base_addr >> 1) + skip_count * 4;
499   UINT32 end_word = start_word + (state->m_sprite_count - skip_count) * 4;
500   int region = (state->m_sprite_flags & 1) ? 0 : 1; //8bpp : 4bpp
501   UINT32 start_word = (m_sprite_base_addr >> 1) + skip_count * 4;
502   UINT32 end_word = start_word + (m_sprite_count - skip_count) * 4;
503   int region = (m_sprite_flags & 1) ? 0 : 1; //8bpp : 4bpp
501504
502505//  printf("frame\n");
503506   #define VRAM_MASK (0xffff)
r21160r21161
514517      int sprite_xflip = (supracan_vram[i+1] & 0x0800) >> 11;
515518      int sprite_yflip = (supracan_vram[i+1] & 0x0400) >> 10;
516519      //int xscale = (supracan_vram[i+2] & 0xf000) >> 12;
517      gfx_element *gfx = machine.gfx[region];
520      gfx_element *gfx = machine().gfx[region];
518521
519522
520523
r21160r21161
626629
627630
628631
629static void mark_active_tilemap_all_dirty(running_machine &machine, int layer)
632void supracan_state::mark_active_tilemap_all_dirty(int layer)
630633{
631   supracan_state *state = (supracan_state *)machine.driver_data<supracan_state>();
632634   int xsize = 0;
633635   int ysize = 0;
634636
635637   int which_tilemap_size;
636638
637   which_tilemap_size = get_tilemap_dimensions(machine, xsize, ysize, layer);
639   which_tilemap_size = get_tilemap_dimensions(xsize, ysize, layer);
638640//  for (int i=0;i<4;i++)
639//    tilemap_mark_all_tiles_dirty(state->m_tilemap_sizes[layer][i]);
640   state->m_tilemap_sizes[layer][which_tilemap_size]->mark_all_dirty();
641//    tilemap_mark_all_tiles_dirty(m_tilemap_sizes[layer][i]);
642   m_tilemap_sizes[layer][which_tilemap_size]->mark_all_dirty();
641643}
642644
643645
644646
645647/* draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap */
646static void supracan_suprnova_draw_roz(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound/*, int columnscroll, UINT32* scrollram*/, int transmask)
648void supracan_state::supracan_suprnova_draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound/*, int columnscroll, UINT32* scrollram*/, int transmask)
647649{
648650   //bitmap_ind16 *destbitmap = bitmap;
649651   bitmap_ind16 &srcbitmap = tmap->pixmap();
r21160r21161
779781         m_sprite_final_bitmap.fill(0x00, visarea);
780782         bitmap.fill(0x80, visarea);
781783
782         draw_sprites(machine(), m_sprite_final_bitmap, visarea);
784         draw_sprites( m_sprite_final_bitmap, visarea);
783785      }
784786   }
785787   else
r21160r21161
787789      m_sprite_final_bitmap.fill(0x00, cliprect);
788790      bitmap.fill(0x80, cliprect);
789791
790      draw_sprites(machine(), m_sprite_final_bitmap, cliprect);
792      draw_sprites(m_sprite_final_bitmap, cliprect);
791793   }
792794
793795
r21160r21161
826828         if (priority==pri)
827829         {
828830//            tilemap_num = layer;
829            which_tilemap_size = get_tilemap_dimensions(machine(), xsize, ysize, layer);
831            which_tilemap_size = get_tilemap_dimensions(xsize, ysize, layer);
830832            bitmap_ind16 &src_bitmap = m_tilemap_sizes[layer][which_tilemap_size]->pixmap();
831            int gfx_region = supracan_tilemap_get_region(machine(), layer);
833            int gfx_region = supracan_tilemap_get_region(layer);
832834            int transmask = 0xff;
833835
834836            switch (gfx_region)
r21160r21161
949951
950952
951953                        if (m_vram[m_roz_unk_base0/2 + y]) // incxx = 0, no draw?
952                           supracan_suprnova_draw_roz(machine(), bitmap, clip, m_tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask);
954                           supracan_suprnova_draw_roz(bitmap, clip, m_tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask);
953955                     }
954956                  }
955957                  else
956958                  {
957                     supracan_suprnova_draw_roz(machine(), bitmap, cliprect, m_tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask);
959                     supracan_suprnova_draw_roz(bitmap, cliprect, m_tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask);
958960                  }
959961               }
960962            }
r21160r21161
993995   {
994996      case 0x00/2: // Source address MSW
995997      case 0x10/2:
996         verboselog("maincpu", machine(), 0, "supracan_dma_w: source msw %d: %04x\n", ch, data);
998         verboselog("maincpu", 0, "supracan_dma_w: source msw %d: %04x\n", ch, data);
997999         acan_dma_regs->source[ch] &= 0x0000ffff;
9981000         acan_dma_regs->source[ch] |= data << 16;
9991001         break;
10001002      case 0x02/2: // Source address LSW
10011003      case 0x12/2:
1002         verboselog("maincpu", machine(), 0, "supracan_dma_w: source lsw %d: %04x\n", ch, data);
1004         verboselog("maincpu", 0, "supracan_dma_w: source lsw %d: %04x\n", ch, data);
10031005         acan_dma_regs->source[ch] &= 0xffff0000;
10041006         acan_dma_regs->source[ch] |= data;
10051007         break;
10061008      case 0x04/2: // Destination address MSW
10071009      case 0x14/2:
1008         verboselog("maincpu", machine(), 0, "supracan_dma_w: dest msw %d: %04x\n", ch, data);
1010         verboselog("maincpu", 0, "supracan_dma_w: dest msw %d: %04x\n", ch, data);
10091011         acan_dma_regs->dest[ch] &= 0x0000ffff;
10101012         acan_dma_regs->dest[ch] |= data << 16;
10111013         break;
10121014      case 0x06/2: // Destination address LSW
10131015      case 0x16/2:
1014         verboselog("maincpu", machine(), 0, "supracan_dma_w: dest lsw %d: %04x\n", ch, data);
1016         verboselog("maincpu", 0, "supracan_dma_w: dest lsw %d: %04x\n", ch, data);
10151017         acan_dma_regs->dest[ch] &= 0xffff0000;
10161018         acan_dma_regs->dest[ch] |= data;
10171019         break;
10181020      case 0x08/2: // Byte count
10191021      case 0x18/2:
1020         verboselog("maincpu", machine(), 0, "supracan_dma_w: count %d: %04x\n", ch, data);
1022         verboselog("maincpu", 0, "supracan_dma_w: count %d: %04x\n", ch, data);
10211023         acan_dma_regs->count[ch] = data;
10221024         break;
10231025      case 0x0a/2: // Control
10241026      case 0x1a/2:
1025         verboselog("maincpu", machine(), 0, "supracan_dma_w: control %d: %04x\n", ch, data);
1027         verboselog("maincpu", 0, "supracan_dma_w: control %d: %04x\n", ch, data);
10261028         if(data & 0x8800)
10271029         {
10281030//            if(data & 0x2000)
r21160r21161
10501052         }
10511053         else if(data != 0x0000) // fake DMA, used by C.U.G.
10521054         {
1053            verboselog("maincpu", machine(), 0, "supracan_dma_w: Unknown DMA kickoff value of %04x (other regs %08x, %08x, %d)\n", data, acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1);
1055            verboselog("maincpu", 0, "supracan_dma_w: Unknown DMA kickoff value of %04x (other regs %08x, %08x, %d)\n", data, acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1);
10541056            fatalerror("supracan_dma_w: Unknown DMA kickoff value of %04x (other regs %08x, %08x, %d)\n",data, acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1);
10551057         }
10561058         break;
10571059      default:
1058         verboselog("maincpu", machine(), 0, "supracan_dma_w: Unknown register: %08x = %04x & %04x\n", 0xe90020 + (offset << 1), data, mem_mask);
1060         verboselog("maincpu", 0, "supracan_dma_w: Unknown register: %08x = %04x & %04x\n", 0xe90020 + (offset << 1), data, mem_mask);
10591061         break;
10601062   }
10611063}
r21160r21161
11341136
11351137      case 0x410: // Sound IRQ enable
11361138         data = m_sound_irq_enable_reg;
1137         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_r: IRQ enable: %04x\n", data);
1139         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_r: IRQ enable: %04x\n", data);
11381140         if(!mem.debugger_access())
11391141         {
11401142            if(m_sound_irq_enable_reg & m_sound_irq_source_reg)
r21160r21161
11501152      case 0x411: // Sound IRQ source
11511153         data = m_sound_irq_source_reg;
11521154         m_sound_irq_source_reg = 0;
1153         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: IRQ source: %04x\n", data);
1155         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: IRQ source: %04x\n", data);
11541156         if(!mem.debugger_access())
11551157         {
11561158            machine().device("soundcpu")->execute().set_input_line(0, CLEAR_LINE);
11571159         }
11581160         break;
11591161      case 0x420:
1160         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: Sound hardware status? (not yet implemented): %02x\n", 0);
1162         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: Sound hardware status? (not yet implemented): %02x\n", 0);
11611163         break;
11621164      case 0x422:
1163         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: Sound hardware data? (not yet implemented): %02x\n", 0);
1165         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: Sound hardware data? (not yet implemented): %02x\n", 0);
11641166         break;
11651167      case 0x404:
11661168      case 0x405:
r21160r21161
11711173      default:
11721174         if(offset >= 0x300 && offset < 0x500)
11731175         {
1174            if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_r: Unknown register %04x\n", offset);
1176            if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_r: Unknown register %04x\n", offset);
11751177         }
11761178         break;
11771179   }
r21160r21161
11861188      case 0x407:
11871189         if(m_sound_cpu_68k_irq_reg &~ data)
11881190         {
1189            verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_w: sound_cpu_68k_irq_reg: %04x: Triggering M68k IRQ\n", data);
1191            verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: sound_cpu_68k_irq_reg: %04x: Triggering M68k IRQ\n", data);
11901192            m_maincpu->set_input_line(7, HOLD_LINE);
11911193         }
11921194         else
11931195         {
1194            verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_w: sound_cpu_68k_irq_reg: %04x\n", data);
1196            verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: sound_cpu_68k_irq_reg: %04x\n", data);
11951197         }
11961198         m_sound_cpu_68k_irq_reg = data;
11971199         break;
11981200      case 0x410:
11991201         m_sound_irq_enable_reg = data;
1200         verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_w: IRQ enable: %02x\n", data);
1202         verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: IRQ enable: %02x\n", data);
12011203         break;
12021204      case 0x420:
1203         verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_w: Sound hardware reg data? (not yet implemented): %02x\n", data);
1205         verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_w: Sound hardware reg data? (not yet implemented): %02x\n", data);
12041206         break;
12051207      case 0x422:
1206         verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_w: Sound hardware reg addr? (not yet implemented): %02x\n", data);
1208         verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_w: Sound hardware reg addr? (not yet implemented): %02x\n", data);
12071209         break;
12081210      default:
12091211         if(offset >= 0x300 && offset < 0x500)
12101212         {
1211            verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_w: Unknown register %04x = %02x\n", offset, data);
1213            verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: Unknown register %04x = %02x\n", offset, data);
12121214         }
12131215         m_soundram[offset] = data;
12141216         break;
r21160r21161
14051407   switch( offset )
14061408   {
14071409      default:
1408         verboselog("maincpu", machine(), 0, "supracan_sound_r: Unknown register: (%08x) & %04x\n", 0xe90000 + (offset << 1), mem_mask);
1410         verboselog("maincpu", 0, "supracan_sound_r: Unknown register: (%08x) & %04x\n", 0xe90000 + (offset << 1), mem_mask);
14091411         break;
14101412   }
14111413
r21160r21161
14371439            /* Halt the sound cpu */
14381440            machine().device("soundcpu")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
14391441         }
1440         verboselog("maincpu", machine(), 0, "sound cpu ctrl: %04x\n", data);
1442         verboselog("maincpu", 0, "sound cpu ctrl: %04x\n", data);
14411443         break;
14421444      default:
1443         verboselog("maincpu", machine(), 0, "supracan_sound_w: Unknown register: %08x = %04x & %04x\n", 0xe90000 + (offset << 1), data, mem_mask);
1445         verboselog("maincpu", 0, "supracan_sound_w: Unknown register: %08x = %04x & %04x\n", 0xe90000 + (offset << 1), data, mem_mask);
14441446         break;
14451447   }
14461448}
r21160r21161
14561458      case 0x00/2: // Video IRQ flags
14571459         if(!mem.debugger_access())
14581460         {
1459            //verboselog("maincpu", machine(), 0, "read video IRQ flags (%04x)\n", data);
1461            //verboselog("maincpu", 0, "read video IRQ flags (%04x)\n", data);
14601462            m_maincpu->set_input_line(7, CLEAR_LINE);
14611463         }
14621464         break;
r21160r21161
14661468         data = 0;
14671469         break;
14681470      case 0x100/2:
1469         if(!mem.debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_flags[0] (%04x)\n", data);
1471         if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_flags[0] (%04x)\n", data);
14701472         break;
14711473      case 0x106/2:
1472         if(!mem.debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_scrolly[0] (%04x)\n", data);
1474         if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_scrolly[0] (%04x)\n", data);
14731475         break;
14741476      case 0x120/2:
1475         if(!mem.debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_flags[1] (%04x)\n", data);
1477         if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_flags[1] (%04x)\n", data);
14761478         break;
14771479      default:
1478         if(!mem.debugger_access()) verboselog("maincpu", machine(), 0, "supracan_video_r: Unknown register: %08x (%04x & %04x)\n", 0xf00000 + (offset << 1), data, mem_mask);
1480         if(!mem.debugger_access()) verboselog("maincpu", 0, "supracan_video_r: Unknown register: %08x (%04x & %04x)\n", 0xf00000 + (offset << 1), data, mem_mask);
14791481         break;
14801482   }
14811483
r21160r21161
15151517      m_video_regs[0] &= 0x7fff;
15161518
15171519      // we really need better management of this
1518      mark_active_tilemap_all_dirty(machine(), 0);
1519      mark_active_tilemap_all_dirty(machine(), 1);
1520      mark_active_tilemap_all_dirty(machine(), 2);
1521      mark_active_tilemap_all_dirty(machine(), 3);
1520      mark_active_tilemap_all_dirty(0);
1521      mark_active_tilemap_all_dirty(1);
1522      mark_active_tilemap_all_dirty(2);
1523      mark_active_tilemap_all_dirty(3);
15221524
15231525
15241526      break;
r21160r21161
15301532   case 240:
15311533      if(m_irq_mask & 1)
15321534      {
1533         verboselog("maincpu", machine(), 0, "Triggering VBL IRQ\n\n");
1535         verboselog("maincpu", 0, "Triggering VBL IRQ\n\n");
15341536         m_maincpu->set_input_line(7, HOLD_LINE);
15351537      }
15361538      break;
r21160r21161
15541556   switch(offset)
15551557   {
15561558      case 0x10/2: // Byte count
1557         verboselog("maincpu", machine(), 0, "sprite dma word count: %04x\n", data);
1559         verboselog("maincpu", 0, "sprite dma word count: %04x\n", data);
15581560         acan_sprdma_regs->count = data;
15591561         break;
15601562      case 0x12/2: // Destination address MSW
15611563         acan_sprdma_regs->dst &= 0x0000ffff;
15621564         acan_sprdma_regs->dst |= data << 16;
1563         verboselog("maincpu", machine(), 0, "sprite dma dest msw: %04x\n", data);
1565         verboselog("maincpu", 0, "sprite dma dest msw: %04x\n", data);
15641566         break;
15651567      case 0x14/2: // Destination address LSW
15661568         acan_sprdma_regs->dst &= 0xffff0000;
15671569         acan_sprdma_regs->dst |= data;
1568         verboselog("maincpu", machine(), 0, "sprite dma dest lsw: %04x\n", data);
1570         verboselog("maincpu", 0, "sprite dma dest lsw: %04x\n", data);
15691571         break;
15701572      case 0x16/2: // Source word increment
1571         verboselog("maincpu", machine(), 0, "sprite dma dest word inc: %04x\n", data);
1573         verboselog("maincpu", 0, "sprite dma dest word inc: %04x\n", data);
15721574         acan_sprdma_regs->dst_inc = data;
15731575         break;
15741576      case 0x18/2: // Source address MSW
15751577         acan_sprdma_regs->src &= 0x0000ffff;
15761578         acan_sprdma_regs->src |= data << 16;
1577         verboselog("maincpu", machine(), 0, "sprite dma src msw: %04x\n", data);
1579         verboselog("maincpu", 0, "sprite dma src msw: %04x\n", data);
15781580         break;
15791581      case 0x1a/2: // Source address LSW
1580         verboselog("maincpu", machine(), 0, "sprite dma src lsw: %04x\n", data);
1582         verboselog("maincpu", 0, "sprite dma src lsw: %04x\n", data);
15811583         acan_sprdma_regs->src &= 0xffff0000;
15821584         acan_sprdma_regs->src |= data;
15831585         break;
15841586      case 0x1c/2: // Source word increment
1585         verboselog("maincpu", machine(), 0, "sprite dma src word inc: %04x\n", data);
1587         verboselog("maincpu", 0, "sprite dma src word inc: %04x\n", data);
15861588         acan_sprdma_regs->src_inc = data;
15871589         break;
15881590      case 0x1e/2:
r21160r21161
16191621         }
16201622         else
16211623         {
1622            verboselog("maincpu", machine(), 0, "supracan_dma_w: Attempting to kick off a DMA without bit 15 set! (%04x)\n", data);
1624            verboselog("maincpu", 0, "supracan_dma_w: Attempting to kick off a DMA without bit 15 set! (%04x)\n", data);
16231625         }
16241626         break;
16251627      case 0x08/2:
16261628         {
1627            verboselog("maincpu", machine(), 3, "video_flags = %04x\n", data);
1629            verboselog("maincpu", 3, "video_flags = %04x\n", data);
16281630            m_video_flags = data;
16291631
16301632            rectangle visarea = machine().primary_screen->visible_area();
r21160r21161
16361638      case 0x0a/2:
16371639         {
16381640            // raster interrupt
1639            verboselog("maincpu", machine(), 0, "IRQ Trigger? = %04x\n", data);
1641            verboselog("maincpu", 0, "IRQ Trigger? = %04x\n", data);
16401642            if(data & 0x8000)
16411643            {
16421644               m_line_on_timer->adjust(machine().primary_screen->time_until_pos((data & 0x00ff), 0));
r21160r21161
16501652
16511653      case 0x0c/2:
16521654         {
1653            verboselog("maincpu", machine(), 0, "IRQ De-Trigger? = %04x\n", data);
1655            verboselog("maincpu", 0, "IRQ De-Trigger? = %04x\n", data);
16541656            if(data & 0x8000)
16551657            {
16561658               m_line_off_timer->adjust(machine().primary_screen->time_until_pos(data & 0x00ff, 0));
r21160r21161
16631665         break;
16641666
16651667      /* Sprites */
1666      case 0x20/2: m_sprite_base_addr = data << 2; verboselog("maincpu", machine(), 0, "sprite_base_addr = %04x\n", data); break;
1667      case 0x22/2: m_sprite_count = data+1; verboselog("maincpu", machine(), 0, "sprite_count = %d\n", data+1); break;
1668      case 0x26/2: m_sprite_flags = data; verboselog("maincpu", machine(), 0, "sprite_flags = %04x\n", data); break;
1668      case 0x20/2: m_sprite_base_addr = data << 2; verboselog("maincpu", 0, "sprite_base_addr = %04x\n", data); break;
1669      case 0x22/2: m_sprite_count = data+1; verboselog("maincpu", 0, "sprite_count = %d\n", data+1); break;
1670      case 0x26/2: m_sprite_flags = data; verboselog("maincpu", 0, "sprite_flags = %04x\n", data); break;
16691671
16701672      /* Tilemap 0 */
1671      case 0x100/2: m_tilemap_flags[0] = data; verboselog("maincpu", machine(), 3, "tilemap_flags[0] = %04x\n", data); break;
1672      case 0x104/2: m_tilemap_scrollx[0] = data; verboselog("maincpu", machine(), 3, "tilemap_scrollx[0] = %04x\n", data); break;
1673      case 0x106/2: m_tilemap_scrolly[0] = data; verboselog("maincpu", machine(), 3, "tilemap_scrolly[0] = %04x\n", data); break;
1674      case 0x108/2: m_tilemap_base_addr[0] = (data) << 1; verboselog("maincpu", machine(), 3, "tilemap_base_addr[0] = %05x\n", data << 2); break;
1675      case 0x10a/2: m_tilemap_mode[0] = data; verboselog("maincpu", machine(), 3, "tilemap_mode[0] = %04x\n", data); break;
1673      case 0x100/2: m_tilemap_flags[0] = data; verboselog("maincpu", 3, "tilemap_flags[0] = %04x\n", data); break;
1674      case 0x104/2: m_tilemap_scrollx[0] = data; verboselog("maincpu", 3, "tilemap_scrollx[0] = %04x\n", data); break;
1675      case 0x106/2: m_tilemap_scrolly[0] = data; verboselog("maincpu", 3, "tilemap_scrolly[0] = %04x\n", data); break;
1676      case 0x108/2: m_tilemap_base_addr[0] = (data) << 1; verboselog("maincpu", 3, "tilemap_base_addr[0] = %05x\n", data << 2); break;
1677      case 0x10a/2: m_tilemap_mode[0] = data; verboselog("maincpu", 3, "tilemap_mode[0] = %04x\n", data); break;
16761678
16771679      /* Tilemap 1 */
1678      case 0x120/2: m_tilemap_flags[1] = data; verboselog("maincpu", machine(), 3, "tilemap_flags[1] = %04x\n", data); break;
1679      case 0x124/2: m_tilemap_scrollx[1] = data; verboselog("maincpu", machine(), 3, "tilemap_scrollx[1] = %04x\n", data); break;
1680      case 0x126/2: m_tilemap_scrolly[1] = data; verboselog("maincpu", machine(), 3, "tilemap_scrolly[1] = %04x\n", data); break;
1681      case 0x128/2: m_tilemap_base_addr[1] = (data) << 1; verboselog("maincpu", machine(), 3, "tilemap_base_addr[1] = %05x\n", data << 2); break;
1682      case 0x12a/2: m_tilemap_mode[1] = data; verboselog("maincpu", machine(), 3, "tilemap_mode[1] = %04x\n", data); break;
1680      case 0x120/2: m_tilemap_flags[1] = data; verboselog("maincpu", 3, "tilemap_flags[1] = %04x\n", data); break;
1681      case 0x124/2: m_tilemap_scrollx[1] = data; verboselog("maincpu", 3, "tilemap_scrollx[1] = %04x\n", data); break;
1682      case 0x126/2: m_tilemap_scrolly[1] = data; verboselog("maincpu", 3, "tilemap_scrolly[1] = %04x\n", data); break;
1683      case 0x128/2: m_tilemap_base_addr[1] = (data) << 1; verboselog("maincpu", 3, "tilemap_base_addr[1] = %05x\n", data << 2); break;
1684      case 0x12a/2: m_tilemap_mode[1] = data; verboselog("maincpu", 3, "tilemap_mode[1] = %04x\n", data); break;
16831685
16841686      /* Tilemap 2? */
1685      case 0x140/2: m_tilemap_flags[2] = data; verboselog("maincpu", machine(), 0, "tilemap_flags[2] = %04x\n", data); break;
1686      case 0x144/2: m_tilemap_scrollx[2] = data; verboselog("maincpu", machine(), 0, "tilemap_scrollx[2] = %04x\n", data); break;
1687      case 0x146/2: m_tilemap_scrolly[2] = data; verboselog("maincpu", machine(), 0, "tilemap_scrolly[2] = %04x\n", data); break;
1688      case 0x148/2: m_tilemap_base_addr[2] = (data) << 1; verboselog("maincpu", machine(), 0, "tilemap_base_addr[2] = %05x\n", data << 2); break;
1689      case 0x14a/2: m_tilemap_mode[2] = data; verboselog("maincpu", machine(), 0, "tilemap_mode[2] = %04x\n", data); break;
1687      case 0x140/2: m_tilemap_flags[2] = data; verboselog("maincpu", 0, "tilemap_flags[2] = %04x\n", data); break;
1688      case 0x144/2: m_tilemap_scrollx[2] = data; verboselog("maincpu", 0, "tilemap_scrollx[2] = %04x\n", data); break;
1689      case 0x146/2: m_tilemap_scrolly[2] = data; verboselog("maincpu", 0, "tilemap_scrolly[2] = %04x\n", data); break;
1690      case 0x148/2: m_tilemap_base_addr[2] = (data) << 1; verboselog("maincpu", 0, "tilemap_base_addr[2] = %05x\n", data << 2); break;
1691      case 0x14a/2: m_tilemap_mode[2] = data; verboselog("maincpu", 0, "tilemap_mode[2] = %04x\n", data); break;
16901692
16911693      /* ROZ */
1692      case 0x180/2: m_roz_mode = data; verboselog("maincpu", machine(), 3, "roz_mode = %04x\n", data); break;
1693      case 0x184/2: m_roz_scrollx = (data << 16) | (m_roz_scrollx & 0xffff); m_roz_changed |= 1; verboselog("maincpu", machine(), 3, "roz_scrollx = %08x\n", m_roz_scrollx); break;
1694      case 0x186/2: m_roz_scrollx = (data) | (m_roz_scrollx & 0xffff0000); m_roz_changed |= 1; verboselog("maincpu", machine(), 3, "roz_scrollx = %08x\n", m_roz_scrollx); break;
1695      case 0x188/2: m_roz_scrolly = (data << 16) | (m_roz_scrolly & 0xffff); m_roz_changed |= 2; verboselog("maincpu", machine(), 3, "roz_scrolly = %08x\n", m_roz_scrolly); break;
1696      case 0x18a/2: m_roz_scrolly = (data) | (m_roz_scrolly & 0xffff0000); m_roz_changed |= 2; verboselog("maincpu", machine(), 3, "roz_scrolly = %08x\n", m_roz_scrolly); break;
1697      case 0x18c/2: m_roz_coeffa = data; verboselog("maincpu", machine(), 3, "roz_coeffa = %04x\n", data); break;
1698      case 0x18e/2: m_roz_coeffb = data; verboselog("maincpu", machine(), 3, "roz_coeffb = %04x\n", data); break;
1699      case 0x190/2: m_roz_coeffc = data; verboselog("maincpu", machine(), 3, "roz_coeffc = %04x\n", data); break;
1700      case 0x192/2: m_roz_coeffd = data; verboselog("maincpu", machine(), 3, "roz_coeffd = %04x\n", data); break;
1701      case 0x194/2: m_roz_base_addr = (data) << 1; verboselog("maincpu", machine(), 3, "roz_base_addr = %05x\n", data << 2); break;
1702      case 0x196/2: m_roz_tile_bank = data; verboselog("maincpu", machine(), 3, "roz_tile_bank = %04x\n", data); break; //tile bank
1703      case 0x198/2: m_roz_unk_base0 = data << 2; verboselog("maincpu", machine(), 3, "roz_unk_base0 = %05x\n", data << 2); break;
1704      case 0x19a/2: m_roz_unk_base1 = data << 2; verboselog("maincpu", machine(), 3, "roz_unk_base1 = %05x\n", data << 2); break;
1705      case 0x19e/2: m_roz_unk_base2 = data << 2; verboselog("maincpu", machine(), 3, "roz_unk_base2 = %05x\n", data << 2); break;
1694      case 0x180/2: m_roz_mode = data; verboselog("maincpu", 3, "roz_mode = %04x\n", data); break;
1695      case 0x184/2: m_roz_scrollx = (data << 16) | (m_roz_scrollx & 0xffff); m_roz_changed |= 1; verboselog("maincpu", 3, "roz_scrollx = %08x\n", m_roz_scrollx); break;
1696      case 0x186/2: m_roz_scrollx = (data) | (m_roz_scrollx & 0xffff0000); m_roz_changed |= 1; verboselog("maincpu", 3, "roz_scrollx = %08x\n", m_roz_scrollx); break;
1697      case 0x188/2: m_roz_scrolly = (data << 16) | (m_roz_scrolly & 0xffff); m_roz_changed |= 2; verboselog("maincpu", 3, "roz_scrolly = %08x\n", m_roz_scrolly); break;
1698      case 0x18a/2: m_roz_scrolly = (data) | (m_roz_scrolly & 0xffff0000); m_roz_changed |= 2; verboselog("maincpu", 3, "roz_scrolly = %08x\n", m_roz_scrolly); break;
1699      case 0x18c/2: m_roz_coeffa = data; verboselog("maincpu", 3, "roz_coeffa = %04x\n", data); break;
1700      case 0x18e/2: m_roz_coeffb = data; verboselog("maincpu", 3, "roz_coeffb = %04x\n", data); break;
1701      case 0x190/2: m_roz_coeffc = data; verboselog("maincpu", 3, "roz_coeffc = %04x\n", data); break;
1702      case 0x192/2: m_roz_coeffd = data; verboselog("maincpu", 3, "roz_coeffd = %04x\n", data); break;
1703      case 0x194/2: m_roz_base_addr = (data) << 1; verboselog("maincpu", 3, "roz_base_addr = %05x\n", data << 2); break;
1704      case 0x196/2: m_roz_tile_bank = data; verboselog("maincpu", 3, "roz_tile_bank = %04x\n", data); break; //tile bank
1705      case 0x198/2: m_roz_unk_base0 = data << 2; verboselog("maincpu", 3, "roz_unk_base0 = %05x\n", data << 2); break;
1706      case 0x19a/2: m_roz_unk_base1 = data << 2; verboselog("maincpu", 3, "roz_unk_base1 = %05x\n", data << 2); break;
1707      case 0x19e/2: m_roz_unk_base2 = data << 2; verboselog("maincpu", 3, "roz_unk_base2 = %05x\n", data << 2); break;
17061708
1707      case 0x1d0/2: m_unk_1d0 = data; verboselog("maincpu", machine(), 3, "unk_1d0 = %04x\n", data); break;
1709      case 0x1d0/2: m_unk_1d0 = data; verboselog("maincpu", 3, "unk_1d0 = %04x\n", data); break;
17081710
17091711
17101712
r21160r21161
17171719            m_maincpu->set_input_line(7, CLEAR_LINE);
17181720         }
17191721#endif
1720         verboselog("maincpu", machine(), 3, "irq_mask = %04x\n", data);
1722         verboselog("maincpu", 3, "irq_mask = %04x\n", data);
17211723         break;
17221724      default:
1723         verboselog("maincpu", machine(), 0, "supracan_video_w: Unknown register: %08x = %04x & %04x\n", 0xf00000 + (offset << 1), data, mem_mask);
1725         verboselog("maincpu", 0, "supracan_video_w: Unknown register: %08x = %04x & %04x\n", 0xf00000 + (offset << 1), data, mem_mask);
17241726         break;
17251727   }
17261728   m_video_regs[offset] = data;
trunk/src/mess/drivers/hp49gp.c
r21160r21161
1111
1212#define VERBOSE_LEVEL ( 0 )
1313
14INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...)
15{
16   if (VERBOSE_LEVEL >= n_level)
17   {
18      va_list v;
19      char buf[32768];
20      va_start( v, s_fmt);
21      vsprintf( buf, s_fmt, v);
22      va_end( v);
23      logerror( "%s: %s", machine.describe_context( ), buf);
24   }
25}
26
2714struct lcd_spi_t
2815{
2916   int l1;
r21160r21161
4734   virtual void machine_start();
4835   virtual void machine_reset();
4936   DECLARE_INPUT_CHANGED_MEMBER(port_changed);
37   inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ...);
38   void lcd_spi_reset( );
39   void lcd_spi_init( );
40   void lcd_spi_line_w( int line, int data);
41   int lcd_spi_line_r( int line);
5042};
5143
5244/***************************************************************************
r21160r21161
6254   LCD_SPI_LINE_3
6355};
6456
65static void lcd_spi_reset( running_machine &machine)
57inline void ATTR_PRINTF(3,4) hp49gp_state::verboselog( int n_level, const char *s_fmt, ...)
6658{
67   hp49gp_state *hp49gp = machine.driver_data<hp49gp_state>();
68   verboselog( machine, 5, "lcd_spi_reset\n");
69   hp49gp->m_lcd_spi.l1 = 0;
70   hp49gp->m_lcd_spi.data = 0;
71   hp49gp->m_lcd_spi.l3 = 0;
59   if (VERBOSE_LEVEL >= n_level)
60   {
61      va_list v;
62      char buf[32768];
63      va_start( v, s_fmt);
64      vsprintf( buf, s_fmt, v);
65      va_end( v);
66      logerror( "%s: %s", machine().describe_context( ), buf);
67   }
7268}
7369
74static void lcd_spi_init( running_machine &machine)
70void hp49gp_state::lcd_spi_reset( )
7571{
76   verboselog( machine, 5, "lcd_spi_init\n");
77   lcd_spi_reset( machine);
72   verboselog( 5, "lcd_spi_reset\n");
73   m_lcd_spi.l1 = 0;
74   m_lcd_spi.data = 0;
75   m_lcd_spi.l3 = 0;
7876}
7977
80static void lcd_spi_line_w( running_machine &machine, int line, int data)
78void hp49gp_state::lcd_spi_init( )
8179{
82   hp49gp_state *hp49gp = machine.driver_data<hp49gp_state>();
80   verboselog( 5, "lcd_spi_init\n");
81   lcd_spi_reset();
82}
83
84void hp49gp_state::lcd_spi_line_w( int line, int data)
85{
8386   switch (line)
8487   {
8588      case LCD_SPI_LINE_1 :
8689      {
87         if (data != hp49gp->m_lcd_spi.l1)
90         if (data != m_lcd_spi.l1)
8891         {
8992            if (data == 0)
9093            {
91               hp49gp->m_lcd_spi.shift = 0;
92               hp49gp->m_lcd_spi.bits = 0;
94               m_lcd_spi.shift = 0;
95               m_lcd_spi.bits = 0;
9396            }
94            verboselog( machine, 5, "LCD_SPI_LINE_1 <- %d\n", data);
95            hp49gp->m_lcd_spi.l1 = data;
97            verboselog( 5, "LCD_SPI_LINE_1 <- %d\n", data);
98            m_lcd_spi.l1 = data;
9699         }
97100      }
98101      break;
99102      case LCD_SPI_LINE_DATA :
100103      {
101         if (data != hp49gp->m_lcd_spi.data)
104         if (data != m_lcd_spi.data)
102105         {
103            verboselog( machine, 5, "LCD_SPI_LINE_DATA <- %d\n", data);
104            hp49gp->m_lcd_spi.data = data;
106            verboselog( 5, "LCD_SPI_LINE_DATA <- %d\n", data);
107            m_lcd_spi.data = data;
105108         }
106109      }
107110      break;
108111      case LCD_SPI_LINE_3 :
109112      {
110         if (data != hp49gp->m_lcd_spi.l3)
113         if (data != m_lcd_spi.l3)
111114         {
112            if ((data != 0) && (hp49gp->m_lcd_spi.l1 == 0))
115            if ((data != 0) && (m_lcd_spi.l1 == 0))
113116            {
114               verboselog( machine, 5, "LCD SPI write bit %d\n", hp49gp->m_lcd_spi.data ? 1 : 0);
115               if (hp49gp->m_lcd_spi.bits < 8)
117               verboselog( 5, "LCD SPI write bit %d\n", m_lcd_spi.data ? 1 : 0);
118               if (m_lcd_spi.bits < 8)
116119               {
117                  hp49gp->m_lcd_spi.shift = (hp49gp->m_lcd_spi.shift << 1) | (hp49gp->m_lcd_spi.data ? 1 : 0);
120                  m_lcd_spi.shift = (m_lcd_spi.shift << 1) | (m_lcd_spi.data ? 1 : 0);
118121               }
119               hp49gp->m_lcd_spi.bits++;
120               if (hp49gp->m_lcd_spi.bits == 8)
122               m_lcd_spi.bits++;
123               if (m_lcd_spi.bits == 8)
121124               {
122                  verboselog( machine, 5, "LCD SPI write byte %02X\n", hp49gp->m_lcd_spi.shift);
125                  verboselog( 5, "LCD SPI write byte %02X\n", m_lcd_spi.shift);
123126               }
124               else if (hp49gp->m_lcd_spi.bits == 9)
127               else if (m_lcd_spi.bits == 9)
125128               {
126                  verboselog( machine, 5, "LCD SPI write ack %d\n", (hp49gp->m_lcd_spi.data ? 1 : 0));
129                  verboselog( 5, "LCD SPI write ack %d\n", (m_lcd_spi.data ? 1 : 0));
127130               }
128131            }
129            verboselog( machine, 5, "LCD_SPI_LINE_3 <- %d\n", data);
130            hp49gp->m_lcd_spi.l3 = data;
132            verboselog( 5, "LCD_SPI_LINE_3 <- %d\n", data);
133            m_lcd_spi.l3 = data;
131134         }
132135      }
133136      break;
134137   }
135138}
136139
137static int lcd_spi_line_r( running_machine &machine, int line)
140int hp49gp_state::lcd_spi_line_r( int line)
138141{
139   hp49gp_state *hp49gp = machine.driver_data<hp49gp_state>();
140142   switch (line)
141143   {
142144      case LCD_SPI_LINE_1 :
143145      {
144         verboselog( machine, 7, "LCD_SPI_LINE_1 -> %d\n", hp49gp->m_lcd_spi.l1);
145         return hp49gp->m_lcd_spi.l1;
146         verboselog( 7, "LCD_SPI_LINE_1 -> %d\n", m_lcd_spi.l1);
147         return m_lcd_spi.l1;
146148      }
147149      break;
148150      case LCD_SPI_LINE_DATA :
149151      {
150         verboselog( machine, 7, "LCD_SPI_LINE_DATA -> %d\n", hp49gp->m_lcd_spi.data);
151         return hp49gp->m_lcd_spi.data;
152         verboselog( 7, "LCD_SPI_LINE_DATA -> %d\n", m_lcd_spi.data);
153         return m_lcd_spi.data;
152154      }
153155      break;
154156      case LCD_SPI_LINE_3 :
155157      {
156         verboselog( machine, 7, "LCD_SPI_LINE_3 -> %d\n", hp49gp->m_lcd_spi.l3);
157         return hp49gp->m_lcd_spi.l3;
158         verboselog( 7, "LCD_SPI_LINE_3 -> %d\n", m_lcd_spi.l3);
159         return m_lcd_spi.l3;
158160      }
159161      break;
160162   }
r21160r21161
178180      {
179181         data = data | 0x0008;
180182         data = data & ~0x3200;
181         data |= (lcd_spi_line_r( device->machine(), LCD_SPI_LINE_1) ? 1 : 0) << 9;
182         data |= (lcd_spi_line_r( device->machine(), LCD_SPI_LINE_DATA) ? 1 : 0) << 12;
183         data |= (lcd_spi_line_r( device->machine(), LCD_SPI_LINE_3) ? 1 : 0) << 13;
183         data |= (hp49gp->lcd_spi_line_r( LCD_SPI_LINE_1) ? 1 : 0) << 9;
184         data |= (hp49gp->lcd_spi_line_r( LCD_SPI_LINE_DATA) ? 1 : 0) << 12;
185         data |= (hp49gp->lcd_spi_line_r( LCD_SPI_LINE_3) ? 1 : 0) << 13;
184186      }
185187      break;
186188      case S3C2410_GPIO_PORT_E :
r21160r21161
222224   {
223225      case S3C2410_GPIO_PORT_D :
224226      {
225         lcd_spi_line_w( device->machine(), LCD_SPI_LINE_1, BIT( data, 9) ? 1 : 0);
226         lcd_spi_line_w( device->machine(), LCD_SPI_LINE_DATA, BIT( data, 12) ? 1 : 0);
227         lcd_spi_line_w( device->machine(), LCD_SPI_LINE_3, BIT( data, 13) ? 1 : 0);
227         hp49gp->lcd_spi_line_w( LCD_SPI_LINE_1, BIT( data, 9) ? 1 : 0);
228         hp49gp->lcd_spi_line_w( LCD_SPI_LINE_DATA, BIT( data, 12) ? 1 : 0);
229         hp49gp->lcd_spi_line_w( LCD_SPI_LINE_3, BIT( data, 13) ? 1 : 0);
228230      }
229231      break;
230232   }
r21160r21161
269271{
270272   UINT8 *rom = (UINT8 *)machine().root_device().memregion( "maincpu")->base();
271273   memcpy( m_steppingstone, rom, 1024);
272   lcd_spi_init( machine());
274   lcd_spi_init();
273275}
274276
275277static S3C2410_INTERFACE( hp49gp_s3c2410_intf )
trunk/src/mess/drivers/ip22.c
r21160r21161
143143   required_device<device_t> m_lpt0;
144144   required_device<pit8254_device> m_pit;
145145   required_device<dac_device> m_dac;
146   inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... );
147   void int3_raise_local0_irq(UINT8 source_mask);
148   void int3_lower_local0_irq(UINT8 source_mask);
149   void int3_raise_local1_irq(UINT8 source_mask);
150   void int3_lower_local1_irq(UINT8 source_mask);
151   void dump_chain(address_space &space, UINT32 ch_base);
152   void rtc_update();
146153};
147154
148155
149156#define VERBOSE_LEVEL ( 0 )
150157
151158
152INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ... )
159inline void ATTR_PRINTF(3,4) ip22_state::verboselog(int n_level, const char *s_fmt, ... )
153160{
154161   if( VERBOSE_LEVEL >= n_level )
155162   {
r21160r21161
158165      va_start( v, s_fmt );
159166      vsprintf( buf, s_fmt, v );
160167      va_end( v );
161      logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf);
168      logerror("%08x: %s", machine().device("maincpu")->safe_pc(), buf);
162169   }
163170}
164171
r21160r21161
209216#define INT3_LOCAL1_RETRACE (0x80)
210217
211218// raise a local0 interrupt
212static void int3_raise_local0_irq(running_machine &machine, UINT8 source_mask)
219void ip22_state::int3_raise_local0_irq(UINT8 source_mask)
213220{
214   ip22_state *state = machine.driver_data<ip22_state>();
215221   // signal the interrupt is pending
216   state->m_int3_regs[0] |= source_mask;
222   m_int3_regs[0] |= source_mask;
217223
218224   // if it's not masked, also assert it now at the CPU
219   if (state->m_int3_regs[1] & source_mask)
220      state->m_maincpu->set_input_line(MIPS3_IRQ0, ASSERT_LINE);
225   if (m_int3_regs[1] & source_mask)
226      m_maincpu->set_input_line(MIPS3_IRQ0, ASSERT_LINE);
221227}
222228
223229// lower a local0 interrupt
224static void int3_lower_local0_irq(ip22_state *state, UINT8 source_mask)
230void ip22_state::int3_lower_local0_irq(UINT8 source_mask)
225231{
226   state->m_int3_regs[0] &= ~source_mask;
232   m_int3_regs[0] &= ~source_mask;
227233}
228234
229235#ifdef UNUSED_FUNCTION
230236// raise a local1 interrupt
231static void int3_raise_local1_irq(running_machine &machine, UINT8 source_mask)
237void ip22_state::int3_raise_local1_irq(UINT8 source_mask)
232238{
233   ip22_state *state = machine.driver_data<ip22_state>();
234239   // signal the interrupt is pending
235   state->m_int3_regs[2] |= source_mask;
240   m_int3_regs[2] |= source_mask;
236241
237242   // if it's not masked, also assert it now at the CPU
238   if (state->m_int3_regs[2] & source_mask)
239      state->m_maincpu->set_input_line(MIPS3_IRQ1, ASSERT_LINE);
243   if (m_int3_regs[2] & source_mask)
244      m_maincpu->set_input_line(MIPS3_IRQ1, ASSERT_LINE);
240245}
241246
242247// lower a local1 interrupt
243static void int3_lower_local1_irq(UINT8 source_mask)
248void ip22_state::int3_lower_local1_irq(UINT8 source_mask)
244249{
245   ip22_state *state = machine.driver_data<ip22_state>();
246   state->m_int3_regs[2] &= ~source_mask;
250   m_int3_regs[2] &= ~source_mask;
247251}
248252#endif
249253
r21160r21161
254258   {
255259   case 0x004/4:
256260      ret8 = pc_lpt_control_r(m_lpt0, space, 0) ^ 0x0d;
257      //verboselog(( machine, 0, "Parallel Control Read: %02x\n", ret8 );
261      //verboselog(0, "Parallel Control Read: %02x\n", ret8 );
258262      return ret8;
259263   case 0x008/4:
260264      ret8 = pc_lpt_status_r(m_lpt0, space, 0) ^ 0x80;
261      //verboselog(( machine, 0, "Parallel Status Read: %02x\n", ret8 );
265      //verboselog(0, "Parallel Status Read: %02x\n", ret8 );
262266      return ret8;
263267   case 0x030/4:
264      //verboselog(( machine, 2, "Serial 1 Command Transfer Read, 0x1fbd9830: %02x\n", 0x04 );
268      //verboselog(2, "Serial 1 Command Transfer Read, 0x1fbd9830: %02x\n", 0x04 );
265269      switch(space.device().safe_pc())
266270      {
267271         case 0x9fc1d9e4:    // interpreter (ip244415)
r21160r21161
274278      }
275279      return 0x00000004;
276280   case 0x038/4:
277      //verboselog(( machine, 2, "Serial 2 Command Transfer Read, 0x1fbd9838: %02x\n", 0x04 );
281      //verboselog(2, "Serial 2 Command Transfer Read, 0x1fbd9838: %02x\n", 0x04 );
278282      return 0x00000004;
279283   case 0x40/4:
280284      return kbdc8042_8_r(space, 0);
r21160r21161
298302      return m_int3_regs[offset-0x80/4];
299303   case 0xb0/4:
300304      ret8 = pit8253_r(m_pit, space, 0);
301      //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
305      //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
302306      return ret8;
303307   case 0xb4/4:
304308      ret8 = pit8253_r(m_pit, space, 1);
305      //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
309      //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
306310      return ret8;
307311   case 0xb8/4:
308312      ret8 = pit8253_r(m_pit, space, 2);
309      //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
313      //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
310314      return ret8;
311315   case 0xbc/4:
312316      ret8 = pit8253_r(m_pit, space, 3);
313      //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
317      //verboselog(0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
314318      return ret8;
315319   default:
316      //verboselog(( machine, 0, "Unknown HPC PBUS6 Read: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), mem_mask );
320      //verboselog(0, "Unknown HPC PBUS6 Read: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), mem_mask );
317321      return 0;
318322   }
319323   return 0;
r21160r21161
326330   switch( offset )
327331   {
328332   case 0x004/4:
329      //verboselog(( machine, 0, "Parallel Control Write: %08x\n", data );
333      //verboselog(0, "Parallel Control Write: %08x\n", data );
330334      pc_lpt_control_w(m_lpt0, space, 0, data ^ 0x0d);
331335      //m_nIOC_ParCntl = data;
332336      break;
333337   case 0x030/4:
334338      if( ( data & 0x000000ff ) >= 0x20 )
335339      {
336         //verboselog(( machine, 2, "Serial 1 Command Transfer Write: %02x: %c\n", data & 0x000000ff, data & 0x000000ff );
340         //verboselog(2, "Serial 1 Command Transfer Write: %02x: %c\n", data & 0x000000ff, data & 0x000000ff );
337341      }
338342      else
339343      {
340         //verboselog(( machine, 2, "Serial 1 Command Transfer Write: %02x\n", data & 0x000000ff );
344         //verboselog(2, "Serial 1 Command Transfer Write: %02x\n", data & 0x000000ff );
341345      }
342346      cChar = data & 0x000000ff;
343347      if( cChar >= 0x20 || cChar == 0x0d || cChar == 0x0a )
r21160r21161
348352   case 0x034/4:
349353      if( ( data & 0x000000ff ) >= 0x20 )
350354      {
351         //verboselog(( machine, 2, "Serial 1 Data Transfer Write: %02x: %c\n", data & 0x000000ff, data & 0x000000ff );
355         //verboselog(2, "Serial 1 Data Transfer Write: %02x: %c\n", data & 0x000000ff, data & 0x000000ff );
352356      }
353357      else
354358      {
355         //verboselog(( machine, 2, "Serial 1 Data Transfer Write: %02x\n", data & 0x000000ff );
359         //verboselog(2, "Serial 1 Data Transfer Write: %02x\n", data & 0x000000ff );
356360      }
357361      cChar = data & 0x000000ff;
358362      if( cChar >= 0x20 || cChar == 0x0d || cChar == 0x0a )
r21160r21161
393397
394398      break;
395399   case 0xb0/4:
396      //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Write: 0x%08x (%08x)\n", data, mem_mask );
400      //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 0 Register Write: 0x%08x (%08x)\n", data, mem_mask );
397401      pit8253_w(m_pit, space, 0, data & 0x000000ff);
398402      return;
399403   case 0xb4/4:
400      //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Write: 0x%08x (%08x)\n", data, mem_mask );
404      //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 1 Register Write: 0x%08x (%08x)\n", data, mem_mask );
401405      pit8253_w(m_pit, space, 1, data & 0x000000ff);
402406      return;
403407   case 0xb8/4:
404      //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Write: 0x%08x (%08x)\n", data, mem_mask );
408      //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 2 Register Write: 0x%08x (%08x)\n", data, mem_mask );
405409      pit8253_w(m_pit, space, 2, data & 0x000000ff);
406410      return;
407411   case 0xbc/4:
408      //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Write: 0x%08x (%08x)\n", data, mem_mask );
412      //verboselog(0, "HPC PBUS6 IOC4 Timer Control Word Register Write: 0x%08x (%08x)\n", data, mem_mask );
409413      pit8253_w(m_pit, space, 3, data & 0x000000ff);
410414      return;
411415   default:
412      //verboselog(( machine, 0, "Unknown HPC PBUS6 Write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), data, mem_mask );
416      //verboselog(0, "Unknown HPC PBUS6 Write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), data, mem_mask );
413417      break;
414418   }
415419}
r21160r21161
565569   }
566570}
567571
568#define RTC_SECONDS state->m_RTC.nRegs[0x00]
569#define RTC_SECONDS_A   state->m_RTC.nRegs[0x01]
570#define RTC_MINUTES state->m_RTC.nRegs[0x02]
571#define RTC_MINUTES_A   state->m_RTC.nRegs[0x03]
572#define RTC_HOURS   state->m_RTC.nRegs[0x04]
573#define RTC_HOURS_A state->m_RTC.nRegs[0x05]
574#define RTC_DAYOFWEEK   state->m_RTC.nRegs[0x06]
575#define RTC_DAYOFMONTH  state->m_RTC.nRegs[0x07]
576#define RTC_MONTH   state->m_RTC.nRegs[0x08]
577#define RTC_YEAR    state->m_RTC.nRegs[0x09]
578#define RTC_REGISTERA   state->m_RTC.nRegs[0x0a]
579#define RTC_REGISTERB   state->m_RTC.nRegs[0x0b]
580#define RTC_REGISTERC   state->m_RTC.nRegs[0x0c]
581#define RTC_REGISTERD   state->m_RTC.nRegs[0x0d]
582#define RTC_MODELBYTE   state->m_RTC.nRegs[0x40]
583#define RTC_SERBYTE0    state->m_RTC.nRegs[0x41]
584#define RTC_SERBYTE1    state->m_RTC.nRegs[0x42]
585#define RTC_SERBYTE2    state->m_RTC.nRegs[0x43]
586#define RTC_SERBYTE3    state->m_RTC.nRegs[0x44]
587#define RTC_SERBYTE4    state->m_RTC.nRegs[0x45]
588#define RTC_SERBYTE5    state->m_RTC.nRegs[0x46]
589#define RTC_CRC     state->m_RTC.nRegs[0x47]
590#define RTC_CENTURY state->m_RTC.nRegs[0x48]
591#define RTC_DAYOFMONTH_A state->m_RTC.nRegs[0x49]
592#define RTC_EXTCTRL0    state->m_RTC.nRegs[0x4a]
593#define RTC_EXTCTRL1    state->m_RTC.nRegs[0x4b]
594#define RTC_RTCADDR2    state->m_RTC.nRegs[0x4e]
595#define RTC_RTCADDR3    state->m_RTC.nRegs[0x4f]
596#define RTC_RAMLSB  state->m_RTC.nRegs[0x50]
597#define RTC_RAMMSB  state->m_RTC.nRegs[0x51]
598#define RTC_WRITECNT    state->m_RTC.nRegs[0x5e]
572#define RTC_SECONDS m_RTC.nRegs[0x00]
573#define RTC_SECONDS_A   m_RTC.nRegs[0x01]
574#define RTC_MINUTES m_RTC.nRegs[0x02]
575#define RTC_MINUTES_A   m_RTC.nRegs[0x03]
576#define RTC_HOURS   m_RTC.nRegs[0x04]
577#define RTC_HOURS_A m_RTC.nRegs[0x05]
578#define RTC_DAYOFWEEK   m_RTC.nRegs[0x06]
579#define RTC_DAYOFMONTH  m_RTC.nRegs[0x07]
580#define RTC_MONTH   m_RTC.nRegs[0x08]
581#define RTC_YEAR    m_RTC.nRegs[0x09]
582#define RTC_REGISTERA   m_RTC.nRegs[0x0a]
583#define RTC_REGISTERB   m_RTC.nRegs[0x0b]
584#define RTC_REGISTERC   m_RTC.nRegs[0x0c]
585#define RTC_REGISTERD   m_RTC.nRegs[0x0d]
586#define RTC_MODELBYTE   m_RTC.nRegs[0x40]
587#define RTC_SERBYTE0    m_RTC.nRegs[0x41]
588#define RTC_SERBYTE1    m_RTC.nRegs[0x42]
589#define RTC_SERBYTE2    m_RTC.nRegs[0x43]
590#define RTC_SERBYTE3    m_RTC.nRegs[0x44]
591#define RTC_SERBYTE4    m_RTC.nRegs[0x45]
592#define RTC_SERBYTE5    m_RTC.nRegs[0x46]
593#define RTC_CRC     m_RTC.nRegs[0x47]
594#define RTC_CENTURY m_RTC.nRegs[0x48]
595#define RTC_DAYOFMONTH_A m_RTC.nRegs[0x49]
596#define RTC_EXTCTRL0    m_RTC.nRegs[0x4a]
597#define RTC_EXTCTRL1    m_RTC.nRegs[0x4b]
598#define RTC_RTCADDR2    m_RTC.nRegs[0x4e]
599#define RTC_RTCADDR3    m_RTC.nRegs[0x4f]
600#define RTC_RAMLSB  m_RTC.nRegs[0x50]
601#define RTC_RAMMSB  m_RTC.nRegs[0x51]
602#define RTC_WRITECNT    m_RTC.nRegs[0x5e]
599603
600604READ32_MEMBER(ip22_state::rtc_r)
601605{
602   ip22_state *state = machine().driver_data<ip22_state>();
603
604606   if( offset <= 0x0d )
605607   {
606608      switch( offset )
r21160r21161
729731
730732WRITE32_MEMBER(ip22_state::rtc_w)
731733{
732   ip22_state *state = machine().driver_data<ip22_state>();
733734   RTC_WRITECNT++;
734735
735736//  mame_printf_info("RTC_W: offset %x => %x (PC=%x)\n", data, offset, activecpu_get_pc());
r21160r21161
11961197
11971198void ip22_state::machine_reset()
11981199{
1199   ip22_state *state = machine().driver_data<ip22_state>();
12001200   m_HPC3.nenetr_nbdp = 0x80000000;
12011201   m_HPC3.nenetr_cbp = 0x80000000;
12021202   m_nIntCounter = 0;
r21160r21161
12101210
12111211   m_PBUS_DMA.nActive = 0;
12121212
1213   mips3drc_set_options(state->m_maincpu, MIPS3DRC_COMPATIBLE_OPTIONS | MIPS3DRC_CHECK_OVERFLOWS);
1213   mips3drc_set_options(m_maincpu, MIPS3DRC_COMPATIBLE_OPTIONS | MIPS3DRC_CHECK_OVERFLOWS);
12141214}
12151215
1216static void dump_chain(address_space &space, UINT32 ch_base)
1216void ip22_state::dump_chain(address_space &space, UINT32 ch_base)
12171217{
12181218   printf("node: %08x %08x %08x (len = %x)\n", space.read_dword(ch_base), space.read_dword(ch_base+4), space.read_dword(ch_base+8), space.read_dword(ch_base+4) & 0x3fff);
12191219
r21160r21161
12601260
12611261            printf("DMA to device: %d words @ %x\n", words, wptr);
12621262
1263            dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor);
1263            drvstate->dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor);
12641264
12651265            if (words <= (512/4))
12661266            {
r21160r21161
14011401
14021402//              mame_printf_info("DMA from device: %d words @ %x\n", words, wptr);
14031403
1404            dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor);
1404            drvstate->dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor);
14051405
14061406            if (words <= (1024/4))
14071407            {
r21160r21161
14631463      drvstate->m_HPC3.nSCSI0DMACtrl &= ~HPC3_DMACTRL_ENABLE;
14641464
14651465      // set the interrupt
1466      int3_raise_local0_irq(machine, INT3_LOCAL0_SCSI0);
1466      drvstate->int3_raise_local0_irq(INT3_LOCAL0_SCSI0);
14671467   }
14681468   else
14691469   {
1470      int3_lower_local0_irq(drvstate, INT3_LOCAL0_SCSI0);
1470      drvstate->int3_lower_local0_irq(INT3_LOCAL0_SCSI0);
14711471   }
14721472}
14731473
r21160r21161
15141514   PORT_INCLUDE( at_keyboard )     /* IN4 - IN11 */
15151515INPUT_PORTS_END
15161516
1517static void rtc_update(ip22_state *state)
1517void ip22_state::rtc_update()
15181518{
15191519   RTC_SECONDS++;
15201520
r21160r21161
15841584//  if( m_nIntCounter == 60 )
15851585   {
15861586      m_nIntCounter = 0;
1587      rtc_update(this);
1587      rtc_update();
15881588   }
15891589}
15901590
trunk/src/mess/drivers/atari400.c
r21160r21161
341341   void a1200xl_mmu(UINT8 new_mmu);
342342   void xegs_mmu(UINT8 new_mmu);
343343   void a800_setup_mappers(int type);
344   int a800_get_pcb_id(const char *pcb);
345   int a800_get_type(device_image_interface &image);
346   int a800_check_cart_type(device_image_interface &image);
344347};
345348
346349/**************************************************************
r21160r21161
11801183   {"N/A", A800_UNKNOWN}
11811184};
11821185
1183static int a800_get_pcb_id(const char *pcb)
1186int a400_state::a800_get_pcb_id(const char *pcb)
11841187{
11851188   int i;
11861189
r21160r21161
13741377}
13751378
13761379
1377static int a800_get_type(device_image_interface &image)
1380int a400_state::a800_get_type(device_image_interface &image)
13781381{
13791382   UINT8 header[16];
13801383   image.fread(header, 0x10);
r21160r21161
14391442}
14401443
14411444
1442static int a800_check_cart_type(device_image_interface &image)
1445int a400_state::a800_check_cart_type(device_image_interface &image)
14431446{
14441447   const char  *pcb_name;
14451448   int type = A800_UNKNOWN;
trunk/src/mess/drivers/palmz22.c
r21160r21161
7171
7272#define VERBOSE_LEVEL ( 0 )
7373
74INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...)
75{
76   if (VERBOSE_LEVEL >= n_level)
77   {
78      va_list v;
79      char buf[32768];
80      va_start( v, s_fmt);
81      vsprintf( buf, s_fmt, v);
82      va_end( v);
83      logerror( "%s: %s", machine.describe_context(), buf);
84   }
85}
86
8774class palmz22_state : public driver_device
8875{
8976public:
r21160r21161
10289   virtual void machine_start();
10390   virtual void machine_reset();
10491   DECLARE_INPUT_CHANGED_MEMBER(palmz22_input_changed);
92   inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ...);
10593};
10694
95
96inline void ATTR_PRINTF(3,4) palmz22_state::verboselog( int n_level, const char *s_fmt, ...)
97{
98   if (VERBOSE_LEVEL >= n_level)
99   {
100      va_list v;
101      char buf[32768];
102      va_start( v, s_fmt);
103      vsprintf( buf, s_fmt, v);
104      va_end( v);
105      logerror( "%s: %s", machine().describe_context(), buf);
106   }
107}
108
107109/***************************************************************************
108110    MACHINE HARDWARE
109111***************************************************************************/
r21160r21161
113115static WRITE8_DEVICE_HANDLER( s3c2410_nand_command_w )
114116{
115117   palmz22_state *state = space.machine().driver_data<palmz22_state>();
116   verboselog( space.machine(), 9, "s3c2410_nand_command_w %02X\n", data);
118   state->verboselog(9, "s3c2410_nand_command_w %02X\n", data);
117119   state->m_nand->command_w(data);
118120}
119121
120122static WRITE8_DEVICE_HANDLER( s3c2410_nand_address_w )
121123{
122124   palmz22_state *state = space.machine().driver_data<palmz22_state>();
123   verboselog( space.machine(), 9, "s3c2410_nand_address_w %02X\n", data);
125   state->verboselog(9, "s3c2410_nand_address_w %02X\n", data);
124126   state->m_nand->address_w(data);
125127}
126128
r21160r21161
128130{
129131   palmz22_state *state = space.machine().driver_data<palmz22_state>();
130132   UINT8 data = state->m_nand->data_r();
131   verboselog( space.machine(), 9, "s3c2410_nand_data_r %02X\n", data);
133   state->verboselog(9, "s3c2410_nand_data_r %02X\n", data);
132134   return data;
133135}
134136
135137static WRITE8_DEVICE_HANDLER( s3c2410_nand_data_w )
136138{
137139   palmz22_state *state = space.machine().driver_data<palmz22_state>();
138   verboselog( space.machine(), 9, "s3c2410_nand_data_w %02X\n", data);
140   state->verboselog(9, "s3c2410_nand_data_w %02X\n", data);
139141   state->m_nand->data_w(data);
140142}
141143
r21160r21161
143145{
144146   palmz22_state *state = device->machine().driver_data<palmz22_state>();
145147   UINT8 data = state->m_nand->is_busy();
146   verboselog( device->machine(), 9, "s3c2410_nand_busy_r %02X\n", data);
148   state->verboselog(9, "s3c2410_nand_busy_r %02X\n", data);
147149   return data;
148150}
149151
r21160r21161
212214
213215static READ32_DEVICE_HANDLER( s3c2410_adc_data_r )
214216{
217   palmz22_state *state = device->machine().driver_data<palmz22_state>();
215218   UINT32 data = 0;
216219   switch (offset)
217220   {
r21160r21161
220223      case 2 + 0 : data = space.machine().root_device().ioport( "PENX")->read(); break;
221224      case 2 + 1 : data = 0x3FF - space.machine().root_device().ioport( "PENY")->read(); break;
222225   }
223   verboselog( space.machine(), 5,  "s3c2410_adc_data_r %08X\n", data);
226   state->verboselog(5,  "s3c2410_adc_data_r %08X\n", data);
224227   return data;
225228}
226229
trunk/src/mess/drivers/a2600.c
r21160r21161
153153   void install_banks(int count, unsigned init);
154154
155155   UINT8   *m_cart;
156   int detect_modeDC();
157   int detect_modef6();
158   int detect_mode3E();
159   int detect_modeSS();
160   int detect_modeFE();
161   int detect_modeE0();
162   int detect_modeCV();
163   int detect_modeFV();
164   int detect_modeJVP();
165   int detect_modeE7();
166   int detect_modeUA();
167   int detect_8K_mode3F();
168   int detect_32K_mode3F();
169   int detect_super_chip();
170   unsigned long detect_2600controllers();
156171};
157172
158173
159174
160#define CART machine.root_device().memregion("user1")->base()
161#define CART_MEMBER machine().root_device().memregion("user1")->base()
175#define CART machine().root_device().memregion("user1")->base()
162176
163177#define MASTER_CLOCK_NTSC   3579545
164178#define MASTER_CLOCK_PAL    3546894
r21160r21161
191205
192206static const UINT16 supported_screen_heights[4] = { 262, 312, 328, 342 };
193207
194static int detect_modeDC(running_machine &machine)
208int a2600_state::detect_modeDC()
195209{
196   a2600_state *state = machine.driver_data<a2600_state>();
197210   int i,numfound = 0;
198211   // signature is also in 'video reflex'.. maybe figure out that controller port someday...
199212   static const unsigned char signature[3] = { 0x8d, 0xf0, 0xff };
200   if (state->m_cart_size == 0x10000)
213   if (m_cart_size == 0x10000)
201214   {
202215      UINT8 *cart = CART;
203      for (i = 0; i < state->m_cart_size - sizeof signature; i++)
216      for (i = 0; i < m_cart_size - sizeof signature; i++)
204217      {
205218         if (!memcmp(&cart[i], signature,sizeof signature))
206219         {
r21160r21161
212225   return 0;
213226}
214227
215static int detect_modef6(running_machine &machine)
228int a2600_state::detect_modef6()
216229{
217   a2600_state *state = machine.driver_data<a2600_state>();
218230   int i, numfound = 0;
219231   static const unsigned char signature[3] = { 0x8d, 0xf6, 0xff };
220   if (state->m_cart_size == 0x4000)
232   if (m_cart_size == 0x4000)
221233   {
222234      UINT8 *cart = CART;
223      for (i = 0; i < state->m_cart_size - sizeof signature; i++)
235      for (i = 0; i < m_cart_size - sizeof signature; i++)
224236      {
225237         if (!memcmp(&cart[i], signature, sizeof signature))
226238         {
r21160r21161
232244   return 0;
233245}
234246
235static int detect_mode3E(running_machine &machine)
247int a2600_state::detect_mode3E()
236248{
237   a2600_state *state = machine.driver_data<a2600_state>();
238249   // this one is a little hacky.. looks for STY $3e, which is unique to
239250   // 'not boulderdash', but is the only example i have (cow)
240251   // Would have used STA $3e, but 'Alien' and 'Star Raiders' do that for unknown reasons
241252
242253   int i,numfound = 0;
243254   static const unsigned char signature[3] = { 0x84, 0x3e, 0x9d };
244   if (state->m_cart_size == 0x0800 || state->m_cart_size == 0x1000)
255   if (m_cart_size == 0x0800 || m_cart_size == 0x1000)
245256   {
246257      UINT8 *cart = CART;
247      for (i = 0; i < state->m_cart_size - sizeof signature; i++)
258      for (i = 0; i < m_cart_size - sizeof signature; i++)
248259      {
249260         if (!memcmp(&cart[i], signature,sizeof signature))
250261         {
r21160r21161
256267   return 0;
257268}
258269
259static int detect_modeSS(running_machine &machine)
270int a2600_state::detect_modeSS()
260271{
261   a2600_state *state = machine.driver_data<a2600_state>();
262272   int i,numfound = 0;
263273   static const unsigned char signature[5] = { 0xbd, 0xe5, 0xff, 0x95, 0x81 };
264   if (state->m_cart_size == 0x0800 || state->m_cart_size == 0x1000)
274   if (m_cart_size == 0x0800 || m_cart_size == 0x1000)
265275   {
266276      UINT8 *cart = CART;
267      for (i = 0; i < state->m_cart_size - sizeof signature; i++)
277      for (i = 0; i < m_cart_size - sizeof signature; i++)
268278      {
269279         if (!memcmp(&cart[i], signature,sizeof signature))
270280         {
r21160r21161
276286   return 0;
277287}
278288
279static int detect_modeFE(running_machine &machine)
289int a2600_state::detect_modeFE()
280290{
281   a2600_state *state = machine.driver_data<a2600_state>();
282291   int i,j,numfound = 0;
283292   static const unsigned char signatures[][5] =  {
284293                           { 0x20, 0x00, 0xd0, 0xc6, 0xc5 },
r21160r21161
286295                           { 0xd0, 0xfb, 0x20, 0x73, 0xfe },
287296                           { 0x20, 0x00, 0xf0, 0x84, 0xd6 }
288297   };
289   if (state->m_cart_size == 0x2000)
298   if (m_cart_size == 0x2000)
290299   {
291300      UINT8 *cart = CART;
292      for (i = 0; i < state->m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
301      for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
293302      {
294303         for (j = 0; j < (sizeof signatures/sizeof signatures[0]) && !numfound; j++)
295304         {
r21160r21161
304313   return 0;
305314}
306315
307static int detect_modeE0(running_machine &machine)
316int a2600_state::detect_modeE0()
308317{
309   a2600_state *state = machine.driver_data<a2600_state>();
310318   int i,j,numfound = 0;
311319   static const unsigned char signatures[][3] =  {
312320                           { 0x8d, 0xe0, 0x1f },
r21160r21161
316324                           { 0xad, 0xed, 0xff },
317325                           { 0xad, 0xf3, 0xbf }
318326   };
319   if (state->m_cart_size == 0x2000)
327   if (m_cart_size == 0x2000)
320328   {
321329      UINT8 *cart = CART;
322      for (i = 0; i < state->m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
330      for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
323331      {
324332         for (j = 0; j < (sizeof signatures/sizeof signatures[0]) && !numfound; j++)
325333         {
r21160r21161
334342   return 0;
335343}
336344
337static int detect_modeCV(running_machine &machine)
345int a2600_state::detect_modeCV()
338346{
339   a2600_state *state = machine.driver_data<a2600_state>();
340347   int i,j,numfound = 0;
341348   static const unsigned char signatures[][3] = {
342349                           { 0x9d, 0xff, 0xf3 },
343350                           { 0x99, 0x00, 0xf4 }
344351   };
345   if (state->m_cart_size == 0x0800 || state->m_cart_size == 0x1000)
352   if (m_cart_size == 0x0800 || m_cart_size == 0x1000)
346353   {
347354      UINT8 *cart = CART;
348      for (i = 0; i < state->m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
355      for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
349356      {
350357         for (j = 0; j < (sizeof signatures/sizeof signatures[0]) && !numfound; j++)
351358         {
r21160r21161
360367   return 0;
361368}
362369
363static int detect_modeFV(running_machine &machine)
370int a2600_state::detect_modeFV()
364371{
365   a2600_state *state = machine.driver_data<a2600_state>();
366372   int i,j,numfound = 0;
367373   static const unsigned char signatures[][3] = {
368374                           { 0x2c, 0xd0, 0xff }
369375   };
370   if (state->m_cart_size == 0x2000)
376   if (m_cart_size == 0x2000)
371377   {
372378      UINT8 *cart = CART;
373      for (i = 0; i < state->m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
379      for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
374380      {
375381         for (j = 0; j < (sizeof signatures/sizeof signatures[0]) && !numfound; j++)
376382         {
r21160r21161
380386            }
381387         }
382388      }
383      state->m_FVlocked = 0;
389      m_FVlocked = 0;
384390   }
385391   if (numfound) return 1;
386392   return 0;
387393}
388394
389static int detect_modeJVP(running_machine &machine)
395int a2600_state::detect_modeJVP()
390396{
391   a2600_state *state = machine.driver_data<a2600_state>();
392397   int i,j,numfound = 0;
393398   static const unsigned char signatures[][4] = {
394399                           { 0x2c, 0xc0, 0xef, 0x60 },
395400                           { 0x8d, 0xa0, 0x0f, 0xf0 }
396401   };
397   if (state->m_cart_size == 0x4000 || state->m_cart_size == 0x2000)
402   if (m_cart_size == 0x4000 || m_cart_size == 0x2000)
398403   {
399404      UINT8 *cart = CART;
400      for (i = 0; i < state->m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
405      for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
401406      {
402407         for (j = 0; j < (sizeof signatures/sizeof signatures[0]) && !numfound; j++)
403408         {
r21160r21161
412417   return 0;
413418}
414419
415static int detect_modeE7(running_machine &machine)
420int a2600_state::detect_modeE7()
416421{
417   a2600_state *state = machine.driver_data<a2600_state>();
418422   int i,j,numfound = 0;
419423   static const unsigned char signatures[][3] = {
420424                           { 0xad, 0xe5, 0xff },
421425                           { 0x8d, 0xe7, 0xff }
422426   };
423   if (state->m_cart_size == 0x2000 || state->m_cart_size == 0x4000)
427   if (m_cart_size == 0x2000 || m_cart_size == 0x4000)
424428   {
425429      UINT8 *cart = CART;
426      for (i = 0; i < state->m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
430      for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
427431      {
428432         for (j = 0; j < (sizeof signatures/sizeof signatures[0]) && !numfound; j++)
429433         {
r21160r21161
438442   return 0;
439443}
440444
441static int detect_modeUA(running_machine &machine)
445int a2600_state::detect_modeUA()
442446{
443   a2600_state *state = machine.driver_data<a2600_state>();
444447   int i,numfound = 0;
445448   static const unsigned char signature[3] = { 0x8d, 0x40, 0x02 };
446   if (state->m_cart_size == 0x2000)
449   if (m_cart_size == 0x2000)
447450   {
448451      UINT8 *cart = CART;
449      for (i = 0; i < state->m_cart_size - sizeof signature; i++)
452      for (i = 0; i < m_cart_size - sizeof signature; i++)
450453      {
451454         if (!memcmp(&cart[i], signature,sizeof signature))
452455         {
r21160r21161
458461   return 0;
459462}
460463
461static int detect_8K_mode3F(running_machine &machine)
464int a2600_state::detect_8K_mode3F()
462465{
463   a2600_state *state = machine.driver_data<a2600_state>();
464466   int i,numfound = 0;
465467   static const unsigned char signature1[4] = { 0xa9, 0x01, 0x85, 0x3f };
466468   static const unsigned char signature2[4] = { 0xa9, 0x02, 0x85, 0x3f };
467469   // have to look for two signatures because 'not boulderdash' gives false positive otherwise
468   if (state->m_cart_size == 0x2000)
470   if (m_cart_size == 0x2000)
469471   {
470472      UINT8 *cart = CART;
471      for (i = 0; i < state->m_cart_size - sizeof signature1; i++)
473      for (i = 0; i < m_cart_size - sizeof signature1; i++)
472474      {
473475         if (!memcmp(&cart[i], signature1,sizeof signature1))
474476         {
r21160r21161
484486   return 0;
485487}
486488
487static int detect_32K_mode3F(running_machine &machine)
489int a2600_state::detect_32K_mode3F()
488490{
489   a2600_state *state = machine.driver_data<a2600_state>();
490491   int i,numfound = 0;
491492   static const unsigned char signature[4] = { 0xa9, 0x0e, 0x85, 0x3f };
492   if (state->m_cart_size >= 0x8000)
493   if (m_cart_size >= 0x8000)
493494   {
494495      UINT8 *cart = CART;
495      for (i = 0; i < state->m_cart_size - sizeof signature; i++)
496      for (i = 0; i < m_cart_size - sizeof signature; i++)
496497      {
497498         if (!memcmp(&cart[i], signature,sizeof signature))
498499         {
r21160r21161
504505   return 0;
505506}
506507
507static int detect_super_chip(running_machine &machine)
508int a2600_state::detect_super_chip()
508509{
509   a2600_state *state = machine.driver_data<a2600_state>();
510510   int i,j;
511511   UINT8 *cart = CART;
512512   static const unsigned char signatures[][5] = {
r21160r21161
514514                           { 0xae, 0xf6, 0xff, 0x4c, 0x00 } // off the wall
515515   };
516516
517   if (state->m_cart_size == 0x4000)
517   if (m_cart_size == 0x4000)
518518   {
519      for (i = 0; i < state->m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
519      for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
520520      {
521521         for (j = 0; j < (sizeof signatures/sizeof signatures[0]); j++)
522522         {
r21160r21161
527527         }
528528      }
529529   }
530   for (i = 0x1000; i < state->m_cart_size; i += 0x1000)
530   for (i = 0x1000; i < m_cart_size; i += 0x1000)
531531   {
532532      if (memcmp(cart, cart + i, 0x100))
533533      {
r21160r21161
619619      }
620620   }
621621
622   if (!(m_cart_size == 0x4000 && detect_modef6(machine())))
622   if (!(m_cart_size == 0x4000 && detect_modef6()))
623623   {
624624      while (m_cart_size > 0x00800)
625625      {
r21160r21161
14581458   memset( m_riot_ram, 0x00, 0x80 );
14591459   m_current_reset_bank_counter = 0xFF;
14601460   m_dpc.oscillator = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2600_state::modeDPC_timer_callback),this));
1461   m_cart = CART_MEMBER;
1461   m_cart = CART;
14621462   m_modeSS_last_address = 0;
14631463}
14641464
14651465
14661466#ifdef UNUSED_FUNCTIONS
14671467// try to detect 2600 controller setup. returns 32bits with left/right controller info
1468static unsigned long detect_2600controllers(running_machine &machine)
1468unsigned a2600_state::long detect_2600controllers()
14691469{
1470   a2600_state *state = machine.driver_data<a2600_state>();
14711470#define JOYS 0x001
14721471#define PADD 0x002
14731472#define KEYP 0x004
r21160r21161
15131512   // it can be fixed here with a new signature (note that the Coleco Gemini has this setup also)
15141513   left = JOYS+PADD; right = JOYS+PADD;
15151514   // default for bad dumps and roms too large to have special controllers
1516   if ((state->m_cart_size > 0x4000) || (state->m_cart_size & 0x7ff)) return (left << 16) + right;
1515   if ((m_cart_size > 0x4000) || (m_cart_size & 0x7ff)) return (left << 16) + right;
15171516
15181517   cart = CART;
1519   for (i = 0; i < state->m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
1518   for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++)
15201519   {
15211520      for (j = 0; j < (sizeof signatures/sizeof signatures[0]); j++)
15221521      {
r21160r21161
15531552   m_current_reset_bank_counter++;
15541553
15551554   /* auto-detect bank mode */
1556   if (m_banking_mode == 0xff) if (detect_modeDC(machine())) m_banking_mode = modeDC;
1557   if (m_banking_mode == 0xff) if (detect_mode3E(machine())) m_banking_mode = mode3E;
1558   if (m_banking_mode == 0xff) if (detect_modeFE(machine())) m_banking_mode = modeFE;
1559   if (m_banking_mode == 0xff) if (detect_modeSS(machine())) m_banking_mode = modeSS;
1560   if (m_banking_mode == 0xff) if (detect_modeE0(machine())) m_banking_mode = modeE0;
1561   if (m_banking_mode == 0xff) if (detect_modeCV(machine())) m_banking_mode = modeCV;
1562   if (m_banking_mode == 0xff) if (detect_modeFV(machine())) m_banking_mode = modeFV;
1563   if (m_banking_mode == 0xff) if (detect_modeJVP(machine())) m_banking_mode = modeJVP;
1564   if (m_banking_mode == 0xff) if (detect_modeUA(machine())) m_banking_mode = modeUA;
1565   if (m_banking_mode == 0xff) if (detect_8K_mode3F(machine())) m_banking_mode = mode3F;
1566   if (m_banking_mode == 0xff) if (detect_32K_mode3F(machine())) m_banking_mode = mode3F;
1567   if (m_banking_mode == 0xff) if (detect_modeE7(machine())) m_banking_mode = modeE7;
1555   if (m_banking_mode == 0xff) if (detect_modeDC()) m_banking_mode = modeDC;
1556   if (m_banking_mode == 0xff) if (detect_mode3E()) m_banking_mode = mode3E;
1557   if (m_banking_mode == 0xff) if (detect_modeFE()) m_banking_mode = modeFE;
1558   if (m_banking_mode == 0xff) if (detect_modeSS()) m_banking_mode = modeSS;
1559   if (m_banking_mode == 0xff) if (detect_modeE0()) m_banking_mode = modeE0;
1560   if (m_banking_mode == 0xff) if (detect_modeCV()) m_banking_mode = modeCV;
1561   if (m_banking_mode == 0xff) if (detect_modeFV()) m_banking_mode = modeFV;
1562   if (m_banking_mode == 0xff) if (detect_modeJVP()) m_banking_mode = modeJVP;
1563   if (m_banking_mode == 0xff) if (detect_modeUA()) m_banking_mode = modeUA;
1564   if (m_banking_mode == 0xff) if (detect_8K_mode3F()) m_banking_mode = mode3F;
1565   if (m_banking_mode == 0xff) if (detect_32K_mode3F()) m_banking_mode = mode3F;
1566   if (m_banking_mode == 0xff) if (detect_modeE7()) m_banking_mode = modeE7;
15681567
15691568   if (m_banking_mode == 0xff)
15701569   {
r21160r21161
16071606
16081607   if (m_cart_size == 0x2000 || m_cart_size == 0x4000 || m_cart_size == 0x8000)
16091608   {
1610      chip = detect_super_chip(machine());
1609      chip = detect_super_chip();
16111610   }
16121611
16131612   /* Super chip games:
r21160r21161
16481647
16491648   case modeF8:
16501649      m_current_reset_bank_counter = 0;
1651      if (!memcmp(&CART_MEMBER[0x1ffc],snowwhite,sizeof(snowwhite)))
1650      if (!memcmp(&CART[0x1ffc],snowwhite,sizeof(snowwhite)))
16521651      {
16531652         install_banks(1, 0x0000);
16541653      }
r21160r21161
18091808   case modeSS:
18101809      space.install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(a2600_state::modeSS_r),this));
18111810      m_bank_base[1] = m_extra_RAM->base() + 2 * 0x800;
1812      m_bank_base[2] = CART_MEMBER;
1811      m_bank_base[2] = CART;
18131812      membank("bank1")->set_base(m_bank_base[1] );
18141813      membank("bank2")->set_base(m_bank_base[2] );
18151814      m_modeSS_write_enabled = 0;
r21160r21161
18421841      break;
18431842
18441843   case mode32in1:
1845      membank("bank1")->set_base(CART_MEMBER + m_current_reset_bank_counter * 0x800 );
1846      membank("bank2")->set_base(CART_MEMBER + m_current_reset_bank_counter * 0x800 );
1844      membank("bank1")->set_base(CART + m_current_reset_bank_counter * 0x800 );
1845      membank("bank2")->set_base(CART + m_current_reset_bank_counter * 0x800 );
18471846      break;
18481847
18491848   case modeJVP:
trunk/src/mess/drivers/sgi_ip2.c
r21160r21161
110110   UINT8 m_mbp;
111111   virtual void machine_start();
112112   virtual void machine_reset();
113   inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... );
113114};
114115
115116
r21160r21161
118119#define ENABLE_VERBOSE_LOG (0)
119120
120121#if ENABLE_VERBOSE_LOG
121INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
122inline void ATTR_PRINTF(3,4) sgi_ip2_state::verboselog( int n_level, const char *s_fmt, ... )
122123{
123124   if( VERBOSE_LEVEL >= n_level )
124125   {
r21160r21161
127128      va_start( v, s_fmt );
128129      vsprintf( buf, s_fmt, v );
129130      va_end( v );
130      logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf);
131      logerror("%08x: %s", machine().device("maincpu")->safe_pc(), buf);
131132   }
132133}
133134#else
r21160r21161
147148
148149READ8_MEMBER(sgi_ip2_state::sgi_ip2_m_but_r)
149150{
150   verboselog(machine(), 0, "sgi_ip2_m_but_r: %02x\n", m_mbut | BOARD_REV1);
151   verboselog(0, "sgi_ip2_m_but_r: %02x\n", m_mbut | BOARD_REV1);
151152   return m_mbut | BOARD_REV1;
152153}
153154
154155WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_m_but_w)
155156{
156   verboselog(machine(), 0, "sgi_ip2_m_but_w: %02x\n", data);
157   verboselog(0, "sgi_ip2_m_but_w: %02x\n", data);
157158   m_mbut = data;
158159}
159160
r21160r21161
165166
166167READ16_MEMBER(sgi_ip2_state::sgi_ip2_m_quad_r)
167168{
168   verboselog(machine(), 0, "sgi_ip2_m_quad_r: %04x\n", m_mquad);
169   verboselog(0, "sgi_ip2_m_quad_r: %04x\n", m_mquad);
169170   return m_mquad;
170171}
171172
172173WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_m_quad_w)
173174{
174   verboselog(machine(), 0, "sgi_ip2_m_quad_w = %04x & %04x\n", data, mem_mask);
175   verboselog(0, "sgi_ip2_m_quad_w = %04x & %04x\n", data, mem_mask);
175176   COMBINE_DATA(&m_mquad);
176177}
177178
178179READ16_MEMBER(sgi_ip2_state::sgi_ip2_swtch_r)
179180{
180   verboselog(machine(), 0, "sgi_ip2_swtch_r: %04x\n", ioport("SWTCH")->read());
181   verboselog(0, "sgi_ip2_swtch_r: %04x\n", ioport("SWTCH")->read());
181182   return ioport("SWTCH")->read();
182183}
183184
184185READ8_MEMBER(sgi_ip2_state::sgi_ip2_clock_ctl_r)
185186{
186187   UINT8 ret = m_rtc->read(space, 1);
187   verboselog(machine(), 1, "sgi_ip2_clock_ctl_r: %02x\n", ret);
188   verboselog(1, "sgi_ip2_clock_ctl_r: %02x\n", ret);
188189   return ret;
189190}
190191
191192WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_clock_ctl_w)
192193{
193   verboselog(machine(), 1, "sgi_ip2_clock_ctl_w: %02x\n", data);
194   verboselog(1, "sgi_ip2_clock_ctl_w: %02x\n", data);
194195   m_rtc->write(space, 1, data);
195196}
196197
197198READ8_MEMBER(sgi_ip2_state::sgi_ip2_clock_data_r)
198199{
199200   UINT8 ret = m_rtc->read(space, 0);
200   verboselog(machine(), 1, "sgi_ip2_clock_data_r: %02x\n", ret);
201   verboselog(1, "sgi_ip2_clock_data_r: %02x\n", ret);
201202   return ret;
202203}
203204
204205WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_clock_data_w)
205206{
206   verboselog(machine(), 1, "sgi_ip2_clock_data_w: %02x\n", data);
207   verboselog(1, "sgi_ip2_clock_data_w: %02x\n", data);
207208   m_rtc->write(space, 0, data);
208209}
209210
r21160r21161
213214   switch(offset)
214215   {
215216      default:
216         verboselog(machine(), 0, "sgi_ip2_os_base_r: Unknown Register %08x\n", 0x36000000 + offset);
217         verboselog(0, "sgi_ip2_os_base_r: Unknown Register %08x\n", 0x36000000 + offset);
217218         break;
218219   }
219220   return 0;
r21160r21161
224225   switch(offset)
225226   {
226227      default:
227         verboselog(machine(), 0, "sgi_ip2_os_base_w: Unknown Register %08x = %02x\n", 0x36000000 + offset, data);
228         verboselog(0, "sgi_ip2_os_base_w: Unknown Register %08x = %02x\n", 0x36000000 + offset, data);
228229         break;
229230   }
230231}
r21160r21161
234235   switch(offset)
235236   {
236237      default:
237         verboselog(machine(), 0, "sgi_ip2_status_r: Unknown Register %08x & %04x\n", 0x38000000 + (offset << 1), mem_mask);
238         verboselog(0, "sgi_ip2_status_r: Unknown Register %08x & %04x\n", 0x38000000 + (offset << 1), mem_mask);
238239         break;
239240   }
240241   return 0;
r21160r21161
245246   switch(offset)
246247   {
247248      default:
248         verboselog(machine(), 0, "sgi_ip2_status_w: Unknown Register %08x = %04x & %04x\n", 0x38000000 + (offset << 1), data, mem_mask);
249         verboselog(0, "sgi_ip2_status_w: Unknown Register %08x = %04x & %04x\n", 0x38000000 + (offset << 1), data, mem_mask);
249250         break;
250251   }
251252}
r21160r21161
262263
263264READ8_MEMBER(sgi_ip2_state::sgi_ip2_parctl_r)
264265{
265   verboselog(machine(), 0, "sgi_ip2_parctl_r: %02x\n", m_parctl);
266   verboselog(0, "sgi_ip2_parctl_r: %02x\n", m_parctl);
266267   return m_parctl;
267268}
268269
269270WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_parctl_w)
270271{
271   verboselog(machine(), 0, "sgi_ip2_parctl_w: %02x\n", data);
272   verboselog(0, "sgi_ip2_parctl_w: %02x\n", data);
272273   m_parctl = data;
273274}
274275
r21160r21161
284285
285286READ8_MEMBER(sgi_ip2_state::sgi_ip2_mbp_r)
286287{
287   verboselog(machine(), 0, "sgi_ip2_mbp_r: %02x\n", m_mbp);
288   verboselog(0, "sgi_ip2_mbp_r: %02x\n", m_mbp);
288289   return m_mbp;
289290}
290291
291292WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_mbp_w)
292293{
293   verboselog(machine(), 0, "sgi_ip2_mbp_w: %02x\n", data);
294   verboselog(0, "sgi_ip2_mbp_w: %02x\n", data);
294295   m_mbp = data;
295296}
296297
297298
298299READ32_MEMBER(sgi_ip2_state::sgi_ip2_ptmap_r)
299300{
300   verboselog(machine(), 0, "sgi_ip2_ptmap_r: %08x = %08x & %08x\n", 0x3b000000 + (offset << 2), m_ptmap[offset], mem_mask);
301   verboselog(0, "sgi_ip2_ptmap_r: %08x = %08x & %08x\n", 0x3b000000 + (offset << 2), m_ptmap[offset], mem_mask);
301302   return m_ptmap[offset];
302303}
303304
304305WRITE32_MEMBER(sgi_ip2_state::sgi_ip2_ptmap_w)
305306{
306   verboselog(machine(), 0, "sgi_ip2_ptmap_w: %08x = %08x & %08x\n", 0x3b000000 + (offset << 2), data, mem_mask);
307   verboselog(0, "sgi_ip2_ptmap_w: %08x = %08x & %08x\n", 0x3b000000 + (offset << 2), data, mem_mask);
307308   COMBINE_DATA(&m_ptmap[offset]);
308309}
309310
310311
311312READ16_MEMBER(sgi_ip2_state::sgi_ip2_tdbase_r)
312313{
313   verboselog(machine(), 0, "sgi_ip2_tdbase_r: %04x\n", m_tdbase);
314   verboselog(0, "sgi_ip2_tdbase_r: %04x\n", m_tdbase);
314315   return m_tdbase;
315316}
316317
317318WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_tdbase_w)
318319{
319   verboselog(machine(), 0, "sgi_ip2_tdbase_w: %04x & %04x\n", data, mem_mask);
320   verboselog(0, "sgi_ip2_tdbase_w: %04x & %04x\n", data, mem_mask);
320321   COMBINE_DATA(&m_tdbase);
321322}
322323
323324
324325READ16_MEMBER(sgi_ip2_state::sgi_ip2_tdlmt_r)
325326{
326   verboselog(machine(), 0, "sgi_ip2_tdlmt_r: %04x\n", m_tdlmt);
327   verboselog(0, "sgi_ip2_tdlmt_r: %04x\n", m_tdlmt);
327328   return m_tdlmt;
328329}
329330
330331WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_tdlmt_w)
331332{
332   verboselog(machine(), 0, "sgi_ip2_tdlmt_w: %04x & %04x\n", data, mem_mask);
333   verboselog(0, "sgi_ip2_tdlmt_w: %04x & %04x\n", data, mem_mask);
333334   COMBINE_DATA(&m_tdlmt);
334335}
335336
336337
337338READ16_MEMBER(sgi_ip2_state::sgi_ip2_stkbase_r)
338339{
339   verboselog(machine(), 0, "sgi_ip2_stkbase_r: %04x\n", m_stkbase);
340   verboselog(0, "sgi_ip2_stkbase_r: %04x\n", m_stkbase);
340341   return m_stkbase;
341342}
342343
343344WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_stkbase_w)
344345{
345   verboselog(machine(), 0, "sgi_ip2_stkbase_w: %04x & %04x\n", data, mem_mask);
346   verboselog(0, "sgi_ip2_stkbase_w: %04x & %04x\n", data, mem_mask);
346347   COMBINE_DATA(&m_stkbase);
347348}
348349
349350
350351READ16_MEMBER(sgi_ip2_state::sgi_ip2_stklmt_r)
351352{
352   verboselog(machine(), 0, "sgi_ip2_stklmt_r: %04x\n", m_stklmt);
353   verboselog(0, "sgi_ip2_stklmt_r: %04x\n", m_stklmt);
353354   return m_stklmt;
354355}
355356
356357WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_stklmt_w)
357358{
358   verboselog(machine(), 0, "sgi_ip2_stklmt_w: %04x & %04x\n", data, mem_mask);
359   verboselog(0, "sgi_ip2_stklmt_w: %04x & %04x\n", data, mem_mask);
359360   COMBINE_DATA(&m_stklmt);
360361}
361362
trunk/src/mess/drivers/ti990_4.c
r21160r21161
6363   virtual void video_start();
6464   UINT32 screen_update_ti990_4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6565   INTERRUPT_GEN_MEMBER(ti990_4_line_interrupt);
66   void idle_callback(int state);
6667};
6768
6869
r21160r21161
8889}
8990
9091#ifdef UNUSED_FUNCTION
91static void idle_callback(int state)
92void ti990_4_state::idle_callback(int state)
9293{
9394}
9495#endif
trunk/src/mess/drivers/pc6001.c
r21160r21161
299299   UINT8 check_joy_press();
300300   UINT8 check_keyboard_press();
301301   void vram_bank_change(UINT8 vram_bank);
302   ATTR_CONST UINT8 pc6001_get_attributes(UINT8 c,int scanline, int pos);
303   const UINT8 *pc6001_get_video_ram(int scanline);
304   UINT8 pc6001_get_char_rom(UINT8 ch, int line);
302305};
303306
304307
r21160r21161
838841}
839842
840843#if 0
841static ATTR_CONST UINT8 pc6001_get_attributes(running_machine &machine, UINT8 c,int scanline, int pos)
844ATTR_CONST pc6001_state::UINT8 pc6001_get_attributes(UINT8 c,int scanline, int pos)
842845{
843   pc6001_state *state = machine.driver_data<pc6001_state>();
844846   UINT8 result = 0x00;
845   UINT8 val = state->m_video_ram [(scanline / 12) * 0x20 + pos];
847   UINT8 val = m_video_ram [(scanline / 12) * 0x20 + pos];
846848
847849   if (val & 0x01) {
848850      result |= M6847_INV;
r21160r21161
854856   return result;
855857}
856858
857static const UINT8 *pc6001_get_video_ram(running_machine &machine, int scanline)
859const pc6001_state::UINT8 *pc6001_get_video_ram(int scanline)
858860{
859   pc6001_state *state = machine.driver_data<pc6001_state>();
860   return state->m_video_ram +0x0200+ (scanline / 12) * 0x20;
861   return m_video_ram +0x0200+ (scanline / 12) * 0x20;
861862}
862863
863static UINT8 pc6001_get_char_rom(running_machine &machine, UINT8 ch, int line)
864UINT8 pc6001_state::pc6001_get_char_rom(UINT8 ch, int line)
864865{
865866   UINT8 *gfx = m_region_gfx1->base();
866867   return gfx[ch*16+line];
trunk/src/mess/drivers/pc88va.c
r21160r21161
152152   DECLARE_FLOPPY_FORMATS( floppy_formats );
153153   void pc88va_fdc_update_ready(floppy_image_device *, int);
154154   IRQ_CALLBACK_MEMBER(pc88va_irq_callback);
155   void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
156   UINT32 calc_kanji_rom_addr(UINT8 jis1,UINT8 jis2,int x,int y);
157   void draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect);
158   void tsp_sprite_enable(UINT32 spr_offset, UINT8 sw_bit);
159   void execute_sync_cmd();
160   void execute_dspon_cmd();
161   void execute_dspdef_cmd();
162   void execute_curdef_cmd();
163   void execute_actscr_cmd();
164   void execute_curs_cmd();
165   void execute_emul_cmd();
166   void execute_spron_cmd();
167   void execute_sprsw_cmd();
155168};
156169
157170
r21160r21161
160173{
161174}
162175
163static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
176void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
164177{
165   pc88va_state *state = machine.driver_data<pc88va_state>();
166   UINT16 *tvram = (UINT16 *)(*state->memregion("tvram"));
178   UINT16 *tvram = (UINT16 *)(*memregion("tvram"));
167179   int offs,i;
168180
169   offs = state->m_tsp.spr_offset;
181   offs = m_tsp.spr_offset;
170182   for(i=0;i<(0x100);i+=(8))
171183   {
172184      int xp,yp,sw,md,xsize,ysize,spda,fg_col,bc;
r21160r21161
221233                  pen = pen & 1 ? fg_col : (bc) ? 8 : -1;
222234
223235                  if(pen != -1) //transparent pen
224                     bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = machine.pens[pen];
236                     bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = machine().pens[pen];
225237               }
226238               spr_count+=2;
227239            }
r21160r21161
246258                  pen = (BITSWAP16(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf;
247259
248260                  //if(bc != -1) //transparent pen
249                  bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = machine.pens[pen];
261                  bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = machine().pens[pen];
250262               }
251263               spr_count+=2;
252264            }
r21160r21161
256268}
257269
258270/* TODO: this is either a result of an hand-crafted ROM or the JIS stuff is really attribute related ... */
259static UINT32 calc_kanji_rom_addr(UINT8 jis1,UINT8 jis2,int x,int y)
271UINT32 pc88va_state::calc_kanji_rom_addr(UINT8 jis1,UINT8 jis2,int x,int y)
260272{
261273   if(jis1 < 0x30)
262274      return ((jis2 & 0x60) << 8) + ((jis1 & 0x07) << 10) + ((jis2 & 0x1f) << 5);
r21160r21161
270282   return 0;
271283}
272284
273static void draw_text(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
285void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect)
274286{
275   pc88va_state *state = machine.driver_data<pc88va_state>();
276   UINT8 *tvram = machine.root_device().memregion("tvram")->base();
277   UINT8 *kanji = state->memregion("kanji")->base();
287   UINT8 *tvram = machine().root_device().memregion("tvram")->base();
288   UINT8 *kanji = memregion("kanji")->base();
278289   int xi,yi;
279290   int x,y;
280291   int res_x,res_y;
r21160r21161
288299   //UINT8 blink,dwidc,dwid,uline,hline;
289300   UINT8 screen_fg_col,screen_bg_col;
290301
291   count = (tvram[state->m_tsp.tvram_vreg_offset+0] | tvram[state->m_tsp.tvram_vreg_offset+1] << 8);
302   count = (tvram[m_tsp.tvram_vreg_offset+0] | tvram[m_tsp.tvram_vreg_offset+1] << 8);
292303
293   attr_mode = tvram[state->m_tsp.tvram_vreg_offset+0xa] & 0x1f;
304   attr_mode = tvram[m_tsp.tvram_vreg_offset+0xa] & 0x1f;
294305   /* Note: bug in docs has the following two reversed */
295   screen_fg_col = (tvram[state->m_tsp.tvram_vreg_offset+0xb] & 0xf0) >> 4;
296   screen_bg_col = tvram[state->m_tsp.tvram_vreg_offset+0xb] & 0x0f;
306   screen_fg_col = (tvram[m_tsp.tvram_vreg_offset+0xb] & 0xf0) >> 4;
307   screen_bg_col = tvram[m_tsp.tvram_vreg_offset+0xb] & 0x0f;
297308
298309   for(y=0;y<13;y++)
299310   {
r21160r21161
305316
306317         tile_num = calc_kanji_rom_addr(jis1,jis2,x,y);
307318
308         attr = (tvram[count+state->m_tsp.attr_offset] & 0x00ff);
319         attr = (tvram[count+m_tsp.attr_offset] & 0x00ff);
309320
310321         fg_col = bg_col = reverse = secret = 0; //blink = dwidc = dwid = uline = hline = 0;
311322
r21160r21161
442453               if(secret) { pen = 0; } //hide text
443454
444455               if(pen != -1) //transparent
445                  bitmap.pix32(res_y, res_x) = machine.pens[pen];
456                  bitmap.pix32(res_y, res_x) = machine().pens[pen];
446457            }
447458         }
448459
r21160r21161
496507         {
497508            switch(cur_pri_lv & 3) // (palette color mode)
498509            {
499               case 0: draw_text(machine(),bitmap,cliprect); break;
500               case 1: if(m_tsp.spr_on) { draw_sprites(machine(),bitmap,cliprect); } break;
510               case 0: draw_text(bitmap,cliprect); break;
511               case 1: if(m_tsp.spr_on) { draw_sprites(bitmap,cliprect); } break;
501512               case 2: /* A = graphic 0 */ break;
502513               case 3: /* B = graphic 1 */ break;
503514            }
r21160r21161
697708   }
698709}
699710
700static void tsp_sprite_enable(running_machine &machine, UINT32 spr_offset, UINT8 sw_bit)
711void pc88va_state::tsp_sprite_enable(UINT32 spr_offset, UINT8 sw_bit)
701712{
702   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
713   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
703714
704715   space.write_word(spr_offset, space.read_word(spr_offset) & ~0x200);
705716   space.write_word(spr_offset, space.read_word(spr_offset) | (sw_bit & 0x200));
706717}
707718
708719/* TODO: very preliminary, needs something showable first */
709static void execute_sync_cmd(running_machine &machine)
720void pc88va_state::execute_sync_cmd()
710721{
711   pc88va_state *state = machine.driver_data<pc88va_state>();
712722   /*
713723       ???? ???? [0] - unknown
714724       ???? ???? [1] - unknown
r21160r21161
736746   //printf("V border end: %d\n",(sync_cmd[0xc]));
737747   //printf("V blank end: %d\n",(sync_cmd[0xd]));
738748
739   x_vis_area = state->m_buf_ram[4] * 4;
740   y_vis_area = (state->m_buf_ram[0xa])|((state->m_buf_ram[0xb] & 0x40)<<2);
749   x_vis_area = m_buf_ram[4] * 4;
750   y_vis_area = (m_buf_ram[0xa])|((m_buf_ram[0xb] & 0x40)<<2);
741751
742752   visarea.set(0, x_vis_area - 1, 0, y_vis_area - 1);
743753
r21160r21161
748758
749759   refresh = HZ_TO_ATTOSECONDS(60);
750760
751   machine.primary_screen->configure(640, 480, visarea, refresh);
761   machine().primary_screen->configure(640, 480, visarea, refresh);
752762}
753763
754static void execute_dspon_cmd(running_machine &machine)
764void pc88va_state::execute_dspon_cmd()
755765{
756   pc88va_state *state = machine.driver_data<pc88va_state>();
757766   /*
758767   [0] text table offset (hi word)
759768   [1] unknown
760769   [2] unknown
761770   */
762   state->m_tsp.tvram_vreg_offset = state->m_buf_ram[0] << 8;
763   state->m_tsp.disp_on = 1;
771   m_tsp.tvram_vreg_offset = m_buf_ram[0] << 8;
772   m_tsp.disp_on = 1;
764773}
765774
766static void execute_dspdef_cmd(running_machine &machine)
775void pc88va_state::execute_dspdef_cmd()
767776{
768   pc88va_state *state = machine.driver_data<pc88va_state>();
769777   /*
770778   [0] attr offset (lo word)
771779   [1] attr offset (hi word)
r21160r21161
774782   [4] hline vertical position
775783   [5] blink number
776784   */
777   state->m_tsp.attr_offset = state->m_buf_ram[0] | state->m_buf_ram[1] << 8;
778   state->m_tsp.pitch = (state->m_buf_ram[2] & 0xf0) >> 4;
779   state->m_tsp.line_height = state->m_buf_ram[3] + 1;
780   state->m_tsp.h_line_pos = state->m_buf_ram[4];
781   state->m_tsp.blink = (state->m_buf_ram[5] & 0xf8) >> 3;
785   m_tsp.attr_offset = m_buf_ram[0] | m_buf_ram[1] << 8;
786   m_tsp.pitch = (m_buf_ram[2] & 0xf0) >> 4;
787   m_tsp.line_height = m_buf_ram[3] + 1;
788   m_tsp.h_line_pos = m_buf_ram[4];
789   m_tsp.blink = (m_buf_ram[5] & 0xf8) >> 3;
782790}
783791
784static void execute_curdef_cmd(running_machine &machine)
792void pc88va_state::execute_curdef_cmd()
785793{
786   pc88va_state *state = machine.driver_data<pc88va_state>();
787794   /*
788795   xxxx x--- [0] Sprite Cursor number (sprite RAM entry)
789796   ---- --x- [0] show cursor bit (actively modifies the spriteram entry)
r21160r21161
791798   */
792799
793800   /* TODO: needs basic sprite emulation */
794   state->m_tsp.curn = (state->m_buf_ram[0] & 0xf8);
795   state->m_tsp.curn_blink = (state->m_buf_ram[0] & 1);
801   m_tsp.curn = (m_buf_ram[0] & 0xf8);
802   m_tsp.curn_blink = (m_buf_ram[0] & 1);
796803
797   tsp_sprite_enable(machine, 0xa0000 + state->m_tsp.spr_offset + state->m_tsp.curn, (state->m_buf_ram[0] & 2) << 8);
804   tsp_sprite_enable(0xa0000 + m_tsp.spr_offset + m_tsp.curn, (m_buf_ram[0] & 2) << 8);
798805}
799806
800static void execute_actscr_cmd(running_machine &machine)
807void pc88va_state::execute_actscr_cmd()
801808{
802   //pc88va_state *state = machine.driver_data<pc88va_state>();
803809   /*
804810   This command assigns a strip where the cursor is located.
805811   xxxx xxxx [0] strip ID * 32 (???)
806812   */
807813
808814   /* TODO: no idea about this command */
809   //printf("ACTSCR: %02x\n",state->m_buf_ram[0]);
815   //printf("ACTSCR: %02x\n",m_buf_ram[0]);
810816}
811817
812static void execute_curs_cmd(running_machine &machine)
818void pc88va_state::execute_curs_cmd()
813819{
814   pc88va_state *state = machine.driver_data<pc88va_state>();
815820   /*
816821   [0] Cursor Position Y (lo word)
817822   [1] Cursor Position Y (hi word)
r21160r21161
819824   [3] Cursor Position X (hi word)
820825   */
821826
822   state->m_tsp.cur_pos_y = state->m_buf_ram[0] | state->m_buf_ram[1] << 8;
823   state->m_tsp.cur_pos_x = state->m_buf_ram[2] | state->m_buf_ram[3] << 8;
827   m_tsp.cur_pos_y = m_buf_ram[0] | m_buf_ram[1] << 8;
828   m_tsp.cur_pos_x = m_buf_ram[2] | m_buf_ram[3] << 8;
824829}
825830
826static void execute_emul_cmd(running_machine &machine)
831void pc88va_state::execute_emul_cmd()
827832{
828833   /*
829834   [0] Emulate target strip ID x 32
r21160r21161
836841   //popmessage("Warning: TSP executes EMUL command, contact MESSdev");
837842}
838843
839static void execute_spron_cmd(running_machine &machine)
844void pc88va_state::execute_spron_cmd()
840845{
841   pc88va_state *state = machine.driver_data<pc88va_state>();
842846   /*
843847   [0] Sprite Table Offset (hi word)
844848   [1] (unknown / reserved)
r21160r21161
846850   ---- --x- [2] MG: all sprites are 2x zoomed vertically when 1
847851   ---- ---x [2] GR: 1 to enable the group collision detection
848852   */
849   state->m_tsp.spr_offset = state->m_buf_ram[0] << 8;
850   state->m_tsp.spr_on = 1;
851   printf("SPR TABLE %02x %02x %02x\n",state->m_buf_ram[0],state->m_buf_ram[1],state->m_buf_ram[2]);
853   m_tsp.spr_offset = m_buf_ram[0] << 8;
854   m_tsp.spr_on = 1;
855   printf("SPR TABLE %02x %02x %02x\n",m_buf_ram[0],m_buf_ram[1],m_buf_ram[2]);
852856}
853857
854static void execute_sprsw_cmd(running_machine &machine)
858void pc88va_state::execute_sprsw_cmd()
855859{
856   pc88va_state *state = machine.driver_data<pc88va_state>();
857860   /*
858861   Toggle an individual sprite in the sprite ram entry
859862   [0] xxxx x--- target sprite number
860863   [0] ---- --x- sprite off/on switch
861864   */
862865
863   tsp_sprite_enable(machine, 0xa0000 + state->m_tsp.spr_offset + (state->m_buf_ram[0] & 0xf8), (state->m_buf_ram[0] & 2) << 8);
866   tsp_sprite_enable(0xa0000 + m_tsp.spr_offset + (m_buf_ram[0] & 0xf8), (m_buf_ram[0] & 2) << 8);
864867}
865868
866869WRITE8_MEMBER(pc88va_state::idp_param_w)
r21160r21161
876879      m_buf_index = 0;
877880      switch(m_cmd)
878881      {
879         case SYNC:      execute_sync_cmd(machine());    break;
880         case DSPON:     execute_dspon_cmd(machine());   break;
881         case DSPDEF:    execute_dspdef_cmd(machine()); break;
882         case CURDEF:    execute_curdef_cmd(machine()); break;
883         case ACTSCR:    execute_actscr_cmd(machine()); break;
884         case CURS:      execute_curs_cmd(machine());   break;
885         case EMUL:      execute_emul_cmd(machine());   break;
886         case SPRON:     execute_spron_cmd(machine());  break;
887         case SPRSW:     execute_sprsw_cmd(machine());   break;
882         case SYNC:      execute_sync_cmd();    break;
883         case DSPON:     execute_dspon_cmd();   break;
884         case DSPDEF:    execute_dspdef_cmd(); break;
885         case CURDEF:    execute_curdef_cmd(); break;
886         case ACTSCR:    execute_actscr_cmd(); break;
887         case CURS:      execute_curs_cmd();   break;
888         case EMUL:      execute_emul_cmd();   break;
889         case SPRON:     execute_spron_cmd();  break;
890         case SPRSW:     execute_sprsw_cmd();   break;
888891
889892         default:
890893            //printf("%02x\n",data);
trunk/src/mess/drivers/4004clk.c
r21160r21161
3030   UINT8 m_timer;
3131   virtual void machine_start();
3232   TIMER_DEVICE_CALLBACK_MEMBER(timer_callback);
33   UINT8 nixie_to_num(UINT16 val);
34   inline void output_set_nixie_value(int index, int value);
35   inline void output_set_neon_value(int index, int value);
3336};
3437
3538READ8_MEMBER(nixieclock_state::data_r)
r21160r21161
3740   return ioport("INPUT")->read() & 0x0f;
3841}
3942
40static UINT8 nixie_to_num(UINT16 val)
43UINT8 nixieclock_state::nixie_to_num(UINT16 val)
4144{
4245   if (BIT(val,0)) return 0;
4346   if (BIT(val,1)) return 1;
r21160r21161
5255   return 10;
5356}
5457
55INLINE void output_set_nixie_value(int index, int value)
58inline void nixieclock_state::output_set_nixie_value(int index, int value)
5659{
5760   output_set_indexed_value("nixie", index, value);
5861}
5962
60INLINE void output_set_neon_value(int index, int value)
63inline void nixieclock_state::output_set_neon_value(int index, int value)
6164{
6265   output_set_indexed_value("neon", index, value);
6366}
trunk/src/mess/drivers/nanos.c
r21160r21161
9090   required_ioport m_line5;
9191   required_ioport m_line6;
9292   required_ioport m_linec;
93   UINT8 row_number(UINT8 code);
9394};
9495
9596
r21160r21161
366367   }
367368}
368369
369static UINT8 row_number(UINT8 code) {
370UINT8 nanos_state::row_number(UINT8 code)
371{
370372   if BIT(code,0) return 0;
371373   if BIT(code,1) return 1;
372374   if BIT(code,2) return 2;
trunk/src/mess/drivers/jr100.c
r21160r21161
6363   DECLARE_WRITE8_MEMBER(jr100_via_write_a);
6464   DECLARE_WRITE8_MEMBER(jr100_via_write_b);
6565   DECLARE_WRITE_LINE_MEMBER(jr100_via_write_cb2);
66   UINT32 readByLittleEndian(UINT8 *buf,int pos);
6667
6768protected:
6869   required_device<via6522_device> m_via;
r21160r21161
329330   }
330331}
331332
332static UINT32 readByLittleEndian(UINT8 *buf,int pos)
333UINT32 jr100_state::readByLittleEndian(UINT8 *buf,int pos)
333334{
334335   return buf[pos] + (buf[pos+1] << 8) + (buf[pos+2] << 16) + (buf[pos+3] << 24);
335336}
r21160r21161
352353      return IMAGE_INIT_FAIL;
353354   }
354355   int pos = 4;
355   if (readByLittleEndian(buf,pos)!=1) {
356   if (state->readByLittleEndian(buf,pos)!=1) {
356357      // not version 1 of PRG file
357358      return IMAGE_INIT_FAIL;
358359   }
359360   pos += 4;
360   UINT32 len =readByLittleEndian(buf,pos); pos+= 4;
361   UINT32 len =state->readByLittleEndian(buf,pos); pos+= 4;
361362   pos += len; // skip name
362   UINT32 start_address = readByLittleEndian(buf,pos); pos+= 4;
363   UINT32 code_length   = readByLittleEndian(buf,pos); pos+= 4;
364   UINT32 flag          = readByLittleEndian(buf,pos); pos+= 4;
363   UINT32 start_address = state->readByLittleEndian(buf,pos); pos+= 4;
364   UINT32 code_length   = state->readByLittleEndian(buf,pos); pos+= 4;
365   UINT32 flag          = state->readByLittleEndian(buf,pos); pos+= 4;
365366
366367   UINT32 end_address = start_address + code_length - 1;
367368   // copy code
trunk/src/mess/drivers/pdp11.c
r21160r21161
9292   virtual void machine_reset();
9393   DECLARE_MACHINE_RESET(pdp11ub2);
9494   DECLARE_MACHINE_RESET(pdp11qb);
95   void load9312prom(UINT8 *desc, UINT8 *src, int size);
9596};
9697
9798WRITE16_MEMBER(pdp11_state::term_w)
r21160r21161
248249   }
249250}
250251
251static void load9312prom(UINT8 *desc, UINT8 *src, int size)
252void pdp11_state::load9312prom(UINT8 *desc, UINT8 *src, int size)
252253{
253254   //   3   2   1   8
254255   //   7   6   5   4
trunk/src/mess/drivers/dectalk.c
r21160r21161
196196   virtual void machine_reset();
197197   TIMER_CALLBACK_MEMBER(outfifo_read_cb);
198198   DECLARE_WRITE8_MEMBER(dectalk_kbd_put);
199   void dectalk_outfifo_check ();
200   void dectalk_clear_all_fifos(  );
201   void dectalk_x2212_store(  );
202   void dectalk_x2212_recall(  );
203   void dectalk_semaphore_w ( UINT16 data );
204   UINT16 dectalk_outfifo_r (  );
199205};
200206
201207
r21160r21161
247253#define SPC_INITIALIZE state->m_m68k_spcflags_latch&0x1 // speech initialize flag
248254#define SPC_IRQ_ENABLED ((state->m_m68k_spcflags_latch&0x40)>>6) // irq enable flag
249255
250static void dectalk_outfifo_check (running_machine &machine)
256void dectalk_state::dectalk_outfifo_check ()
251257{
252   dectalk_state *state = machine.driver_data<dectalk_state>();
253258   // check if output fifo is full; if it isn't, set the int on the dsp
254   if (((state->m_outfifo_head_ptr-1)&0xF) != state->m_outfifo_tail_ptr)
255   machine.device("dsp")->execute().set_input_line(0, ASSERT_LINE); // TMS32010 INT
259   if (((m_outfifo_head_ptr-1)&0xF) != m_outfifo_tail_ptr)
260   machine().device("dsp")->execute().set_input_line(0, ASSERT_LINE); // TMS32010 INT
256261   else
257   machine.device("dsp")->execute().set_input_line(0, CLEAR_LINE); // TMS32010 INT
262   machine().device("dsp")->execute().set_input_line(0, CLEAR_LINE); // TMS32010 INT
258263}
259264
260static void dectalk_clear_all_fifos( running_machine &machine )
265void dectalk_state::dectalk_clear_all_fifos(  )
261266{
262   dectalk_state *state = machine.driver_data<dectalk_state>();
263267   // clear fifos (TODO: memset would work better here...)
264268   int i;
265   for (i=0; i<16; i++) state->m_outfifo[i] = 0;
266   for (i=0; i<32; i++) state->m_infifo[i] = 0;
267   state->m_outfifo_tail_ptr = state->m_outfifo_head_ptr = 0;
268   state->m_infifo_tail_ptr = state->m_infifo_head_ptr = 0;
269   dectalk_outfifo_check(machine);
269   for (i=0; i<16; i++) m_outfifo[i] = 0;
270   for (i=0; i<32; i++) m_infifo[i] = 0;
271   m_outfifo_tail_ptr = m_outfifo_head_ptr = 0;
272   m_infifo_tail_ptr = m_infifo_head_ptr = 0;
273   dectalk_outfifo_check();
270274}
271275
272static void dectalk_x2212_store( running_machine &machine )
276void dectalk_state::dectalk_x2212_store(  )
273277{
274   dectalk_state *state = machine.driver_data<dectalk_state>();
275   UINT8 *nvram = state->memregion("nvram")->base();
278   UINT8 *nvram = memregion("nvram")->base();
276279   int i;
277280   for (i = 0; i < 256; i++)
278   nvram[i] = state->m_x2214_sram[i];
281   nvram[i] = m_x2214_sram[i];
279282#ifdef NVRAM_LOG
280283   logerror("nvram store done\n");
281284#endif
282285}
283286
284static void dectalk_x2212_recall( running_machine &machine )
287void dectalk_state::dectalk_x2212_recall(  )
285288{
286   dectalk_state *state = machine.driver_data<dectalk_state>();
287   UINT8 *nvram = state->memregion("nvram")->base();
289   UINT8 *nvram = memregion("nvram")->base();
288290   int i;
289291   for (i = 0; i < 256; i++)
290   state->m_x2214_sram[i] = nvram[i];
292   m_x2214_sram[i] = nvram[i];
291293#ifdef NVRAM_LOG
292294   logerror("nvram recall done\n");
293295#endif
294296}
295297
296298// helper for dsp infifo_semaphore flag to make dealing with interrupts easier
297static void dectalk_semaphore_w ( running_machine &machine, UINT16 data )
299void dectalk_state::dectalk_semaphore_w ( UINT16 data )
298300{
299   dectalk_state *state = machine.driver_data<dectalk_state>();
300   state->m_infifo_semaphore = data&1;
301   if ((state->m_infifo_semaphore == 1) && (state->m_m68k_spcflags_latch&0x40))
301   m_infifo_semaphore = data&1;
302   if ((m_infifo_semaphore == 1) && (m_m68k_spcflags_latch&0x40))
302303   {
303304#ifdef VERBOSE
304305      logerror("speech int fired!\n");
305306#endif
306      machine.device("maincpu")->execute().set_input_line_and_vector(M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
307      machine().device("maincpu")->execute().set_input_line_and_vector(M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
307308   }
308309   else
309   machine.device("maincpu")->execute().set_input_line_and_vector(M68K_IRQ_5, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
310   machine().device("maincpu")->execute().set_input_line_and_vector(M68K_IRQ_5, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
310311}
311312
312313// read the output fifo and set the interrupt line active on the dsp
313static UINT16 dectalk_outfifo_r ( running_machine &machine )
314UINT16 dectalk_state::dectalk_outfifo_r (  )
314315{
315   dectalk_state *state = machine.driver_data<dectalk_state>();
316316   UINT16 data = 0xFFFF;
317   data = state->m_outfifo[state->m_outfifo_tail_ptr];
317   data = m_outfifo[m_outfifo_tail_ptr];
318318   // if fifo is empty (tail ptr == head ptr), do not increment the tail ptr, otherwise do.
319   //if (state->m_outfifo_tail_ptr != state->m_outfifo_head_ptr) state->m_outfifo_tail_ptr++; // technically correct but doesn't match sn74ls224 sheet
320   if (((state->m_outfifo_head_ptr-1)&0xF) != state->m_outfifo_tail_ptr) state->m_outfifo_tail_ptr++; // matches sn74ls224 sheet
321   state->m_outfifo_tail_ptr&=0xF;
322   dectalk_outfifo_check(machine);
319   //if (m_outfifo_tail_ptr != m_outfifo_head_ptr) m_outfifo_tail_ptr++; // technically correct but doesn't match sn74ls224 sheet
320   if (((m_outfifo_head_ptr-1)&0xF) != m_outfifo_tail_ptr) m_outfifo_tail_ptr++; // matches sn74ls224 sheet
321   m_outfifo_tail_ptr&=0xF;
322   dectalk_outfifo_check();
323323   return ((data&0xfff0)^0x8000); // yes this is right, top bit is inverted and bottom 4 are ignored
324324   //return data; // not right but want to get it working first
325325}
r21160r21161
331331   state->m_hack_self_test = 0; // hack
332332   // stuff that is DIRECTLY affected by the RESET line
333333   state->m_statusLED = 0; // clear status led latch
334   dectalk_x2212_recall(device->machine()); // nvram recall
334   state->dectalk_x2212_recall(); // nvram recall
335335   state->m_m68k_spcflags_latch = 1; // initial status is speech reset(d0) active and spc int(d6) disabled
336336   state->m_m68k_tlcflags_latch = 0; // initial status is tone detect int(d6) off, answer phone(d8) off, ring detect int(d14) off
337337   device->machine().device("duart68681")->reset(); // reset the DUART
338338   // stuff that is INDIRECTLY affected by the RESET line
339   dectalk_clear_all_fifos(device->machine()); // speech reset clears the fifos, though we have to do it explicitly here since we're not actually in the m68k_spcflags_w function.
340   dectalk_semaphore_w(device->machine(), 0); // on the original state->m_dectalk pcb revision, this is a semaphore for the INPUT fifo, later dec hacked on a check for the 3 output fifo chips to see if they're in sync, and set both of these latches if true.
339   state->dectalk_clear_all_fifos(); // speech reset clears the fifos, though we have to do it explicitly here since we're not actually in the m68k_spcflags_w function.
340   state->dectalk_semaphore_w(0); // on the original state->m_dectalk pcb revision, this is a semaphore for the INPUT fifo, later dec hacked on a check for the 3 output fifo chips to see if they're in sync, and set both of these latches if true.
341341   state->m_spc_error_latch = 0; // spc error latch is cleared on /reset
342342   device->machine().device("dsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // speech reset forces the CLR line active on the tms32010
343343   state->m_tlc_tonedetect = 0; // TODO, needed for selftest pass
r21160r21161
362362      logerror("m68k: nvram read at %08X: %02X\n", offset, data);
363363#endif
364364   if (offset&0x200) // if a9 is set, do a /RECALL
365   dectalk_x2212_recall(machine());
365   dectalk_x2212_recall();
366366   return data;
367367}
368368
r21160r21161
383383#endif
384384   m_x2214_sram[offset&0xff] = (UINT8)data&0x0f; // TODO: should this be before or after a possible /STORE? I'm guessing before.
385385   if (offset&0x200) // if a9 is set, do a /STORE
386   dectalk_x2212_store(machine());
386   dectalk_x2212_store();
387387}
388388
389389WRITE16_MEMBER(dectalk_state::m68k_infifo_w)// 68k write to the speech input fifo
r21160r21161
434434#ifdef SPC_LOG_68K
435435      logerror(" | 0x01: initialize speech: fifos reset, clear error+semaphore latches and dsp reset\n");
436436#endif
437      dectalk_clear_all_fifos(machine());
437      dectalk_clear_all_fifos();
438438      machine().device("dsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // speech reset forces the CLR line active on the tms32010
439439      // clear the two speech side latches
440440      m_spc_error_latch = 0;
441      dectalk_semaphore_w(machine(), 0);
441      dectalk_semaphore_w(0);
442442   }
443443   else // (data&0x1) == 0
444444   {
r21160r21161
454454#endif
455455      // clear the two speech side latches
456456      m_spc_error_latch = 0;
457      dectalk_semaphore_w(machine(), 0);
457      dectalk_semaphore_w(0);
458458   }
459459   if ((data&0x40) == 0x40) // bit 6 - spc irq enable
460460   {
r21160r21161
572572#ifdef SPC_LOG_DSP
573573   logerror("dsp: set fifo semaphore and set error status = %01X\n",data&1);
574574#endif
575   dectalk_semaphore_w(machine(), (~m_simulate_outfifo_error)&1); // always set to 1 here, unless outfifo error.
575   dectalk_semaphore_w((~m_simulate_outfifo_error)&1); // always set to 1 here, unless outfifo error.
576576   m_spc_error_latch = (data&1);
577577}
578578
r21160r21161
608608   m_outfifo[m_outfifo_head_ptr] = data;
609609   m_outfifo_head_ptr++;
610610   m_outfifo_head_ptr&=0xF;
611   //dectalk_outfifo_check(machine()); // commented to allow int to clear
611   //dectalk_outfifo_check(); // commented to allow int to clear
612612}
613613
614614READ16_MEMBER(dectalk_state::spc_semaphore_r)// Return state of d-latch 74ls74 @ E64 'lower half' in d0 which indicates whether infifo is readable
r21160r21161
703703{
704704   UINT16 data;
705705   dac_device *speaker = machine().device<dac_device>("dac");
706   data = dectalk_outfifo_r(machine());
706   data = dectalk_outfifo_r();
707707#ifdef VERBOSE
708708   if (data!= 0x8000) logerror("sample output: %04X\n", data);
709709#endif
r21160r21161
714714/* Driver init: stuff that needs setting up which isn't directly affected by reset */
715715DRIVER_INIT_MEMBER(dectalk_state,dectalk)
716716{
717   dectalk_clear_all_fifos(machine());
717   dectalk_clear_all_fifos();
718718   m_simulate_outfifo_error = 0;
719719   machine().scheduler().timer_set(attotime::from_hz(10000), timer_expired_delegate(FUNC(dectalk_state::outfifo_read_cb),this));
720720}
trunk/src/mess/drivers/socrates.c
r21160r21161
131131   INTERRUPT_GEN_MEMBER(assert_irq);
132132   TIMER_CALLBACK_MEMBER(clear_speech_cb);
133133   TIMER_CALLBACK_MEMBER(clear_irq_cb);
134   void socrates_set_rom_bank();
135   void socrates_set_ram_bank();
136   void socrates_update_kb();
137   void socrates_check_kb_latch();
138   rgb_t socrates_create_color(UINT8 color);
134139};
135140
136141
r21160r21161
140145
141146/* Devices */
142147
143static void socrates_set_rom_bank( running_machine &machine )
148void socrates_state::socrates_set_rom_bank(  )
144149{
145   socrates_state *state = machine.driver_data<socrates_state>();
146   state->membank( "bank1" )->set_base( state->memregion("maincpu")->base() + ( state->m_rom_bank * 0x4000 ));
150   membank( "bank1" )->set_base( memregion("maincpu")->base() + ( m_rom_bank * 0x4000 ));
147151}
148152
149static void socrates_set_ram_bank( running_machine &machine )
153void socrates_state::socrates_set_ram_bank(  )
150154{
151   socrates_state *state = machine.driver_data<socrates_state>();
152   state->membank( "bank2" )->set_base( machine.root_device().memregion("vram")->base() + ( (state->m_ram_bank&0x3) * 0x4000 )); // window 0
153   state->membank( "bank3" )->set_base( state->memregion("vram")->base() + ( ((state->m_ram_bank&0xC)>>2) * 0x4000 )); // window 1
155   membank( "bank2" )->set_base( machine().root_device().memregion("vram")->base() + ( (m_ram_bank&0x3) * 0x4000 )); // window 0
156   membank( "bank3" )->set_base( memregion("vram")->base() + ( ((m_ram_bank&0xC)>>2) * 0x4000 )); // window 1
154157}
155158
156static void socrates_update_kb( running_machine &machine )
159void socrates_state::socrates_update_kb(  )
157160{
158   socrates_state *state = machine.driver_data<socrates_state>();
159161   static const char *const rownames[] = { "keyboard_40", "keyboard_41", "keyboard_42", "keyboard_43", "keyboard_44" };
160162   int row, keyvalue, powerof2;
161163   int shift = 0;
162164   // first check that the kb latch[1] is clear; if it isn't, don't touch it!
163   if ((state->m_kb_latch_low[1] != 0) || (state->m_kb_latch_high[1] != 1)) return;
165   if ((m_kb_latch_low[1] != 0) || (m_kb_latch_high[1] != 1)) return;
164166   // next check for joypad buttons
165   keyvalue = machine.root_device().ioport("keyboard_jp")->read();
167   keyvalue = machine().root_device().ioport("keyboard_jp")->read();
166168   if (keyvalue != 0)
167169   {
168      state->m_kb_latch_low[1] = (keyvalue & 0xFF0)>>4;
169      state->m_kb_latch_high[1] = 0x80 | (keyvalue & 0xF);
170      m_kb_latch_low[1] = (keyvalue & 0xFF0)>>4;
171      m_kb_latch_high[1] = 0x80 | (keyvalue & 0xF);
170172      return; // get out of this function; due to the way key priorities work, we're done here.
171173   }
172174   // next check for mouse movement.
173175   // this isn't written yet, so write me please!
174176   // next check if shift is down
175   shift = machine.root_device().ioport("keyboard_50")->read();
177   shift = machine().root_device().ioport("keyboard_50")->read();
176178   // find key low and high byte ok keyboard section
177179   for (row = 4; row>=0; row--)
178180   {
179      keyvalue = machine.root_device().ioport(rownames[row])->read();
181      keyvalue = machine().root_device().ioport(rownames[row])->read();
180182      if (keyvalue != 0)
181183      {
182184         for (powerof2 = 9; powerof2 >= 0; powerof2--)
183185         {
184186            if ((keyvalue&(1<<powerof2)) == (1<<powerof2))
185187            {
186               state->m_kb_latch_low[1] = (shift?0x50:0x40)+row;
187               state->m_kb_latch_high[1] = (0x80 | powerof2);
188               m_kb_latch_low[1] = (shift?0x50:0x40)+row;
189               m_kb_latch_high[1] = (0x80 | powerof2);
188190               return; // get out of the for loop; due to the way key priorities work, we're done here.
189191            }
190192         }
r21160r21161
193195   // no key was pressed... check if shift was hit then?
194196   if (shift != 0)
195197   {
196      state->m_kb_latch_low[1] = 0x50;
197      state->m_kb_latch_high[1] = 0x80;
198      m_kb_latch_low[1] = 0x50;
199      m_kb_latch_high[1] = 0x80;
198200   }
199201}
200202
201static void socrates_check_kb_latch( running_machine &machine ) // if kb[1] is full and kb[0] is not, shift [1] to [0] and clear [1]
203void socrates_state::socrates_check_kb_latch(  ) // if kb[1] is full and kb[0] is not, shift [1] to [0] and clear [1]
202204{
203   socrates_state *state = machine.driver_data<socrates_state>();
204   if (((state->m_kb_latch_low[1] != 0) || (state->m_kb_latch_high[1] != 1)) &&
205   ((state->m_kb_latch_low[0] == 0) && (state->m_kb_latch_high[0] == 1)))
205   if (((m_kb_latch_low[1] != 0) || (m_kb_latch_high[1] != 1)) &&
206   ((m_kb_latch_low[0] == 0) && (m_kb_latch_high[0] == 1)))
206207   {
207      state->m_kb_latch_low[0] = state->m_kb_latch_low[1];
208      state->m_kb_latch_low[1] = 0;
209      state->m_kb_latch_high[0] = state->m_kb_latch_high[1];
210      state->m_kb_latch_high[1] = 1;
208      m_kb_latch_low[0] = m_kb_latch_low[1];
209      m_kb_latch_low[1] = 0;
210      m_kb_latch_high[0] = m_kb_latch_high[1];
211      m_kb_latch_high[1] = 1;
211212   }
212213}
213214
214215void socrates_state::machine_reset()
215216{
216217   m_rom_bank = 0xF3; // actually set semi-randomly on real console but we need to initialize it somewhere...
217   socrates_set_rom_bank( machine() );
218   socrates_set_rom_bank();
218219   m_ram_bank = 0;  // the actual console sets it semi randomly on power up, and the bios cleans it up.
219   socrates_set_ram_bank( machine() );
220   socrates_set_ram_bank();
220221   m_kb_latch_low[0] = 0xFF;
221222   m_kb_latch_high[0] = 0x8F;
222223   m_kb_latch_low[1] = 0x00;
r21160r21161
253254WRITE8_MEMBER(socrates_state::socrates_rom_bank_w)
254255{
255256   m_rom_bank = data;
256   socrates_set_rom_bank(machine());
257   socrates_set_rom_bank();
257258}
258259
259260READ8_MEMBER(socrates_state::socrates_ram_bank_r)
r21160r21161
264265WRITE8_MEMBER(socrates_state::socrates_ram_bank_w)
265266{
266267   m_ram_bank = data&0xF;
267   socrates_set_ram_bank(machine());
268   socrates_set_ram_bank();
268269}
269270
270271READ8_MEMBER(socrates_state::read_f3)// used for read-only i/o ports as mame/mess doesn't have a way to set the unmapped area to read as 0xF3
r21160r21161
449450
450451READ8_MEMBER(socrates_state::socrates_keyboard_low_r)// keyboard code low
451452{
452   socrates_update_kb(machine());
453   socrates_check_kb_latch(machine());
453   socrates_update_kb();
454   socrates_check_kb_latch();
454455   return m_kb_latch_low[0];
455456}
456457
457458READ8_MEMBER(socrates_state::socrates_keyboard_high_r)// keyboard code high
458459{
459   socrates_update_kb(machine());
460   socrates_check_kb_latch(machine());
460   socrates_update_kb();
461   socrates_check_kb_latch();
461462   return m_kb_latch_high[0];
462463}
463464
r21160r21161
510511// gamma: this needs to be messed with... may differ on different systems... attach to slider somehow?
511512#define GAMMA 1.5
512513
513static rgb_t socrates_create_color(UINT8 color)
514rgb_t socrates_state::socrates_create_color(UINT8 color)
514515{
515516   rgb_t composedcolor;
516517   static const double lumatable[256] = {
trunk/src/mess/drivers/ng_aes.c
r21160r21161
210210   required_ioport m_io_ctrlsel;
211211
212212   void common_machine_start();
213   INT32 SekIdle(INT32 nCycles);
213214};
214215
215216
r21160r21161
688689
689690
690691
691static INT32 SekIdle(INT32 nCycles)
692INT32 ng_aes_state::SekIdle(INT32 nCycles)
692693{
693694   return nCycles;
694695}
trunk/src/mess/drivers/sgi_ip6.c
r21160r21161
4343   virtual void video_start();
4444   UINT32 screen_update_sgi_ip6(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4545   INTERRUPT_GEN_MEMBER(sgi_ip6_vbl);
46   inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... );
4647};
4748
4849
r21160r21161
5152#define ENABLE_VERBOSE_LOG (1)
5253
5354#if ENABLE_VERBOSE_LOG
54INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
55inline void ATTR_PRINTF(3,4) sgi_ip6_state::verboselog( int n_level, const char *s_fmt, ... )
5556{
5657   if( VERBOSE_LEVEL >= n_level )
5758   {
r21160r21161
6061      va_start( v, s_fmt );
6162      vsprintf( buf, s_fmt, v );
6263      va_end( v );
63      logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf);
64      logerror("%08x: %s", machine().device("maincpu")->safe_pc(), buf);
6465   }
6566}
6667#else
r21160r21161
9394      case 0x0000/4:
9495         if(ACCESSING_BITS_16_31)
9596         {
96            verboselog(machine(), 0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
97            verboselog(0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
9798         }
9899         if(ACCESSING_BITS_0_15)
99100         {
100            verboselog(machine(), 0, "ip6_unk1_r: Unknown Halfword 0: %08x & %08x\n", m_ip6_regs.unknown_half_0, mem_mask );
101            verboselog(0, "ip6_unk1_r: Unknown Halfword 0: %08x & %08x\n", m_ip6_regs.unknown_half_0, mem_mask );
101102            ret |= m_ip6_regs.unknown_half_0;
102103         }
103104         break;
104105      default:
105         verboselog(machine(), 0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
106         verboselog(0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
106107         break;
107108   }
108109   return ret;
r21160r21161
115116      case 0x0000/4:
116117         if(ACCESSING_BITS_16_31)
117118         {
118            verboselog(machine(), 0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
119            verboselog(0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
119120         }
120121         if(ACCESSING_BITS_0_15)
121122         {
122            verboselog(machine(), 0, "ip6_unk1_w: Unknown Halfword 0 = %04x & %04x\n", data & 0x0000ffff, mem_mask & 0x0000ffff );
123            verboselog(0, "ip6_unk1_w: Unknown Halfword 0 = %04x & %04x\n", data & 0x0000ffff, mem_mask & 0x0000ffff );
123124            m_ip6_regs.unknown_half_0 = data & 0x0000ffff;
124125         }
125126         break;
126127      default:
127         verboselog(machine(), 0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
128         verboselog(0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
128129         break;
129130   }
130131}
r21160r21161
137138      case 0x0000/4:
138139         if(!ACCESSING_BITS_24_31)
139140         {
140            verboselog(machine(), 0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
141            verboselog(0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
141142         }
142143         if(ACCESSING_BITS_24_31)
143144         {
144            verboselog(machine(), 0, "ip6_unk2_r: Unknown Byte 0 = %02x & %02x\n", m_ip6_regs.unknown_byte_0, mem_mask >> 24 );
145            verboselog(0, "ip6_unk2_r: Unknown Byte 0 = %02x & %02x\n", m_ip6_regs.unknown_byte_0, mem_mask >> 24 );
145146            ret |= m_ip6_regs.unknown_byte_0 << 24;
146147         }
147148         break;
148149      default:
149         verboselog(machine(), 0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
150         verboselog(0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask );
150151         break;
151152   }
152153   return ret;
r21160r21161
159160      case 0x0000/4:
160161         if(!ACCESSING_BITS_24_31)
161162         {
162            verboselog(machine(), 0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
163            verboselog(0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
163164         }
164165         if(ACCESSING_BITS_24_31)
165166         {
166            verboselog(machine(), 0, "ip6_unk2_w: Unknown Byte 0 = %02x & %02x\n", data >> 24, mem_mask >> 24 );
167            verboselog(0, "ip6_unk2_w: Unknown Byte 0 = %02x & %02x\n", data >> 24, mem_mask >> 24 );
167168            m_ip6_regs.unknown_byte_0 = (data & 0xff000000) >> 24;
168169         }
169170         break;
170171      default:
171         verboselog(machine(), 0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
172         verboselog(0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask );
172173         break;
173174   }
174175}
r21160r21161
178179   UINT32 ret = 0;
179180   if(ACCESSING_BITS_16_23)
180181   {
181      verboselog(machine(), 0, "ip6_unk3_r: Unknown Byte 1: %02x & %02x\n", m_ip6_regs.unknown_byte_1, (mem_mask >> 16) & 0x000000ff);
182      verboselog(0, "ip6_unk3_r: Unknown Byte 1: %02x & %02x\n", m_ip6_regs.unknown_byte_1, (mem_mask >> 16) & 0x000000ff);
182183      ret |= m_ip6_regs.unknown_byte_1 << 16;
183184   }
184185   else
185186   {
186      verboselog(machine(), 0, "ip6_unk3_r: Unknown address: %08x & %08x\n", 0x1fb00000 + (offset << 2), mem_mask );
187      verboselog(0, "ip6_unk3_r: Unknown address: %08x & %08x\n", 0x1fb00000 + (offset << 2), mem_mask );
187188   }
188189   return ret;
189190}
190191
191192WRITE32_MEMBER(sgi_ip6_state::ip6_unk3_w)
192193{
193   verboselog(machine(), 0, "ip6_unk3_w: Unknown address: %08x = %08x & %08x\n", 0x1fb00000 + (offset << 2), data, mem_mask );
194   verboselog(0, "ip6_unk3_w: Unknown address: %08x = %08x & %08x\n", 0x1fb00000 + (offset << 2), data, mem_mask );
194195}
195196
196197INTERRUPT_GEN_MEMBER(sgi_ip6_state::sgi_ip6_vbl)
trunk/src/mess/drivers/apc.c
r21160r21161
157157
158158   virtual void video_start();
159159   virtual void palette_init();
160   inline void set_dma_channel(int channel, int state);
160161};
161162
162163void apc_state::video_start()
r21160r21161
955956   program.write_byte(addr, data);
956957}
957958
958static void set_dma_channel(running_machine &machine, int channel, int state)
959inline void apc_state::set_dma_channel(int channel, int state)
959960{
960   apc_state *drvstate = machine.driver_data<apc_state>();
961   if (!state) drvstate->m_dack = channel;
961   if (!state) m_dack = channel;
962962}
963963
964WRITE_LINE_MEMBER(apc_state::apc_dack0_w){ /*printf("%02x 0\n",state);*/ set_dma_channel(machine(), 0, state); }
965WRITE_LINE_MEMBER(apc_state::apc_dack1_w){ /*printf("%02x 1\n",state);*/ set_dma_channel(machine(), 1, state); }
966WRITE_LINE_MEMBER(apc_state::apc_dack2_w){ /*printf("%02x 2\n",state);*/ set_dma_channel(machine(), 2, state); }
967WRITE_LINE_MEMBER(apc_state::apc_dack3_w){ /*printf("%02x 3\n",state);*/ set_dma_channel(machine(), 3, state); }
964WRITE_LINE_MEMBER(apc_state::apc_dack0_w){ /*printf("%02x 0\n",state);*/ set_dma_channel(0, state); }
965WRITE_LINE_MEMBER(apc_state::apc_dack1_w){ /*printf("%02x 1\n",state);*/ set_dma_channel(1, state); }
966WRITE_LINE_MEMBER(apc_state::apc_dack2_w){ /*printf("%02x 2\n",state);*/ set_dma_channel(2, state); }
967WRITE_LINE_MEMBER(apc_state::apc_dack3_w){ /*printf("%02x 3\n",state);*/ set_dma_channel(3, state); }
968968
969969READ8_MEMBER(apc_state::fdc_r)
970970{
trunk/src/mess/drivers/supercon.c
r21160r21161
117117   required_ioport m_board_7;
118118   required_ioport m_board_8;
119119   void mouse_update();
120   int get_first_cleared_bit(UINT8 data);
121   int get_first_bit(UINT8 data);
120122};
121123
122124
r21160r21161
199201   }
200202}
201203
202static int get_first_cleared_bit(UINT8 data)
204int supercon_state::get_first_cleared_bit(UINT8 data)
203205{
204206   int i;
205207
r21160r21161
210212   return NOT_VALID;
211213}
212214
213static int get_first_bit(UINT8 data)
215int supercon_state::get_first_bit(UINT8 data)
214216{
215217   int i;
216218
trunk/src/mess/drivers/craft.c
r21160r21161
1313#define ENABLE_VERBOSE_LOG (0)
1414
1515#if ENABLE_VERBOSE_LOG
16INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, ...)
16inline void craft_state::verboselog(int n_level, const char *s_fmt, ...)
1717{
1818   if( VERBOSE_LEVEL >= n_level )
1919   {
r21160r21161
2222      va_start( v, s_fmt );
2323      vsprintf( buf, s_fmt, v );
2424      va_end( v );
25      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
25      logerror( "%08x: %s", machine().device("maincpu")->safe_pc(), buf );
2626   }
2727}
2828#else
r21160r21161
7676   DECLARE_DRIVER_INIT(craft);
7777   virtual void machine_reset();
7878   UINT32 screen_update_craft(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
79#if ENABLE_VERBOSE_LOG   
80   inline void verboselog(int n_level, const char *s_fmt, ...);
81#endif   
7982};
8083
8184void craft_state::machine_start()
trunk/src/mess/drivers/vk100.c
r21160r21161
204204   DECLARE_WRITE_LINE_MEMBER(i8251_rxrdy_int);
205205   DECLARE_WRITE_LINE_MEMBER(i8251_txrdy_int);
206206   DECLARE_WRITE_LINE_MEMBER(i8251_rts);
207   UINT8 vram_read();
208   void vram_write(UINT8 data);
207209};
208210
209211// vram access functions:
r21160r21161
228230    */
229231
230232// returns one nybble from vram array based on X and Y regs
231static UINT8 vram_read(running_machine &machine)
233UINT8 vk100_state::vram_read()
232234{
233   vk100_state *state = machine.driver_data<vk100_state>();
234235   // XFinal is (X'&0x3FC)|(X&0x3)
235   UINT16 XFinal = state->m_trans[(state->m_vgX&0x3FC)>>2]<<2|(state->m_vgX&0x3); // appears correct
236   UINT16 XFinal = m_trans[(m_vgX&0x3FC)>>2]<<2|(m_vgX&0x3); // appears correct
236237   // EA is the effective ram address for a 16-bit block
237   UINT16 EA = ((state->m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct
238   UINT16 EA = ((m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct
238239   // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte)
239   UINT16 block = state->m_vram[(EA<<1)+1] | (state->m_vram[(EA<<1)]<<8);
240   UINT16 block = m_vram[(EA<<1)+1] | (m_vram[(EA<<1)]<<8);
240241   // nybbleNum is which of the four nybbles within the block to address. should NEVER be 3!
241242   UINT8 nybbleNum = (XFinal&0xC)>>2;
242243   return (block>>(4*nybbleNum))&0xF;
243244}
244245
245static void vram_write(running_machine &machine, UINT8 data)
246void vk100_state::vram_write(UINT8 data)
246247{
247   vk100_state *state = machine.driver_data<vk100_state>();
248248   // XFinal is (X'&0x3FC)|(X&0x3)
249   UINT16 XFinal = state->m_trans[(state->m_vgX&0x3FC)>>2]<<2|(state->m_vgX&0x3); // appears correct
249   UINT16 XFinal = m_trans[(m_vgX&0x3FC)>>2]<<2|(m_vgX&0x3); // appears correct
250250   // EA is the effective ram address for a 16-bit block
251   UINT16 EA = ((state->m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct
251   UINT16 EA = ((m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct
252252   // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte)
253   UINT16 block = state->m_vram[(EA<<1)+1] | (state->m_vram[(EA<<1)]<<8);
253   UINT16 block = m_vram[(EA<<1)+1] | (m_vram[(EA<<1)]<<8);
254254   // nybbleNum is which of the four nybbles within the block to address. should NEVER be 3!
255255   UINT8 nybbleNum = (XFinal&0xC)>>2;
256256   block &= ~((UINT16)0xF<<(nybbleNum*4)); // mask out the part we want to replace
257257   block |= data<<(nybbleNum*4); // write the new part
258258   // NOTE: this next part may have to be made conditional on VG_MODE
259259   // check if the attribute nybble is supposed to be modified, and if so do so
260   if (state->VG_WOPS&0x08) block = (block&0x0FFF)|(((UINT16)state->VG_WOPS&0xF0)<<8);
261   state->m_vram[(EA<<1)+1] = block&0xFF; // write block back to vram
262   state->m_vram[(EA<<1)] = (block&0xFF00)>>8; // ''
260   if (VG_WOPS&0x08) block = (block&0x0FFF)|(((UINT16)VG_WOPS&0xF0)<<8);
261   m_vram[(EA<<1)+1] = block&0xFF; // write block back to vram
262   m_vram[(EA<<1)] = (block&0xFF00)>>8; // ''
263263}
264264
265265TIMER_CALLBACK_MEMBER(vk100_state::execute_vg)
266266{
267   UINT8 thisNyb = vram_read(machine()); // read in the nybble
267   UINT8 thisNyb = vram_read(); // read in the nybble
268268   // pattern rom addressing is a complex mess. see the pattern rom def later in this file.
269269   UINT8 newNyb = m_pattern[((m_vgPAT&m_vgPAT_Mask)?0x200:0)|((VG_WOPS&7)<<6)|((m_vgX&3)<<4)|thisNyb]; // calculate new nybble based on pattern rom
270270   // finally write the block back to ram depending on the VG_MODE (sort of a hack until we get the vector and synd and dir roms all hooked up)
r21160r21161
275275      case 1: // dot: only write the LAST pixel in the chain? TODO: some fallthrough magic here?
276276         if ((m_vgDownCount) == 0x00)
277277         {
278            vram_write(machine(), newNyb); // write out the modified nybble
278            vram_write(newNyb); // write out the modified nybble
279279         }
280280         break;
281281      case 2: // vec: draw the vector
282            vram_write(machine(), newNyb); // write out the modified nybble
282            vram_write(newNyb); // write out the modified nybble
283283         break;
284284      case 3: // er: erase: special case here: wipe the entire screen (except for color/attrib?) and then set done.
285285         for (int i = 0; i < 0x8000; i++)
r21160r21161
576576#ifdef SYSTAT_A_VERBOSE
577577   if (m_maincpu->pc() != 0x31D) logerror("0x%04X: SYSTAT_A Read!\n", m_maincpu->pc());
578578#endif
579   return ((m_vgGO?0:1)<<7)|(vram_read(machine())<<3)|(((m_dipsw->read()>>dipswitchLUT[offset])&1)?0x4:0)|(m_vsync?0x2:0);
579   return ((m_vgGO?0:1)<<7)|(vram_read()<<3)|(((m_dipsw->read()>>dipswitchLUT[offset])&1)?0x4:0)|(m_vsync?0x2:0);
580580}
581581
582582/* port 0x48: "SYSTAT B"; NOT documented in the tech manual at all.
trunk/src/mess/drivers/juicebox.c
r21160r21161
1818
1919#define VERBOSE_LEVEL ( 0 )
2020
21INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...)
22{
23   if (VERBOSE_LEVEL >= n_level)
24   {
25      va_list v;
26      char buf[32768];
27      va_start( v, s_fmt);
28      vsprintf( buf, s_fmt, v);
29      va_end( v);
30      logerror( "%s: %s", machine.describe_context(), buf);
31   }
32}
33
3421struct smc_t
3522{
3623   int add_latch;
r21160r21161
6047   virtual void machine_start();
6148   virtual void machine_reset();
6249   DECLARE_INPUT_CHANGED_MEMBER(port_changed);
50   inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ...);
51   void smc_reset( );
52   void smc_init( );
53   UINT8 smc_read( );
54   void smc_write( UINT8 data);
6355};
6456
57inline void ATTR_PRINTF(3,4)  juicebox_state::verboselog( int n_level, const char *s_fmt, ...)
58{
59   if (VERBOSE_LEVEL >= n_level)
60   {
61      va_list v;
62      char buf[32768];
63      va_start( v, s_fmt);
64      vsprintf( buf, s_fmt, v);
65      va_end( v);
66      logerror( "%s: %s", machine().describe_context(), buf);
67   }
68}
69
70
6571/***************************************************************************
6672    MACHINE HARDWARE
6773***************************************************************************/
r21160r21161
6975
7076// SMARTMEDIA
7177
72static void smc_reset( running_machine &machine)
78void juicebox_state::smc_reset( )
7379{
74   juicebox_state *state = machine.driver_data<juicebox_state>();
75   verboselog( machine, 5, "smc_reset\n");
76   state->smc.add_latch = 0;
77   state->smc.cmd_latch = 0;
80   verboselog(5, "smc_reset\n");
81   smc.add_latch = 0;
82   smc.cmd_latch = 0;
7883}
7984
80static void smc_init( running_machine &machine)
85void juicebox_state::smc_init( )
8186{
82   verboselog( machine, 5, "smc_init\n");
83   smc_reset( machine);
87   verboselog(5, "smc_init\n");
88   smc_reset();
8489}
8590
86static UINT8 smc_read( running_machine &machine)
91UINT8 juicebox_state::smc_read( )
8792{
88   smartmedia_image_device *smartmedia = machine.device<smartmedia_image_device>( "smartmedia");
93   smartmedia_image_device *smartmedia = machine().device<smartmedia_image_device>( "smartmedia");
8994   UINT8 data;
9095   if (smartmedia->is_present())
9196   {
r21160r21161
95100   {
96101      data = 0xFF;
97102   }
98   verboselog( machine, 5, "smc_read %08X\n", data);
103   verboselog(5, "smc_read %08X\n", data);
99104   return data;
100105}
101106
102static void smc_write( running_machine &machine, UINT8 data)
107void juicebox_state::smc_write( UINT8 data)
103108{
104   juicebox_state *state = machine.driver_data<juicebox_state>();
105   smartmedia_image_device *smartmedia = machine.device<smartmedia_image_device>( "smartmedia");
106   verboselog( machine, 5, "smc_write %08X\n", data);
109   smartmedia_image_device *smartmedia = machine().device<smartmedia_image_device>( "smartmedia");
110   verboselog(5, "smc_write %08X\n", data);
107111   if (smartmedia->is_present())
108112   {
109      if (state->smc.cmd_latch)
113      if (smc.cmd_latch)
110114      {
111         verboselog( machine, 5, "smartmedia_command_w %08X\n", data);
115         verboselog(5, "smartmedia_command_w %08X\n", data);
112116         smartmedia->command_w(data);
113117      }
114      else if (state->smc.add_latch)
118      else if (smc.add_latch)
115119      {
116         verboselog( machine, 5, "smartmedia_address_w %08X\n", data);
120         verboselog(5, "smartmedia_address_w %08X\n", data);
117121         smartmedia->address_w(data);
118122      }
119123      else
120124      {
121         verboselog( machine, 5, "smartmedia_data_w %08X\n", data);
125         verboselog(5, "smartmedia_data_w %08X\n", data);
122126         smartmedia->data_w(data);
123127      }
124128   }
r21160r21161
201205      {
202206         juicebox->smc.cmd_latch = ((data & 0x00000020) != 0);
203207         juicebox->smc.add_latch = ((data & 0x00000040) != 0);
204         verboselog( device->machine(), 5, "s3c44b0_gpio_port_w - nand cle %d ale %d\n", (data & 0x20) ? 1 : 0, (data & 0x40) ? 1 : 0);
208         juicebox->verboselog( 5, "s3c44b0_gpio_port_w - nand cle %d ale %d\n", (data & 0x20) ? 1 : 0, (data & 0x40) ? 1 : 0);
205209      }
206210      break;
207211   }
r21160r21161
212216READ32_MEMBER(juicebox_state::juicebox_nand_r)
213217{
214218   UINT32 data = 0;
215   if (mem_mask & 0x000000FF) data = data | (smc_read(machine()) <<  0);
216   if (mem_mask & 0x0000FF00) data = data | (smc_read(machine()) <<  8);
217   if (mem_mask & 0x00FF0000) data = data | (smc_read(machine()) << 16);
218   if (mem_mask & 0xFF000000) data = data | (smc_read(machine()) << 24);
219   verboselog( machine(), 5, "juicebox_nand_r %08X %08X %08X\n", offset, mem_mask, data);
219   if (mem_mask & 0x000000FF) data = data | (smc_read() <<  0);
220   if (mem_mask & 0x0000FF00) data = data | (smc_read() <<  8);
221   if (mem_mask & 0x00FF0000) data = data | (smc_read() << 16);
222   if (mem_mask & 0xFF000000) data = data | (smc_read() << 24);
223   verboselog( 5, "juicebox_nand_r %08X %08X %08X\n", offset, mem_mask, data);
220224   return data;
221225}
222226
223227WRITE32_MEMBER(juicebox_state::juicebox_nand_w)
224228{
225   verboselog( machine(), 5, "juicebox_nand_w %08X %08X %08X\n", offset, mem_mask, data);
226   if (mem_mask & 0x000000FF) smc_write(machine(), (data >>  0) & 0xFF);
227   if (mem_mask & 0x0000FF00) smc_write(machine(), (data >>  8) & 0xFF);
228   if (mem_mask & 0x00FF0000) smc_write(machine(), (data >> 16) & 0xFF);
229   if (mem_mask & 0xFF000000) smc_write(machine(), (data >> 24) & 0xFF);
229   verboselog( 5, "juicebox_nand_w %08X %08X %08X\n", offset, mem_mask, data);
230   if (mem_mask & 0x000000FF) smc_write((data >>  0) & 0xFF);
231   if (mem_mask & 0x0000FF00) smc_write((data >>  8) & 0xFF);
232   if (mem_mask & 0x00FF0000) smc_write((data >> 16) & 0xFF);
233   if (mem_mask & 0xFF000000) smc_write((data >> 24) & 0xFF);
230234}
231235
232236// I2S
r21160r21161
249253void juicebox_state::machine_start()
250254{
251255   s3c44b0 = machine().device( "s3c44b0");
252   smc_init( machine());
256   smc_init();
253257   dac = machine().device<dac_device>( "dac");
254258}
255259
256260void juicebox_state::machine_reset()
257261{
258262   machine().device("maincpu")->reset();
259   smc_reset( machine());
263   smc_reset();
260264}
261265
262266/***************************************************************************
trunk/src/mess/drivers/ssem.c
r21160r21161
2525   UINT32 screen_update_ssem(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
2626   DECLARE_INPUT_CHANGED_MEMBER(panel_check);
2727   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ssem_store);
28   inline UINT32 reverse(UINT32 v);
29   void glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...);
30   void strlower(char *buf);
2831};
2932
3033
r21160r21161
3740// The de facto snapshot format for other SSEM simulators stores the data physically in that format as well.
3841// Therefore, in MESS, every 32-bit word has its bits reversed, too, and as a result the values must be
3942// un-reversed before being used.
40INLINE UINT32 reverse(UINT32 v)
43inline UINT32 ssem_state::reverse(UINT32 v)
4144{
4245   // Taken from http://www-graphics.stanford.edu/~seander/bithacks.html#ReverseParallel
4346   // swap odd and even bits
r21160r21161
396399   { 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff },
397400};
398401
399static void glyph_print(running_machine &machine, bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...)
402void ssem_state::glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...)
400403{
401404   va_list arg_list;
402405   char buf[32768];
403406   INT32 index = 0;
404   screen_device *screen = machine.first_screen();
407   screen_device *screen = machine().first_screen();
405408   const rectangle &visarea = screen->visible_area();
406409
407410   va_start( arg_list, msg );
r21160r21161
463466      {
464467         if(word & (1 << (31 - bit)))
465468         {
466            glyph_print(machine(), bitmap, bit << 3, line << 3, "%c", line == m_store_line ? 4 : 2);
469            glyph_print(bitmap, bit << 3, line << 3, "%c", line == m_store_line ? 4 : 2);
467470         }
468471         else
469472         {
470            glyph_print(machine(), bitmap, bit << 3, line << 3, "%c", line == m_store_line ? 3 : 1);
473            glyph_print(bitmap, bit << 3, line << 3, "%c", line == m_store_line ? 3 : 1);
471474         }
472475      }
473476   }
r21160r21161
476479   {
477480      if(accum & (1 << bit))
478481      {
479         glyph_print(machine(), bitmap, bit << 3, 264, "%c", 2);
482         glyph_print(bitmap, bit << 3, 264, "%c", 2);
480483      }
481484      else
482485      {
483         glyph_print(machine(), bitmap, bit << 3, 264, "%c", 1);
486         glyph_print(bitmap, bit << 3, 264, "%c", 1);
484487      }
485488   }
486489
r21160r21161
488491               (m_store[(m_store_line << 2) | 1] << 16) |
489492               (m_store[(m_store_line << 2) | 2] <<  8) |
490493               (m_store[(m_store_line << 2) | 3] <<  0));
491   glyph_print(machine(), bitmap, 0, 272, "LINE:%02d  VALUE:%08x  HALT:%d", m_store_line, word, ssem_cpu->state().state_int(SSEM_HALT));
494   glyph_print(bitmap, 0, 272, "LINE:%02d  VALUE:%08x  HALT:%d", m_store_line, word, ssem_cpu->state().state_int(SSEM_HALT));
492495   return 0;
493496}
494497
r21160r21161
496499* Image helper functions                             *
497500\****************************************************/
498501
499static void strlower(char *buf)
502void ssem_state::strlower(char *buf)
500503{
501504   if(buf)
502505   {
trunk/src/mess/drivers/pasogo.c
r21160r21161
7474   TIMER_DEVICE_CALLBACK_MEMBER(vg230_timer);
7575   DECLARE_WRITE_LINE_MEMBER(pasogo_pic8259_set_int_line);
7676   IRQ_CALLBACK_MEMBER(pasogo_irq_callback);
77   void vg230_reset();
78   void vg230_init();
7779};
7880
7981
r21160r21161
107109   }
108110}
109111
110static void vg230_reset(running_machine &machine)
112void pasogo_state::vg230_reset()
111113{
112   pasogo_state *state = machine.driver_data<pasogo_state>();
113   vg230_t *vg230 = &state->m_vg230;
114   vg230_t *vg230 = &m_vg230;
114115   system_time systime;
115116
116117   memset(vg230, 0, sizeof(*vg230));
117118   vg230->pmu.write_protected=TRUE;
118   machine.base_datetime(systime);
119   machine().base_datetime(systime);
119120
120121   vg230->rtc.seconds= systime.local_time.second;
121122   vg230->rtc.minutes= systime.local_time.minute;
r21160r21161
125126   vg230->bios_timer.data=0x7200; // HACK
126127}
127128
128static void vg230_init(running_machine &machine)
129void pasogo_state::vg230_init()
129130{
130   vg230_reset(machine);
131   vg230_reset();
131132}
132133
133134
r21160r21161
547548
548549DRIVER_INIT_MEMBER(pasogo_state,pasogo)
549550{
550   vg230_init(machine());
551   vg230_init();
551552   memset(&m_ems, 0, sizeof(m_ems));
552553   membank( "bank27" )->set_base( machine().root_device().memregion("user1")->base() + 0x00000 );
553554   membank( "bank28" )->set_base( memregion("maincpu")->base() + 0xb8000/*?*/ );
trunk/src/mess/drivers/mini2440.c
r21160r21161
1313
1414#define VERBOSE_LEVEL ( 0 )
1515
16INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...)
17{
18   if (VERBOSE_LEVEL >= n_level)
19   {
20      va_list v;
21      char buf[32768];
22      va_start( v, s_fmt);
23      vsprintf( buf, s_fmt, v);
24      va_end( v);
25      logerror( "%s: %s", machine.describe_context(), buf);
26   }
27}
28
2916class mini2440_state : public driver_device
3017{
3118public:
r21160r21161
5340   virtual void machine_start();
5441   virtual void machine_reset();
5542   DECLARE_INPUT_CHANGED_MEMBER(mini2440_input_changed);
43   inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ...);
5644};
5745
46inline void ATTR_PRINTF(3,4) mini2440_state::verboselog( int n_level, const char *s_fmt, ...)
47{
48   if (VERBOSE_LEVEL >= n_level)
49   {
50      va_list v;
51      char buf[32768];
52      va_start( v, s_fmt);
53      vsprintf( buf, s_fmt, v);
54      va_end( v);
55      logerror( "%s: %s", machine().describe_context(), buf);
56   }
57}
58
5859/***************************************************************************
5960    MACHINE HARDWARE
6061***************************************************************************/
r21160r21161
8788   {
8889      case S3C2440_GPIO_PORT_B :
8990      {
90         verboselog( device->machine(), 5,  "LED %d %d %d %d\n", BIT( data, 5), BIT( data, 6), BIT( data, 7), BIT( data, 8));
91         state->verboselog(5,  "LED %d %d %d %d\n", BIT( data, 5), BIT( data, 6), BIT( data, 7), BIT( data, 8));
9192      }
9293      break;
9394   }
r21160r21161
166167      case 2 + 0 : data = state->m_penx->read(); break;
167168      case 2 + 1 : data = 915 - state->m_peny->read() + 90; break;
168169   }
169   verboselog( space.machine(), 5,  "s3c2440_adc_data_r %08X\n", data);
170   state->verboselog(5,  "s3c2440_adc_data_r %08X\n", data);
170171   return data;
171172}
172173
trunk/src/mess/drivers/pc8801.c
r21160r21161
484484   DECLARE_READ8_MEMBER(opn_porta_r);
485485   DECLARE_READ8_MEMBER(opn_portb_r);
486486   IRQ_CALLBACK_MEMBER(pc8801_irq_callback);
487   void pc8801_raise_irq(UINT8 irq,UINT8 state);
487488};
488489
489490
r21160r21161
22682269};
22692270
22702271#ifdef USE_PROPER_I8214
2271void pc8801_raise_irq(running_machine &machine,UINT8 irq,UINT8 state)
2272void pc8801_state::pc8801_raise_irq(UINT8 irq,UINT8 state)
22722273{
2273   pc8801_state *drvstate = machine.driver_data<pc8801_state>();
22742274   if(state)
22752275   {
2276      drvstate->m_int_state |= irq;
2276      drvm_int_state |= irq;
22772277
2278      drvstate->m_pic->r_w(~irq);
2278      drvm_pic->r_w(~irq);
22792279
22802280      m_maincpu->set_input_line(0,ASSERT_LINE);
22812281   }
22822282   else
22832283   {
2284      //drvstate->m_int_state &= ~irq;
2284      //drvm_int_state &= ~irq;
22852285
22862286      //m_maincpu->set_input_line(0,CLEAR_LINE);
22872287   }
trunk/src/mess/drivers/n64.c
r21160r21161
2525   DECLARE_MACHINE_START(n64dd);
2626   INTERRUPT_GEN_MEMBER(n64_reset_poll);
2727   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(n64_cart);
28   void mempak_format(UINT8* pak);
2829};
2930
3031READ32_MEMBER(n64_mess_state::dd_null_r)
r21160r21161
141142   62500000            /* system clock */
142143};
143144
144static void mempak_format(UINT8* pak)
145void n64_mess_state::mempak_format(UINT8* pak)
145146{
146147   unsigned char pak_header[] =
147148   {
trunk/src/mess/drivers/ti990_10.c
r21160r21161
9090   virtual void video_start();
9191   UINT32 screen_update_ti990_10(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9292   INTERRUPT_GEN_MEMBER(ti990_10_line_interrupt);
93   void idle_callback(int state);
9394};
9495
9596
r21160r21161
115116}
116117
117118#ifdef UNUSED_FUNCTION
118static void idle_callback(int state)
119void ti990_10_state::idle_callback(int state)
119120{
120121}
121122#endif
trunk/src/mess/drivers/scv.c
r21160r21161
8282   required_memory_region m_charrom;
8383
8484   void scv_set_banks();
85   inline void plot_sprite_part( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 pat, UINT8 col, UINT8 screen_sprite_start_line );
86   inline void draw_sprite( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y, UINT8 screen_sprite_start_line );
87   inline void draw_text( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 *char_data, UINT8 fg, UINT8 bg );
88   inline void draw_semi_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 data, UINT8 fg );
89   inline void draw_block_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 col );
8590};
8691
8792
r21160r21161
469474}
470475
471476
472INLINE void plot_sprite_part( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 pat, UINT8 col, UINT8 screen_sprite_start_line )
477inline void scv_state::plot_sprite_part( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 pat, UINT8 col, UINT8 screen_sprite_start_line )
473478{
474479   if ( x < 4 )
475480   {
r21160r21161
500505}
501506
502507
503INLINE void draw_sprite( scv_state *state, bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y, UINT8 screen_sprite_start_line )
508inline void scv_state::draw_sprite( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y, UINT8 screen_sprite_start_line )
504509{
505510   int j;
506511
507512   y += clip_y * 2;
508513   for ( j = clip_y * 4; j < 32; j += 4 )
509514   {
510      UINT8 pat0 = state->m_videoram[ tile_idx * 32 + j + 0 ];
511      UINT8 pat1 = state->m_videoram[ tile_idx * 32 + j + 1 ];
512      UINT8 pat2 = state->m_videoram[ tile_idx * 32 + j + 2 ];
513      UINT8 pat3 = state->m_videoram[ tile_idx * 32 + j + 3 ];
515      UINT8 pat0 = m_videoram[ tile_idx * 32 + j + 0 ];
516      UINT8 pat1 = m_videoram[ tile_idx * 32 + j + 1 ];
517      UINT8 pat2 = m_videoram[ tile_idx * 32 + j + 2 ];
518      UINT8 pat3 = m_videoram[ tile_idx * 32 + j + 3 ];
514519
515520      if ( ( top && j < 16 ) || ( bottom && j >= 16 ) )
516521      {
r21160r21161
542547}
543548
544549
545INLINE void draw_text( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 *char_data, UINT8 fg, UINT8 bg )
550inline void scv_state::draw_text( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 *char_data, UINT8 fg, UINT8 bg )
546551{
547552   int i;
548553
r21160r21161
575580}
576581
577582
578INLINE void draw_semi_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 data, UINT8 fg )
583inline void scv_state::draw_semi_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 data, UINT8 fg )
579584{
580585   int i;
581586
r21160r21161
592597}
593598
594599
595INLINE void draw_block_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 col )
600inline void scv_state::draw_block_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 col )
596601{
597602   int i;
598603
r21160r21161
750755         if ( ( m_videoram[0x1400] & 0x20 ) && ( i & 0x20 ) )
751756         {
752757            /* 2 color sprite handling */
753            draw_sprite( this, bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip, screen_start_sprite_line );
758            draw_sprite( bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip, screen_start_sprite_line );
754759            if ( x_32 || y_32 )
755760            {
756761               static const UINT8 spr_2col_lut0[16] = { 0, 15, 12, 13, 10, 11,  8, 9, 6, 7,  4,  5, 2, 3,  1,  1 };
757762               static const UINT8 spr_2col_lut1[16] = { 0,  1,  8, 11,  2,  3, 10, 9, 4, 5, 12, 13, 6, 7, 14, 15 };
758763
759               draw_sprite( this, bitmap, spr_x, spr_y, tile_idx ^ ( 8 * x_32 + y_32 ), ( i & 0x40 ) ? spr_2col_lut1[col] : spr_2col_lut0[col], left, right, top, bottom, clip, screen_start_sprite_line );
764               draw_sprite( bitmap, spr_x, spr_y, tile_idx ^ ( 8 * x_32 + y_32 ), ( i & 0x40 ) ? spr_2col_lut1[col] : spr_2col_lut0[col], left, right, top, bottom, clip, screen_start_sprite_line );
760765            }
761766         }
762767         else
763768         {
764769            /* regular sprite handling */
765            draw_sprite( this, bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip, screen_start_sprite_line );
770            draw_sprite( bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip, screen_start_sprite_line );
766771            if ( x_32 )
767772            {
768               draw_sprite( this, bitmap, spr_x + 16, spr_y, tile_idx | 8, col, 1, 1, top, bottom, clip, screen_start_sprite_line );
773               draw_sprite( bitmap, spr_x + 16, spr_y, tile_idx | 8, col, 1, 1, top, bottom, clip, screen_start_sprite_line );
769774            }
770775
771776            if ( y_32 )
772777            {
773778               clip = ( clip & 0x08 ) ? ( clip & 0x07 ) : 0;
774               draw_sprite( this, bitmap, spr_x, spr_y + 16, tile_idx | 1, col, left, right, 1, 1, clip, screen_start_sprite_line );
779               draw_sprite( bitmap, spr_x, spr_y + 16, tile_idx | 1, col, left, right, 1, 1, clip, screen_start_sprite_line );
775780               if ( x_32 )
776781               {
777                  draw_sprite( this, bitmap, spr_x + 16, spr_y + 16, tile_idx | 9, col, 1, 1, 1, 1, clip, screen_start_sprite_line );
782                  draw_sprite( bitmap, spr_x + 16, spr_y + 16, tile_idx | 9, col, 1, 1, 1, 1, clip, screen_start_sprite_line );
778783               }
779784            }
780785         }
trunk/src/mess/drivers/ptcsol.c
r21160r21161
181181   DECLARE_DRIVER_INIT(sol20);
182182   TIMER_CALLBACK_MEMBER(sol20_cassette_tc);
183183   TIMER_CALLBACK_MEMBER(sol20_boot);
184   cassette_image_device *cassette_device_image();
184185};
185186
186187
187188/* timer to read cassette waveforms */
188189
189190
190static cassette_image_device *cassette_device_image(running_machine &machine)
191cassette_image_device *sol20_state::cassette_device_image()
191192{
192   sol20_state *state = machine.driver_data<sol20_state>();
193   if (state->m_sol20_fa & 0x40)
194      return machine.device<cassette_image_device>(CASSETTE2_TAG);
193   if (m_sol20_fa & 0x40)
194      return machine().device<cassette_image_device>(CASSETTE2_TAG);
195195   else
196      return machine.device<cassette_image_device>(CASSETTE_TAG);
196      return machine().device<cassette_image_device>(CASSETTE_TAG);
197197}
198198
199199
r21160r21161
210210
211211         m_cass_data.input.length++;
212212
213         cass_ws = ((cassette_device_image(machine()))->input() > +0.02) ? 1 : 0;
213         cass_ws = ((cassette_device_image())->input() > +0.02) ? 1 : 0;
214214
215215         if (cass_ws != m_cass_data.input.level)
216216         {
r21160r21161
239239            if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 4)))
240240            {
241241               m_cass_data.output.level ^= 1;          // toggle output this, except on 2nd half of low bit
242               cassette_device_image(machine())->output(m_cass_data.output.level ? -1.0 : +1.0);
242               cassette_device_image()->output(m_cass_data.output.level ? -1.0 : +1.0);
243243            }
244244         }
245245         return;
r21160r21161
248248         /* loading a tape */
249249         m_cass_data.input.length++;
250250
251         cass_ws = ((cassette_device_image(machine()))->input() > +0.02) ? 1 : 0;
251         cass_ws = ((cassette_device_image())->input() > +0.02) ? 1 : 0;
252252
253253         if (cass_ws != m_cass_data.input.level || m_cass_data.input.length == 10)
254254         {
r21160r21161
279279            if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 8)))
280280            {
281281               m_cass_data.output.level ^= 1;          // toggle output this, except on 2nd half of low bit
282               cassette_device_image(machine())->output(m_cass_data.output.level ? -1.0 : +1.0);
282               cassette_device_image()->output(m_cass_data.output.level ? -1.0 : +1.0);
283283            }
284284         }
285285         return;
trunk/src/mess/drivers/gizmondo.c
r21160r21161
3636
3737#define VERBOSE_LEVEL ( 0 )
3838
39INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...)
40{
41   if (VERBOSE_LEVEL >= n_level)
42   {
43      va_list v;
44      char buf[32768];
45      va_start( v, s_fmt);
46      vsprintf( buf, s_fmt, v);
47      va_end( v);
48      logerror( "%s: %s", machine.describe_context( ), buf);
49   }
50}
5139
5240#define BIT(x,n) (((x)>>(n))&1)
5341#define BITS(x,m,n) (((x)>>(n))&(((UINT32)1<<((m)-(n)+1))-1))
r21160r21161
6452   virtual void machine_start();
6553   virtual void machine_reset();
6654   DECLARE_INPUT_CHANGED_MEMBER(port_changed);
55   inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ...);
6756};
6857
58
59inline void ATTR_PRINTF(3,4) gizmondo_state::verboselog( int n_level, const char *s_fmt, ...)
60{
61   if (VERBOSE_LEVEL >= n_level)
62   {
63      va_list v;
64      char buf[32768];
65      va_start( v, s_fmt);
66      vsprintf( buf, s_fmt, v);
67      va_end( v);
68      logerror( "%s: %s", machine().describe_context( ), buf);
69   }
70}
6971/*******************************************************************************
7072    ...
7173*******************************************************************************/
trunk/src/mess/drivers/pc9801.c
r21160r21161
655655
656656   DECLARE_DRIVER_INIT(pc9801_kanji);
657657   IRQ_CALLBACK_MEMBER(irq_callback);
658   inline void set_dma_channel(int channel, int state);
658659};
659660
660661
r21160r21161
30363037   program.write_byte(addr, data);
30373038}
30383039
3039static void set_dma_channel(running_machine &machine, int channel, int state)
3040void pc9801_state::set_dma_channel(int channel, int state)
30403041{
3041   pc9801_state *drvstate = machine.driver_data<pc9801_state>();
3042   if (!state) drvstate->m_dack = channel;
3042   if (!state) m_dack = channel;
30433043}
30443044
3045WRITE_LINE_MEMBER(pc9801_state::pc9801_dack0_w){ /*printf("%02x 0\n",state);*/ set_dma_channel(machine(), 0, state); }
3046WRITE_LINE_MEMBER(pc9801_state::pc9801_dack1_w){ /*printf("%02x 1\n",state);*/ set_dma_channel(machine(), 1, state); }
3047WRITE_LINE_MEMBER(pc9801_state::pc9801_dack2_w){ /*printf("%02x 2\n",state);*/ set_dma_channel(machine(), 2, state); }
3048WRITE_LINE_MEMBER(pc9801_state::pc9801_dack3_w){ /*printf("%02x 3\n",state);*/ set_dma_channel(machine(), 3, state); }
3045WRITE_LINE_MEMBER(pc9801_state::pc9801_dack0_w){ /*printf("%02x 0\n",state);*/ set_dma_channel(0, state); }
3046WRITE_LINE_MEMBER(pc9801_state::pc9801_dack1_w){ /*printf("%02x 1\n",state);*/ set_dma_channel(1, state); }
3047WRITE_LINE_MEMBER(pc9801_state::pc9801_dack2_w){ /*printf("%02x 2\n",state);*/ set_dma_channel(2, state); }
3048WRITE_LINE_MEMBER(pc9801_state::pc9801_dack3_w){ /*printf("%02x 3\n",state);*/ set_dma_channel(3, state); }
30493049
30503050READ8_MEMBER(pc9801_state::fdc_2hd_r)
30513051{
trunk/src/mess/drivers/pockstat.c
r21160r21161
127127   TIMER_CALLBACK_MEMBER(timer_tick);
128128   TIMER_CALLBACK_MEMBER(rtc_tick);
129129   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( pockstat_flash );
130   inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... );
131   UINT32 ps_intc_get_interrupt_line(UINT32 line);
132   void ps_intc_set_interrupt_line(UINT32 line, int state);
133   void ps_timer_start(int index);
130134};
131135
132136
r21160r21161
157161#define ENABLE_VERBOSE_LOG  (0)
158162
159163#if ENABLE_VERBOSE_LOG
160INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
164inline void ATTR_PRINTF(3,4) pockstat_state::verboselog( int n_level, const char *s_fmt, ... )
161165{
162166   if( VERBOSE_LEVEL >= n_level )
163167   {
r21160r21161
166170      va_start( v, s_fmt );
167171      vsprintf( buf, s_fmt, v );
168172      va_end( v );
169      logerror( "%s: %s", machine.describe_context(), buf );
173      logerror( "%s: %s", machine().describe_context(), buf );
170174   }
171175}
172176#else
173177#define verboselog(x,y,z,...)
174178#endif
175179
176
177// Flash TLB
178
179
180
181// Interrupt Controller
182static UINT32 ps_intc_get_interrupt_line(running_machine &machine, UINT32 line);
183static void ps_intc_set_interrupt_line(running_machine &machine, UINT32 line, int state);
184
185
186
187// Timers
188
189static void ps_timer_start(running_machine &machine, int index);
190
191
192
193// Clock
194
195
196
197// RTC
198
199
200
201
202180#define PS_INT_BTN_ACTION       0x00000001 // "Action button"
203181#define PS_INT_BTN_RIGHT        0x00000002 // "Right button"
204182#define PS_INT_BTN_LEFT         0x00000004 // "Left button"
r21160r21161
222200   switch(offset)
223201   {
224202      case 0x0000/4:
225         verboselog(machine(), 0, "ps_ftlb_r: FlashROM TLB Control = %08x & %08x\n", m_ftlb_regs.control, mem_mask );
203         verboselog(0, "ps_ftlb_r: FlashROM TLB Control = %08x & %08x\n", m_ftlb_regs.control, mem_mask );
226204         return m_ftlb_regs.control | 1; // ???
227205      case 0x0004/4:
228         verboselog(machine(), 0, "ps_ftlb_r: Unknown (F_STAT) = %08x & %08x\n", m_ftlb_regs.stat, mem_mask );
206         verboselog(0, "ps_ftlb_r: Unknown (F_STAT) = %08x & %08x\n", m_ftlb_regs.stat, mem_mask );
229207         return m_ftlb_regs.stat;
230208      case 0x0008/4:
231         verboselog(machine(), 0, "ps_ftlb_r: FlashROM TLB Valid Tag = %08x & %08x\n", m_ftlb_regs.valid, mem_mask );
209         verboselog(0, "ps_ftlb_r: FlashROM TLB Valid Tag = %08x & %08x\n", m_ftlb_regs.valid, mem_mask );
232210         return m_ftlb_regs.valid;
233211      case 0x000c/4:
234         verboselog(machine(), 0, "ps_ftlb_r: Unknown (F_WAIT1) = %08x & %08x\n", m_ftlb_regs.wait1, mem_mask );
212         verboselog(0, "ps_ftlb_r: Unknown (F_WAIT1) = %08x & %08x\n", m_ftlb_regs.wait1, mem_mask );
235213         return m_ftlb_regs.wait1;
236214      case 0x0010/4:
237         verboselog(machine(), 0, "ps_ftlb_r: Unknown (F_WAIT2) = %08x & %08x\n", m_ftlb_regs.wait2 | 0x04, mem_mask );
215         verboselog(0, "ps_ftlb_r: Unknown (F_WAIT2) = %08x & %08x\n", m_ftlb_regs.wait2 | 0x04, mem_mask );
238216         return m_ftlb_regs.wait2 | 0x04;
239217      case 0x0100/4:
240218      case 0x0104/4:
r21160r21161
252230      case 0x0134/4:
253231      case 0x0138/4:
254232      case 0x013c/4:
255         verboselog(machine(), 0, "ps_ftlb_r: FlashROM TLB Entry %d = %08x & %08x\n", offset - 0x100/4, m_ftlb_regs.entry[offset - 0x100/4], mem_mask );
233         verboselog(0, "ps_ftlb_r: FlashROM TLB Entry %d = %08x & %08x\n", offset - 0x100/4, m_ftlb_regs.entry[offset - 0x100/4], mem_mask );
256234         return m_ftlb_regs.entry[offset - 0x100/4];
257235      case 0x0300/4:
258         verboselog(machine(), 0, "ps_ftlb_r: Unknown (F_SN) = %08x & %08x\n", m_ftlb_regs.serial, mem_mask );
236         verboselog(0, "ps_ftlb_r: Unknown (F_SN) = %08x & %08x\n", m_ftlb_regs.serial, mem_mask );
259237         return m_ftlb_regs.serial;
260238      default:
261         verboselog(machine(), 0, "ps_ftlb_r: Unknown Register %08x & %08x\n", 0x06000000 + (offset << 2), mem_mask );
239         verboselog(0, "ps_ftlb_r: Unknown Register %08x & %08x\n", 0x06000000 + (offset << 2), mem_mask );
262240         break;
263241   }
264242   return 0;
r21160r21161
269247   switch(offset)
270248   {
271249      case 0x0000/4:
272         verboselog(machine(), 0, "ps_ftlb_w: FlashROM TLB Control = %08x & %08x\n", data, mem_mask );
250         verboselog(0, "ps_ftlb_w: FlashROM TLB Control = %08x & %08x\n", data, mem_mask );
273251         COMBINE_DATA(&m_ftlb_regs.control);
274252         break;
275253      case 0x0004/4:
276         verboselog(machine(), 0, "ps_ftlb_w: Unknown (F_STAT) = %08x & %08x\n", data, mem_mask );
254         verboselog(0, "ps_ftlb_w: Unknown (F_STAT) = %08x & %08x\n", data, mem_mask );
277255         COMBINE_DATA(&m_ftlb_regs.stat);
278256         break;
279257      case 0x0008/4:
280         verboselog(machine(), 0, "ps_ftlb_w: FlashROM TLB Valid Tag = %08x & %08x\n", data, mem_mask );
258         verboselog(0, "ps_ftlb_w: FlashROM TLB Valid Tag = %08x & %08x\n", data, mem_mask );
281259         COMBINE_DATA(&m_ftlb_regs.valid);
282260         break;
283261      case 0x000c/4:
284         verboselog(machine(), 0, "ps_ftlb_w: Unknown (F_WAIT1) = %08x & %08x\n", data, mem_mask );
262         verboselog(0, "ps_ftlb_w: Unknown (F_WAIT1) = %08x & %08x\n", data, mem_mask );
285263         COMBINE_DATA(&m_ftlb_regs.wait1);
286264         break;
287265      case 0x0010/4:
288         verboselog(machine(), 0, "ps_ftlb_w: Unknown (F_WAIT2) = %08x & %08x\n", data, mem_mask );
266         verboselog(0, "ps_ftlb_w: Unknown (F_WAIT2) = %08x & %08x\n", data, mem_mask );
289267         COMBINE_DATA(&m_ftlb_regs.wait2);
290268         break;
291269      case 0x0100/4:
r21160r21161
304282      case 0x0134/4:
305283      case 0x0138/4:
306284      case 0x013c/4:
307         verboselog(machine(), 0, "ps_ftlb_w: FlashROM TLB Entry %d = %08x & %08x\n", offset - 0x100/4, data, mem_mask );
285         verboselog(0, "ps_ftlb_w: FlashROM TLB Entry %d = %08x & %08x\n", offset - 0x100/4, data, mem_mask );
308286         COMBINE_DATA(&m_ftlb_regs.entry[offset - 0x100/4]);
309287         break;
310288      case 0x0300/4:
311         verboselog(machine(), 0, "ps_ftlb_w: Unknown (F_SN) = %08x & %08x\n", data, mem_mask );
289         verboselog(0, "ps_ftlb_w: Unknown (F_SN) = %08x & %08x\n", data, mem_mask );
312290         COMBINE_DATA(&m_ftlb_regs.serial);
313291         break;
314292      default:
315         verboselog(machine(), 0, "ps_ftlb_w: Unknown Register %08x = %08x & %08x\n", 0x06000000 + (offset << 2), data, mem_mask );
293         verboselog(0, "ps_ftlb_w: Unknown Register %08x = %08x & %08x\n", 0x06000000 + (offset << 2), data, mem_mask );
316294         break;
317295   }
318296}
319297
320static UINT32 ps_intc_get_interrupt_line(running_machine &machine, UINT32 line)
298UINT32 pockstat_state::ps_intc_get_interrupt_line(UINT32 line)
321299{
322   pockstat_state *state = machine.driver_data<pockstat_state>();
323   return state->m_intc_regs.status & line;
300   return m_intc_regs.status & line;
324301}
325302
326static void ps_intc_set_interrupt_line(running_machine &machine, UINT32 line, int state)
303void pockstat_state::ps_intc_set_interrupt_line(UINT32 line, int state)
327304{
328   pockstat_state *drvstate = machine.driver_data<pockstat_state>();
329   //printf( "%08x %d %08x %08x %08x\n", line, state, drvstate->m_intc_regs.hold, drvstate->m_intc_regs.status, drvstate->m_intc_regs.enable );
305   //printf( "%08x %d %08x %08x %08x\n", line, state, drvm_intc_regs.hold, drvm_intc_regs.status, drvm_intc_regs.enable );
330306   if(line)
331307   {
332308      if(state)
333309      {
334         drvstate->m_intc_regs.status |= line & PS_INT_STATUS_MASK;
335         drvstate->m_intc_regs.hold |= line &~ PS_INT_STATUS_MASK;
336         //printf( " Setting %08x, status = %08x, hold = %08x\n", line, drvstate->m_intc_regs.status, drvstate->m_intc_regs.hold );
310         m_intc_regs.status |= line & PS_INT_STATUS_MASK;
311         m_intc_regs.hold |= line &~ PS_INT_STATUS_MASK;
312         //printf( " Setting %08x, status = %08x, hold = %08x\n", line, m_intc_regs.status, m_intc_regs.hold );
337313      }
338314      else
339315      {
340         drvstate->m_intc_regs.status &= ~line;
341         drvstate->m_intc_regs.hold &= ~line;
342         //printf( "Clearing %08x, status = %08x, hold = %08x\n", line, drvstate->m_intc_regs.status, drvstate->m_intc_regs.hold );
316         m_intc_regs.status &= ~line;
317         m_intc_regs.hold &= ~line;
318         //printf( "Clearing %08x, status = %08x, hold = %08x\n", line, m_intc_regs.status, m_intc_regs.hold );
343319      }
344320   }
345   if(drvstate->m_intc_regs.hold & drvstate->m_intc_regs.enable & PS_INT_IRQ_MASK)
321   if(m_intc_regs.hold & m_intc_regs.enable & PS_INT_IRQ_MASK)
346322   {
347      machine.device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, ASSERT_LINE);
323      machine().device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, ASSERT_LINE);
348324   }
349325   else
350326   {
351      machine.device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, CLEAR_LINE);
327      machine().device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, CLEAR_LINE);
352328   }
353   if(drvstate->m_intc_regs.hold & drvstate->m_intc_regs.enable & PS_INT_FIQ_MASK)
329   if(m_intc_regs.hold & m_intc_regs.enable & PS_INT_FIQ_MASK)
354330   {
355      machine.device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE);
331      machine().device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE);
356332   }
357333   else
358334   {
359      machine.device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE);
335      machine().device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE);
360336   }
361337}
362338
r21160r21161
365341   switch(offset)
366342   {
367343      case 0x0000/4:
368         verboselog(machine(), 0, "ps_intc_r: Held Interrupt = %08x & %08x\n", m_intc_regs.hold, mem_mask );
344         verboselog(0, "ps_intc_r: Held Interrupt = %08x & %08x\n", m_intc_regs.hold, mem_mask );
369345         return m_intc_regs.hold;
370346      case 0x0004/4:
371         verboselog(machine(), 0, "ps_intc_r: Interrupt Status = %08x & %08x\n", m_intc_regs.status, mem_mask );
347         verboselog(0, "ps_intc_r: Interrupt Status = %08x & %08x\n", m_intc_regs.status, mem_mask );
372348         return m_intc_regs.status;
373349      case 0x0008/4:
374         verboselog(machine(), 0, "ps_intc_r: Interrupt Enable = %08x & %08x\n", m_intc_regs.enable, mem_mask );
350         verboselog(0, "ps_intc_r: Interrupt Enable = %08x & %08x\n", m_intc_regs.enable, mem_mask );
375351         return m_intc_regs.enable;
376352      case 0x000c/4:
377         verboselog(machine(), 0, "ps_intc_r: Interrupt Mask (Invalid Read) = %08x & %08x\n", 0, mem_mask );
353         verboselog(0, "ps_intc_r: Interrupt Mask (Invalid Read) = %08x & %08x\n", 0, mem_mask );
378354         return 0;
379355      case 0x0010/4:
380         verboselog(machine(), 0, "ps_intc_r: Interrupt Acknowledge (Invalid Read) = %08x & %08x\n", 0, mem_mask );
356         verboselog(0, "ps_intc_r: Interrupt Acknowledge (Invalid Read) = %08x & %08x\n", 0, mem_mask );
381357         return 0;
382358      default:
383         verboselog(machine(), 0, "ps_intc_r: Unknown Register %08x & %08x\n", 0x0a000000 + (offset << 2), mem_mask );
359         verboselog(0, "ps_intc_r: Unknown Register %08x & %08x\n", 0x0a000000 + (offset << 2), mem_mask );
384360         break;
385361   }
386362   return 0;
r21160r21161
391367   switch(offset)
392368   {
393369      case 0x0000/4:
394         verboselog(machine(), 0, "ps_intc_w: Held Interrupt (Invalid Write) = %08x & %08x\n", data, mem_mask );
370         verboselog(0, "ps_intc_w: Held Interrupt (Invalid Write) = %08x & %08x\n", data, mem_mask );
395371         break;
396372      case 0x0004/4:
397         verboselog(machine(), 0, "ps_intc_w: Interrupt Status (Invalid Write) = %08x & %08x\n", data, mem_mask );
373         verboselog(0, "ps_intc_w: Interrupt Status (Invalid Write) = %08x & %08x\n", data, mem_mask );
398374         break;
399375      case 0x0008/4:
400         verboselog(machine(), 0, "ps_intc_w: Interrupt Enable = %08x & %08x\n", data, mem_mask );
376         verboselog(0, "ps_intc_w: Interrupt Enable = %08x & %08x\n", data, mem_mask );
401377         m_intc_regs.enable |= data;
402378         //COMBINE_DATA(&m_intc_regs.enable);
403379         //m_intc_regs.status &= m_intc_regs.enable;
404380         //m_intc_regs.hold &= m_intc_regs.enable;
405         ps_intc_set_interrupt_line(machine(), 0, 0);
381         ps_intc_set_interrupt_line(0, 0);
406382         break;
407383      case 0x000c/4:
408         verboselog(machine(), 0, "ps_intc_w: Interrupt Mask = %08x & %08x\n", data, mem_mask );
384         verboselog(0, "ps_intc_w: Interrupt Mask = %08x & %08x\n", data, mem_mask );
409385         m_intc_regs.enable &= ~data;
410386         COMBINE_DATA(&m_intc_regs.mask);
411387         //m_intc_regs.status &= m_intc_regs.enable;
412388         //m_intc_regs.hold &= m_intc_regs.enable;
413         ps_intc_set_interrupt_line(machine(), 0, 0);
389         ps_intc_set_interrupt_line(0, 0);
414390         break;
415391      case 0x0010/4:
416         verboselog(machine(), 0, "ps_intc_w: Interrupt Acknowledge = %08x & %08x\n", data, mem_mask );
392         verboselog(0, "ps_intc_w: Interrupt Acknowledge = %08x & %08x\n", data, mem_mask );
417393         m_intc_regs.hold &= ~data;
418394         m_intc_regs.status &= ~data;
419         ps_intc_set_interrupt_line(machine(), 0, 0);
395         ps_intc_set_interrupt_line(0, 0);
420396         //COMBINE_DATA(&m_intc_regs.acknowledge);
421397         break;
422398      default:
423         verboselog(machine(), 0, "ps_intc_w: Unknown Register %08x = %08x & %08x\n", 0x0a000000 + (offset << 2), data, mem_mask );
399         verboselog(0, "ps_intc_w: Unknown Register %08x = %08x & %08x\n", 0x0a000000 + (offset << 2), data, mem_mask );
424400         break;
425401   }
426402}
427403
428404TIMER_CALLBACK_MEMBER(pockstat_state::timer_tick)
429405{
430   ps_intc_set_interrupt_line(machine(), param == 2 ? PS_INT_TIMER2 : (param == 1 ? PS_INT_TIMER1 : PS_INT_TIMER0), 1);
406   ps_intc_set_interrupt_line(param == 2 ? PS_INT_TIMER2 : (param == 1 ? PS_INT_TIMER1 : PS_INT_TIMER0), 1);
431407   //printf( "Timer %d is calling back\n", param );
432408   m_timer_regs.timer[param].count = m_timer_regs.timer[param].period;
433   ps_timer_start(machine(), param);
409   ps_timer_start(param);
434410}
435411
436static void ps_timer_start(running_machine &machine, int index)
412void pockstat_state::ps_timer_start(int index)
437413{
438   pockstat_state *state = machine.driver_data<pockstat_state>();
439414   int divisor = 1;
440415   attotime period;
441   switch(state->m_timer_regs.timer[index].control & 3)
416   switch(m_timer_regs.timer[index].control & 3)
442417   {
443418      case 0:
444419      case 3:
r21160r21161
451426         divisor = 256;
452427         break;
453428   }
454   period = attotime::from_hz(CPU_FREQ[state->m_clock_regs.mode & 0x0f] / 2) * divisor;
455   period = period * state->m_timer_regs.timer[index].count;
456   state->m_timer_regs.timer[index].timer->adjust(period, index);
429   period = attotime::from_hz(CPU_FREQ[m_clock_regs.mode & 0x0f] / 2) * divisor;
430   period = period * m_timer_regs.timer[index].count;
431   m_timer_regs.timer[index].timer->adjust(period, index);
457432}
458433
459434READ32_MEMBER(pockstat_state::ps_timer_r)
r21160r21161
463438      case 0x0000/4:
464439      case 0x0010/4:
465440      case 0x0020/4:
466         verboselog(machine(), 0, "ps_timer_r: Timer %d Period = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].period, mem_mask );
441         verboselog(0, "ps_timer_r: Timer %d Period = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].period, mem_mask );
467442         return m_timer_regs.timer[offset / (0x10/4)].period;
468443      case 0x0004/4:
469444      case 0x0014/4:
470445      case 0x0024/4:
471         verboselog(machine(), 0, "ps_timer_r: Timer %d Count = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].count, mem_mask );
446         verboselog(0, "ps_timer_r: Timer %d Count = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].count, mem_mask );
472447         if(m_timer_regs.timer[offset / (0x10/4)].control & 4)
473448         {
474449            m_timer_regs.timer[offset / (0x10/4)].count--;
r21160r21161
482457      case 0x0008/4:
483458      case 0x0018/4:
484459      case 0x0028/4:
485         verboselog(machine(), 0, "ps_timer_r: Timer %d Control = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].control, mem_mask );
460         verboselog(0, "ps_timer_r: Timer %d Control = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].control, mem_mask );
486461         return m_timer_regs.timer[offset / (0x10/4)].control;
487462      default:
488         verboselog(machine(), 0, "ps_timer_r: Unknown Register %08x & %08x\n", 0x0a800000 + (offset << 2), mem_mask );
463         verboselog(0, "ps_timer_r: Unknown Register %08x & %08x\n", 0x0a800000 + (offset << 2), mem_mask );
489464         break;
490465   }
491466   return 0;
r21160r21161
498473      case 0x0000/4:
499474      case 0x0010/4:
500475      case 0x0020/4:
501         verboselog(machine(), 0, "ps_timer_w: Timer %d Period = %08x & %08x\n", offset / (0x10/4), data, mem_mask );
476         verboselog(0, "ps_timer_w: Timer %d Period = %08x & %08x\n", offset / (0x10/4), data, mem_mask );
502477         COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].period);
503478         break;
504479      case 0x0004/4:
505480      case 0x0014/4:
506481      case 0x0024/4:
507         verboselog(machine(), 0, "ps_timer_w: Timer %d Count = %08x & %08x\n", offset / (0x10/4), data, mem_mask );
482         verboselog(0, "ps_timer_w: Timer %d Count = %08x & %08x\n", offset / (0x10/4), data, mem_mask );
508483         COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].count);
509484         break;
510485      case 0x0008/4:
511486      case 0x0018/4:
512487      case 0x0028/4:
513         verboselog(machine(), 0, "ps_timer_w: Timer %d Control = %08x & %08x\n", offset / (0x10/4), data, mem_mask );
488         verboselog(0, "ps_timer_w: Timer %d Control = %08x & %08x\n", offset / (0x10/4), data, mem_mask );
514489         COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].control);
515490         if(m_timer_regs.timer[offset / (0x10/4)].control & 4)
516491         {
517            ps_timer_start(machine(), offset / (0x10/4));
492            ps_timer_start(offset / (0x10/4));
518493         }
519494         else
520495         {
r21160r21161
522497         }
523498         break;
524499      default:
525         verboselog(machine(), 0, "ps_timer_w: Unknown Register %08x = %08x & %08x\n", 0x0a800000 + (offset << 2), data, mem_mask );
500         verboselog(0, "ps_timer_w: Unknown Register %08x = %08x & %08x\n", 0x0a800000 + (offset << 2), data, mem_mask );
526501         break;
527502   }
528503}
r21160r21161
532507   switch(offset)
533508   {
534509      case 0x0000/4:
535         verboselog(machine(), 0, "ps_clock_r: Clock Mode = %08x & %08x\n", m_clock_regs.mode | 0x10, mem_mask );
510         verboselog(0, "ps_clock_r: Clock Mode = %08x & %08x\n", m_clock_regs.mode | 0x10, mem_mask );
536511         return m_clock_regs.mode | PS_CLOCK_STEADY;
537512      case 0x0004/4:
538         verboselog(machine(), 0, "ps_clock_r: Clock Control = %08x & %08x\n", m_clock_regs.control, mem_mask );
513         verboselog(0, "ps_clock_r: Clock Control = %08x & %08x\n", m_clock_regs.control, mem_mask );
539514         return m_clock_regs.control;
540515      default:
541         verboselog(machine(), 0, "ps_clock_r: Unknown Register %08x & %08x\n", 0x0b000000 + (offset << 2), mem_mask );
516         verboselog(0, "ps_clock_r: Unknown Register %08x & %08x\n", 0x0b000000 + (offset << 2), mem_mask );
542517         break;
543518   }
544519   return 0;
r21160r21161
549524   switch(offset)
550525   {
551526      case 0x0000/4:
552         verboselog(machine(), 0, "ps_clock_w: Clock Mode = %08x & %08x\n", data, mem_mask );
527         verboselog(0, "ps_clock_w: Clock Mode = %08x & %08x\n", data, mem_mask );
553528         COMBINE_DATA(&m_clock_regs.mode);
554529         machine().device("maincpu")->set_unscaled_clock(CPU_FREQ[m_clock_regs.mode & 0x0f]);
555530         break;
556531      case 0x0004/4:
557         verboselog(machine(), 0, "ps_clock_w: Clock Control = %08x & %08x\n", data, mem_mask );
532         verboselog(0, "ps_clock_w: Clock Control = %08x & %08x\n", data, mem_mask );
558533         COMBINE_DATA(&m_clock_regs.control);
559534         break;
560535      default:
561         verboselog(machine(), 0, "ps_clock_w: Unknown Register %08x = %08x & %08x\n", 0x0b000000 + (offset << 2), data, mem_mask );
536         verboselog(0, "ps_clock_w: Unknown Register %08x = %08x & %08x\n", 0x0b000000 + (offset << 2), data, mem_mask );
562537         break;
563538   }
564539}
r21160r21161
566541TIMER_CALLBACK_MEMBER(pockstat_state::rtc_tick)
567542{
568543   //printf( "RTC is calling back\n" );
569   ps_intc_set_interrupt_line(machine(), PS_INT_RTC, ps_intc_get_interrupt_line(machine(), PS_INT_RTC) ? 0 : 1);
544   ps_intc_set_interrupt_line(PS_INT_RTC, ps_intc_get_interrupt_line(PS_INT_RTC) ? 0 : 1);
570545   if(!(m_rtc_regs.mode & 1))
571546   {
572547      m_rtc_regs.time++;
r21160r21161
614589   switch(offset)
615590   {
616591      case 0x0000/4:
617         verboselog(machine(), 0, "ps_rtc_r: RTC Mode = %08x & %08x\n", m_rtc_regs.mode, mem_mask );
592         verboselog(0, "ps_rtc_r: RTC Mode = %08x & %08x\n", m_rtc_regs.mode, mem_mask );
618593         return m_rtc_regs.mode;
619594      case 0x0004/4:
620         verboselog(machine(), 0, "ps_rtc_r: RTC Control = %08x & %08x\n", m_rtc_regs.control, mem_mask );
595         verboselog(0, "ps_rtc_r: RTC Control = %08x & %08x\n", m_rtc_regs.control, mem_mask );
621596         return m_rtc_regs.control;
622597      case 0x0008/4:
623         verboselog(machine(), 0, "ps_rtc_r: RTC Time = %08x & %08x\n", m_rtc_regs.time, mem_mask );
598         verboselog(0, "ps_rtc_r: RTC Time = %08x & %08x\n", m_rtc_regs.time, mem_mask );
624599         return m_rtc_regs.time;
625600      case 0x000c/4:
626         verboselog(machine(), 0, "ps_rtc_r: RTC Date = %08x & %08x\n", m_rtc_regs.date, mem_mask );
601         verboselog(0, "ps_rtc_r: RTC Date = %08x & %08x\n", m_rtc_regs.date, mem_mask );
627602         return m_rtc_regs.date;
628603      default:
629         verboselog(machine(), 0, "ps_rtc_r: Unknown Register %08x & %08x\n", 0x0b800000 + (offset << 2), mem_mask );
604         verboselog(0, "ps_rtc_r: Unknown Register %08x & %08x\n", 0x0b800000 + (offset << 2), mem_mask );
630605         break;
631606   }
632607   return 0;
r21160r21161
637612   switch(offset)
638613   {
639614      case 0x0000/4:
640         verboselog(machine(), 0, "ps_rtc_w: RTC Mode = %08x & %08x\n", data, mem_mask );
615         verboselog(0, "ps_rtc_w: RTC Mode = %08x & %08x\n", data, mem_mask );
641616         COMBINE_DATA(&m_rtc_regs.mode);
642617         break;
643618      case 0x0004/4:
644         verboselog(machine(), 0, "ps_rtc_w: RTC Control = %08x & %08x\n", data, mem_mask );
619         verboselog(0, "ps_rtc_w: RTC Control = %08x & %08x\n", data, mem_mask );
645620         if(m_rtc_regs.control == 1 && data == 1)
646621         {
647622            switch(m_rtc_regs.mode >> 1)
r21160r21161
738713         }
739714         break;
740715      default:
741         verboselog(machine(), 0, "ps_rtc_w: Unknown Register %08x = %08x & %08x\n", 0x0b800000 + (offset << 2), data, mem_mask );
716         verboselog(0, "ps_rtc_w: Unknown Register %08x = %08x & %08x\n", 0x0b800000 + (offset << 2), data, mem_mask );
742717         break;
743718   }
744719}
r21160r21161
749724   switch(offset)
750725   {
751726      case 0x0000/4:
752         verboselog(machine(), 0, "ps_lcd_r: LCD Control = %08x & %08x\n", m_lcd_control | 0x100, mem_mask );
727         verboselog(0, "ps_lcd_r: LCD Control = %08x & %08x\n", m_lcd_control | 0x100, mem_mask );
753728         return m_lcd_control;
754729      default:
755         verboselog(machine(), 0, "ps_lcd_r: Unknown Register %08x & %08x\n", 0x0d000000 + (offset << 2), mem_mask );
730         verboselog(0, "ps_lcd_r: Unknown Register %08x & %08x\n", 0x0d000000 + (offset << 2), mem_mask );
756731         break;
757732   }
758733   return 0;
r21160r21161
763738   switch(offset)
764739   {
765740      case 0x0000/4:
766         verboselog(machine(), 0, "ps_lcd_w: LCD Control = %08x & %08x\n", data, mem_mask );
741         verboselog(0, "ps_lcd_w: LCD Control = %08x & %08x\n", data, mem_mask );
767742         COMBINE_DATA(&m_lcd_control);
768743         break;
769744      default:
770         verboselog(machine(), 0, "ps_lcd_w: Unknown Register %08x = %08x & %08x\n", 0x0d000000 + (offset << 2), data, mem_mask );
745         verboselog(0, "ps_lcd_w: Unknown Register %08x = %08x & %08x\n", 0x0d000000 + (offset << 2), data, mem_mask );
771746         break;
772747   }
773748}
r21160r21161
776751{
777752   UINT32 buttons = machine().root_device().ioport("BUTTONS")->read();
778753
779   ps_intc_set_interrupt_line(machine(), PS_INT_BTN_ACTION, (buttons &  1) ? 1 : 0);
780   ps_intc_set_interrupt_line(machine(), PS_INT_BTN_RIGHT, (buttons &  2) ? 1 : 0);
781   ps_intc_set_interrupt_line(machine(), PS_INT_BTN_LEFT,  (buttons &  4) ? 1 : 0);
782   ps_intc_set_interrupt_line(machine(), PS_INT_BTN_DOWN,  (buttons &  8) ? 1 : 0);
783   ps_intc_set_interrupt_line(machine(), PS_INT_BTN_UP,    (buttons & 16) ? 1 : 0);
754   ps_intc_set_interrupt_line(PS_INT_BTN_ACTION, (buttons &  1) ? 1 : 0);
755   ps_intc_set_interrupt_line(PS_INT_BTN_RIGHT, (buttons &  2) ? 1 : 0);
756   ps_intc_set_interrupt_line(PS_INT_BTN_LEFT,  (buttons &  4) ? 1 : 0);
757   ps_intc_set_interrupt_line(PS_INT_BTN_DOWN,  (buttons &  8) ? 1 : 0);
758   ps_intc_set_interrupt_line(PS_INT_BTN_UP,    (buttons & 16) ? 1 : 0);
784759}
785760
786761READ32_MEMBER(pockstat_state::ps_rombank_r)
r21160r21161
830805
831806READ32_MEMBER(pockstat_state::ps_audio_r)
832807{
833   verboselog(machine(), 0, "ps_audio_r: Unknown Read: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), 0x10, mem_mask);
808   verboselog(0, "ps_audio_r: Unknown Read: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), 0x10, mem_mask);
834809   return 0;
835810}
836811
837812WRITE32_MEMBER(pockstat_state::ps_audio_w)
838813{
839   verboselog(machine(), 0, "ps_audio_w: Unknown Write: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), data, mem_mask);
814   verboselog(0, "ps_audio_w: Unknown Write: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), data, mem_mask);
840815}
841816
842817WRITE32_MEMBER(pockstat_state::ps_dac_w)
trunk/src/mess/drivers/pasopia7.c
r21160r21161
116116
117117   void fdc_irq(bool state);
118118   TIMER_CALLBACK_MEMBER(pio_timer);
119   void draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width);
120   void draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width);
121   void draw_mixed_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width);
119122};
120123
121124#define VDP_CLOCK XTAL_3_579545MHz/4
r21160r21161
132135   m_p7_pal = auto_alloc_array(machine(), UINT8, 0x10);
133136}
134137
135static void draw_cg4_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
138void pasopia7_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
136139{
137   UINT8 *vram = machine.root_device().memregion("vram")->base();
140   UINT8 *vram = machine().root_device().memregion("vram")->base();
138141   int x,y,xi,yi;
139142   int count;
140143
r21160r21161
155158
156159               color =  pen_g<<2 | pen_r<<1 | pen_b<<0;
157160
158               bitmap.pix16(y+yi, x+xi) = machine.pens[color];
161               bitmap.pix16(y+yi, x+xi) = machine().pens[color];
159162            }
160163            count+=8;
161164         }
r21160r21161
163166   }
164167}
165168
166static void draw_tv_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
169void pasopia7_state::draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
167170{
168   pasopia7_state *state = machine.driver_data<pasopia7_state>();
169   UINT8 *vram = machine.root_device().memregion("vram")->base();
170   UINT8 *gfx_data = state->memregion("font")->base();
171   UINT8 *vram = machine().root_device().memregion("vram")->base();
172   UINT8 *gfx_data = memregion("font")->base();
171173   int x,y,xi,yi;
172174   int count;
173175
r21160r21161
188190               int pen;
189191               pen = ((gfx_data[tile*8+yi]>>(7-xi)) & 1) ? color : 0;
190192
191               bitmap.pix16(y*8+yi, x*8+xi) = machine.pens[pen];
193               bitmap.pix16(y*8+yi, x*8+xi) = machine().pens[pen];
192194            }
193195         }
194196
195197         // draw cursor
196         if(state->m_cursor_addr*8 == count)
198         if(m_cursor_addr*8 == count)
197199         {
198200            int xc,yc,cursor_on;
199201
200202            cursor_on = 0;
201            switch(state->m_cursor_raster & 0x60)
203            switch(m_cursor_raster & 0x60)
202204            {
203205               case 0x00: cursor_on = 1; break; //always on
204206               case 0x20: cursor_on = 0; break; //always off
205               case 0x40: if(machine.primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
206               case 0x60: if(machine.primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
207               case 0x40: if(machine().primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
208               case 0x60: if(machine().primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
207209            }
208210
209211            if(cursor_on)
210212            {
211               for(yc=0;yc<(8-(state->m_cursor_raster & 7));yc++)
213               for(yc=0;yc<(8-(m_cursor_raster & 7));yc++)
212214               {
213215                  for(xc=0;xc<8;xc++)
214216                  {
215                     bitmap.pix16(y*8-yc+7, x*8+xc) = machine.pens[7];
217                     bitmap.pix16(y*8-yc+7, x*8+xc) = machine().pens[7];
216218                  }
217219               }
218220            }
r21160r21161
222224   }
223225}
224226
225static void draw_mixed_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
227void pasopia7_state::draw_mixed_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
226228{
227   pasopia7_state *state = machine.driver_data<pasopia7_state>();
228   UINT8 *vram = machine.root_device().memregion("vram")->base();
229   UINT8 *gfx_data = state->memregion("font")->base();
229   UINT8 *vram = machine().root_device().memregion("vram")->base();
230   UINT8 *gfx_data = memregion("font")->base();
230231   int x,y,xi,yi;
231232   int count;
232233
r21160r21161
254255
255256                  pen =  pen_g<<2 | pen_r<<1 | pen_b<<0;
256257
257                  bitmap.pix16(y*8+yi, x*8+xi) = machine.pens[pen];
258                  bitmap.pix16(y*8+yi, x*8+xi) = machine().pens[pen];
258259               }
259260            }
260261            else
r21160r21161
266267                  int pen;
267268                  pen = ((gfx_data[tile*8+yi]>>(7-xi)) & 1) ? color : 0;
268269
269                  bitmap.pix16(y*8+yi, x*8+xi) = machine.pens[pen];
270                  bitmap.pix16(y*8+yi, x*8+xi) = machine().pens[pen];
270271               }
271272            }
272273         }
273274
274275         // draw cursor
275         if(state->m_cursor_addr*8 == count)
276         if(m_cursor_addr*8 == count)
276277         {
277278            int xc,yc,cursor_on;
278279
279280            cursor_on = 0;
280            switch(state->m_cursor_raster & 0x60)
281            switch(m_cursor_raster & 0x60)
281282            {
282283               case 0x00: cursor_on = 1; break; //always on
283284               case 0x20: cursor_on = 0; break; //always off
284               case 0x40: if(machine.primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
285               case 0x60: if(machine.primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
285               case 0x40: if(machine().primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
286               case 0x60: if(machine().primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
286287            }
287288
288289            if(cursor_on)
289290            {
290               for(yc=0;yc<(8-(state->m_cursor_raster & 7));yc++)
291               for(yc=0;yc<(8-(m_cursor_raster & 7));yc++)
291292               {
292293                  for(xc=0;xc<8;xc++)
293294                  {
294                     bitmap.pix16(y*8-yc+7, x*8+xc) = machine.pens[7];
295                     bitmap.pix16(y*8-yc+7, x*8+xc) = machine().pens[7];
295296                  }
296297               }
297298            }
r21160r21161
311312   width = m_x_width ? 80 : 40;
312313
313314   if(m_gfx_mode)
314      draw_mixed_screen(machine(),bitmap,cliprect,width);
315      draw_mixed_screen(bitmap,cliprect,width);
315316   else
316317   {
317      draw_cg4_screen(machine(),bitmap,cliprect,width);
318      draw_tv_screen(machine(),bitmap,cliprect,width);
318      draw_cg4_screen(bitmap,cliprect,width);
319      draw_tv_screen(bitmap,cliprect,width);
319320   }
320321
321322   return 0;
trunk/src/mess/drivers/pegasus.c
r21160r21161
8787   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pegasus_cart_3);
8888   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pegasus_cart_4);
8989   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pegasus_cart_5);
90   void pegasus_decrypt_rom( UINT16 addr );
9091};
9192
9293TIMER_DEVICE_CALLBACK_MEMBER(pegasus_state::pegasus_firq)
r21160r21161
419420
420421/* An encrypted single rom starts with 02, decrypted with 20. Not sure what
421422    multipart roms will have. */
422static void pegasus_decrypt_rom( running_machine &machine, UINT16 addr )
423void pegasus_state::pegasus_decrypt_rom( UINT16 addr )
423424{
424   UINT8 b, *ROM = machine.root_device().memregion("maincpu")->base();
425   UINT8 b, *ROM = machine().root_device().memregion("maincpu")->base();
425426   UINT16 i, j;
426427   UINT8 buff[0x1000];
427428   if (ROM[addr] == 0x02)
r21160r21161
441442DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_1 )
442443{
443444   image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x0000, 0x1000);
444   pegasus_decrypt_rom( image.device().machine(), 0x0000 );
445   pegasus_decrypt_rom( 0x0000 );
445446
446447   return IMAGE_INIT_PASS;
447448}
r21160r21161
449450DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_2 )
450451{
451452   image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x1000, 0x1000);
452   pegasus_decrypt_rom( image.device().machine(), 0x1000 );
453   pegasus_decrypt_rom( 0x1000 );
453454
454455   return IMAGE_INIT_PASS;
455456}
r21160r21161
457458DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_3 )
458459{
459460   image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x2000, 0x1000);
460   pegasus_decrypt_rom( image.device().machine(), 0x2000 );
461   pegasus_decrypt_rom( 0x2000 );
461462
462463   return IMAGE_INIT_PASS;
463464}
r21160r21161
465466DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_4 )
466467{
467468   image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0xc000, 0x1000);
468   pegasus_decrypt_rom( image.device().machine(), 0xc000 );
469   pegasus_decrypt_rom( 0xc000 );
469470
470471   return IMAGE_INIT_PASS;
471472}
r21160r21161
473474DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_5 )
474475{
475476   image.fread( image.device().machine().root_device().memregion("maincpu")->base() + 0xd000, 0x1000);
476   pegasus_decrypt_rom( image.device().machine(), 0xd000 );
477   pegasus_decrypt_rom( 0xd000 );
477478
478479   return IMAGE_INIT_PASS;
479480}
r21160r21161
492493
493494DRIVER_INIT_MEMBER(pegasus_state,pegasus)
494495{
495   pegasus_decrypt_rom( machine(), 0xf000 );
496   pegasus_decrypt_rom( 0xf000 );
496497}
497498
498499static MACHINE_CONFIG_START( pegasus, pegasus_state )
trunk/src/mess/drivers/vii.c
r21160r21161
157157   void vii_blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs);
158158   void vii_blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr);
159159   void vii_blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth);
160   inline void verboselog(int n_level, const char *s_fmt, ...);
161   inline UINT8 expand_rgb5_to_rgb8(UINT8 val);
162   inline UINT8 vii_mix_channel(UINT8 a, UINT8 b);
163   void vii_mix_pixel(UINT32 offset, UINT16 rgb);
164   void vii_set_pixel(UINT32 offset, UINT16 rgb);
160165};
161166
162167enum
r21160r21161
179184#define ENABLE_VERBOSE_LOG (1)
180185
181186#if ENABLE_VERBOSE_LOG
182INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, ...)
187inline void vii_state::verboselog(int n_level, const char *s_fmt, ...)
183188{
184189   if( VERBOSE_LEVEL >= n_level )
185190   {
r21160r21161
188193      va_start( v, s_fmt );
189194      vsprintf( buf, s_fmt, v );
190195      va_end( v );
191      logerror( "%04x: %s", machine.driver_data<vii_state>()->m_maincpu->pc(), buf );
192196   }
193197}
194198#else
r21160r21161
203207{
204208}
205209
206INLINE UINT8 expand_rgb5_to_rgb8(UINT8 val)
210inline UINT8 vii_state::expand_rgb5_to_rgb8(UINT8 val)
207211{
208212   UINT8 temp = val & 0x1f;
209213   return (temp << 3) | (temp >> 2);
210214}
211215
212216// Perform a lerp between a and b
213INLINE UINT8 vii_mix_channel(vii_state *state, UINT8 a, UINT8 b)
217inline UINT8 vii_state::vii_mix_channel(UINT8 a, UINT8 b)
214218{
215   UINT8 alpha = state->m_video_regs[0x1c] & 0x00ff;
219   UINT8 alpha = m_video_regs[0x1c] & 0x00ff;
216220   return ((64 - alpha) * a + alpha * b) / 64;
217221}
218222
219static void vii_mix_pixel(vii_state *state, UINT32 offset, UINT16 rgb)
223void vii_state::vii_mix_pixel(UINT32 offset, UINT16 rgb)
220224{
221   state->m_screen[offset].r = vii_mix_channel(state, state->m_screen[offset].r, expand_rgb5_to_rgb8(rgb >> 10));
222   state->m_screen[offset].g = vii_mix_channel(state, state->m_screen[offset].g, expand_rgb5_to_rgb8(rgb >> 5));
223   state->m_screen[offset].b = vii_mix_channel(state, state->m_screen[offset].b, expand_rgb5_to_rgb8(rgb));
225   m_screen[offset].r = vii_mix_channel(m_screen[offset].r, expand_rgb5_to_rgb8(rgb >> 10));
226   m_screen[offset].g = vii_mix_channel(m_screen[offset].g, expand_rgb5_to_rgb8(rgb >> 5));
227   m_screen[offset].b = vii_mix_channel(m_screen[offset].b, expand_rgb5_to_rgb8(rgb));
224228}
225229
226static void vii_set_pixel(vii_state *state, UINT32 offset, UINT16 rgb)
230void vii_state::vii_set_pixel(UINT32 offset, UINT16 rgb)
227231{
228   state->m_screen[offset].r = expand_rgb5_to_rgb8(rgb >> 10);
229   state->m_screen[offset].g = expand_rgb5_to_rgb8(rgb >> 5);
230   state->m_screen[offset].b = expand_rgb5_to_rgb8(rgb);
232   m_screen[offset].r = expand_rgb5_to_rgb8(rgb >> 10);
233   m_screen[offset].g = expand_rgb5_to_rgb8(rgb >> 5);
234   m_screen[offset].b = expand_rgb5_to_rgb8(rgb);
231235}
232236
233237void vii_state::vii_blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile)
r21160r21161
286290            {
287291               if (attr & 0x4000)
288292               {
289                  vii_mix_pixel(this, xx + 320*yy, rgb);
293                  vii_mix_pixel(xx + 320*yy, rgb);
290294               }
291295               else
292296               {
293                  vii_set_pixel(this, xx + 320*yy, rgb);
297                  vii_set_pixel(xx + 320*yy, rgb);
294298               }
295299            }
296300         }
r21160r21161
477481   switch(offset)
478482   {
479483      case 0x62: // Video IRQ Enable
480         verboselog(machine(), 0, "vii_video_r: Video IRQ Enable: %04x\n", VII_VIDEO_IRQ_ENABLE);
484         verboselog(0, "vii_video_r: Video IRQ Enable: %04x\n", VII_VIDEO_IRQ_ENABLE);
481485         return VII_VIDEO_IRQ_ENABLE;
482486
483487      case 0x63: // Video IRQ Status
484         verboselog(machine(), 0, "vii_video_r: Video IRQ Status: %04x\n", VII_VIDEO_IRQ_STATUS);
488         verboselog(0, "vii_video_r: Video IRQ Status: %04x\n", VII_VIDEO_IRQ_STATUS);
485489         return VII_VIDEO_IRQ_STATUS;
486490
487491      default:
488         verboselog(machine(), 0, "vii_video_r: Unknown register %04x = %04x\n", 0x2800 + offset, m_video_regs[offset]);
492         verboselog(0, "vii_video_r: Unknown register %04x = %04x\n", 0x2800 + offset, m_video_regs[offset]);
489493         break;
490494   }
491495   return m_video_regs[offset];
r21160r21161
510514         COMBINE_DATA(&m_video_regs[offset]);
511515         break;
512516      case 0x62: // Video IRQ Enable
513         verboselog(machine(), 0, "vii_video_w: Video IRQ Enable = %04x (%04x)\n", data, mem_mask);
517         verboselog(0, "vii_video_w: Video IRQ Enable = %04x (%04x)\n", data, mem_mask);
514518         COMBINE_DATA(&VII_VIDEO_IRQ_ENABLE);
515519         break;
516520
517521      case 0x63: // Video IRQ Acknowledge
518         verboselog(machine(), 0, "vii_video_w: Video IRQ Acknowledge = %04x (%04x)\n", data, mem_mask);
522         verboselog(0, "vii_video_w: Video IRQ Acknowledge = %04x (%04x)\n", data, mem_mask);
519523         VII_VIDEO_IRQ_STATUS &= ~data;
520524         if(!VII_VIDEO_IRQ_STATUS)
521525         {
r21160r21161
524528         break;
525529
526530      case 0x70: // Video DMA Source
527         verboselog(machine(), 0, "vii_video_w: Video DMA Source = %04x (%04x)\n", data, mem_mask);
531         verboselog(0, "vii_video_w: Video DMA Source = %04x (%04x)\n", data, mem_mask);
528532         COMBINE_DATA(&m_video_regs[offset]);
529533         break;
530534
531535      case 0x71: // Video DMA Dest
532         verboselog(machine(), 0, "vii_video_w: Video DMA Dest = %04x (%04x)\n", data, mem_mask);
536         verboselog(0, "vii_video_w: Video DMA Dest = %04x (%04x)\n", data, mem_mask);
533537         COMBINE_DATA(&m_video_regs[offset]);
534538         break;
535539
536540      case 0x72: // Video DMA Length
537         verboselog(machine(), 0, "vii_video_w: Video DMA Length = %04x (%04x)\n", data, mem_mask);
541         verboselog(0, "vii_video_w: Video DMA Length = %04x (%04x)\n", data, mem_mask);
538542         vii_do_dma(data);
539543         break;
540544
541545      default:
542         verboselog(machine(), 0, "vii_video_w: Unknown register %04x = %04x (%04x)\n", 0x2800 + offset, data, mem_mask);
546         verboselog(0, "vii_video_w: Unknown register %04x = %04x (%04x)\n", 0x2800 + offset, data, mem_mask);
543547         COMBINE_DATA(&m_video_regs[offset]);
544548         break;
545549   }
r21160r21161
550554   switch(offset)
551555   {
552556      default:
553         verboselog(machine(), 4, "vii_audio_r: Unknown register %04x\n", 0x3000 + offset);
557         verboselog(4, "vii_audio_r: Unknown register %04x\n", 0x3000 + offset);
554558         break;
555559   }
556560   return 0;
r21160r21161
561565   switch(offset)
562566   {
563567      default:
564         verboselog(machine(), 4, "vii_audio_w: Unknown register %04x = %04x (%04x)\n", 0x3000 + offset, data, mem_mask);
568         verboselog(4, "vii_audio_w: Unknown register %04x = %04x (%04x)\n", 0x3000 + offset, data, mem_mask);
565569         break;
566570   }
567571}
r21160r21161
654658   {
655659      case 0x01: case 0x06: case 0x0b: // GPIO Data Port A/B/C
656660         vii_do_gpio(offset);
657         verboselog(machine(), 3, "vii_io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask);
661         verboselog(3, "vii_io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask);
658662         val = m_io_regs[offset];
659663         break;
660664
661665      case 0x02: case 0x03: case 0x04: case 0x05:
662666      case 0x07: case 0x08: case 0x09: case 0x0a:
663667      case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Other GPIO regs
664         verboselog(machine(), 3, "vii_io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask);
668         verboselog(3, "vii_io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask);
665669         break;
666670
667671      case 0x1c: // Random
668672         val = machine().rand() & 0x00ff;
669         verboselog(machine(), 3, "vii_io_r: Random = %04x (%04x)\n", val, mem_mask);
673         verboselog(3, "vii_io_r: Random = %04x (%04x)\n", val, mem_mask);
670674         break;
671675
672676      case 0x21: // IRQ Control
673         verboselog(machine(), 3, "vii_io_r: Controller IRQ Control = %04x (%04x)\n", val, mem_mask);
677         verboselog(3, "vii_io_r: Controller IRQ Control = %04x (%04x)\n", val, mem_mask);
674678         break;
675679
676680      case 0x22: // IRQ Status
677         verboselog(machine(), 3, "vii_io_r: Controller IRQ Status = %04x (%04x)\n", val, mem_mask);
681         verboselog(3, "vii_io_r: Controller IRQ Status = %04x (%04x)\n", val, mem_mask);
678682         break;
679683
680684      case 0x2c: case 0x2d: // Timers?
681685         val = machine().rand() & 0x0000ffff;
682         verboselog(machine(), 3, "vii_io_r: Unknown Timer %d Register = %04x (%04x)\n", offset - 0x2c, val, mem_mask);
686         verboselog(3, "vii_io_r: Unknown Timer %d Register = %04x (%04x)\n", offset - 0x2c, val, mem_mask);
683687         break;
684688
685689      case 0x2f: // Data Segment
686690         val = machine().device("maincpu")->state().state_int(UNSP_SR) >> 10;
687         verboselog(machine(), 3, "vii_io_r: Data Segment = %04x (%04x)\n", val, mem_mask);
691         verboselog(3, "vii_io_r: Data Segment = %04x (%04x)\n", val, mem_mask);
688692         break;
689693
690694      case 0x31: // Unknown, UART Status?
691         verboselog(machine(), 3, "vii_io_r: Unknown (UART Status?) = %04x (%04x)\n", 3, mem_mask);
695         verboselog(3, "vii_io_r: Unknown (UART Status?) = %04x (%04x)\n", 3, mem_mask);
692696         val = 3;
693697         break;
694698
695699      case 0x36: // UART RX Data
696700         val = m_controller_input[m_uart_rx_count];
697701         m_uart_rx_count = (m_uart_rx_count + 1) % 8;
698         verboselog(machine(), 3, "vii_io_r: UART RX Data = %04x (%04x)\n", val, mem_mask);
702         verboselog(3, "vii_io_r: UART RX Data = %04x (%04x)\n", val, mem_mask);
699703         break;
700704
701705      case 0x59: // I2C Status
702         verboselog(machine(), 3, "vii_io_r: I2C Status = %04x (%04x)\n", val, mem_mask);
706         verboselog(3, "vii_io_r: I2C Status = %04x (%04x)\n", val, mem_mask);
703707         break;
704708
705709      case 0x5e: // I2C Data In
706         verboselog(machine(), 3, "vii_io_r: I2C Data In = %04x (%04x)\n", val, mem_mask);
710         verboselog(3, "vii_io_r: I2C Data In = %04x (%04x)\n", val, mem_mask);
707711         break;
708712
709713      default:
710         verboselog(machine(), 3, "vii_io_r: Unknown register %04x\n", 0x3d00 + offset);
714         verboselog(3, "vii_io_r: Unknown register %04x\n", 0x3d00 + offset);
711715         break;
712716   }
713717
r21160r21161
726730   switch(offset)
727731   {
728732      case 0x00: // GPIO special function select
729         verboselog(machine(), 3, "vii_io_w: GPIO Function Select = %04x (%04x)\n", data, mem_mask);
733         verboselog(3, "vii_io_w: GPIO Function Select = %04x (%04x)\n", data, mem_mask);
730734         COMBINE_DATA(&m_io_regs[offset]);
731735         break;
732736
r21160r21161
737741      case 0x02: case 0x03: case 0x04: case 0x05: // Port A
738742      case 0x07: case 0x08: case 0x09: case 0x0a: // Port B
739743      case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Port C
740         verboselog(machine(), 3, "vii_io_w: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data, mem_mask);
744         verboselog(3, "vii_io_w: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data, mem_mask);
741745         COMBINE_DATA(&m_io_regs[offset]);
742746         vii_do_gpio(offset);
743747         break;
r21160r21161
745749      case 0x10:      // timebase control
746750         if ((m_io_regs[offset] & 0x0003) != (data & 0x0003)) {
747751            UINT16 hz = 8 << (data & 0x0003);
748            verboselog(machine(), 3, "*** TMB1 FREQ set to %dHz\n", hz);
752            verboselog(3, "*** TMB1 FREQ set to %dHz\n", hz);
749753            m_tmb1->adjust(attotime::zero, 0, attotime::from_hz( hz ));
750754         }
751755         if ((m_io_regs[offset] & 0x000c) != (data & 0x000c)) {
752756            UINT16 hz = 128 << ((data & 0x000c) >> 2);
753            verboselog(machine(), 3, "*** TMB2 FREQ set to %dHz\n", hz);
757            verboselog(3, "*** TMB2 FREQ set to %dHz\n", hz);
754758            m_tmb2->adjust(attotime::zero, 0, attotime::from_hz( hz ));
755759         }
756760         COMBINE_DATA(&m_io_regs[offset]);
757761         break;
758762      case 0x21: // IRQ Enable
759         verboselog(machine(), 3, "vii_io_w: Controller IRQ Control = %04x (%04x)\n", data, mem_mask);
763         verboselog(3, "vii_io_w: Controller IRQ Control = %04x (%04x)\n", data, mem_mask);
760764         COMBINE_DATA(&VII_CTLR_IRQ_ENABLE);
761765         if(!VII_CTLR_IRQ_ENABLE)
762766         {
r21160r21161
765769         break;
766770
767771      case 0x22: // IRQ Acknowledge
768         verboselog(machine(), 3, "vii_io_w: Controller IRQ Acknowledge = %04x (%04x)\n", data, mem_mask);
772         verboselog(3, "vii_io_w: Controller IRQ Acknowledge = %04x (%04x)\n", data, mem_mask);
769773         m_io_regs[0x22] &= ~data;
770774         if(!m_io_regs[0x22])
771775         {
r21160r21161
776780      case 0x2f: // Data Segment
777781         temp = machine().device("maincpu")->state().state_int(UNSP_SR);
778782         machine().device("maincpu")->state().set_state_int(UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10));
779         verboselog(machine(), 3, "vii_io_w: Data Segment = %04x (%04x)\n", data, mem_mask);
783         verboselog(3, "vii_io_w: Data Segment = %04x (%04x)\n", data, mem_mask);
780784         break;
781785
782786      case 0x31: // Unknown UART
783         verboselog(machine(), 3, "vii_io_w: Unknown UART = %04x (%04x)\n", data, mem_mask);
787         verboselog(3, "vii_io_w: Unknown UART = %04x (%04x)\n", data, mem_mask);
784788         COMBINE_DATA(&m_io_regs[offset]);
785789         break;
786790
787791      case 0x32: // UART Reset
788         verboselog(machine(), 3, "vii_io_r: UART Reset\n");
792         verboselog(3, "vii_io_r: UART Reset\n");
789793         break;
790794
791795      case 0x33: // UART Baud Rate
792         verboselog(machine(), 3, "vii_io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (m_io_regs[0x34] << 8) - data));
796         verboselog(3, "vii_io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (m_io_regs[0x34] << 8) - data));
793797         COMBINE_DATA(&m_io_regs[offset]);
794798         break;
795799
796800      case 0x35: // UART TX Data
797         verboselog(machine(), 3, "vii_io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (data << 8) - m_io_regs[0x33]));
801         verboselog(3, "vii_io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (data << 8) - m_io_regs[0x33]));
798802         COMBINE_DATA(&m_io_regs[offset]);
799803         break;
800804
801805      case 0x5a: // I2C Access Mode
802         verboselog(machine(), 3, "vii_io_w: I2C Access Mode = %04x (%04x)\n", data, mem_mask);
806         verboselog(3, "vii_io_w: I2C Access Mode = %04x (%04x)\n", data, mem_mask);
803807         COMBINE_DATA(&m_io_regs[offset]);
804808         break;
805809
806810      case 0x5b: // I2C Device Address
807         verboselog(machine(), 3, "vii_io_w: I2C Device Address = %04x (%04x)\n", data, mem_mask);
811         verboselog(3, "vii_io_w: I2C Device Address = %04x (%04x)\n", data, mem_mask);
808812         COMBINE_DATA(&m_io_regs[offset]);
809813         break;
810814
811815      case 0x5c: // I2C Sub-Address
812         verboselog(machine(), 3, "vii_io_w: I2C Sub-Address = %04x (%04x)\n", data, mem_mask);
816         verboselog(3, "vii_io_w: I2C Sub-Address = %04x (%04x)\n", data, mem_mask);
813817         COMBINE_DATA(&m_io_regs[offset]);
814818         break;
815819
816820      case 0x5d: // I2C Data Out
817         verboselog(machine(), 3, "vii_io_w: I2C Data Out = %04x (%04x)\n", data, mem_mask);
821         verboselog(3, "vii_io_w: I2C Data Out = %04x (%04x)\n", data, mem_mask);
818822         COMBINE_DATA(&m_io_regs[offset]);
819823         break;
820824
821825      case 0x5e: // I2C Data In
822         verboselog(machine(), 3, "vii_io_w: I2C Data In = %04x (%04x)\n", data, mem_mask);
826         verboselog(3, "vii_io_w: I2C Data In = %04x (%04x)\n", data, mem_mask);
823827         COMBINE_DATA(&m_io_regs[offset]);
824828         break;
825829
826830      case 0x5f: // I2C Controller Mode
827         verboselog(machine(), 3, "vii_io_w: I2C Controller Mode = %04x (%04x)\n", data, mem_mask);
831         verboselog(3, "vii_io_w: I2C Controller Mode = %04x (%04x)\n", data, mem_mask);
828832         COMBINE_DATA(&m_io_regs[offset]);
829833         break;
830834
831835      case 0x58: // I2C Command
832         verboselog(machine(), 3, "vii_io_w: I2C Command = %04x (%04x)\n", data, mem_mask);
836         verboselog(3, "vii_io_w: I2C Command = %04x (%04x)\n", data, mem_mask);
833837         COMBINE_DATA(&m_io_regs[offset]);
834838         vii_do_i2c();
835839         break;
836840
837841      case 0x59: // I2C Status / IRQ Acknowledge(?)
838         verboselog(machine(), 3, "vii_io_w: I2C Status / Ack = %04x (%04x)\n", data, mem_mask);
842         verboselog(3, "vii_io_w: I2C Status / Ack = %04x (%04x)\n", data, mem_mask);
839843         m_io_regs[offset] &= ~data;
840844         break;
841845
r21160r21161
850854         break;
851855
852856      default:
853         verboselog(machine(), 3, "vii_io_w: Unknown register %04x = %04x (%04x)\n", 0x3d00 + offset, data, mem_mask);
857         verboselog(3, "vii_io_w: Unknown register %04x = %04x (%04x)\n", 0x3d00 + offset, data, mem_mask);
854858         COMBINE_DATA(&m_io_regs[offset]);
855859         break;
856860   }
r21160r21161
862866    switch(offset)
863867    {
864868        default:
865            verboselog(machine(), 0, "vii_rowscroll_w: %04x = %04x (%04x)\n", 0x2900 + offset, data, mem_mask);
869            verboselog(0, "vii_rowscroll_w: %04x = %04x (%04x)\n", 0x2900 + offset, data, mem_mask);
866870            break;
867871    }
868872}
r21160r21161
872876    switch(offset)
873877    {
874878        default:
875            verboselog(machine(), 0, "vii_spriteram_w: %04x = %04x (%04x)\n", 0x2c00 + offset, data, mem_mask);
879            verboselog(0, "vii_spriteram_w: %04x = %04x (%04x)\n", 0x2c00 + offset, data, mem_mask);
876880            break;
877881    }
878882}
r21160r21161
10541058   VII_VIDEO_IRQ_STATUS = VII_VIDEO_IRQ_ENABLE & 1;
10551059   if(VII_VIDEO_IRQ_STATUS)
10561060   {
1057      verboselog(machine(), 0, "Video IRQ\n");
1061      verboselog(0, "Video IRQ\n");
10581062      machine().device("maincpu")->execute().set_input_line(UNSP_IRQ0_LINE, ASSERT_LINE);
10591063   }
10601064
10611065//  {
1062//      verboselog(machine(), 0, "audio 1 IRQ\n");
1066//      verboselog(0, "audio 1 IRQ\n");
10631067//      machine().device("maincpu")->execute().set_input_line(UNSP_IRQ1_LINE, ASSERT_LINE);
10641068//  }
10651069   if(m_io_regs[0x22] & m_io_regs[0x21] & 0x0c00)
10661070   {
1067      verboselog(machine(), 0, "timerA, timer B IRQ\n");
1071      verboselog(0, "timerA, timer B IRQ\n");
10681072      machine().device("maincpu")->execute().set_input_line(UNSP_IRQ2_LINE, ASSERT_LINE);
10691073   }
10701074
r21160r21161
10721076   // For now trigger always if any enabled
10731077   if(VII_CTLR_IRQ_ENABLE)
10741078   {
1075      verboselog(machine(), 0, "UART, ADC IRQ\n");
1079      verboselog(0, "UART, ADC IRQ\n");
10761080      machine().device("maincpu")->execute().set_input_line(UNSP_IRQ3_LINE, ASSERT_LINE);
10771081   }
10781082//  {
1079//      verboselog(machine(), 0, "audio 4 IRQ\n");
1083//      verboselog(0, "audio 4 IRQ\n");
10801084//      machine().device("maincpu")->execute().set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE);
10811085//  }
10821086
10831087   if(m_io_regs[0x22] & m_io_regs[0x21] & 0x1200)
10841088   {
1085      verboselog(machine(), 0, "External IRQ\n");
1089      verboselog(0, "External IRQ\n");
10861090      machine().device("maincpu")->execute().set_input_line(UNSP_IRQ5_LINE, ASSERT_LINE);
10871091   }
10881092   if(m_io_regs[0x22] & m_io_regs[0x21] & 0x0070)
10891093   {
1090      verboselog(machine(), 0, "1024Hz, 2048HZ, 4096HZ IRQ\n");
1094      verboselog(0, "1024Hz, 2048HZ, 4096HZ IRQ\n");
10911095      machine().device("maincpu")->execute().set_input_line(UNSP_IRQ6_LINE, ASSERT_LINE);
10921096   }
10931097   if(m_io_regs[0x22] & m_io_regs[0x21] & 0x008b)
10941098   {
1095      verboselog(machine(), 0, "TMB1, TMB2, 4Hz, key change IRQ\n");
1099      verboselog(0, "TMB1, TMB2, 4Hz, key change IRQ\n");
10961100      machine().device("maincpu")->execute().set_input_line(UNSP_IRQ7_LINE, ASSERT_LINE);
10971101   }
10981102
trunk/src/mess/drivers/smc777.c
r21160r21161
120120   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
121121   DECLARE_WRITE_LINE_MEMBER(smc777_fdc_intrq_w);
122122   DECLARE_WRITE_LINE_MEMBER(smc777_fdc_drq_w);
123   void check_floppy_inserted();
123124};
124125
125126
r21160r21161
371372}
372373
373374
374static void check_floppy_inserted(running_machine &machine)
375void smc777_state::check_floppy_inserted()
375376{
376377   int f_num;
377378   floppy_image_legacy *floppy;
r21160r21161
380381   /* FIXME: floppy drive 1 doesn't work? */
381382   for(f_num=0;f_num<2;f_num++)
382383   {
383      floppy = flopimg_get_image(floppy_get_device(machine, f_num));
384      floppy_mon_w(floppy_get_device(machine, f_num), (floppy != NULL) ? 0 : 1);
385      floppy_drive_set_ready_state(floppy_get_device(machine, f_num), (floppy != NULL) ? 1 : 0,0);
384      floppy = flopimg_get_image(floppy_get_device(machine(), f_num));
385      floppy_mon_w(floppy_get_device(machine(), f_num), (floppy != NULL) ? 0 : 1);
386      floppy_drive_set_ready_state(floppy_get_device(machine(), f_num), (floppy != NULL) ? 1 : 0,0);
386387   }
387388}
388389
389390READ8_MEMBER(smc777_state::smc777_fdc1_r)
390391{
391   check_floppy_inserted(machine());
392   check_floppy_inserted();
392393
393394   switch(offset)
394395   {
r21160r21161
411412
412413WRITE8_MEMBER(smc777_state::smc777_fdc1_w)
413414{
414   check_floppy_inserted(machine());
415   check_floppy_inserted();
415416
416417   switch(offset)
417418   {

Previous 199869 Revisions Next


© 1997-2024 The MAME Team