src/mess/video/fmtowns.c
| r6786 | r6787 | |
| 618 | 618 | * +6: Sprite Colour |
| 619 | 619 | * bit 15: use colour data in located in sprite RAM offset in bits 11-0 (x32) |
| 620 | 620 | */ |
| 621 | | void render_sprite_4(bitmap_t* bitmap, UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) |
| 621 | void render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) |
| 622 | 622 | { |
| 623 | 623 | INT16 xpos,ypos; |
| 624 | 624 | UINT16 col,pixel; |
| r6786 | r6787 | |
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | | void render_sprite_16(bitmap_t* bitmap, UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) |
| 695 | void render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) |
| 696 | 696 | { |
| 697 | 697 | INT16 xpos,ypos; |
| 698 | 698 | UINT16 col; |
| r6786 | r6787 | |
| 743 | 743 | } |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | | void draw_sprites(running_machine* machine,bitmap_t* bitmap, const rectangle* rect) |
| 746 | void draw_sprites(running_machine* machine, const rectangle* rect) |
| 747 | 747 | { |
| 748 | 748 | UINT16 sprite_limit = (towns_sprite_reg[0] | (towns_sprite_reg[1] << 8)) & 0x3ff; |
| 749 | 749 | int n; |
| r6786 | r6787 | |
| 781 | 781 | n,x,y,attr,colour,poffset,coffset); |
| 782 | 782 | #endif |
| 783 | 783 | 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); |
| 785 | 785 | } |
| 786 | 786 | else |
| 787 | 787 | { |
| r6786 | r6787 | |
| 791 | 791 | printf("Sprite16 #%i, X %i Y %i Attr %04x Col %04x Poff %05x Coff %05x\n", |
| 792 | 792 | n,x,y,attr,colour,poffset,coffset); |
| 793 | 793 | #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); |
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | 797 | } |
| r6786 | r6787 | |
| 1080 | 1080 | } |
| 1081 | 1081 | else |
| 1082 | 1082 | { |
| 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 | | |
| 1086 | 1083 | scanline = rect->min_y; |
| 1087 | 1084 | height = (rect->max_y - rect->min_y); |
| 1088 | 1085 | if(towns_crtc_reg[27] & 0x1000) |
| r6786 | r6787 | |
| 1207 | 1204 | } |
| 1208 | 1205 | } |
| 1209 | 1206 | |
| 1207 | static 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 | |
| 1214 | INTERRUPT_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 | |
| 1210 | 1223 | VIDEO_START( towns ) |
| 1211 | 1224 | { |
| 1212 | 1225 | towns_vram_wplane = 0x00; |
src/mess/drivers/fmtowns.c
| r6786 | r6787 | |
| 1911 | 1911 | PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) |
| 1912 | 1912 | INPUT_PORTS_END |
| 1913 | 1913 | |
| 1914 | | static 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 | | |
| 1920 | | static 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 | | |
| 1927 | 1914 | static DRIVER_INIT( towns ) |
| 1928 | 1915 | { |
| 1929 | 1916 | towns_vram = auto_alloc_array(machine,UINT32,0x20000); |