Commit Graph

435 Commits

Author SHA1 Message Date
Rekai Nyangadzayi Musuka 5d6df46a2d fix(cpu): reimplement instruction handling
continuous-integration/drone/push Build is passing Details
2021-08-14 17:23:45 -05:00
Rekai Nyangadzayi Musuka 7e65d82fef chore(cpu): document fetch, decode, execute 2021-08-14 16:42:38 -05:00
Rekai Nyangadzayi Musuka 8c9567b610 chore(cpu): rename discriminants of ImeState enum 2021-08-14 16:42:15 -05:00
Rekai Nyangadzayi Musuka 53dfaf0de2 fix(apu): increase size of the audio buffer
continuous-integration/drone/push Build is passing Details
2021-08-14 15:29:35 -05:00
Rekai Nyangadzayi Musuka 16c2dd81fc fix(bus): remove dead code 2021-08-14 15:02:25 -05:00
Rekai Nyangadzayi Musuka 79be38a1e6 fix(main): rename constant SCALE to WINDOW_SCALE
continuous-integration/drone/push Build is passing Details
2021-08-14 01:02:18 -05:00
Rekai Nyangadzayi Musuka 8625bec059 feat: clock bus on instruction read-write
continuous-integration/drone/push Build is failing Details
Commit also includes general work towards passing mem-timings.

