| 1 | /* Mednafen - Multi-system Emulator |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 16 | */ |
| 17 | |
| 18 | /* VDC and VCE emulation */ |
| 19 | |
| 20 | /* |
| 21 | "Tonight I hooked up my Turbo Duo(with no games or CDs in it)'s video output to my PC sound card, recorded it, |
| 22 | and did a FFT and looked at the spectrum(around the line rate, 15-16KHz), and I also counted the number |
| 23 | of samples between the ~60Hz peaks(just to verify that the math shown below is remotely accurate). |
| 24 | |
| 25 | The spectrum peaked at 15734 Hz. 21477272.727272... / 3 / 15734 = 455.00(CPU cycles per scanline)" |
| 26 | */ |
| 27 | |
| 28 | #include "pce.h"cxx . . $ `<file>/mednafen/pce_fast/pce.h`/ |
| 29 | #include "../video.h"cxx . . $ `<file>/mednafen/video.h`/ |
| 30 | #include "vdc.h"cxx . . $ `<file>/mednafen/pce_fast/vdc.h`/ |
| 31 | #include "huc.h"cxx . . $ `<file>/mednafen/pce_fast/huc.h`/ |
| 32 | #include "pcecd.h"cxx . . $ `<file>/mednafen/pce_fast/pcecd.h`/ |
| 33 | #include "../FileStream.h"cxx . . $ `<file>/mednafen/FileStream.h`/ |
| 34 | #include <math.h> |
| 35 | |
| 36 | static uint32cxx . . $ uint32# userlecxx . . $ userle.; // User layer enable. |
| 37 | static uint32cxx . . $ uint32# disabled_layer_colorcxx . . $ disabled_layer_color.; |
| 38 | |
| 39 | static bool unlimited_spritescxx . . $ unlimited_sprites.; |
| 40 | static bool correct_aspectcxx . . $ correct_aspect.; |
| 41 | |
| 42 | #define ULE_BG0cxx . . $ `mednafen/pce_fast/vdc.cpp:42:9`! 1 |
| 43 | #define ULE_SPR0cxx . . $ `mednafen/pce_fast/vdc.cpp:43:9`! 2 |
| 44 | #define ULE_BG1cxx . . $ `mednafen/pce_fast/vdc.cpp:44:9`! 4 |
| 45 | #define ULE_SPR1cxx . . $ `mednafen/pce_fast/vdc.cpp:45:9`! 8 |
| 46 | |
| 47 | static const uint8cxx . . $ uint8# bat_width_shift_tabcxx . . $ bat_width_shift_tab.[4] = { 5, 6, 7, 7 }; |
| 48 | static const uint8cxx . . $ uint8# bat_height_mask_tabcxx . . $ bat_height_mask_tab.[2] = { 32 - 1, 64 - 1 }; |
| 49 | |
| 50 | static unsigned int VDScxx . . $ VDS.; |
| 51 | static unsigned int VSWcxx . . $ VSW.; |
| 52 | static unsigned int VDWcxx . . $ VDW.; |
| 53 | static unsigned int VCRcxx . . $ VCR.; |
| 54 | static unsigned int VBlankFLcxx . . $ VBlankFL.; |
| 55 | |
| 56 | vce_tcxx . . $ vce_t# vcecxx . . $ vce.; |
| 57 | |
| 58 | vdc_tcxx . . $ vdc_t# *vdccxx . . $ vdc. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 59 | |
| 60 | #define MAKECOLOR_PCEcxx . . $ `mednafen/pce_fast/vdc.cpp:60:9`!(val) ((((val & 0x038) >> 3) << 13)|(((((val & 0x038) >> 3) & 0x6) << 10) | (((val & 0x1c0) >> 6) << 8) | (((val & 0x1c0) >> 6) << 5) | ((val & 0x007) << 2) | ((val & 0x007) >> 1))) |
| 61 | |
| 62 | |
| 63 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void MDFN_FastU32MemsetM8cxx . . $ MDFN_FastU32MemsetM8(c28fbbcaa6c23e04).(uint32_tcxx . . $ uint32_t# *array, uint32_tcxx . . $ uint32_t# value_32, unsigned int u32len) |
| 64 | { |
| 65 | uint32_tcxx . . $ uint32_t# *ai; |
| 66 | |
| 67 | for(ai = array; ai < array + u32len; ai += 2) |
| 68 | { |
| 69 | ai[0] = value_32; |
| 70 | ai[1] = value_32; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void FixPCachecxx . . $ FixPCache(d4f767463ce0a6b3).(int entry) |
| 75 | { |
| 76 | if(!(entry & 0xFF)) |
| 77 | { |
| 78 | uint16_tcxx . . $ uint16_t# color0 = MAKECOLOR_PCEcxx . . $ `mednafen/pce_fast/vdc.cpp:60:9`!(vce.color_table[entry & 0x100]); |
| 79 | for(int x = 0; x < 16; x++) |
| 80 | vcecxx . . $ vce..color_table_cachecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table_cache.[entry + (x << 4)] = color0 ; |
| 81 | return; |
| 82 | } |
| 83 | |
| 84 | if(entry & 0xF) |
| 85 | vcecxx . . $ vce..color_table_cachecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table_cache.[entry] = MAKECOLOR_PCEcxx . . $ `mednafen/pce_fast/vdc.cpp:60:9`!(vce.color_table[entry]); |
| 86 | } |
| 87 | |
| 88 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void FixTileCachecxx . . $ FixTileCache(447ccb6254e14a0e).(vdc_tcxx . . $ vdc_t# *which_vdc, uint16cxx . . $ uint16# A) |
| 89 | { |
| 90 | uint32cxx . . $ uint32# charname = (A >> 4); |
| 91 | uint32cxx . . $ uint32# y = (A & 0x7); |
| 92 | uint64cxx . . $ uint64# *tc = &which_vdc->bg_tile_cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#bg_tile_cache.[charname][y]; |
| 93 | |
| 94 | uint32cxx . . $ uint32# bitplane01 = which_vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[y + charname * 16]; |
| 95 | uint32cxx . . $ uint32# bitplane23 = which_vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[y+ 8 + charname * 16]; |
| 96 | |
| 97 | *tc = 0; |
| 98 | |
| 99 | for(int x = 0; x < 8; x++) |
| 100 | { |
| 101 | uint32cxx . . $ uint32# raw_pixel = ((bitplane01 >> x) & 1); |
| 102 | raw_pixel |= ((bitplane01 >> (x + 8)) & 1) << 1; |
| 103 | raw_pixel |= ((bitplane23 >> x) & 1) << 2; |
| 104 | raw_pixel |= ((bitplane23 >> (x + 8)) & 1) << 3; |
| 105 | |
| 106 | #ifdef MSB_FIRST |
| 107 | *tc |= (uint64)raw_pixel << ((x) * 8); |
| 108 | #else |
| 109 | *tc |= (uint64cxx . . $ uint64#)raw_pixel << ((7 - x) * 8); |
| 110 | #endif |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void CheckFixSpriteTileCachecxx . . $ CheckFixSpriteTileCache(701ddf999d3192d7).(vdc_tcxx . . $ vdc_t# *which_vdc, uint16cxx . . $ uint16# no, uint32cxx . . $ uint32# special) |
| 115 | { |
| 116 | if(special != 0x4 && special != 0x5) |
| 117 | special = 0; |
| 118 | |
| 119 | if((special | 0x80) == which_vdc->spr_tile_cleancxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_clean.[no]) |
| 120 | return; |
| 121 | |
| 122 | //printf("Oops: %d, %d, %d\n", no, special | 0x100, which_vdc->spr_tile_clean[no]); |
| 123 | if((no * 64) >= VRAM_Sizecxx . . $ VRAM_Size.) |
| 124 | { |
| 125 | //printf("Unmapped: %d\n", no); |
| 126 | //VDC_UNDEFINED("Unmapped VRAM sprite tile read"); |
| 127 | // Unnecessary, since we reset the sprite tile cache to 0 on reset/init anyway. |
| 128 | //memset(which_vdc->spr_tile_cache[no], 0x00, 16 * 16 * sizeof(uint16)); |
| 129 | } |
| 130 | else if(special) |
| 131 | { |
| 132 | for(int y = 0; y < 16; y++) |
| 133 | { |
| 134 | uint8cxx . . $ uint8# *tc = which_vdc->spr_tile_cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_cache.[no][y]; |
| 135 | |
| 136 | uint32cxx . . $ uint32# bitplane0 = which_vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[y + 0x00 + no * 0x40 + ((special & 1) << 5)]; |
| 137 | uint32cxx . . $ uint32# bitplane1 = which_vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[y + 0x10 + no * 0x40 + ((special & 1) << 5)]; |
| 138 | |
| 139 | for(int x = 0; x < 16; x++) |
| 140 | { |
| 141 | uint32cxx . . $ uint32# raw_pixel; |
| 142 | raw_pixel = ((bitplane0 >> x) & 1) << 0; |
| 143 | raw_pixel |= ((bitplane1 >> x) & 1) << 1; |
| 144 | tc[x] = raw_pixel; |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | else |
| 149 | { |
| 150 | for(int y = 0; y < 16; y++) |
| 151 | { |
| 152 | uint8cxx . . $ uint8# *tc = which_vdc->spr_tile_cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_cache.[no][y]; |
| 153 | |
| 154 | uint32cxx . . $ uint32# bitplane0 = which_vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[y + 0x00 + no * 0x40]; |
| 155 | uint32cxx . . $ uint32# bitplane1 = which_vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[y + 0x10 + no * 0x40]; |
| 156 | uint32cxx . . $ uint32# bitplane2 = which_vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[y + 0x20 + no * 0x40]; |
| 157 | uint32cxx . . $ uint32# bitplane3 = which_vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[y + 0x30 + no * 0x40]; |
| 158 | |
| 159 | for(int x = 0; x < 16; x++) |
| 160 | { |
| 161 | uint32cxx . . $ uint32# raw_pixel; |
| 162 | raw_pixel = ((bitplane0 >> x) & 1) << 0; |
| 163 | raw_pixel |= ((bitplane1 >> x) & 1) << 1; |
| 164 | raw_pixel |= ((bitplane2 >> x) & 1) << 2; |
| 165 | raw_pixel |= ((bitplane3 >> x) & 1) << 3; |
| 166 | tc[x] = raw_pixel; |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | which_vdc->spr_tile_cleancxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_clean.[no] = special | 0x80; |
| 172 | } |
| 173 | |
| 174 | |
| 175 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void SetVCECRcxx . . $ SetVCECR(ac50b47256ae7414).(uint8cxx . . $ uint8# V) |
| 176 | { |
| 177 | if(((V & 0x80) >> 7) != vcecxx . . $ vce..bwcxx . . $ $anonymous_type_c69ee54cc268614d_1#bw.) |
| 178 | { |
| 179 | vcecxx . . $ vce..bwcxx . . $ $anonymous_type_c69ee54cc268614d_1#bw. = V & 0x80; |
| 180 | for(int x = 0; x < 512; x++) |
| 181 | FixPCachecxx . . $ FixPCache(d4f767463ce0a6b3).(x); |
| 182 | } |
| 183 | |
| 184 | vcecxx . . $ vce..lc263cxx . . $ $anonymous_type_c69ee54cc268614d_1#lc263. = (V & 0x04); |
| 185 | vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock. = V & 1; |
| 186 | if(V & 2) |
| 187 | vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock. = 2; |
| 188 | vcecxx . . $ vce..CRcxx . . $ $anonymous_type_c69ee54cc268614d_1#CR. = V; |
| 189 | } |
| 190 | |
| 191 | static unsigned int frame_countercxx . . $ frame_counter.; |
| 192 | static int32cxx . . $ int32# need_vbicxx . . $ need_vbi.[2] = { 0, 0 }; |
| 193 | static int32cxx . . $ int32# line_leadin1cxx . . $ line_leadin1. = 0; |
| 194 | static int32cxx . . $ int32# magicalcxx . . $ magical., cyc_totcxx . . $ cyc_tot.; |
| 195 | |
| 196 | vpc_tcxx . . $ vpc_t# vpccxx . . $ vpc.; |
| 197 | |
| 198 | // Some virtual vdc macros to make code simpler to read |
| 199 | #define M_vdc_HSWcxx . . $ `mednafen/pce_fast/vdc.cpp:199:9`! (vdc->HSR & 0x1F) // Horizontal Synchro Width |
| 200 | #define M_vdc_HDScxx . . $ `mednafen/pce_fast/vdc.cpp:200:9`! ((vdc->HSR >> 8) & 0x7F) // Horizontal Display Start |
| 201 | #define M_vdc_HDWcxx . . $ `mednafen/pce_fast/vdc.cpp:201:9`! (vdc->HDR & 0x7F) // Horizontal Display Width |
| 202 | #define M_vdc_HDEcxx . . $ `mednafen/pce_fast/vdc.cpp:202:9`! ((vdc->HDR >> 8) & 0x7F) // Horizontal Display End |
| 203 | |
| 204 | #define M_vdc_VSWcxx . . $ `mednafen/pce_fast/vdc.cpp:204:9`! (vdc->VSR & 0x1F) // Vertical synchro width |
| 205 | #define M_vdc_VDScxx . . $ `mednafen/pce_fast/vdc.cpp:205:9`! ((vdc->VSR >> 8) & 0xFF) // Vertical Display Start |
| 206 | #define M_vdc_VDWcxx . . $ `mednafen/pce_fast/vdc.cpp:206:9`! (vdc->VDR & 0x1FF) // Vertical Display Width(Height? :b) |
| 207 | #define M_vdc_VCRcxx . . $ `mednafen/pce_fast/vdc.cpp:207:9`! (vdc->VCR & 0xFF) |
| 208 | |
| 209 | #define VDCS_CRcxx . . $ `mednafen/pce_fast/vdc.cpp:209:9`! 0x01 // Sprite #0 collision interrupt occurred |
| 210 | #define VDCS_ORcxx . . $ `mednafen/pce_fast/vdc.cpp:210:9`! 0x02 // sprite overflow "" "" |
| 211 | #define VDCS_RRcxx . . $ `mednafen/pce_fast/vdc.cpp:211:9`! 0x04 // RCR "" "" |
| 212 | #define VDCS_DScxx . . $ `mednafen/pce_fast/vdc.cpp:212:9`! 0x08 // VRAM to SAT DMA completion interrupt occurred |
| 213 | #define VDCS_DVcxx . . $ `mednafen/pce_fast/vdc.cpp:213:9`! 0x10 // VRAM to VRAM DMA completion interrupt occurred |
| 214 | #define VDCS_VDcxx . . $ `mednafen/pce_fast/vdc.cpp:214:9`! 0x20 // Vertical blank interrupt occurred |
| 215 | #define VDCS_BSYcxx . . $ `mednafen/pce_fast/vdc.cpp:215:9`! 0x40 // VDC is waiting for a CPU access slot during the active display area?? |
| 216 | |
| 217 | void VDC_SetPixelFormatcxx . . $ VDC_SetPixelFormat(49f6e7a06ebc5aa8).(void) |
| 218 | { |
| 219 | // I know the temptation is there, but don't combine these two loops just |
| 220 | // because they loop 512 times ;) |
| 221 | for(int x = 0; x < 512; x++) |
| 222 | FixPCachecxx . . $ FixPCache(d4f767463ce0a6b3).(x); |
| 223 | |
| 224 | disabled_layer_colorcxx . . $ disabled_layer_color. = MAKECOLORcxx . . $ `mednafen/video.h:17:9`!(0x00, 0xFE, 0x00, 0); |
| 225 | } |
| 226 | |
| 227 | DECLFRcxx . . $ `mednafen/pce_fast/pce.h:11:9`!(VCE_Read) |
| 228 | { |
| 229 | switch(A & 0x7) |
| 230 | { |
| 231 | case 4: |
| 232 | return (vcecxx . . $ vce..color_tablecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table.[vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. & 0x1FF]); |
| 233 | case 5: |
| 234 | { |
| 235 | uint8cxx . . $ uint8# ret = vcecxx . . $ vce..color_tablecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table.[vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. & 0x1FF] >> 8; |
| 236 | ret &= 1; |
| 237 | ret |= 0xFE; |
| 238 | vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress.++; |
| 239 | return(ret); |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | return(0xFF); |
| 244 | } |
| 245 | |
| 246 | DECLFWcxx . . $ `mednafen/pce_fast/pce.h:12:9`!(VCE_Write) |
| 247 | { |
| 248 | //printf("%04x %02x, %04x\n", A, V, HuCPU.PC); |
| 249 | switch(A&0x7) |
| 250 | { |
| 251 | case 0: SetVCECRcxx . . $ SetVCECR(ac50b47256ae7414).(V); break; |
| 252 | case 2: vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. &= 0x100; vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. |= V; break; |
| 253 | case 3: vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. &= 0x0FF; vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. |= (V & 1) << 8; break; |
| 254 | case 4: vcecxx . . $ vce..color_tablecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table.[vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. & 0x1FF] &= 0x100; |
| 255 | vcecxx . . $ vce..color_tablecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table.[vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. & 0x1FF] |= V; |
| 256 | FixPCachecxx . . $ FixPCache(d4f767463ce0a6b3).(vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. & 0x1FF); |
| 257 | break; |
| 258 | case 5: vcecxx . . $ vce..color_tablecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table.[vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. & 0x1FF] &= 0xFF; |
| 259 | vcecxx . . $ vce..color_tablecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table.[vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. & 0x1FF] |= (V & 1) << 8; |
| 260 | FixPCachecxx . . $ FixPCache(d4f767463ce0a6b3).(vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress. & 0x1FF); |
| 261 | vcecxx . . $ vce..ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress.++; |
| 262 | break; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | |
| 267 | void VDC_SetLayerEnableMaskcxx . . $ VDC_SetLayerEnableMask(2c44cd906ae4e829).(uint64cxx . . $ uint64# mask) |
| 268 | { |
| 269 | userlecxx . . $ userle. = mask; |
| 270 | } |
| 271 | |
| 272 | DECLFWcxx . . $ `mednafen/pce_fast/pce.h:12:9`!(VDC_Write_ST) |
| 273 | { |
| 274 | //printf("WriteST: %04x %02x\n", A, V); |
| 275 | VDC_Writecxx . . $ VDC_Write(cc289a6b3dfc48da).(A, V); |
| 276 | } |
| 277 | |
| 278 | static void DoDMAcxx . . $ DoDMA(3156015dbbc7fd1).(vdc_tcxx . . $ vdc_t# *vdc) |
| 279 | { |
| 280 | // Assuming one cycle for reads, one cycle for write, with DMA? |
| 281 | for(int i = 0; i < 455; i++) |
| 282 | { |
| 283 | if(!vdc->DMAReadWritecxx . . $ $anonymous_type_c69ee54cc268614d_3#DMAReadWrite.) |
| 284 | { |
| 285 | if(vdc->SOURcxx . . $ $anonymous_type_c69ee54cc268614d_3#SOUR. >= VRAM_Sizecxx . . $ VRAM_Size.) |
| 286 | VDC_UNDEFINEDcxx . . $ `mednafen/pce_fast/vdc.h:9:9`!("Unmapped VRAM DMA read"); |
| 287 | |
| 288 | vdc->DMAReadBuffercxx . . $ $anonymous_type_c69ee54cc268614d_3#DMAReadBuffer. = vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[vdc->SOURcxx . . $ $anonymous_type_c69ee54cc268614d_3#SOUR.]; |
| 289 | } |
| 290 | else |
| 291 | { |
| 292 | if(vdc->DESRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DESR. < VRAM_Sizecxx . . $ VRAM_Size.) |
| 293 | { |
| 294 | vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[vdc->DESRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DESR.] = vdc->DMAReadBuffercxx . . $ $anonymous_type_c69ee54cc268614d_3#DMAReadBuffer.; |
| 295 | FixTileCachecxx . . $ FixTileCache(447ccb6254e14a0e).(vdc, vdc->DESRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DESR.); |
| 296 | vdc->spr_tile_cleancxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_clean.[vdc->DESRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DESR. >> 6] = 0; |
| 297 | } |
| 298 | |
| 299 | //if(vdc->DCR & 0xC) |
| 300 | //printf("Pllal: %02x\n", vdc->DCR); |
| 301 | |
| 302 | vdc->SOURcxx . . $ $anonymous_type_c69ee54cc268614d_3#SOUR. += (((vdc->DCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DCR. & 0x4) >> 1) ^ 2) - 1; |
| 303 | vdc->DESRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DESR. += (((vdc->DCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DCR. & 0x8) >> 2) ^ 2) - 1; |
| 304 | vdc->LENRcxx . . $ $anonymous_type_c69ee54cc268614d_3#LENR.--; |
| 305 | if(vdc->LENRcxx . . $ $anonymous_type_c69ee54cc268614d_3#LENR. == 0xFFFF) // DMA is done. |
| 306 | { |
| 307 | vdc->DMARunningcxx . . $ $anonymous_type_c69ee54cc268614d_3#DMARunning. = 0; |
| 308 | if(vdc->DCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DCR. & 0x02) |
| 309 | { |
| 310 | vdc->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status. |= VDCS_DVcxx . . $ `mednafen/pce_fast/vdc.cpp:213:9`!; |
| 311 | HuC6280_IRQBegincxx . . $ HuC6280_IRQBegin(d4f767463ce0a6b3).(MDFN_IQIRQ1cxx . . $ `mednafen/pce_fast/huc6280.h:65:9`!); |
| 312 | VDC_DEBUGcxx . . $ `mednafen/pce_fast/vdc.h:7:9`!("DMA IRQ"); |
| 313 | } |
| 314 | break; |
| 315 | } |
| 316 | } |
| 317 | vdc->DMAReadWritecxx . . $ $anonymous_type_c69ee54cc268614d_3#DMAReadWrite. ^= 1; |
| 318 | } // for() |
| 319 | } |
| 320 | |
| 321 | DECLFWcxx . . $ `mednafen/pce_fast/pce.h:12:9`!(VDC_Write) |
| 322 | { |
| 323 | int msb = A & 1; |
| 324 | int chip = 0; |
| 325 | |
| 326 | A &= 0x3; |
| 327 | //if((A == 0x2 || A == 0x3) && ((vdc->select & 0x1f) >= 0x09) && ((vdc->select & 0x1f) <= 0x13)) |
| 328 | |
| 329 | //printf("%04x, %02x: %02x, %d\n", A, vdc->select, V, vdc->display_counter); |
| 330 | |
| 331 | switch(A) |
| 332 | { |
| 333 | case 0x0: vdccxx . . $ vdc.->selectcxx . . $ $anonymous_type_c69ee54cc268614d_3#select. = V & 0x1F; break; |
| 334 | case 0x2: |
| 335 | case 0x3: |
| 336 | switch(vdccxx . . $ vdc.->selectcxx . . $ $anonymous_type_c69ee54cc268614d_3#select. & 0x1F) |
| 337 | { |
| 338 | case 0x00: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->MAWR, V, msb); break; |
| 339 | case 0x01: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->MARR, V, msb); |
| 340 | if(msb) |
| 341 | { |
| 342 | if(vdccxx . . $ vdc.->MARRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MARR. >= VRAM_Sizecxx . . $ VRAM_Size.) |
| 343 | VDC_UNDEFINEDcxx . . $ `mednafen/pce_fast/vdc.h:9:9`!("Unmapped VRAM VRR(MARR set) read"); |
| 344 | |
| 345 | vdccxx . . $ vdc.->read_buffercxx . . $ $anonymous_type_c69ee54cc268614d_3#read_buffer. = vdccxx . . $ vdc.->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[vdccxx . . $ vdc.->MARRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MARR.]; |
| 346 | } |
| 347 | break; |
| 348 | case 0x02: if(!msb) vdccxx . . $ vdc.->write_latchcxx . . $ $anonymous_type_c69ee54cc268614d_3#write_latch. = V; |
| 349 | else |
| 350 | { |
| 351 | if(vdccxx . . $ vdc.->MAWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MAWR. < VRAM_Sizecxx . . $ VRAM_Size.) |
| 352 | { |
| 353 | // A hack to fix Crest of Wolf, and maybe others. |
| 354 | while(vdccxx . . $ vdc.->DMARunningcxx . . $ $anonymous_type_c69ee54cc268614d_3#DMARunning.) |
| 355 | DoDMAcxx . . $ DoDMA(3156015dbbc7fd1).(vdccxx . . $ vdc.); |
| 356 | |
| 357 | vdccxx . . $ vdc.->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[vdccxx . . $ vdc.->MAWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MAWR.] = (V << 8) | vdccxx . . $ vdc.->write_latchcxx . . $ $anonymous_type_c69ee54cc268614d_3#write_latch.; |
| 358 | FixTileCachecxx . . $ FixTileCache(447ccb6254e14a0e).(vdccxx . . $ vdc., vdccxx . . $ vdc.->MAWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MAWR.); |
| 359 | vdccxx . . $ vdc.->spr_tile_cleancxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_clean.[vdccxx . . $ vdc.->MAWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MAWR. >> 6] = 0; |
| 360 | } |
| 361 | else |
| 362 | { |
| 363 | //VDC_UNDEFINED("Unmapped VRAM write"); |
| 364 | //printf("VROOM: %04x, %02x\n", vdc->MAWR, (vdc->CR >> 11) & 0x3); |
| 365 | } |
| 366 | vdccxx . . $ vdc.->MAWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MAWR. += vram_inc_tabcxx . . $ vram_inc_tab.[(vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. >> 11) & 0x3]; |
| 367 | } |
| 368 | break; |
| 369 | case 0x05: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->CR, V, msb); break; |
| 370 | case 0x06: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->RCR, V, msb); vdccxx . . $ vdc.->RCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#RCR. &= 0x3FF; break; |
| 371 | case 0x07: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->BXR, V, msb); vdccxx . . $ vdc.->BXRcxx . . $ $anonymous_type_c69ee54cc268614d_3#BXR. &= 0x3FF; break; |
| 372 | case 0x08: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->BYR, V, msb); vdccxx . . $ vdc.->BYRcxx . . $ $anonymous_type_c69ee54cc268614d_3#BYR. &= 0x1FF; |
| 373 | vdccxx . . $ vdc.->BG_YOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_YOffset. = vdccxx . . $ vdc.->BYRcxx . . $ $anonymous_type_c69ee54cc268614d_3#BYR.; // Set it on LSB and MSB writes(only changing on MSB breaks Youkai Douchuuki) |
| 374 | //printf("%04x\n", HuCPU.PC); |
| 375 | break; |
| 376 | case 0x09: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->MWR, V, msb); break; |
| 377 | case 0x0a: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->HSR, V, msb); break; |
| 378 | case 0x0b: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->HDR, V, msb); break; |
| 379 | case 0x0c: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->VSR, V, msb); break; |
| 380 | case 0x0d: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->VDR, V, msb); break; |
| 381 | case 0x0e: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->VCR, V, msb); break; |
| 382 | case 0x0f: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->DCR, V, msb); break; |
| 383 | case 0x10: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->SOUR, V, msb); break; |
| 384 | case 0x11: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->DESR, V, msb); break; |
| 385 | case 0x12: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->LENR, V, msb); |
| 386 | if(msb) |
| 387 | { |
| 388 | vdccxx . . $ vdc.->DMARunningcxx . . $ $anonymous_type_c69ee54cc268614d_3#DMARunning. = 1; |
| 389 | vdccxx . . $ vdc.->DMAReadWritecxx . . $ $anonymous_type_c69ee54cc268614d_3#DMAReadWrite. = 0; |
| 390 | if(vdccxx . . $ vdc.->burst_modecxx . . $ $anonymous_type_c69ee54cc268614d_3#burst_mode. && !(vdccxx . . $ vdc.->DCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DCR. & 0x02)) |
| 391 | DoDMAcxx . . $ DoDMA(3156015dbbc7fd1).(vdccxx . . $ vdc.); // Do one line's worth of DMA transfers |
| 392 | // because Cosmic Fantasy 4 is evil |
| 393 | // and uses timed writes to the DMA |
| 394 | // start register, rather than waiting until |
| 395 | // the machine says we're done, |
| 396 | // which would require cycle-accurate VDC emulation...like that's |
| 397 | // going to happen when I don't even have accurate values |
| 398 | // for HuC6280 instruction timings. :b |
| 399 | } |
| 400 | break; |
| 401 | case 0x13: REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(vdc->SATB, V, msb); vdccxx . . $ vdc.->SATBPendingcxx . . $ $anonymous_type_c69ee54cc268614d_3#SATBPending. = 1; break; |
| 402 | // default: printf("Oops 2: %04x %02x\n", vdc->select, V);break; |
| 403 | } |
| 404 | break; |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | |
| 409 | // 682 + 8 + 128 = 818. |
| 410 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void CalcStartEndcxx . . $ CalcStartEnd(67094e1f07cf5afd).(const vdc_tcxx . . $ vdc_t# *vdc, uint32cxx . . $ uint32# &start, uint32cxx . . $ uint32# &end) |
| 411 | { |
| 412 | //static const unsigned int ClockModeWidths[3] = { 288, 384, 576 }; |
| 413 | static const unsigned int ClockPixelWidths[3] = { 341, 455, 682 }; |
| 414 | |
| 415 | start = (M_vdc_HDScxx . . $ `mednafen/pce_fast/vdc.cpp:200:9`! + 1) * 8; |
| 416 | // Semi-hack for Asuka 120% |
| 417 | if(vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock. == 1 && M_vdc_HDScxx . . $ `mednafen/pce_fast/vdc.cpp:200:9`! == 5 && M_vdc_HDEcxx . . $ `mednafen/pce_fast/vdc.cpp:202:9`! == 6 && M_vdc_HDWcxx . . $ `mednafen/pce_fast/vdc.cpp:201:9`! == 43 && M_vdc_HSWcxx . . $ `mednafen/pce_fast/vdc.cpp:199:9`! == 2) |
| 418 | start -= 8; |
| 419 | else if(vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock. == 0 && M_vdc_HDScxx . . $ `mednafen/pce_fast/vdc.cpp:200:9`! == 2 && M_vdc_HDEcxx . . $ `mednafen/pce_fast/vdc.cpp:202:9`! == 3 && M_vdc_HDWcxx . . $ `mednafen/pce_fast/vdc.cpp:201:9`! == 33 && M_vdc_HSWcxx . . $ `mednafen/pce_fast/vdc.cpp:199:9`! == 2) |
| 420 | start -= 4; |
| 421 | // and for Addams Family |
| 422 | else if(vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock. == 1 && M_vdc_HDScxx . . $ `mednafen/pce_fast/vdc.cpp:200:9`! == 4 && M_vdc_HDEcxx . . $ `mednafen/pce_fast/vdc.cpp:202:9`! == 4 && M_vdc_HDWcxx . . $ `mednafen/pce_fast/vdc.cpp:201:9`! == 43 && M_vdc_HSWcxx . . $ `mednafen/pce_fast/vdc.cpp:199:9`! == 9) |
| 423 | start -= 4; |
| 424 | end = start + (M_vdc_HDWcxx . . $ `mednafen/pce_fast/vdc.cpp:201:9`! + 1) * 8; |
| 425 | |
| 426 | if(start > (ClockPixelWidths[vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.])) |
| 427 | start = ClockPixelWidths[vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.]; |
| 428 | |
| 429 | if(end > (ClockPixelWidths[vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.])) |
| 430 | end = ClockPixelWidths[vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.]; |
| 431 | |
| 432 | if(start == end) // In case HDS is way off-screen, REMOVE when we confirm the rest of the code won't flip out |
| 433 | start = end - 8; // when start == end; |
| 434 | |
| 435 | // For: start - (vdc->BG_XOffset & 7) |
| 436 | end += 8; |
| 437 | start += 8; |
| 438 | |
| 439 | // For: alignment space when correct_aspect == 0 |
| 440 | end += 128; |
| 441 | start += 128; |
| 442 | } |
| 443 | |
| 444 | #define CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(n) (((n) << 4) | ((n) << 12) | ((n) << 20) | ((n) << 28) | ((n) << 36) | ((n) << 44) | ((n) << 52) | ((n) << 60)) |
| 445 | static const uint64cxx . . $ uint64# cblock_exlutcxx . . $ cblock_exlut.[16] = { |
| 446 | CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(0ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(1ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(2ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(3ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(4ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(5ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(6ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(7ULL), |
| 447 | CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(8ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(9ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(10ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(11ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(12ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(13ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(14ULL), CB_EXLcxx . . $ `mednafen/pce_fast/vdc.cpp:444:9`!(15ULL) |
| 448 | }; |
| 449 | |
| 450 | static void DrawBGcxx . . $ DrawBG(debc6c45b8a7b096).(const vdc_tcxx . . $ vdc_t# *vdc, const uint32cxx . . $ uint32# count, uint8cxx . . $ uint8# *target) NO_INLINEcxx . . $ `mednafen/mednafen-types.h:22:11`!; |
| 451 | static void DrawBGcxx . . $ DrawBG(debc6c45b8a7b096).(const vdc_tcxx . . $ vdc_t# *vdc, const uint32cxx . . $ uint32# count, uint8cxx . . $ uint8# *target) |
| 452 | { |
| 453 | int bat_width_shift = bat_width_shift_tabcxx . . $ bat_width_shift_tab.[(vdc->MWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MWR. >> 4) & 3]; |
| 454 | int bat_width_mask = (1U << bat_width_shift) - 1; |
| 455 | int bat_height_mask = bat_height_mask_tabcxx . . $ bat_height_mask_tab.[(vdc->MWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MWR. >> 6) & 1]; |
| 456 | uint64cxx . . $ uint64# *target64 = (uint64cxx . . $ uint64# *)target; |
| 457 | |
| 458 | { |
| 459 | int bat_y = ((vdc->BG_YOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_YOffset. >> 3) & bat_height_mask) << bat_width_shift; |
| 460 | |
| 461 | int bat_boom = (vdc->BG_XOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_XOffset. >> 3) & bat_width_mask; |
| 462 | int line_sub = vdc->BG_YOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_YOffset. & 7; |
| 463 | |
| 464 | const uint16cxx . . $ uint16# *BAT_Base = &vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[bat_y]; |
| 465 | const uint64cxx . . $ uint64# *CG_Base = &vdc->bg_tile_cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#bg_tile_cache.[0][line_sub]; |
| 466 | |
| 467 | uint64_tcxx . . $ uint64_t# cg_mask = 0xFFFFFFFFFFFFFFFFULL; |
| 468 | |
| 469 | if((vdc->MWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MWR. & 0x3) == 0x3) |
| 470 | cg_mask = (vdc->MWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MWR. & 0x80) ? 0xCCCCCCCCCCCCCCCCULL : 0x3333333333333333ULL; |
| 471 | |
| 472 | for(int x = count - 1; x >= 0; x -= 8) |
| 473 | { |
| 474 | const uint16cxx . . $ uint16# bat = BAT_Base[bat_boom]; |
| 475 | const uint64cxx . . $ uint64# color_or = cblock_exlutcxx . . $ cblock_exlut.[bat >> 12]; |
| 476 | |
| 477 | *target64 = (CG_Base[(bat & 0xFFF) * 8] & cg_mask) | color_or; |
| 478 | |
| 479 | bat_boom = (bat_boom + 1) & bat_width_mask; |
| 480 | target64++; |
| 481 | } |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | #define SPRF_PRIORITYcxx . . $ `mednafen/pce_fast/vdc.cpp:485:9`! 0x00080 |
| 486 | #define SPRF_HFLIPcxx . . $ `mednafen/pce_fast/vdc.cpp:486:9`! 0x00800 |
| 487 | #define SPRF_VFLIPcxx . . $ `mednafen/pce_fast/vdc.cpp:487:9`! 0x08000 |
| 488 | #define SPRF_SPRITE0cxx . . $ `mednafen/pce_fast/vdc.cpp:488:9`! 0x10000 |
| 489 | |
| 490 | static const unsigned int sprite_height_tabcxx . . $ sprite_height_tab.[4] = { 16, 32, 64, 64 }; |
| 491 | static const unsigned int sprite_height_no_maskcxx . . $ sprite_height_no_mask.[4] = { ~0U, ~2U, ~6U, ~6U }; |
| 492 | |
| 493 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void RebuildSATCachecxx . . $ RebuildSATCache(3156015dbbc7fd1).(vdc_tcxx . . $ vdc_t# *vdc) |
| 494 | { |
| 495 | unsigned i; |
| 496 | SAT_Cache_tcxx . . $ SAT_Cache_t# *sat_ptr = (SAT_Cache_tcxx . . $ SAT_Cache_t#*)vdc->SAT_Cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT_Cache.; |
| 497 | |
| 498 | vdc->SAT_Cache_Validcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT_Cache_Valid. = 0; |
| 499 | |
| 500 | for(i = 0; i < 64; i++) |
| 501 | { |
| 502 | uint16cxx . . $ uint16# height; |
| 503 | |
| 504 | const uint16cxx . . $ uint16# SATR0 = vdc->SATcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT.[i * 4 + 0x0]; |
| 505 | const uint16cxx . . $ uint16# SATR1 = vdc->SATcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT.[i * 4 + 0x1]; |
| 506 | const uint16cxx . . $ uint16# SATR2 = vdc->SATcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT.[i * 4 + 0x2]; |
| 507 | const uint16cxx . . $ uint16# SATR3 = vdc->SATcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT.[i * 4 + 0x3]; |
| 508 | |
| 509 | |
| 510 | int16cxx . . $ int16# y = (int16cxx . . $ int16#)(SATR0 & 0x3FF) - 0x40; |
| 511 | uint16cxx . . $ uint16# x = SATR1 & 0x3FF; |
| 512 | uint16cxx . . $ uint16# no = (SATR2 >> 1) & 0x3FF; |
| 513 | uint16cxx . . $ uint16# flags = (SATR3); |
| 514 | bool cgmode = SATR2 & 0x1; |
| 515 | |
| 516 | uint32cxx . . $ uint32# width = ((flags >> 8) & 1); |
| 517 | flags &= ~0x100; |
| 518 | |
| 519 | height = sprite_height_tabcxx . . $ sprite_height_tab.[(flags >> 12) & 3]; |
| 520 | no &= sprite_height_no_maskcxx . . $ sprite_height_no_mask.[(flags >> 12) & 3]; |
| 521 | |
| 522 | no = ((no & ~width) | 0) ^ ((flags & SPRF_HFLIPcxx . . $ `mednafen/pce_fast/vdc.cpp:486:9`!) ? width : 0); |
| 523 | |
| 524 | sat_ptr->ycxx . . $ $anonymous_type_c69ee54cc268614d_2#y. = y; |
| 525 | sat_ptr->heightcxx . . $ $anonymous_type_c69ee54cc268614d_2#height. = height; |
| 526 | sat_ptr->xcxx . . $ $anonymous_type_c69ee54cc268614d_2#x. = x; |
| 527 | sat_ptr->nocxx . . $ $anonymous_type_c69ee54cc268614d_2#no. = no; |
| 528 | sat_ptr->flagscxx . . $ $anonymous_type_c69ee54cc268614d_2#flags. = flags; |
| 529 | sat_ptr->cgmodecxx . . $ $anonymous_type_c69ee54cc268614d_2#cgmode. = cgmode; |
| 530 | |
| 531 | sat_ptr++; |
| 532 | vdc->SAT_Cache_Validcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT_Cache_Valid.++; |
| 533 | |
| 534 | if(width) |
| 535 | { |
| 536 | no = ((no & ~width) | 1) ^ ((flags & SPRF_HFLIPcxx . . $ `mednafen/pce_fast/vdc.cpp:486:9`!) ? width : 0); |
| 537 | x += 16; |
| 538 | |
| 539 | *sat_ptr =cxx . . $ $anonymous_type_c69ee54cc268614d_2#`operator=`(20bb08cb3380d6eb). *(sat_ptr - 1); |
| 540 | |
| 541 | sat_ptr->nocxx . . $ $anonymous_type_c69ee54cc268614d_2#no. = no; |
| 542 | sat_ptr->xcxx . . $ $anonymous_type_c69ee54cc268614d_2#x. = x; |
| 543 | |
| 544 | sat_ptr++; |
| 545 | vdc->SAT_Cache_Validcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT_Cache_Valid.++; |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void DoSATDMAcxx . . $ DoSATDMA(3156015dbbc7fd1).(vdc_tcxx . . $ vdc_t# *vdc) |
| 551 | { |
| 552 | unsigned i; |
| 553 | if(vdc->SATBcxx . . $ $anonymous_type_c69ee54cc268614d_3#SATB. > (VRAM_Sizecxx . . $ VRAM_Size. - 0x100)) |
| 554 | VDC_UNDEFINEDcxx . . $ `mednafen/pce_fast/vdc.h:9:9`!("Unmapped VRAM SATB DMA read"); |
| 555 | |
| 556 | for(i = 0; i < 256; i++) |
| 557 | vdc->SATcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT.[i] = vdc->VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[(vdc->SATBcxx . . $ $anonymous_type_c69ee54cc268614d_3#SATB. + i) & 0xFFFF]; |
| 558 | |
| 559 | RebuildSATCachecxx . . $ RebuildSATCache(3156015dbbc7fd1).(vdc); |
| 560 | } |
| 561 | |
| 562 | |
| 563 | typedef structcxx . . $ $anonymous_type_83a3a9ca9f31744b_0# |
| 564 | { |
| 565 | uint32cxx . . $ uint32# xcxx . . $ $anonymous_type_83a3a9ca9f31744b_0#x.; |
| 566 | uint32cxx . . $ uint32# flagscxx . . $ $anonymous_type_83a3a9ca9f31744b_0#flags.; |
| 567 | uint8cxx . . $ uint8# palette_indexcxx . . $ $anonymous_type_83a3a9ca9f31744b_0#palette_index.; |
| 568 | uint16cxx . . $ uint16# nocxx . . $ $anonymous_type_83a3a9ca9f31744b_0#no.; |
| 569 | uint16cxx . . $ uint16# sub_ycxx . . $ $anonymous_type_83a3a9ca9f31744b_0#sub_y.; |
| 570 | } SPRLEcxx . . $ SPRLE#; |
| 571 | |
| 572 | #define SPR_HPMASKcxx . . $ `mednafen/pce_fast/vdc.cpp:572:9`! 0x8000 // High priority bit mask |
| 573 | |
| 574 | // DrawSprites will write up to 0x20 units before the start of the pointer it's passed. |
| 575 | static void DrawSpritescxx . . $ DrawSprites(a01e3eec7be2dafc).(vdc_tcxx . . $ vdc_t# *vdc, const int32cxx . . $ int32# end, uint16cxx . . $ uint16# *spr_linebuf) NO_INLINEcxx . . $ `mednafen/mednafen-types.h:22:11`!; |
| 576 | static void DrawSpritescxx . . $ DrawSprites(a01e3eec7be2dafc).(vdc_tcxx . . $ vdc_t# *vdc, const int32cxx . . $ int32# end, uint16cxx . . $ uint16# *spr_linebuf) |
| 577 | { |
| 578 | int active_sprites = 0; |
| 579 | SPRLEcxx . . $ SPRLE# SpriteList[64 * 2]; // (see unlimited_sprites option, *2 to accomodate 32-pixel-width sprites ) //16]; |
| 580 | |
| 581 | // First, grab the up to 16(or 128 for unlimited_sprites) sprite units(16xWHATEVER; each 32xWHATEVER sprite counts as 2 sprite units when |
| 582 | // rendering a scanline) for this scanline. |
| 583 | for(int i = 0; i < vdc->SAT_Cache_Validcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT_Cache_Valid.; i++) |
| 584 | { |
| 585 | const SAT_Cache_tcxx . . $ SAT_Cache_t# *SATR = &vdc->SAT_Cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT_Cache.[i]; |
| 586 | |
| 587 | int16cxx . . $ int16# y = SATR->ycxx . . $ $anonymous_type_c69ee54cc268614d_2#y.; |
| 588 | uint16cxx . . $ uint16# x = SATR->xcxx . . $ $anonymous_type_c69ee54cc268614d_2#x.; |
| 589 | uint16cxx . . $ uint16# no = SATR->nocxx . . $ $anonymous_type_c69ee54cc268614d_2#no.; |
| 590 | const uint16cxx . . $ uint16# flags = SATR->flagscxx . . $ $anonymous_type_c69ee54cc268614d_2#flags.; |
| 591 | const uint8cxx . . $ uint8# cgmode = SATR->cgmodecxx . . $ $anonymous_type_c69ee54cc268614d_2#cgmode.; |
| 592 | const uint16cxx . . $ uint16# height = SATR->heightcxx . . $ $anonymous_type_c69ee54cc268614d_2#height.; |
| 593 | const uint32cxx . . $ uint32# palette_index = (flags & 0xF) << 4; |
| 594 | |
| 595 | uint32cxx . . $ uint32# y_offset = vdc->RCRCountcxx . . $ $anonymous_type_c69ee54cc268614d_3#RCRCount. - y; |
| 596 | if(y_offset < height) |
| 597 | { |
| 598 | if(active_sprites == 16) |
| 599 | { |
| 600 | if(vdc->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0x2) |
| 601 | { |
| 602 | vdc->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status. |= VDCS_ORcxx . . $ `mednafen/pce_fast/vdc.cpp:210:9`!; |
| 603 | HuC6280_IRQBegincxx . . $ HuC6280_IRQBegin(d4f767463ce0a6b3).(MDFN_IQIRQ1cxx . . $ `mednafen/pce_fast/huc6280.h:65:9`!); |
| 604 | VDC_DEBUGcxx . . $ `mednafen/pce_fast/vdc.h:7:9`!("Overflow IRQ"); |
| 605 | } |
| 606 | if(!unlimited_spritescxx . . $ unlimited_sprites.) |
| 607 | break; |
| 608 | } |
| 609 | |
| 610 | if(flags & SPRF_VFLIPcxx . . $ `mednafen/pce_fast/vdc.cpp:487:9`!) |
| 611 | y_offset = height - 1 - y_offset; |
| 612 | |
| 613 | no |= (y_offset & 0x30) >> 3; |
| 614 | |
| 615 | SpriteList[active_sprites].flagscxx . . $ $anonymous_type_83a3a9ca9f31744b_0#flags. = flags; |
| 616 | |
| 617 | //printf("Found: %d %d\n", vdc->RCRCount, x); |
| 618 | SpriteList[active_sprites].xcxx . . $ $anonymous_type_83a3a9ca9f31744b_0#x. = x; |
| 619 | SpriteList[active_sprites].palette_indexcxx . . $ $anonymous_type_83a3a9ca9f31744b_0#palette_index. = palette_index; |
| 620 | |
| 621 | SpriteList[active_sprites].nocxx . . $ $anonymous_type_83a3a9ca9f31744b_0#no. = no; |
| 622 | SpriteList[active_sprites].sub_ycxx . . $ $anonymous_type_83a3a9ca9f31744b_0#sub_y. = (y_offset & 15); |
| 623 | |
| 624 | |
| 625 | CheckFixSpriteTileCachecxx . . $ CheckFixSpriteTileCache(701ddf999d3192d7).(vdc, no, (vdc->MWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MWR. & 0xC) | cgmode); |
| 626 | |
| 627 | SpriteList[active_sprites].flagscxx . . $ $anonymous_type_83a3a9ca9f31744b_0#flags. |= i ? 0 : SPRF_SPRITE0cxx . . $ `mednafen/pce_fast/vdc.cpp:488:9`!; |
| 628 | |
| 629 | active_sprites++; |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | //if(!active_sprites) |
| 634 | // return; |
| 635 | |
| 636 | #if 0 |
| 637 | memset(spr_linebuf, 0, sizeof(uint16) * end); |
| 638 | #else |
| 639 | MDFN_FastU32MemsetM8cxx . . $ MDFN_FastU32MemsetM8(c28fbbcaa6c23e04).((uint32cxx . . $ uint32# *)spr_linebuf, 0, ((end + 3) >> 1) & ~1); |
| 640 | #endif |
| 641 | |
| 642 | if(!active_sprites) |
| 643 | return; |
| 644 | |
| 645 | for(int i = (active_sprites - 1) ; i >= 0; i--) |
| 646 | { |
| 647 | int32cxx . . $ int32# pos = SpriteList[i].xcxx . . $ $anonymous_type_83a3a9ca9f31744b_0#x. - 0x20; |
| 648 | uint32cxx . . $ uint32# prio_or; |
| 649 | uint16cxx . . $ uint16# *dest_pix; |
| 650 | |
| 651 | if(pos > end) |
| 652 | continue; |
| 653 | |
| 654 | dest_pix = &spr_linebuf[pos]; |
| 655 | |
| 656 | prio_or = 0x100 | SpriteList[i].palette_indexcxx . . $ $anonymous_type_83a3a9ca9f31744b_0#palette_index.; |
| 657 | |
| 658 | if(SpriteList[i].flagscxx . . $ $anonymous_type_83a3a9ca9f31744b_0#flags. & SPRF_PRIORITYcxx . . $ `mednafen/pce_fast/vdc.cpp:485:9`!) |
| 659 | prio_or |= SPR_HPMASKcxx . . $ `mednafen/pce_fast/vdc.cpp:572:9`!; |
| 660 | |
| 661 | const uint8cxx . . $ uint8# *pix_source = vdc->spr_tile_cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_cache.[SpriteList[i].nocxx . . $ $anonymous_type_83a3a9ca9f31744b_0#no.][SpriteList[i].sub_ycxx . . $ $anonymous_type_83a3a9ca9f31744b_0#sub_y.]; |
| 662 | int increment = -1; |
| 663 | int32cxx . . $ int32# x_second = 15; |
| 664 | |
| 665 | if(SpriteList[i].flagscxx . . $ $anonymous_type_83a3a9ca9f31744b_0#flags. & SPRF_HFLIPcxx . . $ `mednafen/pce_fast/vdc.cpp:486:9`!) |
| 666 | { |
| 667 | increment = 1; |
| 668 | x_second = 0; |
| 669 | } |
| 670 | |
| 671 | if((SpriteList[i].flagscxx . . $ $anonymous_type_83a3a9ca9f31744b_0#flags. & SPRF_SPRITE0cxx . . $ `mednafen/pce_fast/vdc.cpp:488:9`!) && (vdc->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0x01)) |
| 672 | { |
| 673 | for(int32cxx . . $ int32# x = 0; x < 16; x++, x_second += increment) |
| 674 | { |
| 675 | const uint32cxx . . $ uint32# raw_pixel = pix_source[x_second]; |
| 676 | if(raw_pixel) |
| 677 | { |
| 678 | if(((uint32cxx . . $ uint32#)pos + x) >= (uint32cxx . . $ uint32#)end) // Covers negative and overflowing the right side(to prevent spurious sprite hits) |
| 679 | continue; |
| 680 | |
| 681 | if(dest_pix[x] & 0x100) |
| 682 | { |
| 683 | vdc->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status. |= VDCS_CRcxx . . $ `mednafen/pce_fast/vdc.cpp:209:9`!; |
| 684 | VDC_DEBUGcxx . . $ `mednafen/pce_fast/vdc.h:7:9`!("Sprite hit IRQ"); |
| 685 | HuC6280_IRQBegincxx . . $ HuC6280_IRQBegin(d4f767463ce0a6b3).(MDFN_IQIRQ1cxx . . $ `mednafen/pce_fast/huc6280.h:65:9`!); |
| 686 | } |
| 687 | dest_pix[x] = raw_pixel | prio_or; |
| 688 | } |
| 689 | } |
| 690 | } // End sprite0 handling |
| 691 | else // No sprite0 hit: |
| 692 | { |
| 693 | // x must be signed, for "pos + x" to not be promoted to unsigned, which will cause a stack overflow. |
| 694 | // |
| 695 | |
| 696 | for(int32cxx . . $ int32# x = 0; x < 16; x++, x_second += increment) |
| 697 | { |
| 698 | const uint32cxx . . $ uint32# raw_pixel = pix_source[x_second]; |
| 699 | if(raw_pixel) |
| 700 | dest_pix[x] = raw_pixel | prio_or; |
| 701 | } |
| 702 | |
| 703 | } // End no sprite0 hit |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void MixBGSPRcxx . . $ MixBGSPR(b536025058baef1a).(const uint32cxx . . $ uint32# count_in, const uint8cxx . . $ uint8# *bg_linebuf_in, const uint16cxx . . $ uint16# *spr_linebuf_in, uint16_tcxx . . $ uint16_t# *target_in) |
| 708 | { |
| 709 | for(unsigned int x = 0; x < count_in; x++) |
| 710 | { |
| 711 | const uint32cxx . . $ uint32# bg_pixel = bg_linebuf_in[x]; |
| 712 | const uint32cxx . . $ uint32# spr_pixel = spr_linebuf_in[x]; |
| 713 | uint32cxx . . $ uint32# pixel = bg_pixel; |
| 714 | |
| 715 | if ((spr_pixel & SPR_HPMASKcxx . . $ `mednafen/pce_fast/vdc.cpp:572:9`!) || !(bg_pixel & 0x0F)) |
| 716 | pixel = spr_pixel; |
| 717 | |
| 718 | target_in[x] = vcecxx . . $ vce..color_table_cachecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table_cache.[pixel & 0x1FF]; |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | static void MixBGOnlycxx . . $ MixBGOnly(ef09008854ed1885).(const uint32cxx . . $ uint32# count, const uint8cxx . . $ uint8# *bg_linebuf, uint16_tcxx . . $ uint16_t# *target) |
| 723 | { |
| 724 | unsigned x; |
| 725 | |
| 726 | for(x = 0; x < count; x++) |
| 727 | target[x] = vcecxx . . $ vce..color_table_cachecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table_cache.[bg_linebuf[x]]; |
| 728 | } |
| 729 | |
| 730 | static void MixSPROnlycxx . . $ MixSPROnly(886fbf6cfd3b944).(const uint32cxx . . $ uint32# count, const uint16cxx . . $ uint16# *spr_linebuf, uint16_tcxx . . $ uint16_t# *target) |
| 731 | { |
| 732 | unsigned x; |
| 733 | |
| 734 | for(x = 0; x < count; x++) |
| 735 | target[x] = vcecxx . . $ vce..color_table_cachecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table_cache.[(spr_linebuf[x] | 0x100) & 0x1FF]; |
| 736 | } |
| 737 | |
| 738 | static void MixNonecxx . . $ MixNone(5115c8662048035d).(const uint32cxx . . $ uint32# count, uint16_tcxx . . $ uint16_t# *target) |
| 739 | { |
| 740 | unsigned x; |
| 741 | uint32cxx . . $ uint32# bg_color = vcecxx . . $ vce..color_table_cachecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table_cache.[0x000]; |
| 742 | |
| 743 | for(x = 0; x < count; x++) |
| 744 | target[x] = bg_color; |
| 745 | } |
| 746 | |
| 747 | void DrawOverscancxx . . $ DrawOverscan(59dc4c7491660551).(const vdc_tcxx . . $ vdc_t# *vdc, uint16_tcxx . . $ uint16_t# *target, const MDFN_Rect *lw, const bool full = true, const int32cxx . . $ int32# vpl = 0, const int32cxx . . $ int32# vpr = 0) |
| 748 | { |
| 749 | uint32cxx . . $ uint32# os_color = vcecxx . . $ vce..color_table_cachecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table_cache.[0x100]; |
| 750 | |
| 751 | //printf("%d %d\n", lw->x, lw->w); |
| 752 | int x = lw->x; |
| 753 | |
| 754 | if(!full) |
| 755 | { |
| 756 | for(; x < vpl; x++) |
| 757 | target[x] = os_color; |
| 758 | |
| 759 | x = vpr; |
| 760 | } |
| 761 | |
| 762 | for(; x < lw->x + lw->w; x++) |
| 763 | target[x] = os_color; |
| 764 | } |
| 765 | |
| 766 | void VDC_RunFramecxx . . $ VDC_RunFrame(5ce680368ac0bb61).(EmulateSpecStructcxx . . $ EmulateSpecStruct# *espec, bool IsHES) |
| 767 | { |
| 768 | int max_dc = 0; |
| 769 | MDFN_Surface *surface = espec->surfacecxx . . $ $anonymous_type_643ef407c229d02_10#surface.; |
| 770 | MDFN_Rect *DisplayRect = &espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect.; |
| 771 | int32cxx . . $ int32# *LineWidths = espec->LineWidthscxx . . $ $anonymous_type_643ef407c229d02_10#LineWidths.; |
| 772 | bool skip = espec->skipcxx . . $ $anonymous_type_643ef407c229d02_10#skip. || IsHES; |
| 773 | |
| 774 | // x and w should be overwritten in the big loop |
| 775 | |
| 776 | if(!skip) |
| 777 | { |
| 778 | DisplayRect->x = 0; |
| 779 | DisplayRect->w = 256; |
| 780 | |
| 781 | DisplayRect->y = MDFN_GetSettingUIcxx . . $ MDFN_GetSettingUI(751346f8406fd082).("pce_fast.slstart"); |
| 782 | DisplayRect->h = MDFN_GetSettingUIcxx . . $ MDFN_GetSettingUI(751346f8406fd082).("pce_fast.slend") - DisplayRect->y + 1; |
| 783 | } |
| 784 | |
| 785 | do |
| 786 | { |
| 787 | const bool SHOULD_DRAW = (!skip && (int)frame_countercxx . . $ frame_counter. >= (DisplayRect->y + 14) && (int)frame_countercxx . . $ frame_counter. < (DisplayRect->y + DisplayRect->h + 14)); |
| 788 | |
| 789 | if(frame_countercxx . . $ frame_counter. == 0) |
| 790 | { |
| 791 | VDScxx . . $ VDS. = M_vdc_VDScxx . . $ `mednafen/pce_fast/vdc.cpp:205:9`!; |
| 792 | VSWcxx . . $ VSW. = M_vdc_VSWcxx . . $ `mednafen/pce_fast/vdc.cpp:204:9`!; |
| 793 | VDWcxx . . $ VDW. = M_vdc_VDWcxx . . $ `mednafen/pce_fast/vdc.cpp:206:9`!; |
| 794 | VCRcxx . . $ VCR. = M_vdc_VCRcxx . . $ `mednafen/pce_fast/vdc.cpp:207:9`!; |
| 795 | VBlankFLcxx . . $ VBlankFL. = VDScxx . . $ VDS. + VSWcxx . . $ VSW. + VDWcxx . . $ VDW. + 1; |
| 796 | |
| 797 | if(VBlankFLcxx . . $ VBlankFL. > 261) |
| 798 | VBlankFLcxx . . $ VBlankFL. = 261; |
| 799 | } |
| 800 | |
| 801 | need_vbicxx . . $ need_vbi.[0] = need_vbicxx . . $ need_vbi.[1] = 0; |
| 802 | |
| 803 | #if 1 |
| 804 | line_leadin1cxx . . $ line_leadin1. = 0; |
| 805 | |
| 806 | magicalcxx . . $ magical. = M_vdc_HDScxx . . $ `mednafen/pce_fast/vdc.cpp:200:9`! + (M_vdc_HDWcxx . . $ `mednafen/pce_fast/vdc.cpp:201:9`! + 1) + M_vdc_HDEcxx . . $ `mednafen/pce_fast/vdc.cpp:202:9`!; |
| 807 | magicalcxx . . $ magical. = (magicalcxx . . $ magical. + 2) & ~1; |
| 808 | magicalcxx . . $ magical. -= M_vdc_HDWcxx . . $ `mednafen/pce_fast/vdc.cpp:201:9`! + 1; |
| 809 | cyc_totcxx . . $ cyc_tot. = magicalcxx . . $ magical. * 8; //ClockPixelWidths[vce.dot_clock] - magical * 8; |
| 810 | cyc_totcxx . . $ cyc_tot.-=2; |
| 811 | switch(vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.) |
| 812 | { |
| 813 | case 0: cyc_totcxx . . $ cyc_tot. = 4 * cyc_totcxx . . $ cyc_tot. / 3; break; |
| 814 | case 1: break; |
| 815 | case 2: cyc_totcxx . . $ cyc_tot. = 2 * cyc_totcxx . . $ cyc_tot. / 3; break; |
| 816 | } |
| 817 | |
| 818 | if(cyc_totcxx . . $ cyc_tot. < 0) cyc_totcxx . . $ cyc_tot. = 0; |
| 819 | line_leadin1cxx . . $ line_leadin1. = cyc_totcxx . . $ cyc_tot.; |
| 820 | #endif |
| 821 | |
| 822 | #if 0 |
| 823 | { |
| 824 | int vdc_to_master = 4; |
| 825 | |
| 826 | line_leadin1 = 1365 - ((M_vdc_HDW + 1) * 8 - 4 + 6) * vdc_to_master; |
| 827 | |
| 828 | if(line_leadin1 < 0) |
| 829 | { |
| 830 | line_leadin1 = 0; |
| 831 | puts("Eep"); |
| 832 | } |
| 833 | |
| 834 | if(M_vdc_HDS > 2) |
| 835 | line_leadin1 += 2; |
| 836 | |
| 837 | line_leadin1 = line_leadin1 / 3; |
| 838 | } |
| 839 | |
| 840 | if(line_leadin1 < 0) |
| 841 | line_leadin1 = 0; |
| 842 | else if(line_leadin1 > 400) |
| 843 | line_leadin1 = 400; |
| 844 | #endif |
| 845 | |
| 846 | //printf("%d\n", line_leadin1); |
| 847 | if(max_dc < vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.) |
| 848 | max_dc = vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.; |
| 849 | |
| 850 | if(!skip) |
| 851 | { |
| 852 | static const int ws[2][3] = { |
| 853 | { 341, 341, 682 }, |
| 854 | { 256, 341, 512 } |
| 855 | }; |
| 856 | |
| 857 | DisplayRect->x = 0; |
| 858 | DisplayRect->w = ws[correct_aspectcxx . . $ correct_aspect.][vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.]; |
| 859 | } |
| 860 | |
| 861 | int chip = 0; |
| 862 | { |
| 863 | if(frame_countercxx . . $ frame_counter. == 0) |
| 864 | { |
| 865 | vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. = 0; |
| 866 | vdccxx . . $ vdc.->burst_modecxx . . $ $anonymous_type_c69ee54cc268614d_3#burst_mode. = !(vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0xC0); |
| 867 | } |
| 868 | |
| 869 | if(vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. == (VDScxx . . $ VDS. + VSWcxx . . $ VSW.)) |
| 870 | { |
| 871 | vdccxx . . $ vdc.->burst_modecxx . . $ $anonymous_type_c69ee54cc268614d_3#burst_mode. = !(vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0xC0); |
| 872 | vdccxx . . $ vdc.->RCRCountcxx . . $ $anonymous_type_c69ee54cc268614d_3#RCRCount. = 0; |
| 873 | } |
| 874 | int have_free_time = 1; |
| 875 | |
| 876 | if(!vdccxx . . $ vdc.->burst_modecxx . . $ $anonymous_type_c69ee54cc268614d_3#burst_mode. && vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. >= (VDScxx . . $ VDS. + VSWcxx . . $ VSW.) && vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. < (VDScxx . . $ VDS. + VSWcxx . . $ VSW. + VDWcxx . . $ VDW. + 1)) |
| 877 | have_free_time = 0; |
| 878 | |
| 879 | if(have_free_time) // We're outside of the active display area. Weehee |
| 880 | { |
| 881 | if(vdccxx . . $ vdc.->DMARunningcxx . . $ $anonymous_type_c69ee54cc268614d_3#DMARunning.) |
| 882 | DoDMAcxx . . $ DoDMA(3156015dbbc7fd1).(vdccxx . . $ vdc.); |
| 883 | } |
| 884 | |
| 885 | if(vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. == VBlankFLcxx . . $ VBlankFL.) |
| 886 | { |
| 887 | need_vbicxx . . $ need_vbi.[0] = 1; |
| 888 | if(vdccxx . . $ vdc.->SATBPendingcxx . . $ $anonymous_type_c69ee54cc268614d_3#SATBPending. || (vdccxx . . $ vdc.->DCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DCR. & 0x10)) |
| 889 | { |
| 890 | vdccxx . . $ vdc.->SATBPendingcxx . . $ $anonymous_type_c69ee54cc268614d_3#SATBPending. = 0; |
| 891 | vdccxx . . $ vdc.->sat_dma_slcountercxx . . $ $anonymous_type_c69ee54cc268614d_3#sat_dma_slcounter. = 2; |
| 892 | |
| 893 | DoSATDMAcxx . . $ DoSATDMA(3156015dbbc7fd1).(vdccxx . . $ vdc.); |
| 894 | } |
| 895 | } |
| 896 | if((int)vdccxx . . $ vdc.->RCRCountcxx . . $ $anonymous_type_c69ee54cc268614d_3#RCRCount. == ((int)vdccxx . . $ vdc.->RCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#RCR. - 0x40) && (vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0x04)) |
| 897 | { |
| 898 | VDC_DEBUGcxx . . $ `mednafen/pce_fast/vdc.h:7:9`!("RCR IRQ"); |
| 899 | vdccxx . . $ vdc.->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status. |= VDCS_RRcxx . . $ `mednafen/pce_fast/vdc.cpp:211:9`!; |
| 900 | HuC6280_IRQBegincxx . . $ HuC6280_IRQBegin(d4f767463ce0a6b3).(MDFN_IQIRQ1cxx . . $ `mednafen/pce_fast/huc6280.h:65:9`!); |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | HuC6280_Runcxx . . $ HuC6280_Run(d4f767463ce0a6b3).(line_leadin1cxx . . $ line_leadin1.); |
| 905 | |
| 906 | const bool fc_vrm = (frame_countercxx . . $ frame_counter. >= 14 && frame_countercxx . . $ frame_counter. < (14 + 242)); |
| 907 | |
| 908 | chip = 0; |
| 909 | { |
| 910 | MDFN_ALIGNcxx . . $ `mednafen/mednafen-types.h:30:11`!(8) uint8cxx . . $ uint8# bg_linebuf[8 + 1024]; |
| 911 | MDFN_ALIGNcxx . . $ `mednafen/mednafen-types.h:30:11`!(8) uint16cxx . . $ uint16# spr_linebuf[16 + 1024]; |
| 912 | |
| 913 | uint16cxx . . $ uint16# *target_ptr16 = surface->pixels + (frame_countercxx . . $ frame_counter. - 14) * surface->pitch; |
| 914 | |
| 915 | if(fc_vrm && !skip) |
| 916 | LineWidths[frame_countercxx . . $ frame_counter. - 14] = DisplayRect->w; |
| 917 | |
| 918 | if(vdccxx . . $ vdc.->burst_modecxx . . $ $anonymous_type_c69ee54cc268614d_3#burst_mode.) |
| 919 | { |
| 920 | if(fc_vrm && SHOULD_DRAW) |
| 921 | { |
| 922 | DrawOverscancxx . . $ DrawOverscan(59dc4c7491660551).(vdccxx . . $ vdc., target_ptr16, DisplayRect); |
| 923 | } |
| 924 | } |
| 925 | else if(vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. >= (VDScxx . . $ VDS. + VSWcxx . . $ VSW.) && vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. < (VDScxx . . $ VDS. + VSWcxx . . $ VSW. + VDWcxx . . $ VDW. + 1)) |
| 926 | { |
| 927 | if(vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. == (VDScxx . . $ VDS. + VSWcxx . . $ VSW.)) |
| 928 | vdccxx . . $ vdc.->BG_YOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_YOffset. = vdccxx . . $ vdc.->BYRcxx . . $ $anonymous_type_c69ee54cc268614d_3#BYR.; |
| 929 | else |
| 930 | vdccxx . . $ vdc.->BG_YOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_YOffset.++; |
| 931 | vdccxx . . $ vdc.->BG_XOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_XOffset. = vdccxx . . $ vdc.->BXRcxx . . $ $anonymous_type_c69ee54cc268614d_3#BXR.; |
| 932 | |
| 933 | if(fc_vrm) |
| 934 | { |
| 935 | uint32cxx . . $ uint32# start, end; |
| 936 | |
| 937 | CalcStartEndcxx . . $ CalcStartEnd(67094e1f07cf5afd).(vdccxx . . $ vdc., start, end); |
| 938 | |
| 939 | if((vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0x80) && SHOULD_DRAW) |
| 940 | { |
| 941 | if(userlecxx . . $ userle. & (ULE_BG0cxx . . $ `mednafen/pce_fast/vdc.cpp:42:9`!)) |
| 942 | DrawBGcxx . . $ DrawBG(debc6c45b8a7b096).(vdccxx . . $ vdc., end - start + (vdccxx . . $ vdc.->BG_XOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_XOffset. & 7), bg_linebuf); |
| 943 | else |
| 944 | memset(bg_linebuf, 0, end - start + (vdccxx . . $ vdc.->BG_XOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_XOffset. & 7)); |
| 945 | } |
| 946 | |
| 947 | if((vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0x40) && (SHOULD_DRAW || (vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0x03))) // Don't skip sprite drawing if we can generate sprite #0 or sprite overflow IRQs. |
| 948 | { |
| 949 | if((userlecxx . . $ userle. & (ULE_SPR0cxx . . $ `mednafen/pce_fast/vdc.cpp:43:9`!)) || (vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0x03)) |
| 950 | DrawSpritescxx . . $ DrawSprites(a01e3eec7be2dafc).(vdccxx . . $ vdc., end - start, spr_linebuf + 0x20); |
| 951 | |
| 952 | if(!(userlecxx . . $ userle. & (ULE_SPR0cxx . . $ `mednafen/pce_fast/vdc.cpp:43:9`!))) |
| 953 | memset(spr_linebuf + 0x20, 0, sizeof(uint16cxx . . $ uint16#) * (end - start)); |
| 954 | } |
| 955 | |
| 956 | if(SHOULD_DRAW) |
| 957 | { |
| 958 | static const int xs[2][3] = { |
| 959 | { 24 - 43, 38, 96 - 43 * 2 }, |
| 960 | { 24, 38, 96 } |
| 961 | }; |
| 962 | |
| 963 | int32cxx . . $ int32# width = end - start; |
| 964 | int32cxx . . $ int32# source_offset = 0; |
| 965 | int32cxx . . $ int32# target_offset = start - (128 + 8 + xs[correct_aspectcxx . . $ correct_aspect.][vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.]); |
| 966 | |
| 967 | if(target_offset < 0) |
| 968 | { |
| 969 | width += target_offset; |
| 970 | source_offset += 0 - target_offset; |
| 971 | target_offset = 0; |
| 972 | } |
| 973 | |
| 974 | if((target_offset + width) > DisplayRect->w) |
| 975 | width = (int32cxx . . $ int32#)DisplayRect->w - target_offset; |
| 976 | |
| 977 | //if(vdc->display_counter == 50) |
| 978 | // MDFN_DispMessage("soffset=%d, toffset=%d, width=%d", source_offset, target_offset, width); |
| 979 | |
| 980 | if(width > 0) |
| 981 | { |
| 982 | //else if(target_ptr16) |
| 983 | { |
| 984 | switch(vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0xC0) |
| 985 | { |
| 986 | case 0xC0: |
| 987 | MixBGSPRcxx . . $ MixBGSPR(b536025058baef1a).(width, bg_linebuf + (vdccxx . . $ vdc.->BG_XOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_XOffset. & 7) + source_offset, spr_linebuf + 0x20 + source_offset, target_ptr16 + target_offset); |
| 988 | break; |
| 989 | case 0x80: |
| 990 | MixBGOnlycxx . . $ MixBGOnly(ef09008854ed1885).(width, bg_linebuf + (vdccxx . . $ vdc.->BG_XOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_XOffset. & 7) + source_offset, target_ptr16 + target_offset); |
| 991 | break; |
| 992 | case 0x40: |
| 993 | MixSPROnlycxx . . $ MixSPROnly(886fbf6cfd3b944).(width, spr_linebuf + 0x20 + source_offset, target_ptr16 + target_offset); |
| 994 | break; |
| 995 | case 0x00: |
| 996 | MixNonecxx . . $ MixNone(5115c8662048035d).(width, target_ptr16 + target_offset); |
| 997 | break; |
| 998 | } |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | //else if(target_ptr16) |
| 1003 | DrawOverscancxx . . $ DrawOverscan(59dc4c7491660551).(vdccxx . . $ vdc., target_ptr16, DisplayRect, false, target_offset, target_offset + width); |
| 1004 | } // end if(SHOULD_DRAW) |
| 1005 | } |
| 1006 | } |
| 1007 | else if(SHOULD_DRAW && fc_vrm) // Hmm, overscan... |
| 1008 | { |
| 1009 | //else if(target_ptr16) |
| 1010 | DrawOverscancxx . . $ DrawOverscan(59dc4c7491660551).(vdccxx . . $ vdc., target_ptr16, DisplayRect); |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | if(SHOULD_DRAW && fc_vrm) |
| 1015 | { |
| 1016 | MDFN_MidLineUpdatecxx . . $ MDFN_MidLineUpdate(387ada12a6f698cd).(espec, frame_countercxx . . $ frame_counter. - 14); |
| 1017 | } |
| 1018 | |
| 1019 | if((vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. & 0x08) && need_vbicxx . . $ need_vbi.[0]) |
| 1020 | vdccxx . . $ vdc.->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status. |= VDCS_VDcxx . . $ `mednafen/pce_fast/vdc.cpp:214:9`!; |
| 1021 | |
| 1022 | HuC6280_Runcxx . . $ HuC6280_Run(d4f767463ce0a6b3).(2); |
| 1023 | |
| 1024 | if(vdccxx . . $ vdc.->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status. & VDCS_VDcxx . . $ `mednafen/pce_fast/vdc.cpp:214:9`!) |
| 1025 | { |
| 1026 | VDC_DEBUGcxx . . $ `mednafen/pce_fast/vdc.h:7:9`!("VBlank IRQ"); |
| 1027 | HuC6280_IRQBegincxx . . $ HuC6280_IRQBegin(d4f767463ce0a6b3).(MDFN_IQIRQ1cxx . . $ `mednafen/pce_fast/huc6280.h:65:9`!); |
| 1028 | } |
| 1029 | |
| 1030 | HuC6280_Runcxx . . $ HuC6280_Run(d4f767463ce0a6b3).(455 - line_leadin1cxx . . $ line_leadin1. - 2); |
| 1031 | |
| 1032 | if(PCE_IsCDcxx . . $ PCE_IsCD.) |
| 1033 | { |
| 1034 | PCECD_Runcxx . . $ PCECD_Run(cb2f890c2fdad230).(HuCPUcxx . . $ HuCPU..timestampcxx . . $ __HuC6280#timestamp. * 3); |
| 1035 | } |
| 1036 | |
| 1037 | { |
| 1038 | vdccxx . . $ vdc.->RCRCountcxx . . $ $anonymous_type_c69ee54cc268614d_3#RCRCount.++; |
| 1039 | |
| 1040 | //vdc->BG_YOffset = (vdc->BG_YOffset + 1); |
| 1041 | vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter.++; |
| 1042 | |
| 1043 | if(vdccxx . . $ vdc.->sat_dma_slcountercxx . . $ $anonymous_type_c69ee54cc268614d_3#sat_dma_slcounter.) |
| 1044 | { |
| 1045 | vdccxx . . $ vdc.->sat_dma_slcountercxx . . $ $anonymous_type_c69ee54cc268614d_3#sat_dma_slcounter.--; |
| 1046 | if(!vdccxx . . $ vdc.->sat_dma_slcountercxx . . $ $anonymous_type_c69ee54cc268614d_3#sat_dma_slcounter.) |
| 1047 | { |
| 1048 | if(vdccxx . . $ vdc.->DCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DCR. & 0x01) |
| 1049 | { |
| 1050 | VDC_DEBUGcxx . . $ `mednafen/pce_fast/vdc.h:7:9`!("Sprite DMA IRQ"); |
| 1051 | vdccxx . . $ vdc.->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status. |= VDCS_DScxx . . $ `mednafen/pce_fast/vdc.cpp:212:9`!; |
| 1052 | HuC6280_IRQBegincxx . . $ HuC6280_IRQBegin(d4f767463ce0a6b3).(MDFN_IQIRQ1cxx . . $ `mednafen/pce_fast/huc6280.h:65:9`!); |
| 1053 | } |
| 1054 | } |
| 1055 | } |
| 1056 | |
| 1057 | if(vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. == (VDScxx . . $ VDS. + VSWcxx . . $ VSW. + VDWcxx . . $ VDW. + VCRcxx . . $ VCR. + 3)) |
| 1058 | { |
| 1059 | vdccxx . . $ vdc.->display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter. = 0; |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | frame_countercxx . . $ frame_counter. = (frame_countercxx . . $ frame_counter. + 1) % (vcecxx . . $ vce..lc263cxx . . $ $anonymous_type_c69ee54cc268614d_1#lc263. ? 263 : 262); |
| 1064 | //printf("%d\n", vce.lc263); |
| 1065 | } while(frame_countercxx . . $ frame_counter. != VBlankFLcxx . . $ VBlankFL.); // big frame loop! |
| 1066 | |
| 1067 | } |
| 1068 | |
| 1069 | void VDC_Resetcxx . . $ VDC_Reset(49f6e7a06ebc5aa8).(void) |
| 1070 | { |
| 1071 | vdccxx . . $ vdc.->read_buffercxx . . $ $anonymous_type_c69ee54cc268614d_3#read_buffer. = 0xFFFF; |
| 1072 | |
| 1073 | vpccxx . . $ vpc..prioritycxx . . $ $anonymous_type_c69ee54cc268614d_0#priority.[0] = vpccxx . . $ vpc..prioritycxx . . $ $anonymous_type_c69ee54cc268614d_0#priority.[1] = 0x11; |
| 1074 | |
| 1075 | vdccxx . . $ vdc.->HSRcxx . . $ $anonymous_type_c69ee54cc268614d_3#HSR. = vdccxx . . $ vdc.->HDRcxx . . $ $anonymous_type_c69ee54cc268614d_3#HDR. = vdccxx . . $ vdc.->VSRcxx . . $ $anonymous_type_c69ee54cc268614d_3#VSR. = vdccxx . . $ vdc.->VDRcxx . . $ $anonymous_type_c69ee54cc268614d_3#VDR. = vdccxx . . $ vdc.->VCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#VCR. = 0xFF; // Needed for Body Conquest 2 |
| 1076 | |
| 1077 | frame_countercxx . . $ frame_counter. = 0; |
| 1078 | } |
| 1079 | |
| 1080 | void VDC_Powercxx . . $ VDC_Power(49f6e7a06ebc5aa8).(void) |
| 1081 | { |
| 1082 | memset(vdccxx . . $ vdc., 0, sizeof(vdc_tcxx . . $ vdc_t#)); |
| 1083 | VDC_Resetcxx . . $ VDC_Reset(49f6e7a06ebc5aa8).(); |
| 1084 | } |
| 1085 | |
| 1086 | void VDC_Initcxx . . $ VDC_Init(d4f767463ce0a6b3).(int sgx) |
| 1087 | { |
| 1088 | unlimited_spritescxx . . $ unlimited_sprites. = MDFN_GetSettingBcxx . . $ MDFN_GetSettingB(c5f7da30cbc0f4e9).("pce_fast.nospritelimit"); |
| 1089 | correct_aspectcxx . . $ correct_aspect. = MDFN_GetSettingBcxx . . $ MDFN_GetSettingB(c5f7da30cbc0f4e9).("pce_fast.correct_aspect"); |
| 1090 | userlecxx . . $ userle. = ~0; |
| 1091 | |
| 1092 | vdccxx . . $ vdc. = (vdc_tcxx . . $ vdc_t# *)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(vdc_tcxx . . $ vdc_t#)); |
| 1093 | } |
| 1094 | |
| 1095 | void VDC_Closecxx . . $ VDC_Close(49f6e7a06ebc5aa8).(void) |
| 1096 | { |
| 1097 | if(vdccxx . . $ vdc.) |
| 1098 | freecxx . . $ free(bd21765a0afc8e3c).(vdccxx . . $ vdc.); |
| 1099 | vdccxx . . $ vdc. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1100 | } |
| 1101 | |
| 1102 | int VDC_StateActioncxx . . $ VDC_StateAction(a45b884b8cf568d5).(StateMemcxx . . $ StateMem# *sm, int load, int data_only) |
| 1103 | { |
| 1104 | SFORMATcxx . . $ SFORMAT# VCE_StateRegs[] = |
| 1105 | { |
| 1106 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vce.CR, "VCECR"), |
| 1107 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vce.lc263, "lc263"), |
| 1108 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vce.bw, "bw"), |
| 1109 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vce.dot_clock, "dot clock"), |
| 1110 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vce.ctaddress, "ctaddress"), |
| 1111 | SFARRAY16Ncxx . . $ `mednafen/state.h:78:9`!(vce.color_table, 0x200, "color_table"), |
| 1112 | SFENDcxx . . $ `mednafen/state.h:94:9`! |
| 1113 | }; |
| 1114 | |
| 1115 | |
| 1116 | int ret = MDFNSS_StateActioncxx . . $ MDFNSS_StateAction(3f628545d3b0df83).(sm, load, data_only, VCE_StateRegs, "VCE"); |
| 1117 | |
| 1118 | int chip = 0; |
| 1119 | { |
| 1120 | SFORMATcxx . . $ SFORMAT# VDC_StateRegs[] = |
| 1121 | { |
| 1122 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->display_counter, "display_counter"), |
| 1123 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->sat_dma_slcounter, "sat_dma_slcounter"), |
| 1124 | |
| 1125 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->select, "select"), |
| 1126 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->MAWR, "MAWR"), |
| 1127 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->MARR, "MARR"), |
| 1128 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->CR, "CR"), |
| 1129 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->RCR, "RCR"), |
| 1130 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->BXR, "BXR"), |
| 1131 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->BYR, "BYR"), |
| 1132 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->MWR, "MWR"), |
| 1133 | |
| 1134 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->HSR, "HSR"), |
| 1135 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->HDR, "HDR"), |
| 1136 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->VSR, "VSR"), |
| 1137 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->VDR, "VDR"), |
| 1138 | |
| 1139 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->VCR, "VCR"), |
| 1140 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->DCR, "DCR"), |
| 1141 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->SOUR, "SOUR"), |
| 1142 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->DESR, "DESR"), |
| 1143 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->LENR, "LENR"), |
| 1144 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->SATB, "SATB"), |
| 1145 | |
| 1146 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->RCRCount, "RCRCount"), |
| 1147 | |
| 1148 | |
| 1149 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->read_buffer, "read_buffer"), |
| 1150 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->write_latch, "write_latch"), |
| 1151 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->status, "status"), |
| 1152 | |
| 1153 | SFARRAY16Ncxx . . $ `mednafen/state.h:78:9`!(vdc->SAT, 0x100, "SAT"), |
| 1154 | |
| 1155 | SFARRAY16Ncxx . . $ `mednafen/state.h:78:9`!(vdc->VRAM, VRAM_Size, "VRAM"), |
| 1156 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->DMAReadBuffer, "DMAReadBuffer"), |
| 1157 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->DMAReadWrite, "DMAReadWrite"), |
| 1158 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->DMARunning, "DMARunning"), |
| 1159 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->SATBPending, "SATBPending"), |
| 1160 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->burst_mode, "burst_mode"), |
| 1161 | |
| 1162 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->BG_YOffset, "BG_YOffset"), |
| 1163 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(vdc->BG_XOffset, "BG_XOffset"), |
| 1164 | SFVARcxx . . $ `mednafen/state.h:70:9`!(frame_counter), |
| 1165 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(VDS, "VDS_cache"), |
| 1166 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(VSW, "VSW_cache"), |
| 1167 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(VDW, "VDW_cache"), |
| 1168 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(VCR, "VCR_cache"), |
| 1169 | SFVARNcxx . . $ `mednafen/state.h:69:9`!(VBlankFL, "VBlankFL_cache"), |
| 1170 | |
| 1171 | SFARRAY32cxx . . $ `mednafen/state.h:82:9`!(need_vbi, 2), |
| 1172 | SFVARcxx . . $ `mednafen/state.h:70:9`!(line_leadin1), |
| 1173 | SFVARcxx . . $ `mednafen/state.h:70:9`!(magical), |
| 1174 | SFVARcxx . . $ `mednafen/state.h:70:9`!(cyc_tot), |
| 1175 | SFENDcxx . . $ `mednafen/state.h:94:9`! |
| 1176 | }; |
| 1177 | |
| 1178 | ret &= MDFNSS_StateActioncxx . . $ MDFNSS_StateAction(3f628545d3b0df83).(sm, load, data_only, VDC_StateRegs, "VDC0"); |
| 1179 | |
| 1180 | if(load) |
| 1181 | { |
| 1182 | for(int x = 0; x < VRAM_Sizecxx . . $ VRAM_Size.; x++) |
| 1183 | { |
| 1184 | FixTileCachecxx . . $ FixTileCache(447ccb6254e14a0e).(vdccxx . . $ vdc., x); |
| 1185 | vdccxx . . $ vdc.->spr_tile_cleancxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_clean.[x >> 6] = 0; |
| 1186 | } |
| 1187 | for(int x = 0; x < 512; x++) |
| 1188 | FixPCachecxx . . $ FixPCache(d4f767463ce0a6b3).(x); |
| 1189 | RebuildSATCachecxx . . $ RebuildSATCache(3156015dbbc7fd1).(vdccxx . . $ vdc.); |
| 1190 | } |
| 1191 | |
| 1192 | } |
| 1193 | |
| 1194 | return(ret); |
| 1195 | } |