src/mess/includes/sms.h
| r1903 | r1904 | |
| 58 | 58 | |
| 59 | 59 | void setup_rom(void); |
| 60 | 60 | |
| 61 | | void sms_check_pause_button( void ); |
| 61 | void sms_check_pause_button( running_machine *machine ); |
| 62 | 62 | |
| 63 | 63 | DEVICE_INIT( sms_cart ); |
| 64 | 64 | DEVICE_LOAD( sms_cart ); |
| r1903 | r1904 | |
| 72 | 72 | READ8_HANDLER(sms_store_select2); |
| 73 | 73 | READ8_HANDLER(sms_store_control_r); |
| 74 | 74 | WRITE8_HANDLER(sms_store_control_w); |
| 75 | | void sms_int_callback( int state ); |
| 76 | | void sms_store_int_callback( int state ); |
| 75 | void sms_int_callback( running_machine *machine, int state ); |
| 76 | void sms_store_int_callback( running_machine *machine, int state ); |
| 77 | 77 | |
| 78 | 78 | #define IO_EXPANSION (0x80) /* Expansion slot enable (1= disabled, 0= enabled) */ |
| 79 | 79 | #define IO_CARTRIDGE (0x40) /* Cartridge slot enable (1= disabled, 0= enabled) */ |
src/mess/video/smsvdp.c
| r1903 | r1904 | |
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | 39 | #include "driver.h" |
| 40 | | #include "deprecat.h" |
| 41 | 40 | #include "video/smsvdp.h" |
| 42 | 41 | #include "includes/sms.h" |
| 43 | 42 | |
| r1903 | r1904 | |
| 106 | 105 | */ |
| 107 | 106 | int *line_buffer; |
| 108 | 107 | int current_palette[32]; |
| 109 | | void (*int_callback)(int); |
| 108 | void (*int_callback)(running_machine*,int); |
| 110 | 109 | emu_timer *smsvdp_display_timer; |
| 111 | 110 | } smsvdp; |
| 112 | 111 | |
| r1903 | r1904 | |
| 114 | 113 | static void sms_refresh_line(bitmap_t *bitmap, int offsetx, int offsety, int line); |
| 115 | 114 | static void sms_update_palette(void); |
| 116 | 115 | |
| 117 | | static void set_display_settings( void ) { |
| 116 | static void set_display_settings( running_machine *machine ) { |
| 118 | 117 | int M1, M2, M3, M4; |
| 119 | 118 | M1 = smsvdp.reg[0x01] & 0x10; |
| 120 | 119 | M2 = smsvdp.reg[0x00] & 0x02; |
| r1903 | r1904 | |
| 152 | 151 | } |
| 153 | 152 | switch( smsvdp.y_pixels ) { |
| 154 | 153 | case 192: |
| 155 | | smsvdp.sms_frame_timing = ( Machine->screen[0].height == PAL_Y_PIXELS ) ? sms_pal_192 : sms_ntsc_192; |
| 154 | smsvdp.sms_frame_timing = ( machine->screen[0].height == PAL_Y_PIXELS ) ? sms_pal_192 : sms_ntsc_192; |
| 156 | 155 | break; |
| 157 | 156 | case 224: |
| 158 | | smsvdp.sms_frame_timing = ( Machine->screen[0].height == PAL_Y_PIXELS ) ? sms_pal_224 : sms_ntsc_224; |
| 157 | smsvdp.sms_frame_timing = ( machine->screen[0].height == PAL_Y_PIXELS ) ? sms_pal_224 : sms_ntsc_224; |
| 159 | 158 | break; |
| 160 | 159 | case 240: |
| 161 | | smsvdp.sms_frame_timing = ( Machine->screen[0].height == PAL_Y_PIXELS ) ? sms_pal_240 : sms_ntsc_240; |
| 160 | smsvdp.sms_frame_timing = ( machine->screen[0].height == PAL_Y_PIXELS ) ? sms_pal_240 : sms_ntsc_240; |
| 162 | 161 | break; |
| 163 | 162 | } |
| 164 | 163 | smsvdp.cram_dirty = 1; |
| r1903 | r1904 | |
| 176 | 175 | smsvdp.gg_sms_mode = mode; |
| 177 | 176 | } |
| 178 | 177 | |
| 179 | | int smsvdp_video_init( const smsvdp_configuration *config ) { |
| 178 | int smsvdp_video_init( running_machine *machine, const smsvdp_configuration *config ) { |
| 180 | 179 | |
| 181 | 180 | memset( &smsvdp, 0, sizeof smsvdp ); |
| 182 | 181 | |
| r1903 | r1904 | |
| 208 | 207 | |
| 209 | 208 | smsvdp.prev_bitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, BITMAP_FORMAT_INDEXED32); |
| 210 | 209 | |
| 211 | | set_display_settings(); |
| 210 | set_display_settings( machine ); |
| 212 | 211 | |
| 213 | 212 | smsvdp.smsvdp_display_timer = timer_alloc( smsvdp_display_callback , NULL); |
| 214 | 213 | timer_adjust_periodic(smsvdp.smsvdp_display_timer, video_screen_get_time_until_pos( 0, 0, 0 ), 0, video_screen_get_scan_period( 0 )); |
| r1903 | r1904 | |
| 218 | 217 | static TIMER_CALLBACK(smsvdp_set_irq) { |
| 219 | 218 | smsvdp.irq_state = 1; |
| 220 | 219 | if ( smsvdp.int_callback ) { |
| 221 | | smsvdp.int_callback( ASSERT_LINE ); |
| 220 | smsvdp.int_callback( machine, ASSERT_LINE ); |
| 222 | 221 | } |
| 223 | 222 | } |
| 224 | 223 | |
| r1903 | r1904 | |
| 234 | 233 | |
| 235 | 234 | /* Check if we're on the last line of a frame */ |
| 236 | 235 | if ( vpos == vpos_limit - 1 ) { |
| 237 | | sms_check_pause_button(); |
| 236 | sms_check_pause_button( machine ); |
| 238 | 237 | return; |
| 239 | 238 | } |
| 240 | 239 | |
| r1903 | r1904 | |
| 384 | 383 | if (smsvdp.irq_state == 1) { |
| 385 | 384 | smsvdp.irq_state = 0; |
| 386 | 385 | if ( smsvdp.int_callback ) { |
| 387 | | smsvdp.int_callback( CLEAR_LINE ); |
| 386 | smsvdp.int_callback( machine, CLEAR_LINE ); |
| 388 | 387 | } |
| 389 | 388 | } |
| 390 | 389 | |
| r1903 | r1904 | |
| 448 | 447 | logerror("overscan enabled.\n"); |
| 449 | 448 | } |
| 450 | 449 | if ( regNum == 0 || regNum == 1 ) { |
| 451 | | set_display_settings(); |
| 450 | set_display_settings( machine ); |
| 452 | 451 | } |
| 453 | 452 | if ( ( regNum == 1 ) && ( smsvdp.reg[0x01] & 0x20 ) && ( smsvdp.status & STATUS_VINT ) ) { |
| 454 | 453 | smsvdp.irq_state = 1; |
| 455 | | smsvdp.int_callback( ASSERT_LINE ); |
| 454 | smsvdp.int_callback( machine, ASSERT_LINE ); |
| 456 | 455 | } |
| 457 | 456 | smsvdp.addrmode = 0; |
| 458 | 457 | break; |
src/mess/machine/sms.c
| r1903 | r1904 | |
| 1 | 1 | #include <stdio.h> |
| 2 | 2 | #include "driver.h" |
| 3 | 3 | #include "image.h" |
| 4 | | #include "deprecat.h" |
| 5 | 4 | #include "includes/sms.h" |
| 6 | 5 | #include "video/smsvdp.h" |
| 7 | 6 | #include "sound/2413intf.h" |
| r1903 | r1904 | |
| 280 | 279 | } |
| 281 | 280 | } |
| 282 | 281 | |
| 283 | | void sms_check_pause_button( void ) { |
| 282 | void sms_check_pause_button( running_machine *machine ) { |
| 284 | 283 | if ( ! IS_GAMEGEAR ) { |
| 285 | 284 | if ( ! (readinputport(2) & 0x80) ) { |
| 286 | 285 | if ( ! smsPaused ) { |
| 287 | | cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, ASSERT_LINE ); |
| 288 | | cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, CLEAR_LINE ); |
| 286 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE ); |
| 287 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE ); |
| 289 | 288 | } |
| 290 | 289 | smsPaused = 1; |
| 291 | 290 | } else { |
| r1903 | r1904 | |
| 1003 | 1002 | sms_store_control = data; |
| 1004 | 1003 | } |
| 1005 | 1004 | |
| 1006 | | void sms_int_callback( int state ) { |
| 1007 | | cpunum_set_input_line(Machine, 0, 0, state ); |
| 1005 | void sms_int_callback( running_machine *machine, int state ) { |
| 1006 | cpunum_set_input_line(machine, 0, 0, state ); |
| 1008 | 1007 | } |
| 1009 | 1008 | |
| 1010 | | void sms_store_int_callback( int state ) { |
| 1011 | | cpunum_set_input_line(Machine, sms_store_control & 0x01 ? 1 : 0, 0, state ); |
| 1009 | void sms_store_int_callback( running_machine *machine, int state ) { |
| 1010 | cpunum_set_input_line(machine, sms_store_control & 0x01 ? 1 : 0, 0, state ); |
| 1012 | 1011 | } |
| 1013 | 1012 | |
src/mess/drivers/sms.c
| r1903 | r1904 | |
| 276 | 276 | static const smsvdp_configuration config_store = { MODEL_315_5124, sms_store_int_callback }; |
| 277 | 277 | |
| 278 | 278 | static VIDEO_START(sega_315_5124) { |
| 279 | | smsvdp_video_init( &config_315_5124 ); |
| 279 | smsvdp_video_init( machine, &config_315_5124 ); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | static VIDEO_START(sega_315_5246) { |
| 283 | | smsvdp_video_init( &config_315_5246 ); |
| 283 | smsvdp_video_init( machine, &config_315_5246 ); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | static VIDEO_START(sega_315_5378) { |
| 287 | | smsvdp_video_init( &config_315_5378 ); |
| 287 | smsvdp_video_init( machine, &config_315_5378 ); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | static VIDEO_START(sega_store_315_5124) { |
| 291 | | smsvdp_video_init( &config_store ); |
| 291 | smsvdp_video_init( machine, &config_store ); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | static MACHINE_DRIVER_START(sms1ntsc) |