Previous 199869 Revisions Next

r20792 Thursday 7th February, 2013 at 05:30:50 UTC by Angelo Salese
Second round of previous commit, needs recompile
[src/mame/includes]stv.h
[src/mame/video]stvvdp1.c stvvdp2.c

trunk/src/mame/includes/stv.h
r20791r20792
295295                     INT32 u1, INT32 u2, INT32 slu1, INT32 slu2, INT32 *nu1, INT32 *nu2,
296296                     INT32 v1, INT32 v2, INT32 slv1, INT32 slv2, INT32 *nv1, INT32 *nv2,
297297                     INT32 _y1, INT32 y2);
298   void stv_vdp1_setup_shading_for_line(INT32 y, INT32 x1, INT32 x2,
299                                    INT32 r1, INT32 g1, INT32 b1,
300                                    INT32 r2, INT32 g2, INT32 b2);
301   void stv_vdp1_setup_shading_for_slope(
302                     INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2,
303                     INT32 r1, INT32 r2, INT32 slr1, INT32 slr2, INT32 *nr1, INT32 *nr2,
304                     INT32 g1, INT32 g2, INT32 slg1, INT32 slg2, INT32 *ng1, INT32 *ng2,
305                     INT32 b1, INT32 b2, INT32 slb1, INT32 slb2, INT32 *nb1, INT32 *nb2,
306                     INT32 _y1, INT32 y2);
307   UINT16 stv_vdp1_apply_gouraud_shading( int x, int y, UINT16 pix );
298308   void stv_vdp1_setup_shading(const struct spoint* q, const rectangle &cliprect);
299309   UINT8 stv_read_gouraud_table( void );
310   void stv_clear_gouraud_shading(void);
311
300312   void stv_clear_framebuffer( int which_framebuffer );
301313   void stv_vdp1_state_save_postload( void );
302314   int stv_vdp1_start ( void );
303315
316   struct stv_vdp1_poly_scanline
317   {
318      INT32   x[2];
319      INT32   b[2];
320      INT32   g[2];
321      INT32   r[2];
322      INT32   db;
323      INT32   dg;
324      INT32   dr;
325   };
304326
327   struct stv_vdp1_poly_scanline_data
328   {
329      INT32   sy, ey;
330      struct  stv_vdp1_poly_scanline scanline[512];
331   };
332
333   struct stv_vdp1_poly_scanline_data* stv_vdp1_shading_data;
334
335   struct stv_vdp2_sprite_list
336   {
337      int CMDCTRL, CMDLINK, CMDPMOD, CMDCOLR, CMDSRCA, CMDSIZE, CMDGRDA;
338      int CMDXA, CMDYA;
339      int CMDXB, CMDYB;
340      int CMDXC, CMDYC;
341      int CMDXD, CMDYD;
342
343      int ispoly;
344
345   } stv2_current_sprite;
346
347   /* Gouraud shading */
348
349   struct _stv_gouraud_shading
350   {
351      /* Gouraud shading table */
352      UINT16  GA;
353      UINT16  GB;
354      UINT16  GC;
355      UINT16  GD;
356   } stv_gouraud_shading;
357
358   UINT16 m_sprite_colorbank;
359
360   /* VDP1 Framebuffer handling */
361   int      stv_sprite_priorities_used[8];
362   int      stv_sprite_priorities_usage_valid;
363   UINT8    stv_sprite_priorities_in_fb_line[512][8];
364
365
305366   /* VDP2 */
306367
307368   UINT8 get_vblank( void );
r20791r20792
333394   void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, bitmap_rgb32 &roz_bitmap, const rectangle &cliprect, int iRP, int planesizex, int planesizey, int planerenderedsizex, int planerenderedsizey);
334395   void stv_vdp2_fill_rotation_parameter_table( UINT8 rot_parameter );
335396   UINT8 stv_vdp2_check_vram_cycle_pattern_registers( UINT8 access_command_pnmdr, UINT8 access_command_cpdr, UINT8 bitmap_enable );
397   UINT8 stv_vdp2_is_rotation_applied(void);
398   UINT8 stv_vdp2_are_map_registers_equal(void);
399   void stv_vdp2_get_map_page( int x, int y, int *_map, int *_page );
400
336401   void stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 is_roz);
337
338402   void stv_vdp2_fade_effects( void );
339403   void stv_vdp2_compute_color_offset( int *r, int *g, int *b, int cor );
340404   void stv_vdp2_compute_color_offset_UINT32(UINT32 *rgb, int cor);
r20791r20792
352416   void stv_vdp2_state_save_postload( void );
353417   void stv_vdp2_exit ( void );
354418   int stv_vdp2_start ( void );
419
420   UINT8 m_vdpdebug_roz;
421
422   struct stv_vdp2_tilemap_capabilities
423   {
424      UINT8  enabled;
425      UINT8  transparency;
426      UINT8  colour_calculation_enabled;
427      UINT8  colour_depth;
428      UINT8  alpha;
429      UINT8  tile_size;
430      UINT8  bitmap_enable;
431      UINT8  bitmap_size;
432      UINT8  bitmap_palette_number;
433      UINT8  bitmap_map;
434      UINT16 map_offset[16];
435      UINT8  map_count;
436
437      UINT8  pattern_data_size;
438      UINT8  character_number_supplement;
439      UINT8  special_priority_register;
440      UINT8  special_colour_control_register;
441      UINT8  supplementary_palette_bits;
442      UINT8  supplementary_character_bits;
443
444      INT16 scrollx;
445      INT16 scrolly;
446      UINT32 incx, incy;
447
448      UINT8   linescroll_enable;
449      UINT8   linescroll_interval;
450      UINT32  linescroll_table_address;
451      UINT8   vertical_linescroll_enable;
452      UINT8   linezoom_enable;
453
454      UINT8  plane_size;
455      UINT8  colour_ram_address_offset;
456      UINT8  fade_control;
457      UINT8  window_control;
458
459      UINT8  line_screen_enabled;
460      UINT8  mosaic_screen_enabled;
461
462      int layer_name; /* just to keep track */
463   } stv2_current_tilemap;
464
465   struct rotation_table
466   {
467      INT32   xst;
468      INT32   yst;
469      INT32   zst;
470      INT32   dxst;
471      INT32   dyst;
472      INT32   dx;
473      INT32   dy;
474      INT32   A;
475      INT32   B;
476      INT32   C;
477      INT32   D;
478      INT32   E;
479      INT32   F;
480      INT32   px;
481      INT32   py;
482      INT32   pz;
483      INT32   cx;
484      INT32   cy;
485      INT32   cz;
486      INT32   mx;
487      INT32   my;
488      INT32   kx;
489      INT32   ky;
490      UINT32  kast;
491      INT32   dkast;
492      INT32   dkax;
493
494   } stv_current_rotation_parameter_table;
495
496   struct _stv_vdp2_layer_data_placement
497   {
498      UINT32  map_offset_min;
499      UINT32  map_offset_max;
500      UINT32  tile_offset_min;
501      UINT32  tile_offset_max;
502   } stv_vdp2_layer_data_placement;
503
504   struct _stv_rbg_cache_data
505   {
506      UINT8   watch_vdp2_vram_writes;
507      UINT8   is_cache_dirty;
508
509      UINT32  map_offset_min[2];
510      UINT32  map_offset_max[2];
511      UINT32  tile_offset_min[2];
512      UINT32  tile_offset_max[2];
513
514      struct stv_vdp2_tilemap_capabilities    layer_data[2];
515
516   } stv_rbg_cache_data;
517
518
355519};
356520
357521#define MASTER_CLOCK_352 57272720
trunk/src/mame/video/stvvdp1.c
r20791r20792
1818
1919#define VDP1_LOG 0
2020
21struct stv_vdp1_poly_scanline
22{
23   INT32   x[2];
24   INT32   b[2];
25   INT32   g[2];
26   INT32   r[2];
27   INT32   db;
28   INT32   dg;
29   INT32   dr;
30};
3121
32struct stv_vdp1_poly_scanline_data
33{
34   INT32   sy, ey;
35   struct  stv_vdp1_poly_scanline scanline[512];
36};
37
38static struct stv_vdp1_poly_scanline_data* stv_vdp1_shading_data;
39
4022enum { FRAC_SHIFT = 16 };
4123
4224struct spoint {
r20791r20792
501483
502484*/
503485
504static struct stv_vdp2_sprite_list
486void saturn_state::stv_clear_gouraud_shading(void)
505487{
506   int CMDCTRL, CMDLINK, CMDPMOD, CMDCOLR, CMDSRCA, CMDSIZE, CMDGRDA;
507   int CMDXA, CMDYA;
508   int CMDXB, CMDYB;
509   int CMDXC, CMDYC;
510   int CMDXD, CMDYD;
511
512   int ispoly;
513
514} stv2_current_sprite;
515
516/* Gouraud shading */
517
518static struct _stv_gouraud_shading
519{
520   /* Gouraud shading table */
521   UINT16  GA;
522   UINT16  GB;
523   UINT16  GC;
524   UINT16  GD;
525} stv_gouraud_shading;
526
527static void stv_clear_gouraud_shading(void)
528{
529488   memset( &stv_gouraud_shading, 0, sizeof( stv_gouraud_shading ) );
530489}
531490
r20791r20792
559518   return color;
560519}
561520
562static UINT16 stv_vdp1_apply_gouraud_shading( int x, int y, UINT16 pix )
521UINT16 saturn_state::stv_vdp1_apply_gouraud_shading( int x, int y, UINT16 pix )
563522{
564523   INT32 r,g,b, msb;
565524
r20791r20792
589548   return msb | b << 10 | g << 5 | r;
590549}
591550
592static void stv_vdp1_setup_shading_for_line(INT32 y, INT32 x1, INT32 x2,
551void saturn_state::stv_vdp1_setup_shading_for_line(INT32 y, INT32 x1, INT32 x2,
593552                                 INT32 r1, INT32 g1, INT32 b1,
594553                                 INT32 r2, INT32 g2, INT32 b2)
595554{
r20791r20792
643602   }
644603}
645604
646static void stv_vdp1_setup_shading_for_slope(
605void saturn_state::stv_vdp1_setup_shading_for_slope(
647606                     INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2,
648607                     INT32 r1, INT32 r2, INT32 slr1, INT32 slr2, INT32 *nr1, INT32 *nr2,
649608                     INT32 g1, INT32 g2, INT32 slg1, INT32 slg2, INT32 *ng1, INT32 *ng2,
r20791r20792
866825and if we skip the drawing the content could be incorrect when it reads it, although i have no idea
867826why they would want to */
868827
869static UINT8* gfxdata;
870static UINT16 sprite_colorbank;
871828
872
873829static void (*drawpixel)(running_machine &machine, int x, int y, int patterndata, int offsetcnt);
874830
875831static void drawpixel_poly(running_machine &machine, int x, int y, int patterndata, int offsetcnt)
r20791r20792
880836   if(x >= 1024 || y >= 512)
881837      return;
882838
883   state->m_vdp1.framebuffer_draw_lines[y][x] = stv2_current_sprite.CMDCOLR;
839   state->m_vdp1.framebuffer_draw_lines[y][x] = state->stv2_current_sprite.CMDCOLR;
884840}
885841
886842static void drawpixel_8bpp_trans(running_machine &machine, int x, int y, int patterndata, int offsetcnt)
r20791r20792
888844   saturn_state *state = machine.driver_data<saturn_state>();
889845   UINT16 pix;
890846
891   pix = gfxdata[patterndata+offsetcnt];
847   pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt];
892848   if ( pix & 0xff )
893849   {
894      state->m_vdp1.framebuffer_draw_lines[y][x] = pix | sprite_colorbank;
850      state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank;
895851   }
896852}
897853
r20791r20792
900856   saturn_state *state = machine.driver_data<saturn_state>();
901857   UINT16 pix;
902858
903   pix = gfxdata[patterndata+offsetcnt/2];
859   pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt/2];
904860   pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ;
905   state->m_vdp1.framebuffer_draw_lines[y][x] = pix | sprite_colorbank;
861   state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank;
906862}
907863
908864static void drawpixel_4bpp_trans(running_machine &machine, int x, int y, int patterndata, int offsetcnt)
r20791r20792
910866   saturn_state *state = machine.driver_data<saturn_state>();
911867   UINT16 pix;
912868
913   pix = gfxdata[patterndata+offsetcnt/2];
869   pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt/2];
914870   pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ;
915871   if ( pix )
916      state->m_vdp1.framebuffer_draw_lines[y][x] = pix | sprite_colorbank;
872      state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank;
917873}
918874
919875static void drawpixel_generic(running_machine &machine, int x, int y, int patterndata, int offsetcnt)
920876{
921877   saturn_state *state = machine.driver_data<saturn_state>();
922   int pix,mode,transmask, spd = stv2_current_sprite.CMDPMOD & 0x40;
923   int mesh = stv2_current_sprite.CMDPMOD & 0x100;
878   int pix,mode,transmask, spd = state->stv2_current_sprite.CMDPMOD & 0x40;
879   int mesh = state->stv2_current_sprite.CMDPMOD & 0x100;
924880   int pix2;
925881
926882   if ( mesh && !((x ^ y) & 1) )
r20791r20792
928884      return;
929885   }
930886
931   if ( stv2_current_sprite.ispoly )
887   if ( state->stv2_current_sprite.ispoly )
932888   {
933      pix = stv2_current_sprite.CMDCOLR&0xffff;
889      pix = state->stv2_current_sprite.CMDCOLR&0xffff;
934890
935891      transmask = 0xffff;
936892      if ( pix & 0x8000 )
r20791r20792
944900   }
945901   else
946902   {
947      switch (stv2_current_sprite.CMDPMOD&0x0038)
903      switch (state->stv2_current_sprite.CMDPMOD&0x0038)
948904      {
949905         case 0x0000: // mode 0 16 colour bank mode (4bits) (hanagumi blocks)
950906            // most of the shienryu sprites use this mode
951            pix = gfxdata[(patterndata+offsetcnt/2) & 0xfffff];
907            pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt/2) & 0xfffff];
952908            pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ;
953            pix = pix+((stv2_current_sprite.CMDCOLR&0xfff0));
909            pix = pix+((state->stv2_current_sprite.CMDCOLR&0xfff0));
954910            mode = 0;
955911            transmask = 0xf;
956912            break;
957913         case 0x0008: // mode 1 16 colour lookup table mode (4bits)
958914            // shienryu explosisons (and some enemies) use this mode
959            pix2 = gfxdata[(patterndata+offsetcnt/2) & 0xfffff];
915            pix2 = state->m_vdp1.gfx_decode[(patterndata+offsetcnt/2) & 0xfffff];
960916            pix2 = offsetcnt&1 ?  (pix2 & 0x0f):((pix2 & 0xf0)>>4);
961917            pix = pix2&1 ?
962            ((((state->m_vdp1_vram[(((stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0x0000ffff) >> 0):
963            ((((state->m_vdp1_vram[(((stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0xffff0000) >> 16);
918            ((((state->m_vdp1_vram[(((state->stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0x0000ffff) >> 0):
919            ((((state->m_vdp1_vram[(((state->stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0xffff0000) >> 16);
964920
965921            mode = 5;
966922            transmask = 0xffff;
r20791r20792
978934            }
979935            break;
980936         case 0x0010: // mode 2 64 colour bank mode (8bits) (character select portraits on hanagumi)
981            pix = gfxdata[(patterndata+offsetcnt) & 0xfffff];
937            pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff];
982938            mode = 2;
983            pix = pix+(stv2_current_sprite.CMDCOLR&0xffc0);
939            pix = pix+(state->stv2_current_sprite.CMDCOLR&0xffc0);
984940            transmask = 0x3f;
985941            break;
986942         case 0x0018: // mode 3 128 colour bank mode (8bits) (little characters on hanagumi use this mode)
987            pix = gfxdata[(patterndata+offsetcnt) & 0xfffff];
988            pix = pix+(stv2_current_sprite.CMDCOLR&0xff80);
943            pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff];
944            pix = pix+(state->stv2_current_sprite.CMDCOLR&0xff80);
989945            transmask = 0x7f;
990946            mode = 3;
991947            break;
992948         case 0x0020: // mode 4 256 colour bank mode (8bits) (hanagumi title)
993            pix = gfxdata[(patterndata+offsetcnt) & 0xfffff];
994            pix = pix+(stv2_current_sprite.CMDCOLR&0xff00);
949            pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff];
950            pix = pix+(state->stv2_current_sprite.CMDCOLR&0xff00);
995951            transmask = 0xff;
996952            mode = 4;
997953            break;
998954         case 0x0028: // mode 5 32,768 colour RGB mode (16bits)
999            pix = gfxdata[(patterndata+offsetcnt*2+1) & 0xfffff] | (gfxdata[(patterndata+offsetcnt*2) & 0xfffff]<<8) ;
955            pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt*2+1) & 0xfffff] | (state->m_vdp1.gfx_decode[(patterndata+offsetcnt*2) & 0xfffff]<<8) ;
1000956            mode = 5;
1001957            transmask = -1; /* TODO: check me */
1002958            break;
r20791r20792
1009965
1010966
1011967      // preliminary end code disable support
1012      if ( ((stv2_current_sprite.CMDPMOD & 0x80) == 0) &&
968      if ( ((state->stv2_current_sprite.CMDPMOD & 0x80) == 0) &&
1013969         ((pix & transmask) == transmask) )
1014970      {
1015971         return;
r20791r20792
1017973   }
1018974
1019975   /* MSBON */
1020   pix |= stv2_current_sprite.CMDPMOD & 0x8000;
976   pix |= state->stv2_current_sprite.CMDPMOD & 0x8000;
1021977   if ( mode != 5 )
1022978   {
1023979      if ( (pix & transmask) || spd )
r20791r20792
1029985   {
1030986      if ( (pix & transmask) || spd )
1031987      {
1032         switch( stv2_current_sprite.CMDPMOD & 0x7 )
988         switch( state->stv2_current_sprite.CMDPMOD & 0x7 )
1033989         {
1034990            case 0: /* replace */
1035991               state->m_vdp1.framebuffer_draw_lines[y][x] = pix;
r20791r20792
10541010               }
10551011               break;
10561012            case 4: /* Gouraud shading */
1057               state->m_vdp1.framebuffer_draw_lines[y][x] = stv_vdp1_apply_gouraud_shading( x, y, pix );
1013               state->m_vdp1.framebuffer_draw_lines[y][x] = state->stv_vdp1_apply_gouraud_shading( x, y, pix );
10581014               break;
10591015            default:
10601016               state->m_vdp1.framebuffer_draw_lines[y][x] = pix;
r20791r20792
10731029   int mesh = stv2_current_sprite.CMDPMOD & 0x100;
10741030   int ecd = stv2_current_sprite.CMDPMOD & 0x80;
10751031
1076   gfxdata = m_vdp1.gfx_decode;
1077
10781032   if ( mesh || !ecd || ((stv2_current_sprite.CMDPMOD & 0x7) != 0) )
10791033   {
10801034      drawpixel = drawpixel_generic;
r20791r20792
10871041   }
10881042   else if ( (sprite_mode == 0x20) && !spd )
10891043   {
1090      sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xff00);
1044      m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xff00);
10911045      drawpixel = drawpixel_8bpp_trans;
10921046   }
10931047   else if ((sprite_mode == 0x00) && spd)
10941048   {
1095      sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0);
1049      m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0);
10961050      drawpixel = drawpixel_4bpp_notrans;
10971051   }
10981052   else if (sprite_mode == 0x00 && !spd )
10991053   {
1100      sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0);
1054      m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0);
11011055      drawpixel = drawpixel_4bpp_trans;
11021056   }
11031057   else
trunk/src/mame/video/stvvdp2.c
r20791r20792
20812081       \----------|----------|----------|----------|----------|----------|----------|---------*/
20822082   #define STV_VDP2_COBB (m_vdp2_regs[0x11e/2])
20832083
2084/*For Debug purposes only*/
2085static struct stv_vdp2_debugging
2086{
2087   UINT8 l_en;  /*For Layer enable/disable*/
2088   UINT8 win;   /*Enters into Window effect debug menu*/
2089   UINT32 error; /*bits for VDP2 error logging*/
2090   UINT8 roz;   /*Debug roz on screen*/
2091} vdpdebug;
20922084
2093/* Not sure if to use this for the rotating tilemaps as well or just use different draw functions, might add too much bloat */
2094static struct stv_vdp2_tilemap_capabilities
2095{
2096   UINT8  enabled;
2097   UINT8  transparency;
2098   UINT8  colour_calculation_enabled;
2099   UINT8  colour_depth;
2100   UINT8  alpha;
2101   UINT8  tile_size;
2102   UINT8  bitmap_enable;
2103   UINT8  bitmap_size;
2104   UINT8  bitmap_palette_number;
2105   UINT8  bitmap_map;
2106   UINT16 map_offset[16];
2107   UINT8  map_count;
2108
2109   UINT8  pattern_data_size;
2110   UINT8  character_number_supplement;
2111   UINT8  special_priority_register;
2112   UINT8  special_colour_control_register;
2113   UINT8  supplementary_palette_bits;
2114   UINT8  supplementary_character_bits;
2115
2116   INT16 scrollx;
2117   INT16 scrolly;
2118   UINT32 incx, incy;
2119
2120   UINT8   linescroll_enable;
2121   UINT8   linescroll_interval;
2122   UINT32  linescroll_table_address;
2123   UINT8   vertical_linescroll_enable;
2124   UINT8   linezoom_enable;
2125
2126   UINT8  plane_size;
2127   UINT8  colour_ram_address_offset;
2128   UINT8  fade_control;
2129   UINT8  window_control;
2130
2131   UINT8  line_screen_enabled;
2132   UINT8  mosaic_screen_enabled;
2133
2134//  UINT8  real_map_offset[16];
2135
2136   int layer_name; /* just to keep track */
2137} stv2_current_tilemap;
2138
21392085#define STV_VDP2_RBG_ROTATION_PARAMETER_A   1
21402086#define STV_VDP2_RBG_ROTATION_PARAMETER_B   2
21412087
2142static struct rotation_table
2143{
2144   INT32   xst;
2145   INT32   yst;
2146   INT32   zst;
2147   INT32   dxst;
2148   INT32   dyst;
2149   INT32   dx;
2150   INT32   dy;
2151   INT32   A;
2152   INT32   B;
2153   INT32   C;
2154   INT32   D;
2155   INT32   E;
2156   INT32   F;
2157   INT32   px;
2158   INT32   py;
2159   INT32   pz;
2160   INT32   cx;
2161   INT32   cy;
2162   INT32   cz;
2163   INT32   mx;
2164   INT32   my;
2165   INT32   kx;
2166   INT32   ky;
2167   UINT32  kast;
2168   INT32   dkast;
2169   INT32   dkax;
21702088
2171} stv_current_rotation_parameter_table;
2172
2173static struct _stv_vdp2_layer_data_placement
2174{
2175   UINT32  map_offset_min;
2176   UINT32  map_offset_max;
2177   UINT32  tile_offset_min;
2178   UINT32  tile_offset_max;
2179} stv_vdp2_layer_data_placement;
2180
2181static struct _stv_rbg_cache_data
2182{
2183   UINT8   watch_vdp2_vram_writes;
2184   UINT8   is_cache_dirty;
2185
2186   UINT32  map_offset_min[2];
2187   UINT32  map_offset_max[2];
2188   UINT32  tile_offset_min[2];
2189   UINT32  tile_offset_max[2];
2190
2191   struct stv_vdp2_tilemap_capabilities    layer_data[2];
2192
2193} stv_rbg_cache_data;
2194
21952089#define mul_fixed32( a, b ) mul_32x32_shift( a, b, 16 )
21962090
21972091void saturn_state::stv_vdp2_fill_rotation_parameter_table( UINT8 rot_parameter )
r20791r20792
22512145   if(LOG_ROZ == 1) logerror( "kast = %x, dkast = %x, dkax = %x\n", RP.kast, RP.dkast, RP.dkax );
22522146
22532147   /*Attempt to show on screen the rotation table*/
2148   #if 0
22542149   if(LOG_ROZ == 2)
22552150   {
22562151      if(machine().input().code_pressed_once(JOYCODE_Y_UP_SWITCH))
2257         vdpdebug.roz++;
2152         m_vdpdebug_roz++;
22582153
22592154      if(machine().input().code_pressed_once(JOYCODE_Y_DOWN_SWITCH))
2260         vdpdebug.roz--;
2155         m_vdpdebug_roz--;
22612156
2262      if(vdpdebug.roz > 10)
2263         vdpdebug.roz = 10;
2157      if(m_vdpdebug_roz > 10)
2158         m_vdpdebug_roz = 10;
22642159
2265      switch(vdpdebug.roz)
2160      switch(m_vdpdebug_roz)
22662161      {
22672162         case 0: popmessage( "Rotation parameter Table (%d)", rot_parameter ); break;
22682163         case 1: popmessage( "xst = %x, yst = %x, zst = %x", RP.xst, RP.yst, RP.zst ); break;
r20791r20792
22772172         case 10: break;
22782173      }
22792174   }
2175   #endif
22802176}
22812177
22822178/* check if RGB layer has rotation applied */
2283static UINT8 stv_vdp2_is_rotation_applied(void)
2179UINT8 saturn_state::stv_vdp2_is_rotation_applied(void)
22842180{
22852181#define _FIXED_1    (0x00010000)
22862182#define _FIXED_0    (0x00000000)
r20791r20792
23062202   }
23072203}
23082204
2309static UINT8 stv_vdp2_are_map_registers_equal(void)
2205UINT8 saturn_state::stv_vdp2_are_map_registers_equal(void)
23102206{
23112207   int i;
23122208
r20791r20792
35223418
35233419*/
35243420
3525static void stv_vdp2_get_map_page( int x, int y, int *_map, int *_page )
3421void saturn_state::stv_vdp2_get_map_page( int x, int y, int *_map, int *_page )
35263422{
35273423   int page = 0;
35283424   int map = 0;
r20791r20792
60045900   machine().primary_screen->register_screen_bitmap(m_tmpbitmap);
60055901   stv_vdp2_start();
60065902   stv_vdp1_start();
6007   vdpdebug.l_en = 0xff;
6008   vdpdebug.error = 0xffffffff;
6009   vdpdebug.roz = 0;
5903   m_vdpdebug_roz = 0;
60105904   machine().gfx[0]->set_source(m_vdp2.gfx_decode);
60115905   machine().gfx[1]->set_source(m_vdp2.gfx_decode);
60125906   machine().gfx[2]->set_source(m_vdp2.gfx_decode);
r20791r20792
63126206   }
63136207}
63146208
6315/* VDP1 Framebuffer handling */
6316static int      stv_sprite_priorities_used[8];
6317static int      stv_sprite_priorities_usage_valid;
6318static UINT8    stv_sprite_priorities_in_fb_line[512][8];
6319
63206209void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 pri)
63216210{
63226211   int x,y,r,g,b;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team