Commit Graph

477 Commits

Author SHA1 Message Date
Rekai Nyangadzayi Musuka 601b0b2aae feat: handle all I/O when using Cult-Of-GBA BIOS 2022-06-18 17:50:11 -03:00
Rekai Nyangadzayi Musuka 3becd790cf chore: 32-bit reads for PSG audio 2022-06-18 17:35:52 -03:00
Rekai Nyangadzayi Musuka 460f8308a7 chore: implement more than just 1 cycle per mem access 2022-06-16 22:35:42 -03:00
Rekai Nyangadzayi Musuka cc8c1c1e21 fix: implement register reads for Yoshi's Island 2022-06-16 02:32:31 -03:00
Rekai Nyangadzayi Musuka f5e401a4ee fix: reimplement DMA ticking 2022-06-16 01:46:37 -03:00
Rekai Nyangadzayi Musuka dba8873f76 chore(cpu): add inline fn isHalted() 2022-06-16 00:49:37 -03:00
Rekai Nyangadzayi Musuka db08edbdb9 chore: attempt to debug Rhythm Heaven 2022-06-16 00:03:51 -03:00
Rekai Nyangadzayi Musuka 35dba63b94 fix: impl BG?{X,Y} RefPoint write behaviour outside of Vblank
With this fix Mode 7-like games now properly render their backgrounds
2022-06-15 01:34:34 -03:00
Rekai Nyangadzayi Musuka a753912cb5 chore: change priority of some logs 2022-06-15 01:18:45 -03:00
Rekai Nyangadzayi Musuka 7441af9582 chore: mess with debug statements + mask APU I/O reads 2022-06-15 01:08:43 -03:00
Rekai Nyangadzayi Musuka 708f64035f chore: move timer, apu and dma i/o addr matching outside of io.zig 2022-06-15 00:05:36 -03:00
Rekai Nyangadzayi Musuka e4bbd33a49 chore: separate render code for affine sprites 2022-06-04 20:07:20 -03:00
Rekai Nyangadzayi Musuka 25d13722f7 chore: reimplement object rendering
TODO: implement affine sprites
2022-06-04 13:55:31 -03:00
Rekai Nyangadzayi Musuka 4eb0d469b3 chore: small changes to normal background drawing code 2022-06-04 10:21:03 -03:00
Rekai Nyangadzayi Musuka ce2271100b feat: implement affine backgrounds 2022-06-04 09:49:34 -03:00
Rekai Nyangadzayi Musuka e226a59a2f chore: stub 8-bit window registers 2022-06-04 09:48:59 -03:00
Rekai Nyangadzayi Musuka 7ff5f3b8e7 chore: remove code that pretends to remove DC offset 2022-06-04 09:47:58 -03:00
Rekai Nyangadzayi Musuka b6f5517c89 fix: replace affine bg register bitfields with signed integers 2022-06-03 19:26:52 -03:00
Rekai Nyangadzayi Musuka 2dc3864dca chore: use stdlib endian-aware integer read/write functions 2022-06-03 13:26:55 -03:00
Rekai Nyangadzayi Musuka 38afb567b9 chore: misc style improvements 2022-05-27 22:09:15 -03:00
Rekai Nyangadzayi Musuka 4006888629 chore: rename method in FpsTracker 2022-05-27 21:50:16 -03:00
Rekai Nyangadzayi Musuka 413ff02ad9 fix(backup): resolve banking issue in flash impl 2022-05-27 21:17:50 -03:00
Rekai Nyangadzayi Musuka 517ed7a835 chore: remove awful ptr casts in backup.zig and bios.zig 2022-05-27 20:24:09 -03:00
Rekai Nyangadzayi Musuka d4bc1f2cd0 feat: pass jsmolka's bios.gba 2022-05-27 20:08:09 -03:00
Rekai Nyangadzayi Musuka c6ce810afe fix: play right samples in right channel 2022-05-27 18:47:34 -03:00
Rekai Nyangadzayi Musuka 1170673447 fix: resolve issue when handling event sooner than expected 2022-05-26 17:11:02 -03:00
Rekai Nyangadzayi Musuka c007bf4d8e fix: remove DC offset from audio output 2022-05-26 17:10:10 -03:00
Rekai Nyangadzayi Musuka 697ec46cf1 chore: add debug keybinds for scheduler capacity + event count 2022-05-25 15:13:57 -03:00
Rekai Nyangadzayi Musuka 41ee32b118 perf: don't check scheduler every iteration of runFrame loop
~20fps gain in Pokemon Emerald, nice
2022-05-25 14:17:44 -03:00
Rekai Nyangadzayi Musuka 8f5d054195 chore: simplify 4bpp palette code 2022-05-25 10:10:57 -03:00
Rekai Nyangadzayi Musuka c907552864 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-05-24 13:55:50 -03:00
Rekai Nyangadzayi Musuka ff3f79801c chore: modify type signature of util.sext 2022-05-23 14:48:52 -03:00
Rekai Nyangadzayi Musuka f130d1991c chore: cleanup main 2022-05-23 12:50:01 -03:00
Rekai Nyangadzayi Musuka 24a8905c29 chore: emu audio sync code to emu.zig 2022-05-23 12:05:57 -03:00
Rekai Nyangadzayi Musuka e70fe73899 chore: redo apu sampling 2022-05-23 11:25:28 -03:00
Rekai Nyangadzayi Musuka a2d2a84850 chore: implement apu u16 reads 2022-05-21 15:09:32 -03:00
Rekai Nyangadzayi Musuka 109561310e fix: clean up frequency timer implementations 2022-05-21 14:21:50 -03:00
Rekai Nyangadzayi Musuka 5164aa961d Revert "fix: resolve off-by-one errors when scheduling freq timer expirations"
This reverts commit c9b0030b4b.
2022-05-21 13:46:46 -03:00
Rekai Nyangadzayi Musuka c9b0030b4b fix: resolve off-by-one errors when scheduling freq timer expirations 2022-05-21 13:34:14 -03:00
Rekai Nyangadzayi Musuka af2ad6c924 chore: improve APU accuracy + scheduler refactoring 2022-05-20 16:01:12 -03:00
Rekai Nyangadzayi Musuka c40cc2ba30 feat: stub Affine BG registers 2022-05-18 15:50:40 -03:00
Rekai Nyangadzayi Musuka 8dddb865cc fix: resolve out-of-bounds error with 8bpp tall / horizontal sprites
Boot ROM is now enabled by default as well
2022-05-17 12:16:30 -03:00
Rekai Nyangadzayi Musuka 2e821ab79c chore: improve audio accuracy 2022-05-17 11:28:05 -03:00
Rekai Nyangadzayi Musuka a667269d26 chore: reintroduce thread sleeping + simplify fps counter 2022-05-17 08:55:23 -03:00
Rekai Nyangadzayi Musuka daf977ef06 feat: implement double buffering 2022-05-17 06:53:37 -03:00
Rekai Nyangadzayi Musuka 660c8a2d62 chore: clean up DMA code 2022-05-05 22:36:11 -03:00
Rekai Nyangadzayi Musuka 9d590b099a feat: handle DMA IRQs (maybe?) 2022-05-05 22:04:59 -03:00
Rekai Nyangadzayi Musuka d5443d9c2f chore: contain Timers in a tuple rather than a struct 2022-05-05 20:09:00 -03:00
Rekai Nyangadzayi Musuka f0ce39230b chore: contain DMA Controllers in a tuple rather than a struct 2022-05-05 19:53:12 -03:00
Rekai Nyangadzayi Musuka 208e88e869 chore: resolve incorrect memory mirror in VRAM
+ stub GPIO registers on ROM Write
2022-05-05 16:44:48 -03:00
Rekai Nyangadzayi Musuka 5df023fb41 chore: stub a few I/O registers 2022-05-03 22:41:05 -03:00
Rekai Nyangadzayi Musuka 46ac1542a6 chore: allow 8-bit IO to BG0CNT and BG1CNT
BG0CNT and and BG1CNT now work properly in mario kart
2022-05-01 20:41:00 -03:00
Rekai Nyangadzayi Musuka c2f55e0bfb chore: define affine sprite attributes 2022-05-01 19:15:56 -03:00
Rekai Nyangadzayi Musuka 12f9bb51c1 feat: stub mode 1 and 2 2022-05-01 18:53:11 -03:00
Rekai Nyangadzayi Musuka 41558c9103 feat: implement mode 5
I wonder which obscure game makes heavy use of this mode
2022-05-01 18:10:52 -03:00
Rekai Nyangadzayi Musuka 68012f84d3 chore: comment ARM MSR code + Audio issues 2022-04-30 22:17:34 -05:00
Rekai Nyangadzayi Musuka 640b1f7c5d chore: pass destoer's cond_invalid test 2022-04-30 20:42:47 -05:00
Rekai Nyangadzayi Musuka f2f4bb205a chore: misc print message improvements 2022-04-29 12:41:05 -05:00
Rekai Nyangadzayi Musuka 6c88a0aec2 chore: improvements to APU accuracy 2022-04-29 12:19:31 -05:00
Rekai Nyangadzayi Musuka 002287ecfe fix: incorrect order-of-operations in ARM BL impl 2022-04-27 23:15:39 -05:00
Rekai Nyangadzayi Musuka a87b46898b chore: special case saving for ROMS without titles 2022-04-27 18:08:44 -05:00
Rekai Nyangadzayi Musuka d9c9105449 feat: pass DenSinH's eeprom-test 2022-04-25 17:20:43 -05:00
Rekai Nyangadzayi Musuka 05a432f1c1 feat: implement EEPROM 2022-04-25 16:23:24 -05:00
Rekai Nyangadzayi Musuka f4a48d536c chore: implement I/O regsister for Minish Cap 2022-04-25 08:01:34 -05:00
Rekai Nyangadzayi Musuka 81db06d2fc chore: change default window scale to 4x 2022-04-24 08:33:28 -04:00
Rekai Nyangadzayi Musuka 1812fb8008 chore: write more debug log messages for unimplemented registers 2022-04-22 22:19:26 -03:00
Rekai Nyangadzayi Musuka 762494453f chore: only sync to audio for now 2022-04-22 20:56:52 -03:00
Rekai Nyangadzayi Musuka e3553bcbd6 feat: panic on unimplemented I/O in ReleaseSafe/Debug but not ReleaseFast 2022-04-22 20:56:52 -03:00
Rekai Nyangadzayi Musuka 9cce4d9859 chore: misc improvements 2022-04-21 10:15:52 -03:00
Rekai Nyangadzayi Musuka 75ba9a4bf9 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-04-21 07:56:17 -03:00
Rekai Nyangadzayi Musuka 85e8ca9146 feat: implement Noise
Kirby & The Amazing Mirror crashes only in ReleaseSafe / ReleaseBug.

TODO: Figure out why
2022-04-21 02:40:02 -03:00
Rekai Nyangadzayi Musuka 2f07c18f0b feat: implement ch3 2022-04-21 00:21:55 -03:00
Rekai Nyangadzayi Musuka ed3d275974 feat: implement ch2 2022-04-20 21:33:46 -03:00
Rekai Nyangadzayi Musuka 0184ec3e5e feat: implement ch1
TODO: It's really loud
2022-04-20 20:52:50 -03:00
Rekai Nyangadzayi Musuka 97a689ab55 chore: broken impl of ch1 2022-04-20 09:39:12 -03:00
Rekai Nyangadzayi Musuka c3611a0f00 feat: add audio resampler
Also implement extremely naive audio sync
2022-04-20 06:27:06 -03:00
Rekai Nyangadzayi Musuka d270ec711f chore: calculate apu sample rate a bit better 2022-04-20 02:36:32 -03:00
Rekai Nyangadzayi Musuka 172a59aefb feat: schedule audio sampling on scheduler
DMA sound in games like Pokemon Emerald, Chobits, Love Hina, and Kirby:
Nightmare in Dream Land sound great save for conerns about resampling
2022-04-14 05:58:32 -03:00
Rekai Nyangadzayi Musuka 92cabd248b chore: improve timer behaviour 2022-04-14 01:58:40 -03:00
Rekai Nyangadzayi Musuka 6b09250a56 chore: move some init code to functions 2022-04-14 00:52:21 -03:00
Rekai Nyangadzayi Musuka f6d746e810 feat: impelemt THUMB open bus 2022-04-14 00:21:49 -03:00
Rekai Nyangadzayi Musuka 9b9b6c0d6f feat: implement ARM read open bus 2022-04-13 23:28:14 -03:00
Rekai Nyangadzayi Musuka 6d5c30ac25 fix: remove accidental rotation in ldrsh instructions 2022-04-13 22:59:32 -03:00
Rekai Nyangadzayi Musuka c1b74d556a chore: move log statement 2022-04-13 21:45:15 -03:00
Rekai Nyangadzayi Musuka dfe94fb931 chore: remove magic numbers 2022-04-13 21:39:35 -03:00
Rekai Nyangadzayi Musuka ffbb31c767 chore: remove unnecessary 32MB allocation 2022-04-13 21:25:41 -03:00
Rekai Nyangadzayi Musuka 714209565b chore: define more I/O read/writes 2022-04-12 00:50:44 -03:00
Rekai Nyangadzayi Musuka 2c763e9772 feat: pass jsmolka memory.gba 2022-04-11 22:52:17 -03:00
Rekai Nyangadzayi Musuka ad1f5ea8b8 chore: ignore instead of logging errors for perf reasons 2022-04-10 23:10:06 -03:00
Rekai Nyangadzayi Musuka 76b4d56ca6 feat: Initial Implementation of DMA Audio 2022-04-10 04:50:09 -03:00
Rekai Nyangadzayi Musuka c100d64fcb chore: tick scheduler on memory access 2022-04-09 19:43:27 -03:00
Rekai Nyangadzayi Musuka 5da84aff36 chore: log error on open bus in page 0x00 and 0x01 2022-04-09 18:01:17 -03:00
Rekai Nyangadzayi Musuka 76789aa8bc chore: rewrite I/O read/writes 2022-04-08 17:07:36 -03:00
Rekai Nyangadzayi Musuka 80e714e2eb chore: reimplement bus read/writes 2022-04-08 16:48:43 -03:00
Rekai Nyangadzayi Musuka 37a360ec07 fix: force align reads/writes in memory bus rather than in CPU 2022-04-08 15:17:31 -03:00
Rekai Nyangadzayi Musuka a976a5769e fix: pass none.gba and kind of sram.gba from jsmolka test suite 2022-04-08 14:38:35 -03:00
Rekai Nyangadzayi Musuka 6df55c2d86 feat: implement GamePak out-of-bounds reads 2022-04-08 02:34:08 -03:00
Rekai Nyangadzayi Musuka a1008738d2 chore: run zigfmt 2022-04-08 02:13:58 -03:00
Rekai Nyangadzayi Musuka 11a034658a chore: change implementation of rotr 2022-04-08 02:13:41 -03:00
Rekai Nyangadzayi Musuka aac01b0bfe chore: rewrite read/write methods for remainig Bus devices 2022-04-08 02:08:26 -03:00
Rekai Nyangadzayi Musuka 5310c12669 chore: mirror VRAM 2022-04-08 01:10:12 -03:00
Rekai Nyangadzayi Musuka 9b9de11e0c chore: write generic read/write for VRAM 2022-04-08 00:44:52 -03:00
Rekai Nyangadzayi Musuka f8018854be Merge branch 'main' of ssh://musuka.dev:2222/paoda/zba 2022-04-07 17:23:22 -03:00
Rekai Nyangadzayi Musuka fae4b430ab chore: update dependencies 2022-04-07 17:23:07 -03:00
Rekai Nyangadzayi Musuka 3046e6243a chore: don't assume 1cpi when stepping by a frame 2022-03-29 09:06:26 -03:00
Rekai Nyangadzayi Musuka e127669549 Revert "chore: tick on memory access instead of 1cpi"
This reverts commit 7f555095f2.
2022-03-29 08:58:57 -03:00
Rekai Nyangadzayi Musuka 7f555095f2 chore: tick on memory access instead of 1cpi 2022-03-29 08:50:12 -03:00
Rekai Nyangadzayi Musuka 29da7b294e feat: implement Flash backup cartrige kinds 2022-03-28 19:41:22 -03:00
Rekai Nyangadzayi Musuka bf7b533b3c chore: stub more apu I/O addresses 2022-03-28 19:40:47 -03:00
Rekai Nyangadzayi Musuka 37c039fb92 fix: don't create un-needed save file
If we don't know if we support a game's save type yet, avoid
creating a file for it.
2022-03-22 15:03:05 -03:00
Rekai Nyangadzayi Musuka 4c172cff70 fix: account for subset of disallowed chars in save file names 2022-03-22 14:55:08 -03:00
Rekai Nyangadzayi Musuka bd54cba8a0 feat: implement SRAM saving and loading 2022-03-22 14:41:18 -03:00
Rekai Nyangadzayi Musuka da4bb17782 chore: properly deallocate OAM buffer 2022-03-22 11:41:17 -03:00
Rekai Nyangadzayi Musuka 5dd69500ca fix: speed percentage in title is now accurate
We now properly account for full speed being 59.97Hz not, 59Hz or 60Hz
2022-03-22 10:39:42 -03:00
Rekai Nyangadzayi Musuka eff25a0ab2 chore: make some variables const 2022-03-19 02:00:53 -03:00
Rekai Nyangadzayi Musuka 1901a471e4 feat: minor performance improvements 2022-03-18 09:49:49 -03:00
Rekai Nyangadzayi Musuka 3d61c0dba4 feat: switch from BGR555 to RGBA8888 2022-03-18 07:52:54 -03:00
Rekai Nyangadzayi Musuka 39ab363afa fix: improve perf of instructions w/ rotr 2022-03-16 22:56:37 -03:00
Rekai Nyangadzayi Musuka 1921218c7b fix: improve frame limiting and fps counting 2022-03-16 21:25:32 -03:00
Rekai Nyangadzayi Musuka 40968f0990 fix: implement proper SRAM mirroring and stub Flash 2022-03-15 21:54:55 -03:00
Rekai Nyangadzayi Musuka 04d54ec97a chore: move DMA and Timers from io to bus 2022-03-15 08:25:26 -03:00
Rekai Nyangadzayi Musuka 1fd80c1c23 feat: define APU registers 2022-03-15 08:09:07 -03:00
Rekai Nyangadzayi Musuka 48679fa4ca fix: move code in scheduler to ppu 2022-03-15 08:09:07 -03:00
Rekai Nyangadzayi Musuka bdea19f280 chore: create different types of emuloops 2022-03-15 03:46:33 -03:00
Rekai Nyangadzayi Musuka 5579643d65 fix: resolve relative sprite priority issues 2022-03-15 00:37:29 -03:00
Rekai Nyangadzayi Musuka c6e6b42869 chore: improve accuracy of frame limiter 2022-03-14 20:38:29 -03:00
Rekai Nyangadzayi Musuka 3623362f72 chore: improve accuracy of thread sleep in emu thread 2022-03-14 08:54:48 -03:00
Rekai Nyangadzayi Musuka c538079ad4 feat: implement video sync 2022-03-14 05:16:02 -03:00
Rekai Nyangadzayi Musuka 8e3f48837d chore: organize io switch statements 2022-03-13 07:50:19 -03:00
Rekai Nyangadzayi Musuka 025f295c08 fix: mirror SRAM
SRAM is mirrored in 64K chunks
TODO: According to GBATEK SRAM chips are 32K and mirrored
2022-03-13 05:53:32 -03:00
Rekai Nyangadzayi Musuka 017ec407f5 chore: don't panic on unknown bus and io writes/reads
This will lead to emulation bugs due to devices I've yet to implement but by
doing this a lot of games become playable "by default" such as Doom or
Kirby: Nightmare in Dream Land.

When implementing feature and/or debuggin make sure to set:
panic_on_und_bus and panic_on_und_io to true so that the emu crashes
on unknown reads/writes
2022-03-13 05:39:09 -03:00
Rekai Nyangadzayi Musuka 4a76611fca feat: implement Timers 2022-03-13 05:35:01 -03:00
Rekai Nyangadzayi Musuka cb10dfbdfd fix: implement sprite coord overflow behaviour 2022-03-12 03:46:41 -04:00
Rekai Nyangadzayi Musuka 0c50ef1e6d fix: resolve issues with sprite mirroring 2022-03-11 23:52:56 -04:00
Rekai Nyangadzayi Musuka 05e67da181 feat: Implement MVP of Mode 0 Sprites 2022-03-11 01:43:47 -04:00
Rekai Nyangadzayi Musuka f1df3d6615 chore: clean up io 2022-03-04 22:55:04 -04:00
Rekai Nyangadzayi Musuka c5b4b51ae0 feat: fix tile flipping issue 2022-03-03 03:08:35 -04:00
Rekai Nyangadzayi Musuka 2e4854c2ff chore: add some type definitions for sprites 2022-03-03 02:10:33 -04:00
Rekai Nyangadzayi Musuka 85f0b13f4a feat: improve DMA Transfer support 2022-03-03 02:10:29 -04:00
Rekai Nyangadzayi Musuka dccd00782b chore(ppu): resolve integer overflow regression 2022-03-02 23:15:10 -04:00
Rekai Nyangadzayi Musuka 3d8c944bcc feat(ppu): implement bg priority and transparency 2022-03-02 01:39:05 -04:00
Rekai Nyangadzayi Musuka cb4d3a9a51 chore: replace unnecessarily complex sign extension implementation 2022-02-28 20:38:50 -04:00
Rekai Nyangadzayi Musuka ddb68a7952 feat: pass beeg yoshi 2022-02-28 18:24:24 -04:00
Rekai Nyangadzayi Musuka 97de5d1a96 fix: palette id is a u16 not a u8 2022-02-28 17:32:10 -04:00
Rekai Nyangadzayi Musuka d6ef53fd67 feat: DMA Transfer MVP 2022-02-28 12:34:00 -06:00
Rekai Nyangadzayi Musuka b65f833b28 feat(ppu): implement transparency + backdrop in mode 0 2022-02-26 18:33:16 -06:00
Rekai Nyangadzayi Musuka ac0486be1b chore(io): replace some bitfields with enums 2022-02-24 17:20:23 -06:00
Rekai Nyangadzayi Musuka 441ebc38c7 fix: better emulate behaviour of IO reads 2022-02-24 17:20:20 -06:00
Rekai Nyangadzayi Musuka be2dfb379a chore: document select unimplmented I/O registers
These registers are written to / read from Kirby: Nightmare in Dream Land
2022-02-22 17:14:30 -06:00
Rekai Nyangadzayi Musuka bc66be6c06 feat: impelement a barebones SRAM 2022-02-22 17:14:26 -06:00