bsnes/higan/sfc/coprocessor/sa1/serialization.cpp

148 lines
2.5 KiB
C++
Raw Normal View History

auto SA1::serialize(serializer& s) -> void {
Update to v102r24 release. byuu says Changelog: - FC: fixed three MOS6502 regressions [hex\_usr] - GBA: return fetched instruction instead of 0 for unmapped MMIO (passes all of endrift's I/O tests) - MD: fix VDP control port read Vblank bit to test screen height instead of hard-code 240 (fixes Phantasy Star IV) - MD: swap USP,SSP when executing an exception (allows Super Street Fighter II to run; but no sprites visible yet) - MD: grant 68K access to Z80 bus on reset (fixes vdpdoc demo ROM from freezing immediately) - SFC: reads from $00-3f,80-bf:4000-43ff no longer update MDR [p4plus2] - SFC: massive, eight-hour cleanup of WDC65816 CPU core ... still not complete The big change this time around is the SFC CPU core. I've renamed everything from R65816 to WDC65816, and then went through and tried to clean up the code as much as possible. This core is so much larger than the 6502 core that I chose cleaning up the code to rewriting it. First off, I really don't care for the BitRange style functionality. It was an interesting experiment, but its fatal flaw are that the types are just bizarre, which makes them hard to pass around generically to other functions as arguments. So I went back to the list of bools for flags, and union/struct blocks for the registers. Next, I renamed all of the functions to be more descriptive: eg `op_read_idpx_w` becomes `instructionIndexedIndirectRead16`. `op_adc_b` becomes `algorithmADC8`. And so forth. I eliminated about ten instructions because they were functionally identical sans the index, so I just added a uint index=0 parameter to said functions. I added a few new ones (adjust→INC,DEC; pflag→REP,SEP) where it seemed appropriate. I cleaned up the disaster of the instruction switch table into something a whole lot more elegant without all the weird argument decoding nonsense (still need M vs X variants to avoid having to have 4-5 separate switch tables, but all the F/I flags are gone now); and made some things saner, like the flag clear/set and branch conditions, now that I have normal types for flags and registers once again. I renamed all of the memory access functions to be more descriptive to what they're doing: eg writeSP→push, readPC→fetch, writeDP→writeDirect, etc. Eliminated some of the special read/write modes that were only used in one single instruction. I started to clean up some of the actual instructions themselves, but haven't really accomplished much here. The big thing I want to do is get rid of the global state (aa, rd, iaddr, etc) and instead use local variables like I am doing with my other 65xx CPU cores now. But this will take some time ... the algorithm functions depend on rd to be set to work on them, rather than taking arguments. So I'll need to rework that. And then lastly, the disassembler is still a mess. I want to finish the CPU cleanups, and then post a new WIP, and then rewrite the disassembler after that. The reason being ... I want a WIP that can generate identical trace logs to older versions, in case the CPU cleanup causes any regressions. That way I can more easily spot the errors. Oh ... and a bit of good news. v102 was running at ~140fps on the SNES core. With the new support to suspend/resume WAI/STP, plus the internal CPU registers not updating the MDR, the framerate dropped to ~132fps. But with the CPU cleanups, performance went back to ~140fps. So, hooray. Of course, without those two other improvements, we'd have ended up at possibly ~146-148fps, but oh well.
2017-06-13 01:42:31 +00:00
WDC65816::serialize(s);
Thread::serialize(s);
s.array(iram.data(), iram.size());
s.array(bwram.data(), bwram.size());
//sa1.hpp
s.integer(status.counter);
s.integer(status.interruptPending);
s.integer(status.scanlines);
s.integer(status.vcounter);
s.integer(status.hcounter);
//bus/bus.hpp
s.array(iram.data(), iram.size());
s.integer(cpubwram.dma);
//dma/dma.hpp
s.integer(dma.line);
//mmio/mmio.hpp
s.integer(mmio.sa1_irq);
s.integer(mmio.sa1_rdyb);
s.integer(mmio.sa1_resb);
s.integer(mmio.sa1_nmi);
s.integer(mmio.smeg);
s.integer(mmio.cpu_irqen);
s.integer(mmio.chdma_irqen);
s.integer(mmio.cpu_irqcl);
s.integer(mmio.chdma_irqcl);
s.integer(mmio.crv);
s.integer(mmio.cnv);
s.integer(mmio.civ);
s.integer(mmio.cpu_irq);
s.integer(mmio.cpu_ivsw);
s.integer(mmio.cpu_nvsw);
s.integer(mmio.cmeg);
s.integer(mmio.sa1_irqen);
s.integer(mmio.timer_irqen);
s.integer(mmio.dma_irqen);
s.integer(mmio.sa1_nmien);
s.integer(mmio.sa1_irqcl);
s.integer(mmio.timer_irqcl);
s.integer(mmio.dma_irqcl);
s.integer(mmio.sa1_nmicl);
s.integer(mmio.snv);
s.integer(mmio.siv);
s.integer(mmio.hvselb);
s.integer(mmio.ven);
s.integer(mmio.hen);
s.integer(mmio.hcnt);
s.integer(mmio.vcnt);
s.integer(mmio.cbmode);
s.integer(mmio.cb);
s.integer(mmio.dbmode);
s.integer(mmio.db);
s.integer(mmio.ebmode);
s.integer(mmio.eb);
s.integer(mmio.fbmode);
s.integer(mmio.fb);
s.integer(mmio.sbm);
s.integer(mmio.sw46);
s.integer(mmio.cbm);
s.integer(mmio.swen);
s.integer(mmio.cwen);
s.integer(mmio.bwp);
s.integer(mmio.siwp);
s.integer(mmio.ciwp);
s.integer(mmio.dmaen);
s.integer(mmio.dprio);
s.integer(mmio.cden);
s.integer(mmio.cdsel);
s.integer(mmio.dd);
s.integer(mmio.sd);
s.integer(mmio.chdend);
s.integer(mmio.dmasize);
s.integer(mmio.dmacb);
s.integer(mmio.dsa);
s.integer(mmio.dda);
s.integer(mmio.dtc);
s.integer(mmio.bbf);
s.array(mmio.brf);
s.integer(mmio.acm);
s.integer(mmio.md);
s.integer(mmio.ma);
s.integer(mmio.mb);
s.integer(mmio.hl);
s.integer(mmio.vb);
s.integer(mmio.va);
s.integer(mmio.vbit);
s.integer(mmio.cpu_irqfl);
s.integer(mmio.chdma_irqfl);
s.integer(mmio.sa1_irqfl);
s.integer(mmio.timer_irqfl);
s.integer(mmio.dma_irqfl);
s.integer(mmio.sa1_nmifl);
s.integer(mmio.hcr);
s.integer(mmio.vcr);
s.integer(mmio.mr);
s.integer(mmio.overflow);
}