Rekai Nyangadzayi Musuka
f2b27f31f4
chore: better conform to zig idioms
2022-10-21 05:12:57 -03:00
Rekai Nyangadzayi Musuka
867025b1ec
chore: rename arm7tdmi variables to just cpu
...
Less verbose, specifying arm7tdmi doesn't really do much when there's
no other CPU in the system
2022-10-21 05:12:57 -03:00
Rekai Nyangadzayi Musuka
9b0f54b111
chore: allocate sprite array on heap
...
Each Sprite optional is 10 bytes meaning I'm allocating 1.28Kb on the
stack which isn't necessary.
2022-10-21 05:12:56 -03:00
Rekai Nyangadzayi Musuka
4cf58f1faa
chore: improve init/deinit methods
2022-10-21 05:12:56 -03:00
Rekai Nyangadzayi Musuka
1a56f957c1
chore: reorganize some code
2022-10-21 05:12:56 -03:00
Rekai Nyangadzayi Musuka
1a4a2a56a3
chore: pass the allocator as an argument more often
...
As of right now, I think the only cases where I shouldn't explicitly pass an allocator
are in read/write functions and deinits
2022-10-21 05:12:56 -03:00
Rekai Nyangadzayi Musuka
c701156ce6
fix: resolve use-afer-free in backup.zig
...
This worked fine on stage1, and works fine in debug in stage3.
However, stage3 ReleaseSafe would panic due to what I assume must
have been an undefined behaviour optimization.
While I'm happy that I was quickly made aware of the issue thanks to
the safety checks in ReleaseSafe I do wish that this issue showed itself
in Debug, since I *am* using the GPA
2022-10-21 05:12:56 -03:00
Rekai Nyangadzayi Musuka
4b6897aedf
feat: Get ZBA working on Zig's new stage2/stage3 compiler
2022-10-21 05:12:55 -03:00
Rekai Nyangadzayi Musuka
1471288969
chore: move window scale const to emu.zig
2022-10-21 05:12:55 -03:00
Rekai Nyangadzayi Musuka
7488fd7fd5
fix: reimpl debug reads w/out throwing away *const Self
2022-10-21 05:12:55 -03:00
Rekai Nyangadzayi Musuka
3f760fccaf
feat: reimplement cpu logging
2022-10-21 05:12:55 -03:00
Rekai Nyangadzayi Musuka
f833de765c
chore: don't init bus in Arm7tdmi init
2022-10-21 05:12:55 -03:00
Rekai Nyangadzayi Musuka
aa19ef5f71
feat: move arm instr decoding to module
2022-10-21 05:12:54 -03:00
Rekai Nyangadzayi Musuka
f0284107f9
feat: move thumb instr decoding to module
2022-10-21 05:12:54 -03:00
Rekai Nyangadzayi Musuka
91c94fe528
chore: change directory structure
2022-10-21 05:12:54 -03:00
Rekai Nyangadzayi Musuka
45fc49b216
fix: reimplement halt fast-forwarding
2022-10-21 05:12:54 -03:00
Rekai Nyangadzayi Musuka
0939d6d7bc
chore: move audio sync, video sync variables
2022-10-21 05:12:53 -03:00
Rekai Nyangadzayi Musuka
46ee21f464
feat: impl WININ, WINOUT, WIN{N}H and WIN{N}V
2022-10-21 05:12:53 -03:00
Rekai Nyangadzayi Musuka
0287c9a260
fix: force align DMA transfers
2022-10-21 05:12:53 -03:00
Rekai Nyangadzayi Musuka
665767c250
fix: resolve bugs in VRAM unpredictable read/writes
2022-10-21 05:12:53 -03:00
Rekai Nyangadzayi Musuka
0fd8a13a93
fix: don't start HDMA in vblank
2022-10-21 05:12:52 -03:00
Rekai Nyangadzayi Musuka
125b931d0c
feat: implement brightness increase/decrease
2022-10-21 05:12:52 -03:00
Rekai Nyangadzayi Musuka
27259c97db
feat: implement object blending
2022-10-21 05:12:52 -03:00
Rekai Nyangadzayi Musuka
9479838614
feat: implement background alpha blending
2022-10-21 05:12:52 -03:00
Rekai Nyangadzayi Musuka
8a203ff05f
feat: implement BLDCNT, BLDALPHA, BLDY
2022-10-21 05:12:52 -03:00
Rekai Nyangadzayi Musuka
33f993c19d
chore: rename + remove some code
2022-10-21 05:12:51 -03:00
Rekai Nyangadzayi Musuka
18ec16eb6d
fix: properly fire DMA IRQs
...
This resolves Sound DMA Timing issues present in DOOM
2022-10-21 05:12:51 -03:00
Rekai Nyangadzayi Musuka
bf558922f9
chore: rename Dma.active to Dma.in_progress
2022-10-21 05:12:51 -03:00
Rekai Nyangadzayi Musuka
e87bda7584
chore: rewrite info log message
2022-10-21 05:12:51 -03:00
Rekai Nyangadzayi Musuka
87dc70436c
feat: implement NR10 obscure behaviour
2022-10-21 05:12:51 -03:00
Rekai Nyangadzayi Musuka
5dd78177f4
feat: handle all I/O when using Cult-Of-GBA BIOS
2022-10-21 05:12:51 -03:00
Rekai Nyangadzayi Musuka
203af4c471
chore: 32-bit reads for PSG audio
2022-10-21 05:12:50 -03:00
Rekai Nyangadzayi Musuka
98223d9e5a
chore: implement more than just 1 cycle per mem access
2022-10-21 05:12:50 -03:00
Rekai Nyangadzayi Musuka
e8cc0dfabb
fix: implement register reads for Yoshi's Island
2022-10-21 05:12:50 -03:00
Rekai Nyangadzayi Musuka
c8585a6f9a
fix: reimplement DMA ticking
2022-10-21 05:12:50 -03:00
Rekai Nyangadzayi Musuka
7d79361aca
chore(cpu): add inline fn isHalted()
2022-10-21 05:12:50 -03:00
Rekai Nyangadzayi Musuka
d1d32e465c
chore: attempt to debug Rhythm Heaven
2022-10-21 05:12:50 -03:00
Rekai Nyangadzayi Musuka
42c6b21124
fix: impl BG?{X,Y} RefPoint write behaviour outside of Vblank
...
With this fix Mode 7-like games now properly render their backgrounds
2022-10-21 05:12:49 -03:00
Rekai Nyangadzayi Musuka
44e1dacb7b
chore: change priority of some logs
2022-10-21 05:12:49 -03:00
Rekai Nyangadzayi Musuka
eeea8a6327
chore: mess with debug statements + mask APU I/O reads
2022-10-21 05:12:49 -03:00
Rekai Nyangadzayi Musuka
0a5df26c31
chore: move timer, apu and dma i/o addr matching outside of io.zig
2022-10-21 05:12:49 -03:00
Rekai Nyangadzayi Musuka
d3bc58d71c
chore: separate render code for affine sprites
2022-10-21 05:12:49 -03:00
Rekai Nyangadzayi Musuka
8d32d9788e
chore: reimplement object rendering
...
TODO: implement affine sprites
2022-10-21 05:12:48 -03:00
Rekai Nyangadzayi Musuka
b18f488b01
chore: small changes to normal background drawing code
2022-10-21 05:12:48 -03:00
Rekai Nyangadzayi Musuka
4b4242df2a
feat: implement affine backgrounds
2022-10-21 05:12:48 -03:00
Rekai Nyangadzayi Musuka
e2533dedeb
chore: stub 8-bit window registers
2022-10-21 05:12:48 -03:00
Rekai Nyangadzayi Musuka
89619596ad
chore: remove code that pretends to remove DC offset
2022-10-21 05:12:48 -03:00
Rekai Nyangadzayi Musuka
02fee16561
fix: replace affine bg register bitfields with signed integers
2022-10-21 05:12:48 -03:00
Rekai Nyangadzayi Musuka
bf8521eb5e
chore: use stdlib endian-aware integer read/write functions
2022-10-21 05:12:47 -03:00
Rekai Nyangadzayi Musuka
db064d2321
chore: misc style improvements
2022-10-21 05:12:47 -03:00
Rekai Nyangadzayi Musuka
e0523aea63
chore: rename method in FpsTracker
2022-10-21 05:12:47 -03:00
Rekai Nyangadzayi Musuka
c18be62b11
fix(backup): resolve banking issue in flash impl
2022-10-21 05:12:46 -03:00
Rekai Nyangadzayi Musuka
9f69b122d0
chore: remove awful ptr casts in backup.zig and bios.zig
2022-10-21 05:12:46 -03:00
Rekai Nyangadzayi Musuka
295aa139f6
feat: pass jsmolka's bios.gba
2022-10-21 05:12:46 -03:00
Rekai Nyangadzayi Musuka
2502cc5bf0
fix: play right samples in right channel
2022-10-21 05:12:46 -03:00
Rekai Nyangadzayi Musuka
fc7f2a2959
fix: resolve issue when handling event sooner than expected
2022-10-21 05:12:46 -03:00
Rekai Nyangadzayi Musuka
9d839a0328
fix: remove DC offset from audio output
2022-10-21 05:12:45 -03:00
Rekai Nyangadzayi Musuka
55dada243e
chore: add debug keybinds for scheduler capacity + event count
2022-10-21 05:12:45 -03:00
Rekai Nyangadzayi Musuka
78e7c0bc3f
perf: don't check scheduler every iteration of runFrame loop
...
~20fps gain in Pokemon Emerald, nice
2022-10-21 05:12:45 -03:00
Rekai Nyangadzayi Musuka
9134456229
chore: simplify 4bpp palette code
2022-10-21 05:12:45 -03:00
Rekai Nyangadzayi Musuka
0ef71ecb49
perf: convert BGR555 to RGBA8888 at compile-time, access w/ lookup table
...
Compile speed isn't slowed down by that much + there's a ~20fps gain in
Pokemon emerald, though this isn't anything exact
2022-10-21 05:12:45 -03:00
Rekai Nyangadzayi Musuka
3d18685d36
chore: modify type signature of util.sext
2022-10-21 05:12:45 -03:00
Rekai Nyangadzayi Musuka
f194bee4eb
chore: cleanup main
2022-10-21 05:12:44 -03:00
Rekai Nyangadzayi Musuka
f373d8e17c
chore: emu audio sync code to emu.zig
2022-10-21 05:12:44 -03:00
Rekai Nyangadzayi Musuka
1b7d15e7d2
chore: redo apu sampling
2022-10-21 05:12:44 -03:00
Rekai Nyangadzayi Musuka
89d8c08cd1
chore: implement apu u16 reads
2022-10-21 05:12:44 -03:00
Rekai Nyangadzayi Musuka
3cd02a44cf
fix: clean up frequency timer implementations
2022-10-21 05:12:44 -03:00
Rekai Nyangadzayi Musuka
87eb0cc808
Revert "fix: resolve off-by-one errors when scheduling freq timer expirations"
...
This reverts commit c9b0030b4b
.
2022-10-21 05:12:43 -03:00
Rekai Nyangadzayi Musuka
8313210ddc
fix: resolve off-by-one errors when scheduling freq timer expirations
2022-10-21 05:12:43 -03:00
Rekai Nyangadzayi Musuka
2664f5cf20
chore: improve APU accuracy + scheduler refactoring
2022-10-21 05:12:43 -03:00
Rekai Nyangadzayi Musuka
29ee225c1f
feat: stub Affine BG registers
2022-10-21 05:12:43 -03:00
Rekai Nyangadzayi Musuka
ff6d2517be
fix: resolve out-of-bounds error with 8bpp tall / horizontal sprites
...
Boot ROM is now enabled by default as well
2022-10-21 05:12:43 -03:00
Rekai Nyangadzayi Musuka
242bf08cf2
chore: improve audio accuracy
2022-10-21 05:12:42 -03:00
Rekai Nyangadzayi Musuka
996de65688
chore: reintroduce thread sleeping + simplify fps counter
2022-10-21 05:12:42 -03:00
Rekai Nyangadzayi Musuka
b97b66927f
feat: implement double buffering
2022-10-21 05:12:42 -03:00
Rekai Nyangadzayi Musuka
628d4cfb68
chore: clean up DMA code
2022-10-21 05:12:42 -03:00
Rekai Nyangadzayi Musuka
ff002f18c6
feat: handle DMA IRQs (maybe?)
2022-10-21 05:12:42 -03:00
Rekai Nyangadzayi Musuka
5d5d3827fb
chore: contain Timers in a tuple rather than a struct
2022-10-21 05:12:42 -03:00
Rekai Nyangadzayi Musuka
8826242bf3
chore: contain DMA Controllers in a tuple rather than a struct
2022-10-21 05:12:41 -03:00
Rekai Nyangadzayi Musuka
570ff8536c
chore: resolve incorrect memory mirror in VRAM
...
+ stub GPIO registers on ROM Write
2022-10-21 05:12:41 -03:00
Rekai Nyangadzayi Musuka
2c0d2b64a2
chore: stub a few I/O registers
2022-10-21 05:12:41 -03:00
Rekai Nyangadzayi Musuka
1750c0a26e
chore: allow 8-bit IO to BG0CNT and BG1CNT
...
BG0CNT and and BG1CNT now work properly in mario kart
2022-10-21 05:12:41 -03:00
Rekai Nyangadzayi Musuka
a102d68e99
chore: define affine sprite attributes
2022-10-21 05:12:41 -03:00
Rekai Nyangadzayi Musuka
61483b93e8
feat: stub mode 1 and 2
2022-10-21 05:12:40 -03:00
Rekai Nyangadzayi Musuka
192d7645eb
feat: implement mode 5
...
I wonder which obscure game makes heavy use of this mode
2022-10-21 05:12:40 -03:00
Rekai Nyangadzayi Musuka
f1c68fb0de
chore: comment ARM MSR code + Audio issues
2022-10-21 05:12:40 -03:00
Rekai Nyangadzayi Musuka
cb74bfd280
chore: pass destoer's cond_invalid test
2022-10-21 05:12:40 -03:00
Rekai Nyangadzayi Musuka
0d1717538b
chore: misc print message improvements
2022-10-21 05:12:40 -03:00
Rekai Nyangadzayi Musuka
896ae0935a
chore: improvements to APU accuracy
2022-10-21 05:12:39 -03:00
Rekai Nyangadzayi Musuka
1a23073424
fix: incorrect order-of-operations in ARM BL impl
2022-10-21 05:12:39 -03:00
Rekai Nyangadzayi Musuka
36f3b0d381
chore: special case saving for ROMS without titles
2022-10-21 05:12:39 -03:00
Rekai Nyangadzayi Musuka
c2f3790dc3
feat: pass DenSinH's eeprom-test
2022-10-21 05:12:39 -03:00
Rekai Nyangadzayi Musuka
746c28004f
feat: implement EEPROM
2022-10-21 05:12:38 -03:00
Rekai Nyangadzayi Musuka
084d4b28dd
chore: implement I/O regsister for Minish Cap
2022-10-21 05:12:38 -03:00
Rekai Nyangadzayi Musuka
ed6e83b121
chore: change default window scale to 4x
2022-10-21 05:12:38 -03:00
Rekai Nyangadzayi Musuka
b827ba3a1c
chore: write more debug log messages for unimplemented registers
2022-10-21 05:12:38 -03:00
Rekai Nyangadzayi Musuka
0f343f0b74
chore: only sync to audio for now
2022-10-21 05:12:38 -03:00
Rekai Nyangadzayi Musuka
7a670c6ed9
feat: panic on unimplemented I/O in ReleaseSafe/Debug but not ReleaseFast
2022-10-21 05:12:38 -03:00
Rekai Nyangadzayi Musuka
e690f88cda
chore: misc improvements
2022-10-21 05:12:37 -03:00
Rekai Nyangadzayi Musuka
c7f537959b
fix: improper lifetime for *Arm7tdmi ptr in Bus
...
*Arm7tdmi ptr is now assigned one scope up so that it lives as least
as long as Bus does
2022-10-21 05:12:37 -03:00