| 1 | #cxx . . $ `<file>/sfc/slot/satellaview/satellaview.cpp`/include <sfc/sfc.hpp>cxx . . $ `<file>/sfc/sfc.hpp`/ |
| 2 | |
| 3 | #define SATELLAVIEW_CARTRIDGE_CPPcxx . . $ `sfc/slot/satellaview/satellaview.cpp:3:9`! |
| 4 | namespace SuperFamicomcxx . . $ SuperFamicom/ { |
| 5 | |
| 6 | SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge# satellaviewcartridgecxx . . $ SuperFamicom/satellaviewcartridge.; |
| 7 | |
| 8 | void SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge#::initcxx . . $ SuperFamicom/SatellaviewCartridge#init(49f6e7a06ebc5aa8).() { |
| 9 | } |
| 10 | |
| 11 | void SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge#::loadcxx . . $ SuperFamicom/SatellaviewCartridge#load(49f6e7a06ebc5aa8).() { |
| 12 | if(memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..sizecxx . . $ SuperFamicom/MappedRAM#size(ddd8539a2fcdd4ce).() == 0) { |
| 13 | memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..mapcxx . . $ SuperFamicom/MappedRAM#map(e1e8b00c42c42532).(allocatecxx . . $ nall/allocate(9d298eca86c74d3d).<uint8cxx . . $ uint8#>(1024 * 1024, 0xff), 1024 * 1024); |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | void SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge#::unloadcxx . . $ SuperFamicom/SatellaviewCartridge#unload(49f6e7a06ebc5aa8).() { |
| 18 | memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..resetcxx . . $ SuperFamicom/MappedRAM#reset(49f6e7a06ebc5aa8).(); |
| 19 | } |
| 20 | |
| 21 | void SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge#::powercxx . . $ SuperFamicom/SatellaviewCartridge#power(49f6e7a06ebc5aa8).() { |
| 22 | } |
| 23 | |
| 24 | void SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge#::resetcxx . . $ SuperFamicom/SatellaviewCartridge#reset(49f6e7a06ebc5aa8).() { |
| 25 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. = 0; |
| 26 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_oldcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_old. = 0x00; |
| 27 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_newcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_new. = 0x00; |
| 28 | |
| 29 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..flash_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#flash_enable. = false; |
| 30 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..read_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#read_enable. = false; |
| 31 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_enable. = false; |
| 32 | memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..write_protectcxx . . $ SuperFamicom/MappedRAM#write_protect(b45ddcbc8423892c).(!regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_enable.); |
| 33 | } |
| 34 | |
| 35 | unsigned SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge#::sizecxx . . $ SuperFamicom/SatellaviewCartridge#size(ddd8539a2fcdd4ce).() const { |
| 36 | return memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..sizecxx . . $ SuperFamicom/MappedRAM#size(ddd8539a2fcdd4ce).(); |
| 37 | } |
| 38 | |
| 39 | uint8cxx . . $ uint8# SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge#::readcxx . . $ SuperFamicom/SatellaviewCartridge#read(32407b39b2dfce37).(unsigned addr) { |
| 40 | if(readonlycxx . . $ SuperFamicom/SatellaviewCartridge#readonly.) return memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..readcxx . . $ SuperFamicom/MappedRAM#read(32407b39b2dfce37).(buscxx . . $ SuperFamicom/bus..mirrorcxx . . $ SuperFamicom/Bus#mirror(83f10ac8959d5577).(addr, memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..sizecxx . . $ SuperFamicom/MappedRAM#size(ddd8539a2fcdd4ce).())); |
| 41 | |
| 42 | if(addr == 0x0002) { |
| 43 | if(regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..flash_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#flash_enable.) return 0x80; |
| 44 | } |
| 45 | |
| 46 | if(addr == 0x5555) { |
| 47 | if(regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..flash_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#flash_enable.) return 0x80; |
| 48 | } |
| 49 | |
| 50 | if(regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..read_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#read_enable. && addr >= 0xff00 && addr <= 0xff13) { |
| 51 | //read flash cartridge vendor information |
| 52 | switch(addr - 0xff00) { |
| 53 | case 0x00: return 0x4d; |
| 54 | case 0x01: return 0x00; |
| 55 | case 0x02: return 0x50; |
| 56 | case 0x03: return 0x00; |
| 57 | case 0x04: return 0x00; |
| 58 | case 0x05: return 0x00; |
| 59 | case 0x06: return 0x2a; //0x2a = 8mbit, 0x2b = 16mbit (not known to exist, though BIOS recognizes ID) |
| 60 | case 0x07: return 0x00; |
| 61 | default: return 0x00; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | return memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..readcxx . . $ SuperFamicom/MappedRAM#read(32407b39b2dfce37).(addr); |
| 66 | } |
| 67 | |
| 68 | void SatellaviewCartridgecxx . . $ SuperFamicom/SatellaviewCartridge#::writecxx . . $ SuperFamicom/SatellaviewCartridge#write(cc289a6b3dfc48da).(unsigned addr, uint8cxx . . $ uint8# data) { |
| 69 | if(readonlycxx . . $ SuperFamicom/SatellaviewCartridge#readonly.) return; |
| 70 | |
| 71 | if((addr & 0xff0000) == 0) { |
| 72 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_oldcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_old. = regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_newcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_new.; |
| 73 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_newcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_new. = data; |
| 74 | |
| 75 | if(regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_enable. && regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_oldcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_old. == regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_newcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_new.) { |
| 76 | return memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..writecxx . . $ SuperFamicom/MappedRAM#write(cc289a6b3dfc48da).(addr, data); |
| 77 | } |
| 78 | } else { |
| 79 | if(regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_enable.) { |
| 80 | return memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..writecxx . . $ SuperFamicom/MappedRAM#write(cc289a6b3dfc48da).(addr, data); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | if(addr == 0x0000) { |
| 85 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. <<= 8; |
| 86 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. |= data; |
| 87 | |
| 88 | if((regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. & 0xffff) == 0x38d0) { |
| 89 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..flash_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#flash_enable. = true; |
| 90 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..read_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#read_enable. = true; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | if(addr == 0x2aaa) { |
| 95 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. <<= 8; |
| 96 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. |= data; |
| 97 | } |
| 98 | |
| 99 | if(addr == 0x5555) { |
| 100 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. <<= 8; |
| 101 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. |= data; |
| 102 | |
| 103 | if((regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. & 0xffffff) == 0xaa5570) { |
| 104 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_enable. = false; |
| 105 | } |
| 106 | |
| 107 | if((regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. & 0xffffff) == 0xaa55a0) { |
| 108 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_oldcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_old. = 0x00; |
| 109 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_newcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_new. = 0x00; |
| 110 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..flash_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#flash_enable. = true; |
| 111 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_enable. = true; |
| 112 | } |
| 113 | |
| 114 | if((regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..commandcxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#command. & 0xffffff) == 0xaa55f0) { |
| 115 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..flash_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#flash_enable. = false; |
| 116 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..read_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#read_enable. = false; |
| 117 | regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_enable. = false; |
| 118 | } |
| 119 | |
| 120 | memorycxx . . $ SuperFamicom/SatellaviewCartridge#memory..write_protectcxx . . $ SuperFamicom/MappedRAM#write_protect(b45ddcbc8423892c).(!regscxx . . $ SuperFamicom/SatellaviewCartridge#regs..write_enablecxx . . $ SuperFamicom/SatellaviewCartridge#$anonymous_type_0#write_enable.); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | } |