diff options
author | Angelo Salese <angelosa@users.noreply.github.com> | 2013-02-07 15:25:11 +0000 |
---|---|---|
committer | Angelo Salese <angelosa@users.noreply.github.com> | 2013-02-07 15:25:11 +0000 |
commit | 8dac4c4e557c4131791e7a181653d40c4284c7a1 (patch) | |
tree | c71841da07ebf735bde02772416662f962d951ac /src/mame | |
parent | 5c4b336b040184c0a51bc9781ad49b06b32ac7e2 (diff) |
State-ized CD block, and finished state-izing VDP1, thanks to OG & Micko
Diffstat (limited to 'src/mame')
-rw-r--r-- | src/mame/drivers/saturn.c | 24 | ||||
-rw-r--r-- | src/mame/includes/stv.h | 187 | ||||
-rw-r--r-- | src/mame/machine/stvcd.c | 263 | ||||
-rw-r--r-- | src/mame/machine/stvcd.h | 11 | ||||
-rw-r--r-- | src/mame/video/stvvdp1.c | 115 |
5 files changed, 301 insertions, 299 deletions
diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c index d1e17e4f5d7..0f08997463a 100644 --- a/src/mame/drivers/saturn.c +++ b/src/mame/drivers/saturn.c @@ -781,7 +781,7 @@ static ADDRESS_MAP_START( saturn_mem, AS_PROGRAM, 32, saturn_state ) // AM_RANGE(0x02400000, 0x027fffff) AM_RAM //cart RAM area, dynamically allocated // AM_RANGE(0x04000000, 0x047fffff) AM_RAM //backup RAM area, dynamically allocated AM_RANGE(0x04fffffc, 0x04ffffff) AM_READ8(saturn_cart_type_r,0x000000ff) - AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE_LEGACY(stvcd_r, stvcd_w) + AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE(stvcd_r, stvcd_w) /* Sound */ AM_RANGE(0x05a00000, 0x05a7ffff) AM_READWRITE16(saturn_soundram_r, saturn_soundram_w,0xffffffff) AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16_LEGACY("scsp", scsp_r, scsp_w, 0xffffffff) @@ -810,7 +810,7 @@ static ADDRESS_MAP_START( stv_mem, AS_PROGRAM, 32, saturn_state ) AM_RANGE(0x01000000, 0x017fffff) AM_WRITE(minit_w) AM_RANGE(0x01800000, 0x01ffffff) AM_WRITE(sinit_w) AM_RANGE(0x02000000, 0x04ffffff) AM_ROM AM_SHARE("share7") AM_REGION("abus", 0) // cartridge - AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE_LEGACY(stvcd_r, stvcd_w) + AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE(stvcd_r, stvcd_w) /* Sound */ AM_RANGE(0x05a00000, 0x05afffff) AM_READWRITE16(saturn_soundram_r, saturn_soundram_w,0xffffffff) AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16_LEGACY("scsp", scsp_r, scsp_w, 0xffffffff) @@ -930,13 +930,13 @@ INPUT_CHANGED_MEMBER(saturn_state::nmi_reset) INPUT_CHANGED_MEMBER(saturn_state::tray_open) { if(newval) - stvcd_set_tray_open(machine()); + stvcd_set_tray_open(); } INPUT_CHANGED_MEMBER(saturn_state::tray_close) { if(newval) - stvcd_set_tray_close(machine()); + stvcd_set_tray_close(); } static INPUT_PORTS_START( saturn ) @@ -1797,7 +1797,7 @@ MACHINE_START_MEMBER(saturn_state,stv) stv_register_protection_savestates(machine()); // machine/stvprot.c - machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(stvcd_exit), &machine())); + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(saturn_state::stvcd_exit), this)); m_smpc.rtc_data[0] = DectoBCD(systime.local_time.year /100); m_smpc.rtc_data[1] = DectoBCD(systime.local_time.year %100); @@ -1842,7 +1842,7 @@ MACHINE_START_MEMBER(saturn_state,saturn) state_save_register_global_array(machine(), m_smpc.SMEM); state_save_register_global_pointer(machine(), m_cart_dram, 0x400000/4); - machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(stvcd_exit), &machine())); + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(saturn_state::stvcd_exit), this)); m_smpc.rtc_data[0] = DectoBCD(systime.local_time.year /100); m_smpc.rtc_data[1] = DectoBCD(systime.local_time.year %100); @@ -2062,7 +2062,7 @@ MACHINE_RESET_MEMBER(saturn_state,saturn) machine().device("maincpu")->set_unscaled_clock(MASTER_CLOCK_320/2); machine().device("slave")->set_unscaled_clock(MASTER_CLOCK_320/2); - stvcd_reset( machine() ); + stvcd_reset(); m_cart_type = ioport("CART_AREA")->read() & 7; @@ -2138,7 +2138,7 @@ MACHINE_RESET_MEMBER(saturn_state,stv) machine().device("maincpu")->set_unscaled_clock(MASTER_CLOCK_320/2); machine().device("slave")->set_unscaled_clock(MASTER_CLOCK_320/2); - stvcd_reset(machine()); + stvcd_reset(); m_stv_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1)); m_prev_bankswitch = 0xff; @@ -2213,8 +2213,8 @@ static MACHINE_CONFIG_START( saturn, saturn_state ) MCFG_NVRAM_HANDLER(saturn) - MCFG_TIMER_ADD("sector_timer", stv_sector_cb) - MCFG_TIMER_ADD("sh1_cmd", stv_sh1_sim) + MCFG_TIMER_DRIVER_ADD("sector_timer", saturn_state, stv_sector_cb) + MCFG_TIMER_DRIVER_ADD("sh1_cmd", saturn_state, stv_sh1_sim) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2296,8 +2296,8 @@ static MACHINE_CONFIG_START( stv, saturn_state ) MCFG_EEPROM_93C46_ADD("eeprom") /* Actually 93c45 */ - MCFG_TIMER_ADD("sector_timer", stv_sector_cb) - MCFG_TIMER_ADD("sh1_cmd", stv_sh1_sim) + MCFG_TIMER_DRIVER_ADD("sector_timer", saturn_state, stv_sector_cb) + MCFG_TIMER_DRIVER_ADD("sh1_cmd", saturn_state, stv_sh1_sim) /* video hardware */ MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index 0c529332ec3..a107dc549f2 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -1,4 +1,9 @@ /*----------- defined in drivers/stv.c -----------*/ +#include "cdrom.h" + +#define MAX_FILTERS (24) +#define MAX_BLOCKS (200) +#define MAX_DIR_SIZE (256*1024) class saturn_state : public driver_device { @@ -284,12 +289,12 @@ public: int y2s(int v); void vdp1_fill_quad(const rectangle &cliprect, int patterndata, int xsize, const struct spoint *q); void vdp1_fill_line(const rectangle &cliprect, int patterndata, int xsize, INT32 y, INT32 x1, INT32 x2, INT32 u1, INT32 u2, INT32 v1, INT32 v2); -// void (*drawpixel)(int x, int y, int patterndata, int offsetcnt); -// void drawpixel_poly(int x, int y, int patterndata, int offsetcnt); -// void drawpixel_8bpp_trans(int x, int y, int patterndata, int offsetcnt); -// void drawpixel_4bpp_notrans(int x, int y, int patterndata, int offsetcnt); -// void drawpixel_4bpp_trans(int x, int y, int patterndata, int offsetcnt); -// void drawpixel_generic(int x, int y, int patterndata, int offsetcnt); + void (saturn_state::*drawpixel)(int x, int y, int patterndata, int offsetcnt); + void drawpixel_poly(int x, int y, int patterndata, int offsetcnt); + void drawpixel_8bpp_trans(int x, int y, int patterndata, int offsetcnt); + void drawpixel_4bpp_notrans(int x, int y, int patterndata, int offsetcnt); + void drawpixel_4bpp_trans(int x, int y, int patterndata, int offsetcnt); + void drawpixel_generic(int x, int y, int patterndata, int offsetcnt); void vdp1_fill_slope(const rectangle &cliprect, int patterndata, int xsize, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2, INT32 u1, INT32 u2, INT32 slu1, INT32 slu2, INT32 *nu1, INT32 *nu2, @@ -515,7 +520,163 @@ public: } stv_rbg_cache_data; + /* stvcd */ + DECLARE_READ32_MEMBER( stvcd_r ); + DECLARE_WRITE32_MEMBER( stvcd_w ); + + TIMER_DEVICE_CALLBACK_MEMBER( stv_sector_cb ); + TIMER_DEVICE_CALLBACK_MEMBER( stv_sh1_sim ); + + struct direntryT + { + UINT8 record_size; + UINT8 xa_record_size; + UINT32 firstfad; // first sector of file + UINT32 length; // length of file + UINT8 year; + UINT8 month; + UINT8 day; + UINT8 hour; + UINT8 minute; + UINT8 second; + UINT8 gmt_offset; + UINT8 flags; // iso9660 flags + UINT8 file_unit_size; + UINT8 interleave_gap_size; + UINT16 volume_sequencer_number; + UINT8 name[128]; + }; + + struct filterT + { + UINT8 mode; + UINT8 chan; + UINT8 smmask; + UINT8 cimask; + UINT8 fid; + UINT8 smval; + UINT8 cival; + UINT8 condtrue; + UINT8 condfalse; + UINT32 fad; + UINT32 range; + }; + + struct blockT + { + INT32 size; // size of block + INT32 FAD; // FAD on disc + UINT8 data[CD_MAX_SECTOR_DATA]; + UINT8 chan; // channel + UINT8 fnum; // file number + UINT8 subm; // subchannel mode + UINT8 cinf; // coding information + }; + + struct partitionT + { + INT32 size; + blockT *blocks[MAX_BLOCKS]; + UINT8 bnum[MAX_BLOCKS]; + UINT8 numblks; + }; + + // 16-bit transfer types + enum transT + { + XFERTYPE_INVALID, + XFERTYPE_TOC, + XFERTYPE_FILEINFO_1, + XFERTYPE_FILEINFO_254, + XFERTYPE_SUBQ, + XFERTYPE_SUBRW + }; + + // 32-bit transfer types + enum trans32T + { + XFERTYPE32_INVALID, + XFERTYPE32_GETSECTOR, + XFERTYPE32_GETDELETESECTOR + }; + + void stvcd_reset(void); + void stvcd_exit(void); + void stvcd_set_tray_open(void); + void stvcd_set_tray_close(void); + + int get_track_index(void); + void cr_standard_return(UINT16 cur_status); + void cd_free_block(blockT *blktofree); + void cd_defragblocks(partitionT *part); + void cd_getsectoroffsetnum(UINT32 bufnum, UINT32 *sectoffs, UINT32 *sectnum); + + UINT16 cd_readWord(UINT32 addr); + void cd_writeWord(UINT32 addr, UINT16 data); + UINT32 cd_readLong(UINT32 addr); + + void cd_readTOC(void); + void cd_readblock(UINT32 fad, UINT8 *dat); + void cd_playdata(void); + + void cd_exec_command( void ); + // iso9660 utilities + void make_dir_current(UINT32 fad); + void read_new_dir(UINT32 fileno); + + blockT *cd_alloc_block(UINT8 *blknum); + partitionT *cd_filterdata(filterT *flt, int trktype, UINT8 *p_ok); + partitionT *cd_read_filtered_sector(INT32 fad, UINT8 *p_ok); + + cdrom_file *cdrom;// = (cdrom_file *)NULL; + + // local variables + timer_device *sector_timer; + timer_device *sh1_timer; + partitionT partitions[MAX_FILTERS]; + partitionT *transpart; + + blockT blocks[MAX_BLOCKS]; + blockT curblock; + + UINT8 tocbuf[102*4]; + UINT8 subqbuf[5*2]; + UINT8 subrwbuf[12*2]; + UINT8 finfbuf[256]; + + INT32 sectlenin, sectlenout; + + UINT8 lastbuf, playtype; + + transT xfertype; + trans32T xfertype32; + UINT32 xfercount, calcsize; + UINT32 xferoffs, xfersect, xfersectpos, xfersectnum, xferdnum; + + filterT filters[MAX_FILTERS]; + filterT *cddevice; + int cddevicenum; + + UINT16 cr1, cr2, cr3, cr4; + UINT16 hirqmask, hirqreg; + UINT16 cd_stat; + UINT32 cd_curfad;// = 0; + UINT32 fadstoplay;// = 0; + UINT32 in_buffer;// = 0; // amount of data in the buffer + int oddframe;// = 0; + int buffull, sectorstore, freeblocks; + int cur_track; + UINT8 cmd_pending; + UINT8 cd_speed; + UINT8 cdda_maxrepeat; + UINT8 cdda_repeat_count; + UINT8 tray_is_closed; + + direntryT curroot; // root entry of current filesystem + direntryT *curdir; // current directory + int numfiles; // # of entries in current directory + int firstfile; // first non-directory file }; #define MASTER_CLOCK_352 57272720 @@ -552,12 +713,12 @@ void install_stvbios_speedups(running_machine &machine); /*----------- defined in video/stvvdp1.c -----------*/ -extern UINT16 **stv_framebuffer_display_lines; -extern int stv_framebuffer_double_interlace; -extern int stv_framebuffer_mode; -extern UINT8* stv_vdp1_gfx_decode; +//extern UINT16 **stv_framebuffer_display_lines; +//extern int stv_framebuffer_double_interlace; +//extern int stv_framebuffer_mode; +//extern UINT8* stv_vdp1_gfx_decode; -int stv_vdp1_start ( running_machine &machine ); -void video_update_vdp1(running_machine &machine); -void stv_vdp2_dynamic_res_change(running_machine &machine); +//int stv_vdp1_start ( running_machine &machine ); +//void video_update_vdp1(running_machine &machine); +//void stv_vdp2_dynamic_res_change(running_machine &machine); diff --git a/src/mame/machine/stvcd.c b/src/mame/machine/stvcd.c index 044dcf01e98..04be6fc89df 100644 --- a/src/mame/machine/stvcd.c +++ b/src/mame/machine/stvcd.c @@ -23,6 +23,7 @@ #include "emu.h" #include "imagedev/chd_cd.h" +#include "includes/stv.h" #include "cdrom.h" #include "stvcd.h" #include "sound/cdda.h" @@ -36,140 +37,6 @@ #define CDROM_LOG(x) #endif -static cdrom_file *cdrom = (cdrom_file *)NULL; - -static void cd_readTOC(void); -static void cd_readblock(UINT32 fad, UINT8 *dat); -static void cd_playdata(running_machine &machine); - -#define MAX_FILTERS (24) -#define MAX_BLOCKS (200) -#define MAX_DIR_SIZE (256*1024) - -struct direntryT -{ - UINT8 record_size; - UINT8 xa_record_size; - UINT32 firstfad; // first sector of file - UINT32 length; // length of file - UINT8 year; - UINT8 month; - UINT8 day; - UINT8 hour; - UINT8 minute; - UINT8 second; - UINT8 gmt_offset; - UINT8 flags; // iso9660 flags - UINT8 file_unit_size; - UINT8 interleave_gap_size; - UINT16 volume_sequencer_number; - UINT8 name[128]; -}; - -struct filterT -{ - UINT8 mode; - UINT8 chan; - UINT8 smmask; - UINT8 cimask; - UINT8 fid; - UINT8 smval; - UINT8 cival; - UINT8 condtrue; - UINT8 condfalse; - UINT32 fad; - UINT32 range; -}; - -struct blockT -{ - INT32 size; // size of block - INT32 FAD; // FAD on disc - UINT8 data[CD_MAX_SECTOR_DATA]; - UINT8 chan; // channel - UINT8 fnum; // file number - UINT8 subm; // subchannel mode - UINT8 cinf; // coding information -}; - -struct partitionT -{ - INT32 size; - blockT *blocks[MAX_BLOCKS]; - UINT8 bnum[MAX_BLOCKS]; - UINT8 numblks; -}; - -// 16-bit transfer types -enum transT -{ - XFERTYPE_INVALID, - XFERTYPE_TOC, - XFERTYPE_FILEINFO_1, - XFERTYPE_FILEINFO_254, - XFERTYPE_SUBQ, - XFERTYPE_SUBRW -}; - -// 32-bit transfer types -enum trans32T -{ - XFERTYPE32_INVALID, - XFERTYPE32_GETSECTOR, - XFERTYPE32_GETDELETESECTOR -}; - -// local variables -static timer_device *sector_timer; -static timer_device *sh1_timer; -static partitionT partitions[MAX_FILTERS]; -static partitionT *transpart; - -static blockT blocks[MAX_BLOCKS]; -static blockT curblock; - -static UINT8 tocbuf[102*4]; -static UINT8 subqbuf[5*2]; -static UINT8 subrwbuf[12*2]; -static UINT8 finfbuf[256]; - -static INT32 sectlenin, sectlenout; - -static UINT8 lastbuf, playtype; - -static transT xfertype; -static trans32T xfertype32; -static UINT32 xfercount, calcsize; -static UINT32 xferoffs, xfersect, xfersectpos, xfersectnum, xferdnum; - -static filterT filters[MAX_FILTERS]; -static filterT *cddevice; -static int cddevicenum; - -static UINT16 cr1, cr2, cr3, cr4; -static UINT16 hirqmask, hirqreg; -static UINT16 cd_stat; -static UINT32 cd_curfad = 0; -static UINT32 fadstoplay = 0; -static UINT32 in_buffer = 0; // amount of data in the buffer -static int oddframe = 0; -static int buffull, sectorstore, freeblocks; -static int cur_track; -static UINT8 cmd_pending; -static UINT8 cd_speed; -static UINT8 cdda_maxrepeat; -static UINT8 cdda_repeat_count; -static UINT8 tray_is_closed; - -// iso9660 utilities -static void read_new_dir(running_machine &machine, UINT32 fileno); -static void make_dir_current(running_machine &machine, UINT32 fad); - -static direntryT curroot; // root entry of current filesystem -static direntryT *curdir; // current directory -static int numfiles; // # of entries in current directory -static int firstfile; // first non-directory file - // HIRQ definitions #define CMOK 0x0001 // command dispatch possible #define DRDY 0x0002 // data transfer preparations complete @@ -205,7 +72,7 @@ static int firstfile; // first non-directory file #define CD_STAT_REJECT 0xff00 // ultra-fatal error. /* FIXME: assume Saturn CD-ROMs to have a 2 secs pre-gap for now. */ -static int get_track_index(void) +int saturn_state::get_track_index(void) { UINT32 rel_fad; UINT8 track; @@ -223,7 +90,7 @@ static int get_track_index(void) return 1; } -static void cr_standard_return(UINT16 cur_status) +void saturn_state::cr_standard_return(UINT16 cur_status) { cr1 = cur_status | (playtype << 7) | 0x00 | (cdda_repeat_count & 0xf); //options << 4 | repeat & 0xf cr2 = (cur_track == 0xff) ? 0xffff : (cdrom_get_adr_control(cdrom, cur_track)<<8 | cur_track); // TODO: fix current track @@ -232,11 +99,7 @@ static void cr_standard_return(UINT16 cur_status) cd_stat |= CD_STAT_PERI; } -static void cd_free_block(blockT *blktofree); -static void cd_defragblocks(partitionT *part); -static void cd_getsectoroffsetnum(UINT32 bufnum, UINT32 *sectoffs, UINT32 *sectnum); - -static void cd_exec_command(running_machine &machine) +void saturn_state::cd_exec_command( void ) { UINT32 temp; @@ -537,7 +400,7 @@ static void cd_exec_command(running_machine &machine) // cdda if(cdrom_get_track_type(cdrom, cdrom_get_track(cdrom, cd_curfad)) == CD_TRACK_AUDIO) { - cdda_pause_audio( machine.device( "cdda" ), 0 ); + cdda_pause_audio( machine().device( "cdda" ), 0 ); //cdda_start_audio( machine.device( "cdda" ), cd_curfad, fadstoplay ); //cdda_repeat_count = 0; } @@ -564,7 +427,7 @@ static void cd_exec_command(running_machine &machine) if (temp == 0xffffff) { cd_stat = CD_STAT_PAUSE; - cdda_pause_audio( machine.device( "cdda" ), 1 ); + cdda_pause_audio( machine().device( "cdda" ), 1 ); } else { @@ -580,7 +443,7 @@ static void cd_exec_command(running_machine &machine) cd_stat = CD_STAT_PAUSE; cur_track = cr2>>8;; cd_curfad = cdrom_get_track_start(cdrom, cur_track-1); - cdda_pause_audio( machine.device( "cdda" ), 1 ); + cdda_pause_audio( machine().device( "cdda" ), 1 ); // (index is cr2 low byte) } else // error! @@ -588,7 +451,7 @@ static void cd_exec_command(running_machine &machine) cd_stat = CD_STAT_STANDBY; cd_curfad = 0xffffffff; cur_track = 0xff; - cdda_stop_audio( machine.device( "cdda" ) ); //stop any pending CD-DA + cdda_stop_audio( machine().device( "cdda" ) ); //stop any pending CD-DA } } @@ -1224,7 +1087,7 @@ static void cd_exec_command(running_machine &machine) temp = (cr3&0xff)<<16; temp |= cr4; - read_new_dir(machine, temp); + read_new_dir(temp); cr_standard_return(cd_stat); break; @@ -1240,7 +1103,7 @@ static void cd_exec_command(running_machine &machine) cddevice = (filterT *)NULL; /* TODO: */ - //read_new_dir(machine, read_dir - 2); + //read_new_dir(read_dir - 2); cr_standard_return(cd_stat); hirqreg |= (CMOK|EFLS); @@ -1387,13 +1250,13 @@ static void cd_exec_command(running_machine &machine) } } -TIMER_DEVICE_CALLBACK( stv_sh1_sim ) +TIMER_DEVICE_CALLBACK_MEMBER( saturn_state::stv_sh1_sim ) { sh1_timer->adjust(attotime::from_hz(16667)); if((cmd_pending == 0xf) && (!(hirqreg & CMOK))) { - cd_exec_command(timer.machine()); + cd_exec_command(); return; } @@ -1408,13 +1271,13 @@ TIMER_DEVICE_CALLBACK( stv_sh1_sim ) } } -TIMER_DEVICE_CALLBACK( stv_sector_cb ) +TIMER_DEVICE_CALLBACK_MEMBER( saturn_state::stv_sector_cb ) { //sector_timer->reset(); //popmessage("%08x %08x %d %d",cd_curfad,fadstoplay,cmd_pending,cd_speed); - cd_playdata(timer.machine()); + cd_playdata(); if(cdrom_get_track_type(cdrom, cdrom_get_track(cdrom, cd_curfad)) == CD_TRACK_AUDIO) sector_timer->adjust(attotime::from_hz(75)); // 75 sectors / second = 150kBytes/second (cdda track ignores cd_speed setting) @@ -1423,7 +1286,7 @@ TIMER_DEVICE_CALLBACK( stv_sector_cb ) } // global functions -void stvcd_reset(running_machine &machine) +void saturn_state::stvcd_reset( void ) { INT32 i, j; @@ -1438,7 +1301,7 @@ void stvcd_reset(running_machine &machine) cur_track = 0xff; if (curdir != (direntryT *)NULL) - auto_free(machine, curdir); + auto_free(machine(), curdir); curdir = (direntryT *)NULL; // no directory yet xfertype = XFERTYPE_INVALID; @@ -1480,7 +1343,7 @@ void stvcd_reset(running_machine &machine) cdrom = (cdrom_file *)NULL; } - cdrom_image_device *cddevice = machine.device<cdrom_image_device>("cdrom"); + cdrom_image_device *cddevice = machine().device<cdrom_image_device>("cdrom"); if (cddevice!=NULL) { // MESS case @@ -1489,15 +1352,15 @@ void stvcd_reset(running_machine &machine) else { // MAME case - cdrom = cdrom_open(get_disk_handle(machine, "cdrom")); + cdrom = cdrom_open(get_disk_handle(machine(), "cdrom")); } - cdda_set_cdrom( machine.device("cdda"), cdrom ); + cdda_set_cdrom( machine().device("cdda"), cdrom ); if (cdrom) { CDROM_LOG(("Opened CD-ROM successfully, reading root directory\n")) - read_new_dir(machine, 0xffffff); // read root directory + read_new_dir(0xffffff); // read root directory } else { @@ -1508,13 +1371,13 @@ void stvcd_reset(running_machine &machine) cdda_repeat_count = 0; tray_is_closed = 1; - sector_timer = machine.device<timer_device>("sector_timer"); + sector_timer = machine().device<timer_device>("sector_timer"); sector_timer->adjust(attotime::from_hz(150)); // 150 sectors / second = 300kBytes/second - sh1_timer = machine.device<timer_device>("sh1_cmd"); + sh1_timer = machine().device<timer_device>("sh1_cmd"); sh1_timer->adjust(attotime::from_hz(16667)); } -static blockT *cd_alloc_block(UINT8 *blknum) +saturn_state::blockT *saturn_state::cd_alloc_block(UINT8 *blknum) { INT32 i; @@ -1542,7 +1405,7 @@ static blockT *cd_alloc_block(UINT8 *blknum) return (blockT *)NULL; } -static void cd_free_block(blockT *blktofree) +void saturn_state::cd_free_block(blockT *blktofree) { INT32 i; @@ -1567,7 +1430,7 @@ static void cd_free_block(blockT *blktofree) hirqreg &= ~BFUL; } -static void cd_getsectoroffsetnum(UINT32 bufnum, UINT32 *sectoffs, UINT32 *sectnum) +void saturn_state::cd_getsectoroffsetnum(UINT32 bufnum, UINT32 *sectoffs, UINT32 *sectnum) { if (*sectoffs == 0xffff) { @@ -1580,7 +1443,7 @@ static void cd_getsectoroffsetnum(UINT32 bufnum, UINT32 *sectoffs, UINT32 *sectn } } -static void cd_defragblocks(partitionT *part) +void saturn_state::cd_defragblocks(partitionT *part) { UINT32 i, j; blockT *temp; @@ -1604,7 +1467,7 @@ static void cd_defragblocks(partitionT *part) } } -static UINT16 cd_readWord(UINT32 addr) +UINT16 saturn_state::cd_readWord(UINT32 addr) { UINT16 rv; @@ -1758,7 +1621,7 @@ static UINT16 cd_readWord(UINT32 addr) } -static UINT32 cd_readLong(UINT32 addr) +UINT32 saturn_state::cd_readLong(UINT32 addr) { UINT32 rv = 0; @@ -1773,10 +1636,10 @@ static UINT32 cd_readLong(UINT32 addr) if (xfersect < xfersectnum) { // get next longword - rv = transpart->blocks[xfersectpos+xfersect]->data[xferoffs]<<24 | - transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 1]<<16 | - transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 2]<<8 | - transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 3]; + rv = (transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 0]<<24) | + (transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 1]<<16) | + (transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 2]<<8) | + (transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 3]<<0); xferdnum += 4; xferoffs += 4; @@ -1831,13 +1694,13 @@ static UINT32 cd_readLong(UINT32 addr) } } -static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data) +void saturn_state::cd_writeWord(UINT32 addr, UINT16 data) { switch(addr & 0xffff) { case 0x0008: case 0x000a: -// CDROM_LOG(("%s:WW HIRQ: %04x & %04x => %04x\n", machine.describe_context(), hirqreg, data, hirqreg & data)) +// CDROM_LOG(("%s:WW HIRQ: %04x & %04x => %04x\n", machine().describe_context(), hirqreg, data, hirqreg & data)) hirqreg &= data; if(!(hirqreg & CMOK)) { @@ -1853,26 +1716,26 @@ static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data) return; case 0x0018: case 0x001a: -// CDROM_LOG(("WW CR1: %04x\n", data)) +// CDROM_LOG(("WW CR1: %04x\n", data)) cr1 = data; cd_stat &= ~CD_STAT_PERI; cmd_pending |= 1; break; case 0x001c: case 0x001e: -// CDROM_LOG(("WW CR2: %04x\n", data)) +// CDROM_LOG(("WW CR2: %04x\n", data)) cr2 = data; cmd_pending |= 2; break; case 0x0020: case 0x0022: -// CDROM_LOG(("WW CR3: %04x\n", data)) +// CDROM_LOG(("WW CR3: %04x\n", data)) cr3 = data; cmd_pending |= 4; break; case 0x0024: case 0x0026: -// CDROM_LOG(("WW CR4: %04x\n", data)) +// CDROM_LOG(("WW CR4: %04x\n", data)) cr4 = data; cmd_pending |= 8; break; @@ -1882,7 +1745,7 @@ static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data) } } -READ32_HANDLER( stvcd_r ) +READ32_MEMBER( saturn_state::stvcd_r ) { UINT32 rv = 0; @@ -1934,7 +1797,7 @@ READ32_HANDLER( stvcd_r ) return rv; } -WRITE32_HANDLER( stvcd_w ) +WRITE32_MEMBER( saturn_state::stvcd_w ) { offset <<= 2; @@ -1952,7 +1815,7 @@ WRITE32_HANDLER( stvcd_w ) case 0x90022: case 0x90024: case 0x90026: - cd_writeWord(space.machine(), offset, data>>16); + cd_writeWord(offset, data>>16); break; default: @@ -1962,7 +1825,7 @@ WRITE32_HANDLER( stvcd_w ) } // iso9660 parsing -static void read_new_dir(running_machine &machine, UINT32 fileno) +void saturn_state::read_new_dir(UINT32 fileno) { int foundpd, i; UINT32 cfad;//, dirfad; @@ -2029,7 +1892,7 @@ static void read_new_dir(running_machine &machine, UINT32 fileno) } // done with all that, read the root directory now - make_dir_current(machine, curroot.firstfad); + make_dir_current(curroot.firstfad); } } else @@ -2038,12 +1901,12 @@ static void read_new_dir(running_machine &machine, UINT32 fileno) { mame_printf_error("ERROR: new directory too big (%d)!\n", curdir[fileno].length); } - make_dir_current(machine, curdir[fileno].firstfad); + make_dir_current(curdir[fileno].firstfad); } } // makes the directory pointed to by FAD current -static void make_dir_current(running_machine &machine, UINT32 fad) +void saturn_state::make_dir_current(UINT32 fad) { int i; UINT32 nextent, numentries; @@ -2077,10 +1940,10 @@ static void make_dir_current(running_machine &machine, UINT32 fad) if (curdir != (direntryT *)NULL) { - auto_free(machine, curdir); + auto_free(machine(), curdir); } - curdir = auto_alloc_array(machine, direntryT, numentries); + curdir = auto_alloc_array(machine(), direntryT, numentries); curentry = curdir; numfiles = numentries; @@ -2149,17 +2012,17 @@ static void make_dir_current(running_machine &machine, UINT32 fad) free(sect); } -void stvcd_exit(running_machine& machine) +void saturn_state::stvcd_exit( void ) { if (curdir != (direntryT *)NULL) { - auto_free(machine, curdir); + auto_free(machine(), curdir); curdir = (direntryT *)NULL; } if (cdrom) { - cdrom_image_device *cddevice = machine.device<cdrom_image_device>("cdrom"); + cdrom_image_device *cddevice = machine().device<cdrom_image_device>("cdrom"); if (cddevice==NULL) { cdrom_close(cdrom); @@ -2168,7 +2031,7 @@ void stvcd_exit(running_machine& machine) } } -static void cd_readTOC(void) +void saturn_state::cd_readTOC(void) { int i, ntrks, tocptr, fad; @@ -2258,7 +2121,7 @@ static void cd_readTOC(void) tocbuf[tocptr+11] = fad&0xff; } -static partitionT *cd_filterdata(filterT *flt, int trktype, UINT8 *p_ok) +saturn_state::partitionT *saturn_state::cd_filterdata(filterT *flt, int trktype, UINT8 *p_ok) { int match = 1, keepgoing = 2; partitionT *filterprt = (partitionT *)NULL; @@ -2411,7 +2274,7 @@ static partitionT *cd_filterdata(filterT *flt, int trktype, UINT8 *p_ok) } // read a single sector off the CD, applying the current filter(s) as necessary -static partitionT *cd_read_filtered_sector(INT32 fad, UINT8 *p_ok) +saturn_state::partitionT *saturn_state::cd_read_filtered_sector(INT32 fad, UINT8 *p_ok) { int trktype; @@ -2460,7 +2323,7 @@ static partitionT *cd_read_filtered_sector(INT32 fad, UINT8 *p_ok) } // loads in data set up by a CD-block PLAY command -static void cd_playdata(running_machine &machine) +void saturn_state::cd_playdata( void ) { if ((cd_stat & 0x0f00) == CD_STAT_PLAY) { @@ -2475,12 +2338,12 @@ static void cd_playdata(running_machine &machine) if(cdrom_get_track_type(cdrom, cdrom_get_track(cdrom, cd_curfad)) != CD_TRACK_AUDIO) { cd_read_filtered_sector(cd_curfad,&p_ok); - cdda_stop_audio( machine.device( "cdda" ) ); //stop any pending CD-DA + cdda_stop_audio( machine().device( "cdda" ) ); //stop any pending CD-DA } else { p_ok = 1; // TODO - cdda_start_audio( machine.device( "cdda" ), cd_curfad, 1 ); + cdda_start_audio( machine().device( "cdda" ), cd_curfad, 1 ); } if(p_ok) @@ -2521,7 +2384,7 @@ static void cd_playdata(running_machine &machine) } // loads a single sector off the CD, anywhere from FAD 150 on up -static void cd_readblock(UINT32 fad, UINT8 *dat) +void saturn_state::cd_readblock(UINT32 fad, UINT8 *dat) { if (cdrom) { @@ -2529,7 +2392,7 @@ static void cd_readblock(UINT32 fad, UINT8 *dat) } } -void stvcd_set_tray_open(running_machine &machine) +void saturn_state::stvcd_set_tray_open( void ) { if(!tray_is_closed) return; @@ -2543,7 +2406,7 @@ void stvcd_set_tray_open(running_machine &machine) popmessage("Tray Open"); } -void stvcd_set_tray_close(running_machine &machine) +void saturn_state::stvcd_set_tray_close( void ) { /* avoid user attempts to load a CD-ROM without opening the tray first (emulation asserts anyway with current framework) */ if(tray_is_closed) @@ -2551,7 +2414,7 @@ void stvcd_set_tray_close(running_machine &machine) hirqreg |= DCHG; - cdrom_image_device *cddevice = machine.device<cdrom_image_device>("cdrom"); + cdrom_image_device *cddevice = machine().device<cdrom_image_device>("cdrom"); if (cddevice!=NULL) { // MESS case @@ -2560,15 +2423,15 @@ void stvcd_set_tray_close(running_machine &machine) else { // MAME case - cdrom = cdrom_open(get_disk_handle(machine, "cdrom")); + cdrom = cdrom_open(get_disk_handle(machine(), "cdrom")); } - cdda_set_cdrom( machine.device("cdda"), cdrom ); + cdda_set_cdrom( machine().device("cdda"), cdrom ); if (cdrom) { CDROM_LOG(("Opened CD-ROM successfully, reading root directory\n")) - //read_new_dir(machine, 0xffffff); // read root directory + //read_new_dir(0xffffff); // read root directory cd_stat = CD_STAT_PAUSE; } else diff --git a/src/mame/machine/stvcd.h b/src/mame/machine/stvcd.h index 34f9a7859c6..6bd5e9ca8b0 100644 --- a/src/mame/machine/stvcd.h +++ b/src/mame/machine/stvcd.h @@ -9,16 +9,5 @@ #ifndef __STVCD_H__ #define __STVCD_H__ -void stvcd_reset(running_machine& machine); -void stvcd_exit(running_machine& machine); - -TIMER_DEVICE_CALLBACK( stv_sector_cb ); -TIMER_DEVICE_CALLBACK( stv_sh1_sim ); - -DECLARE_READ32_HANDLER( stvcd_r ); -DECLARE_WRITE32_HANDLER( stvcd_w ); - -void stvcd_set_tray_open(running_machine &machine); -void stvcd_set_tray_close(running_machine &machine); #endif diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c index 2c5d62d421f..ded533cd6b7 100644 --- a/src/mame/video/stvvdp1.c +++ b/src/mame/video/stvvdp1.c @@ -826,57 +826,50 @@ and if we skip the drawing the content could be incorrect when it reads it, alth why they would want to */ -static void (*drawpixel)(running_machine &machine, int x, int y, int patterndata, int offsetcnt); -static void drawpixel_poly(running_machine &machine, int x, int y, int patterndata, int offsetcnt) +void saturn_state::drawpixel_poly(int x, int y, int patterndata, int offsetcnt) { - saturn_state *state = machine.driver_data<saturn_state>(); - /* Capcom Collection Dai 4 uses a dummy polygon to clear VDP1 framebuffer that goes over our current max size ... */ if(x >= 1024 || y >= 512) return; - state->m_vdp1.framebuffer_draw_lines[y][x] = state->stv2_current_sprite.CMDCOLR; + m_vdp1.framebuffer_draw_lines[y][x] = stv2_current_sprite.CMDCOLR; } -static void drawpixel_8bpp_trans(running_machine &machine, int x, int y, int patterndata, int offsetcnt) +void saturn_state::drawpixel_8bpp_trans(int x, int y, int patterndata, int offsetcnt) { - saturn_state *state = machine.driver_data<saturn_state>(); UINT16 pix; - pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt]; + pix = m_vdp1.gfx_decode[patterndata+offsetcnt]; if ( pix & 0xff ) { - state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank; + m_vdp1.framebuffer_draw_lines[y][x] = pix | m_sprite_colorbank; } } -static void drawpixel_4bpp_notrans(running_machine &machine, int x, int y, int patterndata, int offsetcnt) +void saturn_state::drawpixel_4bpp_notrans(int x, int y, int patterndata, int offsetcnt) { - saturn_state *state = machine.driver_data<saturn_state>(); UINT16 pix; - pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt/2]; + pix = m_vdp1.gfx_decode[patterndata+offsetcnt/2]; pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ; - state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank; + m_vdp1.framebuffer_draw_lines[y][x] = pix | m_sprite_colorbank; } -static void drawpixel_4bpp_trans(running_machine &machine, int x, int y, int patterndata, int offsetcnt) +void saturn_state::drawpixel_4bpp_trans(int x, int y, int patterndata, int offsetcnt) { - saturn_state *state = machine.driver_data<saturn_state>(); UINT16 pix; - pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt/2]; + pix = m_vdp1.gfx_decode[patterndata+offsetcnt/2]; pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ; if ( pix ) - state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank; + m_vdp1.framebuffer_draw_lines[y][x] = pix | m_sprite_colorbank; } -static void drawpixel_generic(running_machine &machine, int x, int y, int patterndata, int offsetcnt) +void saturn_state::drawpixel_generic(int x, int y, int patterndata, int offsetcnt) { - saturn_state *state = machine.driver_data<saturn_state>(); - int pix,mode,transmask, spd = state->stv2_current_sprite.CMDPMOD & 0x40; - int mesh = state->stv2_current_sprite.CMDPMOD & 0x100; + int pix,mode,transmask, spd = stv2_current_sprite.CMDPMOD & 0x40; + int mesh = stv2_current_sprite.CMDPMOD & 0x100; int pix2; if ( mesh && !((x ^ y) & 1) ) @@ -884,9 +877,9 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter return; } - if ( state->stv2_current_sprite.ispoly ) + if ( stv2_current_sprite.ispoly ) { - pix = state->stv2_current_sprite.CMDCOLR&0xffff; + pix = stv2_current_sprite.CMDCOLR&0xffff; transmask = 0xffff; if ( pix & 0x8000 ) @@ -900,23 +893,23 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter } else { - switch (state->stv2_current_sprite.CMDPMOD&0x0038) + switch (stv2_current_sprite.CMDPMOD&0x0038) { case 0x0000: // mode 0 16 colour bank mode (4bits) (hanagumi blocks) // most of the shienryu sprites use this mode - pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt/2) & 0xfffff]; + pix = m_vdp1.gfx_decode[(patterndata+offsetcnt/2) & 0xfffff]; pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ; - pix = pix+((state->stv2_current_sprite.CMDCOLR&0xfff0)); + pix = pix+((stv2_current_sprite.CMDCOLR&0xfff0)); mode = 0; transmask = 0xf; break; case 0x0008: // mode 1 16 colour lookup table mode (4bits) // shienryu explosisons (and some enemies) use this mode - pix2 = state->m_vdp1.gfx_decode[(patterndata+offsetcnt/2) & 0xfffff]; + pix2 = m_vdp1.gfx_decode[(patterndata+offsetcnt/2) & 0xfffff]; pix2 = offsetcnt&1 ? (pix2 & 0x0f):((pix2 & 0xf0)>>4); pix = pix2&1 ? - ((((state->m_vdp1_vram[(((state->stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0x0000ffff) >> 0): - ((((state->m_vdp1_vram[(((state->stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0xffff0000) >> 16); + ((((m_vdp1_vram[(((stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0x0000ffff) >> 0): + ((((m_vdp1_vram[(((stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0xffff0000) >> 16); mode = 5; transmask = 0xffff; @@ -934,30 +927,30 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter } break; case 0x0010: // mode 2 64 colour bank mode (8bits) (character select portraits on hanagumi) - pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff]; + pix = m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff]; mode = 2; - pix = pix+(state->stv2_current_sprite.CMDCOLR&0xffc0); + pix = pix+(stv2_current_sprite.CMDCOLR&0xffc0); transmask = 0x3f; break; case 0x0018: // mode 3 128 colour bank mode (8bits) (little characters on hanagumi use this mode) - pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff]; - pix = pix+(state->stv2_current_sprite.CMDCOLR&0xff80); + pix = m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff]; + pix = pix+(stv2_current_sprite.CMDCOLR&0xff80); transmask = 0x7f; mode = 3; break; case 0x0020: // mode 4 256 colour bank mode (8bits) (hanagumi title) - pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff]; - pix = pix+(state->stv2_current_sprite.CMDCOLR&0xff00); + pix = m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff]; + pix = pix+(stv2_current_sprite.CMDCOLR&0xff00); transmask = 0xff; mode = 4; break; case 0x0028: // mode 5 32,768 colour RGB mode (16bits) - pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt*2+1) & 0xfffff] | (state->m_vdp1.gfx_decode[(patterndata+offsetcnt*2) & 0xfffff]<<8) ; + pix = m_vdp1.gfx_decode[(patterndata+offsetcnt*2+1) & 0xfffff] | (m_vdp1.gfx_decode[(patterndata+offsetcnt*2) & 0xfffff]<<8) ; mode = 5; transmask = -1; /* TODO: check me */ break; default: // other settings illegal - pix = machine.rand(); + pix = machine().rand(); mode = 0; transmask = 0xff; popmessage("Illegal Sprite Mode, contact MAMEdev"); @@ -965,7 +958,7 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter // preliminary end code disable support - if ( ((state->stv2_current_sprite.CMDPMOD & 0x80) == 0) && + if ( ((stv2_current_sprite.CMDPMOD & 0x80) == 0) && ((pix & transmask) == transmask) ) { return; @@ -973,47 +966,47 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter } /* MSBON */ - pix |= state->stv2_current_sprite.CMDPMOD & 0x8000; + pix |= stv2_current_sprite.CMDPMOD & 0x8000; if ( mode != 5 ) { if ( (pix & transmask) || spd ) { - state->m_vdp1.framebuffer_draw_lines[y][x] = pix; + m_vdp1.framebuffer_draw_lines[y][x] = pix; } } else { if ( (pix & transmask) || spd ) { - switch( state->stv2_current_sprite.CMDPMOD & 0x7 ) + switch( stv2_current_sprite.CMDPMOD & 0x7 ) { case 0: /* replace */ - state->m_vdp1.framebuffer_draw_lines[y][x] = pix; + m_vdp1.framebuffer_draw_lines[y][x] = pix; break; case 1: /* shadow */ - if ( state->m_vdp1.framebuffer_draw_lines[y][x] & 0x8000 ) + if ( m_vdp1.framebuffer_draw_lines[y][x] & 0x8000 ) { - state->m_vdp1.framebuffer_draw_lines[y][x] = ((state->m_vdp1.framebuffer_draw_lines[y][x] & ~0x8421) >> 1) | 0x8000; + m_vdp1.framebuffer_draw_lines[y][x] = ((m_vdp1.framebuffer_draw_lines[y][x] & ~0x8421) >> 1) | 0x8000; } break; case 2: /* half luminance */ - state->m_vdp1.framebuffer_draw_lines[y][x] = ((pix & ~0x8421) >> 1) | 0x8000; + m_vdp1.framebuffer_draw_lines[y][x] = ((pix & ~0x8421) >> 1) | 0x8000; break; case 3: /* half transparent */ - if ( state->m_vdp1.framebuffer_draw_lines[y][x] & 0x8000 ) + if ( m_vdp1.framebuffer_draw_lines[y][x] & 0x8000 ) { - state->m_vdp1.framebuffer_draw_lines[y][x] = alpha_blend_r16( state->m_vdp1.framebuffer_draw_lines[y][x], pix, 0x80 ) | 0x8000; + m_vdp1.framebuffer_draw_lines[y][x] = alpha_blend_r16( m_vdp1.framebuffer_draw_lines[y][x], pix, 0x80 ) | 0x8000; } else { - state->m_vdp1.framebuffer_draw_lines[y][x] = pix; + m_vdp1.framebuffer_draw_lines[y][x] = pix; } break; case 4: /* Gouraud shading */ - state->m_vdp1.framebuffer_draw_lines[y][x] = state->stv_vdp1_apply_gouraud_shading( x, y, pix ); + m_vdp1.framebuffer_draw_lines[y][x] = stv_vdp1_apply_gouraud_shading( x, y, pix ); break; default: - state->m_vdp1.framebuffer_draw_lines[y][x] = pix; + m_vdp1.framebuffer_draw_lines[y][x] = pix; break; } } @@ -1031,32 +1024,32 @@ void saturn_state::stv_vdp1_set_drawpixel( void ) if ( mesh || !ecd || ((stv2_current_sprite.CMDPMOD & 0x7) != 0) ) { - drawpixel = drawpixel_generic; + drawpixel = &saturn_state::drawpixel_generic; return; } if (sprite_type == 4 && ((stv2_current_sprite.CMDPMOD & 0x7) == 0)) { - drawpixel = drawpixel_poly; + drawpixel = &saturn_state::drawpixel_poly; } else if ( (sprite_mode == 0x20) && !spd ) { m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xff00); - drawpixel = drawpixel_8bpp_trans; + drawpixel = &saturn_state::drawpixel_8bpp_trans; } else if ((sprite_mode == 0x00) && spd) { m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0); - drawpixel = drawpixel_4bpp_notrans; + drawpixel = &saturn_state::drawpixel_4bpp_notrans; } else if (sprite_mode == 0x00 && !spd ) { m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0); - drawpixel = drawpixel_4bpp_trans; + drawpixel = &saturn_state::drawpixel_4bpp_trans; } else { - drawpixel = drawpixel_generic; + drawpixel = &saturn_state::drawpixel_generic; } } @@ -1151,9 +1144,7 @@ void saturn_state::vdp1_fill_slope(const rectangle &cliprect, int patterndata, i xx2 = cliprect.max_x; while(xx1 <= xx2) { - drawpixel(machine(),xx1,_y1, - patterndata, - (v>>FRAC_SHIFT)*xsize+(u>>FRAC_SHIFT)); + (this->*drawpixel)(xx1,_y1, patterndata, (v>>FRAC_SHIFT)*xsize+(u>>FRAC_SHIFT)); xx1++; u += slux; v += slvx; @@ -1205,9 +1196,7 @@ void saturn_state::vdp1_fill_line(const rectangle &cliprect, int patterndata, in xx2 = cliprect.max_x; while(xx1 <= xx2) { - drawpixel(machine(), xx1,y, - patterndata, - (v>>FRAC_SHIFT)*xsize+(u>>FRAC_SHIFT)); + (this->*drawpixel)(xx1,y,patterndata,(v>>FRAC_SHIFT)*xsize+(u>>FRAC_SHIFT)); xx1++; u += slux; v += slvx; @@ -1725,7 +1714,7 @@ void saturn_state::stv_vdp1_draw_normal_sprite(const rectangle &cliprect, int sp su = u; for (drawxpos = x; drawxpos <= maxdrawxpos; drawxpos++ ) { - drawpixel( machine(), drawxpos, drawypos, patterndata, u ); + (this->*drawpixel)( drawxpos, drawypos, patterndata, u ); u += dux; } u = su + duy; |