diff options
author | 2017-09-09 00:51:23 +0200 | |
---|---|---|
committer | 2017-09-09 00:52:31 +0200 | |
commit | 8cfe16b9391d50d4a289dccec147dccf1ce8c1b5 (patch) | |
tree | 3ec88793d14c3e0e76b1b55c8ca1662ac67940c8 /src/devices/video/mb_vcu.cpp | |
parent | 490c9cf053437404593d5b3d707b1900d2017617 (diff) |
mb_vcu.cpp: added collision detection feature, specific to Mazer Blazer [Angelo Salese]
Diffstat (limited to 'src/devices/video/mb_vcu.cpp')
-rw-r--r-- | src/devices/video/mb_vcu.cpp | 77 |
1 files changed, 26 insertions, 51 deletions
diff --git a/src/devices/video/mb_vcu.cpp b/src/devices/video/mb_vcu.cpp index 193a0d2987b..1db506e3d0e 100644 --- a/src/devices/video/mb_vcu.cpp +++ b/src/devices/video/mb_vcu.cpp @@ -380,48 +380,48 @@ READ8_MEMBER( mb_vcu_device::load_gfx ) /* -Read-Modify-Write operation, not fully understood +Read-Modify-Write operations ----0 -111 (0x07) write to i/o? ----0 -011 (0x03) read to i/o? ----1 -011 (0x13) read to vram? +---0 -111 (0x07) write to i/o +---0 -011 (0x03) clear VRAM +---1 -011 (0x13) collision detection */ READ8_MEMBER( mb_vcu_device::load_set_clr ) { int xi,yi; int dstx,dsty; // uint8_t dot; - int bits = 0; - #if 0 - if(m_mode == 0x13) //|| m_mode == 0x03) - { - printf("[0] %02x ",m_ram[m_param_offset_latch]); - printf("X: %04x ",m_xpos); - printf("Y: %04x ",m_ypos); - printf("C1:%02x ",m_color1); - printf("C2:%02x ",m_color2); - printf("M :%02x ",m_mode); - printf("XS:%02x ",m_pix_xsize); - printf("YS:%02x ",m_pix_ysize); - printf("VB:%02x ",m_vbank); - printf("\n"); - } - #endif switch(m_mode) { - #if 0 case 0x13: { - uint8_t res = read_byte(m_xpos|m_ypos<<8|0<<16|(m_vbank)<<18); + bool collision_flag = false; + + for (yi = 0; yi < m_pix_ysize; yi++) + { + for (xi = 0; xi < m_pix_xsize; xi++) + { + dstx = (m_xpos + xi); + dsty = (m_ypos + yi); + + if(dstx < 256 && dsty < 256) + { + uint8_t res = read_byte(dstx|dsty<<8|0<<16|(m_vbank)<<18); + + if(res != 0xf) + collision_flag = true; + } + } + } - // TODO: offset? - if(res != 0xf) - m_ram[0x28] = res; + if(collision_flag == true) + m_ram[m_param_offset_latch] |= 8; + else + m_ram[m_param_offset_latch] &= ~8; break; } - #endif case 0x03: { @@ -435,32 +435,7 @@ READ8_MEMBER( mb_vcu_device::load_set_clr ) if(dstx < 256 && dsty < 256) { write_byte(dstx|dsty<<8|0<<16|(m_vbank)<<18, 0xf); - - #if 0 - dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (6-(bits & 7)); - dot&= 3; - - switch(dot) - { - case 0: - write_byte(dstx|dsty<<8, m_color1 & 0xf); - break; - case 1: - write_byte(dstx|dsty<<8, m_color1 >> 4); - break; - case 2: - write_byte(dstx|dsty<<8, m_color2 & 0xf); - break; - case 3: - write_byte(dstx|dsty<<8, m_color2 >> 4); - break; - } - #endif - - //write_byte(dstx|dsty<<8, m_mode >> 4); } - - bits+=2; } } break; |