| 1 | #cxx . . $ `<file>/mednafen/pce_fast/vdc.h`/ifndef _PCE_VDC_H |
| 2 | #define _PCE_VDC_Hcxx . . $ `mednafen/pce_fast/vdc.h:2:9`! |
| 3 | |
| 4 | #define REGSETPcxx . . $ `mednafen/pce_fast/vdc.h:4:9`!(_reg, _data, _msb) { _reg &= 0xFF << ((_msb) ? 0 : 8); _reg |= (_data) << ((_msb) ? 8 : 0); } |
| 5 | #define REGGETPcxx . . $ `mednafen/pce_fast/vdc.h:5:9`!(_reg, _msb) ((_reg >> ((_msb) ? 8 : 0)) & 0xFF) |
| 6 | |
| 7 | #define VDC_DEBUGcxx . . $ `mednafen/pce_fast/vdc.h:7:9`!(x) |
| 8 | //printf("%s: %d\n", x, vdc->display_counter); |
| 9 | #define VDC_UNDEFINEDcxx . . $ `mednafen/pce_fast/vdc.h:9:9`!(x) { } |
| 10 | //{ printf("%s: %d\n", x, vdc->display_counter); } |
| 11 | |
| 12 | static const uint8cxx . . $ uint8# vram_inc_tabcxx . . $ vram_inc_tab.[4] = { 1, 32, 64, 128 }; |
| 13 | |
| 14 | typedef structcxx . . $ $anonymous_type_c69ee54cc268614d_0# |
| 15 | { |
| 16 | uint8cxx . . $ uint8# prioritycxx . . $ $anonymous_type_c69ee54cc268614d_0#priority.[2]; |
| 17 | uint16cxx . . $ uint16# winwidthscxx . . $ $anonymous_type_c69ee54cc268614d_0#winwidths.[2]; |
| 18 | uint8cxx . . $ uint8# st_modecxx . . $ $anonymous_type_c69ee54cc268614d_0#st_mode.; |
| 19 | } vpc_tcxx . . $ vpc_t#; |
| 20 | |
| 21 | extern vpc_tcxx . . $ vpc_t# vpccxx . . $ vpc.; |
| 22 | |
| 23 | static const int VRAM_Sizecxx . . $ VRAM_Size. = 0x8000; |
| 24 | static const int VRAM_SizeMaskcxx . . $ VRAM_SizeMask. = VRAM_Sizecxx . . $ VRAM_Size. - 1; //0x7FFF; |
| 25 | static const int VRAM_BGTileNoMaskcxx . . $ VRAM_BGTileNoMask. = VRAM_SizeMaskcxx . . $ VRAM_SizeMask. / 16; //0x7FF; |
| 26 | |
| 27 | typedef structcxx . . $ $anonymous_type_c69ee54cc268614d_1# |
| 28 | { |
| 29 | uint8cxx . . $ uint8# CRcxx . . $ $anonymous_type_c69ee54cc268614d_1#CR.; |
| 30 | |
| 31 | bool lc263cxx . . $ $anonymous_type_c69ee54cc268614d_1#lc263.; // 263 line count if set, 262 if not |
| 32 | bool bwcxx . . $ $anonymous_type_c69ee54cc268614d_1#bw.; // Black and White |
| 33 | uint8cxx . . $ uint8# dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock.; // Dot Clock(5, 7, or 10 MHz = 0, 1, 2) |
| 34 | uint16cxx . . $ uint16# color_tablecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table.[0x200]; |
| 35 | uint16cxx . . $ uint16# color_table_cachecxx . . $ $anonymous_type_c69ee54cc268614d_1#color_table_cache.[0x200]; |
| 36 | uint16cxx . . $ uint16# ctaddresscxx . . $ $anonymous_type_c69ee54cc268614d_1#ctaddress.; |
| 37 | } vce_tcxx . . $ vce_t#; |
| 38 | |
| 39 | extern vce_tcxx . . $ vce_t# vcecxx . . $ vce.; |
| 40 | |
| 41 | typedef structcxx . . $ $anonymous_type_c69ee54cc268614d_2# |
| 42 | { |
| 43 | int16cxx . . $ int16# ycxx . . $ $anonymous_type_c69ee54cc268614d_2#y.; |
| 44 | uint16cxx . . $ uint16# heightcxx . . $ $anonymous_type_c69ee54cc268614d_2#height.; |
| 45 | uint16cxx . . $ uint16# xcxx . . $ $anonymous_type_c69ee54cc268614d_2#x.; |
| 46 | uint16cxx . . $ uint16# nocxx . . $ $anonymous_type_c69ee54cc268614d_2#no.; |
| 47 | uint16cxx . . $ uint16# flagscxx . . $ $anonymous_type_c69ee54cc268614d_2#flags.; |
| 48 | bool cgmodecxx . . $ $anonymous_type_c69ee54cc268614d_2#cgmode.; |
| 49 | } SAT_Cache_tcxx . . $ SAT_Cache_t#; |
| 50 | |
| 51 | typedef structcxx . . $ $anonymous_type_c69ee54cc268614d_3# |
| 52 | { |
| 53 | uint32cxx . . $ uint32# display_countercxx . . $ $anonymous_type_c69ee54cc268614d_3#display_counter.; |
| 54 | |
| 55 | int32cxx . . $ int32# sat_dma_slcountercxx . . $ $anonymous_type_c69ee54cc268614d_3#sat_dma_slcounter.; |
| 56 | |
| 57 | uint8cxx . . $ uint8# selectcxx . . $ $anonymous_type_c69ee54cc268614d_3#select.; |
| 58 | uint16cxx . . $ uint16# MAWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MAWR.; // Memory Address Write Register |
| 59 | uint16cxx . . $ uint16# MARRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MARR.; // Memory Address Read Register |
| 60 | |
| 61 | uint16cxx . . $ uint16# CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR.; // Control Register |
| 62 | uint16cxx . . $ uint16# RCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#RCR.; // Raster Compare Register |
| 63 | uint16cxx . . $ uint16# BXRcxx . . $ $anonymous_type_c69ee54cc268614d_3#BXR.; // Background X-Scroll Register |
| 64 | uint16cxx . . $ uint16# BYRcxx . . $ $anonymous_type_c69ee54cc268614d_3#BYR.; // Background Y-Scroll Register |
| 65 | uint16cxx . . $ uint16# MWRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MWR.; // Memory Width Register |
| 66 | |
| 67 | uint16cxx . . $ uint16# HSRcxx . . $ $anonymous_type_c69ee54cc268614d_3#HSR.; // Horizontal Sync Register |
| 68 | uint16cxx . . $ uint16# HDRcxx . . $ $anonymous_type_c69ee54cc268614d_3#HDR.; // Horizontal Display Register |
| 69 | uint16cxx . . $ uint16# VSRcxx . . $ $anonymous_type_c69ee54cc268614d_3#VSR.; |
| 70 | uint16cxx . . $ uint16# VDRcxx . . $ $anonymous_type_c69ee54cc268614d_3#VDR.; |
| 71 | |
| 72 | uint16cxx . . $ uint16# VCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#VCR.; |
| 73 | uint16cxx . . $ uint16# DCRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DCR.; |
| 74 | uint16cxx . . $ uint16# SOURcxx . . $ $anonymous_type_c69ee54cc268614d_3#SOUR.; |
| 75 | uint16cxx . . $ uint16# DESRcxx . . $ $anonymous_type_c69ee54cc268614d_3#DESR.; |
| 76 | uint16cxx . . $ uint16# LENRcxx . . $ $anonymous_type_c69ee54cc268614d_3#LENR.; |
| 77 | uint16cxx . . $ uint16# SATBcxx . . $ $anonymous_type_c69ee54cc268614d_3#SATB.; |
| 78 | |
| 79 | uint32cxx . . $ uint32# RCRCountcxx . . $ $anonymous_type_c69ee54cc268614d_3#RCRCount.; |
| 80 | |
| 81 | uint16cxx . . $ uint16# read_buffercxx . . $ $anonymous_type_c69ee54cc268614d_3#read_buffer.; |
| 82 | uint8cxx . . $ uint8# write_latchcxx . . $ $anonymous_type_c69ee54cc268614d_3#write_latch.; |
| 83 | uint8cxx . . $ uint8# statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status.; |
| 84 | |
| 85 | uint16cxx . . $ uint16# DMAReadBuffercxx . . $ $anonymous_type_c69ee54cc268614d_3#DMAReadBuffer.; |
| 86 | bool DMAReadWritecxx . . $ $anonymous_type_c69ee54cc268614d_3#DMAReadWrite.; |
| 87 | bool DMARunningcxx . . $ $anonymous_type_c69ee54cc268614d_3#DMARunning.; |
| 88 | bool SATBPendingcxx . . $ $anonymous_type_c69ee54cc268614d_3#SATBPending.; |
| 89 | bool burst_modecxx . . $ $anonymous_type_c69ee54cc268614d_3#burst_mode.; |
| 90 | |
| 91 | uint32cxx . . $ uint32# BG_YOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_YOffset.; |
| 92 | uint32cxx . . $ uint32# BG_XOffsetcxx . . $ $anonymous_type_c69ee54cc268614d_3#BG_XOffset.; |
| 93 | |
| 94 | |
| 95 | |
| 96 | int SAT_Cache_Validcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT_Cache_Valid.; // 64 through 128, depending on the number of 32-pixel-wide sprites. |
| 97 | SAT_Cache_tcxx . . $ SAT_Cache_t# SAT_Cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT_Cache.[128]; //64]; |
| 98 | |
| 99 | uint16cxx . . $ uint16# SATcxx . . $ $anonymous_type_c69ee54cc268614d_3#SAT.[0x100]; |
| 100 | |
| 101 | uint16cxx . . $ uint16# VRAMcxx . . $ $anonymous_type_c69ee54cc268614d_3#VRAM.[65536]; //VRAM_Size]; |
| 102 | uint64cxx . . $ uint64# bg_tile_cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#bg_tile_cache.[65536][8]; // Tile, y, x |
| 103 | uint8cxx . . $ uint8# spr_tile_cachecxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_cache.[1024][16][16]; // Tile, y, x |
| 104 | uint8cxx . . $ uint8# spr_tile_cleancxx . . $ $anonymous_type_c69ee54cc268614d_3#spr_tile_clean.[1024]; //VRAM_Size / 64]; |
| 105 | } vdc_tcxx . . $ vdc_t#; |
| 106 | |
| 107 | extern vdc_tcxx . . $ vdc_t# *vdccxx . . $ vdc.; |
| 108 | |
| 109 | |
| 110 | void VDC_SetPixelFormatcxx . . $ VDC_SetPixelFormat(49f6e7a06ebc5aa8).(void); |
| 111 | void VDC_RunFramecxx . . $ VDC_RunFrame(5ce680368ac0bb61).(EmulateSpecStructcxx . . $ EmulateSpecStruct# *espec, bool IsHES); |
| 112 | void VDC_SetLayerEnableMaskcxx . . $ VDC_SetLayerEnableMask(2c44cd906ae4e829).(uint64cxx . . $ uint64# mask); |
| 113 | |
| 114 | DECLFWcxx . . $ `mednafen/pce_fast/pce.h:12:9`!(VDC_Write); |
| 115 | DECLFWcxx . . $ `mednafen/pce_fast/pce.h:12:9`!(VDC_Write_ST); |
| 116 | |
| 117 | DECLFRcxx . . $ `mednafen/pce_fast/pce.h:11:9`!(VCE_Read); |
| 118 | |
| 119 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint8cxx . . $ uint8# VDC_Readcxx . . $ VDC_Read(caa7d1c0e7e3236b).(unsigned int A, bool SGX) |
| 120 | { |
| 121 | uint8cxx . . $ uint8# ret = 0; |
| 122 | int msb = A & 1; |
| 123 | int chip = 0; |
| 124 | |
| 125 | { |
| 126 | A &= 0x3; |
| 127 | } |
| 128 | |
| 129 | switch(A) |
| 130 | { |
| 131 | case 0x0: ret = vdccxx . . $ vdc.->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status.; |
| 132 | |
| 133 | vdccxx . . $ vdc.->statuscxx . . $ $anonymous_type_c69ee54cc268614d_3#status. &= ~0x3F; |
| 134 | |
| 135 | HuC6280_IRQEndcxx . . $ HuC6280_IRQEnd(d4f767463ce0a6b3).(MDFN_IQIRQ1cxx . . $ `mednafen/pce_fast/huc6280.h:65:9`!); // Clear VDC IRQ line |
| 136 | |
| 137 | break; |
| 138 | |
| 139 | case 0x2: |
| 140 | case 0x3: |
| 141 | ret = REGGETPcxx . . $ `mednafen/pce_fast/vdc.h:5:9`!(vdc->read_buffer, msb); |
| 142 | if(vdccxx . . $ vdc.->selectcxx . . $ $anonymous_type_c69ee54cc268614d_3#select. == 0x2) // VRR - VRAM Read Register |
| 143 | { |
| 144 | if(msb) |
| 145 | { |
| 146 | vdccxx . . $ vdc.->MARRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MARR. += vram_inc_tabcxx . . $ vram_inc_tab.[(vdccxx . . $ vdc.->CRcxx . . $ $anonymous_type_c69ee54cc268614d_3#CR. >> 11) & 0x3]; |
| 147 | |
| 148 | if(vdccxx . . $ vdc.->MARRcxx . . $ $anonymous_type_c69ee54cc268614d_3#MARR. >= VRAM_Sizecxx . . $ VRAM_Size.) |
| 149 | VDC_UNDEFINEDcxx . . $ `mednafen/pce_fast/vdc.h:9:9`!("Unmapped VRAM VRR read"); |
| 150 | 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. & VRAM_SizeMaskcxx . . $ VRAM_SizeMask.]; |
| 151 | } |
| 152 | } |
| 153 | break; |
| 154 | } |
| 155 | |
| 156 | //if(HuCPU.isopread && (A == 1 || A == 3)) //(A == 2 || A == 3)) // && A == 1) |
| 157 | if(A == 1) |
| 158 | { |
| 159 | //if(vdc->display_counter >= (VDS + VSW) && vdc->display_counter < (VDS + VSW + VDW + 1) && vce.dot_clock > 0) |
| 160 | if(vcecxx . . $ vce..dot_clockcxx . . $ $anonymous_type_c69ee54cc268614d_1#dot_clock. > 0) |
| 161 | ret = 0x40; |
| 162 | //printf("%d %d %02x\n", vdc->display_counter, vce.dot_clock, ret); |
| 163 | //ret = 0x40; |
| 164 | } |
| 165 | return(ret); |
| 166 | } |
| 167 | |
| 168 | DECLFWcxx . . $ `mednafen/pce_fast/pce.h:12:9`!(VCE_Write); |
| 169 | |
| 170 | void VDC_Initcxx . . $ VDC_Init(d4f767463ce0a6b3).(int sgx) MDFN_COLDcxx . . $ `mednafen/mednafen-types.h:116:9`!; |
| 171 | void VDC_Closecxx . . $ VDC_Close(49f6e7a06ebc5aa8).(void) MDFN_COLDcxx . . $ `mednafen/mednafen-types.h:116:9`!; |
| 172 | void VDC_Resetcxx . . $ VDC_Reset(49f6e7a06ebc5aa8).(void) MDFN_COLDcxx . . $ `mednafen/mednafen-types.h:116:9`!; |
| 173 | void VDC_Powercxx . . $ VDC_Power(49f6e7a06ebc5aa8).(void) MDFN_COLDcxx . . $ `mednafen/mednafen-types.h:116:9`!; |
| 174 | |
| 175 | int VDC_StateActioncxx . . $ VDC_StateAction(a45b884b8cf568d5).(StateMemcxx . . $ StateMem# *sm, int load, int data_only); |
| 176 | |
| 177 | #endif |