src/mame/video/stvvdp2.c
| r12502 | r12503 | |
| 4368 | 4368 | // popmessage("Line Window %s %08x enabled, contact MAMEdev",STV_VDP2_W0LWE ? "0" : "1",STV_VDP2_W0LWTA); |
| 4369 | 4369 | |
| 4370 | 4370 | /* Akumajou Dracula, bits 2-4 */ |
| 4371 | | /* Arcana Strikes bit 5*/ |
| 4371 | /* Arcana Strikes bit 5 */ |
| 4372 | 4372 | /* Choh Makai Mura 0x0055 */ |
| 4373 | 4373 | /* Sega Rally 0x0155 */ |
| 4374 | | if(STV_VDP2_SFPRMD & ~0x0155) |
| 4374 | /* Find Love 0x4400 */ |
| 4375 | if(STV_VDP2_SFPRMD & ~0x4555) |
| 4375 | 4376 | popmessage("Special Priority Mode enabled %04x, contact MAMEdev",STV_VDP2_SFPRMD); |
| 4376 | 4377 | } |
| 4377 | 4378 | } |
| r12502 | r12503 | |
| 5571 | 5572 | |
| 5572 | 5573 | switch(offset) |
| 5573 | 5574 | { |
| 5574 | | case 0x0/4: |
| 5575 | case 0x000/4: |
| 5575 | 5576 | { |
| 5576 | 5577 | /* latch h/v signals thru HV latch*/ |
| 5577 | 5578 | if(!STV_VDP2_EXLTEN) |
| r12502 | r12503 | |
| 5585 | 5586 | |
| 5586 | 5587 | break; |
| 5587 | 5588 | } |
| 5588 | | case 0x4/4: |
| 5589 | case 0x004/4: |
| 5589 | 5590 | { |
| 5590 | 5591 | /*Screen Status Register*/ |
| 5591 | 5592 | /*VBLANK HBLANK ODD PAL */ |
| 5592 | | state->m_vdp2_regs[offset] = (state->m_vdp2.exltfg<<25) | (state->m_vdp2.exsyfg<<24) | (get_vblank(space->machine())<<19) | (get_hblank(space->machine())<<18) | (get_odd_bit(space->machine()) << 17) | (state->m_vdp2.pal << 16); |
| 5593 | state->m_vdp2_regs[offset] = (state->m_vdp2.exltfg<<25) | |
| 5594 | (state->m_vdp2.exsyfg<<24) | |
| 5595 | (get_vblank(space->machine())<<19) | |
| 5596 | (get_hblank(space->machine())<<18) | |
| 5597 | (get_odd_bit(space->machine()) << 17) | |
| 5598 | (state->m_vdp2.pal << 16) | |
| 5599 | (STV_VDP2_VRAMSZ << 15) | |
| 5600 | ((0 << 0) & 0xf); // VDP2 version |
| 5593 | 5601 | |
| 5594 | 5602 | /* vblank bit is always 1 if DISP bit is disabled */ |
| 5595 | 5603 | if(!STV_VDP2_DISP) |
| r12502 | r12503 | |
| 5601 | 5609 | state->m_vdp2.exltfg &= ~1; |
| 5602 | 5610 | state->m_vdp2.exsyfg &= ~1; |
| 5603 | 5611 | } |
| 5612 | if(ACCESSING_BITS_0_15) |
| 5613 | { |
| 5614 | if(!space->debugger_access()) |
| 5615 | printf("Warning: VDP2 version read\n"); |
| 5616 | } |
| 5604 | 5617 | break; |
| 5605 | 5618 | } |
| 5606 | | case 0x8/4: |
| 5619 | case 0x008/4: |
| 5607 | 5620 | /*H/V Counter Register*/ |
| 5608 | 5621 | { |
| 5609 | 5622 | state->m_vdp2_regs[offset] = (state->m_vdp2.h_count<<16)|(state->m_vdp2.v_count); |
| r12502 | r12503 | |
| 5757 | 5770 | state->m_vdp2.old_tvmd = STV_VDP2_TVMD; |
| 5758 | 5771 | stv_vdp2_dynamic_res_change(space->machine()); |
| 5759 | 5772 | } |
| 5773 | |
| 5774 | if(STV_VDP2_VRAMSZ) |
| 5775 | printf("VDP2 sets up 8 Mbit VRAM!\n"); |
| 5760 | 5776 | } |
| 5761 | 5777 | |
| 5762 | 5778 | static int get_hblank_duration(running_machine &machine) |
| r12502 | r12503 | |
| 6049 | 6065 | Done: |
| 6050 | 6066 | -Basic support(w0 or w1),bitmaps only. |
| 6051 | 6067 | -W0 (outside) for tilemaps and sprite layer. |
| 6068 | -Window logic. |
| 6052 | 6069 | |
| 6053 | 6070 | Not Done: |
| 6054 | 6071 | -Complete Windows on cells.A split between cells and bitmaps is in progress... |
| 6055 | 6072 | -w0 & w1 at the same time. |
| 6056 | | -Window logic. |
| 6057 | 6073 | -Line window. |
| 6058 | 6074 | -Color Calculation. |
| 6059 | 6075 | -Rotation parameter Window (already done?). |
| r12502 | r12503 | |
| 6167 | 6183 | |
| 6168 | 6184 | } |
| 6169 | 6185 | |
| 6170 | | static int stv_vdp2_window_process(running_machine &machine,int x,int y) |
| 6186 | static int get_window_pixel(UINT16 s_x,UINT16 e_x,UINT16 s_y,UINT16 e_y,int x, int y,UINT8 win_num) |
| 6171 | 6187 | { |
| 6172 | | UINT16 s_x=0,e_x=0,s_y=0,e_y=0; |
| 6173 | | |
| 6174 | | if ((stv2_current_tilemap.window_control & 6) == 0) |
| 6175 | | return 0; |
| 6176 | | |
| 6177 | | stv_vdp2_get_window0_coordinates(machine,&s_x, &e_x, &s_y, &e_y); |
| 6178 | | |
| 6179 | | if(stv2_current_tilemap.window_control & 2) |
| 6188 | if(stv2_current_tilemap.window_control & (2 << win_num)) |
| 6180 | 6189 | { |
| 6181 | 6190 | /*Outside Area*/ |
| 6182 | | if(stv2_current_tilemap.window_control & 0x10) |
| 6191 | if(stv2_current_tilemap.window_control & (0x10 << win_num)) |
| 6183 | 6192 | { |
| 6184 | 6193 | if(y < s_y || y > e_y) |
| 6185 | 6194 | return 1; |
| r12502 | r12503 | |
| 6204 | 6213 | } |
| 6205 | 6214 | } |
| 6206 | 6215 | |
| 6216 | return 0; |
| 6217 | } |
| 6218 | |
| 6219 | static int stv_vdp2_window_process(running_machine &machine,int x,int y) |
| 6220 | { |
| 6221 | UINT16 s_x=0,e_x=0,s_y=0,e_y=0; |
| 6222 | UINT8 w0_pix, w1_pix; |
| 6223 | |
| 6224 | if ((stv2_current_tilemap.window_control & 6) == 0) |
| 6225 | return 0; |
| 6226 | |
| 6227 | stv_vdp2_get_window0_coordinates(machine,&s_x, &e_x, &s_y, &e_y); |
| 6228 | w0_pix = get_window_pixel(s_x,e_x,s_y,e_y,x,y,0); |
| 6229 | |
| 6207 | 6230 | stv_vdp2_get_window1_coordinates(machine,&s_x, &e_x, &s_y, &e_y); |
| 6231 | w1_pix = get_window_pixel(s_x,e_x,s_y,e_y,x,y,1); |
| 6208 | 6232 | |
| 6209 | | if(stv2_current_tilemap.window_control & 4) |
| 6210 | | { |
| 6211 | | /*Outside Area*/ |
| 6212 | | if(stv2_current_tilemap.window_control & 0x20) |
| 6213 | | { |
| 6214 | | if(y < s_y || y > e_y) |
| 6215 | | return 1; |
| 6216 | | else |
| 6217 | | { |
| 6218 | | if(x < s_x || x > e_x) |
| 6219 | | return 1; |
| 6220 | | //else |
| 6221 | | // return 0; |
| 6222 | | } |
| 6223 | | } |
| 6224 | | /*Inside Area*/ |
| 6225 | | else |
| 6226 | | { |
| 6227 | | if(y > s_y && y < e_y) |
| 6228 | | { |
| 6229 | | if(x > s_x && x < e_x) |
| 6230 | | return 1; |
| 6231 | | } |
| 6232 | | //else |
| 6233 | | // return 0; |
| 6234 | | } |
| 6235 | | } |
| 6236 | | return 0; |
| 6237 | | // return 1; |
| 6233 | return stv2_current_tilemap.window_control & 1 ? (w0_pix & w1_pix) : (w0_pix | w1_pix); |
| 6238 | 6234 | } |
| 6239 | 6235 | |
| 6240 | 6236 | static int stv_vdp2_apply_window_on_layer(running_machine &machine,rectangle *cliprect) |