Previous 199869 Revisions Next

r29305 Saturday 5th April, 2014 at 11:04:39 UTC by Nathan Woods
Merge branch 'master' of ssh://mess.org/mame into new_menus
[/shelves/new_menus/src/emu]clifront.c devcb.c devcb.h mcfglgcy.h rendlay.c rendlay.h
[/shelves/new_menus/src/emu/bus/isa]omti8621.c omti8621.h
[/shelves/new_menus/src/emu/bus/nubus]nubus_image.c nubus_image.h
[/shelves/new_menus/src/emu/bus/saturn]bram.c bram.h
[/shelves/new_menus/src/emu/bus/wangpc]tig.c tig.h
[/shelves/new_menus/src/emu/cpu]cpu.mak
[/shelves/new_menus/src/emu/cpu/dsp56k]dsp56k.c dsp56k.h dsp56mem.c dsp56mem.h
[/shelves/new_menus/src/emu/cpu/g65816]g65816.c g65816.h
[/shelves/new_menus/src/emu/cpu/h8]h83008.c* h83008.h*
[/shelves/new_menus/src/emu/cpu/i86]i286.c i86.c
[/shelves/new_menus/src/emu/cpu/sh4]sh4dmac.c
[/shelves/new_menus/src/emu/machine]ins8154.c ins8154.h lh5810.c lh5810.h smpc.c smpc.h
[/shelves/new_menus/src/emu/ui]devctrl.h
[/shelves/new_menus/src/emu/video]bufsprite.c i8275x.c i8275x.h stvvdp1.c upd7220.c upd7220.h
[/shelves/new_menus/src/mame/drivers]bowltry.c kopunch.c namcos23.c stv.c vega.c wpc_dot.c
[/shelves/new_menus/src/mame/includes]kopunch.h snes.h stv.h
[/shelves/new_menus/src/mame/machine]archimds.c dc.c maple-dc.c snes.c wpc.c
[/shelves/new_menus/src/mame/video]archimds.c kopunch.c snes.c
[/shelves/new_menus/src/mess/drivers]a5105.c acrnsys1.c apc.c compis.c dmv.c if800.c mk14.c mz3500.c mz6500.c pc.c pc1500.c pc9801.c qx10.c saturn.c snes.c vt240.c wicat.c zorba.c
[/shelves/new_menus/src/mess/includes]compis.h mikromik.h msx.h swtpc09.h
[/shelves/new_menus/src/mess/machine]dccons.c msx_slot.c swtpc09.c
[/shelves/new_menus/src/mess/machine/ti99]gromport.c
[/shelves/new_menus/src/mess/video]mikromik.c

shelves/new_menus/src/mess/drivers/snes.c
r29304r29305
18151815      case SNES_Z80GB:      // skeleton support
18161816         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessgb_lo_r),this), write8_delegate(FUNC(snes_console_state::snessgb_lo_w),this));
18171817         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessgb_hi_r),this), write8_delegate(FUNC(snes_console_state::snessgb_hi_w),this));
1818         set_5a22_map(m_maincpu);
1818         m_maincpu->set_5a22_map();
18191819         break;
18201820      case SNES_SA1:      // skeleton support
18211821         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessa1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessa1_lo_w),this));
18221822         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessa1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessa1_hi_w),this));
1823         set_5a22_map(m_maincpu);
1823         m_maincpu->set_5a22_map();
18241824         break;
18251825      case SNES_DSP:
18261826         m_maincpu->space(AS_PROGRAM).install_read_handler(0x208000, 0x20ffff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
r29304r29305
18411841      case SNES_SFX:
18421842         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessfx_lo_r),this), write8_delegate(FUNC(snes_console_state::snessfx_lo_w),this));
18431843         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessfx_hi_r),this), write8_delegate(FUNC(snes_console_state::snessfx_hi_w),this));
1844         set_5a22_map(m_maincpu);
1844         m_maincpu->set_5a22_map();
18451845         break;
18461846      case SNES_SDD1:
18471847         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessdd1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_lo_w),this));
18481848         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessdd1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_hi_w),this));
1849         set_5a22_map(m_maincpu);
1849         m_maincpu->set_5a22_map();
18501850         break;
18511851      case SNES_BSX:
18521852         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snesbsx_lo_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_lo_w),this));
18531853         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snesbsx_hi_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_hi_w),this));
1854         set_5a22_map(m_maincpu);
1854         m_maincpu->set_5a22_map();
18551855         break;
18561856      // HiROM & HiROM + addons
18571857      case SNES_MODE21:
18581858      case SNES_BSXHI:
18591859         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this));
18601860         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this));
1861         set_5a22_map(m_maincpu);
1861         m_maincpu->set_5a22_map();
18621862         break;
18631863      case SNES_DSP_MODE21:
18641864         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this));
18651865         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this));
18661866         m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
18671867         m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
1868         set_5a22_map(m_maincpu);
1868         m_maincpu->set_5a22_map();
18691869         break;
18701870      case SNES_SRTC:
18711871         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this));
18721872         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this));
18731873         m_maincpu->space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
18741874         m_maincpu->space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
1875         set_5a22_map(m_maincpu);
1875         m_maincpu->set_5a22_map();
18761876         break;
18771877      case SNES_SPC7110:
18781878      case SNES_SPC7110_RTC:
18791879         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes7110_lo_r),this), write8_delegate(FUNC(snes_console_state::snes7110_lo_w),this));
18801880         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes7110_hi_r),this), write8_delegate(FUNC(snes_console_state::snes7110_hi_w),this));
1881         set_5a22_map(m_maincpu);
1881         m_maincpu->set_5a22_map();
18821882         break;
18831883      case SNES_PFEST94:
18841884         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::pfest94_lo_r),this), write8_delegate(FUNC(snes_console_state::pfest94_lo_w),this));
18851885         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::pfest94_hi_r),this), write8_delegate(FUNC(snes_console_state::pfest94_hi_w),this));
1886         set_5a22_map(m_maincpu);
1886         m_maincpu->set_5a22_map();
18871887         break;
18881888         // pirate 'mappers'
18891889      case SNES_POKEMON:
r29304r29305
19041904      case SNES_SOULBLAD:
19051905         // reads from xxx0-xxx3in range [80-bf] return a fixed sequence of 4bits; reads in range [c0-ff] return open bus
19061906         m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x808003, 0, 0x3f7ff0, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1907         m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xc00000, 0xffffff, FUNC(snes_open_bus_r));
1907         m_maincpu->space(AS_PROGRAM).install_read_handler(0xc00000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes_open_bus_r),this));
19081908         break;
19091909      case SNES_BUGS:
19101910      case SNES_BANANA:
19111911//          m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
19121912//          m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
1913//          set_5a22_map(m_maincpu);
1913//          m_maincpu->set_5a22_map();
19141914         break;
19151915   }
19161916
shelves/new_menus/src/mess/drivers/acrnsys1.c
r29304r29305
233233    MACHINE DRIVERS
234234***************************************************************************/
235235
236static const ins8154_interface ins8154_b1 =
237{
238   DEVCB_DRIVER_MEMBER(acrnsys1_state, ins8154_b1_port_a_r),
239   DEVCB_DRIVER_MEMBER(acrnsys1_state, ins8154_b1_port_a_w),
240   DEVCB_NULL,
241   DEVCB_DRIVER_MEMBER(acrnsys1_state, acrnsys1_led_segment_w),
242   DEVCB_NULL
243};
244
245236static MACHINE_CONFIG_START( acrnsys1, acrnsys1_state )
246237   /* basic machine hardware */
247238   MCFG_CPU_ADD("maincpu", M6502, 1008000)  /* 1.008 MHz */
r29304r29305
255246   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
256247
257248   /* devices */
258   MCFG_INS8154_ADD("b1", ins8154_b1)
249   MCFG_DEVICE_ADD("b1", INS8154, 0)
250   MCFG_INS8154_IN_A_CB(READ8(acrnsys1_state, ins8154_b1_port_a_r))
251   MCFG_INS8154_OUT_A_CB(WRITE8(acrnsys1_state, ins8154_b1_port_a_w))
252   MCFG_INS8154_OUT_B_CB(WRITE8(acrnsys1_state, acrnsys1_led_segment_w))
259253   MCFG_DEVICE_ADD("ic8_7445", TTL74145, 0)
260254   MCFG_CASSETTE_ADD( "cassette", default_cassette_interface )
261255   MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_c", acrnsys1_state, acrnsys1_c, attotime::from_hz(4800))
shelves/new_menus/src/mess/drivers/wicat.c
r29304r29305
887887
888888   MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette")
889889
890   MCFG_I8275_ADD("video",XTAL_19_6608MHz/8,9,wicat_display_pixels,DEVWRITELINE("videodma",am9517a_device, dreq0_w))
890   MCFG_DEVICE_ADD("video", I8275x, XTAL_19_6608MHz/8)
891   MCFG_I8275_CHARACTER_WIDTH(9)
892   MCFG_I8275_DISPLAY_CALLBACK(wicat_display_pixels)
893   MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("videodma",am9517a_device, dreq0_w))
891894   MCFG_I8275_IRQ_CALLBACK(WRITELINE(wicat_state,crtc_cb))
892895   MCFG_VIDEO_SET_SCREEN("screen")
893896
shelves/new_menus/src/mess/drivers/compis.c
r29304r29305
453453//  UPD7220_INTERFACE( hgdc_intf )
454454//-------------------------------------------------
455455
456static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
456UPD7220_DISPLAY_PIXELS_MEMBER( compis_state::hgdc_display_pixels )
457457{
458   compis_state *state = device->machine().driver_data<compis_state>();
459   UINT8 i,gfx = state->m_video_ram[address];
460   const pen_t *pen = state->m_palette->pens();
458   UINT8 i,gfx = m_video_ram[address];
459   const pen_t *pen = m_palette->pens();
461460
462461   for(i=0; i<8; i++)
463462      bitmap.pix32(y, x + i) = pen[BIT(gfx, i)];
464463}
465464
466static UPD7220_INTERFACE( hgdc_intf )
467{
468   hgdc_display_pixels,
469   NULL,
470   DEVCB_NULL,
471   DEVCB_NULL,
472   DEVCB_NULL
473};
474465
475
476466//-------------------------------------------------
477467//  I80186_INTERFACE( cpu_intf )
478468//-------------------------------------------------
r29304r29305
722712   MCFG_SCREEN_SIZE(640, 400)
723713   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
724714   MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
725   MCFG_UPD7220_ADD("upd7220", XTAL_4_433619MHz/2, hgdc_intf, upd7220_map) //unknown clock
715   
716   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4_433619MHz/2) // unknown clock
717   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
718   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(compis_state, hgdc_display_pixels)   
726719   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
720   
727721   MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette")
728722
729723   // devices
shelves/new_menus/src/mess/drivers/mz3500.c
r29304r29305
9797   // screen updates
9898   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
9999   DECLARE_PALETTE_INIT(mz3500);
100   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
101   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
102
100103protected:
101104   // driver_device overrides
102105   virtual void machine_start();
r29304r29305
137140(mirror of [5]?)
138141*/
139142
140static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
143UPD7220_DISPLAY_PIXELS_MEMBER( mz3500_state::hgdc_display_pixels )
141144{
142145   // ...
143146}
144147
145static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
148UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text )
146149{
147   mz3500_state *state = device->machine().driver_data<mz3500_state>();
148   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
150   const rgb_t *palette = m_palette->palette()->entry_list_raw();
149151   int x;
150152   int xi,yi;
151153   int tile;
r29304r29305
156158   UINT8 hires;
157159   UINT8 color_mode;
158160
159//  popmessage("%02x",state->m_crtc[6]);
161//  popmessage("%02x",m_crtc[6]);
160162
161   color_mode = state->m_crtc[4] & 1;
162   width80 = (state->m_crtc[5] & 2) >> 1;
163   hires = (state->m_crtc[6] & 1);
163   color_mode = m_crtc[4] & 1;
164   width80 = (m_crtc[5] & 2) >> 1;
165   hires = (m_crtc[6] & 1);
164166   char_size = (hires) ? 16 : 8;
165167
166168   for( x = 0; x < pitch; x++ )
167169   {
168      tile = (state->m_video_ram[((addr+x)*2) & 0x1fff] & 0xff);
169      attr = (state->m_video_ram[((addr+x)*2+1) & 0x3ffff] & 0x0f);
170      tile = (m_video_ram[((addr+x)*2) & 0x1fff] & 0xff);
171      attr = (m_video_ram[((addr+x)*2+1) & 0x3ffff] & 0x0f);
170172
171173      //if(hires)
172174      //  tile <<= 1;
173175
174176      for( yi = 0; yi < lr; yi++)
175177      {
176         tile_data = state->m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)];
178         tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)];
177179
178180         for( xi = 0; xi < 8; xi++)
179181         {
r29304r29305
234236   return 0;
235237}
236238
237
238
239static UPD7220_INTERFACE( hgdc_1_intf )
240{
241   NULL,
242   hgdc_draw_text,
243   DEVCB_NULL,
244   DEVCB_DEVICE_LINE_MEMBER("upd7220_gfx", upd7220_device, ext_sync_w),
245   DEVCB_NULL
246};
247
248static UPD7220_INTERFACE( hgdc_2_intf )
249{
250   hgdc_display_pixels,
251   NULL,
252   DEVCB_NULL,
253   DEVCB_NULL,
254   DEVCB_NULL
255};
256
257239READ8_MEMBER(mz3500_state::mz3500_ipl_r)
258240{
259241   return m_ipl_rom[offset];
r29304r29305
852834   MCFG_FLOPPY_DRIVE_ADD("upd765a:2", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats)
853835   MCFG_FLOPPY_DRIVE_ADD("upd765a:3", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats)
854836
855   MCFG_UPD7220_ADD("upd7220_chr", MAIN_CLOCK/5, hgdc_1_intf, upd7220_1_map)
856   MCFG_UPD7220_ADD("upd7220_gfx", MAIN_CLOCK/5, hgdc_2_intf, upd7220_2_map)
837   MCFG_DEVICE_ADD("upd7220_chr", UPD7220, MAIN_CLOCK/5)
838   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
839   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(mz3500_state, hgdc_draw_text)
840   MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_gfx", upd7220_device, ext_sync_w))   
857841
842   MCFG_DEVICE_ADD("upd7220_gfx", UPD7220, MAIN_CLOCK/5)
843   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
844   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz3500_state, hgdc_display_pixels)
845
858846   /* video hardware */
859847   MCFG_SCREEN_ADD("screen", RASTER)
860848   MCFG_SCREEN_REFRESH_RATE(60)
shelves/new_menus/src/mess/drivers/pc1500.c
r29304r29305
264264   palette.set_pen_color(1, rgb_t(92, 83, 88));
265265}
266266
267static const lh5810_interface lh5810_pc1500_config =
268{
269   DEVCB_DRIVER_MEMBER(pc1500_state, port_a_r),        //port A read
270   DEVCB_DRIVER_MEMBER(pc1500_state, kb_matrix_w),     //port A write
271   DEVCB_DRIVER_MEMBER(pc1500_state, port_b_r),        //port B read
272   DEVCB_NULL,                                         //port B write
273   DEVCB_DRIVER_MEMBER(pc1500_state, port_c_w),        //port C write
274   DEVCB_CPU_INPUT_LINE("maincpu", LH5801_LINE_MI)     //IRQ callback
275};
276
277267static MACHINE_CONFIG_START( pc1500, pc1500_state )
278268   MCFG_CPU_ADD("maincpu", LH5801, 1300000)            //1.3 MHz
279269   MCFG_CPU_PROGRAM_MAP( pc1500_mem )
r29304r29305
292282   MCFG_PALETTE_ADD("palette", 2)
293283   MCFG_PALETTE_INIT_OWNER(pc1500_state, pc1500)
294284
295   MCFG_LH5810_ADD("lh5810", lh5810_pc1500_config)
285   MCFG_DEVICE_ADD("lh5810", LH5810, 0)
286   MCFG_LH5810_PORTA_R_CB(READ8(pc1500_state, port_a_r))
287   MCFG_LH5810_PORTA_W_CB(WRITE8(pc1500_state, kb_matrix_w))
288   MCFG_LH5810_PORTB_R_CB(READ8(pc1500_state, port_b_r))
289   MCFG_LH5810_PORTC_W_CB(WRITE8(pc1500_state, port_c_w))
290   MCFG_LH5810_OUT_INT_CB(INPUTLINE("maincpu", LH5801_LINE_MI))
296291
297292   MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL)
298293MACHINE_CONFIG_END
shelves/new_menus/src/mess/drivers/saturn.c
r29304r29305
4343#include "sound/scsp.h"
4444#include "sound/cdda.h"
4545#include "machine/smpc.h"
46#include "machine/nvram.h"
4647#include "includes/stv.h"
4748#include "imagedev/chd_cd.h"
4849#include "coreutil.h"
r29304r29305
5253#include "bus/saturn/dram.h"
5354#include "bus/saturn/bram.h"
5455
55#include "mcfglgcy.h"
5656
57
5857class sat_console_state : public saturn_state
5958{
6059public:
6160   sat_console_state(const machine_config &mconfig, device_type type, const char *tag)
6261            : saturn_state(mconfig, type, tag)
6362            , m_exp(*this, "exp")
63            , m_nvram(*this, "nvram")
64            , m_smpc_nv(*this, "smpc_nv")
6465   { }
6566
6667   DECLARE_INPUT_CHANGED_MEMBER(key_stroke);
r29304r29305
8283   DECLARE_DRIVER_INIT(saturneu);
8384   DECLARE_DRIVER_INIT(saturnjp);
8485
86   void nvram_init(nvram_device &nvram, void *data, size_t size);
87
8588   required_device<sat_cart_slot_device> m_exp;
89   required_device<nvram_device> m_nvram;
90   required_device<nvram_device> m_smpc_nv;   // TODO: move this in the base class saturn_state and add it to stv in MAME
8691};
8792
8893
89/* TODO: if you change the driver configuration then NVRAM contents gets screwed, needs mods in MAME framework */
90static NVRAM_HANDLER(saturn)
91{
92   sat_console_state *state = machine.driver_data<sat_console_state>();
93   static const UINT32 BUP_SIZE = 32*1024;
94   UINT8 backup_file[(BUP_SIZE)+4];
95   static const UINT8 init[16] =
96   {
97      'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't'
98   };
99   UINT32 i;
100
101   if (read_or_write)
102   {
103      for(i=0;i<BUP_SIZE;i++)
104         backup_file[i] = state->m_backupram[i];
105      for(i=0;i<4;i++)
106         backup_file[i+(BUP_SIZE)] = state->m_smpc.SMEM[i];
107
108      file->write(backup_file, (BUP_SIZE)+4);
109   }
110   else
111   {
112      if (file)
113      {
114         file->read(backup_file, (BUP_SIZE)+4);
115
116         for(i=0;i<BUP_SIZE;i++)
117            state->m_backupram[i] = backup_file[i];
118         for(i=0;i<4;i++)
119            state->m_smpc.SMEM[i] = backup_file[i+BUP_SIZE];
120      }
121      else
122      {
123         UINT8 j;
124         memset(state->m_backupram, 0, BUP_SIZE);
125         for (i = 0; i < 4; i++)
126         {
127            for(j=0;j<16;j++)
128               state->m_backupram[i*16+j] = init[j];
129         }
130         memset(state->m_smpc.SMEM, 0, 4); // TODO: default for each region
131      }
132   }
133}
134
13594READ8_MEMBER(sat_console_state::saturn_cart_type_r)
13695{
13796   if (m_exp)
r29304r29305
585544   PORT_CONFSETTING(0x01,"One Shot (Hack)")
586545INPUT_PORTS_END
587546
547
548/* TODO: if you change the driver configuration then NVRAM contents gets screwed, needs mods in MAME framework */
549void sat_console_state::nvram_init(nvram_device &nvram, void *data, size_t size)
550{
551   static const UINT8 init[64] = {
552   'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't',
553   'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't',
554   'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't',
555   'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', };
556   
557   memset(data, 0x00, size);
558   memcpy(data, init, sizeof(init));
559}
560
561
588562static const sh2_cpu_core sh2_conf_master = { 0, NULL };
589563static const sh2_cpu_core sh2_conf_slave  = { 1, NULL };
590564
591565
592MACHINE_START_MEMBER(sat_console_state,saturn)
566MACHINE_START_MEMBER(sat_console_state, saturn)
593567{
594568   system_time systime;
595569   machine().base_datetime(systime);
r29304r29305
602576   m_maincpu->space(AS_PROGRAM).nop_readwrite(0x04000000, 0x047fffff);
603577   m_slave->space(AS_PROGRAM).nop_readwrite(0x04000000, 0x047fffff);
604578
579   m_nvram->set_base(m_backupram, 0x8000);
580   m_smpc_nv->set_base(&m_smpc.SMEM, 4);
581
605582   if (m_exp)
606583   {
607584      switch (m_exp->get_cart_type())
r29304r29305
708685   m_NMI_reset = 0;
709686   m_smpc.slave_on = 0;
710687
711
712688   //memset(stv_m_workram_l, 0, 0x100000);
713689   //memset(stv_m_workram_h, 0, 0x100000);
714690
r29304r29305
765741   MCFG_MACHINE_START_OVERRIDE(sat_console_state,saturn)
766742   MCFG_MACHINE_RESET_OVERRIDE(sat_console_state,saturn)
767743
768   MCFG_NVRAM_HANDLER(saturn)
744   MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", sat_console_state, nvram_init)
745   MCFG_NVRAM_ADD_0FILL("smpc_nv") // TODO: default for each region (+ move it inside SMPC when converted to device)
769746
770747   MCFG_TIMER_DRIVER_ADD("sector_timer", sat_console_state, stv_sector_cb)
771748   MCFG_TIMER_DRIVER_ADD("sh1_cmd", sat_console_state, stv_sh1_sim)
shelves/new_menus/src/mess/drivers/zorba.c
r29304r29305
394394   MCFG_PIT8253_CLK1(XTAL_24MHz / 3) /* Timer 1: ? */
395395   MCFG_PIT8253_CLK2(XTAL_24MHz / 3) /* Timer 2: ? */
396396
397   MCFG_I8275_ADD("crtc", XTAL_14_31818MHz/7, 8, zorba_update_chr, DEVWRITELINE("dma", z80dma_device, rdy_w))
397   MCFG_DEVICE_ADD("crtc", I8275x, XTAL_14_31818MHz/7)
398   MCFG_I8275_CHARACTER_WIDTH(8)
399   MCFG_I8275_DISPLAY_CALLBACK(zorba_update_chr)
400   MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w))
398401   MCFG_I8275_IRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
399402   MCFG_FD1793x_ADD("fdc", XTAL_24MHz / 24)
400403   MCFG_FLOPPY_DRIVE_ADD("fdc:0", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats)
shelves/new_menus/src/mess/drivers/pc.c
r29304r29305
299299
300300static MACHINE_CONFIG_DERIVED(bondwell, pccga)
301301   MCFG_DEVICE_REMOVE("maincpu")
302   MCFG_CPU_PC(pc8, pc8, I8088, 12000000)
302   MCFG_CPU_PC(pc8, pc8, I8088, 4772720) // turbo?
303303MACHINE_CONFIG_END
304304
305305static MACHINE_CONFIG_DERIVED(mk88, poisk2)
shelves/new_menus/src/mess/drivers/apc.c
r29304r29305
151151   UINT8 m_dma_offset[4];
152152
153153   IRQ_CALLBACK_MEMBER(irq_callback);
154   
155   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
156   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
154157
155158protected:
156159   // driver_device overrides
r29304r29305
179182}
180183
181184
182static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
185UPD7220_DISPLAY_PIXELS_MEMBER( apc_state::hgdc_display_pixels )
183186{
184187   // ...
185188}
186189
187static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
190UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text )
188191{
189   apc_state *state = device->machine().driver_data<apc_state>();
190   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
192   const rgb_t *palette = m_palette->palette()->entry_list_raw();
191193   int xi,yi,yi_trans;
192194   int x;
193195   UINT8 char_size;
194196//  UINT8 interlace_on;
195197
196//  if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
198//  if(m_video_ff[DISPLAY_REG] == 0) //screen is off
197199//      return;
198200
199//  interlace_on = state->m_video_reg[2] == 0x10; /* TODO: correct? */
201//  interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */
200202   char_size = 19;
201203
202204   for(x=0;x<pitch;x++)
r29304r29305
208210      UINT32 tile_addr;
209211      UINT8 tile_sel;
210212
211//      tile_addr = addr+(x*(state->m_video_ff[WIDTH40_REG]+1));
213//      tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1));
212214      tile_addr = addr+(x*(1));
213215
214      tile = state->m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0x00ff;
215      tile_sel = state->m_video_ram_1[(tile_addr*2) & 0x1fff] & 0x00ff;
216      attr = (state->m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0x00ff);
216      tile = m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0x00ff;
217      tile_sel = m_video_ram_1[(tile_addr*2) & 0x1fff] & 0x00ff;
218      attr = (m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0x00ff);
217219
218220      u_line = attr & 0x01;
219221      o_line = attr & 0x02;
r29304r29305
233235            res_x = (x*8+xi);
234236            res_y = y*lr+yi;
235237
236            if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
238            if(!machine().first_screen()->visible_area().contains(res_x, res_y))
237239               continue;
238240
239241            /*
r29304r29305
257259               if(yi & 0x10)
258260                  tile_data = 0;
259261               else
260                  tile_data = state->m_aux_pcg[(tile & 0xff)*0x20+yi*2];
262                  tile_data = m_aux_pcg[(tile & 0xff)*0x20+yi*2];
261263            }
262264            else
263               tile_data = state->m_char_rom[(tile & 0x7f)+((tile & 0x80)<<4)+((yi_trans & 0xf)*0x80)+((yi_trans & 0x10)<<8)];
265               tile_data = m_char_rom[(tile & 0x7f)+((tile & 0x80)<<4)+((yi_trans & 0xf)*0x80)+((yi_trans & 0x10)<<8)];
264266
265267            if(reverse) { tile_data^=0xff; }
266268            if(u_line && yi == lr-1) { tile_data = 0xff; }
267269            if(o_line && yi == 0) { tile_data = 0xff; }
268270            if(v_line)  { tile_data|=1; }
269            if(blink && device->machine().first_screen()->frame_number() & 0x20) { tile_data = 0; } // TODO: rate & correct behaviour
271            if(blink && machine().first_screen()->frame_number() & 0x20) { tile_data = 0; } // TODO: rate & correct behaviour
270272
271            if(cursor_on && cursor_addr == tile_addr && device->machine().first_screen()->frame_number() & 0x10)
273            if(cursor_on && cursor_addr == tile_addr && machine().first_screen()->frame_number() & 0x10)
272274               tile_data^=0xff;
273275
274276            if(yi >= char_size)
r29304r29305
758760   m_keyb.sig = 0;
759761}
760762
761
762static UPD7220_INTERFACE( hgdc_1_intf )
763{
764   NULL,
765   hgdc_draw_text,
766   DEVCB_NULL,
767   DEVCB_NULL,
768   DEVCB_NULL
769};
770
771
772static UPD7220_INTERFACE( hgdc_2_intf )
773{
774   hgdc_display_pixels,
775   NULL,
776   DEVCB_NULL,
777   DEVCB_NULL,
778   DEVCB_NULL
779};
780
781763static const gfx_layout charset_8x16 =
782764{
783765   8, 16,
r29304r29305
1000982
1001983   MCFG_GFXDECODE_ADD("gfxdecode", "palette", apc)
1002984
1003   MCFG_UPD7220_ADD("upd7220_chr", XTAL_3_579545MHz, hgdc_1_intf, upd7220_1_map) // unk clock
1004   MCFG_UPD7220_ADD("upd7220_btm", XTAL_3_579545MHz, hgdc_2_intf, upd7220_2_map) // unk clock
985   MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 3579545) // unk clock
986   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
987   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(apc_state, hgdc_draw_text)   
1005988
989   MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 3579545) // unk clock
990   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
991   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(apc_state, hgdc_display_pixels)   
992
1006993   MCFG_PALETTE_ADD("palette", 16)
1007994   MCFG_PALETTE_INIT_OWNER(apc_state,apc)
1008995
shelves/new_menus/src/mess/drivers/if800.c
r29304r29305
2828   virtual void machine_reset();
2929   required_device<cpu_device> m_maincpu;
3030   required_device<palette_device> m_palette;
31   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
3132};
3233
33static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
34UPD7220_DISPLAY_PIXELS_MEMBER( if800_state::hgdc_display_pixels )
3435{
35   if800_state *state = device->machine().driver_data<if800_state>();
36   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
36   const rgb_t *palette = m_palette->palette()->entry_list_raw();
3737
3838   int xi,gfx;
3939   UINT8 pen;
4040
41   gfx = state->m_video_ram[address];
41   gfx = m_video_ram[address];
4242
4343   for(xi=0;xi<8;xi++)
4444   {
r29304r29305
7373{
7474}
7575
76static UPD7220_INTERFACE( hgdc_intf )
77{
78   hgdc_display_pixels,
79   NULL,
80   DEVCB_NULL,
81   DEVCB_NULL,
82   DEVCB_NULL
83};
84
8576static ADDRESS_MAP_START( upd7220_map, AS_0, 8, if800_state )
8677   AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram")
8778ADDRESS_MAP_END
r29304r29305
9485
9586
9687//  MCFG_PIC8259_ADD( "pic8259", if800_pic8259_config )
97   MCFG_UPD7220_ADD("upd7220", 8000000/4, hgdc_intf, upd7220_map)
88   MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/4)
89   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
90   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(if800_state, hgdc_display_pixels)
9891
9992   /* video hardware */
10093   MCFG_SCREEN_ADD("screen", RASTER)
shelves/new_menus/src/mess/drivers/mz6500.c
r29304r29305
3333   virtual void video_start();
3434   required_device<cpu_device> m_maincpu;
3535   required_device<palette_device> m_palette;
36   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
3637};
3738
38static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
39UPD7220_DISPLAY_PIXELS_MEMBER( mz6500_state::hgdc_display_pixels )
3940{
40   mz6500_state *state = device->machine().driver_data<mz6500_state>();
41   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
41   const rgb_t *palette = m_palette->palette()->entry_list_raw();
4242   int gfx[3];
4343   UINT8 i,pen;
4444
45   gfx[0] = state->m_video_ram[address + 0x00000];
46   gfx[1] = state->m_video_ram[address + 0x10000];
47   gfx[2] = state->m_video_ram[address + 0x20000];
45   gfx[0] = m_video_ram[address + 0x00000];
46   gfx[1] = m_video_ram[address + 0x10000];
47   gfx[2] = m_video_ram[address + 0x20000];
4848
4949   for(i=0; i<8; i++)
5050   {
r29304r29305
126126   SLOT_INTERFACE( "525hd", FLOPPY_525_HD )
127127SLOT_INTERFACE_END
128128
129static UPD7220_INTERFACE( hgdc_intf )
130{
131   hgdc_display_pixels,
132   NULL,
133   DEVCB_NULL,
134   DEVCB_NULL,
135   DEVCB_NULL
136};
137
138129static ADDRESS_MAP_START( upd7220_map, AS_0, 8, mz6500_state )
139130   AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram")
140131ADDRESS_MAP_END
r29304r29305
157148   MCFG_PALETTE_ADD("palette", 8)
158149
159150   /* Devices */
160   MCFG_UPD7220_ADD("upd7220", 8000000/6, hgdc_intf, upd7220_map) // unk clock
151   MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/6) // unk clock
152   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
153   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz6500_state, hgdc_display_pixels)
154
161155   MCFG_UPD765A_ADD("upd765", true, true)
162156   MCFG_FLOPPY_DRIVE_ADD("upd765:0", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats)
163157   MCFG_FLOPPY_DRIVE_ADD("upd765:1", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats)
shelves/new_menus/src/mess/drivers/dmv.c
r29304r29305
5656
5757   required_shared_ptr<UINT8> m_video_ram;
5858   required_device<palette_device> m_palette;
59
60   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
61   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
5962};
6063
6164
r29304r29305
131134   machine().device<upi41_cpu_device>("kb_ctrl_mcu")->upi41_master_w(space, offset, data);
132135}
133136
134static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
137UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels )
135138{
136139   //TODO
137140}
138141
139static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
142UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text )
140143{
141   dmv_state *state = device->machine().driver_data<dmv_state>();
142   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
143   UINT8 * chargen = state->memregion("maincpu")->base() + 0x1000;
144   const rgb_t *palette = m_palette->palette()->entry_list_raw();
145   UINT8 * chargen = memregion("maincpu")->base() + 0x1000;
144146
145147   for( int x = 0; x < pitch; x++ )
146148   {
147      UINT8 tile = state->m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff;
149      UINT8 tile = m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff;
148150
149151      for( int yi = 0; yi < lr; yi++)
150152      {
r29304r29305
161163            res_x = x * 8 + xi;
162164            res_y = y * lr + yi;
163165
164            if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
166            if(!machine().first_screen()->visible_area().contains(res_x, res_y))
165167               continue;
166168
167169            if(yi >= 16) { pen = 0; }
r29304r29305
250252GFXDECODE_END
251253
252254
253static UPD7220_INTERFACE( hgdc_intf )
254{
255   hgdc_display_pixels,
256   hgdc_draw_text,
257   DEVCB_NULL,
258   DEVCB_NULL,
259   DEVCB_NULL
260};
261
262
263255//------------------------------------------------------------------------------------
264256//   I8237_INTERFACE
265257//------------------------------------------------------------------------------------
r29304r29305
322314   MCFG_DEFAULT_LAYOUT(layout_dmv)
323315
324316   // devices
325   MCFG_UPD7220_ADD( "upd7220", XTAL_5MHz/2, hgdc_intf, upd7220_map ) // unk clock
317   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_5MHz/2) // unk clock
318   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
319   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(dmv_state, hgdc_display_pixels)
320   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(dmv_state, hgdc_draw_text)
321
326322   MCFG_I8237_ADD( "dma8237", XTAL_4MHz, dmv_dma8237_config )
327323   MCFG_UPD765A_ADD( "upd765", true, true )
328324   MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8237", am9517a_device, dreq3_w))
shelves/new_menus/src/mess/drivers/mk14.c
r29304r29305
134134{
135135}
136136
137static const ins8154_interface mk14_ins8154 =
138{
139   DEVCB_NULL,
140   DEVCB_NULL,
141   DEVCB_NULL,
142   DEVCB_NULL,
143   DEVCB_NULL
144};
145
146137static MACHINE_CONFIG_START( mk14, mk14_state )
147138   /* basic machine hardware */
148139   // IC1 1SP-8A/600 (8060) SC/MP Microprocessor
r29304r29305
154145   MCFG_DEFAULT_LAYOUT(layout_mk14)
155146
156147   /* devices */
157   MCFG_INS8154_ADD("ic8", mk14_ins8154)
148   MCFG_DEVICE_ADD("ic8", INS8154, 0)
158149MACHINE_CONFIG_END
159150
160151/* ROM definition */
shelves/new_menus/src/mess/drivers/qx10.c
r29304r29305
148148   required_device<cpu_device> m_maincpu;
149149   required_device<ram_device> m_ram;
150150   required_device<palette_device> m_palette;
151   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
152   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
151153};
152154
153static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
155UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels )
154156{
155   qx10_state *state = device->machine().driver_data<qx10_state>();
156   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
157   const rgb_t *palette = m_palette->palette()->entry_list_raw();
157158   int xi,gfx[3];
158159   UINT8 pen;
159160
160   if(state->m_color_mode)
161   if(m_color_mode)
161162   {
162      gfx[0] = state->m_video_ram[(address) + 0x00000];
163      gfx[1] = state->m_video_ram[(address) + 0x20000];
164      gfx[2] = state->m_video_ram[(address) + 0x40000];
163      gfx[0] = m_video_ram[(address) + 0x00000];
164      gfx[1] = m_video_ram[(address) + 0x20000];
165      gfx[2] = m_video_ram[(address) + 0x40000];
165166   }
166167   else
167168   {
168      gfx[0] = state->m_video_ram[address];
169      gfx[0] = m_video_ram[address];
169170      gfx[1] = 0;
170171      gfx[2] = 0;
171172   }
r29304r29305
180181   }
181182}
182183
183static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
184UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text )
184185{
185   qx10_state *state = device->machine().driver_data<qx10_state>();
186   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
186   const rgb_t *palette = m_palette->palette()->entry_list_raw();
187187   int x;
188188   int xi,yi;
189189   int tile;
r29304r29305
194194
195195   for( x = 0; x < pitch; x++ )
196196   {
197      tile = state->m_video_ram[(addr+x)*2];
198      attr = state->m_video_ram[(addr+x)*2+1];
197      tile = m_video_ram[(addr+x)*2];
198      attr = m_video_ram[(addr+x)*2+1];
199199
200      color = (state->m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */
200      color = (m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */
201201
202202      for( yi = 0; yi < lr; yi++)
203203      {
204         tile_data = (state->m_char_rom[tile*16+yi]);
204         tile_data = (m_char_rom[tile*16+yi]);
205205
206206         if(attr & 8)
207207            tile_data^=0xff;
r29304r29305
209209         if(cursor_on && cursor_addr == addr+x) //TODO
210210            tile_data^=0xff;
211211
212         if(attr & 0x80 && device->machine().first_screen()->frame_number() & 0x10) //TODO: check for blinking interval
212         if(attr & 0x80 && machine().first_screen()->frame_number() & 0x10) //TODO: check for blinking interval
213213            tile_data=0;
214214
215215         for( xi = 0; xi < 8; xi++)
r29304r29305
219219            res_x = x * 8 + xi;
220220            res_y = y * lr + yi;
221221
222            if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
222            if(!machine().first_screen()->visible_area().contains(res_x, res_y))
223223               continue;
224224
225225            if(yi >= 16)
r29304r29305
766766   m_char_rom = memregion("chargen")->base();
767767}
768768
769static UPD7220_INTERFACE( hgdc_intf )
770{
771   hgdc_display_pixels,
772   hgdc_draw_text,
773   DEVCB_NULL,
774   DEVCB_NULL,
775   DEVCB_NULL
776};
777
778769PALETTE_INIT_MEMBER(qx10_state, qx10)
779770{
780771   // ...
r29304r29305
858849   MCFG_I8255_ADD("i8255", qx10_i8255_interface)
859850   MCFG_I8237_ADD("8237dma_1", MAIN_CLK/4, qx10_dma8237_1_interface)
860851   MCFG_I8237_ADD("8237dma_2", MAIN_CLK/4, qx10_dma8237_2_interface)
861   MCFG_UPD7220_ADD("upd7220", MAIN_CLK/6, hgdc_intf, upd7220_map) // unk clock
852   
853   MCFG_DEVICE_ADD("upd7220", UPD7220, MAIN_CLK/6) // unk clock
854   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
855   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(qx10_state, hgdc_display_pixels)
856   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(qx10_state, hgdc_draw_text)
862857   MCFG_VIDEO_SET_SCREEN("screen")
858
863859   MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz )
864860   MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir2_w))
865861   MCFG_UPD765A_ADD("upd765", true, true)
shelves/new_menus/src/mess/drivers/a5105.c
r29304r29305
8888   required_device<ram_device> m_ram;
8989   required_device<gfxdecode_device> m_gfxdecode;
9090   required_device<palette_device> m_palette;
91   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
92   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
9193};
9294
9395/* TODO */
94static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
96UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels )
9597{
96   a5105_state *state = device->machine().driver_data<a5105_state>();
97   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
98   const rgb_t *palette = m_palette->palette()->entry_list_raw();
9899
99100   int xi,gfx;
100101   UINT8 pen;
101102
102   gfx = state->m_video_ram[address & 0x1ffff];
103   gfx = m_video_ram[address & 0x1ffff];
103104
104105   for(xi=0;xi<8;xi++)
105106   {
r29304r29305
109110   }
110111}
111112
112static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
113UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text )
113114{
114   a5105_state *state = device->machine().driver_data<a5105_state>();
115   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
115   const rgb_t *palette = m_palette->palette()->entry_list_raw();
116116   int x;
117117   int xi,yi;
118118   int tile,color;
r29304r29305
120120
121121   for( x = 0; x < pitch; x++ )
122122   {
123      tile = (state->m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff);
124      color = (state->m_video_ram[((addr+x)*2+1) & 0x1ffff] & 0x0f);
123      tile = (m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff);
124      color = (m_video_ram[((addr+x)*2+1) & 0x1ffff] & 0x0f);
125125
126126      for( yi = 0; yi < lr; yi++)
127127      {
128         tile_data = state->m_char_ram[(tile*8+yi) & 0x7ff];
128         tile_data = m_char_ram[(tile*8+yi) & 0x7ff];
129129
130         if(cursor_on && cursor_addr == addr+x && device->machine().first_screen()->frame_number() & 0x10)
130         if(cursor_on && cursor_addr == addr+x && machine().first_screen()->frame_number() & 0x10)
131131            tile_data^=0xff;
132132
133133         for( xi = 0; xi < 8; xi++)
r29304r29305
141141            if(yi >= 8) { pen = 0; }
142142
143143            /* TODO: pitch is currently 40, this should actually go in the upd7220 device */
144            if(!device->machine().first_screen()->visible_area().contains(res_x*2+0, res_y))
144            if(!machine().first_screen()->visible_area().contains(res_x*2+0, res_y))
145145               continue;
146146
147147            bitmap.pix32(res_y, res_x*2+0) = palette[pen];
148148
149            if(!device->machine().first_screen()->visible_area().contains(res_x*2+1, res_y))
149            if(!machine().first_screen()->visible_area().contains(res_x*2+1, res_y))
150150               continue;
151151
152152            bitmap.pix32(res_y, res_x*2+1) = palette[pen];
r29304r29305
539539   m_char_ram = memregion("pcg")->base();
540540}
541541
542static UPD7220_INTERFACE( hgdc_intf )
543{
544   hgdc_display_pixels,
545   hgdc_draw_text,
546   DEVCB_NULL,
547   DEVCB_NULL,
548   DEVCB_NULL
549};
550
551542static ADDRESS_MAP_START( upd7220_map, AS_0, 8, a5105_state)
552543   ADDRESS_MAP_GLOBAL_MASK(0x1ffff)
553544   AM_RANGE(0x00000, 0x1ffff) AM_RAM AM_SHARE("video_ram")
r29304r29305
613604   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
614605
615606   /* Devices */
616   MCFG_UPD7220_ADD("upd7220", XTAL_15MHz / 16, hgdc_intf, upd7220_map) // unk clock
607   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_15MHz / 16) // unk clock
608   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
609   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(a5105_state, hgdc_display_pixels)
610   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(a5105_state, hgdc_draw_text)
611
617612   MCFG_Z80CTC_ADD( "z80ctc", XTAL_15MHz / 4, a5105_ctc_intf )
618613   MCFG_Z80PIO_ADD( "z80pio", XTAL_15MHz / 4, a5105_pio_intf )
619614
shelves/new_menus/src/mess/drivers/vt240.c
r29304r29305
3030   vt240_state(const machine_config &mconfig, device_type type, const char *tag)
3131      : driver_device(mconfig, type, tag),
3232      m_maincpu(*this, "maincpu"),
33      m_hgdc(*this, "upd7220")
34      ,
33      m_hgdc(*this, "upd7220"),
3534      m_video_ram(*this, "video_ram"){ }
3635
3736   required_device<cpu_device> m_maincpu;
r29304r29305
4847   DECLARE_DRIVER_INIT(vt240);
4948   virtual void machine_reset();
5049   INTERRUPT_GEN_MEMBER(vt240_irq);
50   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
5151};
5252
5353/* TODO */
54static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
54UPD7220_DRAW_TEXT_LINE_MEMBER( vt240_state::hgdc_draw_text )
5555{
56   //vt240_state *state = device->machine().driver_data<a5105_state>();
5756   //int x;
5857   //int xi,yi;
5958   //int tile,color;
r29304r29305
6766
6867      for( yi = 0; yi < lr; yi++)
6968      {
70         tile_data = state->m_char_rom[(tile*8+yi) & 0x7ff];
69         tile_data = m_char_rom[(tile*8+yi) & 0x7ff];
7170
7271         if(cursor_on && cursor_addr == addr+x) //TODO
7372            tile_data^=0xff;
r29304r29305
131130{
132131}
133132
134static UPD7220_INTERFACE( hgdc_intf )
135{
136   NULL,
137   hgdc_draw_text,
138   DEVCB_NULL,
139   DEVCB_NULL,
140   DEVCB_NULL
141};
142
143133INTERRUPT_GEN_MEMBER(vt240_state::vt240_irq)
144134{
145135   //device.execute().set_input_line(I8085_RST65_LINE, ASSERT_LINE);
r29304r29305
179169   MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette")
180170   MCFG_GFXDECODE_ADD("gfxdecode", "palette", vt240)
181171
182   MCFG_UPD7220_ADD("upd7220", XTAL_4MHz / 4, hgdc_intf, upd7220_map) //unknown clock
172   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4MHz / 4)
173   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
174   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(vt240_state, hgdc_draw_text)
183175MACHINE_CONFIG_END
184176
185177/* ROM definition */
shelves/new_menus/src/mess/drivers/pc9801.c
r29304r29305
683683   DECLARE_WRITE8_MEMBER(pc9821_ext2_video_ff_w);
684684
685685   DECLARE_FLOPPY_FORMATS( floppy_formats );
686    UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
687    UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
686688
687689private:
688690   UINT8 m_sdip_read(UINT16 port, UINT8 sdip_offset);
r29304r29305
781783   return 0;
782784}
783785
784static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
786UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels )
785787{
786   pc9801_state *state = device->machine().driver_data<pc9801_state>();
787   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
788   const rgb_t *palette = m_palette->palette()->entry_list_raw();
788789   int xi;
789790   int res_x,res_y;
790791   UINT8 pen;
791792   UINT8 interlace_on;
792793   UINT8 colors16_mode;
793794
794   if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
795   if(m_video_ff[DISPLAY_REG] == 0) //screen is off
795796      return;
796797
797//  popmessage("%02x %d",state->m_video_ff[INTERLACE_REG],device->machine().first_screen()->visible_area().max_y + 1);
798//  interlace_on = ((device->machine().first_screen()->visible_area().max_y + 1) >= 400) ? 1 : 0;
799   interlace_on = state->m_video_ff[INTERLACE_REG];
800   colors16_mode = (state->m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8;
798//  popmessage("%02x %d",m_video_ff[INTERLACE_REG],machine().first_screen()->visible_area().max_y + 1);
799//  interlace_on = ((machine().first_screen()->visible_area().max_y + 1) >= 400) ? 1 : 0;
800   interlace_on = m_video_ff[INTERLACE_REG];
801   colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8;
801802
802   if(state->m_ex_video_ff[ANALOG_256_MODE])
803   if(m_ex_video_ff[ANALOG_256_MODE])
803804   {
804805      for(xi=0;xi<8;xi++)
805806      {
806807         res_x = x + xi;
807808         res_y = y;
808809
809         if(!device->machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
810         if(!machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
810811            return;
811812
812         pen = state->m_ext_gvram[(address*8+xi)+(state->m_vram_disp*0x40000)];
813         pen = m_ext_gvram[(address*8+xi)+(m_vram_disp*0x40000)];
813814
814815         bitmap.pix32(res_y*2+0, res_x) = palette[pen + 0x20];
815         if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
816         if(machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
816817            bitmap.pix32(res_y*2+1, res_x) = palette[pen + 0x20];
817818      }
818819   }
r29304r29305
823824         res_x = x + xi;
824825         res_y = y;
825826
826         pen = ((state->m_video_ram_2[(address & 0x7fff) + (0x08000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
827         pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x10000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
828         pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x18000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
829         if(state->m_ex_video_ff[ANALOG_16_MODE])
830            pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 8 : 0;
827         pen = ((m_video_ram_2[(address & 0x7fff) + (0x08000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
828         pen|= ((m_video_ram_2[(address & 0x7fff) + (0x10000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
829         pen|= ((m_video_ram_2[(address & 0x7fff) + (0x18000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
830         if(m_ex_video_ff[ANALOG_16_MODE])
831            pen|= ((m_video_ram_2[(address & 0x7fff) + (0) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 8 : 0;
831832
832833         if(interlace_on)
833834         {
834            if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
835            if(machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
835836               bitmap.pix32(res_y*2+0, res_x) = palette[pen + colors16_mode];
836837            /* TODO: it looks like that PC-98xx can only display even lines ... */
837            if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
838            if(machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
838839               bitmap.pix32(res_y*2+1, res_x) = palette[pen + colors16_mode];
839840         }
840841         else
r29304r29305
843844   }
844845}
845846
846static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
847UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text )
847848{
848   pc9801_state *state = device->machine().driver_data<pc9801_state>();
849   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
849   const rgb_t *palette = m_palette->palette()->entry_list_raw();
850850   int xi,yi;
851851   int x;
852852   UINT8 char_size;
r29304r29305
856856   UINT8 kanji_sel;
857857   UINT8 x_step;
858858
859   if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
859   if(m_video_ff[DISPLAY_REG] == 0) //screen is off
860860      return;
861861
862//  interlace_on = state->m_video_ff[INTERLACE_REG];
863   char_size = state->m_video_ff[FONTSEL_REG] ? 16 : 8;
862//  interlace_on = m_video_ff[INTERLACE_REG];
863   char_size = m_video_ff[FONTSEL_REG] ? 16 : 8;
864864   tile = 0;
865865
866866   for(x=0;x<pitch;x+=x_step)
r29304r29305
873873      UINT8 knj_tile;
874874      UINT8 gfx_mode;
875875
876      tile_addr = addr+(x*(state->m_video_ff[WIDTH40_REG]+1));
876      tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1));
877877
878878      kanji_sel = 0;
879879      kanji_lr = 0;
880880
881      tile = state->m_video_ram_1[(tile_addr*2) & 0x1fff] & 0xff;
882      knj_tile = state->m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0xff;
881      tile = m_video_ram_1[(tile_addr*2) & 0x1fff] & 0xff;
882      knj_tile = m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0xff;
883883      if(knj_tile)
884884      {
885885         /* Note: bit 7 doesn't really count, if a kanji is enabled then the successive tile is always the second part of it.
r29304r29305
900900      else
901901         x_step = 1;
902902
903      attr = (state->m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0xff);
903      attr = (m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0xff);
904904
905905      secret = (attr & 1) ^ 1;
906906      blink = attr & 2;
907907      reverse = attr & 4;
908908      u_line = attr & 8;
909      v_line = (state->m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10;
910      gfx_mode = (state->m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0;
909      v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10;
910      gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0;
911911      color = (attr & 0xe0) >> 5;
912912
913913      for(kanji_lr=0;kanji_lr<x_step;kanji_lr++)
r29304r29305
918918            {
919919               int res_x,res_y;
920920
921               res_x = ((x+kanji_lr)*8+xi) * (state->m_video_ff[WIDTH40_REG]+1);
922               res_y = y*lr+yi - (state->m_txt_scroll_reg[3] & 0xf);
921               res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1);
922               res_y = y*lr+yi - (m_txt_scroll_reg[3] & 0xf);
923923
924               if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
924               if(!machine().first_screen()->visible_area().contains(res_x, res_y))
925925                  continue;
926926
927927               tile_data = 0;
r29304r29305
952952                     tile_data = ((tile >> gfx_bit) & 1) ? 0xff : 0x00;
953953                  }
954954                  else if(kanji_sel)
955                     tile_data = (state->m_kanji_rom[tile*0x20+yi*2+kanji_lr]);
955                     tile_data = (m_kanji_rom[tile*0x20+yi*2+kanji_lr]);
956956                  else
957                     tile_data = (state->m_char_rom[tile*char_size+state->m_video_ff[FONTSEL_REG]*0x800+yi]);
957                     tile_data = (m_char_rom[tile*char_size+m_video_ff[FONTSEL_REG]*0x800+yi]);
958958               }
959959
960960               if(reverse) { tile_data^=0xff; }
r29304r29305
962962               if(v_line)  { tile_data|=8; }
963963
964964               /* TODO: proper blink rate for these two */
965               if(cursor_on && cursor_addr == tile_addr && device->machine().first_screen()->frame_number() & 0x10)
965               if(cursor_on && cursor_addr == tile_addr && machine().first_screen()->frame_number() & 0x10)
966966                  tile_data^=0xff;
967967
968               if(blink && device->machine().first_screen()->frame_number() & 0x10)
968               if(blink && machine().first_screen()->frame_number() & 0x10)
969969                  tile_data^=0xff;
970970
971971               if(yi >= char_size)
r29304r29305
976976               if(pen != -1)
977977                  bitmap.pix32(res_y, res_x) = palette[pen];
978978
979               if(state->m_video_ff[WIDTH40_REG])
979               if(m_video_ff[WIDTH40_REG])
980980               {
981                  if(!device->machine().first_screen()->visible_area().contains(res_x+1, res_y))
981                  if(!machine().first_screen()->visible_area().contains(res_x+1, res_y))
982982                     continue;
983983
984984                  if(pen != -1)
r29304r29305
990990   }
991991}
992992
993static UPD7220_INTERFACE( hgdc_1_intf )
994{
995   NULL,
996   hgdc_draw_text,
997   DEVCB_NULL,
998   DEVCB_DEVICE_LINE_MEMBER("upd7220_btm", upd7220_device, ext_sync_w),
999   DEVCB_NULL
1000};
1001993
1002static UPD7220_INTERFACE( hgdc_2_intf )
1003{
1004   hgdc_display_pixels,
1005   NULL,
1006   DEVCB_NULL,
1007   DEVCB_NULL,
1008   DEVCB_NULL
1009};
1010
1011
1012994#if 0
1013995READ8_MEMBER(pc9801_state::pc9801_xx_r)
1014996{
r29304r29305
36723654   MCFG_SCREEN_SIZE(640, 480)
36733655   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
36743656
3675   MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
3676   MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
3657    MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
3658    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
3659    MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
3660    MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))   
36773661
3662    MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
3663    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
3664    MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
3665
36783666   MCFG_PALETTE_ADD("palette", 16)
36793667   MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
36803668   MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc9801)
r29304r29305
37443732   MCFG_SCREEN_SIZE(640, 480)
37453733   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
37463734
3747   MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
3748   MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
3735    MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
3736    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
3737    MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
3738    MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))   
37493739
3740    MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
3741    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
3742    MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
3743
37503744   MCFG_PALETTE_ADD("palette", 16+16)
37513745   MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
37523746   MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc9801)
r29304r29305
38303824   MCFG_SCREEN_SIZE(640, 480)
38313825   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
38323826
3833   MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
3834   MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
3827    MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
3828    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
3829    MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
3830    MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))   
38353831
3832    MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
3833    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
3834    MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
3835
38363836   MCFG_PALETTE_ADD("palette", 16+16+256)
38373837   MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
38383838   MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc9801)
shelves/new_menus/src/mess/machine/msx_slot.c
r29304r29305
347347   state->m_cart.scc.active = 0;
348348}
349349
350static READ8_HANDLER (konami_scc_bank5)
350READ8_MEMBER(msx_state::konami_scc_bank5)
351351{
352   msx_state *drvstate = space.machine().driver_data<msx_state>();
353352   if (offset & 0x80)
354353   {
355354      if ((offset & 0xff) >= 0xe0)
356355      {
357         return drvstate->m_k051649->k051649_test_r(space, offset & 0xff);
356         return m_k051649->k051649_test_r(space, offset & 0xff);
358357      }
359358      return 0xff;
360359   }
361360   else
362361   {
363      return drvstate->m_k051649->k051649_waveform_r(space, offset & 0x7f);
362      return m_k051649->k051649_waveform_r(space, offset & 0x7f);
364363   }
365364}
366365
r29304r29305
381380      msx_cpu_setbank (machine, 6, state->m_mem + state->m_banks[3] * 0x2000);
382381      if (state->m_cart.scc.active ) {
383382         msx_state *drvstate = machine.driver_data<msx_state>();
384         drvstate->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x9800, 0x9fff, FUNC(konami_scc_bank5));
383         drvstate->m_maincpu->space(AS_PROGRAM).install_read_handler(0x9800, 0x9fff, read8_delegate(FUNC(msx_state::konami_scc_bank5),drvstate));
385384      } else {
386385         msx_state *drvstate = machine.driver_data<msx_state>();
387386         drvstate->m_maincpu->space(AS_PROGRAM).install_read_bank(0x9800, 0x9fff,"bank7");
r29304r29305
12341233   drvstate->m_wd179x->reset();
12351234}
12361235
1237static READ8_HANDLER (msx_diskrom_page1_r)
1236READ8_MEMBER(msx_state::msx_diskrom_page1_r)
12381237{
1239   msx_state *state = space.machine().driver_data<msx_state>();
12401238   switch (offset)
12411239   {
1242   case 0: return state->m_wd179x->status_r (space, 0);
1243   case 1: return state->m_wd179x->track_r (space, 0);
1244   case 2: return state->m_wd179x->sector_r (space, 0);
1245   case 3: return state->m_wd179x->data_r (space, 0);
1246   case 7: return state->m_dsk_stat;
1240   case 0: return m_wd179x->status_r (space, 0);
1241   case 1: return m_wd179x->track_r (space, 0);
1242   case 2: return m_wd179x->sector_r (space, 0);
1243   case 3: return m_wd179x->data_r (space, 0);
1244   case 7: return m_dsk_stat;
12471245   default:
1248      return state->m_state[1]->m_mem[offset + 0x3ff8];
1246      return m_state[1]->m_mem[offset + 0x3ff8];
12491247   }
12501248}
12511249
1252static READ8_HANDLER (msx_diskrom_page2_r)
1250READ8_MEMBER(msx_state::msx_diskrom_page2_r)
12531251{
1254   msx_state *state = space.machine().driver_data<msx_state>();
12551252   if (offset >= 0x7f8)
12561253   {
12571254      switch (offset)
12581255      {
12591256      case 0x7f8:
1260         return state->m_wd179x->status_r (space, 0);
1257         return m_wd179x->status_r (space, 0);
12611258      case 0x7f9:
1262         return state->m_wd179x->track_r (space, 0);
1259         return m_wd179x->track_r (space, 0);
12631260      case 0x7fa:
1264         return state->m_wd179x->sector_r (space, 0);
1261         return m_wd179x->sector_r (space, 0);
12651262      case 0x7fb:
1266         return state->m_wd179x->data_r (space, 0);
1263         return m_wd179x->data_r (space, 0);
12671264      case 0x7ff:
1268         return state->m_dsk_stat;
1265         return m_dsk_stat;
12691266      default:
1270         return state->m_state[2]->m_mem[offset + 0x3800];
1267         return m_state[2]->m_mem[offset + 0x3800];
12711268      }
12721269   }
12731270   else
r29304r29305
12891286   case 1:
12901287      msx_cpu_setbank (machine, 3, state->m_mem);
12911288      msx_cpu_setbank (machine, 4, state->m_mem + 0x2000);
1292      space.install_legacy_read_handler(0x7ff8, 0x7fff, FUNC(msx_diskrom_page1_r));
1289      space.install_read_handler(0x7ff8, 0x7fff, read8_delegate(FUNC(msx_state::msx_diskrom_page1_r),drvstate));
12931290      break;
12941291   case 2:
12951292      msx_cpu_setbank (machine, 5, drvstate->m_empty);
12961293      msx_cpu_setbank (machine, 6, drvstate->m_empty);
1297      space.install_legacy_read_handler(0xb800, 0xbfff, FUNC(msx_diskrom_page2_r));
1294      space.install_read_handler(0xb800, 0xbfff, read8_delegate(FUNC(msx_state::msx_diskrom_page2_r),drvstate));
12981295      break;
12991296   case 3:
13001297      msx_cpu_setbank (machine, 7, drvstate->m_empty);
r29304r29305
13611358   drvstate->m_wd179x->reset();
13621359}
13631360
1364static READ8_HANDLER (msx_diskrom2_page1_r)
1361READ8_MEMBER(msx_state::msx_diskrom2_page1_r)
13651362{
1366   msx_state *state = space.machine().driver_data<msx_state>();
13671363   switch (offset)
13681364   {
1369   case 0: return state->m_wd179x->status_r(space, 0);
1370   case 1: return state->m_wd179x->track_r(space, 0);
1371   case 2: return state->m_wd179x->sector_r(space, 0);
1372   case 3: return state->m_wd179x->data_r(space, 0);
1373   case 4: return state->m_dsk_stat;
1365   case 0: return m_wd179x->status_r(space, 0);
1366   case 1: return m_wd179x->track_r(space, 0);
1367   case 2: return m_wd179x->sector_r(space, 0);
1368   case 3: return m_wd179x->data_r(space, 0);
1369   case 4: return m_dsk_stat;
13741370   default:
1375      return state->m_state[1]->m_mem[offset + 0x3ff8];
1371      return m_state[1]->m_mem[offset + 0x3ff8];
13761372   }
13771373}
13781374
1379static  READ8_HANDLER (msx_diskrom2_page2_r)
1375READ8_MEMBER(msx_state::msx_diskrom2_page2_r)
13801376{
1381   msx_state *state = space.machine().driver_data<msx_state>();
13821377   if (offset >= 0x7b8)
13831378   {
13841379      switch (offset)
13851380      {
13861381      case 0x7b8:
1387         return state->m_wd179x->status_r (space, 0);
1382         return m_wd179x->status_r (space, 0);
13881383      case 0x7b9:
1389         return state->m_wd179x->track_r (space, 0);
1384         return m_wd179x->track_r (space, 0);
13901385      case 0x7ba:
1391         return state->m_wd179x->sector_r (space, 0);
1386         return m_wd179x->sector_r (space, 0);
13921387      case 0x7bb:
1393         return state->m_wd179x->data_r (space, 0);
1388         return m_wd179x->data_r (space, 0);
13941389      case 0x7bc:
1395         return state->m_dsk_stat;
1390         return m_dsk_stat;
13961391      default:
1397         return state->m_state[2]->m_mem[offset + 0x3800];
1392         return m_state[2]->m_mem[offset + 0x3800];
13981393      }
13991394   }
14001395   else
r29304r29305
14161411   case 1:
14171412      msx_cpu_setbank (machine, 3, state->m_mem);
14181413      msx_cpu_setbank (machine, 4, state->m_mem + 0x2000);
1419      space.install_legacy_read_handler(0x7fb8, 0x7fbc, FUNC(msx_diskrom2_page1_r));
1414      space.install_read_handler(0x7fb8, 0x7fbc, read8_delegate(FUNC(msx_state::msx_diskrom2_page1_r),drvstate));
14201415      break;
14211416   case 2:
14221417      msx_cpu_setbank (machine, 5, drvstate->m_empty);
14231418      msx_cpu_setbank (machine, 6, drvstate->m_empty);
1424      space.install_legacy_read_handler(0xb800, 0xbfbc, FUNC(msx_diskrom2_page2_r));
1419      space.install_read_handler(0xb800, 0xbfbc, read8_delegate(FUNC(msx_state::msx_diskrom2_page2_r),drvstate));
14251420      break;
14261421   case 3:
14271422      msx_cpu_setbank (machine, 7, drvstate->m_empty);
r29304r29305
21812176   state->m_cart.sccp.sccp_active = 0;
21822177}
21832178
2184static  READ8_HANDLER (soundcartridge_scc)
2179READ8_MEMBER(msx_state::soundcartridge_scc)
21852180{
2186   msx_state *state = space.machine().driver_data<msx_state>();
21872181   int reg;
21882182
21892183
21902184   if (offset >= 0x7e0)
21912185   {
2192      return state->m_state[2]->m_mem[
2193            state->m_state[2]->m_banks[2] * 0x2000 + 0x1800 + offset];
2186      return m_state[2]->m_mem[
2187            m_state[2]->m_banks[2] * 0x2000 + 0x1800 + offset];
21942188   }
21952189
21962190   reg = offset & 0xff;
21972191
21982192   if (reg < 0x80)
21992193   {
2200      return state->m_k051649->k051649_waveform_r (space, reg);
2194      return m_k051649->k051649_waveform_r (space, reg);
22012195   }
22022196   else if (reg < 0xa0)
22032197   {
r29304r29305
22062200   else if (reg < 0xc0)
22072201   {
22082202      /* read wave 5 */
2209      return state->m_k051649->k051649_waveform_r (space, 0x80 + (reg & 0x1f));
2203      return m_k051649->k051649_waveform_r (space, 0x80 + (reg & 0x1f));
22102204   }
22112205   else if (reg < 0xe0)
22122206   {
2213      return state->m_k051649->k051649_test_r (space, reg);
2207      return m_k051649->k051649_test_r (space, reg);
22142208   }
22152209
22162210   return 0xff;
22172211}
22182212
2219static  READ8_HANDLER (soundcartridge_sccp)
2213READ8_MEMBER(msx_state::soundcartridge_sccp)
22202214{
2221   msx_state *state = space.machine().driver_data<msx_state>();
22222215   int reg;
22232216
22242217   if (offset >= 0x7e0)
22252218   {
2226      return state->m_state[2]->m_mem[
2227            state->m_state[2]->m_banks[3] * 0x2000 + 0x1800 + offset];
2219      return m_state[2]->m_mem[
2220            m_state[2]->m_banks[3] * 0x2000 + 0x1800 + offset];
22282221   }
22292222
22302223   reg = offset & 0xff;
22312224
22322225   if (reg < 0xa0)
22332226   {
2234      return state->m_k051649->k051649_waveform_r (space, reg);
2227      return m_k051649->k051649_waveform_r (space, reg);
22352228   }
22362229   else if (reg >= 0xc0 && reg < 0xe0)
22372230   {
2238      return state->m_k051649->k051649_test_r (space, reg);
2231      return m_k051649->k051649_test_r (space, reg);
22392232   }
22402233
22412234   return 0xff;
r29304r29305
22592252      msx_cpu_setbank (machine, 5, state->m_mem + state->m_banks[2] * 0x2000);
22602253      msx_cpu_setbank (machine, 6, state->m_mem + state->m_banks[3] * 0x2000);
22612254      if (state->m_cart.sccp.scc_active) {
2262         space.install_legacy_read_handler(0x9800, 0x9fff, FUNC(soundcartridge_scc));
2255         space.install_read_handler(0x9800, 0x9fff, read8_delegate(FUNC(msx_state::soundcartridge_scc),drvstate));
22632256      } else {
22642257         space.install_read_bank(0x9800, 0x9fff, "bank7");
22652258      }
22662259      if (state->m_cart.sccp.scc_active) {
2267         space.install_legacy_read_handler(0xb800, 0xbfff, FUNC(soundcartridge_sccp));
2260         space.install_read_handler(0xb800, 0xbfff, read8_delegate(FUNC(msx_state::soundcartridge_sccp),drvstate));
22682261      } else {
22692262         space.install_read_bank(0xb800, 0xbfff, "bank9");
22702263      }
shelves/new_menus/src/mess/machine/dccons.c
r29304r29305
6868      ddtdata.size = 4;
6969      ddtdata.buffer = sector_buffer;
7070      ddtdata.direction=1;    // 0 source to buffer, 1 buffer to destination
71      ddtdata.channel= -1;    // not used
71      ddtdata.channel= 0;
7272      ddtdata.mode= -1;       // copy from/to buffer
7373      printf("ATAPI: DMA one sector to %x, %x remaining\n", atapi_xferbase, atapi_xferlen);
7474      sh4_dma_ddt(m_maincpu, &ddtdata);
shelves/new_menus/src/mess/machine/swtpc09.c
r29304r29305
2424#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
2525
2626
27/* channel_data structure holds info about each 6844 DMA channel */
28typedef struct m6844_channel_data
29{
30   int active;
31   int address;
32   int counter;
33   UINT8 control;
34   int start_address;
35   int start_counter;
36} m6844_channel_data;
37
38/* 6844 description */
39static m6844_channel_data m6844_channel[4];
40static UINT8 m6844_priority;
41static UINT8 m6844_interrupt;
42static UINT8 m6844_chain;
43
4427/******* MC6840 PTM on MPID Board *******/
4528/* 6840 PTM interface */
4629const ptm6840_interface swtpc09_6840_intf =
r29304r29305
206189
207190    offset = (m_fdc_dma_address_reg & 0x0f)<<16;
208191
209   if (m6844_channel[0].active == 1)  //active dma transfer
192   if (m_m6844_channel[0].active == 1)  //active dma transfer
210193   {
211      if (!(m6844_channel[0].control & 0x01))  // dma write to memory
194      if (!(m_m6844_channel[0].control & 0x01))  // dma write to memory
212195      {
213196         UINT8 data = m_fdc->data_r(space, 0);
214197
215         LOG(("swtpc09_dma_write_mem %05X %02X\n", m6844_channel[0].address + offset, data));
216         RAM[m6844_channel[0].address + offset] = data;
198         LOG(("swtpc09_dma_write_mem %05X %02X\n", m_m6844_channel[0].address + offset, data));
199         RAM[m_m6844_channel[0].address + offset] = data;
217200      }
218201      else
219202      {
220         UINT8 data = RAM[m6844_channel[0].address + offset];
203         UINT8 data = RAM[m_m6844_channel[0].address + offset];
221204
222205         m_fdc->data_w(space, 0, data);
223         //LOG(("swtpc09_dma_read_mem %04X %02X\n", m6844_channel[0].address, data));
206         //LOG(("swtpc09_dma_read_mem %04X %02X\n", m_m6844_channel[0].address, data));
224207      }
225208
226      m6844_channel[0].address++;
227      m6844_channel[0].counter--;
209      m_m6844_channel[0].address++;
210      m_m6844_channel[0].counter--;
228211
229      if (m6844_channel[0].counter == 0)    // dma transfer has finished
212      if (m_m6844_channel[0].counter == 0)    // dma transfer has finished
230213      {
231            m6844_channel[0].control |= 0x80; // set dend flag
232            if (m6844_interrupt & 0x01)       // interrupt for channel 0 is enabled?
214            m_m6844_channel[0].control |= 0x80; // set dend flag
215            if (m_m6844_interrupt & 0x01)       // interrupt for channel 0 is enabled?
233216            {
234              m6844_interrupt   |= 0x80;      // set bit 7 to indicate active interrupt
217              m_m6844_interrupt   |= 0x80;      // set bit 7 to indicate active interrupt
235218                swtpc09_irq_handler(DMAC_IRQ, ASSERT_LINE);
236219          }
237220      }
r29304r29305
630613    {
631614        if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2)   // if DMF2 conroller this is the map
632615        {
633            mem.install_legacy_readwrite_handler(logical_address+0x000, logical_address+0x01f, FUNC(m6844_r), FUNC(m6844_w));
616            mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this));
634617            mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_device::read), fdc), write8_delegate(FUNC(fd1793_device::write),fdc));
635618           mem.install_readwrite_handler(logical_address+0x024, logical_address+0x03f, read8_delegate(FUNC(swtpc09_state::dmf2_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_control_reg_w),this));
636619           mem.install_readwrite_handler(logical_address+0x040, logical_address+0x041, read8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_w),this));
r29304r29305
640623       }
641624        else if (m_system_type == FLEX_DC4_PIAIDE)   // 2k ram for piaide on s09 board
642625        {
643            //mem.install_legacy_readwrite_handler(logical_address+0x000, logical_address+0x01f, FUNC(m6844_r), FUNC(m6844_w));
644            //mem.install_legacy_readwrite_handler(*fdc, logical_address+0x020, logical_address+0x023, 0, 0, FUNC(wd17xx_r), FUNC(wd17xx_w));
626            //mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this));
627            //mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_device::read), fdc), write8_delegate(FUNC(fd1793_device::write),fdc));
645628           //mem.install_readwrite_handler(logical_address+0x024, logical_address+0x03f, read8_delegate(FUNC(swtpc09_state::dmf2_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_control_reg_w),this));
646629           //mem.install_readwrite_handler(logical_address+0x040, logical_address+0x041, read8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_w),this));
647630            mem.install_ram(logical_address+0x000, logical_address+0x7ff, &RAM[0xf000]);
r29304r29305
649632            mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this));
650633       }
651634       else    // assume DMF3 controller
652        {
653            mem.install_legacy_readwrite_handler(logical_address+0x000, logical_address+0x01f, FUNC(m6844_r), FUNC(m6844_w));
635        {           
636         mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this));
654637            mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_device::read), fdc), write8_delegate(FUNC(fd1793_device::write),fdc));
655638           mem.install_readwrite_handler(logical_address+0x024, logical_address+0x024, read8_delegate(FUNC(swtpc09_state::dmf3_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf3_control_reg_w),this));
656639           mem.install_readwrite_handler(logical_address+0x025, logical_address+0x025, read8_delegate(FUNC(swtpc09_state::dmf3_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf3_dma_address_reg_w),this));
r29304r29305
688671
689672/*  MC6844 DMA controller I/O */
690673
691READ8_HANDLER( m6844_r )
674READ8_MEMBER( swtpc09_state::m6844_r )
692675{
693676   UINT8 result = 0;
694   swtpc09_state *state = space.machine().driver_data<swtpc09_state>();
695677
696678
697679   /* switch off the offset we were given */
r29304r29305
702684      case 0x04:
703685      case 0x08:
704686      case 0x0c:
705         result = m6844_channel[offset / 4].address >> 8;
687         result = m_m6844_channel[offset / 4].address >> 8;
706688         break;
707689
708690      /* lower byte of address */
r29304r29305
710692      case 0x05:
711693      case 0x09:
712694      case 0x0d:
713         result = m6844_channel[offset / 4].address & 0xff;
695         result = m_m6844_channel[offset / 4].address & 0xff;
714696         break;
715697
716698      /* upper byte of counter */
r29304r29305
718700      case 0x06:
719701      case 0x0a:
720702      case 0x0e:
721         result = m6844_channel[offset / 4].counter >> 8;
703         result = m_m6844_channel[offset / 4].counter >> 8;
722704         break;
723705
724706      /* lower byte of counter */
r29304r29305
726708      case 0x07:
727709      case 0x0b:
728710      case 0x0f:
729         result = m6844_channel[offset / 4].counter & 0xff;
711         result = m_m6844_channel[offset / 4].counter & 0xff;
730712         break;
731713
732714      /* channel control */
r29304r29305
734716      case 0x11:
735717      case 0x12:
736718      case 0x13:
737         result = m6844_channel[offset - 0x10].control;
719         result = m_m6844_channel[offset - 0x10].control;
738720
739721         /* a read here clears the DMA end flag */
740         m6844_channel[offset - 0x10].control &= ~0x80;
741            if (m6844_interrupt && 0x80) // if interrupt is active, then clear
722         m_m6844_channel[offset - 0x10].control &= ~0x80;
723            if (m_m6844_interrupt && 0x80) // if interrupt is active, then clear
742724            {
743                state->swtpc09_irq_handler(0x01, CLEAR_LINE);
744             m6844_interrupt &= 0x7f;  // clear interrupt indication bit 7
725                swtpc09_irq_handler(0x01, CLEAR_LINE);
726             m_m6844_interrupt &= 0x7f;  // clear interrupt indication bit 7
745727             LOG(("swtpc09_6844_r interrupt cleared \n"));
746728         }
747729         break;
748730
749731      /* priority control */
750732      case 0x14:
751         result = m6844_priority;
733         result = m_m6844_priority;
752734         break;
753735
754736      /* interrupt control */
755737      case 0x15:
756         result = m6844_interrupt;
738         result = m_m6844_interrupt;
757739         break;
758740
759741      /* chaining control */
760742      case 0x16:
761         result = m6844_chain;
743         result = m_m6844_chain;
762744         break;
763745
764746      /* 0x17-0x1f not used */
r29304r29305
766748   }
767749    //LOG(("swtpc09_6844_r %02X %02X\n", offset, result & 0xff));
768750
769    if (state->m_system_type == UNIFLEX_DMF2 || state->m_system_type == FLEX_DMF2)   // if DMF2 controller data bus is inverted to 6844
751    if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2)   // if DMF2 controller data bus is inverted to 6844
770752    {
771753        return ~result & 0xff;
772754   }
r29304r29305
777759}
778760
779761
780WRITE8_HANDLER( m6844_w )
762WRITE8_MEMBER( swtpc09_state::m6844_w )
781763{
782764   int i;
783   swtpc09_state *state = space.machine().driver_data<swtpc09_state>();
784765
785    if (state->m_system_type == UNIFLEX_DMF2 || state->m_system_type == FLEX_DMF2)   // if DMF2 controller data bus is inverted to 6844
766    if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2)   // if DMF2 controller data bus is inverted to 6844
786767        data = ~data & 0xff;
787768
788769    LOG(("swtpc09_6844_w %02X %02X\n", offset, data));
r29304r29305
794775      case 0x04:
795776      case 0x08:
796777      case 0x0c:
797         m6844_channel[offset / 4].address = (m6844_channel[offset / 4].address & 0xff) | (data << 8);
778         m_m6844_channel[offset / 4].address = (m_m6844_channel[offset / 4].address & 0xff) | (data << 8);
798779         break;
799780
800781      /* lower byte of address */
r29304r29305
802783      case 0x05:
803784      case 0x09:
804785      case 0x0d:
805         m6844_channel[offset / 4].address = (m6844_channel[offset / 4].address & 0xff00) | (data & 0xff);
786         m_m6844_channel[offset / 4].address = (m_m6844_channel[offset / 4].address & 0xff00) | (data & 0xff);
806787         break;
807788
808789      /* upper byte of counter */
r29304r29305
810791      case 0x06:
811792      case 0x0a:
812793      case 0x0e:
813         m6844_channel[offset / 4].counter = (m6844_channel[offset / 4].counter & 0xff) | (data << 8);
794         m_m6844_channel[offset / 4].counter = (m_m6844_channel[offset / 4].counter & 0xff) | (data << 8);
814795         break;
815796
816797      /* lower byte of counter */
r29304r29305
818799      case 0x07:
819800      case 0x0b:
820801      case 0x0f:
821         m6844_channel[offset / 4].counter = (m6844_channel[offset / 4].counter & 0xff00) | (data & 0xff);
802         m_m6844_channel[offset / 4].counter = (m_m6844_channel[offset / 4].counter & 0xff00) | (data & 0xff);
822803         break;
823804
824805      /* channel control */
r29304r29305
826807      case 0x11:
827808      case 0x12:
828809      case 0x13:
829         m6844_channel[offset - 0x10].control = (m6844_channel[offset - 0x10].control & 0xc0) | (data & 0x3f);
810         m_m6844_channel[offset - 0x10].control = (m_m6844_channel[offset - 0x10].control & 0xc0) | (data & 0x3f);
830811         break;
831812
832813      /* priority control */
833814      case 0x14:
834         m6844_priority = data;
815         m_m6844_priority = data;
835816
836817         /* update each channel */
837818         for (i = 0; i < 4; i++)
838819         {
839820            /* if we're going active... */
840            if (!m6844_channel[i].active && (data & (1 << i)))
821            if (!m_m6844_channel[i].active && (data & (1 << i)))
841822            {
842823               /* mark us active */
843               m6844_channel[i].active = 1;
824               m_m6844_channel[i].active = 1;
844825               LOG(("swtpc09_dma_channel active %02X\n", i));
845826
846827               /* set the DMA busy bit and clear the DMA end bit */
847               m6844_channel[i].control |= 0x40;
848               m6844_channel[i].control &= ~0x80;
828               m_m6844_channel[i].control |= 0x40;
829               m_m6844_channel[i].control &= ~0x80;
849830
850831               /* set the starting address, counter, and time */
851               m6844_channel[i].start_address = m6844_channel[i].address;
852               m6844_channel[i].start_counter = m6844_channel[i].counter;
832               m_m6844_channel[i].start_address = m_m6844_channel[i].address;
833               m_m6844_channel[i].start_counter = m_m6844_channel[i].counter;
853834
854835
855836               /* generate and play the sample */
r29304r29305
857838            }
858839
859840            /* if we're going inactive... */
860            else if (m6844_channel[i].active && !(data & (1 << i)))
841            else if (m_m6844_channel[i].active && !(data & (1 << i)))
861842            {
862843               /* mark us inactive */
863               m6844_channel[i].active = 0;
844               m_m6844_channel[i].active = 0;
864845            }
865846         }
866847         break;
867848
868849      /* interrupt control */
869850      case 0x15:
870         m6844_interrupt = (m6844_interrupt & 0x80) | (data & 0x7f);
871            LOG(("swtpc09_m6844_interrupt_w %02X\n", m6844_interrupt));
851         m_m6844_interrupt = (m_m6844_interrupt & 0x80) | (data & 0x7f);
852            LOG(("swtpc09_m_m6844_interrupt_w %02X\n", m_m6844_interrupt));
872853         break;
873854
874855      /* chaining control */
875856      case 0x16:
876         m6844_chain = data;
857         m_m6844_chain = data;
877858         break;
878859
879860      /* 0x17-0x1f not used */
r29304r29305
895876   /* reset the 6844 */
896877   for (i = 0; i < 4; i++)
897878   {
898      m6844_channel[i].active = 0;
899      m6844_channel[i].control = 0x00;
879      m_m6844_channel[i].active = 0;
880      m_m6844_channel[i].control = 0x00;
900881   }
901   m6844_priority = 0x00;
902   m6844_interrupt = 0x00;
903   m6844_chain = 0x00;
882   m_m6844_priority = 0x00;
883   m_m6844_interrupt = 0x00;
884   m_m6844_chain = 0x00;
904885
905886}
906887
r29304r29305
917898   /* reset the 6844 */
918899   for (i = 0; i < 4; i++)
919900   {
920      m6844_channel[i].active = 0;
921      m6844_channel[i].control = 0x00;
901      m_m6844_channel[i].active = 0;
902      m_m6844_channel[i].control = 0x00;
922903   }
923   m6844_priority = 0x00;
924   m6844_interrupt = 0x00;
925   m6844_chain = 0x00;
904   m_m6844_priority = 0x00;
905   m_m6844_interrupt = 0x00;
906   m_m6844_chain = 0x00;
926907
927908}
928909
r29304r29305
939920   /* reset the 6844 */
940921   for (i = 0; i < 4; i++)
941922   {
942      m6844_channel[i].active = 0;
943      m6844_channel[i].control = 0x00;
923      m_m6844_channel[i].active = 0;
924      m_m6844_channel[i].control = 0x00;
944925   }
945   m6844_priority = 0x00;
946   m6844_interrupt = 0x00;
947   m6844_chain = 0x00;
926   m_m6844_priority = 0x00;
927   m_m6844_interrupt = 0x00;
928   m_m6844_chain = 0x00;
948929
949930}
950931
r29304r29305
963944   /* reset the 6844 */
964945   for (i = 0; i < 4; i++)
965946   {
966      m6844_channel[i].active = 0;
967      m6844_channel[i].control = 0x00;
947      m_m6844_channel[i].active = 0;
948      m_m6844_channel[i].control = 0x00;
968949   }
969   m6844_priority = 0x00;
970   m6844_interrupt = 0x00;
971   m6844_chain = 0x00;
950   m_m6844_priority = 0x00;
951   m_m6844_interrupt = 0x00;
952   m_m6844_chain = 0x00;
972953
973954}
shelves/new_menus/src/mess/machine/ti99/gromport.c
r29304r29305
23122312   zip_file* zipfile;
23132313
23142314   char *layout_text = NULL;
2315   xml_data_node *layout_xml;
2315   xml_data_node *layout_xml = NULL;
23162316   xml_data_node *romset_node;
23172317   xml_data_node *configuration_node;
23182318   xml_data_node *resources_node;
r29304r29305
24282428   catch (rpk_exception &exp)
24292429   {
24302430      newrpk->close();
2431      if (layout_xml != NULL)      xml_file_free(layout_xml);
24312432      if (zipfile != NULL)        zip_file_close(zipfile);
24322433      if (layout_text != NULL)    global_free_array(layout_text);
24332434
r29304r29305
24352436      throw exp;
24362437   }
24372438
2439   if (layout_xml != NULL)      xml_file_free(layout_xml);
24382440   if (zipfile != NULL)        zip_file_close(zipfile);
24392441   if (layout_text != NULL)    global_free_array(layout_text);
24402442
shelves/new_menus/src/mess/includes/mikromik.h
r29304r29305
125125   int m_fdc_tc;
126126
127127   DECLARE_FLOPPY_FORMATS( floppy_formats );
128   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
128129};
129130
130131
shelves/new_menus/src/mess/includes/msx.h
r29304r29305
167167   DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( msx_cart );
168168   DECLARE_WRITE_LINE_MEMBER(msx_vdp_interrupt);
169169
170   // from msx_slot
171   DECLARE_READ8_MEMBER(konami_scc_bank5);
172   DECLARE_READ8_MEMBER(msx_diskrom_page1_r);
173   DECLARE_READ8_MEMBER(msx_diskrom_page2_r);
174   DECLARE_READ8_MEMBER(msx_diskrom2_page1_r);
175   DECLARE_READ8_MEMBER(msx_diskrom2_page2_r);
176   DECLARE_READ8_MEMBER(soundcartridge_scc);
177   DECLARE_READ8_MEMBER(soundcartridge_sccp);
178
170179   required_memory_bank m_bank1;
171180   required_memory_bank m_bank2;
172181   required_memory_bank m_bank3;
shelves/new_menus/src/mess/includes/swtpc09.h
r29304r29305
112112   UINT8 m_piaide_portb;
113113   UINT8 m_active_interrupt;
114114   UINT8 m_interrupt;
115   
116   
117   // TODO: move this in proper device
118   
119   /* channel_data structure holds info about each 6844 DMA channel */
120   typedef struct m6844_channel_data
121   {
122      int active;
123      int address;
124      int counter;
125      UINT8 control;
126      int start_address;
127      int start_counter;
128   } m6844_channel_data;
115129
130   /* 6844 description */
131   m6844_channel_data m_m6844_channel[4];
132   UINT8 m_m6844_priority;
133   UINT8 m_m6844_interrupt;
134   UINT8 m_m6844_chain;
135   DECLARE_READ8_MEMBER ( m6844_r );
136   DECLARE_WRITE8_MEMBER ( m6844_w );
137
116138};
117139
118140/*----------- defined in machine/swtpc09.c -----------*/
r29304r29305
120142extern const wd17xx_interface swtpc09_wd17xx_interface;
121143extern const ptm6840_interface swtpc09_6840_intf;
122144
123
124READ8_HANDLER ( m6844_r );
125WRITE8_HANDLER ( m6844_w );
126
127
128145#endif /* swtpc09_H_ */
129146
130147
shelves/new_menus/src/mess/includes/compis.h
r29304r29305
125125   DECLARE_WRITE_LINE_MEMBER(write_centronics_select);
126126
127127   int m_tmr0;
128
129   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
128130};
129131
130132
shelves/new_menus/src/mess/video/mikromik.c
r29304r29305
5050//  UPD7220_INTERFACE( hgdc_intf )
5151//-------------------------------------------------
5252
53static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
53UPD7220_DISPLAY_PIXELS_MEMBER( mm1_state::hgdc_display_pixels )
5454{
55   mm1_state *state = device->machine().driver_data<mm1_state>();
55   UINT8 data = m_video_ram[address];
5656
57   UINT8 data = state->m_video_ram[address];
58
5957   for (int i = 0; i < 8; i++)
6058   {
61      if (BIT(data, 7-i)) bitmap.pix32(y, x + i) = state->m_palette->pen(1);
59      if (BIT(data, 7 - i)) bitmap.pix32(y, x + i) = m_palette->pen(1);
6260   }
6361}
6462
65static UPD7220_INTERFACE( hgdc_intf )
66{
67   hgdc_display_pixels,
68   NULL,
69   DEVCB_NULL,
70   DEVCB_NULL,
71   DEVCB_NULL
72};
7363
74
7564UINT32 mm1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
7665{
7766   /* text */
r29304r29305
125114   MCFG_GFXDECODE_ADD("gfxdecode", "palette", mm1)
126115   MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette")
127116
128   MCFG_I8275_ADD(I8275_TAG, XTAL_18_720MHz/8, 8, crtc_display_pixels, DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w))
117   MCFG_DEVICE_ADD(I8275_TAG, I8275x, XTAL_18_720MHz/8)
118   MCFG_I8275_CHARACTER_WIDTH(8)
119   MCFG_I8275_DISPLAY_CALLBACK(crtc_display_pixels)
120   MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w))
121   MCFG_I8275_VRTC_CALLBACK(DEVWRITELINE(UPD7220_TAG, upd7220_device, ext_sync_w))
129122   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
130   MCFG_UPD7220_ADD(UPD7220_TAG, XTAL_18_720MHz/8, hgdc_intf, mm1_upd7220_map)
123
124   MCFG_DEVICE_ADD(UPD7220_TAG, UPD7220, XTAL_18_720MHz/8)
125   MCFG_DEVICE_ADDRESS_MAP(AS_0, mm1_upd7220_map)
126   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mm1_state, hgdc_display_pixels)   
131127   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
132128MACHINE_CONFIG_END
shelves/new_menus/src/mame/machine/maple-dc.c
r29304r29305
118118         ddtdata.size      = 4;       // bytes per word
119119         ddtdata.buffer    = header;  // destination buffer
120120         ddtdata.direction = 0;       // 0 source to buffer, 1 buffer to source
121         ddtdata.channel   = -1;      // not used
121         ddtdata.channel   = 0;
122122         ddtdata.mode      = -1;      // copy from/to buffer
123123         sh4_dma_ddt(cpu, &ddtdata);
124124         dma_adr += 8;
r29304r29305
134134         ddtdata.size      = 4;       // bytes per word
135135         ddtdata.buffer    = data;    // destination buffer
136136         ddtdata.direction = 0;       // 0 source to buffer, 1 buffer to source
137         ddtdata.channel   = -1;      // not used
137         ddtdata.channel   = 0;
138138         ddtdata.mode      = -1;      // copy from/to buffer
139139         sh4_dma_ddt(cpu, &ddtdata);
140140         dma_adr += length*4;
r29304r29305
189189         ddtdata.size        = 4;        // bytes per word
190190         ddtdata.buffer      = &data;    // destination buffer
191191         ddtdata.direction   = 1;        // 0 source to buffer, 1 buffer to source
192         ddtdata.channel     = -1;       // not used
192         ddtdata.channel     = 0;
193193         ddtdata.mode        = -1;       // copy from/to buffer
194194         sh4_dma_ddt(cpu, &ddtdata);
195195         dma_state = dma_endflag ? DMA_DONE : DMA_SEND;
r29304r29305
214214            ddtdata.size        = 4;        // bytes per word
215215            ddtdata.buffer      = data;     // destination buffer
216216            ddtdata.direction   = 1;        // 0 source to buffer, 1 buffer to source
217            ddtdata.channel     = -1;       // not used
217            ddtdata.channel     = 0;
218218            ddtdata.mode        = -1;       // copy from/to buffer
219219            sh4_dma_ddt(cpu, &ddtdata);
220220            dma_dest += length*4;
shelves/new_menus/src/mame/machine/dc.c
r29304r29305
8686   ddt.length = length;
8787   ddt.size =size;
8888   ddt.direction = to_mainram;
89   ddt.channel = -1;
89   ddt.channel = 0;
9090   ddt.mode = -1;
9191   sh4_dma_ddt(m_maincpu, &ddt);
9292}
shelves/new_menus/src/mame/machine/snes.c
r29304r29305
3434
3535void snes_state::video_start()
3636{
37   m_ppu.ppu_start(m_screen);
37   m_ppu.ppu_start(m_screen,this);
3838}
3939
4040UINT32 snes_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
r29304r29305
269269
270270*************************************/
271271
272READ8_HANDLER( snes_open_bus_r )
272READ8_MEMBER( snes_state::snes_open_bus_r )
273273{
274274   static UINT8 recurse = 0;
275275   UINT16 result;
shelves/new_menus/src/mame/machine/wpc.c
r29304r29305
1212
1313wpc_device::wpc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1414   : device_t(mconfig,WPCASIC,"Williams WPC ASIC",tag,owner,clock, "wpc", __FILE__),
15      m_dmd_visiblepage(0),
1516      m_irq_cb(*this),
1617      m_firq_cb(*this),
1718      m_sounddata_r(*this),
shelves/new_menus/src/mame/machine/archimds.c
r29304r29305
796796         visarea.min_x = 0;
797797         visarea.min_y = 0;
798798         visarea.max_x = m_vidc_regs[VIDC_HBER] - m_vidc_regs[VIDC_HBSR] - 1;
799         visarea.max_y = m_vidc_regs[VIDC_VBER] - m_vidc_regs[VIDC_VBSR];
799         visarea.max_y = (m_vidc_regs[VIDC_VBER] - m_vidc_regs[VIDC_VBSR]) * (m_vidc_interlace+1);
800800
801801         logerror("Configuring: htotal %d vtotal %d border %d x %d display %d x %d\n",
802802            m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR],
r29304r29305
806806         /* FIXME: pixel clock */
807807         refresh = HZ_TO_ATTOSECONDS(pixel_rate[m_vidc_pixel_clk]*2) * m_vidc_regs[VIDC_HCR] * m_vidc_regs[VIDC_VCR];
808808
809         m_screen->configure(m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR], visarea, refresh);
809         m_screen->configure(m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR] * (m_vidc_interlace+1), visarea, refresh);
810810      }
811811   }
812812}
r29304r29305
913913      m_vidc_bpp_mode = ((val & 0x0c) >> 2);
914914      m_vidc_interlace = ((val & 0x40) >> 6);
915915      m_vidc_pixel_clk = (val & 0x03);
916      //todo: vga/svga modes sets 0x1000
916917      vidc_dynamic_res_change();
917918   }
918919   else
shelves/new_menus/src/mame/includes/snes.h
r29304r29305
375375   UINT8  blend_exception[SNES_SCR_WIDTH];
376376};
377377
378class snes_state;
379
378380class snes_ppu_class  /* once all the regs are saved in this structure, it would be better to reorganize it a bit... */
379381{
380382public:
r29304r29305
450452      UINT16 ver_offset;
451453      UINT8 extbg;
452454   } m_mode7;
455   
456   struct OAM
457   {
458      UINT16 tile;
459      INT16 x, y;
460      UINT8 size, vflip, hflip, priority_bits, pal;
461      int height, width;
462   };
453463
464   struct OAM m_oam_spritelist[SNES_SCR_WIDTH / 2];
465
466   UINT8 m_oam_itemlist[32];
467
468   struct TILELIST {
469      INT16 x;
470      UINT16 priority, pal, tileaddr;
471      int hflip;
472   };
473
474   struct TILELIST m_oam_tilelist[34];
475
476   #if SNES_LAYER_DEBUG
477   struct DEBUGOPTS
478   {
479      UINT8 bg_disabled[5];
480      UINT8 mode_disabled[8];
481      UINT8 draw_subscreen;
482      UINT8 windows_disabled;
483      UINT8 mosaic_disabled;
484      UINT8 colormath_disabled;
485      UINT8 sprite_reversed;
486      UINT8 select_pri[5];
487   };
488   struct DEBUGOPTS m_debug_options;
489   #endif
490
454491   screen_device *m_screen;
455492
456493   UINT8 m_mosaic_size;
r29304r29305
527564   inline UINT32 get_vram_address(running_machine &machine);
528565   UINT8 dbg_video(running_machine &machine, UINT16 curline);
529566
530   void ppu_start(screen_device &screen);
567   void ppu_start(screen_device &screen,snes_state *state);
531568   UINT8 read(address_space &space, UINT32 offset, UINT8 wrio_bit7);
532569   void write(address_space &space, UINT32 offset, UINT8 data);
533570
r29304r29305
540577   UINT16 *m_oam_ram;     /* Object Attribute Memory */
541578   UINT16 *m_cgram;   /* Palette RAM */
542579   UINT8  *m_vram;    /* Video RAM (TODO: Should be 16-bit, but it's easier this way) */
580   
581   snes_state *m_state;
543582};
544583
545584struct snes_cart_info
r29304r29305
678717   DECLARE_READ8_MEMBER(snes_r_bank2);
679718   DECLARE_WRITE8_MEMBER(snes_w_bank1);
680719   DECLARE_WRITE8_MEMBER(snes_w_bank2);
720   DECLARE_READ8_MEMBER(snes_open_bus_r);
681721   TIMER_CALLBACK_MEMBER(snes_nmi_tick);
682722   TIMER_CALLBACK_MEMBER(snes_hirq_tick_callback);
683723   TIMER_CALLBACK_MEMBER(snes_reset_oam_address);
r29304r29305
740780   SNES_COLOR
741781};
742782
743DECLARE_READ8_HANDLER( snes_open_bus_r );
744
745783#endif /* _SNES_H_ */
shelves/new_menus/src/mame/includes/kopunch.h
r29304r29305
2929   UINT8 m_gfxbank;
3030   UINT8 m_scrollx;
3131
32   DECLARE_READ8_MEMBER(kopunch_in_r);
33   DECLARE_WRITE8_MEMBER(kopunch_lamp_w);
34   DECLARE_WRITE8_MEMBER(kopunch_coin_w);
35   DECLARE_WRITE8_MEMBER(kopunch_fg_w);
36   DECLARE_WRITE8_MEMBER(kopunch_bg_w);
37   DECLARE_WRITE8_MEMBER(kopunch_scroll_x_w);
38   DECLARE_WRITE8_MEMBER(kopunch_scroll_y_w);
39   DECLARE_WRITE8_MEMBER(kopunch_gfxbank_w);
32   DECLARE_READ8_MEMBER(sensors1_r);
33   DECLARE_READ8_MEMBER(sensors2_r);
34   DECLARE_WRITE8_MEMBER(lamp_w);
35   DECLARE_WRITE8_MEMBER(coin_w);
36   DECLARE_WRITE8_MEMBER(vram_fg_w);
37   DECLARE_WRITE8_MEMBER(vram_bg_w);
38   DECLARE_WRITE8_MEMBER(scroll_x_w);
39   DECLARE_WRITE8_MEMBER(scroll_y_w);
40   DECLARE_WRITE8_MEMBER(gfxbank_w);
4041
4142   DECLARE_INPUT_CHANGED_MEMBER(left_coin_inserted);
4243   DECLARE_INPUT_CHANGED_MEMBER(right_coin_inserted);
44   INTERRUPT_GEN_MEMBER(vblank_interrupt);
4345
4446   TILE_GET_INFO_MEMBER(get_fg_tile_info);
4547   TILE_GET_INFO_MEMBER(get_bg_tile_info);
r29304r29305
4850
4951   virtual void machine_start();
5052   virtual void video_start();
51
52   INTERRUPT_GEN_MEMBER(kopunch_interrupt);
5353};
shelves/new_menus/src/mame/includes/stv.h
r29304r29305
3434   optional_ioport m_fake_comms;
3535
3636   UINT8     *m_backupram;
37   UINT8     *m_cart_backupram;
3837   UINT32    *m_scu_regs;
3938   UINT16    *m_scsp_regs;
4039   UINT16    *m_vdp2_regs;
r29304r29305
645644   DECLARE_WRITE_LINE_MEMBER(scudsp_end_w);
646645   DECLARE_READ16_MEMBER(scudsp_dma_r);
647646   DECLARE_WRITE16_MEMBER(scudsp_dma_w);
647   
648   // FROM smpc.c
649   TIMER_CALLBACK_MEMBER( stv_bankswitch_state );
650   void stv_select_game(int gameno);
651   void smpc_master_on();
652   TIMER_CALLBACK_MEMBER( smpc_slave_enable );
653   TIMER_CALLBACK_MEMBER( smpc_sound_enable );
654   TIMER_CALLBACK_MEMBER( smpc_cd_enable );
655   void smpc_system_reset();
656   TIMER_CALLBACK_MEMBER( smpc_change_clock );
657   TIMER_CALLBACK_MEMBER( stv_intback_peripheral );
658   TIMER_CALLBACK_MEMBER( stv_smpc_intback );
659   void smpc_digital_pad(UINT8 pad_num, UINT8 offset);
660   void smpc_analog_pad(UINT8 pad_num, UINT8 offset, UINT8 id);
661   void smpc_keyboard(UINT8 pad_num, UINT8 offset);
662   void smpc_mouse(UINT8 pad_num, UINT8 offset, UINT8 id);
663   void smpc_md_pad(UINT8 pad_num, UINT8 offset, UINT8 id);
664   void smpc_unconnected(UINT8 pad_num, UINT8 offset);
665   TIMER_CALLBACK_MEMBER( intback_peripheral );
666   TIMER_CALLBACK_MEMBER( saturn_smpc_intback );
667   void smpc_rtc_write();
668   void smpc_memory_setting();
669   void smpc_nmi_req();
670   TIMER_CALLBACK_MEMBER( smpc_nmi_set );
671   void smpc_comreg_exec(address_space &space, UINT8 data, UINT8 is_stv);
672   DECLARE_READ8_MEMBER( stv_SMPC_r );
673   DECLARE_WRITE8_MEMBER( stv_SMPC_w );
674   
648675};
649676
650677class stv_state : public saturn_state
shelves/new_menus/src/mame/video/kopunch.c
r29304r29305
4141   }
4242}
4343
44WRITE8_MEMBER(kopunch_state::kopunch_fg_w)
44WRITE8_MEMBER(kopunch_state::vram_fg_w)
4545{
4646   m_vram_fg[offset] = data;
4747   m_fg_tilemap->mark_tile_dirty(offset);
4848}
4949
50WRITE8_MEMBER(kopunch_state::kopunch_bg_w)
50WRITE8_MEMBER(kopunch_state::vram_bg_w)
5151{
5252   m_vram_bg[offset] = data;
5353   m_bg_tilemap->mark_tile_dirty(offset);
5454}
5555
56WRITE8_MEMBER(kopunch_state::kopunch_scroll_x_w)
56WRITE8_MEMBER(kopunch_state::scroll_x_w)
5757{
5858   m_scrollx = data;
5959   m_bg_tilemap->set_scrollx(0, data);
6060}
6161
62WRITE8_MEMBER(kopunch_state::kopunch_scroll_y_w)
62WRITE8_MEMBER(kopunch_state::scroll_y_w)
6363{
6464   m_bg_tilemap->set_scrolly(0, data);
6565}
6666
67WRITE8_MEMBER(kopunch_state::kopunch_gfxbank_w)
67WRITE8_MEMBER(kopunch_state::gfxbank_w)
6868{
6969   // d0-d2: bg gfx bank
7070   if (m_gfxbank != (data & 0x07))
r29304r29305
7373      m_bg_tilemap->mark_all_dirty();
7474   }
7575
76   // d3: flip y, other bits: unused
76   // d3: flip y, other bits: N/C
7777   m_bg_tilemap->set_flip((data & 0x08) ? TILEMAP_FLIPY : 0);
7878}
7979
shelves/new_menus/src/mame/video/snes.c
r29304r29305
8181#define SNES_CLIP_ALWAYS   3
8282
8383#if SNES_LAYER_DEBUG
84struct DEBUGOPTS
85{
86   UINT8 bg_disabled[5];
87   UINT8 mode_disabled[8];
88   UINT8 draw_subscreen;
89   UINT8 windows_disabled;
90   UINT8 mosaic_disabled;
91   UINT8 colormath_disabled;
92   UINT8 sprite_reversed;
93   UINT8 select_pri[5];
94};
95static struct DEBUGOPTS debug_options;
9684/*                                    red   green  blue    purple  yellow cyan    grey    white */
9785static const UINT16 dbg_mode_colours[8] = { 0x1f, 0x3e0, 0x7c00, 0x7c1f, 0x3ff, 0x7fe0, 0x4210, 0x7fff };
9886#endif /* SNES_LAYER_DEBUG */
r29304r29305
197185            UINT8 clipmask = m_clipmasks[layer][ii];
198186
199187#if SNES_LAYER_DEBUG
200            if (debug_options.windows_disabled)
188            if (m_debug_options.windows_disabled)
201189               clipmask = 0xff;
202190#endif /* SNES_LAYER_DEBUG */
203191
r29304r29305
232220            UINT8 clipmask = m_clipmasks[layer][ii >> 1];
233221
234222#if SNES_LAYER_DEBUG
235            if (debug_options.windows_disabled)
223            if (m_debug_options.windows_disabled)
236224               clipmask = 0xff;
237225#endif /* SNES_LAYER_DEBUG */
238226
r29304r29305
266254         UINT8 clipmask = m_clipmasks[SNES_OAM][pos];
267255
268256#if SNES_LAYER_DEBUG
269         if (debug_options.windows_disabled)
257         if (m_debug_options.windows_disabled)
270258            clipmask = 0xff;
271259#endif /* SNES_LAYER_DEBUG */
272260
r29304r29305
312300      UINT8 mosaic = m_layer[layer].mosaic_enabled;
313301
314302#if SNES_LAYER_DEBUG
315      if (debug_options.mosaic_disabled)
303      if (m_debug_options.mosaic_disabled)
316304         mosaic = 0;
317305#endif /* SNES_LAYER_DEBUG */
318306
r29304r29305
415403   UINT8 color_shift = 2 << color_depth;
416404
417405#if SNES_LAYER_DEBUG
418   if (debug_options.bg_disabled[layer])
406   if (m_debug_options.bg_disabled[layer])
419407      return;
420408#endif /* SNES_LAYER_DEBUG */
421409
r29304r29305
517505
518506#if SNES_LAYER_DEBUG
519507      /* if we want to draw only one of the priorities of this layer */
520      if (((debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) ||
521         ((debug_options.select_pri[layer] & 0x02) && (priority == priority_b)))
508      if (((m_debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) ||
509         ((m_debug_options.select_pri[layer] & 0x02) && (priority == priority_b)))
522510      {
523511         if (!hires && tile_size)
524512            ii += 16;
r29304r29305
597585   int screen;
598586
599587#if SNES_LAYER_DEBUG
600   if (debug_options.bg_disabled[layer])
588   if (m_debug_options.bg_disabled[layer])
601589      return;
602590#endif /* SNES_LAYER_DEBUG */
603591
r29304r29305
659647   }
660648
661649#if SNES_LAYER_DEBUG
662   if (debug_options.mosaic_disabled)
650   if (m_debug_options.mosaic_disabled)
663651   {
664652      mosaic_x =  m_mosaic_table[0];
665653      mosaic_y =  m_mosaic_table[0];
r29304r29305
712700
713701#if SNES_LAYER_DEBUG
714702      /* if we want to draw only one of the priorities of this layer */
715      if (((debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) ||
716         ((debug_options.select_pri[layer] & 0x02) && (priority == priority_b)))
703      if (((m_debug_options.select_pri[layer] & 0x01) && (priority == priority_a)) ||
704         ((m_debug_options.select_pri[layer] & 0x02) && (priority == priority_b)))
717705         continue;
718706#endif /* SNES_LAYER_DEBUG */
719707      }
r29304r29305
726714            UINT8 clipmask = m_clipmasks[layer][xpos];
727715
728716#if SNES_LAYER_DEBUG
729            if (debug_options.windows_disabled)
717            if (m_debug_options.windows_disabled)
730718               clipmask = 0xff;
731719#endif /* SNES_LAYER_DEBUG */
732720
r29304r29305
784772 * test their priority with the one of the correct sprite - see update_objects.
785773 *************************************************************************************************/
786774
787struct OAM
788{
789   UINT16 tile;
790   INT16 x, y;
791   UINT8 size, vflip, hflip, priority_bits, pal;
792   int height, width;
793};
794775
795static struct OAM oam_spritelist[SNES_SCR_WIDTH / 2];
796
797static UINT8 oam_itemlist[32];
798
799struct TILELIST {
800   INT16 x;
801   UINT16 priority, pal, tileaddr;
802   int hflip;
803};
804
805static struct TILELIST oam_tilelist[34];
806
807776/*********************************************
808777 * update_obsel()
809778 *
r29304r29305
843812      if (((ii + 1) % 4) == 0)
844813         extra = oamram[oam_extra--];
845814
846      oam_spritelist[ii].vflip = (oamram[oam] & 0x80) >> 7;
847      oam_spritelist[ii].hflip = (oamram[oam] & 0x40) >> 6;
848      oam_spritelist[ii].priority_bits = (oamram[oam] & 0x30) >> 4;
849      oam_spritelist[ii].pal = 128 + ((oamram[oam] & 0x0e) << 3);
850      oam_spritelist[ii].tile = (oamram[oam--] & 0x1) << 8;
851      oam_spritelist[ii].tile |= oamram[oam--];
852      oam_spritelist[ii].y = oamram[oam--] + 1;
853      oam_spritelist[ii].x = oamram[oam--];
854      oam_spritelist[ii].size = (extra & 0x80) >> 7;
815      m_oam_spritelist[ii].vflip = (oamram[oam] & 0x80) >> 7;
816      m_oam_spritelist[ii].hflip = (oamram[oam] & 0x40) >> 6;
817      m_oam_spritelist[ii].priority_bits = (oamram[oam] & 0x30) >> 4;
818      m_oam_spritelist[ii].pal = 128 + ((oamram[oam] & 0x0e) << 3);
819      m_oam_spritelist[ii].tile = (oamram[oam--] & 0x1) << 8;
820      m_oam_spritelist[ii].tile |= oamram[oam--];
821      m_oam_spritelist[ii].y = oamram[oam--] + 1;
822      m_oam_spritelist[ii].x = oamram[oam--];
823      m_oam_spritelist[ii].size = (extra & 0x80) >> 7;
855824      extra <<= 1;
856      oam_spritelist[ii].x |= ((extra & 0x80) << 1);
825      m_oam_spritelist[ii].x |= ((extra & 0x80) << 1);
857826      extra <<= 1;
858827
859      oam_spritelist[ii].y *= m_obj_interlace;
860      oam_spritelist[ii].y &= 0x1ff;
828      m_oam_spritelist[ii].y *= m_obj_interlace;
829      m_oam_spritelist[ii].y &= 0x1ff;
861830
862      oam_spritelist[ii].x &= 0x1ff;
831      m_oam_spritelist[ii].x &= 0x1ff;
863832
864833      /* Determine object size */
865834      switch (m_oam.size)
866835      {
867836      case 0:         /* 8x8 or 16x16 */
868         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 2 : 1;
869         oam_spritelist[ii].height = oam_spritelist[ii].size ? 2 : 1;
837         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 2 : 1;
838         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 2 : 1;
870839         break;
871840      case 1:         /* 8x8 or 32x32 */
872         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 4 : 1;
873         oam_spritelist[ii].height = oam_spritelist[ii].size ? 4 : 1;
841         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 4 : 1;
842         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 4 : 1;
874843         break;
875844      case 2:         /* 8x8 or 64x64 */
876         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 8 : 1;
877         oam_spritelist[ii].height = oam_spritelist[ii].size ? 8 : 1;
845         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 8 : 1;
846         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 8 : 1;
878847         break;
879848      case 3:         /* 16x16 or 32x32 */
880         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 4 : 2;
881         oam_spritelist[ii].height = oam_spritelist[ii].size ? 4 : 2;
849         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 4 : 2;
850         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 4 : 2;
882851         break;
883852      case 4:         /* 16x16 or 64x64 */
884         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 8 : 2;
885         oam_spritelist[ii].height = oam_spritelist[ii].size ? 8 : 2;
853         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 8 : 2;
854         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 8 : 2;
886855         break;
887856      case 5:         /* 32x32 or 64x64 */
888         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 8 : 4;
889         oam_spritelist[ii].height = oam_spritelist[ii].size ? 8 : 4;
857         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 8 : 4;
858         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 8 : 4;
890859         break;
891860      case 6:         /* undocumented: 16x32 or 32x64 */
892         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 4 : 2;
893         oam_spritelist[ii].height = oam_spritelist[ii].size ? 8 : 4;
894         if (m_obj_interlace && !oam_spritelist[ii].size)
895            oam_spritelist[ii].height = 2;
861         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 4 : 2;
862         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 8 : 4;
863         if (m_obj_interlace && !m_oam_spritelist[ii].size)
864            m_oam_spritelist[ii].height = 2;
896865         break;
897866      case 7:         /* undocumented: 16x32 or 32x32 */
898         oam_spritelist[ii].width  = oam_spritelist[ii].size ? 4 : 2;
899         oam_spritelist[ii].height = oam_spritelist[ii].size ? 4 : 4;
900         if (m_obj_interlace && !oam_spritelist[ii].size)
901            oam_spritelist[ii].height = 2;
867         m_oam_spritelist[ii].width  = m_oam_spritelist[ii].size ? 4 : 2;
868         m_oam_spritelist[ii].height = m_oam_spritelist[ii].size ? 4 : 4;
869         if (m_obj_interlace && !m_oam_spritelist[ii].size)
870            m_oam_spritelist[ii].height = 2;
902871         break;
903872      default:
904873         /* we should never enter here... */
r29304r29305
919888{
920889   //if sprite is entirely offscreen and doesn't wrap around to the left side of the screen,
921890   //then it is not counted. this *should* be 256, and not 255, even though dot 256 is offscreen.
922   int spr_height = (oam_spritelist[sprite].height << 3);
891   int spr_height = (m_oam_spritelist[sprite].height << 3);
923892
924   if (oam_spritelist[sprite].x > 256 && (oam_spritelist[sprite].x + (oam_spritelist[sprite].width << 3) - 1) < 512)
893   if (m_oam_spritelist[sprite].x > 256 && (m_oam_spritelist[sprite].x + (m_oam_spritelist[sprite].width << 3) - 1) < 512)
925894      return 0;
926895
927   if (curline >= oam_spritelist[sprite].y && curline < (oam_spritelist[sprite].y + spr_height))
896   if (curline >= m_oam_spritelist[sprite].y && curline < (m_oam_spritelist[sprite].y + spr_height))
928897      return 1;
929898
930   if ((oam_spritelist[sprite].y + spr_height) >= 256 && curline < ((oam_spritelist[sprite].y + spr_height) & 255))
899   if ((m_oam_spritelist[sprite].y + spr_height) >= 256 && curline < ((m_oam_spritelist[sprite].y + spr_height) & 255))
931900      return 1;
932901
933902   return 0;
r29304r29305
962931   curline *= m_obj_interlace;
963932
964933   /* reset the list of first 32 objects which intersect current scanline */
965   memset(oam_itemlist, 0xff, 32);
934   memset(m_oam_itemlist, 0xff, 32);
966935
967936   /* populate the list of 32 objects */
968937   for (ii = 0; ii < 128; ii++)
r29304r29305
975944      if (range_over++ >= 32)
976945         break;
977946
978      oam_itemlist[range_over - 1] = active_sprite;
947      m_oam_itemlist[range_over - 1] = active_sprite;
979948   }
980949
981950   /* reset the list of first 34 tiles to be drawn */
982951   for (ii = 0; ii < 34; ii++)
983      oam_tilelist[ii].tileaddr = 0xffff;
952      m_oam_tilelist[ii].tileaddr = 0xffff;
984953
985954   /* populate the list of 34 tiles */
986955   for (ii = 31; ii >= 0; ii--)
987956   {
988      if (oam_itemlist[ii] == 0xff)
957      if (m_oam_itemlist[ii] == 0xff)
989958         continue;
990959
991      active_sprite = oam_itemlist[ii];
960      active_sprite = m_oam_itemlist[ii];
992961
993      tile = oam_spritelist[active_sprite].tile;
994      x = oam_spritelist[active_sprite].x;
995      y = oam_spritelist[active_sprite].y;
996      height = oam_spritelist[active_sprite].height;
997      width = oam_spritelist[active_sprite].width;
998      vflip = oam_spritelist[active_sprite].vflip;
999      hflip = oam_spritelist[active_sprite].hflip;
1000      priority = oam_spritelist[active_sprite].priority_bits;
1001      pal = oam_spritelist[active_sprite].pal;
962      tile = m_oam_spritelist[active_sprite].tile;
963      x = m_oam_spritelist[active_sprite].x;
964      y = m_oam_spritelist[active_sprite].y;
965      height = m_oam_spritelist[active_sprite].height;
966      width = m_oam_spritelist[active_sprite].width;
967      vflip = m_oam_spritelist[active_sprite].vflip;
968      hflip = m_oam_spritelist[active_sprite].hflip;
969      priority = m_oam_spritelist[active_sprite].priority_bits;
970      pal = m_oam_spritelist[active_sprite].pal;
1002971
1003972      /* Adjust y, if past maximum position (for sprites which overlap between top & bottom) */
1004973      if (y >= (0x100 - 16) * m_interlace)
r29304r29305
1030999               break;
10311000
10321001            xs = (hflip) ? (width - 1 - jj) : jj;
1033            oam_tilelist[time_over - 1].tileaddr = name_sel + tile + table_obj_offset[ys][xs] + line;
1034            oam_tilelist[time_over - 1].hflip = hflip;
1035            oam_tilelist[time_over - 1].x = xx;
1036            oam_tilelist[time_over - 1].pal = pal;
1037            oam_tilelist[time_over - 1].priority = priority;
1002            m_oam_tilelist[time_over - 1].tileaddr = name_sel + tile + table_obj_offset[ys][xs] + line;
1003            m_oam_tilelist[time_over - 1].hflip = hflip;
1004            m_oam_tilelist[time_over - 1].x = xx;
1005            m_oam_tilelist[time_over - 1].pal = pal;
1006            m_oam_tilelist[time_over - 1].priority = priority;
10381007         }
10391008      }
10401009   }
r29304r29305
10611030   int ii;
10621031
10631032#if SNES_LAYER_DEBUG
1064   if (debug_options.bg_disabled[SNES_OAM])
1033   if (m_debug_options.bg_disabled[SNES_OAM])
10651034      return;
10661035#endif /* SNES_LAYER_DEBUG */
10671036
r29304r29305
10851054   {
10861055      int tile = ii;
10871056#if SNES_LAYER_DEBUG
1088      if (debug_options.sprite_reversed)
1057      if (m_debug_options.sprite_reversed)
10891058         tile = 33 - ii;
10901059#endif /* SNES_LAYER_DEBUG */
10911060
1092      if (oam_tilelist[tile].tileaddr == 0xffff)
1061      if (m_oam_tilelist[tile].tileaddr == 0xffff)
10931062         continue;
10941063
1095      pri = priority[oam_tilelist[tile].priority];
1064      pri = priority[m_oam_tilelist[tile].priority];
10961065
10971066#if SNES_LAYER_DEBUG
1098      if (debug_options.select_pri[SNES_OAM])
1067      if (m_debug_options.select_pri[SNES_OAM])
10991068      {
1100         int oam_draw = debug_options.select_pri[SNES_OAM] - 1;
1101         if (oam_draw != oam_tilelist[tile].priority)
1069         int oam_draw = m_debug_options.select_pri[SNES_OAM] - 1;
1070         if (oam_draw != m_oam_tilelist[tile].priority)
11021071            continue;
11031072      }
11041073#endif /* SNES_LAYER_DEBUG */
11051074
11061075      /* OAM tiles have fixed planes (4), no direct color and no hires, but otherwise work the same as BG ones */
1107      draw_tile(4, SNES_OAM, charaddr + oam_tilelist[tile].tileaddr, oam_tilelist[tile].x, pri, oam_tilelist[tile].hflip, 0, oam_tilelist[tile].pal, 0);
1076      draw_tile(4, SNES_OAM, charaddr + m_oam_tilelist[tile].tileaddr, m_oam_tilelist[tile].x, pri, m_oam_tilelist[tile].hflip, 0, m_oam_tilelist[tile].pal, 0);
11081077   }
11091078}
11101079
r29304r29305
11181087void snes_ppu_class::update_mode_0( UINT16 curline )
11191088{
11201089#if SNES_LAYER_DEBUG
1121   if (debug_options.mode_disabled[0])
1090   if (m_debug_options.mode_disabled[0])
11221091      return;
11231092#endif /* SNES_LAYER_DEBUG */
11241093
r29304r29305
11321101void snes_ppu_class::update_mode_1( UINT16 curline )
11331102{
11341103#if SNES_LAYER_DEBUG
1135   if (debug_options.mode_disabled[1])
1104   if (m_debug_options.mode_disabled[1])
11361105      return;
11371106#endif /* SNES_LAYER_DEBUG */
11381107
r29304r29305
11551124void snes_ppu_class::update_mode_2( UINT16 curline )
11561125{
11571126#if SNES_LAYER_DEBUG
1158   if (debug_options.mode_disabled[2])
1127   if (m_debug_options.mode_disabled[2])
11591128      return;
11601129#endif /* SNES_LAYER_DEBUG */
11611130
r29304r29305
11671136void snes_ppu_class::update_mode_3( UINT16 curline )
11681137{
11691138#if SNES_LAYER_DEBUG
1170   if (debug_options.mode_disabled[3])
1139   if (m_debug_options.mode_disabled[3])
11711140      return;
11721141#endif /* SNES_LAYER_DEBUG */
11731142
r29304r29305
11791148void snes_ppu_class::update_mode_4( UINT16 curline )
11801149{
11811150#if SNES_LAYER_DEBUG
1182   if (debug_options.mode_disabled[4])
1151   if (m_debug_options.mode_disabled[4])
11831152      return;
11841153#endif /* SNES_LAYER_DEBUG */
11851154
r29304r29305
11911160void snes_ppu_class::update_mode_5( UINT16 curline )
11921161{
11931162#if SNES_LAYER_DEBUG
1194   if (debug_options.mode_disabled[5])
1163   if (m_debug_options.mode_disabled[5])
11951164      return;
11961165#endif /* SNES_LAYER_DEBUG */
11971166
r29304r29305
12031172void snes_ppu_class::update_mode_6( UINT16 curline )
12041173{
12051174#if SNES_LAYER_DEBUG
1206   if (debug_options.mode_disabled[6])
1175   if (m_debug_options.mode_disabled[6])
12071176      return;
12081177#endif /* SNES_LAYER_DEBUG */
12091178
r29304r29305
12141183void snes_ppu_class::update_mode_7( UINT16 curline )
12151184{
12161185#if SNES_LAYER_DEBUG
1217   if (debug_options.mode_disabled[7])
1186   if (m_debug_options.mode_disabled[7])
12181187      return;
12191188#endif /* SNES_LAYER_DEBUG */
12201189
r29304r29305
13591328inline void snes_ppu_class::draw_blend( UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens )
13601329{
13611330#if SNES_LAYER_DEBUG
1362   if (debug_options.colormath_disabled)
1331   if (m_debug_options.colormath_disabled)
13631332      return;
13641333#endif /* SNES_LAYER_DEBUG */
13651334
r29304r29305
13861355
13871356#if SNES_LAYER_DEBUG
13881357      /* Toggle drawing of SNES_SUBSCREEN or SNES_MAINSCREEN */
1389      if (debug_options.draw_subscreen)
1358      if (m_debug_options.draw_subscreen)
13901359      {
13911360         subscreen = switch_screens ? &m_scanlines[SNES_SUBSCREEN] : &m_scanlines[SNES_MAINSCREEN];
13921361      }
r29304r29305
15471516      }
15481517
15491518      /* Toggle drawing of SNES_SUBSCREEN or SNES_MAINSCREEN */
1550      if (debug_options.draw_subscreen)
1519      if (m_debug_options.draw_subscreen)
15511520      {
15521521         scanline1 = &m_scanlines[SNES_SUBSCREEN];
15531522         scanline2 = &m_scanlines[SNES_MAINSCREEN];
r29304r29305
16431612   g_profiler.stop();
16441613}
16451614
1646void snes_ppu_class::ppu_start(screen_device &screen)
1615void snes_ppu_class::ppu_start(screen_device &screen,snes_state *state)
16471616{
16481617   m_screen = &screen;
16491618   running_machine &machine = screen.machine();
1650
1619   m_state = state;
16511620#if SNES_LAYER_DEBUG
1652   memset(&debug_options, 0, sizeof(debug_options));
1621   memset(&m_debug_options, 0, sizeof(m_debug_options));
16531622#endif
16541623
16551624   m_vram = auto_alloc_array(machine, UINT8, SNES_VRAM_SIZE);
r29304r29305
19381907         if (h <= 4)
19391908            m_vram[offset] = data;
19401909         else if (h == 6)
1941            m_vram[offset] = snes_open_bus_r(space, 0);
1910            m_vram[offset] = m_state->snes_open_bus_r(space, 0);
19421911         else
19431912         {
19441913            //printf("%d %d VRAM write, CHECK!\n",h,v);
r29304r29305
21492118         }
21502119      case SLHV:      /* Software latch for H/V counter */
21512120         latch_counters(space.machine());
2152         return snes_open_bus_r(space, 0);       /* Return value is meaningless */
2121         return m_state->snes_open_bus_r(space, 0);       /* Return value is meaningless */
21532122      case ROAMDATA:  /* Read data from OAM (DR) */
21542123         m_ppu1_open_bus = oam_read(space, m_oam.address);
21552124         PPU_REG(OAMDATA) = (PPU_REG(OAMDATA) + 1) % 2;
r29304r29305
22442213   }
22452214
22462215   /* note: remaining registers (Namely TM in Super Kick Boxing) returns MDR open bus, not PPU Open Bus! */
2247   return snes_open_bus_r(space, 0);
2216   return m_state->snes_open_bus_r(space, 0);
22482217}
22492218
22502219
r29304r29305
26702639{
26712640   int i;
26722641   UINT8 toggles = machine.root_device().ioport("DEBUG1")->read_safe(0);
2673   debug_options.select_pri[SNES_BG1] = (toggles & 0x03);
2674   debug_options.select_pri[SNES_BG2] = (toggles & 0x0c) >> 2;
2675   debug_options.select_pri[SNES_BG3] = (toggles & 0x30) >> 4;
2676   debug_options.select_pri[SNES_BG4] = (toggles & 0xc0) >> 6;
2642   m_debug_options.select_pri[SNES_BG1] = (toggles & 0x03);
2643   m_debug_options.select_pri[SNES_BG2] = (toggles & 0x0c) >> 2;
2644   m_debug_options.select_pri[SNES_BG3] = (toggles & 0x30) >> 4;
2645   m_debug_options.select_pri[SNES_BG4] = (toggles & 0xc0) >> 6;
26772646
26782647   toggles = machine.root_device().ioport("DEBUG2")->read_safe(0);
26792648   for (i = 0; i < 4; i++)
2680      DEBUG_TOGGLE(i, debug_options.bg_disabled[i], ("Debug: Disabled BG%d.\n", i + 1), ("Debug: Enabled BG%d.\n", i + 1))
2681   DEBUG_TOGGLE(4, debug_options.bg_disabled[SNES_OAM], ("Debug: Disabled OAM.\n"), ("Debug: Enabled OAM.\n"))
2682   DEBUG_TOGGLE(5, debug_options.draw_subscreen, ("Debug: Switched screens.\n"), ("Debug: Switched screens.\n"))
2683   DEBUG_TOGGLE(6, debug_options.colormath_disabled, ("Debug: Disabled Color Math.\n"), ("Debug: Enabled Color Math.\n"))
2684   DEBUG_TOGGLE(7, debug_options.windows_disabled, ("Debug: Disabled Window Masks.\n"), ("Debug: Enabled Window Masks.\n"))
2649      DEBUG_TOGGLE(i, m_debug_options.bg_disabled[i], ("Debug: Disabled BG%d.\n", i + 1), ("Debug: Enabled BG%d.\n", i + 1))
2650   DEBUG_TOGGLE(4, m_debug_options.bg_disabled[SNES_OAM], ("Debug: Disabled OAM.\n"), ("Debug: Enabled OAM.\n"))
2651   DEBUG_TOGGLE(5, m_debug_options.draw_subscreen, ("Debug: Switched screens.\n"), ("Debug: Switched screens.\n"))
2652   DEBUG_TOGGLE(6, m_debug_options.colormath_disabled, ("Debug: Disabled Color Math.\n"), ("Debug: Enabled Color Math.\n"))
2653   DEBUG_TOGGLE(7, m_debug_options.windows_disabled, ("Debug: Disabled Window Masks.\n"), ("Debug: Enabled Window Masks.\n"))
26852654
26862655   toggles = machine.root_device().ioport("DEBUG4")->read_safe(0);
26872656   for (i = 0; i < 8; i++)
2688      DEBUG_TOGGLE(i, debug_options.mode_disabled[i], ("Debug: Disabled Mode %d drawing.\n", i), ("Debug: Enabled Mode %d drawing.\n", i))
2657      DEBUG_TOGGLE(i, m_debug_options.mode_disabled[i], ("Debug: Disabled Mode %d drawing.\n", i), ("Debug: Enabled Mode %d drawing.\n", i))
26892658
26902659   toggles = machine.root_device().ioport("DEBUG3")->read_safe(0);
2691   DEBUG_TOGGLE(2, debug_options.mosaic_disabled, ("Debug: Disabled Mosaic.\n"), ("Debug: Enabled Mosaic.\n"))
2692   debug_options.sprite_reversed = BIT(toggles, 7);
2693   debug_options.select_pri[SNES_OAM] = (toggles & 0x70) >> 4;
2660   DEBUG_TOGGLE(2, m_debug_options.mosaic_disabled, ("Debug: Disabled Mosaic.\n"), ("Debug: Enabled Mosaic.\n"))
2661   m_debug_options.sprite_reversed = BIT(toggles, 7);
2662   m_debug_options.select_pri[SNES_OAM] = (toggles & 0x70) >> 4;
26942663
26952664#ifdef MAME_DEBUG
26962665   /* Once per frame, log video properties */
r29304r29305
26982667   {
26992668      static const char WINLOGIC[4] = { '|', '&', '^', '!' };
27002669
2701      logerror("%s", debug_options.windows_disabled?" ":"W");
2670      logerror("%s", m_debug_options.windows_disabled?" ":"W");
27022671      logerror("%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
2703            debug_options.bg_disabled[0]?" ":"*",
2672            m_debug_options.bg_disabled[0]?" ":"*",
27042673            (PPU_REG(TM) & 0x1)?"M":" ",
27052674            (PPU_REG(TS) & 0x1)?"S":" ",
27062675            (PPU_REG(CGADSUB) & 0x1)?"B":" ",
r29304r29305
27152684            (PPU_REG(BG1SC) & 0xfc) << 9,
27162685            m_layer[SNES_BG1].charmap << 13);
27172686      logerror("%s2 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
2718            debug_options.bg_disabled[1]?" ":"*",
2687            m_debug_options.bg_disabled[1]?" ":"*",
27192688            (PPU_REG(TM) & 0x2)?"M":" ",
27202689            (PPU_REG(TS) & 0x2)?"S":" ",
27212690            (PPU_REG(CGADSUB) & 0x2)?"B":" ",
r29304r29305
27302699            (PPU_REG(BG2SC) & 0xfc) << 9,
27312700            m_layer[SNES_BG2].charmap << 13);
27322701      logerror("%s3 %s%s%s%s%s%c%s%s%d%s%s%d %4X %4X",
2733            debug_options.bg_disabled[2]?" ":"*",
2702            m_debug_options.bg_disabled[2]?" ":"*",
27342703            (PPU_REG(TM) & 0x4)?"M":" ",
27352704            (PPU_REG(TS) & 0x4)?"S":" ",
27362705            (PPU_REG(CGADSUB) & 0x4)?"B":" ",
r29304r29305
27462715            (PPU_REG(BG3SC) & 0xfc) << 9,
27472716            m_layer[SNES_BG3].charmap << 13);
27482717      logerror("%s4 %s%s%s%s%s%c%s%s%d%s %d %4X %4X",
2749            debug_options.bg_disabled[3]?" ":"*",
2718            m_debug_options.bg_disabled[3]?" ":"*",
27502719            (PPU_REG(TM) & 0x8)?"M":" ",
27512720            (PPU_REG(TS) & 0x8)?"S":" ",
27522721            (PPU_REG(CGADSUB) & 0x8)?"B":" ",
r29304r29305
27612730            (PPU_REG(BG4SC) & 0xfc) << 9,
27622731            m_layer[SNES_BG4].charmap << 13 );
27632732      logerror("%sO %s%s%s%s%s%c%s%s       %4X",
2764            debug_options.bg_disabled[4]?" ":"*",
2733            m_debug_options.bg_disabled[4]?" ":"*",
27652734            (PPU_REG(TM) & 0x10)?"M":" ",
27662735            (PPU_REG(TS) & 0x10)?"S":" ",
27672736            (PPU_REG(CGADSUB) & 0x10)?"B":" ",
r29304r29305
27722741            (PPU_REG(WOBJSEL) & 0x8)?((PPU_REG(WOBJSEL) & 0x4)?"o":"i"):" ",
27732742            m_layer[SNES_OAM].charmap << 13 );
27742743      logerror("%sB   %s  %c%s%s",
2775            debug_options.colormath_disabled?" ":"*",
2744            m_debug_options.colormath_disabled?" ":"*",
27762745            (PPU_REG(CGADSUB) & 0x20)?"B":" ",
27772746            WINLOGIC[(PPU_REG(WOBJLOG) & 0xc)>>2],
27782747            (PPU_REG(WOBJSEL) & 0x20)?((PPU_REG(WOBJSEL) & 0x10)?"o":"i"):" ",
shelves/new_menus/src/mame/video/archimds.c
r29304r29305
2424
2525   /* now calculate display clip rectangle start/end areas */
2626   xstart = (calc_dxs)-m_vidc_regs[VIDC_HBSR];
27   ystart = (m_vidc_regs[VIDC_VDSR])-m_vidc_regs[VIDC_VBSR];
27   ystart = (m_vidc_regs[VIDC_VDSR]-m_vidc_regs[VIDC_VBSR]);
2828   xend = (calc_dxe)+xstart;
29   yend = m_vidc_regs[VIDC_VDER]+ystart;
29   yend = (m_vidc_regs[VIDC_VDER] * (m_vidc_interlace+1))+ystart;
3030
3131   /* disable the screen if display params are invalid */
3232   if(xstart > xend || ystart > yend)
r29304r29305
7777            }
7878         }
7979         break;
80         case 1: //2 bpp
81         {
82            for(y=0;y<ysize;y++)
83            {
84               for(x=0;x<xsize;x+=4)
85               {
86                  pen = vram[count];
87
88                  for(xi=0;xi<4;xi++)
89                  {
90                     res_x = x+xi+xstart;
91                     res_y = (y+ystart)*(m_vidc_interlace+1);
92
93                     if(m_vidc_interlace)
94                     {
95                        if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
96                           bitmap.pix32(res_y, res_x) = m_palette->pen((pen>>(xi*2))&0x3);
97                        if (cliprect.contains(res_x, res_y+1) && (res_x) <= xend && (res_y+1) <= yend)
98                           bitmap.pix32(res_y+1, res_x) = m_palette->pen((pen>>(xi*2))&0x3);
99                     }
100                     else
101                     {
102                        if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
103                           bitmap.pix32(res_y, res_x) = m_palette->pen((pen>>(xi*2))&0x3);
104                     }
105                  }
106
107                  count++;
108               }
109            }
110         }
111         break;
80112         case 2: //4 bpp
81113         {
82114            for(y=0;y<ysize;y++)
shelves/new_menus/src/mame/drivers/bowltry.c
r29304r29305
55   (c)200? Atlus
66
77   TODO:
8   - needs H83008 core features kicked in to proceed.
8   - Tight loops at 0x60e090-0x60e093, control status from video chip?
9   - YGV631-B ... what's that?
910
1011   ATLUS PCB  BT-208001
1112   ------------------------
r29304r29305
2627
2728
2829#include "emu.h"
29#include "cpu/h8/h83002.h"
30#include "cpu/h8/h83008.h"
3031
32#define HACK_ENABLED 0
3133
3234class bowltry_state : public driver_device
3335{
r29304r29305
3739         m_maincpu(*this, "maincpu")
3840   { }
3941
40   UINT32 screen_update_bowltry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
42   UINT32 screen_update_bowltry(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
43   int m_test_x;
44   int m_test_y;
45   int m_start_offs;
46#if HACK_ENABLED
47   DECLARE_READ16_MEMBER(hack_r);
48   DECLARE_WRITE16_MEMBER(hack_w);
49   UINT16 m_hack[2];
50#endif
4151
4252protected:
4353   required_device<cpu_device> m_maincpu;
4454public:
4555};
4656
57#if HACK_ENABLED
58READ16_MEMBER(bowltry_state::hack_r)
59{
60   if(offset)
61      return m_hack[1] & ~0x20;
4762
63   m_hack[0]^=1;
64   return m_hack[0];
65}
66
67WRITE16_MEMBER(bowltry_state::hack_w)
68{
69   COMBINE_DATA(&m_hack[offset]);
70}
71#endif
72
4873static ADDRESS_MAP_START( bowltry_map, AS_PROGRAM, 16, bowltry_state )
74   ADDRESS_MAP_UNMAP_HIGH
4975   AM_RANGE( 0x000000, 0x07ffff ) AM_ROM AM_REGION("maincpu", 0)
50   AM_RANGE( 0x080000, 0x08ffff ) AM_RAM
76   AM_RANGE( 0x080000, 0x083fff ) AM_RAM
77#if HACK_ENABLED
78   AM_RANGE( 0x60e090, 0x60e093 ) AM_READWRITE(hack_r,hack_w)
79#endif
5180   AM_RANGE( 0x600000, 0x60ffff ) AM_RAM
52   AM_RANGE( 0xfee000, 0xffffff ) AM_RAM // CPU i/o goes here?
81
5382ADDRESS_MAP_END
5483
5584static INPUT_PORTS_START( bowltry )
5685INPUT_PORTS_END
5786
58UINT32 bowltry_state::screen_update_bowltry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
87UINT32 bowltry_state::screen_update_bowltry(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
5988{
6089   return 0;
6190}
r29304r29305
6392
6493
6594static MACHINE_CONFIG_START( bowltry, bowltry_state )
66   MCFG_CPU_ADD("maincpu", H83002, 16000000 ) // H83008 (!)
95   MCFG_CPU_ADD("maincpu", H83008, 16000000 )
6796   MCFG_CPU_PROGRAM_MAP( bowltry_map )
6897//   MCFG_CPU_VBLANK_INT_DRIVER("screen", bowltry_state,  irq0_line_hold) // uses vector $64, IMIAB according to the manual (timer/compare B, internal to the CPU)
6998
r29304r29305
73102   MCFG_SCREEN_SIZE(64*8, 32*8)
74103   MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
75104   MCFG_SCREEN_UPDATE_DRIVER(bowltry_state, screen_update_bowltry)
76   MCFG_SCREEN_PALETTE("palette")
105   //MCFG_SCREEN_PALETTE("palette")
77106
78   MCFG_PALETTE_ADD("palette", 0x200)
107   //MCFG_PALETTE_ADD("palette", 65536)
79108
80109   /* tt5665 sound */
81110
r29304r29305
85114   ROM_REGION( 0x080000, "maincpu", 0 )
86115   ROM_LOAD16_WORD_SWAP( "u30_v1.00.u30", 0x000000, 0x080000, CRC(2bd47419) SHA1(8fc975340e47ddeedf96e454a6c5372328f28b72) )
87116
88   ROM_REGION( 0x800000, "gfx", 0 )
117   ROM_REGION( 0x800000, "gfx", 0 ) // ???
89118   ROM_LOAD16_BYTE( "u27_v1.00.u27", 0x000000, 0x400000, CRC(80f51c25) SHA1(53c21325e7796197c26ca0cf4f8e51bf1e0bdcd3) )
90119   ROM_LOAD16_BYTE( "u28_v1.00.u28", 0x000001, 0x400000, CRC(9cc8b577) SHA1(6ef5cbb83860f88c9c83d4410034c5b528b2138b) )
91120
92   ROM_REGION( 0x400000, "tt5665", 0 )
121   ROM_REGION( 0x400000, "tt5665", 0 ) // sound
93122   ROM_LOAD( "u24_v1.00.u24", 0x000000, 0x400000, CRC(4e082d58) SHA1(d2eb58bc3d8ade2ea556960013d580f0fb952090) )
94123ROM_END
95124
shelves/new_menus/src/mame/drivers/wpc_dot.c
r29304r29305
183183   m_bankmask = (memregion("code")->bytes() >> 14) - 1;
184184   logerror("WPC: ROM bank mask = %02x\n",m_bankmask);
185185   memset(m_ram,0,0x3000);
186   memset(m_dmdram,0,0x2000);
186187   save_pointer(m_dmdram,"DMD RAM",0x2000);
187188}
188189
shelves/new_menus/src/mame/drivers/kopunch.c
r29304r29305
44 
55  XTAL: ?
66  CPU: 8085 (proof: it uses SIM opcode)
7  Other: 4 x i8255 for all I/O
78
89  TODO:
910  - discrete sound?
r29304r29305
3031
3132#include "emu.h"
3233#include "cpu/i8085/i8085.h"
34#include "machine/i8255.h"
3335#include "includes/kopunch.h"
3436
3537
36INTERRUPT_GEN_MEMBER(kopunch_state::kopunch_interrupt)
38/********************************************************
39
40  Interrupts
41
42********************************************************/
43
44INTERRUPT_GEN_MEMBER(kopunch_state::vblank_interrupt)
3745{
3846   device.execute().set_input_line(I8085_RST75_LINE, ASSERT_LINE);
3947   device.execute().set_input_line(I8085_RST75_LINE, CLEAR_LINE);
4048}
4149
42READ8_MEMBER(kopunch_state::kopunch_in_r)
50INPUT_CHANGED_MEMBER(kopunch_state::left_coin_inserted)
4351{
44   /* port 31 + low 3 bits of port 32 contain the punch strength */
45   if (offset == 0)
46      return machine().rand();
47   else
48      return (machine().rand() & 0x07) | ioport("SYSTEM")->read();
52   // left coin insertion causes a rst6.5 (vector 0x34)
53   if (newval)
54      m_maincpu->set_input_line(I8085_RST65_LINE, HOLD_LINE);
4955}
5056
51WRITE8_MEMBER(kopunch_state::kopunch_lamp_w)
57INPUT_CHANGED_MEMBER(kopunch_state::right_coin_inserted)
5258{
53   set_led_status(machine(), 0, ~data & 0x80);
59   // right coin insertion causes a rst5.5 (vector 0x2c)
60   if (newval)
61      m_maincpu->set_input_line(I8085_RST55_LINE, HOLD_LINE);
5462}
5563
56WRITE8_MEMBER(kopunch_state::kopunch_coin_w)
57{
58   coin_counter_w(machine(), 0, ~data & 0x80);
59   coin_counter_w(machine(), 1, ~data & 0x40);
6064
61//  if ((data & 0x3f) != 0x3e)
62//      printf("port 34 = %02x   ",data);
63}
65/********************************************************
6466
67  Memory Maps
6568
69********************************************************/
6670
6771static ADDRESS_MAP_START( kopunch_map, AS_PROGRAM, 8, kopunch_state )
6872   AM_RANGE(0x0000, 0x1fff) AM_ROM
6973   AM_RANGE(0x2000, 0x23ff) AM_RAM
70   AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(kopunch_fg_w) AM_SHARE("vram_fg")
71   AM_RANGE(0x7000, 0x70ff) AM_RAM_WRITE(kopunch_bg_w) AM_SHARE("vram_bg")
74   AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(vram_fg_w) AM_SHARE("vram_fg")
75   AM_RANGE(0x7000, 0x70ff) AM_RAM_WRITE(vram_bg_w) AM_SHARE("vram_bg")
7276   AM_RANGE(0x7100, 0x73ff) AM_RAM // unused vram
77   AM_RANGE(0x7400, 0x7bff) AM_RAM // more unused vram? or accidental writes?
7378ADDRESS_MAP_END
7479
7580static ADDRESS_MAP_START( kopunch_io_map, AS_IO, 8, kopunch_state )
76   AM_RANGE(0x30, 0x30) AM_READ_PORT("P1")
77   AM_RANGE(0x31, 0x32) AM_READ(kopunch_in_r)
78   AM_RANGE(0x33, 0x33) AM_WRITENOP
79   AM_RANGE(0x34, 0x34) AM_WRITE(kopunch_coin_w)
80   AM_RANGE(0x35, 0x35) AM_WRITENOP
81   AM_RANGE(0x36, 0x36) AM_WRITENOP
82   AM_RANGE(0x37, 0x37) AM_WRITENOP
83   AM_RANGE(0x38, 0x38) AM_WRITE(kopunch_lamp_w)
84   AM_RANGE(0x39, 0x39) AM_WRITENOP
85   AM_RANGE(0x3a, 0x3a) AM_READ_PORT("DSW")
86   AM_RANGE(0x3b, 0x3b) AM_WRITENOP
87   AM_RANGE(0x3c, 0x3c) AM_WRITE(kopunch_scroll_x_w)
88   AM_RANGE(0x3d, 0x3d) AM_WRITE(kopunch_scroll_y_w)
89   AM_RANGE(0x3e, 0x3e) AM_READ_PORT("P2") AM_WRITE(kopunch_gfxbank_w)
90   AM_RANGE(0x3f, 0x3f) AM_WRITENOP
81   AM_RANGE(0x30, 0x33) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
82   AM_RANGE(0x34, 0x37) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
83   AM_RANGE(0x38, 0x3b) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write)
84   AM_RANGE(0x3c, 0x3f) AM_DEVREADWRITE("ppi8255_3", i8255_device, read, write)
9185ADDRESS_MAP_END
9286
93INPUT_CHANGED_MEMBER(kopunch_state::left_coin_inserted)
87
88
89/********************************************************
90
91  PPI I/O
92
93********************************************************/
94
95READ8_MEMBER(kopunch_state::sensors1_r)
9496{
95   // left coin insertion causes a rst6.5 (vector 0x34)
96   if (newval)
97      m_maincpu->set_input_line(I8085_RST65_LINE, HOLD_LINE);
97   // punch strength low bits
98   return machine().rand();
9899}
99100
100INPUT_CHANGED_MEMBER(kopunch_state::right_coin_inserted)
101READ8_MEMBER(kopunch_state::sensors2_r)
101102{
102   // right coin insertion causes a rst5.5 (vector 0x2c)
103   if (newval)
104      m_maincpu->set_input_line(I8085_RST55_LINE, HOLD_LINE);
103   // d0-d2: punch strength high bits
104   // d3: coin 2
105   // d4: unknown sensor
106   // d5: unknown sensor
107   // d6: unknown sensor
108   // d7: coin 1
109   return (machine().rand() & 0x07) | ioport("SYSTEM")->read();
105110}
106111
112WRITE8_MEMBER(kopunch_state::lamp_w)
113{
114   set_led_status(machine(), 0, ~data & 0x80);
115}
116
117WRITE8_MEMBER(kopunch_state::coin_w)
118{
119   coin_counter_w(machine(), 0, ~data & 0x80);
120   coin_counter_w(machine(), 1, ~data & 0x40);
121
122//  if ((data & 0x3f) != 0x3e)
123//      printf("port 34 = %02x   ",data);
124}
125
126/*******************************************************/
127
128static I8255A_INTERFACE( ppi8255_0_intf )
129{
130   // $30 - always $9b (PPI mode 0, ports A & B & C as input)
131   DEVCB_INPUT_PORT("P1"),
132   DEVCB_NULL,
133   DEVCB_DRIVER_MEMBER(kopunch_state, sensors1_r),
134   DEVCB_NULL,
135   DEVCB_DRIVER_MEMBER(kopunch_state, sensors2_r),
136   DEVCB_NULL
137};
138
139static I8255A_INTERFACE( ppi8255_1_intf )
140{
141   // $34 - always $80 (PPI mode 0, ports A & B & C as output)
142   DEVCB_NULL,
143   DEVCB_DRIVER_MEMBER(kopunch_state, coin_w),
144   DEVCB_NULL,
145   DEVCB_UNMAPPED,
146   DEVCB_NULL,
147   DEVCB_UNMAPPED
148};
149
150static I8255A_INTERFACE( ppi8255_2_intf )
151{
152   // $38 - always $89 (PPI mode 0, ports A & B as output, port C as input)
153   DEVCB_NULL,
154   DEVCB_DRIVER_MEMBER(kopunch_state, lamp_w),
155   DEVCB_NULL,
156   DEVCB_UNMAPPED,
157   DEVCB_INPUT_PORT("DSW"),
158   DEVCB_NULL
159};
160
161static I8255A_INTERFACE( ppi8255_3_intf )
162{
163   // $3c - always $88 (PPI mode 0, ports A & B & lower C as output, upper C as input)
164   DEVCB_NULL,
165   DEVCB_DRIVER_MEMBER(kopunch_state, scroll_x_w),
166   DEVCB_NULL,
167   DEVCB_DRIVER_MEMBER(kopunch_state, scroll_y_w),
168   DEVCB_INPUT_PORT("P2"),
169   DEVCB_DRIVER_MEMBER(kopunch_state, gfxbank_w)
170};
171
172
173
174/********************************************************
175
176  Inputs
177
178********************************************************/
179
107180static INPUT_PORTS_START( kopunch )
108181   PORT_START("P1")
109182   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
r29304r29305
158231INPUT_PORTS_END
159232
160233
161static const gfx_layout charlayout =
234
235/*******************************************************/
236
237static const gfx_layout fg_layout =
162238{
163239   8,8,
164240   RGN_FRAC(1,3),
r29304r29305
169245   8*8
170246};
171247
172static const gfx_layout charlayoutbig =
248static const gfx_layout bg_layout =
173249{
174250   16,16,
175251   RGN_FRAC(1,3),
r29304r29305
181257};
182258
183259static GFXDECODE_START( kopunch )
184   GFXDECODE_ENTRY( "gfx1", 0, charlayout,    0, 1 )
185   GFXDECODE_ENTRY( "gfx2", 0, charlayoutbig, 0, 1 )
260   GFXDECODE_ENTRY( "gfx1", 0, fg_layout, 0, 1 )
261   GFXDECODE_ENTRY( "gfx2", 0, bg_layout, 0, 1 )
186262GFXDECODE_END
187263
188264
r29304r29305
203279   MCFG_CPU_ADD("maincpu", I8085A, 4000000) // 4 MHz?
204280   MCFG_CPU_PROGRAM_MAP(kopunch_map)
205281   MCFG_CPU_IO_MAP(kopunch_io_map)
206   MCFG_CPU_VBLANK_INT_DRIVER("screen", kopunch_state, kopunch_interrupt)
282   MCFG_CPU_VBLANK_INT_DRIVER("screen", kopunch_state, vblank_interrupt)
207283
284   MCFG_I8255A_ADD("ppi8255_0", ppi8255_0_intf)
285   MCFG_I8255A_ADD("ppi8255_1", ppi8255_1_intf)
286   MCFG_I8255A_ADD("ppi8255_2", ppi8255_2_intf)
287   MCFG_I8255A_ADD("ppi8255_3", ppi8255_3_intf)
288
208289   /* video hardware */
209290   MCFG_SCREEN_ADD("screen", RASTER)
210291   MCFG_SCREEN_REFRESH_RATE(60)
211292   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
212293   MCFG_SCREEN_SIZE(32*8, 32*8)
213   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
294   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 28*8-1)
214295   MCFG_SCREEN_UPDATE_DRIVER(kopunch_state, screen_update_kopunch)
215296   MCFG_SCREEN_PALETTE("palette")
216297
r29304r29305
219300   MCFG_PALETTE_INIT_OWNER(kopunch_state, kopunch)
220301
221302   /* sound hardware */
303   // ...
222304MACHINE_CONFIG_END
223305
224306
225/***************************************************************************
226307
308/********************************************************
309
227310  Game driver(s)
228311
229***************************************************************************/
312********************************************************/
230313
231314ROM_START( kopunch )
232315   ROM_REGION( 0x10000, "maincpu", 0 )
r29304r29305
252335   ROM_LOAD( "epr1100",      0x0040, 0x0020, CRC(bedb66b1) SHA1(8e78bb205d900075b761e1baa5f5813174ff28ba) ) /* unknown */
253336ROM_END
254337
338
255339GAME( 1981, kopunch, 0, kopunch, kopunch, driver_device, 0, ROT270, "Sega", "KO Punch", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_MECHANICAL | GAME_SUPPORTS_SAVE )
shelves/new_menus/src/mame/drivers/namcos23.c
r29304r29305
16371637      logerror("WARNING: c435_matrix_vector_mul with size %d\n", m_c435_buffer[0] & 0xf);
16381638      return;
16391639   }
1640   if(m_c435_buffer[3] != 0xffff)
1641      logerror("WARNING: c435_matrix_vector_mul with +2=%04x\n", m_c435_buffer[3]);
16421640
1643   INT32 *t       = c435_getv(m_c435_buffer[1]);
1644   const INT16 *m = c435_getm(m_c435_buffer[2]);
1645   const INT32 *v = c435_getv(m_c435_buffer[4]);
1641   if(m_c435_buffer[3] != 0xffff) {
1642      INT32 *t        = c435_getv(m_c435_buffer[1]);
1643      const INT16 *m  = c435_getm(m_c435_buffer[2]);
1644      const INT32 *vt = c435_getv(m_c435_buffer[3]);
1645      const INT32 *v  = c435_getv(m_c435_buffer[4]);
16461646
1647   t[0] = INT32((m[0]*INT64(v[0]) + m[1]*INT64(v[1]) + m[2]*INT64(v[2])) >> 14);
1648   t[1] = INT32((m[3]*INT64(v[0]) + m[4]*INT64(v[1]) + m[5]*INT64(v[2])) >> 14);
1649   t[2] = INT32((m[6]*INT64(v[0]) + m[7]*INT64(v[1]) + m[8]*INT64(v[2])) >> 14);
1647      t[0] = INT32((m[0]*INT64(v[0]) + m[1]*INT64(v[1]) + m[2]*INT64(v[2])) >> 14) + vt[0];
1648      t[1] = INT32((m[3]*INT64(v[0]) + m[4]*INT64(v[1]) + m[5]*INT64(v[2])) >> 14) + vt[1];
1649      t[2] = INT32((m[6]*INT64(v[0]) + m[7]*INT64(v[1]) + m[8]*INT64(v[2])) >> 14) + vt[2];
1650
1651   } else {
1652      INT32 *t       = c435_getv(m_c435_buffer[1]);
1653      const INT16 *m = c435_getm(m_c435_buffer[2]);
1654      const INT32 *v = c435_getv(m_c435_buffer[4]);
1655
1656      t[0] = INT32((m[0]*INT64(v[0]) + m[1]*INT64(v[1]) + m[2]*INT64(v[2])) >> 14);
1657      t[1] = INT32((m[3]*INT64(v[0]) + m[4]*INT64(v[1]) + m[5]*INT64(v[2])) >> 14);
1658      t[2] = INT32((m[6]*INT64(v[0]) + m[7]*INT64(v[1]) + m[8]*INT64(v[2])) >> 14);
1659   }
16501660}
16511661
16521662void namcos23_state::c435_matrix_set() // 0.4
r29304r29305
17911801      break;
17921802
17931803   case 0x4000:
1794      switch(h & 0xf00) {
1795      case 0x400: c435_scaling_set(); break;
1796      case 0xf00: c435_state_set(); break;
1804      switch(h & 0x3f00) {
1805      case 0x0400: c435_scaling_set(); break;
1806      case 0x0f00: c435_state_set(); break;
17971807      default: known = false; break;
17981808      }
17991809      break;
shelves/new_menus/src/mame/drivers/stv.c
r29304r29305
927927
928928static ADDRESS_MAP_START( stv_mem, AS_PROGRAM, 32, stv_state )
929929   AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_SHARE("share6")  // bios
930   AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE8_LEGACY(stv_SMPC_r, stv_SMPC_w,0xffffffff)
930   AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE8(stv_SMPC_r, stv_SMPC_w,0xffffffff)
931931   AM_RANGE(0x00180000, 0x0018ffff) AM_READWRITE8(saturn_backupram_r,saturn_backupram_w,0xffffffff) AM_SHARE("share1")
932932   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x20100000) AM_SHARE("workram_l")
933933//  AM_RANGE(0x00400000, 0x0040001f) AM_READWRITE(stv_ioga_r32, stv_io_w32) AM_SHARE("ioga") AM_MIRROR(0x20) /* installed with per-game specific */
shelves/new_menus/src/mame/drivers/vega.c
r29304r29305
807807};
808808
809809
810static const ins8154_interface ins8154_intf =
811{
812   DEVCB_DRIVER_MEMBER(vega_state, ins8154_pa_r),
813   DEVCB_DRIVER_MEMBER(vega_state, ins8154_pa_w),
814   DEVCB_DRIVER_MEMBER(vega_state, ins8154_pb_r),
815   DEVCB_DRIVER_MEMBER(vega_state, ins8154_pb_w),
816   DEVCB_NULL
817};
818
819
820810static const ay8910_interface ay8910_inf =
821811{
822812   AY8910_LEGACY_OUTPUT,
r29304r29305
843833
844834
845835   MCFG_I8255A_ADD( "ppi8255", ppi8255_intf )
846   MCFG_INS8154_ADD( "ins8154", ins8154_intf)
836   MCFG_DEVICE_ADD( "ins8154", INS8154, 0 )
837   MCFG_INS8154_IN_A_CB(READ8(vega_state, ins8154_pa_r))
838   MCFG_INS8154_OUT_A_CB(WRITE8(vega_state, ins8154_pa_w))
839   MCFG_INS8154_IN_B_CB(READ8(vega_state, ins8154_pb_r))
840   MCFG_INS8154_OUT_B_CB(WRITE8(vega_state, ins8154_pb_w))
847841
848842   /* video hardware */
849843   MCFG_SCREEN_ADD("screen", RASTER)
shelves/new_menus/src/emu/rendlay.c
r29304r29305
666666      m_stateoffset = xml_get_attribute_int_with_subst(machine, compnode, "stateoffset", 0);
667667      m_numsymbolsvisible = xml_get_attribute_int_with_subst(machine, compnode, "numsymbolsvisible", 3);
668668      m_reelreversed = xml_get_attribute_int_with_subst(machine, compnode, "reelreversed", 0);
669      m_beltreel = xml_get_attribute_int_with_subst(machine, compnode, "beltreel", 0);
670     
669671   }
670672
671673   // led7seg nodes
r29304r29305
981983/* state is a normalized value between 0 and 65536 so that we don't need to worry about how many motor steps here or in the .lay, only the number of symbols */
982984void layout_element::component::draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
983985{
986   if (m_beltreel)
987   {
988      draw_beltreel(machine,dest,bounds,state);
989   }
990   else
991   {
992      const int max_state_used = 0x10000;
993
994      // shift the reels a bit based on this param, allows fine tuning
995      int use_state = (state + m_stateoffset) % max_state_used;
996
997      // compute premultiplied colors
998      UINT32 r = m_color.r * 255.0;
999      UINT32 g = m_color.g * 255.0;
1000      UINT32 b = m_color.b * 255.0;
1001      UINT32 a = m_color.a * 255.0;
1002
1003      // get the width of the string
1004      render_font *font = machine.render().font_alloc("default");
1005      float aspect = 1.0f;
1006      INT32 width;
1007     
1008
1009      int curry = 0;
1010      int num_shown = m_numsymbolsvisible;
1011
1012      int ourheight = bounds.height();
1013
1014      for (int fruit = 0;fruit<m_numstops;fruit++)
1015      {
1016         int basey;
1017
1018         if (m_reelreversed==1)
1019         {
1020            basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1021         }
1022         else
1023         {
1024            basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1025         }
1026
1027         // wrap around...
1028         if (basey < bounds.min_y)
1029            basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1030         if (basey > bounds.max_y)
1031            basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1032
1033         int endpos = basey+ourheight/num_shown;
1034
1035         // only render the symbol / text if it's atually in view because the code is SLOW
1036         if ((endpos >= bounds.min_y) && (basey <= bounds.max_y))
1037         {
1038            while (1)
1039            {
1040               width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]);
1041               if (width < bounds.width())
1042                  break;
1043               aspect *= 0.9f;
1044            }
1045
1046            INT32 curx;
1047            curx = bounds.min_x + (bounds.width() - width) / 2;
1048
1049            if (m_file[fruit])
1050               if (!m_bitmap[fruit].valid())
1051                  load_reel_bitmap(fruit);
1052
1053            if (m_file[fruit]) // render gfx
1054            {
1055               bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown);
1056
1057               if (m_bitmap[fruit].valid())
1058               {
1059                  render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
1060
1061                  for (int y = 0; y < ourheight/num_shown; y++)
1062                  {
1063                     int effy = basey + y;
1064
1065                     if (effy >= bounds.min_y && effy <= bounds.max_y)
1066                     {
1067                        UINT32 *src = &tempbitmap2.pix32(y);
1068                        UINT32 *d = &dest.pix32(effy);
1069                        for (int x = 0; x < dest.width(); x++)
1070                        {
1071                           int effx = x;
1072                           if (effx >= bounds.min_x && effx <= bounds.max_x)
1073                           {
1074                              UINT32 spix = rgb_t(src[x]).a();
1075                              if (spix != 0)
1076                              {
1077                                 d[effx] = src[x];
1078                              }
1079                           }
1080                        }
1081                     }
1082
1083                  }
1084               }
1085            }
1086            else // render text (fallback)
1087            {
1088               // allocate a temporary bitmap
1089               bitmap_argb32 tempbitmap(dest.width(), dest.height());
1090
1091               // loop over characters
1092               for (const char *s = m_stopnames[fruit]; *s != 0; s++)
1093               {
1094                  // get the font bitmap
1095                  rectangle chbounds;
1096                  font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds);
1097
1098                  // copy the data into the target
1099                  for (int y = 0; y < chbounds.height(); y++)
1100                  {
1101                     int effy = basey + y;
1102
1103                     if (effy >= bounds.min_y && effy <= bounds.max_y)
1104                     {
1105                        UINT32 *src = &tempbitmap.pix32(y);
1106                        UINT32 *d = &dest.pix32(effy);
1107                        for (int x = 0; x < chbounds.width(); x++)
1108                        {
1109                           int effx = curx + x + chbounds.min_x;
1110                           if (effx >= bounds.min_x && effx <= bounds.max_x)
1111                           {
1112                              UINT32 spix = rgb_t(src[x]).a();
1113                              if (spix != 0)
1114                              {
1115                                 rgb_t dpix = d[effx];
1116                                 UINT32 ta = (a * (spix + 1)) >> 8;
1117                                 UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8;
1118                                 UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8;
1119                                 UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8;
1120                                 d[effx] = rgb_t(tr, tg, tb);
1121                              }
1122                           }
1123                        }
1124                     }
1125                  }
1126
1127                  // advance in the X direction
1128                  curx += font->char_width(ourheight/num_shown, aspect, *s);
1129
1130               }
1131
1132            }
1133         }
1134
1135         curry += ourheight/num_shown;
1136      }
1137   // free the temporary bitmap and font
1138   machine.render().font_free(font);
1139   }
1140}
1141
1142
1143void layout_element::component::draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state)
1144{
9841145   const int max_state_used = 0x10000;
9851146
9861147   // shift the reels a bit based on this param, allows fine tuning
r29304r29305
9961157   render_font *font = machine.render().font_alloc("default");
9971158   float aspect = 1.0f;
9981159   INT32 width;
999   int curry = 0;
1160   int currx = 0;
10001161   int num_shown = m_numsymbolsvisible;
10011162
1002   int ourheight = bounds.height();
1163   int ourwidth = bounds.width();
10031164
10041165   for (int fruit = 0;fruit<m_numstops;fruit++)
10051166   {
1006      int basey;
1007
1167      int basex;
10081168      if (m_reelreversed==1)
10091169      {
1010         basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1170         basex = bounds.min_x + ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
10111171      }
10121172      else
10131173      {
1014         basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
1174         basex = bounds.min_x - ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx;
10151175      }
10161176
10171177      // wrap around...
1018      if (basey < bounds.min_y)
1019         basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1020      if (basey > bounds.max_y)
1021         basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
1178      if (basex < bounds.min_x)
1179         basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
1180      if (basex > bounds.max_x)
1181         basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
10221182
1023      int endpos = basey+ourheight/num_shown;
1183      int endpos = basex+(ourwidth/num_shown);
10241184
10251185      // only render the symbol / text if it's atually in view because the code is SLOW
1026      if ((endpos >= bounds.min_y) && (basey <= bounds.max_y))
1186      if ((endpos >= bounds.min_x) && (basex <= bounds.max_x))
10271187      {
10281188         while (1)
10291189         {
1030            width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]);
1190            width = font->string_width(dest.height(), aspect, m_stopnames[fruit]);
10311191            if (width < bounds.width())
10321192               break;
10331193            aspect *= 0.9f;
10341194         }
10351195
10361196         INT32 curx;
1037         curx = bounds.min_x + (bounds.width() - width) / 2;
1197         curx = bounds.min_x;
10381198
10391199         if (m_file[fruit])
10401200            if (!m_bitmap[fruit].valid())
r29304r29305
10421202
10431203         if (m_file[fruit]) // render gfx
10441204         {
1045            bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown);
1205            bitmap_argb32 tempbitmap2(ourwidth/num_shown, dest.height());
10461206
10471207            if (m_bitmap[fruit].valid())
10481208            {
10491209               render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color);
10501210
1051               for (int y = 0; y < ourheight/num_shown; y++)
1211               for (int y = 0; y < dest.height(); y++)
10521212               {
1053                  int effy = basey + y;
1213                  int effy = y;
10541214
10551215                  if (effy >= bounds.min_y && effy <= bounds.max_y)
10561216                  {
10571217                     UINT32 *src = &tempbitmap2.pix32(y);
10581218                     UINT32 *d = &dest.pix32(effy);
1059                     for (int x = 0; x < dest.width(); x++)
1219                     for (int x = 0; x < ourwidth/num_shown; x++)
10601220                     {
1061                        int effx = x;
1221                        int effx = basex + x;
10621222                        if (effx >= bounds.min_x && effx <= bounds.max_x)
10631223                        {
10641224                           UINT32 spix = rgb_t(src[x]).a();
r29304r29305
10831243            {
10841244               // get the font bitmap
10851245               rectangle chbounds;
1086               font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds);
1246               font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, *s, chbounds);
10871247
10881248               // copy the data into the target
10891249               for (int y = 0; y < chbounds.height(); y++)
10901250               {
1091                  int effy = basey + y;
1251                  int effy = y;
10921252
10931253                  if (effy >= bounds.min_y && effy <= bounds.max_y)
10941254                  {
r29304r29305
10961256                     UINT32 *d = &dest.pix32(effy);
10971257                     for (int x = 0; x < chbounds.width(); x++)
10981258                     {
1099                        int effx = curx + x + chbounds.min_x;
1259                        int effx = basex + curx + x;
11001260                        if (effx >= bounds.min_x && effx <= bounds.max_x)
11011261                        {
1102                           UINT32 spix = rgb_t(src[x]).a();
1262                           UINT32 spix = rgb_t(src[x]).a();
11031263                           if (spix != 0)
11041264                           {
11051265                              rgb_t dpix = d[effx];
r29304r29305
11151275               }
11161276
11171277               // advance in the X direction
1118               curx += font->char_width(ourheight/num_shown, aspect, *s);
1278               curx += font->char_width(dest.height(), aspect, *s);
11191279
11201280            }
11211281
11221282         }
11231283      }
11241284
1125      curry += ourheight/num_shown;
1285      currx += ourwidth/num_shown;
11261286   }
11271287
11281288   // free the temporary bitmap and font
r29304r29305
11301290}
11311291
11321292
1133
1134
11351293//-------------------------------------------------
11361294//  load_bitmap - load a PNG file with artwork for
11371295//  a component
shelves/new_menus/src/emu/rendlay.h
r29304r29305
105105      void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds);
106106      void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
107107      void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
108      void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state);
108109      void load_bitmap();
109110      void load_reel_bitmap(int number);
110111      void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern);
r29304r29305
148149      int                 m_stateoffset;
149150      int                 m_reelreversed;
150151      int                 m_numsymbolsvisible;
151
152      int               m_beltreel;
152153   };
153154
154155   // a texture encapsulates a texture for a given element in a given state
shelves/new_menus/src/emu/bus/saturn/bram.c
r29304r29305
6868{
6969}
7070
71void saturn_bram_device::nvram_default()
72{
73   static const UINT8 init[16] =
74   { 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't' };
75   memset(m_ext_bram, 0, m_ext_bram_size);
7176
77   for (int i = 0; i < 32; i++)
78   {
79      for (int j = 0; j < 16; j++)
80         m_ext_bram[i * 16 + j] = init[j];
81   }
82}
83
84
7285/*-------------------------------------------------
7386 IO handlers
7487 -------------------------------------------------*/
shelves/new_menus/src/emu/bus/saturn/bram.h
r29304r29305
1919   virtual void device_reset();
2020
2121   // device_nvram_interface overrides
22   virtual void nvram_default() { }
22   virtual void nvram_default();
2323   virtual void nvram_read(emu_file &file) { if (m_ext_bram != NULL) { file.read(m_ext_bram, m_ext_bram_size); } }
2424   virtual void nvram_write(emu_file &file) { if (m_ext_bram != NULL) { file.write(m_ext_bram, m_ext_bram_size); } }
2525
shelves/new_menus/src/emu/bus/isa/omti8621.c
r29304r29305
2828#define LOG2(x) { if (verbose > 1) LOG(x)}
2929#define LOG3(x) { if (verbose > 2) LOG(x)}
3030
31#define DLOG(x) { logerror ("%s: ", cpu_context(disk->device)); logerror x; logerror ("\n"); }
32#define DLOG1(x)    { if (verbose > 0) DLOG(x)}
33#define DLOG2(x)    { if (verbose > 1) DLOG(x)}                       
34
3531#define OMTI_DISK_SECTOR_SIZE 1056
3632
3733#define OMTI_DISK_TYPE_155_MB 0x607 // Micropolis 1355 (170 MB Dtype = 607)
r29304r29305
7167   virtual const option_guide *create_option_guide() const { return NULL; }
7268
7369   virtual bool call_create(int format_type, option_resolution *format_options);
74
75   disk_data *token() { return &m_token; }
7670protected:
7771   // device-level overrides
7872   virtual void device_config_complete();
7973   virtual void device_start();
8074   virtual void device_reset();
75   
76   void omti_disk_config(UINT16 disk_type);
77public:
78   UINT16 m_type;
79   UINT16 m_cylinders;
80   UINT16 m_heads;
81   UINT16 m_sectors;
82   UINT32 m_sectorbytes;
83   UINT32 m_sector_count;
8184
82   disk_data m_token;
85   device_image_interface *m_image;
86
87   // configuration data
88   UINT8 m_config_data[10];
89
90   // ESDI defect list data
91   UINT8 m_esdi_defect_list[256];
8392};
8493
8594/*
r29304r29305
279288   sector_buffer.resize(OMTI_DISK_SECTOR_SIZE*OMTI_MAX_BLOCK_COUNT);
280289
281290   m_timer = timer_alloc(0, NULL);
282
283   device_t *device0 = subdevice(OMTI_DISK0_TAG);
284   our_disks[0] = (disk_data *) downcast<omti_disk_image_device *>(device0)->token();
285
286   device_t *device1 = subdevice(OMTI_DISK1_TAG);
287   our_disks[1] = (disk_data *) downcast<omti_disk_image_device *>(device1)->token();
291   
292   our_disks[0] = subdevice<omti_disk_image_device>(OMTI_DISK0_TAG);
293   our_disks[1] = subdevice<omti_disk_image_device>(OMTI_DISK1_TAG);
288294}
289295
290296/*-------------------------------------------------
r29304r29305
320326      m_installed = true;
321327   }
322328
323   set_jumper(our_disks[0]->type);
329   set_jumper(our_disks[0]->m_type);
324330
325331   // should go from reset to idle after 100 us
326332   // state->omti_state = OMTI_STATE_RESET;
r29304r29305
422428   LOG2(("set_configuration_data lun=%x", lun));
423429
424430   // initialize the configuration data
425   disk_data *disk = our_disks[lun];
431   omti_disk_image_device *disk = our_disks[lun];
426432
427   disk->config_data[0] = (disk->cylinders - 1) >> 8; // Number of Cylinders (MSB)
428   disk->config_data[1] = (disk->cylinders - 1) & 0xff; // Number of Cylinders (LSB) (-1)
429   disk->config_data[2] = disk->heads - 1; // Number of Heads (-1)
430   disk->config_data[3] = disk->sectors - 1; // Number of Sectors (-1)
431   disk->config_data[4] = 0x02; // Drive Configuration Word (MSB)
432   disk->config_data[5] = 0x44; // Drive Configuration Word (LSB)
433   disk->config_data[6] = 0x00; // ISG AFTER INDEX
434   disk->config_data[7] = 0x00; // PLO SYN Field (ID)
435   disk->config_data[8] = 0x00; // PLO SYN Field (DATA)
436   disk->config_data[9] = 0x00; // ISG AFTER SECTOR
433   disk->m_config_data[0] = (disk->m_cylinders - 1) >> 8; // Number of Cylinders (MSB)
434   disk->m_config_data[1] = (disk->m_cylinders - 1) & 0xff; // Number of Cylinders (LSB) (-1)
435   disk->m_config_data[2] = disk->m_heads - 1; // Number of Heads (-1)
436   disk->m_config_data[3] = disk->m_sectors - 1; // Number of Sectors (-1)
437   disk->m_config_data[4] = 0x02; // Drive Configuration Word (MSB)
438   disk->m_config_data[5] = 0x44; // Drive Configuration Word (LSB)
439   disk->m_config_data[6] = 0x00; // ISG AFTER INDEX
440   disk->m_config_data[7] = 0x00; // PLO SYN Field (ID)
441   disk->m_config_data[8] = 0x00; // PLO SYN Field (DATA)
442   disk->m_config_data[9] = 0x00; // ISG AFTER SECTOR
437443}
438444
439445/***************************************************************************
r29304r29305
457463   UINT16 sector = cdb[2] & 0x3f;
458464   UINT32 cylinder = cdb[3] + ((cdb[2] & 0xc0) << 2) + ((cdb[1] & 0x80) << 3);
459465   UINT8 block_count = cdb[4];
460   disk_data *disk = our_disks[lun];
466   omti_disk_image_device *disk = our_disks[lun];
461467
462   UINT32 disk_track = cylinder * disk->heads + head;
463   UINT32 disk_addr = (disk_track * disk->sectors) + sector;
468   UINT32 disk_track = cylinder * disk->m_heads + head;
469   UINT32 disk_addr = (disk_track * disk->m_sectors) + sector;
464470
465471   if (block_count > OMTI_MAX_BLOCK_COUNT) {
466472      LOG(("########### check_disk_address: unexpected block count %x", block_count));
r29304r29305
469475
470476   if (lun > OMTI_MAX_LUN) {
471477      sense_code = OMTI_SENSE_CODE_DRIVE_NOT_READY;
472   } else  if (!disk->image->exists()) {
478   } else  if (!disk->m_image->exists()) {
473479      sense_code = OMTI_SENSE_CODE_DRIVE_NOT_READY;
474480   } else  if (sector >= OMTI_MAX_BLOCK_COUNT) {
475481      sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
476   } else if (head >= disk->heads) {
482   } else if (head >= disk->m_heads) {
477483      sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
478   } else if (cylinder >= disk->cylinders) {
484   } else if (cylinder >= disk->m_cylinders) {
479485      sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
480486   } else if ( disk_track == diskaddr_format_bad_track && disk_track != 0) {
481487      sense_code = OMTI_SENSE_CODE_BAD_TRACK;
r29304r29305
502508   UINT8 lun = get_lun(cdb);
503509   UINT16 head = cdb[1] & 0x1f;
504510   UINT32 cylinder = cdb[3] + ((cdb[2] & 0xc0) << 2) + ((cdb[1] & 0x80) << 3);
505   return cylinder * our_disks[lun]->heads + head;
511   return cylinder * our_disks[lun]->m_heads + head;
506512}
507513
508514/***************************************************************************
r29304r29305
512518UINT32 omti8621_device::get_disk_address(const UINT8 * cdb) {
513519   UINT8 lun = get_lun(cdb);
514520   UINT16 sector = cdb[2] & 0x3f;
515   return get_disk_track(cdb) * our_disks[lun]->sectors + sector;
521   return get_disk_track(cdb) * our_disks[lun]->m_sectors + sector;
516522}
517523
518524/***************************************************************************
r29304r29305
538544void omti8621_device::read_sectors_from_disk(INT32 diskaddr, UINT8 count, UINT8 lun)
539545{
540546   UINT8 *data_buffer = sector_buffer;
541   device_image_interface *image = our_disks[lun]->image;
547   device_image_interface *image = our_disks[lun]->m_image;
542548
543549   while (count-- > 0) {
544550      LOG2(("read_sectors_from_disk lun=%d diskaddr=%x", lun, diskaddr));
r29304r29305
558564void omti8621_device::write_sectors_to_disk(INT32 diskaddr, UINT8 count, UINT8 lun)
559565{
560566   UINT8 *data_buffer = sector_buffer;
561   device_image_interface *image = our_disks[lun]->image;
567   device_image_interface *image = our_disks[lun]->m_image;
562568
563569   while (count-- > 0) {
564570      LOG2(("write_sectors_to_disk lun=%d diskaddr=%x", lun, diskaddr));
r29304r29305
582588
583589void omti8621_device::copy_sectors(INT32 dst_addr, INT32 src_addr, UINT8 count, UINT8 lun)
584590{
585   device_image_interface *image = our_disks[lun]->image;
591   device_image_interface *image = our_disks[lun]->m_image;
586592
587593   LOG2(("copy_sectors lun=%d src_addr=%x dst_addr=%x count=%x", lun, src_addr, dst_addr, count));
588594
r29304r29305
635641
636642   if (check_disk_address(cdb) ) {
637643      if ((cdb[5] & 0x40) == 0) {
638         memset(sector_buffer, 0x6C, OMTI_DISK_SECTOR_SIZE * our_disks[lun]->sectors);
644         memset(sector_buffer, 0x6C, OMTI_DISK_SECTOR_SIZE * our_disks[lun]->m_sectors);
639645      }
640      write_sectors_to_disk(disk_addr, our_disks[lun]->sectors, lun);
646      write_sectors_to_disk(disk_addr, our_disks[lun]->m_sectors, lun);
641647   }
642648
643649}
r29304r29305
648654
649655void omti8621_device::set_esdi_defect_list(UINT8 lun, UINT8 head)
650656{
651   disk_data *disk = our_disks[lun];
657   omti_disk_image_device *disk = our_disks[lun];
652658
653   memset(disk->esdi_defect_list, 0, sizeof(disk->esdi_defect_list));
654   disk->esdi_defect_list[0] = 1; // month
655   disk->esdi_defect_list[1] = 1; // day
656   disk->esdi_defect_list[2] = 90; // year
657   disk->esdi_defect_list[3] = head;
658   memset(disk->esdi_defect_list+6, 0xff, 5); // end of defect list
659   memset(disk->m_esdi_defect_list, 0, sizeof(disk->m_esdi_defect_list));
660   disk->m_esdi_defect_list[0] = 1; // month
661   disk->m_esdi_defect_list[1] = 1; // day
662   disk->m_esdi_defect_list[2] = 90; // year
663   disk->m_esdi_defect_list[3] = head;
664   memset(disk->m_esdi_defect_list+6, 0xff, 5); // end of defect list
659665}
660666
661667/***************************************************************************
r29304r29305
785791void omti8621_device::do_command(const UINT8 cdb[], const UINT16 cdb_length)
786792{
787793   UINT8 lun = get_lun(cdb);
788   disk_data *disk = our_disks[lun];
794   omti_disk_image_device *disk = our_disks[lun];
789795   int command_duration = 0; // ms
790796
791797   log_command( cdb, cdb_length);
r29304r29305
799805      set_interrupt(CLEAR_LINE);
800806   }
801807
802   if (!disk->image->exists()) {
808   if (!disk->m_image->exists()) {
803809      command_status |= OMTI_COMMAND_STATUS_ERROR; // no such drive
804810   }
805811
806812   switch (cdb[0]) {
807813   case OMTI_CMD_TEST_DRIVE_READY: // 0x00
808      if (!disk->image->exists())
814      if (!disk->m_image->exists())
809815      {
810816         set_sense_data(OMTI_SENSE_CODE_DRIVE_NOT_READY, cdb);
811817      }
r29304r29305
866872
867873   case OMTI_CMD_READ_ESDI_DEFECT_LIST: // 0x37
868874      set_esdi_defect_list(get_lun(cdb), cdb[1] & 0x1f);
869      set_data_transfer(disk->esdi_defect_list, sizeof(disk->esdi_defect_list));
875      set_data_transfer(disk->m_esdi_defect_list, sizeof(disk->m_esdi_defect_list));
870876      break;
871877
872878   case OMTI_CMD_ASSIGN_ALTERNATE_TRACK: // 0x11
r29304r29305
917923
918924   case OMTI_CMD_READ_CONFIGURATION: // 0xEC
919925      set_configuration_data(get_lun(cdb));
920      set_data_transfer(disk->config_data, sizeof(disk->config_data));
926      set_data_transfer(disk->m_config_data, sizeof(disk->m_config_data));
921927      break;
922928
923929   case OMTI_CMD_INVALID_COMMAND: // 0xFF
r29304r29305
11961202
11971203UINT32 omti8621_device::get_sector(INT32 diskaddr, UINT8 *data_buffer, UINT32 length, UINT8 lun)
11981204{
1199   disk_data *disk = our_disks[lun];
1205   omti_disk_image_device *disk = our_disks[lun];
12001206
1201   if (disk->image == NULL || !disk->image->exists())
1207   if (disk->m_image == NULL || !disk->m_image->exists())
12021208   {
12031209      return 0;
12041210   }
r29304r29305
12091215      // restrict length to size of 1 sector (i.e. 1024 Byte)
12101216      length = length < OMTI_DISK_SECTOR_SIZE ? length  : OMTI_DISK_SECTOR_SIZE;
12111217
1212      disk->image->fseek(diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
1213      disk->image->fread(data_buffer, length);
1218      disk->m_image->fseek(diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
1219      disk->m_image->fread(data_buffer, length);
12141220
12151221      return length;
12161222   }
r29304r29305
12821288
12831289
12841290/***************************************************************************
1285 get_safe_disk_token - makes sure that the passed in device is a OMTI disk
1286 ***************************************************************************/
1287
1288INLINE disk_data *get_safe_disk_token(device_t *device) {
1289   assert(device != NULL);
1290   assert(device->type() == OMTI_DISK);
1291   return (disk_data *) downcast<omti_disk_image_device *>(device)->token();
1292}
1293
1294/***************************************************************************
12951291 omti_disk_config - configure disk parameters
12961292 ***************************************************************************/
12971293
1298static void omti_disk_config(disk_data *disk, UINT16 disk_type)
1294void omti_disk_image_device::omti_disk_config(UINT16 disk_type)
12991295{
1300   DLOG1(("omti_disk_config: configuring disk with type %x", disk_type));
1296   LOG1(("omti_disk_config: configuring disk with type %x", disk_type));
13011297
13021298   switch (disk_type)
13031299   {
13041300   case OMTI_DISK_TYPE_348_MB: // Maxtor 380 MB (348-MB FA formatted)
1305      disk->cylinders = 1223;
1306      disk->heads = 15;
1307      disk->sectors = 18;
1301      m_cylinders = 1223;
1302      m_heads = 15;
1303      m_sectors = 18;
13081304      break;
13091305
13101306   case OMTI_DISK_TYPE_155_MB: // Micropolis 170 MB (155-MB formatted)
13111307   default:
1312      disk->cylinders = 1023;
1313      disk->heads = 8;
1314      disk->sectors = 18;
1308      m_cylinders = 1023;
1309      m_heads = 8;
1310      m_sectors = 18;
13151311      break;
13161312   }
13171313
1318   disk->type = disk_type;
1319   disk->sectorbytes = OMTI_DISK_SECTOR_SIZE;
1320   disk->sector_count = disk->cylinders * disk->heads * disk->sectors;
1314   m_type = disk_type;
1315   m_sectorbytes = OMTI_DISK_SECTOR_SIZE;
1316   m_sector_count = m_cylinders * m_heads * m_sectors;
13211317}
13221318
13231319/*-------------------------------------------------
r29304r29305
13261322
13271323void omti_disk_image_device::device_start()
13281324{
1329   disk_data *disk = get_safe_disk_token(this);
1325   m_image = this;
13301326
1331   disk->device = this;
1332   // note: we must have disk->device before we can log
1333
1334   disk->image = this;
1335
1336   if (disk->image->image_core_file() == NULL)
1327   if (m_image->image_core_file() == NULL)
13371328   {
1338      DLOG1(("device_start_omti_disk: no disk"));
1329      LOG1(("device_start_omti_disk: no disk"));
13391330   }
13401331   else
13411332   {
1342      DLOG1(("device_start_omti_disk: with disk image %s",disk->image->basename() ));
1333      LOG1(("device_start_omti_disk: with disk image %s",m_image->basename() ));
13431334   }
13441335
13451336   // default disk type
1346   omti_disk_config(disk, OMTI_DISK_TYPE_DEFAULT);
1337   omti_disk_config(OMTI_DISK_TYPE_DEFAULT);
13471338}
13481339
13491340/*-------------------------------------------------
r29304r29305
13511342-------------------------------------------------*/
13521343
13531344void omti_disk_image_device::device_reset()
1354{
1355   disk_data *disk = get_safe_disk_token(this);
1356   DLOG1(("device_reset_omti_disk"));
1345{   
1346   LOG1(("device_reset_omti_disk"));
13571347
13581348   if (exists() && fseek(0, SEEK_END) == 0)
13591349   {
13601350      UINT32 disk_size = (UINT32)(ftell() / OMTI_DISK_SECTOR_SIZE);
13611351      UINT16 disk_type = disk_size >= 300000 ? OMTI_DISK_TYPE_348_MB : OMTI_DISK_TYPE_155_MB;
1362      if (disk_type != disk->type) {
1363         DLOG1(("device_reset_omti_disk: disk size=%d blocks, disk type=%x", disk_size, disk_type ));
1364         omti_disk_config(disk, disk_type);
1352      if (disk_type != m_type) {
1353         LOG1(("device_reset_omti_disk: disk size=%d blocks, disk type=%x", disk_size, disk_type ));
1354         omti_disk_config(disk_type);
13651355      }
13661356   }
13671357}
r29304r29305
13721362
13731363bool omti_disk_image_device::call_create(int format_type, option_resolution *format_options)
13741364{
1375   disk_data *disk = get_safe_disk_token(this);
1376   DLOG(("device_create_omti_disk: creating OMTI Disk with %d blocks", disk->sector_count));
1365   LOG(("device_create_omti_disk: creating OMTI Disk with %d blocks", m_sector_count));
13771366
13781367   int x;
13791368   unsigned char sectordata[OMTI_DISK_SECTOR_SIZE]; // empty block data
13801369
13811370
13821371   memset(sectordata, 0x55, sizeof(sectordata));
1383   for (x = 0; x < disk->sector_count; x++)
1372   for (x = 0; x < m_sector_count; x++)
13841373   {
13851374      if (fwrite(sectordata, OMTI_DISK_SECTOR_SIZE)
13861375            < OMTI_DISK_SECTOR_SIZE)
shelves/new_menus/src/emu/bus/isa/omti8621.h
r29304r29305
2727 FUNCTION PROTOTYPES
2828 ***************************************************************************/
2929
30struct disk_data
31{
32   device_t *device;
33   UINT16 type;
34   UINT16 cylinders;
35   UINT16 heads;
36   UINT16 sectors;
37   UINT32 sectorbytes;
38   UINT32 sector_count;
39
40   device_image_interface *image;
41
42   // configuration data
43   UINT8 config_data[10];
44
45   // ESDI defect list data
46   UINT8 esdi_defect_list[256];
47};
48
30class omti_disk_image_device;
31 
4932/* ----- device interface ----- */
5033
5134class omti8621_device : public device_t, public device_isa16_card_interface
r29304r29305
8770   void set_interrupt(enum line_state line_state);
8871
8972private:
90   disk_data *our_disks[OMTI_MAX_LUN+1];
73   omti_disk_image_device *our_disks[OMTI_MAX_LUN+1];
9174
9275   UINT16 jumper;
9376
shelves/new_menus/src/emu/bus/wangpc/tig.c
r29304r29305
8989   AM_RANGE(0x4000, 0x7fff) AM_RAM // font memory
9090ADDRESS_MAP_END
9191
92static UPD7220_DRAW_TEXT_LINE( hgdc_display_text)
92UPD7220_DRAW_TEXT_LINE_MEMBER( wangpc_tig_device::hgdc_draw_text )
9393{
9494}
9595
96static UPD7220_INTERFACE( hgdc0_intf )
97{
98   NULL,
99   hgdc_display_text,
100   DEVCB_NULL,
101   DEVCB_NULL,
102   DEVCB_NULL
103};
10496
105
10697//-------------------------------------------------
10798//  UPD7220_INTERFACE( hgdc1_intf )
10899//-------------------------------------------------
r29304r29305
112103   AM_RANGE(0x0000, 0xffff) AM_RAM // graphics memory
113104ADDRESS_MAP_END
114105
115static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
106UPD7220_DISPLAY_PIXELS_MEMBER( wangpc_tig_device::hgdc_display_pixels )
116107{
117108}
118109
119static UPD7220_INTERFACE( hgdc1_intf )
120{
121   hgdc_display_pixels,
122   NULL,
123   DEVCB_NULL,
124   DEVCB_NULL,
125   DEVCB_NULL
126};
127110
128
129111//-------------------------------------------------
130112//  MACHINE_CONFIG_FRAGMENT( wangpc_tig )
131113//-------------------------------------------------
r29304r29305
140122
141123   MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette")
142124
143   MCFG_UPD7220_ADD(UPD7720_0_TAG, XTAL_52_832MHz/28, hgdc0_intf, upd7220_0_map) // was /10?
125   MCFG_DEVICE_ADD(UPD7720_0_TAG, UPD7220, XTAL_52_832MHz/28)
126   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_0_map)
127   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(wangpc_tig_device, hgdc_draw_text)   
144128   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
145   MCFG_UPD7220_ADD(UPD7720_1_TAG, XTAL_52_832MHz/28, hgdc1_intf, upd7220_1_map) // was /16?
129
130   MCFG_DEVICE_ADD(UPD7720_1_TAG, UPD7220, XTAL_52_832MHz/28)
131   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
132   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(wangpc_tig_device, hgdc_display_pixels)   
146133   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
147134MACHINE_CONFIG_END
148135
shelves/new_menus/src/emu/bus/wangpc/tig.h
r29304r29305
3838   virtual machine_config_constructor device_mconfig_additions() const;
3939   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4040
41   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
42   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
43
4144protected:
4245   // device-level overrides
4346   virtual void device_start();
shelves/new_menus/src/emu/bus/nubus/nubus_image.c
r29304r29305
1414
1515#define MESSIMG_DISK_SECTOR_SIZE (512)
1616
17
1718// messimg_disk_image_device
1819
1920class messimg_disk_image_device :   public device_t,
r29304r29305
3839   virtual bool call_load();
3940   virtual void call_unload();
4041
41   disk_data *token() { return &m_token; }
42protected:
42   protected:
4343   // device-level overrides
4444   virtual void device_config_complete();
4545   virtual void device_start();
4646   virtual void device_reset();
47
48   disk_data m_token;
47public:
48   UINT32 m_size;
49   UINT8 *m_data;
50   bool m_ejected;
4951};
5052
53
5154// device type definition
5255extern const device_type MESSIMG_DISK;
5356
r29304r29305
6568};
6669
6770
68/***************************************************************************
69 get_safe_disk_token - makes sure that the passed in device is a messimg disk
70 ***************************************************************************/
71
72INLINE disk_data *get_safe_disk_token(device_t *device) {
73   assert(device != NULL);
74   assert(device->type() == MESSIMG_DISK);
75   return (disk_data *) downcast<messimg_disk_image_device *>(device)->token();
76}
77
7871/*-------------------------------------------------
7972    device start callback
8073-------------------------------------------------*/
8174
8275void messimg_disk_image_device::device_start()
8376{
84   disk_data *disk = get_safe_disk_token(this);
77   m_data = (UINT8 *)NULL;
8578
86   disk->device = this;
87   disk->image = this;
88   disk->data = (UINT8 *)NULL;
89
9079   if (exists() && fseek(0, SEEK_END) == 0)
9180   {
92      disk->size = (UINT32)ftell();
81      m_size = (UINT32)ftell();
9382   }
9483}
9584
9685bool messimg_disk_image_device::call_load()
9786{
98   disk_data *disk = get_safe_disk_token(this);
99
10087   fseek(0, SEEK_END);
101   disk->size = (UINT32)ftell();
102   if (disk->size > (256*1024*1024))
88   m_size = (UINT32)ftell();
89   if (m_size > (256*1024*1024))
10390   {
10491      printf("Mac image too large: must be 256MB or less!\n");
105      disk->size = 0;
92      m_size = 0;
10693      return IMAGE_INIT_FAIL;
10794   }
10895
109   disk->data = (UINT8 *)auto_alloc_array_clear(machine(), UINT32, disk->size/sizeof(UINT32));
96   m_data = (UINT8 *)auto_alloc_array_clear(machine(), UINT32, m_size/sizeof(UINT32));
11097   fseek(0, SEEK_SET);
111   fread(disk->data, disk->size);
112   disk->ejected = false;
98   fread(m_data, m_size);
99   m_ejected = false;
113100
114101   return IMAGE_INIT_PASS;
115102}
116103
117104void messimg_disk_image_device::call_unload()
118105{
119   disk_data *disk = get_safe_disk_token(this);
120
121106   // TODO: track dirty sectors and only write those
122107   fseek(0, SEEK_SET);
123   fwrite(disk->data, disk->size);
124   disk->size = 0;
125   //free(disk->data);
108   fwrite(m_data, m_size);
109   m_size = 0;
110   //free(m_data);
126111}
127112
128113/*-------------------------------------------------
r29304r29305
210195   m_nubus->install_device(slotspace+4, slotspace+7, read32_delegate(FUNC(nubus_image_device::image_status_r), this), write32_delegate(FUNC(nubus_image_device::image_status_w), this));
211196   m_nubus->install_device(superslotspace, superslotspace+((256*1024*1024)-1), read32_delegate(FUNC(nubus_image_device::image_super_r), this), write32_delegate(FUNC(nubus_image_device::image_super_w), this));
212197
213   device_t *device0 = subdevice(IMAGE_DISK0_TAG);
214   m_image = (disk_data *) downcast<messimg_disk_image_device *>(device0)->token();
198   m_image = subdevice<messimg_disk_image_device>(IMAGE_DISK0_TAG);
215199}
216200
217201//-------------------------------------------------
r29304r29305
224208
225209WRITE32_MEMBER( nubus_image_device::image_status_w )
226210{
227   m_image->ejected = true;
211   m_image->m_ejected = true;
228212}
229213
230214READ32_MEMBER( nubus_image_device::image_status_r )
231215{
232   if(m_image->ejected) {
216   if(m_image->m_ejected) {
233217      return 0;
234218   }
235219
236   if(m_image->size) {
220   if(m_image->m_size) {
237221      return 1;
238222   }
239223   return 0;
r29304r29305
245229
246230READ32_MEMBER( nubus_image_device::image_r )
247231{
248   return m_image->size;
232   return m_image->m_size;
249233}
250234
251235WRITE32_MEMBER( nubus_image_device::image_super_w )
252236{
253   UINT32 *image = (UINT32*)m_image->data;
237   UINT32 *image = (UINT32*)m_image->m_data;
254238   data = ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24);
255239   mem_mask = ((mem_mask & 0xff) << 24) | ((mem_mask & 0xff00) << 8) | ((mem_mask & 0xff0000) >> 8) | ((mem_mask & 0xff000000) >> 24);
256240
r29304r29305
259243
260244READ32_MEMBER( nubus_image_device::image_super_r )
261245{
262   UINT32 *image = (UINT32*)m_image->data;
246   UINT32 *image = (UINT32*)m_image->m_data;
263247   UINT32 data = image[offset];
264248   return ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24);
265249}
shelves/new_menus/src/emu/bus/nubus/nubus_image.h
r29304r29305
99//**************************************************************************
1010//  TYPE DEFINITIONS
1111//**************************************************************************
12class messimg_disk_image_device;
1213
13struct disk_data
14{
15   device_t *device;
16   UINT32 size;
17   UINT8 *data;
18   bool ejected;
19
20   device_image_interface *image;
21};
22
2314// ======================> nubus_image_device
2415
2516class nubus_image_device :
r29304r29305
4839      DECLARE_WRITE32_MEMBER(image_super_w);
4940
5041public:
51   disk_data *m_image;
42   messimg_disk_image_device *m_image;
5243};
5344
5445
shelves/new_menus/src/emu/mcfglgcy.h
r29304r29305
1818   config.m_nvram_handler = NVRAM_HANDLER_NAME(_func);
1919#define MCFG_MEMCARD_HANDLER(_func) \
2020   config.m_memcard_handler = MEMCARD_HANDLER_NAME(_func);
21#define MCFG_NVRAM_HANDLER_CLEAR() \
22   config.m_nvram_handler = NULL;
2321
2422#endif  /* __MCFGLGCY_H__ */
shelves/new_menus/src/emu/machine/smpc.c
r29304r29305
164164 *
165165 *******************************************/
166166
167static TIMER_CALLBACK( stv_bankswitch_state )
167TIMER_CALLBACK_MEMBER( saturn_state::stv_bankswitch_state )
168168{
169   saturn_state *state = machine.driver_data<saturn_state>();
170169   static const char *const banknames[] = { "game0", "game1", "game2", "game3" };
171170   UINT8* game_region;
172171
173   if(state->m_prev_bankswitch != param)
172   if(m_prev_bankswitch != param)
174173   {
175      game_region = machine.root_device().memregion(banknames[param])->base();
174      game_region = memregion(banknames[param])->base();
176175
177176      if (game_region)
178         memcpy(machine.root_device().memregion("abus")->base(), game_region, 0x3000000);
177         memcpy(memregion("abus")->base(), game_region, 0x3000000);
179178      else
180         memset(machine.root_device().memregion("abus")->base(), 0x00, 0x3000000);
179         memset(memregion("abus")->base(), 0x00, 0x3000000);
181180
182      state->m_prev_bankswitch = param;
181      m_prev_bankswitch = param;
183182   }
184183}
185184
186static void stv_select_game(running_machine &machine, int gameno)
185void saturn_state::stv_select_game(int gameno)
187186{
188   machine.scheduler().timer_set(attotime::zero, FUNC(stv_bankswitch_state), gameno);
187   machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(saturn_state::stv_bankswitch_state),this), gameno);
189188}
190189
191190/********************************************
r29304r29305
194193 *
195194 *******************************************/
196195
197static void smpc_master_on(running_machine &machine)
196void saturn_state::smpc_master_on()
198197{
199   saturn_state *state = machine.driver_data<saturn_state>();
200
201   state->m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
198   m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
202199}
203200
204static TIMER_CALLBACK( smpc_slave_enable )
201TIMER_CALLBACK_MEMBER( saturn_state::smpc_slave_enable )
205202{
206   saturn_state *state = machine.driver_data<saturn_state>();
207
208   state->m_slave->set_input_line(INPUT_LINE_RESET, param ? ASSERT_LINE : CLEAR_LINE);
209   state->m_smpc.OREG[31] = param + 0x02; //read-back for last command issued
210   state->m_smpc.SF = 0x00; //clear hand-shake flag
211   state->m_smpc.slave_on = param;
212//  printf("%d %d\n",machine.first_screen()->hpos(),machine.first_screen()->vpos());
203   m_slave->set_input_line(INPUT_LINE_RESET, param ? ASSERT_LINE : CLEAR_LINE);
204   m_smpc.OREG[31] = param + 0x02; //read-back for last command issued
205   m_smpc.SF = 0x00; //clear hand-shake flag
206   m_smpc.slave_on = param;
207//  printf("%d %d\n",machine().first_screen()->hpos(),machine().first_screen()->vpos());
213208}
214209
215static TIMER_CALLBACK( smpc_sound_enable )
210TIMER_CALLBACK_MEMBER( saturn_state::smpc_sound_enable )
216211{
217   saturn_state *state = machine.driver_data<saturn_state>();
218
219   state->m_audiocpu->set_input_line(INPUT_LINE_RESET, param ? ASSERT_LINE : CLEAR_LINE);
220   state->m_en_68k = param ^ 1;
221   state->m_smpc.OREG[31] = param + 0x06; //read-back for last command issued
222   state->m_smpc.SF = 0x00; //clear hand-shake flag
212   m_audiocpu->set_input_line(INPUT_LINE_RESET, param ? ASSERT_LINE : CLEAR_LINE);
213   m_en_68k = param ^ 1;
214   m_smpc.OREG[31] = param + 0x06; //read-back for last command issued
215   m_smpc.SF = 0x00; //clear hand-shake flag
223216}
224217
225static TIMER_CALLBACK( smpc_cd_enable )
218TIMER_CALLBACK_MEMBER( saturn_state::smpc_cd_enable )
226219{
227   saturn_state *state = machine.driver_data<saturn_state>();
228
229   state->m_smpc.OREG[31] = param + 0x08; //read-back for last command issued
230   state->m_smpc.SF = 0x08; //clear hand-shake flag (TODO: diagnostic wants this to have bit 3 high)
220   m_smpc.OREG[31] = param + 0x08; //read-back for last command issued
221   m_smpc.SF = 0x08; //clear hand-shake flag (TODO: diagnostic wants this to have bit 3 high)
231222}
232223
233static void smpc_system_reset(running_machine &machine)
224void saturn_state::smpc_system_reset()
234225{
235   saturn_state *state = machine.driver_data<saturn_state>();
236
237226   /*Only backup ram and SMPC ram are retained after that this command is issued.*/
238   memset(state->m_scu_regs ,0x00,0x000100);
239   memset(state->m_scsp_regs,0x00,0x001000);
240   memset(state->m_sound_ram,0x00,0x080000);
241   memset(state->m_workram_h,0x00,0x100000);
242   memset(state->m_workram_l,0x00,0x100000);
243   memset(state->m_vdp2_regs,0x00,0x040000);
244   memset(state->m_vdp2_vram,0x00,0x100000);
245   memset(state->m_vdp2_cram,0x00,0x080000);
246   memset(state->m_vdp1_vram,0x00,0x100000);
227   memset(m_scu_regs ,0x00,0x000100);
228   memset(m_scsp_regs,0x00,0x001000);
229   memset(m_sound_ram,0x00,0x080000);
230   memset(m_workram_h,0x00,0x100000);
231   memset(m_workram_l,0x00,0x100000);
232   memset(m_vdp2_regs,0x00,0x040000);
233   memset(m_vdp2_vram,0x00,0x100000);
234   memset(m_vdp2_cram,0x00,0x080000);
235   memset(m_vdp1_vram,0x00,0x100000);
247236   //A-Bus
248237
249   state->m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
238   m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
250239}
251240
252static TIMER_CALLBACK( smpc_change_clock )
241TIMER_CALLBACK_MEMBER( saturn_state::smpc_change_clock )
253242{
254   saturn_state *state = machine.driver_data<saturn_state>();
255243   UINT32 xtal;
256244
257   if(LOG_SMPC) printf ("Clock change execute at (%d %d)\n",machine.first_screen()->hpos(),machine.first_screen()->vpos());
245   if(LOG_SMPC) printf ("Clock change execute at (%d %d)\n",machine().first_screen()->hpos(),machine().first_screen()->vpos());
258246
259247   xtal = param ? MASTER_CLOCK_320 : MASTER_CLOCK_352;
260248
261   machine.device("maincpu")->set_unscaled_clock(xtal/2);
262   machine.device("slave")->set_unscaled_clock(xtal/2);
249   machine().device("maincpu")->set_unscaled_clock(xtal/2);
250   machine().device("slave")->set_unscaled_clock(xtal/2);
263251
264   state->m_vdp2.dotsel = param ^ 1;
265   state->stv_vdp2_dynamic_res_change();
252   m_vdp2.dotsel = param ^ 1;
253   stv_vdp2_dynamic_res_change();
266254
267   state->m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
268   if(!state->m_NMI_reset)
269      state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
270   state->m_slave->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
271   state->m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
272   state->m_audiocpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
255   m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
256   if(!m_NMI_reset)
257      m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
258   m_slave->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
259   m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
260   m_audiocpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
273261
274262   /* put issued command in OREG31 */
275   state->m_smpc.OREG[31] = 0x0e + param;
263   m_smpc.OREG[31] = 0x0e + param;
276264   /* clear hand-shake flag */
277   state->m_smpc.SF = 0x00;
265   m_smpc.SF = 0x00;
278266
279267   /* TODO: VDP1 / VDP2 / SCU / SCSP default power ON values? */
280268}
281269
282static TIMER_CALLBACK( stv_intback_peripheral )
270TIMER_CALLBACK_MEMBER( saturn_state::stv_intback_peripheral )
283271{
284   saturn_state *state = machine.driver_data<saturn_state>();
285
286   if (state->m_smpc.intback_stage == 2)
272   if (m_smpc.intback_stage == 2)
287273   {
288      state->m_smpc.SR = (0x80 | state->m_smpc.pmode);    // pad 2, no more data, echo back pad mode set by intback
289      state->m_smpc.intback_stage = 0;
274      m_smpc.SR = (0x80 | m_smpc.pmode);    // pad 2, no more data, echo back pad mode set by intback
275      m_smpc.intback_stage = 0;
290276   }
291277   else
292278   {
293      state->m_smpc.SR = (0xc0 | state->m_smpc.pmode);    // pad 1, more data, echo back pad mode set by intback
294      state->m_smpc.intback_stage ++;
279      m_smpc.SR = (0xc0 | m_smpc.pmode);    // pad 1, more data, echo back pad mode set by intback
280      m_smpc.intback_stage ++;
295281   }
296282
297   if(!(state->m_scu.ism & IRQ_SMPC))
298      state->m_maincpu->set_input_line_and_vector(8, HOLD_LINE, 0x47);
283   if(!(m_scu.ism & IRQ_SMPC))
284      m_maincpu->set_input_line_and_vector(8, HOLD_LINE, 0x47);
299285   else
300      state->m_scu.ist |= (IRQ_SMPC);
286      m_scu.ist |= (IRQ_SMPC);
301287
302   state->m_smpc.OREG[31] = 0x10; /* callback for last command issued */
303   state->m_smpc.SF = 0x00;    /* clear hand-shake flag */
288   m_smpc.OREG[31] = 0x10; /* callback for last command issued */
289   m_smpc.SF = 0x00;    /* clear hand-shake flag */
304290}
305291
306292
307static TIMER_CALLBACK( stv_smpc_intback )
293TIMER_CALLBACK_MEMBER( saturn_state::stv_smpc_intback )
308294{
309   saturn_state *state = machine.driver_data<saturn_state>();
310295   int i;
311296
312//  printf("%02x %02x %02x\n",state->m_smpc.intback_buf[0],state->m_smpc.intback_buf[1],state->m_smpc.intback_buf[2]);
297//  printf("%02x %02x %02x\n",m_smpc.intback_buf[0],m_smpc.intback_buf[1],m_smpc.intback_buf[2]);
313298
314   if(state->m_smpc.intback_buf[0] != 0)
299   if(m_smpc.intback_buf[0] != 0)
315300   {
316      state->m_smpc.OREG[0] = (0x80) | ((state->m_NMI_reset & 1) << 6);
301      m_smpc.OREG[0] = (0x80) | ((m_NMI_reset & 1) << 6);
317302
318303      for(i=0;i<7;i++)
319         state->m_smpc.OREG[1+i] = state->m_smpc.rtc_data[i];
304         m_smpc.OREG[1+i] = m_smpc.rtc_data[i];
320305
321      state->m_smpc.OREG[8]=0x00;  // CTG0 / CTG1?
306      m_smpc.OREG[8]=0x00;  // CTG0 / CTG1?
322307
323      state->m_smpc.OREG[9]=0x00;  // TODO: system region on Saturn
308      m_smpc.OREG[9]=0x00;  // TODO: system region on Saturn
324309
325      state->m_smpc.OREG[10]= 0 << 7 |
326                        state->m_vdp2.dotsel << 6 |
310      m_smpc.OREG[10]= 0 << 7 |
311                        m_vdp2.dotsel << 6 |
327312                        1 << 5 |
328313                        1 << 4 |
329314                        0 << 3 | //MSHNMI
330315                        1 << 2 |
331316                        0 << 1 | //SYSRES
332317                        0 << 0;  //SOUNDRES
333      state->m_smpc.OREG[11]= 0 << 6; //CDRES
318      m_smpc.OREG[11]= 0 << 6; //CDRES
334319
335320      for(i=0;i<4;i++)
336         state->m_smpc.OREG[12+i]=state->m_smpc.SMEM[i];
321         m_smpc.OREG[12+i]=m_smpc.SMEM[i];
337322
338323      for(i=0;i<15;i++)
339         state->m_smpc.OREG[16+i]=0xff; // undefined
324         m_smpc.OREG[16+i]=0xff; // undefined
340325
341      state->m_smpc.intback_stage = (state->m_smpc.intback_buf[1] & 8) >> 3; // first peripheral
342      state->m_smpc.SR = 0x40 | state->m_smpc.intback_stage << 5;
343      state->m_smpc.pmode = state->m_smpc.intback_buf[0]>>4;
326      m_smpc.intback_stage = (m_smpc.intback_buf[1] & 8) >> 3; // first peripheral
327      m_smpc.SR = 0x40 | m_smpc.intback_stage << 5;
328      m_smpc.pmode = m_smpc.intback_buf[0]>>4;
344329
345330      //  /*This is for RTC,cartridge code and similar stuff...*/
346331      //if(LOG_SMPC) printf ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline);
347      if(!(state->m_scu.ism & IRQ_SMPC))
348         state->m_maincpu->set_input_line_and_vector(8, HOLD_LINE, 0x47);
332      if(!(m_scu.ism & IRQ_SMPC))
333         m_maincpu->set_input_line_and_vector(8, HOLD_LINE, 0x47);
349334      else
350         state->m_scu.ist |= (IRQ_SMPC);
335         m_scu.ist |= (IRQ_SMPC);
351336
352337      /* put issued command in OREG31 */
353      state->m_smpc.OREG[31] = 0x10; // TODO: doc says 0?
338      m_smpc.OREG[31] = 0x10; // TODO: doc says 0?
354339      /* clear hand-shake flag */
355      state->m_smpc.SF = 0x00;
340      m_smpc.SF = 0x00;
356341   }
357   else if(state->m_smpc.intback_buf[1] & 8)
342   else if(m_smpc.intback_buf[1] & 8)
358343   {
359      state->m_smpc.intback_stage = (state->m_smpc.intback_buf[1] & 8) >> 3; // first peripheral
360      state->m_smpc.SR = 0x40;
361      state->m_smpc.OREG[31] = 0x10;
362      machine.scheduler().timer_set(attotime::from_usec(0), FUNC(stv_intback_peripheral),0);
344      m_smpc.intback_stage = (m_smpc.intback_buf[1] & 8) >> 3; // first peripheral
345      m_smpc.SR = 0x40;
346      m_smpc.OREG[31] = 0x10;
347      machine().scheduler().timer_set(attotime::from_usec(0), timer_expired_delegate(FUNC(saturn_state::stv_intback_peripheral),this),0);
363348   }
364349   else
365350   {
366351      /* Shienryu calls this, it would be plainly illegal on Saturn, I'll just return the command and clear the hs flag for now. */
367      state->m_smpc.OREG[31] = 0x10;
368      state->m_smpc.SF = 0x00;
352      m_smpc.OREG[31] = 0x10;
353      m_smpc.SF = 0x00;
369354   }
370355}
371356
r29304r29305
383368        0x34 keyboard
384369*/
385370
386static void smpc_digital_pad(running_machine &machine, UINT8 pad_num, UINT8 offset)
371void saturn_state::smpc_digital_pad(UINT8 pad_num, UINT8 offset)
387372{
388   saturn_state *state = machine.driver_data<saturn_state>();
389373   static const char *const padnames[] = { "JOY1", "JOY2" };
390374   UINT16 pad_data;
391375
392   pad_data = machine.root_device().ioport(padnames[pad_num])->read();
393   state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
394   state->m_smpc.OREG[1+pad_num*offset] = 0x02;
395   state->m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
396   state->m_smpc.OREG[3+pad_num*offset] = pad_data & 0xff;
376   pad_data = ioport(padnames[pad_num])->read();
377   m_smpc.OREG[0+pad_num*offset] = 0xf1;
378   m_smpc.OREG[1+pad_num*offset] = 0x02;
379   m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
380   m_smpc.OREG[3+pad_num*offset] = pad_data & 0xff;
397381}
398382
399static void smpc_analog_pad(running_machine &machine, UINT8 pad_num, UINT8 offset, UINT8 id)
383void saturn_state::smpc_analog_pad( UINT8 pad_num, UINT8 offset, UINT8 id)
400384{
401   saturn_state *state = machine.driver_data<saturn_state>();
402385   static const char *const padnames[] = { "AN_JOY1", "AN_JOY2" };
403386   static const char *const annames[2][3] = { { "AN_X1", "AN_Y1", "AN_Z1" },
404387                                    { "AN_X2", "AN_Y2", "AN_Z2" }};
405388   UINT16 pad_data;
406389
407   pad_data = machine.root_device().ioport(padnames[pad_num])->read();
408   state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
409   state->m_smpc.OREG[1+pad_num*offset] = id;
410   state->m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
411   state->m_smpc.OREG[3+pad_num*offset] = pad_data & 0xff;
412   state->m_smpc.OREG[4+pad_num*offset] = machine.root_device().ioport(annames[pad_num][0])->read();
390   pad_data = ioport(padnames[pad_num])->read();
391   m_smpc.OREG[0+pad_num*offset] = 0xf1;
392   m_smpc.OREG[1+pad_num*offset] = id;
393   m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
394   m_smpc.OREG[3+pad_num*offset] = pad_data & 0xff;
395   m_smpc.OREG[4+pad_num*offset] = ioport(annames[pad_num][0])->read();
413396   if(id == 0x15)
414397   {
415      state->m_smpc.OREG[5+pad_num*offset] = machine.root_device().ioport(annames[pad_num][1])->read();
416      state->m_smpc.OREG[6+pad_num*offset] = machine.root_device().ioport(annames[pad_num][2])->read();
398      m_smpc.OREG[5+pad_num*offset] = ioport(annames[pad_num][1])->read();
399      m_smpc.OREG[6+pad_num*offset] = ioport(annames[pad_num][2])->read();
417400   }
418401}
419402
420static void smpc_keyboard(running_machine &machine, UINT8 pad_num, UINT8 offset)
403void saturn_state::smpc_keyboard(UINT8 pad_num, UINT8 offset)
421404{
422   saturn_state *state = machine.driver_data<saturn_state>();
423405   UINT16 game_key;
424406
425407   game_key = 0xffff;
426408
427   game_key ^= ((state->ioport("KEYS_1")->read() & 0x80) << 8); // right
428   game_key ^= ((state->ioport("KEYS_1")->read() & 0x40) << 8); // left
429   game_key ^= ((state->ioport("KEYS_1")->read() & 0x20) << 8); // down
430   game_key ^= ((state->ioport("KEYS_1")->read() & 0x10) << 8); // up
431   game_key ^= ((state->ioport("KEYF")->read() & 0x80) << 4); // ESC -> START
432   game_key ^= ((state->ioport("KEY3")->read() & 0x04) << 8); // Z / A trigger
433   game_key ^= ((state->ioport("KEY4")->read() & 0x02) << 8); // C / C trigger
434   game_key ^= ((state->ioport("KEY6")->read() & 0x04) << 6); // X / B trigger
435   game_key ^= ((state->ioport("KEY2")->read() & 0x20) << 2); // Q / R trigger
436   game_key ^= ((state->ioport("KEY3")->read() & 0x10) << 2); // A / X trigger
437   game_key ^= ((state->ioport("KEY3")->read() & 0x08) << 2); // S / Y trigger
438   game_key ^= ((state->ioport("KEY4")->read() & 0x08) << 1); // D / Z trigger
439   game_key ^= ((state->ioport("KEY4")->read() & 0x10) >> 1); // E / L trigger
409   game_key ^= ((ioport("KEYS_1")->read() & 0x80) << 8); // right
410   game_key ^= ((ioport("KEYS_1")->read() & 0x40) << 8); // left
411   game_key ^= ((ioport("KEYS_1")->read() & 0x20) << 8); // down
412   game_key ^= ((ioport("KEYS_1")->read() & 0x10) << 8); // up
413   game_key ^= ((ioport("KEYF")->read() & 0x80) << 4); // ESC -> START
414   game_key ^= ((ioport("KEY3")->read() & 0x04) << 8); // Z / A trigger
415   game_key ^= ((ioport("KEY4")->read() & 0x02) << 8); // C / C trigger
416   game_key ^= ((ioport("KEY6")->read() & 0x04) << 6); // X / B trigger
417   game_key ^= ((ioport("KEY2")->read() & 0x20) << 2); // Q / R trigger
418   game_key ^= ((ioport("KEY3")->read() & 0x10) << 2); // A / X trigger
419   game_key ^= ((ioport("KEY3")->read() & 0x08) << 2); // S / Y trigger
420   game_key ^= ((ioport("KEY4")->read() & 0x08) << 1); // D / Z trigger
421   game_key ^= ((ioport("KEY4")->read() & 0x10) >> 1); // E / L trigger
440422
441   state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
442   state->m_smpc.OREG[1+pad_num*offset] = 0x34;
443   state->m_smpc.OREG[2+pad_num*offset] = game_key>>8; // game buttons, TODO
444   state->m_smpc.OREG[3+pad_num*offset] = game_key & 0xff;
423   m_smpc.OREG[0+pad_num*offset] = 0xf1;
424   m_smpc.OREG[1+pad_num*offset] = 0x34;
425   m_smpc.OREG[2+pad_num*offset] = game_key>>8; // game buttons, TODO
426   m_smpc.OREG[3+pad_num*offset] = game_key & 0xff;
445427   /*
446428       x--- ---- 0
447429       -x-- ---- caps lock
r29304r29305
452434       ---- --x- 1
453435       ---- ---x Break key
454436   */
455   state->m_smpc.OREG[4+pad_num*offset] = state->m_keyb.status | 6;
456   state->m_smpc.OREG[5+pad_num*offset] = state->m_keyb.data;
437   m_smpc.OREG[4+pad_num*offset] = m_keyb.status | 6;
438   m_smpc.OREG[5+pad_num*offset] = m_keyb.data;
457439}
458440
459static void smpc_mouse(running_machine &machine, UINT8 pad_num, UINT8 offset, UINT8 id)
441void saturn_state::smpc_mouse(UINT8 pad_num, UINT8 offset, UINT8 id)
460442{
461   saturn_state *state = machine.driver_data<saturn_state>();
462443   static const char *const mousenames[2][3] = { { "MOUSEB1", "MOUSEX1", "MOUSEY1" },
463444                                       { "MOUSEB2", "MOUSEX2", "MOUSEY2" }};
464445   UINT8 mouse_ctrl;
465446   INT16 mouse_x, mouse_y;
466447
467   mouse_ctrl = machine.root_device().ioport(mousenames[pad_num][0])->read();
468   mouse_x = machine.root_device().ioport(mousenames[pad_num][1])->read();
469   mouse_y = machine.root_device().ioport(mousenames[pad_num][2])->read();
448   mouse_ctrl = ioport(mousenames[pad_num][0])->read();
449   mouse_x = ioport(mousenames[pad_num][1])->read();
450   mouse_y = ioport(mousenames[pad_num][2])->read();
470451
471452   if(mouse_x < 0)
472453      mouse_ctrl |= 0x10;
r29304r29305
480461   if((mouse_y & 0xff00) != 0xff00 && (mouse_y & 0xff00) != 0x0000)
481462      mouse_ctrl |= 0x80;
482463
483   state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
484   state->m_smpc.OREG[1+pad_num*offset] = id; // 0x23 / 0xe3
485   state->m_smpc.OREG[2+pad_num*offset] = mouse_ctrl;
486   state->m_smpc.OREG[3+pad_num*offset] = mouse_x & 0xff;
487   state->m_smpc.OREG[4+pad_num*offset] = mouse_y & 0xff;
464   m_smpc.OREG[0+pad_num*offset] = 0xf1;
465   m_smpc.OREG[1+pad_num*offset] = id; // 0x23 / 0xe3
466   m_smpc.OREG[2+pad_num*offset] = mouse_ctrl;
467   m_smpc.OREG[3+pad_num*offset] = mouse_x & 0xff;
468   m_smpc.OREG[4+pad_num*offset] = mouse_y & 0xff;
488469}
489470
490471/* TODO: is there ANY game on which the MD pad works? */
491static void smpc_md_pad(running_machine &machine, UINT8 pad_num, UINT8 offset, UINT8 id)
472void saturn_state::smpc_md_pad(UINT8 pad_num, UINT8 offset, UINT8 id)
492473{
493   saturn_state *state = machine.driver_data<saturn_state>();
494474   static const char *const padnames[] = { "MD_JOY1", "MD_JOY2" };
495475   UINT16 pad_data;
496476
497   pad_data = machine.root_device().ioport(padnames[pad_num])->read();
498   state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
499   state->m_smpc.OREG[1+pad_num*offset] = id;
500   state->m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
477   pad_data = ioport(padnames[pad_num])->read();
478   m_smpc.OREG[0+pad_num*offset] = 0xf1;
479   m_smpc.OREG[1+pad_num*offset] = id;
480   m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
501481   if(id == 0xe2) // MD 6 Button PAD
502      state->m_smpc.OREG[3+pad_num*offset] = pad_data & 0xff;
482      m_smpc.OREG[3+pad_num*offset] = pad_data & 0xff;
503483}
504484
505static void smpc_unconnected(running_machine &machine, UINT8 pad_num, UINT8 offset)
485void saturn_state::smpc_unconnected(UINT8 pad_num, UINT8 offset)
506486{
507   saturn_state *state = machine.driver_data<saturn_state>();
508
509   state->m_smpc.OREG[0+pad_num*offset] = 0xf0;
487   m_smpc.OREG[0+pad_num*offset] = 0xf0;
510488}
511489
512static TIMER_CALLBACK( intback_peripheral )
490TIMER_CALLBACK_MEMBER( saturn_state::intback_peripheral )
513491{
514   saturn_state *state = machine.driver_data<saturn_state>();
515492   int pad_num;
516493   static const UINT8 peri_id[10] = { 0x02, 0x13, 0x15, 0x23, 0x23, 0x34, 0xe1, 0xe2, 0xe3, 0xff };
517494   UINT8 read_id[2];
r29304r29305
519496
520497//  if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2);
521498
522   read_id[0] = (machine.root_device().ioport("INPUT_TYPE")->read()) & 0x0f;
523   read_id[1] = (machine.root_device().ioport("INPUT_TYPE")->read()) >> 4;
499   read_id[0] = (ioport("INPUT_TYPE")->read()) & 0x0f;
500   read_id[1] = (ioport("INPUT_TYPE")->read()) >> 4;
524501
525502   /* doesn't work? */
526   //pad_num = state->m_smpc.intback_stage - 1;
503   //pad_num = m_smpc.intback_stage - 1;
527504
528   if(LOG_PAD_CMD) printf("%d %d %d\n",state->m_smpc.intback_stage - 1,machine.first_screen()->vpos(),(int)machine.first_screen()->frame_number());
505   if(LOG_PAD_CMD) printf("%d %d %d\n",m_smpc.intback_stage - 1,machine().first_screen()->vpos(),(int)machine().first_screen()->frame_number());
529506
530507   offset = 0;
531508
r29304r29305
533510   {
534511      switch(read_id[pad_num])
535512      {
536         case 0: smpc_digital_pad(machine,pad_num,offset); break;
537         case 1: smpc_analog_pad(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* Steering Wheel */
538         case 2: smpc_analog_pad(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* Analog Pad */
539         case 4: smpc_mouse(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* Pointing Device */
540         case 5: smpc_keyboard(machine,pad_num,offset); break;
541         case 6: smpc_md_pad(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* MD 3B PAD */
542         case 7: smpc_md_pad(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* MD 6B PAD */
543         case 8: smpc_mouse(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* Saturn Mouse */
544         case 9: smpc_unconnected(machine,pad_num,offset); break;
513         case 0: smpc_digital_pad(pad_num,offset); break;
514         case 1: smpc_analog_pad(pad_num,offset,peri_id[read_id[pad_num]]); break; /* Steering Wheel */
515         case 2: smpc_analog_pad(pad_num,offset,peri_id[read_id[pad_num]]); break; /* Analog Pad */
516         case 4: smpc_mouse(pad_num,offset,peri_id[read_id[pad_num]]); break; /* Pointing Device */
517         case 5: smpc_keyboard(pad_num,offset); break;
518         case 6: smpc_md_pad(pad_num,offset,peri_id[read_id[pad_num]]); break; /* MD 3B PAD */
519         case 7: smpc_md_pad(pad_num,offset,peri_id[read_id[pad_num]]); break; /* MD 6B PAD */
520         case 8: smpc_mouse(pad_num,offset,peri_id[read_id[pad_num]]); break; /* Saturn Mouse */
521         case 9: smpc_unconnected(pad_num,offset); break;
545522      }
546523
547524      offset += (peri_id[read_id[pad_num]] & 0xf) + 2; /* offset for port 2 */
548525   }
549526
550   if (state->m_smpc.intback_stage == 2)
527   if (m_smpc.intback_stage == 2)
551528   {
552      state->m_smpc.SR = (0x80 | state->m_smpc.pmode);    // pad 2, no more data, echo back pad mode set by intback
553      state->m_smpc.intback_stage = 0;
529      m_smpc.SR = (0x80 | m_smpc.pmode);    // pad 2, no more data, echo back pad mode set by intback
530      m_smpc.intback_stage = 0;
554531   }
555532   else
556533   {
557      state->m_smpc.SR = (0xc0 | state->m_smpc.pmode);    // pad 1, more data, echo back pad mode set by intback
558      state->m_smpc.intback_stage ++;
534      m_smpc.SR = (0xc0 | m_smpc.pmode);    // pad 1, more data, echo back pad mode set by intback
535      m_smpc.intback_stage ++;
559536   }
560537
561   if(!(state->m_scu.ism & IRQ_SMPC))
562      state->m_maincpu->set_input_line_and_vector(8, HOLD_LINE, 0x47);
538   if(!(m_scu.ism & IRQ_SMPC))
539      m_maincpu->set_input_line_and_vector(8, HOLD_LINE, 0x47);
563540   else
564      state->m_scu.ist |= (IRQ_SMPC);
541      m_scu.ist |= (IRQ_SMPC);
565542
566   state->m_smpc.OREG[31] = 0x10; /* callback for last command issued */
567   state->m_smpc.SF = 0x00;    /* clear hand-shake flag */
543   m_smpc.OREG[31] = 0x10; /* callback for last command issued */
544   m_smpc.SF = 0x00;    /* clear hand-shake flag */
568545}
569546
570static TIMER_CALLBACK( saturn_smpc_intback )
547TIMER_CALLBACK_MEMBER( saturn_state::saturn_smpc_intback )
571548{
572   saturn_state *state = machine.driver_data<saturn_state>();
573
574   if(state->m_smpc.intback_buf[0] != 0)
549   if(m_smpc.intback_buf[0] != 0)
575550   {
576551      {
577552         int i;
578553
579         state->m_smpc.OREG[0] = (0x80) | ((state->m_NMI_reset & 1) << 6); // bit 7: SETTIME (RTC isn't setted up properly)
554         m_smpc.OREG[0] = (0x80) | ((m_NMI_reset & 1) << 6); // bit 7: SETTIME (RTC isn't setted up properly)
580555
581556         for(i=0;i<7;i++)
582            state->m_smpc.OREG[1+i] = state->m_smpc.rtc_data[i];
557            m_smpc.OREG[1+i] = m_smpc.rtc_data[i];
583558
584         state->m_smpc.OREG[8]=0x00;  //Cartridge code?
559         m_smpc.OREG[8]=0x00;  //Cartridge code?
585560
586         state->m_smpc.OREG[9] = state->m_saturn_region;
561         m_smpc.OREG[9] = m_saturn_region;
587562
588         state->m_smpc.OREG[10]= 0 << 7 |
589                              state->m_vdp2.dotsel << 6 |
563         m_smpc.OREG[10]= 0 << 7 |
564                              m_vdp2.dotsel << 6 |
590565                              1 << 5 |
591566                              1 << 4 |
592567                              0 << 3 | //MSHNMI
593568                              1 << 2 |
594569                              0 << 1 | //SYSRES
595570                              0 << 0;  //SOUNDRES
596         state->m_smpc.OREG[11]= 0 << 6; //CDRES
571         m_smpc.OREG[11]= 0 << 6; //CDRES
597572
598573         for(i=0;i<4;i++)
599            state->m_smpc.OREG[12+i]=state->m_smpc.SMEM[i];
574            m_smpc.OREG[12+i]=m_smpc.SMEM[i];
600575
601576         for(i=0;i<15;i++)
602            state->m_smpc.OREG[16+i]=0xff; // undefined
577            m_smpc.OREG[16+i]=0xff; // undefined
603578      }
604579
605      state->m_smpc.intback_stage = (state->m_smpc.intback_buf[1] & 8) >> 3; // first peripheral
606      state->m_smpc.SR = 0x40 | state->m_smpc.intback_stage << 5;
607      state->m_smpc.pmode = state->m_smpc.intback_buf[0]>>4;
580      m_smpc.intback_stage = (m_smpc.intback_buf[1] & 8) >> 3; // first peripheral
581      m_smpc.SR = 0x40 | m_smpc.intback_stage << 5;
582      m_smpc.pmode = m_smpc.intback_buf[0]>>4;
608583
609      if(!(state->m_scu.ism & IRQ_SMPC))
610         state->m_maincpu->set_input_line_and_vector(8, HOLD_LINE, 0x47);
584      if(!(m_scu.ism & IRQ_SMPC))
585         m_maincpu->set_input_line_and_vector(8, HOLD_LINE, 0x47);
611586      else
612         state->m_scu.ist |= (IRQ_SMPC);
587         m_scu.ist |= (IRQ_SMPC);
613588
614589      /* put issued command in OREG31 */
615      state->m_smpc.OREG[31] = 0x10;
590      m_smpc.OREG[31] = 0x10;
616591      /* clear hand-shake flag */
617      state->m_smpc.SF = 0x00;
592      m_smpc.SF = 0x00;
618593   }
619   else if(state->m_smpc.intback_buf[1] & 8)
594   else if(m_smpc.intback_buf[1] & 8)
620595   {
621      state->m_smpc.intback_stage = (state->m_smpc.intback_buf[1] & 8) >> 3; // first peripheral
622      state->m_smpc.SR = 0x40;
623      state->m_smpc.OREG[31] = 0x10;
624      machine.scheduler().timer_set(attotime::from_usec(0), FUNC(intback_peripheral),0);
596      m_smpc.intback_stage = (m_smpc.intback_buf[1] & 8) >> 3; // first peripheral
597      m_smpc.SR = 0x40;
598      m_smpc.OREG[31] = 0x10;
599      machine().scheduler().timer_set(attotime::from_usec(0), timer_expired_delegate(FUNC(saturn_state::intback_peripheral),this),0);
625600   }
626601   else
627602   {
628      printf("SMPC intback bogus behaviour called %02x %02x\n",state->m_smpc.IREG[0],state->m_smpc.IREG[1]);
603      printf("SMPC intback bogus behaviour called %02x %02x\n",m_smpc.IREG[0],m_smpc.IREG[1]);
629604   }
630605
631606}
632607
633static void smpc_rtc_write(running_machine &machine)
608void saturn_state::smpc_rtc_write()
634609{
635   saturn_state *state = machine.driver_data<saturn_state>();
636610   int i;
637611
638612   for(i=0;i<7;i++)
639      state->m_smpc.rtc_data[i] = state->m_smpc.IREG[i];
613      m_smpc.rtc_data[i] = m_smpc.IREG[i];
640614}
641615
642static void smpc_memory_setting(running_machine &machine)
616void saturn_state::smpc_memory_setting()
643617{
644   saturn_state *state = machine.driver_data<saturn_state>();
645618   int i;
646619
647620   for(i=0;i<4;i++)
648      state->m_smpc.SMEM[i] = state->m_smpc.IREG[i];
621      m_smpc.SMEM[i] = m_smpc.IREG[i];
649622}
650623
651static void smpc_nmi_req(running_machine &machine)
624void saturn_state::smpc_nmi_req()
652625{
653   saturn_state *state = machine.driver_data<saturn_state>();
654
655626   /*NMI is unconditionally requested */
656   state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
627   m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
657628}
658629
659static TIMER_CALLBACK( smpc_nmi_set )
630TIMER_CALLBACK_MEMBER( saturn_state::smpc_nmi_set )
660631{
661   saturn_state *state = machine.driver_data<saturn_state>();
632//  printf("%d %d\n",machine().first_screen()->hpos(),machine().first_screen()->vpos());
662633
663//  printf("%d %d\n",machine.first_screen()->hpos(),machine.first_screen()->vpos());
664   state->m_NMI_reset = param;
634   m_NMI_reset = param;
665635   /* put issued command in OREG31 */
666   state->m_smpc.OREG[31] = 0x19 + param;
636   m_smpc.OREG[31] = 0x19 + param;
667637   /* clear hand-shake flag */
668   state->m_smpc.SF = 0x00;
638   m_smpc.SF = 0x00;
669639
670   //state->m_smpc.OREG[0] = (0x80) | ((state->m_NMI_reset & 1) << 6);
640   //m_smpc.OREG[0] = (0x80) | ((m_NMI_reset & 1) << 6);
671641}
672642
673643
r29304r29305
682652 *
683653 *******************************************/
684654
685static void smpc_comreg_exec(address_space &space, UINT8 data, UINT8 is_stv)
655void saturn_state::smpc_comreg_exec(address_space &space, UINT8 data, UINT8 is_stv)
686656{
687   saturn_state *state = space.machine().driver_data<saturn_state>();
688
689657   switch (data)
690658   {
691659      case 0x00:
692660         if(LOG_SMPC) printf ("SMPC: Master ON\n");
693         smpc_master_on(space.machine());
661         smpc_master_on();
694662         break;
695663      //case 0x01: Master OFF?
696664      case 0x02:
697665      case 0x03:
698         if(LOG_SMPC) printf ("SMPC: Slave %s %d %d\n",(data & 1) ? "off" : "on",space.machine().first_screen()->hpos(),space.machine().first_screen()->vpos());
699         space.machine().scheduler().timer_set(attotime::from_usec(15), FUNC(smpc_slave_enable),data & 1);
666         if(LOG_SMPC) printf ("SMPC: Slave %s %d %d\n",(data & 1) ? "off" : "on",machine().first_screen()->hpos(),machine().first_screen()->vpos());
667         machine().scheduler().timer_set(attotime::from_usec(15), timer_expired_delegate(FUNC(saturn_state::smpc_slave_enable),this),data & 1);
700668         break;
701669      case 0x06:
702670      case 0x07:
703671         if(LOG_SMPC) printf ("SMPC: Sound %s\n",(data & 1) ? "off" : "on");
704672
705673         if(!is_stv)
706            space.machine().scheduler().timer_set(attotime::from_usec(15), FUNC(smpc_sound_enable),data & 1);
674            machine().scheduler().timer_set(attotime::from_usec(15), timer_expired_delegate(FUNC(saturn_state::smpc_sound_enable),this),data & 1);
707675         break;
708676      /*CD (SH-1) ON/OFF */
709677      case 0x08:
710678      case 0x09:
711679         printf ("SMPC: CD %s\n",(data & 1) ? "off" : "on");
712         space.machine().scheduler().timer_set(attotime::from_usec(20), FUNC(smpc_cd_enable),data & 1);
680         machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(saturn_state::smpc_cd_enable),this),data & 1);
713681         break;
714682      case 0x0d:
715683         if(LOG_SMPC) printf ("SMPC: System Reset\n");
716         smpc_system_reset(space.machine());
684         smpc_system_reset();
717685         break;
718686      case 0x0e:
719687      case 0x0f:
720         if(LOG_SMPC) printf ("SMPC: Change Clock to %s (%d %d)\n",data & 1 ? "320" : "352",space.machine().first_screen()->hpos(),space.machine().first_screen()->vpos());
688         if(LOG_SMPC) printf ("SMPC: Change Clock to %s (%d %d)\n",data & 1 ? "320" : "352",machine().first_screen()->hpos(),machine().first_screen()->vpos());
721689
722690         /* on ST-V timing of this is pretty fussy, you get 2 credits at start-up otherwise
723691            My current theory is that SMPC first stops all CPUs until it executes the whole snippet for this,
r29304r29305
725693            can do an usable mid-frame clock switching anyway.
726694            */
727695
728         state->m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
729         state->m_slave->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
730         state->m_audiocpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
696         m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
697         m_slave->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
698         m_audiocpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
731699
732         space.machine().scheduler().timer_set(space.machine().first_screen()->time_until_pos(state->get_vblank_start_position()*state->get_ystep_count(), 0), FUNC(smpc_change_clock),data & 1);
700         machine().scheduler().timer_set(machine().first_screen()->time_until_pos(get_vblank_start_position()*get_ystep_count(), 0), timer_expired_delegate(FUNC(saturn_state::smpc_change_clock),this),data & 1);
733701         break;
734702      /*"Interrupt Back"*/
735703      case 0x10:
736704         if(0)
737705         {
738            saturn_state *state = space.machine().driver_data<saturn_state>();
739            printf ("SMPC: Status Acquire %02x %02x %02x %d\n",state->m_smpc.IREG[0],state->m_smpc.IREG[1],state->m_smpc.IREG[2],space.machine().first_screen()->vpos());
706            printf ("SMPC: Status Acquire %02x %02x %02x %d\n",m_smpc.IREG[0],m_smpc.IREG[1],m_smpc.IREG[2],machine().first_screen()->vpos());
740707         }
741708
742709         int timing;
743710
744711         timing = 8;
745712
746         if(state->m_smpc.IREG[0] != 0) // non-peripheral data
713         if(m_smpc.IREG[0] != 0) // non-peripheral data
747714            timing += 8;
748715
749716         /* TODO: At vblank-out actually ... */
750         if(state->m_smpc.IREG[1] & 8) // peripheral data
717         if(m_smpc.IREG[1] & 8) // peripheral data
751718            timing += 700;
752719
753720         /* TODO: check if IREG[2] is setted to 0xf0 */
r29304r29305
755722            int i;
756723
757724            for(i=0;i<3;i++)
758               state->m_smpc.intback_buf[i] = state->m_smpc.IREG[i];
725               m_smpc.intback_buf[i] = m_smpc.IREG[i];
759726         }
760727
761728         if(is_stv)
762729         {
763            space.machine().scheduler().timer_set(attotime::from_usec(timing), FUNC(stv_smpc_intback),0); //TODO: variable time
730            machine().scheduler().timer_set(attotime::from_usec(timing), timer_expired_delegate(FUNC(saturn_state::stv_smpc_intback),this),0); //TODO: variable time
764731         }
765732         else
766733         {
767            if(LOG_PAD_CMD) printf("INTBACK %02x %02x %d %d\n",state->m_smpc.IREG[0],state->m_smpc.IREG[1],space.machine().first_screen()->vpos(),(int)space.machine().first_screen()->frame_number());
768            space.machine().scheduler().timer_set(attotime::from_usec(timing), FUNC(saturn_smpc_intback),0); //TODO: is variable time correct?
734            if(LOG_PAD_CMD) printf("INTBACK %02x %02x %d %d\n",m_smpc.IREG[0],m_smpc.IREG[1],machine().first_screen()->vpos(),(int)machine().first_screen()->frame_number());
735            machine().scheduler().timer_set(attotime::from_usec(timing), timer_expired_delegate(FUNC(saturn_state::saturn_smpc_intback),this),0); //TODO: is variable time correct?
769736         }
770737         break;
771738      /* RTC write*/
772739      case 0x16:
773740         if(LOG_SMPC) printf("SMPC: RTC write\n");
774         smpc_rtc_write(space.machine());
741         smpc_rtc_write();
775742         break;
776743      /* SMPC memory setting*/
777744      case 0x17:
778745         if(LOG_SMPC) printf ("SMPC: memory setting\n");
779         smpc_memory_setting(space.machine());
746         smpc_memory_setting();
780747         break;
781748      case 0x18:
782749         if(LOG_SMPC) printf ("SMPC: NMI request\n");
783         smpc_nmi_req(space.machine());
750         smpc_nmi_req();
784751         break;
785752      case 0x19:
786753      case 0x1a:
787754         /* TODO: timing */
788         if(LOG_SMPC) printf ("SMPC: NMI %sable %d %d\n",data & 1 ? "Dis" : "En",space.machine().first_screen()->hpos(),space.machine().first_screen()->vpos());
789         space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_nmi_set),data & 1);
755         if(LOG_SMPC) printf ("SMPC: NMI %sable %d %d\n",data & 1 ? "Dis" : "En",machine().first_screen()->hpos(),machine().first_screen()->vpos());
756         machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(saturn_state::smpc_nmi_set),this),data & 1);
790757         break;
791758      default:
792759         printf ("cpu '%s' (PC=%08X) SMPC: undocumented Command %02x\n", space.device().tag(), space.device().safe_pc(), data);
r29304r29305
799766 *
800767 *******************************************/
801768
802READ8_HANDLER( stv_SMPC_r )
769READ8_MEMBER( saturn_state::stv_SMPC_r )
803770{
804   saturn_state *state = space.machine().driver_data<saturn_state>();
805771   int return_data = 0;
806772
807773   if(!(offset & 1))
808774      return 0;
809775
810776   if(offset >= 0x21 && offset <= 0x5f)
811      return_data = state->m_smpc.OREG[(offset-0x21) >> 1];
777      return_data = m_smpc.OREG[(offset-0x21) >> 1];
812778
813779   if (offset == 0x61) // TODO: SR
814      return_data = state->m_smpc.SR;
780      return_data = m_smpc.SR;
815781
816782   if (offset == 0x63)
817      return_data = state->m_smpc.SF;
783      return_data = m_smpc.SF;
818784
819785   if (offset == 0x75)//PDR1 read
820      return_data = state->ioport("DSW1")->read();
786      return_data = ioport("DSW1")->read();
821787
822788   if (offset == 0x77)//PDR2 read
823      return_data = (0xfe | state->m_eeprom->do_read());
789      return_data = (0xfe | m_eeprom->do_read());
824790
825791   return return_data;
826792}
827793
828WRITE8_HANDLER( stv_SMPC_w )
794WRITE8_MEMBER( saturn_state::stv_SMPC_w )
829795{
830   saturn_state *state = space.machine().driver_data<saturn_state>();
831
832796   if (!(offset & 1)) // avoid writing to even bytes
833797      return;
834798
835799//  if(LOG_SMPC) printf ("8-bit SMPC Write to Offset %02x with Data %02x\n", offset, data);
836800
837801   if(offset >= 1 && offset <= 0xd)
838      state->m_smpc.IREG[offset >> 1] = data;
802      m_smpc.IREG[offset >> 1] = data;
839803
840804   if(offset == 1) //IREG0, check if a BREAK / CONTINUE request for INTBACK command
841805   {
842      if(state->m_smpc.intback_stage)
806      if(m_smpc.intback_stage)
843807      {
844808         if(data & 0x40)
845809         {
846810            if(LOG_PAD_CMD) printf("SMPC: BREAK request\n");
847            state->m_smpc.SR &= 0x0f;
848            state->m_smpc.intback_stage = 0;
811            m_smpc.SR &= 0x0f;
812            m_smpc.intback_stage = 0;
849813         }
850814         else if(data & 0x80)
851815         {
852816            if(LOG_PAD_CMD) printf("SMPC: CONTINUE request\n");
853            space.machine().scheduler().timer_set(attotime::from_usec(700), FUNC(stv_intback_peripheral),0); /* TODO: is timing correct? */
854            state->m_smpc.OREG[31] = 0x10;
855            state->m_smpc.SF = 0x01; //TODO: set hand-shake flag?
817            machine().scheduler().timer_set(attotime::from_usec(700), timer_expired_delegate(FUNC(saturn_state::stv_intback_peripheral),this),0); /* TODO: is timing correct? */
818            m_smpc.OREG[31] = 0x10;
819            m_smpc.SF = 0x01; //TODO: set hand-shake flag?
856820         }
857821      }
858822   }
r29304r29305
864828      // we've processed the command, clear status flag
865829      if(data != 0x10 && data != 0x02 && data != 0x03 && data != 0x08 && data != 0x09 && data != 0xe && data != 0xf && data != 0x19 && data != 0x1a)
866830      {
867         state->m_smpc.OREG[31] = data; //read-back command
868         state->m_smpc.SF = 0x00;
831         m_smpc.OREG[31] = data; //read-back command
832         m_smpc.SF = 0x00;
869833      }
870834      /*TODO:emulate the timing of each command...*/
871835   }
872836
873837   if(offset == 0x63)
874      state->m_smpc.SF = data & 1;
838      m_smpc.SF = data & 1;
875839
876840   if(offset == 0x75)
877841   {
r29304r29305
882846      ---- -x-- EEPROM CS line
883847      ---- --xx A-Bus bank bits
884848      */
885      state->m_eeprom->clk_write((data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
886      state->m_eeprom->di_write((data >> 4) & 1);
887      state->m_eeprom->cs_write((data & 0x04) ? ASSERT_LINE : CLEAR_LINE);
888      state->m_stv_multi_bank = data & 3;
849      m_eeprom->clk_write((data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
850      m_eeprom->di_write((data >> 4) & 1);
851      m_eeprom->cs_write((data & 0x04) ? ASSERT_LINE : CLEAR_LINE);
852      m_stv_multi_bank = data & 3;
889853
890      stv_select_game(space.machine(), state->m_stv_multi_bank);
854      stv_select_game(m_stv_multi_bank);
891855
892      state->m_smpc.PDR1 = (data & 0x60);
856      m_smpc.PDR1 = (data & 0x60);
893857   }
894858
895859   if(offset == 0x77)
r29304r29305
898862          -xx- ---- PDR2
899863          ---x ---- Enable Sound System (ACTIVE LOW)
900864      */
901      //popmessage("PDR2 = %02x",state->m_smpc_ram[0x77]);
865      //popmessage("PDR2 = %02x",m_smpc_ram[0x77]);
902866
903867      if(LOG_SMPC) printf("SMPC: M68k %s\n",(data & 0x10) ? "off" : "on");
904      //space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_sound_enable),(state->m_smpc_ram[0x77] & 0x10) >> 4);
905      state->m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
906      state->m_en_68k = ((data & 0x10) >> 4) ^ 1;
868      //machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(saturn_state::smpc_sound_enable),this),(m_smpc_ram[0x77] & 0x10) >> 4);
869      m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
870      m_en_68k = ((data & 0x10) >> 4) ^ 1;
907871
908872      //if(LOG_SMPC) printf("SMPC: ram [0x77] = %02x\n",data);
909      state->m_smpc.PDR2 = (data & 0x60);
873      m_smpc.PDR2 = (data & 0x60);
910874   }
911875
912876   if(offset == 0x7d)
r29304r29305
915879      ---- --x- IOSEL2 direct (1) / control mode (0) port select
916880      ---- ---x IOSEL1 direct (1) / control mode (0) port select
917881      */
918      state->m_smpc.IOSEL1 = (data & 1) >> 0;
919      state->m_smpc.IOSEL2 = (data & 2) >> 1;
882      m_smpc.IOSEL1 = (data & 1) >> 0;
883      m_smpc.IOSEL2 = (data & 2) >> 1;
920884   }
921885
922886   if(offset == 0x7f)
923887   {
924888      //enable PAD irq & VDP2 external latch for port 1/2
925      state->m_smpc.EXLE1 = (data & 1) >> 0;
926      state->m_smpc.EXLE2 = (data & 2) >> 1;
889      m_smpc.EXLE1 = (data & 1) >> 0;
890      m_smpc.EXLE2 = (data & 2) >> 1;
927891   }
928892}
929893
r29304r29305
1001965
1002966   if (offset == 0x63)
1003967   {
1004      //printf("SF %d %d\n",space.machine().first_screen()->hpos(),space.machine().first_screen()->vpos());
968      //printf("SF %d %d\n",machine().first_screen()->hpos(),machine().first_screen()->vpos());
1005969      return_data = m_smpc.SF;
1006970   }
1007971
r29304r29305
10601024         else if(data & 0x80)
10611025         {
10621026            if(LOG_PAD_CMD) printf("SMPC: CONTINUE request\n");
1063            machine().scheduler().timer_set(attotime::from_usec(700), FUNC(intback_peripheral),0); /* TODO: is timing correct? */
1027            machine().scheduler().timer_set(attotime::from_usec(700), timer_expired_delegate(FUNC(saturn_state::intback_peripheral),this),0); /* TODO: is timing correct? */
10641028            m_smpc.OREG[31] = 0x10;
10651029            m_smpc.SF = 0x01; //TODO: set hand-shake flag?
10661030         }
shelves/new_menus/src/emu/machine/smpc.h
r29304r29305
1DECLARE_WRITE8_HANDLER( stv_SMPC_w );
2DECLARE_READ8_HANDLER( stv_SMPC_r );
3DECLARE_WRITE8_HANDLER( saturn_SMPC_w );
4DECLARE_READ8_HANDLER( saturn_SMPC_r );
1// TODO: make separate device when code is decoupled better
2//DECLARE_WRITE8_MEMBER( stv_SMPC_w );
3//DECLARE_READ8_MEMBER( stv_SMPC_r );
4//DECLARE_WRITE8_MEMBER( saturn_SMPC_w );
5//DECLARE_READ8_MEMBER( saturn_SMPC_r );
shelves/new_menus/src/emu/machine/lh5810.c
r29304r29305
1919
2020const device_type LH5810 = &device_creator<lh5810_device>;
2121
22
23//-------------------------------------------------
24//  device_config_complete - perform any
25//  operations now that the configuration is
26//  complete
27//-------------------------------------------------
28
29void lh5810_device::device_config_complete()
30{
31   // inherit a copy of the static data
32   const lh5810_interface *intf = reinterpret_cast<const lh5810_interface *>(static_config());
33   if (intf != NULL)
34      *static_cast<lh5810_interface *>(this) = *intf;
35
36   // or initialize to defaults if none provided
37   else
38   {
39      memset(&m_porta_r_cb, 0, sizeof(m_porta_r_cb));
40      memset(&m_porta_w_cb, 0, sizeof(m_porta_w_cb));
41      memset(&m_portb_r_cb, 0, sizeof(m_portb_r_cb));
42      memset(&m_portb_w_cb, 0, sizeof(m_portb_w_cb));
43      memset(&m_portc_w_cb, 0, sizeof(m_portc_w_cb));
44      memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
45   }
46}
47
48
4922//**************************************************************************
5023//  LIVE DEVICE
5124//**************************************************************************
r29304r29305
5528//-------------------------------------------------
5629
5730lh5810_device::lh5810_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
58   : device_t(mconfig, LH5810, "LH5810", tag, owner, clock, "lh5810", __FILE__)
31   : device_t(mconfig, LH5810, "LH5810", tag, owner, clock, "lh5810", __FILE__),
32   m_porta_r_cb(*this),
33   m_porta_w_cb(*this),
34   m_portb_r_cb(*this),
35   m_portb_w_cb(*this),
36   m_portc_w_cb(*this),
37   m_out_int_cb(*this)
5938{
6039}
6140
r29304r29305
6746void lh5810_device::device_start()
6847{
6948   // resolve callbacks
70   m_porta_r_func.resolve(m_porta_r_cb, *this);
71   m_porta_w_func.resolve(m_porta_w_cb, *this);
72   m_portb_r_func.resolve(m_portb_r_cb, *this);
73   m_portb_w_func.resolve(m_portb_w_cb, *this);
74   m_portc_w_func.resolve(m_portc_w_cb, *this);
75   m_out_int_func.resolve(m_out_int_cb, *this);
49   m_porta_r_cb.resolve_safe(0);
50   m_porta_w_cb.resolve_safe();
51   m_portb_r_cb.resolve_safe(0);
52   m_portb_w_cb.resolve_safe();
53   m_portc_w_cb.resolve_safe();
54   m_out_int_cb.resolve_safe();
7655
7756   // register for state saving
7857   save_item(NAME(m_irq));
r29304r29305
10988         return m_reg[offset];
11089
11190      case LH5810_IF:
112         if (BIT(m_portb_r_func(0) & ~m_reg[LH5810_DDB], 7))
91         if (BIT(m_portb_r_cb(0) & ~m_reg[LH5810_DDB], 7))
11392            m_reg[offset] |= 2;
11493         else
11594            m_reg[offset] &= 0xfd;
r29304r29305
12099         return (m_reg[offset]&0x0f) | (m_irq<<4) | (BIT(m_reg[LH5810_OPB],7)<<5);
121100
122101      case LH5810_OPA:
123         m_reg[offset] = (m_reg[offset] & m_reg[LH5810_DDA]) | (m_porta_r_func(0) & ~m_reg[LH5810_DDA]);
102         m_reg[offset] = (m_reg[offset] & m_reg[LH5810_DDA]) | (m_porta_r_cb(0) & ~m_reg[LH5810_DDA]);
124103         return m_reg[offset];
125104
126105      case LH5810_OPB:
127         m_reg[offset] = (m_reg[offset] & m_reg[LH5810_DDB]) | (m_portb_r_func(0) & ~m_reg[LH5810_DDB]);
128         m_out_int_func((m_reg[offset] & 0x80 && m_reg[LH5810_MSK] & 0x02) ? ASSERT_LINE : CLEAR_LINE);
106         m_reg[offset] = (m_reg[offset] & m_reg[LH5810_DDB]) | (m_portb_r_cb(0) & ~m_reg[LH5810_DDB]);
107         m_out_int_cb((m_reg[offset] & 0x80 && m_reg[LH5810_MSK] & 0x02) ? ASSERT_LINE : CLEAR_LINE);
129108         return m_reg[offset];
130109
131110      default:
r29304r29305
175154
176155      case LH5810_OPA:
177156         m_reg[offset] = (data & m_reg[LH5810_DDA]) | (m_reg[offset] & ~m_reg[LH5810_DDA]);
178         m_porta_w_func(0, m_reg[offset]);
157         m_porta_w_cb((offs_t)0, m_reg[offset]);
179158         break;
180159
181160      case LH5810_OPB:
182161         m_reg[offset] = (data & m_reg[LH5810_DDB]) | (m_reg[offset] & ~m_reg[LH5810_DDB]);
183         m_portb_w_func(0, m_reg[offset]);
184         m_out_int_func((m_reg[offset] & 0x80 && m_reg[LH5810_MSK] & 0x02) ? ASSERT_LINE : CLEAR_LINE);
162         m_portb_w_cb((offs_t)0, m_reg[offset]);
163         m_out_int_cb((m_reg[offset] & 0x80 && m_reg[LH5810_MSK] & 0x02) ? ASSERT_LINE : CLEAR_LINE);
185164         break;
186165
187166      case LH5810_OPC:
188167         m_reg[offset] = data;
189         m_portc_w_func(0, m_reg[offset]);
168         m_portc_w_cb((offs_t)0, m_reg[offset]);
190169         break;
191170   }
192171}
shelves/new_menus/src/emu/machine/lh5810.h
r29304r29305
3838//  INTERFACE CONFIGURATION MACROS
3939//*************************************************************************
4040
41#define MCFG_LH5810_ADD(_tag, _config) \
42   MCFG_DEVICE_ADD((_tag), LH5810, 0)  \
43   MCFG_DEVICE_CONFIG(_config)
41#define MCFG_LH5810_PORTA_R_CB(_devcb) \
42   devcb = &lh5810_device::set_porta_r_callback(*device, DEVCB2_##_devcb);
4443
44#define MCFG_LH5810_PORTA_W_CB(_devcb) \
45   devcb = &lh5810_device::set_porta_w_callback(*device, DEVCB2_##_devcb);
46   
47#define MCFG_LH5810_PORTB_R_CB(_devcb) \
48   devcb = &lh5810_device::set_portb_r_callback(*device, DEVCB2_##_devcb);
49   
50#define MCFG_LH5810_PORTB_W_CB(_devcb) \
51   devcb = &lh5810_device::set_portb_w_callback(*device, DEVCB2_##_devcb);
52   
53#define MCFG_LH5810_PORTC_W_CB(_devcb) \
54   devcb = &lh5810_device::set_portc_w_callback(*device, DEVCB2_##_devcb);
55 
56#define MCFG_LH5810_OUT_INT_CB(_devcb) \
57   devcb = &lh5810_device::set_out_int_callback(*device, DEVCB2_##_devcb); //currently unused
4558
4659
60
4761//*************************************************************************
4862//  TYPE DEFINITIONS
4963//*************************************************************************
5064
51// ======================> lh5810_interface
52
53struct lh5810_interface
54{
55   devcb_read8         m_porta_r_cb;       //port A read
56   devcb_write8        m_porta_w_cb;       //port A write
57   devcb_read8         m_portb_r_cb;       //port B read
58   devcb_write8        m_portb_w_cb;       //port B write
59   devcb_write8        m_portc_w_cb;       //port C write
60
61   devcb_write_line    m_out_int_cb;       //IRQ callback
62};
63
6465// ======================> lh5810_device
6566
66class lh5810_device :   public device_t,
67                  public lh5810_interface
67class lh5810_device :   public device_t
6868{
6969public:
7070   // construction/destruction
7171   lh5810_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
7272
73   template<class _Object> static devcb2_base &set_porta_r_callback(device_t &device, _Object object) { return downcast<lh5810_device &>(device).m_porta_r_cb.set_callback(object); }
74   template<class _Object> static devcb2_base &set_porta_w_callback(device_t &device, _Object object) { return downcast<lh5810_device &>(device).m_porta_w_cb.set_callback(object); }
75   template<class _Object> static devcb2_base &set_portb_r_callback(device_t &device, _Object object) { return downcast<lh5810_device &>(device).m_portb_r_cb.set_callback(object); }
76   template<class _Object> static devcb2_base &set_portb_w_callback(device_t &device, _Object object) { return downcast<lh5810_device &>(device).m_portb_w_cb.set_callback(object); }
77   template<class _Object> static devcb2_base &set_portc_w_callback(device_t &device, _Object object) { return downcast<lh5810_device &>(device).m_portc_w_cb.set_callback(object); }
78   template<class _Object> static devcb2_base &set_out_int_callback(device_t &device, _Object object) { return downcast<lh5810_device &>(device).m_out_int_cb.set_callback(object); }
79   
7380   DECLARE_READ8_MEMBER( data_r );
7481   DECLARE_WRITE8_MEMBER( data_w );
7582
r29304r29305
7784   // device-level overrides
7885   virtual void device_start();
7986   virtual void device_reset();
80   virtual void device_config_complete();
8187
8288private:
8389
84   devcb_resolved_read8        m_porta_r_func;
85   devcb_resolved_write8       m_porta_w_func;
86   devcb_resolved_read8        m_portb_r_func;
87   devcb_resolved_write8       m_portb_w_func;
88   devcb_resolved_write8       m_portc_w_func;
89   devcb_resolved_write_line   m_out_int_func;
90   devcb2_read8         m_porta_r_cb;       //port A read
91   devcb2_write8        m_porta_w_cb;       //port A write
92   devcb2_read8         m_portb_r_cb;       //port B read
93   devcb2_write8        m_portb_w_cb;       //port B write
94   devcb2_write8        m_portc_w_cb;       //port C write
9095
96   devcb2_write_line    m_out_int_cb;       //IRQ callback
97
9198   UINT8 m_reg[0x10];
9299   UINT8 m_irq;
93100};
shelves/new_menus/src/emu/machine/ins8154.c
r29304r29305
4444//-------------------------------------------------
4545
4646ins8154_device::ins8154_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
47   : device_t(mconfig, INS8154, "INS8154", tag, owner, clock, "ins8154", __FILE__)
47   : device_t(mconfig, INS8154, "INS8154", tag, owner, clock, "ins8154", __FILE__),
48   m_in_a_cb(*this),
49   m_out_a_cb(*this),
50   m_in_b_cb(*this),
51   m_out_b_cb(*this),
52   m_out_irq_cb(*this)
4853{
4954}
5055
51
5256//-------------------------------------------------
53//  device_config_complete - perform any
54//  operations now that the configuration is
55//  complete
56//-------------------------------------------------
57
58void ins8154_device::device_config_complete()
59{
60   // inherit a copy of the static data
61   const ins8154_interface *intf = reinterpret_cast<const ins8154_interface *>(static_config());
62   if (intf != NULL)
63   {
64      *static_cast<ins8154_interface *>(this) = *intf;
65   }
66
67   // or initialize to defaults if none provided
68   else
69   {
70      memset(&m_in_a_cb, 0, sizeof(m_in_a_cb));
71      memset(&m_in_b_cb, 0, sizeof(m_in_b_cb));
72      memset(&m_out_a_cb, 0, sizeof(m_out_a_cb));
73      memset(&m_out_b_cb, 0, sizeof(m_out_b_cb));
74      memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
75   }
76}
77
78
79//-------------------------------------------------
8057//  device_start - device-specific startup
8158//-------------------------------------------------
8259
8360void ins8154_device::device_start()
8461{
8562   /* resolve callbacks */
86   m_in_a_func.resolve(m_in_a_cb, *this);
87   m_out_a_func.resolve(m_out_a_cb, *this);
88   m_in_b_func.resolve(m_in_b_cb, *this);
89   m_out_b_func.resolve(m_out_b_cb, *this);
90   m_out_irq_func.resolve(m_out_irq_cb, *this);
63   m_in_a_cb.resolve();
64   m_out_a_cb.resolve_safe();
65   m_in_b_cb.resolve();
66   m_out_b_cb.resolve_safe();
67   m_out_irq_cb.resolve_safe();
9168
9269   /* register for state saving */
9370   save_item(NAME(m_in_a));
r29304r29305
132109   switch (offset)
133110   {
134111   case 0x20:
135      if(!m_in_a_func.isnull())
112      if(!m_in_a_cb.isnull())
136113      {
137         val = m_in_a_func(0);
114         val = m_in_a_cb(0);
138115      }
139116      m_in_a = val;
140117      break;
141118
142119   case 0x21:
143      if(!m_in_b_func.isnull())
120      if(!m_in_b_cb.isnull())
144121      {
145         val = m_in_b_func(0);
122         val = m_in_b_cb(0);
146123      }
147124      m_in_b = val;
148125      break;
r29304r29305
150127   default:
151128      if (offset < 0x08)
152129      {
153         if(!m_in_a_func.isnull())
130         if(!m_in_a_cb.isnull())
154131         {
155            val = (m_in_a_func(0) << (8 - offset)) & 0x80;
132            val = (m_in_a_cb(0) << (8 - offset)) & 0x80;
156133         }
157134         m_in_a = val;
158135      }
159136      else
160137      {
161         if(!m_in_b_func.isnull())
138         if(!m_in_b_cb.isnull())
162139         {
163            val = (m_in_b_func(0) << (8 - (offset >> 4))) & 0x80;
140            val = (m_in_b_cb(0) << (8 - (offset >> 4))) & 0x80;
164141         }
165142         m_in_b = val;
166143      }
r29304r29305
177154   /* Test if any pins are set as outputs */
178155   if (m_odra)
179156   {
180      m_out_a_func(0, (data & m_odra) | (m_odra ^ 0xff));
157      m_out_a_cb((offs_t)0, (data & m_odra) | (m_odra ^ 0xff));
181158   }
182159}
183160
r29304r29305
188165   /* Test if any pins are set as outputs */
189166   if (m_odrb)
190167   {
191      m_out_b_func(0, (data & m_odrb) | (m_odrb ^ 0xff));
168      m_out_b_cb((offs_t)0, (data & m_odrb) | (m_odrb ^ 0xff));
192169   }
193170}
194171
shelves/new_menus/src/emu/machine/ins8154.h
r29304r29305
4444    DEVICE CONFIGURATION MACROS
4545***************************************************************************/
4646
47#define MCFG_INS8154_ADD(_tag, _intrf) \
48   MCFG_DEVICE_ADD(_tag, INS8154, 0) \
49   MCFG_DEVICE_CONFIG(_intrf)
47#define MCFG_INS8154_IN_A_CB(_devcb) \
48   devcb = &ins8154_device::set_in_a_callback(*device, DEVCB2_##_devcb);
49   
50#define MCFG_INS8154_OUT_A_CB(_devcb) \
51   devcb = &ins8154_device::set_out_a_callback(*device, DEVCB2_##_devcb);
52   
53#define MCFG_INS8154_IN_B_CB(_devcb) \
54   devcb = &ins8154_device::set_in_b_callback(*device, DEVCB2_##_devcb);
55   
56#define MCFG_INS8154_OUT_B_CB(_devcb) \
57   devcb = &ins8154_device::set_out_b_callback(*device, DEVCB2_##_devcb);
5058
59#define MCFG_INS8154_OUT_IRQ_CB(_devcb) \
60   devcb = &ins8154_device::set_out_irq_callback(*device, DEVCB2_##_devcb); //currently unused
5161
5262/***************************************************************************
5363    TYPE DEFINITIONS
5464***************************************************************************/
5565
56
57// ======================> ins8154_interface
58
59struct ins8154_interface
60{
61   devcb_read8         m_in_a_cb;
62   devcb_write8        m_out_a_cb;
63   devcb_read8         m_in_b_cb;
64   devcb_write8        m_out_b_cb;
65   devcb_write_line    m_out_irq_cb;
66};
67
68
69
7066// ======================> ins8154_device
7167
72class ins8154_device :  public device_t,
73                  public ins8154_interface
68class ins8154_device :  public device_t
7469{
7570public:
7671   // construction/destruction
7772   ins8154_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
7873
74   template<class _Object> static devcb2_base &set_in_a_callback(device_t &device, _Object object) { return downcast<ins8154_device &>(device).m_in_a_cb.set_callback(object); }
75   template<class _Object> static devcb2_base &set_out_a_callback(device_t &device, _Object object) { return downcast<ins8154_device &>(device).m_out_a_cb.set_callback(object); }
76   template<class _Object> static devcb2_base &set_in_b_callback(device_t &device, _Object object) { return downcast<ins8154_device &>(device).m_in_b_cb.set_callback(object); }
77   template<class _Object> static devcb2_base &set_out_b_callback(device_t &device, _Object object) { return downcast<ins8154_device &>(device).m_out_b_cb.set_callback(object); }
78   template<class _Object> static devcb2_base &set_out_irq_callback(device_t &device, _Object object) { return downcast<ins8154_device &>(device).m_out_irq_cb.set_callback(object); }
79   
7980   DECLARE_READ8_MEMBER( ins8154_r );
8081   DECLARE_WRITE8_MEMBER( ins8154_w );
8182
r29304r29305
8485
8586protected:
8687   // device-level overrides
87   virtual void device_config_complete();
8888   virtual void device_start();
8989   virtual void device_reset();
9090   virtual void device_post_load() { }
r29304r29305
9393private:
9494
9595   /* i/o lines */
96   devcb_resolved_read8 m_in_a_func;
97   devcb_resolved_write8 m_out_a_func;
98   devcb_resolved_read8 m_in_b_func;
99   devcb_resolved_write8 m_out_b_func;
100   devcb_resolved_write_line m_out_irq_func;
96   devcb2_read8         m_in_a_cb;
97   devcb2_write8        m_out_a_cb;
98   devcb2_read8         m_in_b_cb;
99   devcb2_write8        m_out_b_cb;
100   devcb2_write_line    m_out_irq_cb;
101101
102102   /* registers */
103103   UINT8 m_in_a;  /* Input Latch Port A */
shelves/new_menus/src/emu/clifront.c
r29304r29305
148148
149149         machine_config config(*system, m_options);
150150         software_list_device_iterator iter(config.root_device());
151         if (iter.first() == NULL)
151         if (iter.count() == 0)
152152            throw emu_fatalerror(MAMERR_FATALERROR, "Error: unknown option: %s\n", m_options.software_name());
153153
154154         bool found = false;
r29304r29305
550550   {
551551      // see if we have samples
552552      samples_device_iterator iter(drivlist.config().root_device());
553      if (iter.first() == NULL)
553      if (iter.count() == 0)
554554         continue;
555555
556556      // print a header
shelves/new_menus/src/emu/ui/devctrl.h
r29304r29305
4646   : ui_menu(machine, container)
4747{
4848   iterator iter(machine.root_device());
49   m_count = iter.count();
4950   m_device = device ? device : iter.first();
50   iterator iter_cnt(machine.root_device());
51   m_count = iter_cnt.count();
5251}
5352
5453
shelves/new_menus/src/emu/cpu/cpu.mak
r29304r29305
490490OBJDIRS += $(CPUOBJ)/h8
491491CPUOBJS += $(CPUOBJ)/h8/h8.o $(CPUOBJ)/h8/h8h.o $(CPUOBJ)/h8/h8s2000.o $(CPUOBJ)/h8/h8s2600.o \
492492           $(CPUOBJ)/h8/h83337.o \
493           $(CPUOBJ)/h8/h83002.o $(CPUOBJ)/h8/h83006.o $(CPUOBJ)/h8/h83048.o \
493           $(CPUOBJ)/h8/h83002.o $(CPUOBJ)/h8/h83006.o  $(CPUOBJ)/h8/h83008.o \
494           $(CPUOBJ)/h8/h83048.o \
494495           $(CPUOBJ)/h8/h8s2245.o $(CPUOBJ)/h8/h8s2320.o $(CPUOBJ)/h8/h8s2357.o \
495496           $(CPUOBJ)/h8/h8s2655.o \
496497           $(CPUOBJ)/h8/h8_adc.o $(CPUOBJ)/h8/h8_port.o $(CPUOBJ)/h8/h8_intc.o \
r29304r29305
549550                        $(CPUSRC)/h8/h8_timer16.h \
550551                        $(CPUSRC)/h8/h8_sci.h
551552
553$(CPUOBJ)/h8/h83008.o:         $(CPUSRC)/h8/h83008.c \
554                        $(CPUSRC)/h8/h83008.h \
555                        $(CPUSRC)/h8/h8h.h \
556                        $(CPUSRC)/h8/h8.h \
557                        $(CPUSRC)/h8/h8_intc.h \
558                        $(CPUSRC)/h8/h8_adc.h \
559                        $(CPUSRC)/h8/h8_port.h \
560                        $(CPUSRC)/h8/h8_timer16.h \
561                        $(CPUSRC)/h8/h8_sci.h
562
552563$(CPUOBJ)/h8/h83048.o:         $(CPUSRC)/h8/h83048.c \
553564                        $(CPUSRC)/h8/h83048.h \
554565                        $(CPUSRC)/h8/h8h.h \
shelves/new_menus/src/emu/cpu/i86/i86.c
r29304r29305
13541354
13551355      case 0x8c: // i_mov_wsreg
13561356         m_modrm = fetch();
1357         PutRMWord(m_sregs[(m_modrm & 0x38) >> 3]);
1357         PutRMWord(m_sregs[(m_modrm & 0x18) >> 3]); // guess: ignore bit 5
1358         if(m_modrm & 0x20) logerror("%s: %06x: Mov Sreg - Invalid register\n", tag(), pc());
13581359         CLKM(MOV_RS,MOV_MS);
13591360         break;
13601361
shelves/new_menus/src/emu/cpu/i86/i286.c
r29304r29305
14241424               i_outsw();
14251425               break;
14261426
1427            case 0x8c: // i_mov_wsreg
1428               m_modrm = fetch();
1429               if((m_modrm & 0x38) > 0x18)
1430               {
1431                  logerror("%s: %06x: Mov Sreg - Invalid register\n", tag(), pc());
1432                  throw TRAP(FAULT_UD, (UINT16)-1);
1433               }
1434               PutRMWord(m_sregs[(m_modrm & 0x38) >> 3]);
1435               CLKM(MOV_RS,MOV_MS);
1436               break;
1437
14271438            case 0x8e: // i_mov_sregw
14281439               m_modrm = fetch();
14291440               m_src = GetRMWord();
shelves/new_menus/src/emu/cpu/g65816/g65816.c
r29304r29305
5845848 CPU cycles for division at first, since using 16 produces bugs (see e.g.
585585Triforce pieces in Zelda 3 intro) */
586586
587static WRITE8_HANDLER( wrmpya_w )
587WRITE8_MEMBER( _5a22_device::wrmpya_w )
588588{
589   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
589   g65816i_cpu_struct *cpustate = get_safe_token(this);
590590
591591   cpustate->wrmpya = data;
592592}
593593
594static WRITE8_HANDLER( wrmpyb_w )
594WRITE8_MEMBER( _5a22_device::wrmpyb_w )
595595{
596   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
596   g65816i_cpu_struct *cpustate = get_safe_token(this);
597597
598598   cpustate->wrmpyb = data;
599599   cpustate->rdmpy = cpustate->wrmpya * cpustate->wrmpyb;
600600   /* TODO: cpustate->rddiv == 0? */
601601}
602602
603static WRITE8_HANDLER( wrdivl_w )
603WRITE8_MEMBER( _5a22_device::wrdivl_w )
604604{
605   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
605   g65816i_cpu_struct *cpustate = get_safe_token(this);
606606
607607   cpustate->wrdiv = (data) | (cpustate->wrdiv & 0xff00);
608608}
609609
610static WRITE8_HANDLER( wrdivh_w )
610WRITE8_MEMBER( _5a22_device::wrdivh_w )
611611{
612   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
612   g65816i_cpu_struct *cpustate = get_safe_token(this);
613613
614614   cpustate->wrdiv = (data << 8) | (cpustate->wrdiv & 0xff);
615615}
616616
617static WRITE8_HANDLER( wrdvdd_w )
617WRITE8_MEMBER( _5a22_device::wrdvdd_w )
618618{
619   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
619   g65816i_cpu_struct *cpustate = get_safe_token(this);
620620   UINT16 quotient, remainder;
621621
622622   cpustate->dvdd = data;
r29304r29305
628628   cpustate->rdmpy = remainder;
629629}
630630
631static WRITE8_HANDLER( memsel_w )
631WRITE8_MEMBER( _5a22_device::memsel_w )
632632{
633   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
633   g65816i_cpu_struct *cpustate = get_safe_token(this);
634634   cpustate->fastROM = data & 1;
635635}
636636
637static READ8_HANDLER( rddivl_r )
637READ8_MEMBER( _5a22_device::rddivl_r )
638638{
639   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
639   g65816i_cpu_struct *cpustate = get_safe_token(this);
640640   return cpustate->rddiv & 0xff;
641641}
642642
643static READ8_HANDLER( rddivh_r )
643READ8_MEMBER( _5a22_device::rddivh_r )
644644{
645   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
645   g65816i_cpu_struct *cpustate = get_safe_token(this);
646646   return cpustate->rddiv >> 8;
647647}
648648
649static READ8_HANDLER( rdmpyl_r )
649READ8_MEMBER( _5a22_device::rdmpyl_r )
650650{
651   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
651   g65816i_cpu_struct *cpustate = get_safe_token(this);
652652   return cpustate->rdmpy & 0xff;
653653}
654654
655static READ8_HANDLER( rdmpyh_r )
655READ8_MEMBER( _5a22_device::rdmpyh_r )
656656{
657   g65816i_cpu_struct *cpustate = get_safe_token(&space.device());
657   g65816i_cpu_struct *cpustate = get_safe_token(this);
658658   return cpustate->rdmpy >> 8;
659659}
660660
661661
662static ADDRESS_MAP_START(_5a22_map, AS_PROGRAM, 8, legacy_cpu_device)
663   AM_RANGE(0x4202, 0x4202) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrmpya_w)
664   AM_RANGE(0x4203, 0x4203) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrmpyb_w)
665   AM_RANGE(0x4204, 0x4204) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrdivl_w)
666   AM_RANGE(0x4205, 0x4205) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrdivh_w)
667   AM_RANGE(0x4206, 0x4206) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(wrdvdd_w)
662static ADDRESS_MAP_START(_5a22_map, AS_PROGRAM, 8, _5a22_device)
663   AM_RANGE(0x4202, 0x4202) AM_MIRROR(0xbf0000) AM_WRITE(wrmpya_w)
664   AM_RANGE(0x4203, 0x4203) AM_MIRROR(0xbf0000) AM_WRITE(wrmpyb_w)
665   AM_RANGE(0x4204, 0x4204) AM_MIRROR(0xbf0000) AM_WRITE(wrdivl_w)
666   AM_RANGE(0x4205, 0x4205) AM_MIRROR(0xbf0000) AM_WRITE(wrdivh_w)
667   AM_RANGE(0x4206, 0x4206) AM_MIRROR(0xbf0000) AM_WRITE(wrdvdd_w)
668668
669   AM_RANGE(0x420d, 0x420d) AM_MIRROR(0xbf0000) AM_WRITE_LEGACY(memsel_w)
669   AM_RANGE(0x420d, 0x420d) AM_MIRROR(0xbf0000) AM_WRITE(memsel_w)
670670
671   AM_RANGE(0x4214, 0x4214) AM_MIRROR(0xbf0000) AM_READ_LEGACY(rddivl_r)
672   AM_RANGE(0x4215, 0x4215) AM_MIRROR(0xbf0000) AM_READ_LEGACY(rddivh_r)
673   AM_RANGE(0x4216, 0x4216) AM_MIRROR(0xbf0000) AM_READ_LEGACY(rdmpyl_r)
674   AM_RANGE(0x4217, 0x4217) AM_MIRROR(0xbf0000) AM_READ_LEGACY(rdmpyh_r)
671   AM_RANGE(0x4214, 0x4214) AM_MIRROR(0xbf0000) AM_READ(rddivl_r)
672   AM_RANGE(0x4215, 0x4215) AM_MIRROR(0xbf0000) AM_READ(rddivh_r)
673   AM_RANGE(0x4216, 0x4216) AM_MIRROR(0xbf0000) AM_READ(rdmpyl_r)
674   AM_RANGE(0x4217, 0x4217) AM_MIRROR(0xbf0000) AM_READ(rdmpyh_r)
675675
676676ADDRESS_MAP_END
677677
678void set_5a22_map(legacy_cpu_device &cpu)
678void _5a22_device::set_5a22_map()
679679{
680   cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4202, 0x4202, 0, 0xbf0000, FUNC(wrmpya_w));
681   cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4203, 0x4203, 0, 0xbf0000, FUNC(wrmpyb_w));
682   cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4204, 0x4204, 0, 0xbf0000, FUNC(wrdivl_w));
683   cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4205, 0x4205, 0, 0xbf0000, FUNC(wrdivh_w));
684   cpu.space(AS_PROGRAM).install_legacy_write_handler(0x4206, 0x4206, 0, 0xbf0000, FUNC(wrdvdd_w));
680   space(AS_PROGRAM).install_write_handler(0x4202, 0x4202, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrmpya_w),this));
681   space(AS_PROGRAM).install_write_handler(0x4203, 0x4203, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrmpyb_w),this));
682   space(AS_PROGRAM).install_write_handler(0x4204, 0x4204, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrdivl_w),this));
683   space(AS_PROGRAM).install_write_handler(0x4205, 0x4205, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrdivh_w),this));
684   space(AS_PROGRAM).install_write_handler(0x4206, 0x4206, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::wrdvdd_w),this));
685685
686   cpu.space(AS_PROGRAM).install_legacy_write_handler(0x420d, 0x420d, 0, 0xbf0000, FUNC(memsel_w));
686   space(AS_PROGRAM).install_write_handler(0x420d, 0x420d, 0, 0xbf0000, write8_delegate(FUNC(_5a22_device::memsel_w),this));
687687
688   cpu.space(AS_PROGRAM).install_legacy_read_handler(0x4214, 0x4214, 0, 0xbf0000, FUNC(rddivl_r));
689   cpu.space(AS_PROGRAM).install_legacy_read_handler(0x4215, 0x4215, 0, 0xbf0000, FUNC(rddivh_r));
690   cpu.space(AS_PROGRAM).install_legacy_read_handler(0x4216, 0x4216, 0, 0xbf0000, FUNC(rdmpyl_r));
691   cpu.space(AS_PROGRAM).install_legacy_read_handler(0x4217, 0x4217, 0, 0xbf0000, FUNC(rdmpyh_r));
688   space(AS_PROGRAM).install_read_handler(0x4214, 0x4214, 0, 0xbf0000, read8_delegate(FUNC(_5a22_device::rddivl_r),this));
689   space(AS_PROGRAM).install_read_handler(0x4215, 0x4215, 0, 0xbf0000, read8_delegate(FUNC(_5a22_device::rddivh_r),this));
690   space(AS_PROGRAM).install_read_handler(0x4216, 0x4216, 0, 0xbf0000, read8_delegate(FUNC(_5a22_device::rdmpyl_r),this));
691   space(AS_PROGRAM).install_read_handler(0x4217, 0x4217, 0, 0xbf0000, read8_delegate(FUNC(_5a22_device::rdmpyh_r),this));
692692}
693693
694694CPU_SET_INFO( _5a22 )
shelves/new_menus/src/emu/cpu/g65816/g65816.h
r29304r29305
5959
6060/* Main interface function */
6161DECLARE_LEGACY_CPU_DEVICE(G65816, g65816);
62DECLARE_LEGACY_CPU_DEVICE(_5A22, _5a22);
6362
63CPU_GET_INFO( _5a22 );
64
65class _5a22_device : public legacy_cpu_device
66{
67public:
68   _5a22_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock);
69   
70   DECLARE_WRITE8_MEMBER( wrmpya_w );
71   DECLARE_WRITE8_MEMBER( wrmpyb_w );
72   DECLARE_WRITE8_MEMBER( wrdivl_w );
73   DECLARE_WRITE8_MEMBER( wrdivh_w );
74   DECLARE_WRITE8_MEMBER( wrdvdd_w );
75   DECLARE_WRITE8_MEMBER( memsel_w );
76   DECLARE_READ8_MEMBER( rddivl_r );
77   DECLARE_READ8_MEMBER( rddivh_r );
78   DECLARE_READ8_MEMBER( rdmpyl_r );
79   DECLARE_READ8_MEMBER( rdmpyh_r );
80   
81   void set_5a22_map();
82};
83
84extern const device_type _5A22;
85
86
6487#define CPU_TYPE_G65816 0
6588#define CPU_TYPE_5A22 1
6689
6790
6891void g65816_set_read_vector_callback(device_t *device, read8_delegate read_vector);
6992
70void set_5a22_map(legacy_cpu_device &cpu);
71
7293/* ======================================================================== */
7394/* ============================== END OF FILE ============================= */
7495/* ======================================================================== */
shelves/new_menus/src/emu/cpu/sh4/sh4dmac.c
r29304r29305
436436   if (sh4->cpu_type != CPU_TYPE_SH4)
437437      fatalerror("sh4_dma_ddt uses sh4->m[] with SH3\n");
438438
439   assert(s->channel >= 0 && s->channel < ARRAY_LENGTH(sh4->dma_timer_active));
440439   if (sh4->dma_timer_active[s->channel])
441440      return;
442441   if (s->mode >= 0) {
shelves/new_menus/src/emu/cpu/dsp56k/dsp56k.c
r29304r29305
368368/****************************************************************************
369369 *  Internal Memory Maps
370370 ****************************************************************************/
371static ADDRESS_MAP_START( dsp56156_program_map, AS_PROGRAM, 16, legacy_cpu_device )
372   AM_RANGE(0x0000,0x07ff) AM_READWRITE_LEGACY(DSP56K::program_r, DSP56K::program_w)   /* 1-5 */
371static ADDRESS_MAP_START( dsp56156_program_map, AS_PROGRAM, 16, dsp56k_device )
372   AM_RANGE(0x0000,0x07ff) AM_READWRITE(program_r, program_w)   /* 1-5 */
373373//  AM_RANGE(0x2f00,0x2fff) AM_ROM                              /* 1-5 PROM reserved memory.  Is this the right spot for it? */
374374ADDRESS_MAP_END
375375
376static ADDRESS_MAP_START( dsp56156_x_data_map, AS_DATA, 16, legacy_cpu_device )
376static ADDRESS_MAP_START( dsp56156_x_data_map, AS_DATA, 16, dsp56k_device )
377377   AM_RANGE(0x0000,0x07ff) AM_RAM                              /* 1-5 */
378   AM_RANGE(0xffc0,0xffff) AM_READWRITE_LEGACY(DSP56K::peripheral_register_r, DSP56K::peripheral_register_w)   /* 1-5 On-chip peripheral registers memory mapped in data space */
378   AM_RANGE(0xffc0,0xffff) AM_READWRITE(peripheral_register_r, peripheral_register_w)   /* 1-5 On-chip peripheral registers memory mapped in data space */
379379ADDRESS_MAP_END
380380
381381
shelves/new_menus/src/emu/cpu/dsp56k/dsp56k.h
r29304r29305
2323#define DSP56K_IRQ_RESET 3  /* Is this needed? */
2424
2525// Needed for MAME
26DECLARE_LEGACY_CPU_DEVICE(DSP56156, dsp56k);
26CPU_GET_INFO( dsp56k );
2727
28class dsp56k_device : public legacy_cpu_device
29{
30public:
31   dsp56k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock);
2832
33   DECLARE_READ16_MEMBER( program_r );
34   DECLARE_WRITE16_MEMBER( program_w );
35   DECLARE_READ16_MEMBER( peripheral_register_r );
36   DECLARE_WRITE16_MEMBER( peripheral_register_w );
37};
38
39extern const device_type DSP56156;
40
41
2942/***************************************************************************
3043    STRUCTURES & TYPEDEFS
3144***************************************************************************/
shelves/new_menus/src/emu/cpu/dsp56k/dsp56mem.c
r29304r29305
482482   external_p_wait_states_set(cpustate, 0x1f);
483483}
484484
485READ16_HANDLER( program_r )
485
486} // namespace DSP56K
487
488
489READ16_MEMBER( dsp56k_device::program_r )
486490{
487   dsp56k_core* cpustate = get_safe_token(&space.device());
491   dsp56k_core* cpustate = get_safe_token(this);
488492   return cpustate->program_ram[offset];
489493}
490494
491WRITE16_HANDLER( program_w )
495WRITE16_MEMBER( dsp56k_device::program_w )
492496{
493   dsp56k_core* cpustate = get_safe_token(&space.device());
497   dsp56k_core* cpustate = get_safe_token(this);
494498   cpustate->program_ram[offset] = data;
495499}
496500
497501/* Work */
498READ16_HANDLER( peripheral_register_r )
502READ16_MEMBER( dsp56k_device::peripheral_register_r )
499503{
500   dsp56k_core* cpustate = get_safe_token(&space.device());
504   dsp56k_core* cpustate = get_safe_token(this);
501505   // (printf) logerror("Peripheral read 0x%04x\n", O2A(offset));
502506
503507   switch (O2A(offset))
r29304r29305
630634   return cpustate->peripheral_ram[offset];
631635}
632636
633WRITE16_HANDLER( peripheral_register_w )
637WRITE16_MEMBER( dsp56k_device::peripheral_register_w )
634638{
635   dsp56k_core* cpustate = get_safe_token(&space.device());
639   dsp56k_core* cpustate = get_safe_token(this);
636640
637641   // Its primary behavior is RAM
638642   // COMBINE_DATA(&cpustate->peripheral_ram[offset]);
r29304r29305
785789   }
786790}
787791
788} // namespace DSP56K
789
790792/* These two functions are exposed to the outside world */
791793/* They represent the host side of the dsp56k's host interface */
792794void dsp56k_host_interface_write(device_t* device, UINT8 offset, UINT8 data)
shelves/new_menus/src/emu/cpu/dsp56k/dsp56mem.h
r29304r29305
234234/* Port C Dtaa Register (PCD) */
235235void PCD_set(dsp56k_core* cpustate, UINT16 value);
236236
237DECLARE_READ16_HANDLER( peripheral_register_r );
238DECLARE_WRITE16_HANDLER( peripheral_register_w );
239DECLARE_READ16_HANDLER( program_r );
240DECLARE_WRITE16_HANDLER( program_w );
241
242237} // namespace DSP56K
243238
244239#endif
shelves/new_menus/src/emu/cpu/h8/h83008.c
r0r29305
1#include "emu.h"
2#include "h83008.h"
3#include "h8_adc.h"
4
5const device_type H83008 = &device_creator<h83008_device>;
6
7h83008_device::h83008_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
8   h8h_device(mconfig, H83008, "H8/3008", tag, owner, clock, "h83008", __FILE__, address_map_delegate(FUNC(h83008_device::map), this)),
9   intc(*this, "intc"),
10   adc(*this, "adc"),
11   port4(*this, "port4"),
12   port6(*this, "port6"),
13   port7(*this, "port7"),
14   port8(*this, "port8"),
15   port9(*this, "port9"),
16   porta(*this, "porta"),
17   portb(*this, "portb"),
18   timer16(*this, "timer16"),
19   timer16_0(*this, "timer16:0"),
20   timer16_1(*this, "timer16:1"),
21   timer16_2(*this, "timer16:2"),
22   sci0(*this, "sci0"),
23   sci1(*this, "sci1")
24{
25}
26
27static MACHINE_CONFIG_FRAGMENT(h83008)
28   MCFG_H8H_INTC_ADD("intc")
29   MCFG_H8_ADC_3006_ADD("adc", "intc", 23)
30   MCFG_H8_PORT_ADD("port4", h8_device::PORT_4, 0x00, 0x00)
31   MCFG_H8_PORT_ADD("port6", h8_device::PORT_6, 0x80, 0x80)
32   MCFG_H8_PORT_ADD("port7", h8_device::PORT_7, 0xff, 0x00)
33   MCFG_H8_PORT_ADD("port8", h8_device::PORT_8, 0xf0, 0xe0)
34   MCFG_H8_PORT_ADD("port9", h8_device::PORT_9, 0xc0, 0xc0)
35   MCFG_H8_PORT_ADD("porta", h8_device::PORT_A, 0x80, 0x00)
36   MCFG_H8_PORT_ADD("portb", h8_device::PORT_B, 0x00, 0x00)
37   MCFG_H8_TIMER16_ADD("timer16", 3, 0xf8)
38   MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:0", 2, 2, "intc", 24)
39   MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:1", 2, 2, "intc", 28)
40   MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:2", 2, 2, "intc", 32)
41   MCFG_H8_SCI_ADD("sci0", "intc", 52, 53, 54, 55)
42   MCFG_H8_SCI_ADD("sci1", "intc", 56, 57, 58, 59)
43MACHINE_CONFIG_END
44
45DEVICE_ADDRESS_MAP_START(map, 16, h83008_device)
46   AM_RANGE(0xfee002, 0xfee003) AM_DEVWRITE8(    "port4",     h8_port_device,                     ddr_w,   0x00ff)
47   AM_RANGE(0xfee004, 0xfee005) AM_DEVWRITE8(    "port6",     h8_port_device,                     ddr_w,   0x00ff)
48   AM_RANGE(0xfee006, 0xfee007) AM_DEVWRITE8(    "port8",     h8_port_device,                     ddr_w,   0x00ff)
49   AM_RANGE(0xfee008, 0xfee009) AM_DEVWRITE8(    "port9",     h8_port_device,                     ddr_w,   0xff00)
50   AM_RANGE(0xfee008, 0xfee009) AM_DEVWRITE8(    "porta",     h8_port_device,                     ddr_w,   0x00ff)
51   AM_RANGE(0xfee00a, 0xfee00b) AM_DEVWRITE8(    "portb",     h8_port_device,                     ddr_w,   0xff00)
52
53   AM_RANGE(0xfee012, 0xfee013) AM_READWRITE8(                                           syscr_r, syscr_w, 0xff00)
54   AM_RANGE(0xfee014, 0xfee015) AM_DEVREADWRITE8("intc",      h8h_intc_device,           iscr_r,  iscr_w,  0xff00)
55   AM_RANGE(0xfee014, 0xfee015) AM_DEVREADWRITE8("intc",      h8h_intc_device,           ier_r,   ier_w,   0x00ff)
56   AM_RANGE(0xfee016, 0xfee017) AM_DEVREADWRITE8("intc",      h8h_intc_device,           isr_r,   isr_w,   0xff00)
57   AM_RANGE(0xfee018, 0xfee019) AM_DEVREADWRITE8("intc",      h8h_intc_device,           icr_r,   icr_w,   0xffff)
58
59   AM_RANGE(0xfee03e, 0xfee03f) AM_DEVREADWRITE8("port4",     h8_port_device,            pcr_r,   pcr_w,   0xff00)
60
61   AM_RANGE(0xffef20, 0xffff1f) AM_RAM
62
63   AM_RANGE(0xffff60, 0xffff61) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tstr_r,  tstr_w,  0xff00)
64   AM_RANGE(0xffff60, 0xffff61) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tsyr_r,  tsyr_w,  0x00ff)
65   AM_RANGE(0xffff62, 0xffff63) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tmdr_r,  tmdr_w,  0xff00)
66   AM_RANGE(0xffff62, 0xffff63) AM_DEVWRITE8(    "timer16",   h8_timer16_device,                  tolr_w,  0x00ff)
67   AM_RANGE(0xffff64, 0xffff65) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tisr_r,  tisr_w,  0xffff)
68   AM_RANGE(0xffff66, 0xffff67) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tisrc_r, tisrc_w, 0xff00)
69   AM_RANGE(0xffff68, 0xffff69) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
70   AM_RANGE(0xffff68, 0xffff69) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tior_r,  tior_w,  0x00ff)
71   AM_RANGE(0xffff6a, 0xffff6b) AM_DEVREADWRITE( "timer16:0", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
72   AM_RANGE(0xffff6c, 0xffff6f) AM_DEVREADWRITE( "timer16:0", h8_timer16_channel_device, tgr_r,   tgr_w          )
73   AM_RANGE(0xffff70, 0xffff71) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
74   AM_RANGE(0xffff70, 0xffff71) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tior_r,  tior_w,  0x00ff)
75   AM_RANGE(0xffff72, 0xffff73) AM_DEVREADWRITE( "timer16:1", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
76   AM_RANGE(0xffff74, 0xffff77) AM_DEVREADWRITE( "timer16:1", h8_timer16_channel_device, tgr_r,   tgr_w          )
77   AM_RANGE(0xffff78, 0xffff79) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
78   AM_RANGE(0xffff78, 0xffff79) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tior_r,  tior_w,  0x00ff)
79   AM_RANGE(0xffff7a, 0xffff7b) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
80   AM_RANGE(0xffff7c, 0xffff7f) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tgr_r,   tgr_w          )
81
82   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0",      h8_sci_device,             smr_r,   smr_w,   0xff00)
83   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0",      h8_sci_device,             brr_r,   brr_w,   0x00ff)
84   AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("sci0",      h8_sci_device,             scr_r,   scr_w,   0xff00)
85   AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("sci0",      h8_sci_device,             tdr_r,   tdr_w,   0x00ff)
86   AM_RANGE(0xffffb4, 0xffffb5) AM_DEVREADWRITE8("sci0",      h8_sci_device,             ssr_r,   ssr_w,   0xff00)
87   AM_RANGE(0xffffb4, 0xffffb5) AM_DEVREAD8(     "sci0",      h8_sci_device,             rdr_r,            0x00ff)
88   AM_RANGE(0xffffb6, 0xffffb7) AM_DEVREADWRITE8("sci0",      h8_sci_device,             scmr_r,  scmr_w,  0xff00)
89   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("sci1",      h8_sci_device,             smr_r,   smr_w,   0xff00)
90   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("sci1",      h8_sci_device,             brr_r,   brr_w,   0x00ff)
91   AM_RANGE(0xffffba, 0xffffbb) AM_DEVREADWRITE8("sci1",      h8_sci_device,             scr_r,   scr_w,   0xff00)
92   AM_RANGE(0xffffba, 0xffffbb) AM_DEVREADWRITE8("sci1",      h8_sci_device,             tdr_r,   tdr_w,   0x00ff)
93   AM_RANGE(0xffffbc, 0xffffbd) AM_DEVREADWRITE8("sci1",      h8_sci_device,             ssr_r,   ssr_w,   0xff00)
94   AM_RANGE(0xffffbc, 0xffffbd) AM_DEVREAD8(     "sci1",      h8_sci_device,             rdr_r,            0x00ff)
95   AM_RANGE(0xffffbe, 0xffffbf) AM_DEVREADWRITE8("sci1",      h8_sci_device,             scmr_r,  scmr_w,  0xff00)
96   AM_RANGE(0xffffd2, 0xffffd3) AM_DEVREADWRITE8("port4",     h8_port_device,            port_r,  dr_w,    0x00ff)
97   AM_RANGE(0xffffd4, 0xffffd5) AM_DEVREADWRITE8("port6",     h8_port_device,            port_r,  dr_w,    0x00ff)
98   AM_RANGE(0xffffd6, 0xffffd7) AM_DEVREADWRITE8("port7",     h8_port_device,            port_r,  dr_w,    0xff00)
99   AM_RANGE(0xffffd6, 0xffffd7) AM_DEVREADWRITE8("port8",     h8_port_device,            port_r,  dr_w,    0x00ff)
100   AM_RANGE(0xffffd8, 0xffffd9) AM_DEVREADWRITE8("port9",     h8_port_device,            port_r,  dr_w,    0xff00)
101   AM_RANGE(0xffffd8, 0xffffd9) AM_DEVREADWRITE8("porta",     h8_port_device,            port_r,  dr_w,    0x00ff)
102   AM_RANGE(0xffffda, 0xffffdb) AM_DEVREADWRITE8("portb",     h8_port_device,            port_r,  dr_w,    0xff00)
103
104   AM_RANGE(0xffffe0, 0xffffe7) AM_DEVREAD8(     "adc",       h8_adc_device,             addr8_r,          0xffff)
105   AM_RANGE(0xffffe8, 0xffffe9) AM_DEVREADWRITE8("adc",       h8_adc_device,             adcsr_r, adcsr_w, 0xff00)
106   AM_RANGE(0xffffe8, 0xffffe9) AM_DEVREADWRITE8("adc",       h8_adc_device,             adcr_r,  adcr_w,  0x00ff)
107ADDRESS_MAP_END
108
109machine_config_constructor h83008_device::device_mconfig_additions() const
110{
111   return MACHINE_CONFIG_NAME(h83008);
112}
113
114void h83008_device::execute_set_input(int inputnum, int state)
115{
116   intc->set_input(inputnum, state);
117}
118
119int h83008_device::trapa_setup()
120{
121   if(syscr & 0x08)
122      CCR |= F_I;
123   else
124      CCR |= F_I|F_UI;
125   return 8;
126}
127
128void h83008_device::irq_setup()
129{
130   if(syscr & 0x08)
131      CCR |= F_I;
132   else
133      CCR |= F_I|F_UI;
134}
135
136void h83008_device::update_irq_filter()
137{
138   switch(syscr & 0x08) {
139   case 0x00:
140      if((CCR & (F_I|F_UI)) == (F_I|F_UI))
141         intc->set_filter(2, -1);
142      else if(CCR & F_I)
143         intc->set_filter(1, -1);
144      else
145         intc->set_filter(0, -1);
146      break;
147   case 0x08:
148      if(CCR & F_I)
149         intc->set_filter(2, -1);
150      else
151         intc->set_filter(0, -1);
152      break;
153   }
154}
155
156void h83008_device::interrupt_taken()
157{
158   standard_irq_callback(intc->interrupt_taken(taken_irq_vector));
159}
160
161void h83008_device::internal_update(UINT64 current_time)
162{
163   UINT64 event_time = 0;
164
165   add_event(event_time, adc->internal_update(current_time));
166   add_event(event_time, sci0->internal_update(current_time));
167   add_event(event_time, sci1->internal_update(current_time));
168   add_event(event_time, timer16_0->internal_update(current_time));
169   add_event(event_time, timer16_1->internal_update(current_time));
170   add_event(event_time, timer16_2->internal_update(current_time));
171
172   recompute_bcount(event_time);
173}
174
175void h83008_device::device_start()
176{
177   h8h_device::device_start();
178}
179
180void h83008_device::device_reset()
181{
182   h8h_device::device_reset();
183   syscr = 0x09;
184}
185
186
187READ8_MEMBER(h83008_device::syscr_r)
188{
189   return syscr;
190}
191
192WRITE8_MEMBER(h83008_device::syscr_w)
193{
194   syscr = data;
195   update_irq_filter();
196   logerror("%s: syscr = %02x\n", tag(), data);
197}
Property changes on: shelves/new_menus/src/emu/cpu/h8/h83008.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
shelves/new_menus/src/emu/cpu/h8/h83008.h
r0r29305
1/***************************************************************************
2
3    h83008.h
4
5    H8/3008
6
7    H8/300H-based mcu.
8
9****************************************************************************
10
11    Copyright Olivier Galibert
12    All rights reserved.
13
14    Redistribution and use in source and binary forms, with or without
15    modification, are permitted provided that the following conditions are
16    met:
17
18        * Redistributions of source code must retain the above copyright
19          notice, this list of conditions and the following disclaimer.
20        * Redistributions in binary form must reproduce the above copyright
21          notice, this list of conditions and the following disclaimer in
22          the documentation and/or other materials provided with the
23          distribution.
24        * Neither the name 'MAME' nor the names of its contributors may be
25          used to endorse or promote products derived from this software
26          without specific prior written permission.
27
28    THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
29    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31    DISCLAIMED. IN NO EVENT SHALL OLIVIER GALIBERT BE LIABLE FOR ANY DIRECT,
32    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
37    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38    POSSIBILITY OF SUCH DAMAGE.
39
40***************************************************************************/
41
42#ifndef __H83008_H__
43#define __H83008_H__
44
45#include "h8h.h"
46#include "h8_adc.h"
47#include "h8_port.h"
48#include "h8_intc.h"
49#include "h8_sci.h"
50#include "h8_timer16.h"
51
52class h83008_device : public h8h_device {
53public:
54   h83008_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
55   h83008_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
56
57   DECLARE_READ8_MEMBER(syscr_r);
58   DECLARE_WRITE8_MEMBER(syscr_w);   
59
60protected:
61   required_device<h8h_intc_device> intc;
62   required_device<h8_adc_device> adc;
63   required_device<h8_port_device> port4;
64   required_device<h8_port_device> port6;
65   required_device<h8_port_device> port7;
66   required_device<h8_port_device> port8;
67   required_device<h8_port_device> port9;
68   required_device<h8_port_device> porta;
69   required_device<h8_port_device> portb;
70   required_device<h8_timer16_device> timer16;
71   required_device<h8h_timer16_channel_device> timer16_0;
72   required_device<h8h_timer16_channel_device> timer16_1;
73   required_device<h8h_timer16_channel_device> timer16_2;
74   required_device<h8_sci_device> sci0;
75   required_device<h8_sci_device> sci1;
76
77   UINT8 syscr;
78
79   virtual void update_irq_filter();
80   virtual void interrupt_taken();
81   virtual int trapa_setup();
82   virtual void irq_setup();
83   virtual void internal_update(UINT64 current_time);
84   virtual machine_config_constructor device_mconfig_additions() const;
85   DECLARE_ADDRESS_MAP(map, 16);
86
87   virtual void device_start();
88   virtual void device_reset();
89   virtual void execute_set_input(int inputnum, int state);
90};
91
92extern const device_type H83008;
93
94#endif
Property changes on: shelves/new_menus/src/emu/cpu/h8/h83008.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
shelves/new_menus/src/emu/devcb.c
r29304r29305
396396
397397
398398//-------------------------------------------------
399//  from_read8space - helper to convert from a device
400//  line read value to an 8-bit value
401//-------------------------------------------------
402
403UINT8 devcb_resolved_read8::from_read8space(offs_t offset, UINT8 mem_mask)
404{
405   return (*m_helper.read8_space)(*m_object.space, offset, 0xff);
406}
407
408
409//-------------------------------------------------
410399//  from_read8device - helper to convert from a device
411400//  line read value to an 8-bit value
412401//-------------------------------------------------
r29304r29305
546535
547536
548537//-------------------------------------------------
549//  to_write8space - helper to convert to an 8-bit
550//  memory read value from a line value
551//-------------------------------------------------
552
553void devcb_resolved_write8::to_write8space(offs_t offset, UINT8 data, UINT8 mem_mask)
554{
555   (*m_helper.write8_space)(*m_object.space, offset, data, mem_mask);
556}
557
558
559//-------------------------------------------------
560538//  to_write8device - helper to convert to an 8-bit
561539//  memory read value from a line value
562540//-------------------------------------------------
shelves/new_menus/src/emu/video/i8275x.c
r29304r29305
2525//  MACROS / CONSTANTS
2626//**************************************************************************
2727
28#define LOG 0
29
30
2831const int DMA_BURST_SPACING[] = { 0, 7, 15, 23, 31, 39, 47, 55 };
2932
33
3034#define DOUBLE_SPACED_ROWS \
3135   BIT(m_param[REG_SCN1], 7)
3236
r29304r29305
6670
6771
6872//**************************************************************************
69//  somethign
73//  DEVICE DEFINITIONS
7074//**************************************************************************
7175
7276// device type definition
7377const device_type I8275x = &device_creator<i8275x_device>;
7478
7579
80
7681//**************************************************************************
7782//  LIVE DEVICE
7883//**************************************************************************
r29304r29305
8186//  i8275x_device - constructor
8287//-------------------------------------------------
8388
84i8275x_device::i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
85   : device_t(mconfig, I8275x, "I8275", tag, owner, clock, "i8275x", __FILE__),
86      device_video_interface(mconfig, *this),
87      m_write_irq(*this),
88      m_write_drq(*this),
89      m_write_hrtc(*this),
90      m_write_vrtc(*this),
91      m_display_pixels(NULL),
92      m_status(0),
93      m_param_idx(0),
94      m_param_end(0),
95      m_buffer_idx(0),
96      m_fifo_next(false),
97      m_buffer_dma(0),
98      m_lpen(0),
99      m_hlgt(0),
100      m_vsp(0),
101      m_gpa(0),
102      m_rvv(0),
103      m_lten(0),
104      m_scanline(0),
105      m_du(false),
106      m_cursor_blink(0),
107      m_char_blink(0)
89i8275x_device::i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
90   device_t(mconfig, I8275x, "I8275", tag, owner, clock, "i8275x", __FILE__),
91   device_video_interface(mconfig, *this),
92   m_write_irq(*this),
93   m_write_drq(*this),
94   m_write_hrtc(*this),
95   m_write_vrtc(*this),
96   m_display_cb(NULL),
97   m_status(0),
98   m_param_idx(0),
99   m_param_end(0),
100   m_buffer_idx(0),
101   m_fifo_next(false),
102   m_buffer_dma(0),
103   m_lpen(0),
104   m_hlgt(0),
105   m_vsp(0),
106   m_gpa(0),
107   m_rvv(0),
108   m_lten(0),
109   m_scanline(0),
110   m_du(false),
111   m_cursor_blink(0),
112   m_char_blink(0)
108113{
109114}
110115
r29304r29305
173178   switch (id)
174179   {
175180   case TIMER_HRTC_ON:
176      //logerror("I8275 '%s' y %u x %u HRTC 1\n", tag(), y, x);
181      //if (LOG) logerror("I8275 '%s' y %u x %u HRTC 1\n", tag(), y, x);
177182      m_write_hrtc(1);
178183      break;
179184
180185   case TIMER_DRQ_ON:
181      //logerror("I8275 '%s' y %u x %u DRQ 1\n", tag(), y, x);
186      //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 1\n", tag(), y, x);
182187      m_write_drq(1);
183188      m_drq_off_timer->adjust(clocks_to_attotime(DMA_BURST_COUNT));
184189      break;
r29304r29305
188193      {
189194         m_status |= ST_DU;
190195         m_du = true;
191         //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
196         //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
192197         m_write_drq(0);
193198      }
194199      else if (m_buffer_idx == CHARACTERS_PER_ROW)
195200      {
196         //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
201         //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
197202         m_write_drq(0);
198203      }
199204      else if (DMA_BURST_SPACE > 0)
200205      {
201         //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
206         //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
202207         m_write_drq(0);
203208         m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE));
204209      }
r29304r29305
207212   case TIMER_SCANLINE:
208213      if (!(m_status & ST_VE)) break;
209214
210      //logerror("I8275 '%s' y %u x %u HRTC 0\n", tag(), y, x);
215      //if (LOG) logerror("I8275 '%s' y %u x %u HRTC 0\n", tag(), y, x);
211216      m_write_hrtc(0);
212217
213218      if (m_scanline == 0)
214219      {
215         //logerror("I8275 '%s' y %u x %u VRTC 0\n", tag(), y, x);
220         //if (LOG) logerror("I8275 '%s' y %u x %u VRTC 0\n", tag(), y, x);
216221         m_write_vrtc(0);
217222      }
218223      else if (m_scanline == m_irq_scanline)
219224      {
220225         if (m_status & ST_IE)
221226         {
222            //logerror("I8275 '%s' y %u x %u IRQ 1\n", tag(), y, x);
227            //if (LOG) logerror("I8275 '%s' y %u x %u IRQ 1\n", tag(), y, x);
223228            m_status |= ST_IR;
224229            m_write_irq(ASSERT_LINE);
225230         }
226231      }
227232      else if (m_scanline == m_vrtc_scanline)
228233      {
229         //logerror("I8275 '%s' y %u x %u VRTC 1\n", tag(), y, x);
234         //if (LOG) logerror("I8275 '%s' y %u x %u VRTC 1\n", tag(), y, x);
230235         m_write_vrtc(1);
231236
232237         // reset field attributes
r29304r29305
329334               lc = (lc - 1) & 0x0f;
330335            }
331336
332            if (m_display_pixels)
333            m_display_pixels(this, m_bitmap,
337            if (m_display_cb)
338            m_display_cb(this, m_bitmap,
334339               sx * m_hpixels_per_column, // x position on screen of starting point
335340               m_scanline, // y position on screen
336341               lc, // current line of char
r29304r29305
366371
367372      if (m_status & ST_IR)
368373      {
369         //logerror("I8275 '%s' IRQ 0\n", tag());
374         //if (LOG) logerror("I8275 '%s' IRQ 0\n", tag());
370375         m_write_irq(CLEAR_LINE);
371376      }
372377
r29304r29305
395400{
396401   if (offset & 0x01)
397402   {
398      logerror("I8275 '%s' Command %02x\n", tag(), data);
403      if (LOG) logerror("I8275 '%s' Command %02x\n", tag(), data);
399404
400405      switch (data >> 5)
401406      {
402407      case CMD_RESET:
403         logerror("I8275 '%s' Reset\n", tag());
408         if (LOG) logerror("I8275 '%s' Reset\n", tag());
404409
405410         m_status &= ~ST_IE;
406         logerror("I8275 '%s' IRQ 0\n", tag());
411         if (LOG) logerror("I8275 '%s' IRQ 0\n", tag());
407412         m_write_irq(CLEAR_LINE);
408413
409414         m_param_idx = REG_SCN1;
r29304r29305
413418      case CMD_START_DISPLAY:
414419         {
415420            m_param[REG_DMA] = data;
416            logerror("I8275 '%s' Start Display %u %u\n", tag(), DMA_BURST_COUNT, DMA_BURST_SPACE);
421            if (LOG) logerror("I8275 '%s' Start Display %u %u\n", tag(), DMA_BURST_COUNT, DMA_BURST_SPACE);
417422            m_status |= (ST_IE | ST_VE);
418423         }
419424         break;
420425
421426      case CMD_STOP_DISPLAY:
422         logerror("I8275 '%s' Stop Display\n", tag());
427         if (LOG) logerror("I8275 '%s' Stop Display\n", tag());
423428         m_status &= ~ST_VE;
424429         break;
425430
426431      case CMD_READ_LIGHT_PEN:
427         logerror("I8275 '%s' Read Light Pen\n", tag());
432         if (LOG) logerror("I8275 '%s' Read Light Pen\n", tag());
428433         m_param_idx = REG_LPEN_COL;
429434         m_param_end = REG_LPEN_ROW;
430435         break;
431436
432437      case CMD_LOAD_CURSOR:
433         logerror("I8275 '%s' Load Cursor\n", tag());
438         if (LOG) logerror("I8275 '%s' Load Cursor\n", tag());
434439         m_param_idx = REG_CUR_COL;
435440         m_param_end = REG_CUR_ROW;
436441         break;
437442
438443      case CMD_ENABLE_INTERRUPT:
439         logerror("I8275 '%s' Enable Interrupt\n", tag());
444         if (LOG) logerror("I8275 '%s' Enable Interrupt\n", tag());
440445         m_status |= ST_IE;
441446         break;
442447
443448      case CMD_DISABLE_INTERRUPT:
444         logerror("I8275 '%s' Disable Interrupt\n", tag());
449         if (LOG) logerror("I8275 '%s' Disable Interrupt\n", tag());
445450         m_status &= ~ST_IE;
446451         break;
447452
448453      case CMD_PRESET_COUNTERS:
449         logerror("I8275 '%s' Preset Counters\n", tag());
454         if (LOG) logerror("I8275 '%s' Preset Counters\n", tag());
450455         m_scanline = 0;
451456         break;
452457      }
453458   }
454459   else
455460   {
456      logerror("I8275 '%s' Parameter %02x\n", tag(), data);
461      if (LOG) logerror("I8275 '%s' Parameter %02x\n", tag(), data);
457462
458463      m_param[m_param_idx] = data;
459464
r29304r29305
473478
474479WRITE8_MEMBER( i8275x_device::dack_w )
475480{
476   //logerror("DACK write %02x %u\n", data, m_buffer_idx);
481   //if (LOG) logerror("DACK write %02x %u\n", data, m_buffer_idx);
477482
478483   if (m_fifo_next)
479484   {
r29304r29305
553558   int max_visible_x = (CHARACTERS_PER_ROW * m_hpixels_per_column) - 1;
554559   int max_visible_y = (CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW) - 1;
555560
556   logerror("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
561   if (LOG) logerror("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
557562
558563   rectangle visarea;
559564   visarea.set(0, max_visible_x, 0, max_visible_y);
shelves/new_menus/src/emu/video/i8275x.h
r29304r29305
4545//  INTERFACE CONFIGURATION MACROS
4646//**************************************************************************
4747
48#define MCFG_I8275_ADD(_tag, _clock, _hpixels_per_column, _display_func, _drq) \
49   MCFG_DEVICE_ADD(_tag, I8275x, _clock) \
50   downcast<i8275x_device *>(device)->set_hpixels_per_column(_hpixels_per_column); \
51   downcast<i8275x_device *>(device)->set_display_func(_display_func); \
52   downcast<i8275x_device *>(device)->set_drq_callback(DEVCB2_##_drq);
48#define MCFG_I8275_CHARACTER_WIDTH(_value) \
49   i8275x_device::static_set_character_width(*device, _value);
5350
54#define MCFG_I8275_IRQ_CALLBACK(_irq) \
55   downcast<i8275x_device *>(device)->set_irq_callback(DEVCB2_##_irq);
56#define MCFG_I8275_HRTC_CALLBACK(_hrtc) \
57   downcast<i8275x_device *>(device)->set_hrtc_callback(DEVCB2_##_hrtc);
58#define MCFG_I8275_VRTC_CALLBACK(_vrtc) \
59   downcast<i8275x_device *>(device)->set_vrtc_callback(DEVCB2_##_vrtc);
51#define MCFG_I8275_DISPLAY_CALLBACK(_func) \
52   i8275x_device::static_set_display_callback(*device, _func);
6053
54#define MCFG_I8275_DRQ_CALLBACK(_write) \
55   devcb = &i8275x_device::set_drq_wr_callback(*device, DEVCB2_##_write);
6156
57#define MCFG_I8275_IRQ_CALLBACK(_write) \
58   devcb = &i8275x_device::set_irq_wr_callback(*device, DEVCB2_##_write);
6259
60#define MCFG_I8275_HRTC_CALLBACK(_write) \
61   devcb = &i8275x_device::set_hrtc_wr_callback(*device, DEVCB2_##_write);
62
63#define MCFG_I8275_VRTC_CALLBACK(_write) \
64   devcb = &i8275x_device::set_vrtc_wr_callback(*device, DEVCB2_##_write);
65
66
67
68
6369//**************************************************************************
6470//  TYPE DEFINITIONS
6571//**************************************************************************
r29304r29305
8288   // construction/destruction
8389   i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
8490
85   template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
86   template<class _drq> void set_drq_callback(_drq drq) { m_write_drq.set_callback(drq); }
87   template<class _hrtc> void set_hrtc_callback(_hrtc hrtc) { m_write_hrtc.set_callback(hrtc); }
88   template<class _vrtc> void set_vrtc_callback(_vrtc vrtc) { m_write_vrtc.set_callback(vrtc); }
89   void set_hpixels_per_column(int hpixels_per_column) { m_hpixels_per_column = hpixels_per_column; }
90   void set_display_func(i8275_display_pixels_func func) { m_display_pixels = func; }
91   static void static_set_character_width(device_t &device, int value) { downcast<i8275x_device &>(device).m_hpixels_per_column = value; }
92   static void static_set_display_callback(device_t &device, i8275_display_pixels_func func) { downcast<i8275x_device &>(device).m_display_cb = func; }
9193
94   template<class _Object> static devcb2_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<i8275x_device &>(device).m_write_drq.set_callback(object); }
95   template<class _Object> static devcb2_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<i8275x_device &>(device).m_write_irq.set_callback(object); }
96   template<class _Object> static devcb2_base &set_hrtc_wr_callback(device_t &device, _Object object) { return downcast<i8275x_device &>(device).m_write_hrtc.set_callback(object); }
97   template<class _Object> static devcb2_base &set_vrtc_wr_callback(device_t &device, _Object object) { return downcast<i8275x_device &>(device).m_write_vrtc.set_callback(object); }
98
9299   DECLARE_READ8_MEMBER( read );
93100   DECLARE_WRITE8_MEMBER( write );
94101
r29304r29305
171178   devcb2_write_line   m_write_hrtc;
172179   devcb2_write_line   m_write_vrtc;
173180
174   i8275_display_pixels_func m_display_pixels;
181   i8275_display_pixels_func m_display_cb;
175182   int m_hpixels_per_column;
176183
177184   bitmap_rgb32 m_bitmap;
shelves/new_menus/src/emu/video/upd7220.c
r29304r29305
182182}
183183
184184
185//-------------------------------------------------
186//  device_config_complete - perform any
187//  operations now that the configuration is
188//  complete
189//-------------------------------------------------
190185
191void upd7220_device::device_config_complete()
192{
193   // inherit a copy of the static data
194   const upd7220_interface *intf = reinterpret_cast<const upd7220_interface *>(static_config());
195   if (intf != NULL)
196      *static_cast<upd7220_interface *>(this) = *intf;
197
198   // or initialize to defaults if none provided
199   else
200   {
201      memset(&m_out_drq_cb, 0, sizeof(m_out_drq_cb));
202      memset(&m_out_hsync_cb, 0, sizeof(m_out_hsync_cb));
203      memset(&m_out_vsync_cb, 0, sizeof(m_out_vsync_cb));
204      memset(&m_out_blank_cb, 0, sizeof(m_out_blank_cb));
205   }
206}
207
208
209
210186//**************************************************************************
211187//  INLINE HELPERS
212188//**************************************************************************
r29304r29305
681657//  upd7220_device - constructor
682658//-------------------------------------------------
683659
684upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
685   : device_t(mconfig, UPD7220, "uPD7220", tag, owner, clock, "upd7220", __FILE__),
686      device_memory_interface(mconfig, *this),
687      device_video_interface(mconfig, *this),
688      m_mask(0),
689      m_pitch(0),
690      m_ead(0),
691      m_dad(0),
692      m_lad(0),
693      m_ra_addr(0),
694      m_sr(UPD7220_SR_FIFO_EMPTY),
695      m_cr(0),
696      m_param_ptr(0),
697      m_fifo_ptr(-1),
698      m_fifo_dir(0),
699      m_mode(0),
700      m_draw_mode(0),
701      m_de(0),
702      m_m(0),
703      m_aw(0),
704      m_al(0),
705      m_vs(0),
706      m_vfp(0),
707      m_vbp(0),
708      m_hs(0),
709      m_hfp(0),
710      m_hbp(0),
711      m_dc(0),
712      m_sc(0),
713      m_br(0),
714      m_ctop(0),
715      m_cbot(0),
716      m_lr(0),
717      m_disp(0),
718      m_gchr(0),
719      m_bitmap_mod(0),
720      m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, NULL, *ADDRESS_MAP_NAME(upd7220_vram))
660upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
661   device_t(mconfig, UPD7220, "uPD7220", tag, owner, clock, "upd7220", __FILE__),
662   device_memory_interface(mconfig, *this),
663   device_video_interface(mconfig, *this),
664   m_write_drq(*this),
665   m_write_hsync(*this),
666   m_write_vsync(*this),
667   m_write_blank(*this),
668   m_mask(0),
669   m_pitch(0),
670   m_ead(0),
671   m_dad(0),
672   m_lad(0),
673   m_ra_addr(0),
674   m_sr(UPD7220_SR_FIFO_EMPTY),
675   m_cr(0),
676   m_param_ptr(0),
677   m_fifo_ptr(-1),
678   m_fifo_dir(0),
679   m_mode(0),
680   m_draw_mode(0),
681   m_de(0),
682   m_m(0),
683   m_aw(0),
684   m_al(0),
685   m_vs(0),
686   m_vfp(0),
687   m_vbp(0),
688   m_hs(0),
689   m_hfp(0),
690   m_hbp(0),
691   m_dc(0),
692   m_sc(0),
693   m_br(0),
694   m_ctop(0),
695   m_cbot(0),
696   m_lr(0),
697   m_disp(0),
698   m_gchr(0),
699   m_bitmap_mod(0),
700   m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, NULL, *ADDRESS_MAP_NAME(upd7220_vram))
721701{
722702   for (int i = 0; i < 16; i++)
723703   {
r29304r29305
748728
749729void upd7220_device::device_start()
750730{
731   // resolve callbacks
732   m_display_cb.bind_relative_to(*owner());
733   m_draw_text_cb.bind_relative_to(*owner());
734
735   m_write_drq.resolve_safe();
736   m_write_hsync.resolve_safe();
737   m_write_vsync.resolve_safe();
738   m_write_blank.resolve_safe();
739
751740   // allocate timers
752741   m_vsync_timer = timer_alloc(TIMER_VSYNC);
753742   m_hsync_timer = timer_alloc(TIMER_HSYNC);
754743   m_blank_timer = timer_alloc(TIMER_BLANK);
755744
756   // resolve callbacks
757   m_out_drq_func.resolve(m_out_drq_cb, *this);
758   m_out_hsync_func.resolve(m_out_hsync_cb, *this);
759   m_out_vsync_func.resolve(m_out_vsync_cb, *this);
760   m_out_blank_func.resolve(m_out_blank_cb, *this);
761
762745   // register for state saving
763746   save_item(NAME(m_ra));
764747   save_item(NAME(m_sr));
r29304r29305
795778
796779void upd7220_device::device_reset()
797780{
798   m_out_drq_func(CLEAR_LINE);
781   m_write_drq(CLEAR_LINE);
799782}
800783
801784
r29304r29305
817800         m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
818801      }
819802
820      m_out_hsync_func(param);
803      m_write_hsync(param);
821804
822805      update_hsync_timer(param);
823806      break;
r29304r29305
832815         m_sr &= ~UPD7220_SR_VSYNC_ACTIVE;
833816      }
834817
835      m_out_vsync_func(param);
818      m_write_vsync(param);
836819
837820      update_vsync_timer(param);
838821      break;
r29304r29305
847830         m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
848831      }
849832
850      m_out_blank_func(param);
833      m_write_blank(param);
851834
852835      update_blank_timer(param);
853836      break;
r29304r29305
15561539      {
15571540         addr = sad + (y * m_pitch);
15581541
1559         if (m_draw_text_cb)
1560            m_draw_text_cb(this, bitmap, addr, y, wd, m_pitch, m_lr, m_dc, m_ead);
1542         if (!m_draw_text_cb.isnull())
1543            m_draw_text_cb(bitmap, addr, y, wd, m_pitch, m_lr, m_dc, m_ead);
15611544      }
15621545
15631546      sy = y + 1;
r29304r29305
15761559   for (sx = 0; sx < 80; sx++)
15771560   {
15781561      if((sx << 3) < m_aw * 16 && y < m_al)
1579         m_display_cb(this, bitmap, y, sx << 3, addr);
1562         m_display_cb(bitmap, y, sx << 3, addr);
15801563
15811564      addr+= wd + 1;
15821565   }
r29304r29305
16131596                     Dragon Buster (PC-98xx) contradicts with Xevious with regards of the pitch tho ... */
16141597            addr = ((sad << 1) & 0x3ffff) + (y * m_pitch * 2);
16151598
1616            if (m_display_cb)
1599            if (!m_display_cb.isnull())
16171600               draw_graphics_line(bitmap, addr, y + bsy/((m_pitch == 40)+1), wd);
16181601         }
16191602      }
r29304r29305
16271610            {
16281611               addr = (sad & 0x3ffff) + ((y / m_lr) * m_pitch);
16291612
1630               if (m_draw_text_cb)
1631                  m_draw_text_cb(this, bitmap, addr, (y + tsy) / m_lr, wd, m_pitch, m_lr, m_dc, m_ead);
1613               if (!m_draw_text_cb.isnull())
1614                  m_draw_text_cb(bitmap, addr, (y + tsy) / m_lr, wd, m_pitch, m_lr, m_dc, m_ead);
16321615            }
16331616         }
16341617      }
shelves/new_menus/src/emu/video/upd7220.h
r29304r29305
4040
4141
4242//**************************************************************************
43//  MACROS / CONSTANTS
43//  INTERFACE CONFIGURATION MACROS
4444//**************************************************************************
4545
46#define UPD7220_DISPLAY_PIXELS_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int y, int x, UINT32 address)
47#define UPD7220_DRAW_TEXT_LINE_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)
4648
4749
50#define MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(_class, _method) \
51   upd7220_device::static_set_display_pixels_callback(*device, upd7220_display_pixels_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
4852
49//**************************************************************************
50//  INTERFACE CONFIGURATION MACROS
51//**************************************************************************
53#define MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(_class, _method) \
54   upd7220_device::static_set_draw_text_callback(*device, upd7220_draw_text_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
5255
53#define MCFG_UPD7220_ADD(_tag, _clock, _config, _map) \
54   MCFG_DEVICE_ADD(_tag, UPD7220, _clock) \
55   MCFG_DEVICE_CONFIG(_config) \
56   MCFG_DEVICE_ADDRESS_MAP(AS_0, _map)
56#define MCFG_UPD7220_DRQ_CALLBACK(_write) \
57   devcb = &upd7220_device::set_drq_wr_callback(*device, DEVCB2_##_write);
5758
58#define UPD7220_INTERFACE(name) \
59   const upd7220_interface (name) =
59#define MCFG_UPD7220_HSYNC_CALLBACK(_write) \
60   devcb = &upd7220_device::set_hsync_wr_callback(*device, DEVCB2_##_write);
6061
62#define MCFG_UPD7220_VSYNC_CALLBACK(_write) \
63   devcb = &upd7220_device::set_vsync_wr_callback(*device, DEVCB2_##_write);
6164
65#define MCFG_UPD7220_BLANK_CALLBACK(_write) \
66   devcb = &upd7220_device::set_blank_wr_callback(*device, DEVCB2_##_write);
6267
68
69
6370//**************************************************************************
6471//  TYPE DEFINITIONS
6572//**************************************************************************
6673
67typedef void (*upd7220_display_pixels_func)(device_t *device, bitmap_rgb32 &bitmap, int y, int x, UINT32 address);
68#define UPD7220_DISPLAY_PIXELS(name) void name(device_t *device, bitmap_rgb32 &bitmap, int y, int x, UINT32 address)
74typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, UINT32 address)> upd7220_display_pixels_delegate;
75typedef device_delegate<void (bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)> upd7220_draw_text_delegate;
6976
70typedef void (*upd7220_draw_text_line)(device_t *device, bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr);
71#define UPD7220_DRAW_TEXT_LINE(name) void name(device_t *device, bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)
7277
73
74// ======================> upd7220_interface
75
76struct upd7220_interface
77{
78   upd7220_display_pixels_func m_display_cb;
79   upd7220_draw_text_line m_draw_text_cb;
80
81   devcb_write_line        m_out_drq_cb;
82   devcb_write_line        m_out_hsync_cb;
83   devcb_write_line        m_out_vsync_cb;
84   devcb_write_line        m_out_blank_cb;
85};
86
8778// ======================> upd7220_device
8879
8980class upd7220_device :  public device_t,
9081                  public device_memory_interface,
91                  public device_video_interface,
92                  public upd7220_interface
82                  public device_video_interface
9383{
9484public:
9585   // construction/destruction
9686   upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9787
88   static void static_set_display_pixels_callback(device_t &device, upd7220_display_pixels_delegate callback) { downcast<upd7220_device &>(device).m_display_cb = callback; }
89   static void static_set_draw_text_callback(device_t &device, upd7220_draw_text_delegate callback) { downcast<upd7220_device &>(device).m_draw_text_cb = callback; }
90
91   template<class _Object> static devcb2_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_drq.set_callback(object); }
92   template<class _Object> static devcb2_base &set_hsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_hsync.set_callback(object); }
93   template<class _Object> static devcb2_base &set_vsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_vsync.set_callback(object); }
94   template<class _Object> static devcb2_base &set_blank_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_blank.set_callback(object); }
95
9896   DECLARE_READ8_MEMBER( read );
9997   DECLARE_WRITE8_MEMBER( write );
10098
r29304r29305
117115   virtual void device_start();
118116   virtual void device_reset();
119117   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
120   virtual void device_config_complete();
121118
122119private:
123   static const device_timer_id TIMER_VSYNC = 0;
124   static const device_timer_id TIMER_HSYNC = 1;
125   static const device_timer_id TIMER_BLANK = 2;
120   enum
121   {
122      TIMER_VSYNC,
123      TIMER_HSYNC,
124      TIMER_BLANK
125   };
126126
127127   inline UINT8 readbyte(offs_t address);
128128   inline void writebyte(offs_t address, UINT8 data);
r29304r29305
153153   void draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd);
154154   void update_graphics(bitmap_rgb32 &bitmap, const rectangle &cliprect, int force_bitmap);
155155
156   devcb_resolved_write_line   m_out_drq_func;
157   devcb_resolved_write_line   m_out_hsync_func;
158   devcb_resolved_write_line   m_out_vsync_func;
159   devcb_resolved_write_line   m_out_blank_func;
156   upd7220_display_pixels_delegate      m_display_cb;
157   upd7220_draw_text_delegate         m_draw_text_cb;
160158
159   devcb2_write_line   m_write_drq;
160   devcb2_write_line   m_write_hsync;
161   devcb2_write_line   m_write_vsync;
162   devcb2_write_line   m_write_blank;
163
161164   UINT16 m_mask;                  // mask register
162165   UINT8 m_pitch;                  // number of word addresses in display memory in the horizontal direction
163166   UINT32 m_ead;                   // execute word address
shelves/new_menus/src/emu/video/bufsprite.c
r29304r29305
2121extern const device_type BUFFERED_SPRITERAM16 = &device_creator<buffered_spriteram16_device>;
2222extern const device_type BUFFERED_SPRITERAM32 = &device_creator<buffered_spriteram32_device>;
2323extern const device_type BUFFERED_SPRITERAM64 = &device_creator<buffered_spriteram64_device>;
24
25
26
27/* ----- sprite buffering ----- */
28
29/* buffered sprite RAM write handlers */
30WRITE8_HANDLER( buffer_spriteram_w ) { }
31WRITE16_HANDLER( buffer_spriteram16_w ) { }
32WRITE32_HANDLER( buffer_spriteram32_w ) { }
33WRITE8_HANDLER( buffer_spriteram_2_w ) { }
34WRITE16_HANDLER( buffer_spriteram16_2_w ) { }
35WRITE32_HANDLER( buffer_spriteram32_2_w ) { }
36
37/* perform the actual buffering */
38void buffer_spriteram(running_machine &machine, UINT8 *ptr, int length) { }
39void buffer_spriteram_2(running_machine &machine, UINT8 *ptr, int length) { }
shelves/new_menus/src/emu/video/stvvdp1.c
r29304r29305
429429}
430430
431431#ifdef UNUSED_FUNCTION
432WRITE32_HANDLER ( saturn_vdp1_framebuffer1_w )
432WRITE32_MEMBER ( saturn_state::saturn_vdp1_framebuffer1_w )
433433{
434434   //popmessage ("STV VDP1 Framebuffer 1 WRITE offset %08x data %08x",offset, data);
435435}
436436
437READ32_HANDLER ( saturn_vdp1_framebuffer1_r )
437READ32_MEMBER ( saturn_state::saturn_vdp1_framebuffer1_r )
438438{
439439   //popmessage ("STV VDP1 Framebuffer 1 READ offset %08x",offset);
440440   return 0xffff;
shelves/new_menus/src/emu/devcb.h
r29304r29305
3434        write_line_device_func: (device, data)
3535        read8_device_func:      (device, offset)
3636        write8_device_func:     (device, offset, data)
37        read8_space_func:       (space, offset)
38        write8_space_func:      (space, offset, data)
3937        read16_device_func:     (device, offset)
4038        write16_device_func:    (device, offset, data)
41        read16_space_func:      (space, offset)
42        write16_space_func:     (space, offset, data)
4339        read32_device_func:     (device, offset)
4440        write32_device_func:    (device, offset, data)
45        read32_space_func:      (space, offset)
46        write32_space_func:     (space, offset, data)
4741        read64_device_func:     (device, offset)
4842        write64_device_func:    (device, offset, data)
49        read64_space_func:      (space, offset)
50        write64_space_func:     (space, offset, data)
5143
5244***************************************************************************/
5345
r29304r29305
165157#define DEVCB_NULL                              { DEVCB_TYPE_NULL }
166158
167159// line or read/write handlers for the driver device
168#define DEVCB_DRIVER_LINE_MEMBER(cls,memb)      { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
169#define DEVCB_DRIVER_MEMBER(cls,memb)           { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, NULL, &devcb_stub<cls, &cls::memb>, NULL }
170#define DEVCB_DRIVER_MEMBER16(cls,memb)         { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, NULL, &devcb_stub16<cls, &cls::memb>, NULL }
171#define DEVCB_DRIVER_MEMBER32(cls,memb)         { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, NULL, &devcb_stub32<cls, &cls::memb>, NULL }
172//#define DEVCB_DRIVER_MEMBER64(cls,memb)         { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, NULL, &devcb_stub64<cls, &cls::memb>, NULL }
160#define DEVCB_DRIVER_LINE_MEMBER(cls,memb)      { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, &devcb_line_stub<cls, &cls::memb>, NULL }
161#define DEVCB_DRIVER_MEMBER(cls,memb)           { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, NULL, &devcb_stub<cls, &cls::memb> }
162#define DEVCB_DRIVER_MEMBER16(cls,memb)         { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, NULL, &devcb_stub16<cls, &cls::memb> }
163#define DEVCB_DRIVER_MEMBER32(cls,memb)         { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, NULL, &devcb_stub32<cls, &cls::memb> }
164//#define DEVCB_DRIVER_MEMBER64(cls,memb)         { DEVCB_TYPE_DEVICE, 0, ":", #cls "::" #memb, NULL, &devcb_stub64<cls, &cls::memb> }
173165
174166// line or read/write handlers for another device
175#define DEVCB_DEVICE_LINE_MEMBER(tag,cls,memb)  { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
176#define DEVCB_DEVICE_MEMBER(tag,cls,memb)       { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, NULL, &devcb_stub<cls, &cls::memb>, NULL }
177#define DEVCB_DEVICE_MEMBER16(tag,cls,memb)     { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, NULL, &devcb_stub16<cls, &cls::memb>, NULL }
178#define DEVCB_DEVICE_MEMBER32(tag,cls,memb)     { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, NULL, &devcb_stub32<cls, &cls::memb>, NULL }
179//#define DEVCB_DEVICE_MEMBER64(tag,cls,memb)     { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, NULL, &devcb_stub64<cls, &cls::memb>, NULL }
167#define DEVCB_DEVICE_LINE_MEMBER(tag,cls,memb)  { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, &devcb_line_stub<cls, &cls::memb>, NULL }
168#define DEVCB_DEVICE_MEMBER(tag,cls,memb)       { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, NULL, &devcb_stub<cls, &cls::memb> }
169#define DEVCB_DEVICE_MEMBER16(tag,cls,memb)     { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, NULL, &devcb_stub16<cls, &cls::memb> }
170#define DEVCB_DEVICE_MEMBER32(tag,cls,memb)     { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, NULL, &devcb_stub32<cls, &cls::memb> }
171//#define DEVCB_DEVICE_MEMBER64(tag,cls,memb)     { DEVCB_TYPE_DEVICE, 0, tag, #cls "::" #memb, NULL, &devcb_stub64<cls, &cls::memb> }
180172
181173// constant values
182#define DEVCB_CONSTANT(value)                   { DEVCB_TYPE_CONSTANT, value, NULL, NULL, NULL, NULL }
174#define DEVCB_CONSTANT(value)                   { DEVCB_TYPE_CONSTANT, value, NULL, NULL, NULL }
183175#define DEVCB_LINE_GND                          DEVCB_CONSTANT(0)
184176#define DEVCB_LINE_VCC                          DEVCB_CONSTANT(1)
185177
186#define DEVCB_UNMAPPED                          { DEVCB_TYPE_UNMAP, 0, NULL, NULL, NULL, NULL }
178#define DEVCB_UNMAPPED                          { DEVCB_TYPE_UNMAP, 0, NULL, NULL, NULL }
187179
188180// read handlers for an I/O port by tag
189#define DEVCB_INPUT_PORT(tag)                   { DEVCB_TYPE_IOPORT, 0, (tag), NULL, NULL, NULL, NULL }
181#define DEVCB_INPUT_PORT(tag)                   { DEVCB_TYPE_IOPORT, 0, (tag), NULL, NULL, NULL }
190182
191183// write handlers for a CPU input line
192#define DEVCB_CPU_INPUT_LINE(tag,line)          { DEVCB_TYPE_INPUT_LINE, (line), (tag), NULL, NULL, NULL, NULL }
184#define DEVCB_CPU_INPUT_LINE(tag,line)          { DEVCB_TYPE_INPUT_LINE, (line), (tag), NULL, NULL, NULL }
193185
194186
195187
r29304r29305
218210   UINT8 *                 null_indicator;
219211   read_line_device_func   read_line;
220212   read8_device_func       read8_device;
221   read8_space_func        read8_space;
222213   read16_device_func      read16_device;
223   read16_space_func       read16_space;
224214   read32_device_func      read32_device;
225   read32_space_func       read32_space;
226215   read64_device_func      read64_device;
227   read64_space_func       read64_space;
228216};
229217
230218union devcb_resolved_write_helpers
r29304r29305
232220   UINT8 *                 null_indicator;
233221   write_line_device_func  write_line;
234222   write8_device_func      write8_device;
235   write8_space_func       write8_space;
236223   write16_device_func     write16_device;
237   write16_space_func      write16_space;
238224   write32_device_func     write32_device;
239   write32_space_func      write32_space;
240225   write64_device_func     write64_device;
241   write64_space_func      write64_space;
242226   int                     input_line;
243227};
244228
r29304r29305
254238   const char *            name;           // name of the target function
255239   read_line_device_func   readline;       // read line function
256240   read8_device_func       readdevice;     // read device function
257   read8_space_func        readspace;      // read space function
258241};
259242
260243
r29304r29305
304287   const char *            name;           // name of the target function
305288   write_line_device_func  writeline;      // write line function
306289   write8_device_func      writedevice;    // write device function
307   write8_space_func       writespace;     // write space function
308290};
309291
310292
r29304r29305
355337   const char *            name;           // name of the target function
356338   read_line_device_func   readline;       // read line function
357339   read8_device_func       readdevice;     // read device function
358   read8_space_func        readspace;      // read space function
359340};
360341
361342
r29304r29305
386367private:
387368   // internal helpers
388369   UINT8 from_port(offs_t offset, UINT8 mem_mask);
389   UINT8 from_read8space(offs_t offset, UINT8 mem_mask);
390370   UINT8 from_read8device(offs_t offset, UINT8 mem_mask);
391371   UINT8 from_readline(offs_t offset, UINT8 mem_mask);
392372   UINT8 from_constant(offs_t offset, UINT8 mem_mask);
r29304r29305
410390   const char *            name;           // name of the target function
411391   write_line_device_func  writeline;      // write line function
412392   write8_device_func      writedevice;    // write device function
413   write8_space_func       writespace;     // write space function
414393};
415394
416395
r29304r29305
442421   // internal helpers
443422   void to_null(offs_t offset, UINT8 data, UINT8 mem_mask);
444423   void to_port(offs_t offset, UINT8 data, UINT8 mem_mask);
445   void to_write8space(offs_t offset, UINT8 data, UINT8 mem_mask);
446424   void to_write8device(offs_t offset, UINT8 data, UINT8 mem_mask);
447425   void to_writeline(offs_t offset, UINT8 data, UINT8 mem_mask);
448426   void to_input(offs_t offset, UINT8 data, UINT8 mem_mask);
r29304r29305
466444   const char *            name;           // name of the target function
467445   read_line_device_func   readline;       // read line function
468446   read16_device_func      readdevice;     // read device function
469   read16_space_func       readspace;      // read space function
470447};
471448
472449
r29304r29305
520497   const char *            name;           // name of the target function
521498   write_line_device_func  writeline;      // write line function
522499   write16_device_func     writedevice;    // write device function
523   write16_space_func      writespace;     // write space function
524500};
525501
526502
r29304r29305
574550   const char *            name;           // name of the target function
575551   read_line_device_func   readline;       // read line function
576552   read32_device_func      readdevice;     // read device function
577   read32_space_func       readspace;      // read space function
578553};
579554
580555
r29304r29305
628603   const char *            name;           // name of the target function
629604   write_line_device_func  writeline;      // write line function
630605   write32_device_func     writedevice;    // write device function
631   write32_space_func      writespace;     // write space function
632606};
633607
634608
r29304r29305
682656   const char *            name;           // name of the target function
683657   read_line_device_func   readline;       // read line function
684658   read64_device_func      readdevice;     // read device function
685   read64_space_func       readspace;      // read space function
686659};
687660
688661
r29304r29305
736709   const char *            name;           // name of the target function
737710   write_line_device_func  writeline;      // write line function
738711   write64_device_func     writedevice;    // write device function
739   write64_space_func      writespace;     // write space function
740712};
741713
742714
Property changes on: shelves/new_menus
Modified: svn:mergeinfo
   Merged /trunk:r29181-29216

Previous 199869 Revisions Next


© 1997-2024 The MAME Team