| 1 | #cxx . . $ `<file>/mednafen/wswan/interrupt.c`/include "wswan.h"cxx . . $ `<file>/mednafen/wswan/wswan.h`/ |
| 2 | #include "interrupt.h"cxx . . $ `<file>/mednafen/wswan/interrupt.h`/ |
| 3 | #include "v30mz.h"cxx . . $ `<file>/mednafen/wswan/v30mz.h`/ |
| 4 | #include "../state.h"cxx . . $ `<file>/mednafen/state.h`/ |
| 5 | |
| 6 | static uint8cxx . . $ uint8# IStatuscxx . . $ IStatus.; |
| 7 | static uint8cxx . . $ uint8# IEnablecxx . . $ IEnable.; |
| 8 | static uint8cxx . . $ uint8# IVectorBasecxx . . $ IVectorBase.; |
| 9 | |
| 10 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! IOn_Cachecxx . . $ IOn_Cache.; |
| 11 | static uint32cxx . . $ uint32# IOn_Whichcxx . . $ IOn_Which.; |
| 12 | static uint32cxx . . $ uint32# IVector_Cachecxx . . $ IVector_Cache.; |
| 13 | |
| 14 | static void RecalcInterruptcxx . . $ RecalcInterrupt(49f6e7a06ebc5aa8).(void) |
| 15 | { |
| 16 | unsigned i; |
| 17 | IOn_Cachecxx . . $ IOn_Cache. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 18 | IOn_Whichcxx . . $ IOn_Which. = 0; |
| 19 | IVector_Cachecxx . . $ IVector_Cache. = 0; |
| 20 | |
| 21 | for(i = 0; i < 8; i++) |
| 22 | { |
| 23 | if(IStatuscxx . . $ IStatus. & IEnablecxx . . $ IEnable. & (1 << i)) |
| 24 | { |
| 25 | IOn_Cachecxx . . $ IOn_Cache. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 26 | IOn_Whichcxx . . $ IOn_Which. = i; |
| 27 | IVector_Cachecxx . . $ IVector_Cache. = (IVectorBasecxx . . $ IVectorBase. + i) * 4; |
| 28 | break; |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | void WSwan_Interruptcxx . . $ WSwan_Interrupt(d4f767463ce0a6b3).(int which) |
| 34 | { |
| 35 | if(IEnablecxx . . $ IEnable. & (1 << which)) |
| 36 | IStatuscxx . . $ IStatus. |= 1 << which; |
| 37 | |
| 38 | RecalcInterruptcxx . . $ RecalcInterrupt(49f6e7a06ebc5aa8).(); |
| 39 | } |
| 40 | |
| 41 | void WSwan_InterruptWritecxx . . $ WSwan_InterruptWrite(cc289a6b3dfc48da).(uint32cxx . . $ uint32# A, uint8cxx . . $ uint8# V) |
| 42 | { |
| 43 | switch(A) |
| 44 | { |
| 45 | case 0xB0: |
| 46 | IVectorBasecxx . . $ IVectorBase. = V; |
| 47 | RecalcInterruptcxx . . $ RecalcInterrupt(49f6e7a06ebc5aa8).(); |
| 48 | break; |
| 49 | case 0xB2: |
| 50 | IEnablecxx . . $ IEnable. = V; |
| 51 | IStatuscxx . . $ IStatus. &= IEnablecxx . . $ IEnable.; |
| 52 | RecalcInterruptcxx . . $ RecalcInterrupt(49f6e7a06ebc5aa8).(); |
| 53 | break; |
| 54 | case 0xB6: |
| 55 | IStatuscxx . . $ IStatus. &= ~V; |
| 56 | RecalcInterruptcxx . . $ RecalcInterrupt(49f6e7a06ebc5aa8).(); |
| 57 | break; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | uint8cxx . . $ uint8# WSwan_InterruptReadcxx . . $ WSwan_InterruptRead(32407b39b2dfce37).(uint32cxx . . $ uint32# A) |
| 62 | { |
| 63 | switch(A) |
| 64 | { |
| 65 | case 0xB0: |
| 66 | return(IVectorBasecxx . . $ IVectorBase.); |
| 67 | case 0xB2: |
| 68 | return(IEnablecxx . . $ IEnable.); |
| 69 | case 0xB6: |
| 70 | return(1 << IOn_Whichcxx . . $ IOn_Which.); //return(IStatus); |
| 71 | } |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | void WSwan_InterruptCheckcxx . . $ WSwan_InterruptCheck(49f6e7a06ebc5aa8).(void) |
| 77 | { |
| 78 | if(IOn_Cachecxx . . $ IOn_Cache.) |
| 79 | v30mz_intcxx . . $ v30mz_int(ee2069353d7cc01f).(IVector_Cachecxx . . $ IVector_Cache., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 80 | } |
| 81 | |
| 82 | void WSwan_InterruptResetcxx . . $ WSwan_InterruptReset(49f6e7a06ebc5aa8).(void) |
| 83 | { |
| 84 | IEnablecxx . . $ IEnable. = 0x00; |
| 85 | IStatuscxx . . $ IStatus. = 0x00; |
| 86 | IVectorBasecxx . . $ IVectorBase. = 0x00; |
| 87 | RecalcInterruptcxx . . $ RecalcInterrupt(49f6e7a06ebc5aa8).(); |
| 88 | } |
| 89 | |
| 90 | int WSwan_InterruptStateActioncxx . . $ WSwan_InterruptStateAction(a45b884b8cf568d5).(StateMemcxx . . $ StateMem# *sm, int load, int data_only) |
| 91 | { |
| 92 | SFORMATcxx . . $ SFORMAT# StateRegs[] = |
| 93 | { |
| 94 | { &(IStatuscxx . . $ IStatus.), (uint32_tcxx . . $ uint32_t#)sizeof(IStatuscxx . . $ IStatus.), MDFNSTATE_RLSBcxx . . $ `mednafen/state.h:26:9`!, "IStatus" }, |
| 95 | { &(IEnablecxx . . $ IEnable.), (uint32_tcxx . . $ uint32_t#)sizeof(IEnablecxx . . $ IEnable.), MDFNSTATE_RLSBcxx . . $ `mednafen/state.h:26:9`!, "IEnable"}, |
| 96 | { &(IVectorBasecxx . . $ IVectorBase.), (uint32_tcxx . . $ uint32_t#)sizeof(IVectorBasecxx . . $ IVectorBase.), MDFNSTATE_RLSBcxx . . $ `mednafen/state.h:26:9`!, "IVectorBase" }, |
| 97 | { 0, 0, 0, 0 } |
| 98 | }; |
| 99 | |
| 100 | if(!MDFNSS_StateActioncxx . . $ MDFNSS_StateAction(3f628545d3b0df83).(sm, load, data_only, StateRegs, "INTR", falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)) |
| 101 | return 0; |
| 102 | |
| 103 | if(load) |
| 104 | RecalcInterruptcxx . . $ RecalcInterrupt(49f6e7a06ebc5aa8).(); |
| 105 | |
| 106 | return 1; |
| 107 | } |