From b29167eeee880c9f7f31194c94aadf715733bf99 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 23 Dec 2023 19:29:20 -0800 Subject: lots of stuff. yax rx notes --- source/blog/yaxgbc_dev_notes.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 source/blog/yaxgbc_dev_notes.md (limited to 'source/blog/yaxgbc_dev_notes.md') diff --git a/source/blog/yaxgbc_dev_notes.md b/source/blog/yaxgbc_dev_notes.md new file mode 100644 index 0000000..2a14567 --- /dev/null +++ b/source/blog/yaxgbc_dev_notes.md @@ -0,0 +1,39 @@ +# yaxgbc + +i hack on a gameboy color emulator from time to time. it started as... [a disassembler](https://git.iximeow.net/yaxpeax-sm83/?h=no-gods-no-) for the kind-of-but-not-Z80 processor in the Gameboy and Gameboy Color. in December or so, i looked at that library, remarked to myself that the whole disassembler is maybe 400 lines of Rust, and wondered how it would fare seeing real use. + +so i started writing enough of an emulator to see that the disassembler worked (it did! yay!), and started measuring how it affected the dependent code: +* actual runtime overhead? +* how large is the compiled decoder? + +TODO: fish up old numbers and screenshots. because there was substantial runtime impact, and i spotted a [missed optimization](https://github.com/rust-lang/rust/issues/107208) in rustc. i entirely rewrote the [`sm83` disassembler](https://github.com/iximeow/yaxpeax-sm83/commit/819e8a30d20c28398a00976a9925e9e741950bee) to be easier to merge the disassembler directly into code using it. as a [length-only decoder](https://github.com/iximeow/yaxpeax-sm83/commit/819e8a30d20c28398a00976a9925e9e741950bee#diff-9176af78feab5192ec447e97a2b52a0ba00b22c9e9b7ac3fc8c9763a5e9bd5caR50-R55), the decoder is on the order of 85 bytes without rustc being improved. + +somewhere between discovering the issue and coming up with a redesigned decoder interface, i had an existential panic about code reuse being fundamentally incompatible with high performance/tightly-integrated libraries. i no longer have any such panic :) + +## bugs aka dev log + +### video issues ("ascii `video` to the terminal is good right") + +### video issues ("why is the gameboy logo rendered wrong") + +### interrupt issues (are they level-triggered or edge-triggered? what clears interrupt bits, if anything) + +### input issues (edge/level trigger on inputs too) + +### clock sync (sleep() accuracy on windows and timeBeginPeriod) + +### audio issues ("there isn't any") + +### audio issues ("sounds are.. backwards?? what gives" [cycles/sample vs samples/sec]) + +### audio issues ("noise noises too long. why." [channel 4 length docs]) + +### audio issues ("frequencies are all off?" [timer multiplier issue]) + +### video issues ("why is parallax in link's awakening broken" [not handlnig lyc=0]) + +### video issues ("why is oracle of seasons/oracle of ages corrupted" [dma transfers to odd addresses]) + +### video issues ("why is wario land 3 corrupted" [dma transfers to address 0, expecting high bits set]) + +... -- cgit v1.1