Note: while cpu_instrs.gb passes, instr_timing.gb and mem_timing.gb both
are stuck in infinite loops (Currently, it seems like a timing issue).
This is a major regression that hopefully shouldn't last for too long.
2021-08-14 00:10:51 -05:00
Rekai Nyangadzayi Musuka 0637b771e3 chore(instr): implement copy and clone on instruction enum
continuous-integration/drone/push Build is failing Details
2021-08-05 20:04:39 -05:00
Rekai Nyangadzayi Musuka 0107fa04c9 chore(apu): remove implemtation of register that always returns 0xFF 2021-08-05 16:39:04 -05:00
Rekai Nyangadzayi Musuka 6265c8af04 chore(joypad): poll input every frame instead of every instruction
continuous-integration/drone/push Build is failing Details
2021-08-03 20:36:55 -05:00
Rekai Nyangadzayi Musuka 5482a8e75f fix(apu): fix out of bounds error with channel 3 wave ram 2021-08-03 20:35:22 -05:00
Rekai Nyangadzayi Musuka 002dae6826 fix(joypad): improve handling of keyboard input 2021-08-03 20:23:43 -05:00
Rekai Nyangadzayi Musuka c863dc835c fix(apu): fix index out of bounds error on channel 3 write 2021-08-03 20:23:08 -05:00
Rekai Nyangadzayi Musuka d4407cf849 fix(apu): implement NR50 volume controls 2021-08-03 19:33:27 -05:00
Rekai Nyangadzayi Musuka de0d147685 fix(cartridge): put a bit more detail into the MBC3 RTC stub
continuous-integration/drone/push Build is failing Details
2021-08-03 15:19:08 -05:00
Rekai Nyangadzayi Musuka dd8339e8de chore(cartridge): consistently capitalize MBC 2021-08-03 15:06:06 -05:00
Rekai Nyangadzayi Musuka 05d6475015 fix(cartridge): Use default title instead of empty string 2021-08-03 14:53:30 -05:00
Rekai Nyangadzayi Musuka 32b597a328 fix(apu): incremental improvements to APU accuracy
continuous-integration/drone/push Build is failing Details
2021-08-03 14:10:08 -05:00
Rekai Nyangadzayi Musuka 33be2e0e83 fix(main): tie emulation to 60Hz on host machine 2021-08-03 14:09:16 -05:00
Rekai Nyangadzayi Musuka 832e1b7633 fix(apu): implement WAVE RAM blocking 2021-08-02 22:38:00 -05:00
Rekai Nyangadzayi Musuka a549b9feef chore(bus): suppress warning 2021-08-02 21:55:07 -05:00
Rekai Nyangadzayi Musuka 4d6fc95130 chore: remove premature optimizations 2021-08-02 21:52:12 -05:00
Rekai Nyangadzayi Musuka 7112cd15e3 chore(cpu): refactor SM83 implementation
continuous-integration/drone/push Build is passing Details
Instruction::decode no longer requires mutable access to the CPU
2021-07-31 20:29:13 -05:00
Rekai Nyangadzayi Musuka 2af673d7c5 chore: remove various warnings
continuous-integration/drone/push Build is passing Details
2021-07-28 16:25:29 -05:00
Rekai Nyangadzayi Musuka e43cac8041 fix(apu): don't spin if ringbuf is full 2021-07-28 16:23:31 -05:00
Rekai Nyangadzayi Musuka 8724da824e chore: inline some methods 2021-07-28 14:53:52 -05:00
Rekai Nyangadzayi Musuka 903cfacad3 fix(apu): replace mpsc with spsc ringbuffer
continuous-integration/drone/push Build is passing Details
2021-07-28 02:01:04 -05:00
Rekai Nyangadzayi Musuka 9d0e099a97 chore: remove unnecessary derivations from structs 2021-07-28 00:09:07 -05:00
Rekai Nyangadzayi Musuka 1a4546f4a4 chore: remove egui from project
I want to re-implement this later.
2021-07-27 22:38:21 -05:00
Rekai Nyangadzayi Musuka 31abd6dc5c chore(apu): change default sample rate
continuous-integration/drone/push Build is passing Details
2021-07-25 18:29:19 -05:00
Rekai Nyangadzayi Musuka c7e3cb5b35 fix(apu): abstract Apu read/write using BusIO trait
continuous-integration/drone/push Build is passing Details
2021-07-25 18:19:27 -05:00
Rekai Nyangadzayi Musuka e4d77d66ba fix(apu): abstract wave RAM behind BusIO trait 2021-07-25 18:03:11 -05:00
Rekai Nyangadzayi Musuka 9e36e86c14 fix(apu): increase accuracy of apu
continuous-integration/drone/push Build is passing Details
Due to this, not all instruments work. This is a regression and will be
fixed in a later commit when presumably the implementation of the APU is
a bit more correct
2021-07-25 17:42:09 -05:00
Rekai Nyangadzayi Musuka 6f6c308d84 fix(apu): implement write guards for Ch1 & Ch1 when disabled 2021-07-18 22:10:32 -05:00
Rekai Nyangadzayi Musuka f429d72882 chore(bus): remove panics in IO bus read/write failures with stderr msgs 2021-07-18 21:52:22 -05:00
Rekai Nyangadzayi Musuka 4fda7587ce chore(main): disable vsync 2021-07-18 21:33:52 -05:00
Rekai Nyangadzayi Musuka 3fb182b9cb fix(apu): have send_samples block main thraed
continuous-integration/drone/push Build is passing Details
2021-07-18 21:18:04 -05:00
Rekai Nyangadzayi Musuka c1430594cf chore(apu): change access modifiers of some methods 2021-07-18 20:58:02 -05:00
Rekai Nyangadzayi Musuka 8e2ef58b81 chore(main): remove rodio sink 2021-07-18 20:42:36 -05:00
Rekai Nyangadzayi Musuka b4b84d0cc5 fix(main): Allow emu to work on windows and linux
continuous-integration/drone/push Build is passing Details
2021-07-16 21:07:00 -05:00
Rekai Nyangadzayi Musuka 1d8fb8d32a fix(ppu): delay ppu by one cycle on scx fifo discard
continuous-integration/drone/push Build is passing Details
2021-07-16 21:01:52 -05:00
Rekai Nyangadzayi Musuka cc0cb0dd8a chore(apu): satisfy clippy
continuous-integration/drone/push Build is passing Details
2021-07-15 22:58:23 -05:00
Rekai Nyangadzayi Musuka fd9a5b51ba chore(ppu): reimplement background/window/sprite priority 2021-07-15 22:29:51 -05:00
Rekai Nyangadzayi Musuka a1eadc0bc4 chore(apu): rename sound/snd to apu
continuous-integration/drone/push Build is passing Details
2021-07-14 23:45:01 -05:00
Rekai Nyangadzayi Musuka ea53f97312 chore(snd): refactor APU implementation 2021-07-14 23:34:00 -05:00
Rekai Nyangadzayi Musuka 08bd33b4d4 fix(snd): replace Audio Sync solution with a faster one
continuous-integration/drone/push Build is passing Details
2021-07-14 22:35:37 -05:00
Rekai Nyangadzayi Musuka 2b5926e533 chore(snd): Make AudioReceiver and AudioSender structs generic 2021-07-14 22:34:57 -05:00
Rekai Nyangadzayi Musuka 1e27875dc3 fix(cpu): fix timing issue involving when the bus is clocked 2021-07-14 21:15:52 -05:00
Rekai Nyangadzayi Musuka 1566d60fd4 fix(ppu): add fifo delay when BG fifo is not empty 2021-07-14 21:11:31 -05:00
Rekai Nyangadzayi Musuka ab99e24f64 chore: modify commented out debug statement 2021-07-14 21:10:44 -05:00
Rekai Nyangadzayi Musuka 192bdffd64 fix(ppu): PPU cycle count increases even if LCDC bit 7 says otherwise
continuous-integration/drone/push Build is passing Details
2021-07-12 21:32:50 -05:00
Rekai Nyangadzayi Musuka afdfcfce2c chore: add _debug_log function to cpu.rs 2021-07-12 21:08:38 -05:00
Rekai Nyangadzayi Musuka 44b605970f chore(snd): rename some structs 2021-07-12 10:03:45 -05:00
Rekai Nyangadzayi Musuka b13444c885 feat(snd): simplify audio buffer
continuous-integration/drone/push Build is passing Details
The audio buffer now is held by crossbeam. The developers of said
library could write a batter queue than I could anyday
2021-07-11 23:48:16 -05:00
Rekai Nyangadzayi Musuka 3754325e30 chore(cartridge): silence warning 2021-07-11 23:47:05 -05:00
Rekai Nyangadzayi Musuka 3b772c7c49 feat(snd): synchronize audio with rest of system
In it's current form I think this is actually rather inefficient. It's
also not very accurate since I throw away a lot of samples for no real
good reason. More improvements to thiss will be coming henceforth
2021-07-11 23:22:17 -05:00
Rekai Nyangadzayi Musuka 45dc27301c chore: enable/disable gamepad input at compile time 2021-07-11 15:45:37 -05:00
Rekai Nyangadzayi Musuka db421c58f8 chore(snd): Don't repeat yourself
continuous-integration/drone/push Build is passing Details
2021-07-11 13:15:55 -05:00
Rekai Nyangadzayi Musuka ce6a83425f feat(snd): implement channel 3 2021-07-11 00:16:25 -05:00
Rekai Nyangadzayi Musuka d145ae44f3 feat(snd): implement channel 4 2021-07-10 22:36:48 -05:00
Rekai Nyangadzayi Musuka 3dbf026d33 fix(snd): increase accuracy of when to sample from APU 2021-07-10 22:35:54 -05:00
Rekai Nyangadzayi Musuka 7ab6e120f9 feat(snd): implement ch1 & envelopes for ch1 and ch2 2021-07-10 18:56:54 -05:00
Rekai Nyangadzayi Musuka 3c28dd7a6b fix(snd): clock channel 2 every T-cycle 2021-07-10 14:00:22 -05:00
Rekai Nyangadzayi Musuka 91d19a7e66 chore(snd): mask unreadable bits from return values 2021-07-09 21:16:33 -05:00
Rekai Nyangadzayi Musuka 40ca0abb72 feat: implement keyboard controls 2021-07-09 19:19:52 -05:00
Rekai Nyangadzayi Musuka 548f3867d4 chore(main): remove windows-specific code 2021-07-09 17:25:38 -05:00
Rekai Nyangadzayi Musuka ce630baa5d feat(snd): implement audio playback using rodio
continuous-integration/drone/push Build is failing Details
2021-07-09 01:25:52 -05:00
Rekai Nyangadzayi Musuka 0fa818a1a6 chore(snd): reimplement NR52 & implement sampling for ch2
Also add rodio as dependency for audio
2021-07-08 22:36:28 -05:00
Rekai Nyangadzayi Musuka 9b3a5d49d2 chore: update error messages in expect() calls 2021-07-08 18:50:58 -05:00
Rekai Nyangadzayi Musuka 4f3fc3136d chore: print cartridge info in stderr
continuous-integration/drone/push Build is passing Details
2021-07-05 01:10:10 -05:00
Rekai Nyangadzayi Musuka 48e81ff426 fix(cartridge): fix bug preventing MBC1 from working
continuous-integration/drone/push Build is passing Details
2021-07-05 00:43:02 -05:00
Rekai Nyangadzayi Musuka 18b790a777 chore(cartridge): update MBC1 (still broken)
continuous-integration/drone/push Build is passing Details
2021-07-05 00:14:56 -05:00
Rekai Nyangadzayi Musuka 39af03aebf chore(bus): stub 0xFF4D 2021-07-01 23:09:02 -05:00
Rekai Nyangadzayi Musuka 559cb54385 chore(snd): add enabled property to all channels
Also, rename lsfr property to shift_register
2021-07-01 22:27:42 -05:00
Rekai Nyangadzayi Musuka fd7f0655ef chore: satisfy clippy 2021-06-27 20:31:59 -05:00
Rekai Nyangadzayi Musuka fc4a898177 chore: reorganize select parts of codebase 2021-06-27 20:28:29 -05:00
Rekai Nyangadzayi Musuka c5aafab3ef feat(snd): implement trigger event behaviour for lfsr 2021-06-24 01:28:00 -05:00
Rekai Nyangadzayi Musuka 278953ab78 chore(snd): implement shift amount for channel 3 volume 2021-06-24 01:13:58 -05:00
Rekai Nyangadzayi Musuka 67e2a6ad79 feat(snd): implement ch 1,2,3 and 4 length function 2021-06-24 01:00:07 -05:00
Rekai Nyangadzayi Musuka b8b3563bca chore(snd): tighten use of access modifiers 2021-06-24 00:40:10 -05:00
Rekai Nyangadzayi Musuka 249d96b443 chore(snd): update select bitfield names 2021-06-24 00:00:28 -05:00
Rekai Nyangadzayi Musuka d2e37da2b0 feat(snd): implement sweep behaviour 2021-06-23 23:51:30 -05:00
Rekai Nyangadzayi Musuka 29237f0a2c chore(timer): clean up if let statement 2021-06-23 21:49:46 -05:00
Rekai Nyangadzayi Musuka 0c843b9ca9 feat(snd): implement volume envelope in ch1, 2 and 4 2021-06-23 21:49:25 -05:00
Rekai Nyangadzayi Musuka 1bc5de7cff chore(cartridge): incremental improvements to MBC1 2021-06-23 17:12:54 -05:00
Rekai Nyangadzayi Musuka b89515a0c1 fix(ppu): calculating window position is now signed
This allows for the window to display properly in Link's Awakening
2021-06-17 18:48:04 -05:00
Rekai Nyangadzayi Musuka 0b50e4eae9 fix(ppu): implement slightly better SCX discarding 2021-06-17 18:29:22 -05:00
Rekai Nyangadzayi Musuka aa0e3399f6 chore(ppu): fix integer overflow 2021-06-17 17:43:04 -05:00
Rekai Nyangadzayi Musuka d9db3e404f fix(ppu): stub IO address 0xFF7F
Tetris now runs without requiring any local modifications
2021-06-15 01:19:40 -05:00
Rekai Nyangadzayi Musuka fe8598fd61 feat(snd): implement ch4 2021-06-15 01:11:18 -05:00
Rekai Nyangadzayi Musuka 5b041d4713 chore(bus): rename sound property to snd 2021-06-15 00:30:08 -05:00
Rekai Nyangadzayi Musuka 909972d36e feat(snd): implement channel 3 2021-06-15 00:29:31 -05:00
Rekai Nyangadzayi Musuka e45c13f719 feat(sound): implement NR10 2021-06-14 23:51:37 -05:00
Rekai Nyangadzayi Musuka 6a7ff66274 chore(sound): implement channel 2 registers 2021-06-14 23:37:30 -05:00
Rekai Nyangadzayi Musuka 8149352e63 fix(ppu): Discard SCX mod 8 pixels from fifo
As of right now, the implementation of this is rudimentary. There are
currently some visual bugs that still need to get worked out
2021-06-12 13:42:57 -05:00
Rekai Nyangadzayi Musuka daeb02f7c9 fix(ppu): DMA takes priority over OAM Scan 2021-06-12 13:41:27 -05:00
Rekai Nyangadzayi Musuka 0c22509d24 chore(cartridge): impelement MBC3 2021-06-10 16:57:40 -05:00
Rekai Nyangadzayi Musuka 482d226cd6 fix(ppu): properly implement $8800 addressing mode 2021-06-10 00:37:49 -05:00
Rekai Nyangadzayi Musuka 17024c439a chore(ppu): emu now properly handles VRAM and OAM write guards 2021-06-09 22:04:06 -05:00
Rekai Nyangadzayi Musuka 2b7958f5f3 chore(bus): add a select few read/write guards 2021-06-09 20:48:31 -05:00
Rekai Nyangadzayi Musuka 50efe12aec chore: change how bus components are clocked 2021-06-09 19:41:10 -05:00
Rekai Nyangadzayi Musuka aa4a898a6b fix: resolve type issue with debug feature enabled 2021-06-09 13:45:12 -05:00
Rekai Nyangadzayi Musuka a904503b90 chore: document IO registers 2021-06-09 13:43:46 -05:00
Rekai Nyangadzayi Musuka 1449ed3765 fix(joypad): reimplement joypad 2021-06-07 17:23:48 -05:00
Rekai Nyangadzayi Musuka 83994e6adc chore(gui): add two windows to top menu 2021-06-07 17:05:55 -05:00
Rekai Nyangadzayi Musuka dd86330e1d fix(bus): Fix address calculation error in Echo RAM 2021-06-07 00:22:11 -05:00
Rekai Nyangadzayi Musuka d5e67568dd chore(bus): temporarily disable VRAM and OAM gates
There appears to be severe timing issues in the ppu which result in
regressions with these gates enabled. They are commented out for now,
but will be re-enabled once the timing issues in the PPU are fixed
2021-06-07 00:01:40 -05:00
Rekai Nyangadzayi Musuka e8e6c41dbe fix(dma): initial version of dma transfer now works 2021-06-06 23:57:54 -05:00
Rekai Nyangadzayi Musuka d623800005 fix: apply clippy suggestions 2021-06-06 21:30:08 -05:00
Rekai Nyangadzayi Musuka c428e934d8 fix(bus): improve guards for illlegal memory IO 2021-06-06 21:18:19 -05:00
Rekai Nyangadzayi Musuka ef4e54aba6 chore: restrict what should be pub or not 2021-06-06 20:47:11 -05:00
Rekai Nyangadzayi Musuka 878edd4082 chore: replace pub with pub(crate) when possible 2021-06-06 19:14:28 -05:00
Rekai Nyangadzayi Musuka b7b213b6b9 chore(bus): implement read/write blocks when dma is active 2021-06-05 20:53:35 -05:00
Rekai Nyangadzayi Musuka 2e42513d71 chore(cartrige): rewrite error to be more descriptive 2021-06-04 13:47:49 -05:00
Rekai Nyangadzayi Musuka 811a9f9cc9 feat(dma): implement non-working dma transfer 2021-06-04 13:47:06 -05:00
Rekai Nyangadzayi Musuka 778e04e645 feat(ppu): account for OBJ ENABLE bit in LCDC 2021-06-03 02:16:03 -05:00
Rekai Nyangadzayi Musuka aeaaee8c6c fix(ppu): fix bugs in code that grabs sprite tiles
PPU now supports 8x16 tiles
2021-06-03 02:14:59 -05:00
Rekai Nyangadzayi Musuka 138aba52c1 fix(ppu): fix integer overflow error in bg fetcher 2021-06-03 00:41:21 -05:00
Rekai Nyangadzayi Musuka 66c2b51e10 chore(ppu): fix silly spelling mistake 2021-06-03 00:16:25 -05:00
Rekai Nyangadzayi Musuka be39c249e1 chore(ppu): reimplement WindowLineCounter behaviour 2021-06-03 00:13:51 -05:00
Rekai Nyangadzayi Musuka 112454aa59 chore(ppu): reimplement fifo pixel merging logic 2021-06-02 23:32:39 -05:00
Rekai Nyangadzayi Musuka cd21c90722 chore(ppu): rename ppu/registers.rs to ppu/types.rs 2021-06-02 23:31:57 -05:00
Rekai Nyangadzayi Musuka c60bf704ff chore(cpu): Ensure Cycles is the size of an u32 2021-06-02 23:09:45 -05:00
Rekai Nyangadzayi Musuka 50ba300d23 chore(gui): ensure all windows are disabled by default 2021-06-02 23:06:20 -05:00
Rekai Nyangadzayi Musuka 86f3a897f1 feat(egui): add timer window 2021-06-02 02:44:32 -05:00
Rekai Nyangadzayi Musuka b1bf6c5868 feat: integrate eui and pixels-rs for debug info 2021-06-02 01:50:35 -05:00
Rekai Nyangadzayi Musuka 96cf705966 chore: update dependencies 2021-05-31 23:24:20 -05:00
Rekai Nyangadzayi Musuka 9ea26d4a05 chore: improve performance of match statements 2021-05-19 02:52:32 -05:00
Rekai Nyangadzayi Musuka e89e89df5b chore(ppu): refactor small part of bg fetcher 2021-05-08 15:52:43 -05:00
Rekai Nyangadzayi Musuka fd2b64496c chore(ppu): refactor reset behaviour in fetchers
and other components like window_stat and the window line counter
2021-05-08 15:35:16 -05:00
Rekai Nyangadzayi Musuka 705194eced chore(ppu): rename PixelFetcher properties 2021-05-08 15:13:26 -05:00
Rekai Nyangadzayi Musuka 5917ca203f chore(ppu): rename pixel fetcher and background fetcher variables 2021-05-08 14:31:20 -05:00
Rekai Nyangadzayi Musuka 48abc97505 chore(ppu): add bytes() method to Pixels 2021-05-08 14:06:41 -05:00
Rekai Nyangadzayi Musuka a67aec55e2 chore(ppu): rename ppu property 2021-05-05 20:25:15 -05:00
Rekai Nyangadzayi Musuka f6cf5393b6 chore(ppu): fix logic error in shifter 2021-05-05 20:24:09 -05:00
Rekai Nyangadzayi Musuka 6575eb5531 chore(bus): ensure no read-only bits are overwritten by the cpu 2021-05-05 19:23:01 -05:00
Rekai Nyangadzayi Musuka af3edde2ab chore(ppu): rearrange/reimplement some behaviour 2021-05-05 17:47:06 -05:00
Rekai Nyangadzayi Musuka abdff1251e fix: properly implement LY==LYC behaviour 2021-05-05 08:29:39 -05:00
Rekai Nyangadzayi Musuka b36f4441fa chore(ppu): change signature of get_obj_low_addr 2021-05-05 00:14:14 -05:00
Rekai Nyangadzayi Musuka 2cf85b0add fix(ppu): fix off by one error when grabbing sprite address 2021-05-05 00:01:19 -05:00
Rekai Nyangadzayi Musuka b57df3d2a7 chore(ppu): rename Pixel to Pixels
Since the Pixel struct represents 8 pixels in a 2BPP format, I felt like
the name of the type needed to represent this
2021-05-04 22:55:34 -05:00
Rekai Nyangadzayi Musuka 2a7377c724 chore(ppu): reimplement offset calculation for obj fetcher 2021-05-04 22:11:03 -05:00
Rekai Nyangadzayi Musuka 6f919acafb chore(bus): remove 0xFF7F matches from read and write_byte 2021-05-04 21:38:37 -05:00
Rekai Nyangadzayi Musuka 834b1bd9fd chore(cpu): remove branching code in instructions
also, rename a couple of methods
2021-05-04 00:50:22 -05:00
Rekai Nyangadzayi Musuka 5a59c31b72 fix(joypad): fix bug where gameboy overwrites read only bits 2021-05-03 23:37:30 -05:00
Rekai Nyangadzayi Musuka 4abb2833c4 chore: implement gamepad controls 2021-05-03 23:11:39 -05:00
Rekai Nyangadzayi Musuka 1e19854ab0 feat: reimplement joypad status register 2021-05-03 03:27:23 -05:00
Rekai Nyangadzayi Musuka 66414075da fix(ppu): fix bug when loading sprite pixels into FIFO 2021-05-01 16:22:44 -05:00
Rekai Nyangadzayi Musuka b251efcc7d fix(ppu): reimplement the pixel fifo shifter 2021-04-30 17:44:02 -05:00
Rekai Nyangadzayi Musuka 11398303b5 feat(ppu): reimplement window line counter check 2021-04-30 02:10:16 -05:00