Commit Graph

353 Commits

Author SHA1 Message Date
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
Rekai Nyangadzayi Musuka 51252db753 chore(ppu): rename select structs 2021-04-30 00:24:22 -05:00
Rekai Nyangadzayi Musuka 6ffdd92dbb feat(ppu): implement sprite x-flip check 2021-04-30 00:20:50 -05:00
Rekai Nyangadzayi Musuka 3c680dec2f fix(ppu): reimplement OAM scan 2021-04-30 00:09:17 -05:00
Rekai Nyangadzayi Musuka 0672c7346a chore(ppu): rename select method and variables 2021-04-28 19:36:00 -05:00
Rekai Nyangadzayi Musuka 8a06fe9ff8 chore(ppu): improve code quality 2021-04-28 17:59:30 -05:00
Rekai Nyangadzayi Musuka 7620633116 chore(ppu): reimplement background/sprite fetcher state machine 2021-04-27 04:57:00 -05:00
Rekai Nyangadzayi Musuka 9003617459 chore: rename properties in bus.rs 2021-04-27 04:06:08 -05:00
Rekai Nyangadzayi Musuka 9d01b2458d chore: move ppu bitfield structs to separate file 2021-04-27 04:03:50 -05:00
Rekai Nyangadzayi Musuka 1343e8e52e chore(ppu): flatten if statement 2021-04-24 02:14:58 -05:00
Rekai Nyangadzayi Musuka 2586314f9a chore(ppu): implement IntoIterator and iter() for ObjectBuffer 2021-04-24 02:14:50 -05:00
Rekai Nyangadzayi Musuka 067049e2dd chore: rename to_byte_count to as_byte_count
using to_* and not taking ownership of self violates rust conventions
according to clippy.
2021-04-24 02:12:05 -05:00
Rekai Nyangadzayi Musuka e8f6a94fee chore(ppu): reimplement object buffer remove 2021-04-24 01:48:15 -05:00
Rekai Nyangadzayi Musuka 98af1865ee chore(ppu): reimplement the object buffer struct 2021-04-23 23:55:18 -05:00
Rekai Nyangadzayi Musuka 4ab59007f9 chore(cpu): disable logging by default 2021-04-23 23:31:16 -05:00
Rekai Nyangadzayi Musuka 6f4f872765 fix(cpu): pass SLA (HL) and SRA (HL) tests from blargg 2021-04-22 20:38:13 -05:00
Rekai Nyangadzayi Musuka 9bf10f0c7d chore(ppu): improve accuracy of sprite pixel fifo 2021-04-21 00:03:17 -05:00
Rekai Nyangadzayi Musuka d457761c3b chore(ppu): reimplement the object buffer 2021-04-20 23:39:16 -05:00
Rekai Nyangadzayi Musuka f92f4a17e0 chore(ppu): add alternate colour palette 2021-04-20 23:15:54 -05:00
Rekai Nyangadzayi Musuka c90b9ab024 fix(ppu): fix sprite buffer bug
Now, the background renders like it should and some sprites do load,
though they aren't where they're supposed to be
2021-04-20 04:26:28 -05:00
Rekai Nyangadzayi Musuka 4f4c867a63 fix(ppu): ensure better timings for sprite fetcher 2021-04-20 03:14:00 -05:00
Rekai Nyangadzayi Musuka db1b40fe2d fix(ppu): clear oam on hblank 2021-04-20 03:13:40 -05:00
Rekai Nyangadzayi Musuka 0361d04248 feat(ppu): implement broken ppu fifo renderer 2021-04-20 01:27:32 -05:00
Rekai Nyangadzayi Musuka 38460577b9 chore(ppu): move bg fetcher code into fetcher functions 2021-04-18 02:43:34 -05:00
Rekai Nyangadzayi Musuka 2acdaaeec2 chore(ppu): rename types and improve code quality 2021-04-18 01:45:09 -05:00
Rekai Nyangadzayi Musuka b43c8ac7c9 feat(cartridge): grab title from the ROM 2021-04-14 01:21:45 -05:00
Rekai Nyangadzayi Musuka cbd085c25b chore: use Default::default instead of Type::Default 2021-04-13 23:02:13 -05:00
Rekai Nyangadzayi Musuka e9f129dbee fix(ppu): move frame/pixel buffer from the stack to the heap 2021-04-13 22:55:11 -05:00
Rekai Nyangadzayi Musuka 12a51b115a feat(ppu): reimplement ppu as fifo pixel renderer 2021-04-11 02:07:25 -05:00
Rekai Nyangadzayi Musuka 5931fe95e3 feat(ppu): implement (broken) sprite renderer 2021-04-09 00:35:41 -05:00
Rekai Nyangadzayi Musuka 7425384fb1 chore: convert select base 10 constants to base 16 2021-04-08 20:32:32 -05:00
Rekai Nyangadzayi Musuka 770b081f98 feat(ppu): stub sprite attribute table 2021-04-08 20:28:30 -05:00
Rekai Nyangadzayi Musuka 23de87e482 chore: remove panics when gameboy performs certain actions 2021-04-08 19:23:29 -05:00
Rekai Nyangadzayi Musuka 41081e9cce feat(bus): implement echo RAM 2021-04-08 17:58:33 -05:00
Rekai Nyangadzayi Musuka 2733bbe6d7 feat(ppu): implement window rendering 2021-04-08 17:10:24 -05:00
Rekai Nyangadzayi Musuka e2fa72aa0e chore: remove unecessary eprintln! statements 2021-04-08 00:02:54 -05:00
Rekai Nyangadzayi Musuka cf3b79f0dc chore(cpu): move RST behaviour to a method 2021-04-07 23:05:22 -05:00
Rekai Nyangadzayi Musuka 0eb40a8109 feat: comply with the fourth individual blargg test rom 2021-04-07 22:37:33 -05:00
Rekai Nyangadzayi Musuka 067ed03de3 feat: comply with test 03 of blargg's cpu_instrs test rom 2021-04-07 20:12:05 -05:00
Rekai Nyangadzayi Musuka 6db132ad48 feat(cartridge): handle MBC-less games like tetris
TODO: This will panic whenever a write is attempted on the MBC-less
cartridge. This would be fine if games held the implicit rules given by
the hardware, however this is not the case. We will have to modify the
NoMBC implementation to ignore writes to the cartrige (while still
documenting them just in case of bugs)
2021-04-05 01:43:26 -05:00
Rekai Nyangadzayi Musuka 823e4b1e0a chore: follow rust style guides 2021-04-05 01:40:26 -05:00
Rekai Nyangadzayi Musuka 9b77d6c6c3 fix(cpu): ensure that timer, lcd and sound runs regardless of HALT 2021-04-05 01:20:18 -05:00
Rekai Nyangadzayi Musuka 9d2fbd2427 chore: remove unecessary print statements 2021-04-05 01:20:03 -05:00
Rekai Nyangadzayi Musuka 748c32c446 fix(cpu): use enums only of maintaining IME register state 2021-04-05 01:10:03 -05:00
Rekai Nyangadzayi Musuka 77c7c610d0 chore(cpu): rename ImeSet to ImeEnabled 2021-04-05 00:53:46 -05:00
Rekai Nyangadzayi Musuka a15a6a25b6 feat(cpu): properly implement EI instruction 2021-04-05 00:52:12 -05:00
Rekai Nyangadzayi Musuka 62bd88945f chore: rename a couple of interrupt instances to "int" instead of
"interrupt"
2021-04-04 01:52:53 -05:00
Rekai Nyangadzayi Musuka 7c9bff61f6 fix(ppu): add missing check for enabled interrupt 2021-04-04 01:50:49 -05:00
Rekai Nyangadzayi Musuka 777abd1c10 chore: rename some symbols 2021-04-04 01:31:31 -05:00
Rekai Nyangadzayi Musuka 4dd7a0d9ce chore: fix several clippy warnings 2021-04-04 01:19:39 -05:00
Rekai Nyangadzayi Musuka cb1bcdb859 feat(cpu): implement DAA instruction 2021-04-04 01:03:44 -05:00
Rekai Nyangadzayi Musuka 25e44f3e49 chore: fix condition when logs are printed 2021-03-27 15:07:17 -05:00
Rekai Nyangadzayi Musuka 2b05571c49 chore: rename Cycles newtype to Cycle 2021-03-27 12:10:18 -05:00
Rekai Nyangadzayi Musuka bce14348f8 feat: enable halt and rework timer registers 2021-03-27 11:56:47 -05:00
Rekai Nyangadzayi Musuka 2bf877d1ec fix(cpu): Ensure mask the high bits of the flag register
There was a bug where POP AF returned 0x1301. In this example, the A
register would be set to 0x13, and the Flag register woud be set to
0x01, which is an invalid state considering only bits 4 -> 7 of the flag
register are used. This commit masks the flag register with & 0xF0
whenever it is read or written to so that we can ensure that only the
high bits can ever be potentially set
2021-03-26 20:25:30 -05:00
Rekai Nyangadzayi Musuka 15781b3d5a fix(instructions): correct the flags being set in ADD HL, r16 2021-03-26 20:19:48 -05:00
Rekai Nyangadzayi Musuka a6d5553035 fix(cartridge): reimplement apply_rom_size_bitmask 2021-03-26 20:18:49 -05:00
Rekai Nyangadzayi Musuka a82e3d3372 feat: implement HALT behaviour
note: while the logic is there, the instruction currently does not do
anything because we don't halde it in Cpu::step(). The code that does is
currently commented out and there should be some underlying bugs still
present. Nevertheless it is a good start
2021-03-23 23:05:27 -05:00
Rekai Nyangadzayi Musuka c16f318fd1 fix: remove unnecessary allocation when loading boot rom 2021-03-23 21:21:18 -05:00
Rekai Nyangadzayi Musuka 48ac8317a8 fix(bus): fix off by one error when reading from boot rom 2021-03-23 21:01:33 -05:00
Rekai Nyangadzayi Musuka e5fb07c4d1 chore: refactor parts of instruction.rs 2021-03-23 20:22:11 -05:00
Rekai Nyangadzayi Musuka 501d93c37b chore: clean up code in one instruction 2021-03-23 18:21:59 -05:00
Rekai Nyangadzayi Musuka 1b7d778c1d chore: clean up some instruction code 2021-03-23 02:11:40 -05:00
Rekai Nyangadzayi Musuka 6f11640f24 chore: replace CALL instruction with RST in interrupt handler 2021-03-23 02:11:06 -05:00
Rekai Nyangadzayi Musuka 342e6616ac chore: improve unreachable! and panic! error messages 2021-03-22 22:33:56 -05:00
Rekai Nyangadzayi Musuka 2813b762dd chore: replace select unreachable! macros with todo! and unreachable! 2021-03-22 21:52:28 -05:00
Rekai Nyangadzayi Musuka 9301a36682 chore: remove all unwraps from the project 2021-03-22 21:48:12 -05:00
Rekai Nyangadzayi Musuka 45466a5733 feat: implement clap for cli and improve error messages 2021-03-22 21:41:22 -05:00
Rekai Nyangadzayi Musuka d7d9fd857f fix: squash bugs in cpu intrucion implementation 2021-03-21 21:16:23 -05:00
Rekai Nyangadzayi Musuka 8a1540c9e9 fix: replaced unnecessary &mut self with &self 2021-03-21 19:56:38 -05:00
Rekai Nyangadzayi Musuka dc45688e4f feat: implement timers 2021-03-21 03:03:03 -05:00
Rekai Nyangadzayi Musuka 4db6f1de6e chore: move LR35902_CLOCK_SPEED to lib.rs 2021-03-21 02:10:56 -05:00
Rekai Nyangadzayi Musuka b548610fdb chore: re-enable scrolling 2021-03-21 02:08:29 -05:00
Rekai Nyangadzayi Musuka fe586d77ac feat: stub 0xFF05 2021-03-21 02:01:19 -05:00
Rekai Nyangadzayi Musuka 15da6cb7d2 fix: squash several bugs in MBC1 implementation 2021-03-21 01:52:29 -05:00
Rekai Nyangadzayi Musuka 5a42d76f1e feat: implement LCDSTAT interrupt 2021-03-21 00:01:21 -05:00
Rekai Nyangadzayi Musuka c64417fdce fix: horizontally flip ppu so the Nin***** logo is readable 2021-03-20 23:24:06 -05:00
Rekai Nyangadzayi Musuka 7462061937 chore: be more specific with integer types 2021-03-20 22:19:55 -05:00
Rekai Nyangadzayi Musuka f78651d8d7 feat: implement programmable background palette 2021-03-20 22:19:13 -05:00
Rekai Nyangadzayi Musuka b213a6e545 feat: make 0xFF0F aware of joypad struct interrupt bool 2021-03-20 21:21:55 -05:00
Rekai Nyangadzayi Musuka 36e572b783 feat: implement Joypad register 2021-03-20 21:11:45 -05:00
Rekai Nyangadzayi Musuka fc303b6265 chore: rename "as u8" to "as Self" when implementing From Trait 2021-03-20 21:10:48 -05:00
Rekai Nyangadzayi Musuka cd0eac9d37 chore: improve code quality
Removed a lot of magic constants. Gave them descriptive variable names
2021-03-20 20:26:49 -05:00