Previous 15994 Revisions Next

r1904 Tuesday 11th March, 2008 at 17:40:48 UTC by Wilbert Pol
[SMS] Updated to pass running_machine around.
[src/mess/drivers]sms.c
[src/mess/includes]sms.h
[src/mess/machine]sms.c
[src/mess/video]smsvdp.c smsvdp.h

src/mess/includes/sms.h
r1903r1904
5858
5959void setup_rom(void);
6060
61void sms_check_pause_button( void );
61void sms_check_pause_button( running_machine *machine );
6262
6363DEVICE_INIT( sms_cart );
6464DEVICE_LOAD( sms_cart );
r1903r1904
7272READ8_HANDLER(sms_store_select2);
7373READ8_HANDLER(sms_store_control_r);
7474WRITE8_HANDLER(sms_store_control_w);
75void sms_int_callback( int state );
76void sms_store_int_callback( int state );
75void sms_int_callback( running_machine *machine, int state );
76void sms_store_int_callback( running_machine *machine, int state );
7777
7878#define IO_EXPANSION            (0x80)   /* Expansion slot enable (1= disabled, 0= enabled) */
7979#define IO_CARTRIDGE            (0x40)   /* Cartridge slot enable (1= disabled, 0= enabled) */
src/mess/video/smsvdp.c
r1903r1904
3737*/
3838
3939#include "driver.h"
40#include "deprecat.h"
4140#include "video/smsvdp.h"
4241#include "includes/sms.h"
4342
r1903r1904
106105    */
107106   int         *line_buffer;
108107   int         current_palette[32];
109   void (*int_callback)(int);
108   void (*int_callback)(running_machine*,int);
110109   emu_timer   *smsvdp_display_timer;
111110} smsvdp;
112111
r1903r1904
114113static void sms_refresh_line(bitmap_t *bitmap, int offsetx, int offsety, int line);
115114static void sms_update_palette(void);
116115
117static void set_display_settings( void ) {
116static void set_display_settings( running_machine *machine ) {
118117   int M1, M2, M3, M4;
119118   M1 = smsvdp.reg[0x01] & 0x10;
120119   M2 = smsvdp.reg[0x00] & 0x02;
r1903r1904
152151   }
153152   switch( smsvdp.y_pixels ) {
154153   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;
156155      break;
157156   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;
159158      break;
160159   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;
162161      break;
163162   }
164163   smsvdp.cram_dirty = 1;
r1903r1904
176175   smsvdp.gg_sms_mode = mode;
177176}
178177
179int smsvdp_video_init( const smsvdp_configuration *config ) {
178int smsvdp_video_init( running_machine *machine, const smsvdp_configuration *config ) {
180179
181180   memset( &smsvdp, 0, sizeof smsvdp );
182181
r1903r1904
208207
209208   smsvdp.prev_bitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, BITMAP_FORMAT_INDEXED32);
210209
211   set_display_settings();
210   set_display_settings( machine );
212211
213212   smsvdp.smsvdp_display_timer = timer_alloc( smsvdp_display_callback , NULL);
214213   timer_adjust_periodic(smsvdp.smsvdp_display_timer, video_screen_get_time_until_pos( 0, 0, 0 ), 0, video_screen_get_scan_period( 0 ));
r1903r1904
218217static TIMER_CALLBACK(smsvdp_set_irq) {
219218   smsvdp.irq_state = 1;
220219   if ( smsvdp.int_callback ) {
221      smsvdp.int_callback( ASSERT_LINE );
220      smsvdp.int_callback( machine, ASSERT_LINE );
222221   }
223222}
224223
r1903r1904
234233
235234   /* Check if we're on the last line of a frame */
236235   if ( vpos == vpos_limit - 1 ) {
237      sms_check_pause_button();
236      sms_check_pause_button( machine );
238237      return;
239238   }
240239
r1903r1904
384383   if (smsvdp.irq_state == 1) {
385384      smsvdp.irq_state = 0;
386385      if ( smsvdp.int_callback ) {
387         smsvdp.int_callback( CLEAR_LINE );
386         smsvdp.int_callback( machine, CLEAR_LINE );
388387      }
389388   }
390389
r1903r1904
448447            logerror("overscan enabled.\n");
449448         }
450449         if ( regNum == 0 || regNum == 1 ) {
451            set_display_settings();
450            set_display_settings( machine );
452451         }
453452         if ( ( regNum == 1 ) && ( smsvdp.reg[0x01] & 0x20 ) && ( smsvdp.status & STATUS_VINT ) ) {
454453            smsvdp.irq_state = 1;
455            smsvdp.int_callback( ASSERT_LINE );
454            smsvdp.int_callback( machine, ASSERT_LINE );
456455         }
457456         smsvdp.addrmode = 0;
458457         break;
src/mess/video/smsvdp.h
r1903r1904
2626
2727typedef struct smsvdp_configuration {
2828   UINT32   model;         /* Select model/features for the emulation */
29   void   (*int_callback)(int);   /* interupt callback function */
29   void   (*int_callback)(running_machine*,int);   /* interupt callback function */
3030} smsvdp_configuration;
3131
3232
3333/* prototypes */
3434
35int smsvdp_video_init( const smsvdp_configuration *config );
35int smsvdp_video_init( running_machine *machine, const smsvdp_configuration *config );
3636VIDEO_UPDATE(sms);
3737 READ8_HANDLER(sms_vdp_vcount_r);
3838 READ8_HANDLER(sms_vdp_hcount_r);
src/mess/machine/sms.c
r1903r1904
11#include <stdio.h>
22#include "driver.h"
33#include "image.h"
4#include "deprecat.h"
54#include "includes/sms.h"
65#include "video/smsvdp.h"
76#include "sound/2413intf.h"
r1903r1904
280279   }
281280}
282281
283void sms_check_pause_button( void ) {
282void sms_check_pause_button( running_machine *machine ) {
284283   if ( ! IS_GAMEGEAR ) {
285284      if ( ! (readinputport(2) & 0x80) ) {
286285         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 );
289288         }
290289         smsPaused = 1;
291290      } else {
r1903r1904
10031002   sms_store_control = data;
10041003}
10051004
1006void sms_int_callback( int state ) {
1007   cpunum_set_input_line(Machine, 0, 0, state );
1005void sms_int_callback( running_machine *machine, int state ) {
1006   cpunum_set_input_line(machine, 0, 0, state );
10081007}
10091008
1010void sms_store_int_callback( int state ) {
1011   cpunum_set_input_line(Machine, sms_store_control & 0x01 ? 1 : 0, 0, state );
1009void sms_store_int_callback( running_machine *machine, int state ) {
1010   cpunum_set_input_line(machine, sms_store_control & 0x01 ? 1 : 0, 0, state );
10121011}
10131012
src/mess/drivers/sms.c
r1903r1904
276276static const smsvdp_configuration config_store = { MODEL_315_5124, sms_store_int_callback };
277277
278278static VIDEO_START(sega_315_5124) {
279   smsvdp_video_init( &config_315_5124 );
279   smsvdp_video_init( machine, &config_315_5124 );
280280}
281281
282282static VIDEO_START(sega_315_5246) {
283   smsvdp_video_init( &config_315_5246 );
283   smsvdp_video_init( machine, &config_315_5246 );
284284}
285285
286286static VIDEO_START(sega_315_5378) {
287   smsvdp_video_init( &config_315_5378 );
287   smsvdp_video_init( machine, &config_315_5378 );
288288}
289289
290290static VIDEO_START(sega_store_315_5124) {
291   smsvdp_video_init( &config_store );
291   smsvdp_video_init( machine, &config_store );
292292}
293293
294294static MACHINE_DRIVER_START(sms1ntsc)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team