Previous 15994 Revisions Next

r6787 Sunday 27th December, 2009 at 10:16:40 UTC by Barry Rodewald
[FMTOWNS] Moved VBlank triggers to video/fmtowns.c, moved sprite updates to beginning of VBlank.
[src/mess/drivers]fmtowns.c
[src/mess/includes]fmtowns.h
[src/mess/video]fmtowns.c

src/mess/video/fmtowns.c
r6786r6787
618618 *       +6: Sprite Colour
619619 *          bit 15: use colour data in located in sprite RAM offset in bits 11-0 (x32)
620620 */
621void render_sprite_4(bitmap_t* bitmap, UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect)
621void render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect)
622622{
623623   INT16 xpos,ypos;
624624   UINT16 col,pixel;
r6786r6787
692692   }
693693}
694694
695void render_sprite_16(bitmap_t* bitmap, UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect)
695void render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect)
696696{
697697   INT16 xpos,ypos;
698698   UINT16 col;
r6786r6787
743743   }
744744}
745745
746void draw_sprites(running_machine* machine,bitmap_t* bitmap, const rectangle* rect)
746void draw_sprites(running_machine* machine, const rectangle* rect)
747747{
748748   UINT16 sprite_limit = (towns_sprite_reg[0] | (towns_sprite_reg[1] << 8)) & 0x3ff;
749749   int n;
r6786r6787
781781            n,x,y,attr,colour,poffset,coffset);
782782#endif
783783         if(!(colour & 0x2000))
784            render_sprite_4(bitmap,(poffset+pshift)&0x1ffff,coffset,x,y,attr&0x2000,attr&0x1000,rect);
784            render_sprite_4((poffset+pshift)&0x1ffff,coffset,x,y,attr&0x2000,attr&0x1000,rect);
785785      }
786786      else
787787      {
r6786r6787
791791         printf("Sprite16 #%i, X %i Y %i Attr %04x Col %04x Poff %05x Coff %05x\n",
792792            n,x,y,attr,colour,poffset,coffset);
793793#endif
794         render_sprite_16(bitmap,(poffset+pshift)&0x1ffff,x,y,attr&0x2000,attr&0x1000,rect);
794         render_sprite_16((poffset+pshift)&0x1ffff,x,y,attr&0x2000,attr&0x1000,rect);
795795      }
796796   }
797797}
r6786r6787
10801080   }
10811081   else
10821082   {
1083      if(towns_sprite_reg[1] & 0x80)  // if sprites are enabled, then sprites are drawn on this layer.
1084         draw_sprites(machine,bitmap,rect);
1085         
10861083      scanline = rect->min_y;
10871084      height = (rect->max_y - rect->min_y);
10881085      if(towns_crtc_reg[27] & 0x1000)
r6786r6787
12071204   }
12081205}
12091206
1207static TIMER_CALLBACK( towns_vblank_end )
1208{
1209   // here we'll clear the vsync signal, I presume it goes low on it's own eventually
1210   const device_config* dev = ptr;
1211   pic8259_set_irq_line(dev,3,0);  // IRQ11 = VSync
1212}
1213
1214INTERRUPT_GEN( towns_vsync_irq )
1215{
1216   const device_config* dev = devtag_get_device(device->machine,"pic8259_slave");
1217   pic8259_set_irq_line(dev,3,1);  // IRQ11 = VSync
1218   timer_set(device->machine,video_screen_get_time_until_vblank_end(device->machine->primary_screen),(void*)dev,0,towns_vblank_end);
1219   if(towns_sprite_reg[1] & 0x80)  // if sprites are enabled, then sprites are drawn on this layer.
1220      draw_sprites(dev->machine,&towns_crtc_layerscr[1]);
1221}
1222
12101223VIDEO_START( towns )
12111224{
12121225   towns_vram_wplane = 0x00;
src/mess/includes/fmtowns.h
r6786r6787
2525
2626void towns_update_video_banks(const address_space*);
2727
28INTERRUPT_GEN( towns_vsync_irq );
2829VIDEO_START( towns );
2930VIDEO_UPDATE( towns );
3031
src/mess/drivers/fmtowns.c
r6786r6787
19111911    PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED)
19121912INPUT_PORTS_END
19131913
1914static TIMER_CALLBACK( towns_vblank_end )
1915{
1916   // here we'll clear the vsync signal, I presume it goes low on it's own eventually
1917   pic8259_set_irq_line(ptr,3,0);  // IRQ11 = VSync
1918}
1919
1920static INTERRUPT_GEN( towns_vsync_irq )
1921{
1922   const device_config* dev = devtag_get_device(device->machine,"pic8259_slave");
1923   pic8259_set_irq_line(dev,3,1);  // IRQ11 = VSync
1924   timer_set(device->machine,video_screen_get_time_until_vblank_end(device->machine->primary_screen),(void*)dev,0,towns_vblank_end);
1925}
1926
19271914static DRIVER_INIT( towns )
19281915{
19291916   towns_vram = auto_alloc_array(machine,UINT32,0x20000);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team