@@ -154,15 +154,18 @@ JC-301-00 W11 9510K7059 23C16000 U85
154154*/
155155
156156#include " emu.h"
157+
158+ #include " kaneko_rlespr.h"
159+ #include " kaneko_tmap.h"
160+ #include " kaneko_toybox.h"
161+
157162#include " cpu/m68000/m68000.h"
158163#include " machine/eepromser.h"
159164#include " machine/nvram.h"
160165#include " machine/timer.h"
161166#include " machine/watchdog.h"
162167#include " sound/ymz280b.h"
163- #include " sknsspr.h"
164- #include " kaneko_tmap.h"
165- #include " kaneko_toybox.h"
168+
166169#include " emupal.h"
167170#include " screen.h"
168171#include " speaker.h"
@@ -194,11 +197,14 @@ class jchan_state : public driver_device
194197
195198 void init_jchan ();
196199
200+ protected:
201+ virtual void video_start () override ATTR_COLD;
202+
197203private:
198204 required_device<cpu_device> m_maincpu;
199205 required_device<cpu_device> m_subcpu;
200206 required_device<palette_device> m_palette;
201- required_device_array<sknsspr_device , 2 > m_spritegen;
207+ required_device_array<kaneko_rlespr_device , 2 > m_spritegen;
202208 required_device<kaneko_view2_tilemap_device> m_view2;
203209
204210 required_shared_ptr_array<u16 , 2 > m_spriteram;
@@ -211,24 +217,21 @@ class jchan_state : public driver_device
211217 required_ioport m_io_system;
212218 required_ioport m_io_extra;
213219
214- std::unique_ptr<bitmap_ind16> m_sprite_bitmap[2 ];
215220 std::unique_ptr<u32 []> m_sprite_ram32[2 ];
216221 std::unique_ptr<u32 []> m_sprite_regs32[2 ];
217- int m_irq_sub_enable;
222+ bool m_irq_sub_enable = false ;
218223
219224 void ctrl_w (u16 data);
220225 u16 ctrl_r (offs_t offset);
221226 void main2sub_cmd_w (offs_t offset, u16 data, u16 mem_mask = ~0 );
222227 void sub2main_cmd_w (offs_t offset, u16 data, u16 mem_mask = ~0 );
223- template <int Chip> void sknsspr_sprite32regs_w (offs_t offset, u16 data, u16 mem_mask = ~0 );
224-
225- virtual void video_start () override ATTR_COLD;
228+ template <int Chip> void spriteregs_w (offs_t offset, u16 data, u16 mem_mask = ~0 );
226229
227230 u32 screen_update (screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
228231
229232 TIMER_DEVICE_CALLBACK_MEMBER (vblank);
230- void jchan_main (address_map &map) ATTR_COLD;
231- void jchan_sub (address_map &map) ATTR_COLD;
233+ void main_map (address_map &map) ATTR_COLD;
234+ void sub_map (address_map &map) ATTR_COLD;
232235};
233236
234237
@@ -280,7 +283,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(jchan_state::vblank)
280283
281284void jchan_state::video_start ()
282285{
283- /* so we can use sknsspr .cpp */
286+ /* so we can use kaneko/kaneko_rlespr .cpp */
284287 for (int chip = 0 ; chip < 2 ; chip++)
285288 {
286289 const u32 size = m_spriteram[chip].bytes () / 4 ;
@@ -291,12 +294,6 @@ void jchan_state::video_start()
291294 m_sprite_regs32[0 ] = std::make_unique<u32 []>(0x40 /4 );
292295 m_sprite_regs32[1 ] = std::make_unique<u32 []>(0x40 /4 );
293296
294- m_sprite_bitmap[0 ] = std::make_unique<bitmap_ind16>(1024 ,1024 );
295- m_sprite_bitmap[1 ] = std::make_unique<bitmap_ind16>(1024 ,1024 );
296-
297- m_spritegen[0 ]->skns_sprite_kludge (0 ,0 );
298- m_spritegen[1 ]->skns_sprite_kludge (0 ,0 );
299-
300297 save_item (NAME (m_irq_sub_enable));
301298 save_pointer (NAME (m_sprite_regs32[0 ]), 0x40 /4 );
302299 save_pointer (NAME (m_sprite_regs32[1 ]), 0x40 /4 );
@@ -318,16 +315,16 @@ u32 jchan_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons
318315
319316 for (int chip = 0 ; chip < 2 ; chip++)
320317 {
321- m_spritegen[chip]->skns_draw_sprites (*m_sprite_bitmap[chip], cliprect, m_sprite_ram32[chip].get (), 0x4000 , m_sprite_regs32[chip].get ());
318+ m_spritegen[chip]->draw_sprites ( cliprect, m_sprite_ram32[chip].get (), 0x4000 , m_sprite_regs32[chip].get ());
322319 }
323320
324321 bitmap_ind8 *tile_primap = &screen.priority ();
325322
326323 // TODO : verify sprite-tile priorities from real hardware, Check what 15 bit of palette actually working
327324 for (int y = cliprect.min_y ; y <= cliprect.max_y ; y++)
328325 {
329- u16 const *const src1 = &m_sprite_bitmap [0 ]->pix (y);
330- u16 const *const src2 = &m_sprite_bitmap [1 ]->pix (y);
326+ u16 const *const src1 = &m_spritegen [0 ]->bitmap (). pix (y);
327+ u16 const *const src2 = &m_spritegen [1 ]->bitmap (). pix (y);
331328 u8 *const tilepri = &tile_primap->pix (y);
332329 u16 *const dst = &bitmap.pix (y);
333330
@@ -408,7 +405,7 @@ u32 jchan_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons
408405
409406void jchan_state::ctrl_w (u16 data)
410407{
411- m_irq_sub_enable = data & 0x8000 ; // hack / guess!
408+ m_irq_sub_enable = BIT ( data, 15 ) ; // hack / guess!
412409}
413410
414411u16 jchan_state::ctrl_r (offs_t offset)
@@ -419,7 +416,10 @@ u16 jchan_state::ctrl_r(offs_t offset)
419416 case 2 /2 : return m_io_p2->read ();
420417 case 4 /2 : return m_io_system->read ();
421418 case 6 /2 : return m_io_extra->read ();
422- default : logerror (" ctrl_r unknown!" ); break ;
419+ default :
420+ if (!machine ().side_effects_disabled ())
421+ logerror (" %s: ctrl_r unknown!" , machine ().describe_context ());
422+ break ;
423423 }
424424 return m_ctrl[offset];
425425}
@@ -446,15 +446,15 @@ void jchan_state::sub2main_cmd_w(offs_t offset, u16 data, u16 mem_mask)
446446
447447/* ram convert for suprnova (requires 32-bit stuff) */
448448template <int Chip>
449- void jchan_state::sknsspr_sprite32regs_w (offs_t offset, u16 data, u16 mem_mask)
449+ void jchan_state::spriteregs_w (offs_t offset, u16 data, u16 mem_mask)
450450{
451451 COMBINE_DATA (&m_sprregs[Chip][offset]);
452452 offset >>= 1 ;
453453 m_sprite_regs32[Chip][offset] = (m_sprregs[Chip][offset * 2 + 1 ] << 16 ) | (m_sprregs[Chip][offset * 2 ]);
454454}
455455
456456
457- void jchan_state::jchan_main (address_map &map)
457+ void jchan_state::main_map (address_map &map)
458458{
459459 map (0x000000 , 0x1fffff ).rom ();
460460 map (0x200000 , 0x20ffff ).ram (); // Work RAM - [A] grid tested, cleared ($9d6-$a54)
@@ -470,7 +470,7 @@ void jchan_state::jchan_main(address_map &map)
470470
471471 /* 1st sprite layer */
472472 map (0x500000 , 0x503fff ).ram ().share (" spriteram_1" );
473- map (0x600000 , 0x60003f ).ram ().w (FUNC (jchan_state::sknsspr_sprite32regs_w <0 >)).share (" sprregs_1" );
473+ map (0x600000 , 0x60003f ).ram ().w (FUNC (jchan_state::spriteregs_w <0 >)).share (" sprregs_1" );
474474
475475 map (0x700000 , 0x70ffff ).ram ().w (m_palette, FUNC (palette_device::write16)).share (" palette" ); // palette
476476
@@ -480,7 +480,7 @@ void jchan_state::jchan_main(address_map &map)
480480}
481481
482482
483- void jchan_state::jchan_sub (address_map &map)
483+ void jchan_state::sub_map (address_map &map)
484484{
485485 map (0x000000 , 0x0fffff ).rom ();
486486 map (0x100000 , 0x10ffff ).ram (); // Work RAM - grid tested, cleared ($612-$6dc)
@@ -493,7 +493,7 @@ void jchan_state::jchan_sub(address_map &map)
493493
494494 /* background sprites */
495495 map (0x700000 , 0x703fff ).ram ().share (" spriteram_2" );
496- map (0x780000 , 0x78003f ).ram ().w (FUNC (jchan_state::sknsspr_sprite32regs_w <1 >)).share (" sprregs_2" );
496+ map (0x780000 , 0x78003f ).ram ().w (FUNC (jchan_state::spriteregs_w <1 >)).share (" sprregs_2" );
497497
498498 map (0x800000 , 0x800003 ).w (" ymz" , FUNC (ymz280b_device::write)).umask16 (0x00ff ); // sound
499499
@@ -590,11 +590,11 @@ INPUT_PORTS_END
590590void jchan_state::jchan(machine_config &config)
591591{
592592 M68000 (config, m_maincpu, 16000000 );
593- m_maincpu->set_addrmap (AS_PROGRAM , &jchan_state::jchan_main );
593+ m_maincpu->set_addrmap (AS_PROGRAM , &jchan_state::main_map );
594594 TIMER (config, " scantimer" ).configure_scanline (FUNC (jchan_state::vblank), " screen" , 0 , 1 );
595595
596596 M68000 (config, m_subcpu, 16000000 );
597- m_subcpu->set_addrmap (AS_PROGRAM , &jchan_state::jchan_sub );
597+ m_subcpu->set_addrmap (AS_PROGRAM , &jchan_state::sub_map );
598598
599599 WATCHDOG_TIMER (config, " watchdog" );
600600
@@ -611,7 +611,11 @@ void jchan_state::jchan(machine_config &config)
611611 m_view2->set_palette (m_palette);
612612
613613 for (auto &spritegen : m_spritegen)
614- SKNS_SPRITE (config, spritegen, 0 );
614+ {
615+ KANEKO_RLESPR (config, spritegen, 0 );
616+ spritegen->set_screen (" screen" );
617+ spritegen->set_sprite_kludge (0 , 0 );
618+ }
615619
616620 KANEKO_TOYBOX (config, " toybox" , " eeprom" , " DSW1" , " mcuram" , " mcudata" );
617621
0 commit comments