Commit graph

302 commits

Author SHA1 Message Date
Michel Heily aee86d85c8 Start Sdl2AudioPlayer
Former-commit-id: 905b846d751db577bc213f1ca38a4c0e72558cfa
2019-12-20 15:11:26 +02:00
Michel Heily 04d2edfc01 Refactor "backend" concept
See plat/sdl2


Former-commit-id: 5f7c9625467003d5b73307959095eb5365db523e
2019-12-20 15:11:26 +02:00
Michel Heily 326bb06e82 Move rom file loading logic to Cartridge
Former-commit-id: 29045310d380657819529333b5231a98be5fa8c1
2019-12-20 15:11:26 +02:00
Yonatan Goldschmidt 763ee217d8 Add WIP sound controller and backend
Former-commit-id: 50e5bb71a620ac138a880872ae1f13f1c0c0604c
2019-12-20 15:11:26 +02:00
Yonatan Goldschmidt 7cfa4bb07d Remove some unused imports
Former-commit-id: 64bd0e7419cd374f6321fcc3bd9fdee7a241592b
2019-12-20 15:11:26 +02:00
Yonatan Goldschmidt 60c77869df Add cpal extern crate
I really hope all these additions to Cargo.lock are actually its deps...


Former-commit-id: 7c85f330ea3c27f8ebae7020dc4a46d7d557affd
2019-12-20 15:11:26 +02:00
Yonatan Goldschmidt 41deb1631c Print read/writes to unhandled sound registers
Former-commit-id: f63a98b61866c872ef52dd972db3ef28054be432
2019-12-20 15:11:26 +02:00
Michel Heily 29df4231e9 Protect unused bits from being set in window flags
Former-commit-id: a618b4775de7276618dd11ace2e140d200fb066b
2019-12-20 15:07:23 +02:00
Michel Heily cb36db688e Fix LSR#0
Former-commit-id: 7cfcc0b8f6e0849c9090148f2cc381b3419abd39
2019-12-20 15:06:21 +02:00
Michel Heily 11219dab7e tmpfix: Reset scanline in scanline_aff_bg placeholder
Former-commit-id: a4f910210bfa186611d771202a4ef96e97fe75b7
2019-11-21 17:46:51 +02:00
Michel Heily 42904782f7 Fix bios infinite loop caused by changes in f5a8ca8de8a5b007ace879f50fb97ead3e976347 [formerly e885e9ff1393dd14f5e4132c71a7641d658399cb]
This commit removed the dummy iomem buffer, and the bios busy waits on
REG_SOUNDBIAS in order to proceed.


Former-commit-id: 1fb8e2b621bed22da55781adcaae748aaaf845b9
2019-11-21 17:36:58 +02:00
Michel Heily 9856f04e05 Implement affine sprites. Displaying TONC affine sprites demos correctly.
Former-commit-id: 6f8aaec9cb844a685a1b07f7d09a0535039133b8
2019-11-20 06:25:38 +02:00
Michel Heily 64a877369d Reorganize sprite rendering code
This commit contains changes I forgot to push way earlier.


Former-commit-id: 793bfc2bde25f2299136e6b196f2770ee1db8d19
2019-11-20 05:33:51 +02:00
Michel Heily bb08b2f48e Improve timers
Former-commit-id: 02985b13aec6ac4ce52952b9bc505e48ebbb94e6
2019-11-20 05:20:46 +02:00
Michel Heily 3c3129c73c Minor fixes
Fix LSR integer underflow.
Change SWI LR calculation


Former-commit-id: 6a298719e380c3a01f70c3b05d9f3507638398d5
2019-11-20 05:04:54 +02:00
Michel Heily 3c3e8c35b4 Fix wrong sprite size calculation
This solve many graphical glitches with normal sprites in:

- Kirby - Nightmare in Dreamland
- DragonBall Advanced Adventure
- DragonBall Supersonic Warriors


Former-commit-id: aa7813720ca86c0ff0a3111f245d35765112d750
2019-11-16 20:18:28 +02:00
Michel Heily 49ef59b8e9 fixup! Improve the debugger
Former-commit-id: 9ca33bd4f8273a6be66cec6a8218664a7aada376
2019-11-16 18:48:24 +02:00
Michel Heily 4c3862543e Fix bug in MODE0 where BG3 would not be rendered due to inconclusive range, thank you Rust.
Former-commit-id: 6dd8ce110d212083cba394f08488d4fffdf6d015
2019-11-16 18:17:53 +02:00
Michel Heily 46931a1f6a Fix CPU bugs, KIRBY BOOTS!
- Bad LSR emulation caused an edge-case making allmost all of the game I tested fail to boot past intro.
- Incorrect sign extension of offset5 in THUMB caused bad address calculation.

Kirby boots with rendering glitches, I played past the first 2 boses
without crashes.


Former-commit-id: 8ea0ad6eb0f70e6dc23d1f2fcc44c8c0b3448fba
2019-11-16 18:17:53 +02:00
Michel Heily ccfff31123 Improve DMA
According to GBATEK:
The SAD, DAD, and CNT_L registers are holding the initial start
addresses, and initial length. The hardware does NOT change the content
of these registers during or after the transfer.

The actual transfer takes place by using internal pointer/counter
registers. The initial values are copied into internal regs under the
following circumstances:

Upon DMA Enable (Bit 15) changing from 0 to 1: Reloads SAD, DAD, CNT_L.

Upon Repeat: Reloads CNT_L, and optionally DAD (Increment+Reload).


Former-commit-id: 1e606dc88603a4600a79a341ef17fe8ccb482871
2019-11-16 18:17:53 +02:00
Michel Heily 4f2fbc2af2 More memory map bug fixes (Wrong ROM masks and more)
Former-commit-id: 4149a16965d111fb95629e8381269eae4f84c0c4
2019-11-16 18:17:53 +02:00
Michel Heily f7dc417e94 Fix accesses outside of IO region
Former-commit-id: dc874b6d28370cf7256156f2502bd2dc56a0a3fd
2019-11-16 18:17:53 +02:00
Michel Heily b9d0857acc Don't allow IRQs when pipeline is reloading
Former-commit-id: a51d3671dfabab422f2ad880b3cbe1bac65d442b
2019-11-16 18:17:53 +02:00
Michel Heily b288625b9a Improve the debugger
- Add tracing of opcodes and potentially more stuff
- Add option to run a script file at the beginnig (I use it to redirect
traces to a file)
- Support breakpoints again


Former-commit-id: 4e988d6bc1a59456c96547f0320a6d9abedcae00
2019-11-16 18:17:53 +02:00
Michel Heily 7e98af80c2 Fixes to ALU, passing mGBA carry tests
Former-commit-id: 14a4293b2511c7c63a920e6344e89b209ca7c5ee
2019-11-16 18:17:53 +02:00
Michel Heily 88b908f2a0 Implemenet GBA Halt control
Former-commit-id: 1b09cb881b4e68f410abe6e1f6a161cd55a4626a
2019-11-12 18:55:26 +02:00
Michel Heily dcab1e6328 Improve GPU state machine.
This fixes the glitch in dma_demo.gba where the rendering of the circle
was off by a scanline.


Former-commit-id: 907fefd548b6557ce46e06a99d0bc6ab83a8f332
2019-11-12 18:22:00 +02:00
Michel Heily 2978fde0dc Add tasks.json
Former-commit-id: 602d0564b1fe77ff58c4ee00e22d0a7b2c2fab19
2019-11-12 18:22:00 +02:00
Michel Heily 1d088accb8 mGBA test suite now boots!
Fix tons of bug and reimplemented some of the core code.
Add a neat feature for debug builds:
When the cpu "swi 0x55" instruction, a breakpoint is triggered on the
host.


Former-commit-id: 959249df4374327d90b2503d7a45f8d5d27995a6
2019-11-12 18:22:00 +02:00
Michel Heily c117cbe924 Make the debugger work again, but currently breakpoints are not supported.
Added memory write command and the ability to pause the debugger with Ctrl-C


Former-commit-id: 83d141fa191dadefb84f7c9de163631a69af8324
2019-11-12 18:22:00 +02:00
Michel Heily bfee970592 Update Cargo.lock
Former-commit-id: 91eeaeccafc9eee20aee6b103176b4ee9d42c742
2019-11-09 19:44:55 +02:00
Michel Heily f898de8ddc Update launch.json for cppvsdbg
Former-commit-id: 6fc91daa80dd77bcefb82880217b4b1d85bfcdb5
2019-11-09 19:44:55 +02:00
Michel Heily c78a111ad4 Implement DMA, WIP
I have fought very hard against the rust ownership model,
In the end for DMA to play nice with my code, I had to resort to use
unsafe code for now..

The DMA implementation itself is not accurate to say the least, but will
have to do for now.

Tonc's dma_demo.gba plays but with a visual glitch.


Former-commit-id: 3b9cdcb2d09c78701290f2c48b77f9f3487e85c9
2019-11-09 19:44:55 +02:00
Michel Heily 3a1d5c10ce Fix many bugs, refactor many things..
Passing: Armwrestler, cpu_test by Dead_Body

Former-commit-id: 80d815d110c5341515dd01c476a0d7e25ecb66a8
2019-11-09 01:06:24 +02:00
Michel Heily 2bd8b56bc6 Fix that DAMN bug.
Long story short, I've been hunting this bug for a while now.
While passing armwresteler tests, I still had an emulation bug which
causeed libgcc's iprintf to produce bugged strings.

In order to find it, I've used https://github.com/fleroviux/NanoboyAdvance/
And patched it to produce a formatted log of every step of the execution
of iprintf:
{OPCODE} {PC} {R0} {R1} ... {R14} {FLAGS}
Did the same on my emulator and searched for differences.

Found out the a "CMP r3, #0x0" instruction turned off the carry flag
when it shouldn't. Found this sad function, the check I'm using for
carry flag is meaningless when done on signed integers. :sigh:


Former-commit-id: 871d2581921796dae9bf4f5fdaa45c6ad46aebec
2019-11-06 00:49:59 +02:00
Michel Heily 7cc1a50d12 Support zip files and add --no-framerate-limit
Former-commit-id: 62a7122fb0b3e832eeb3cbf347a0966e4cd32d50
2019-09-11 21:26:40 +03:00
Michel Heily fa211fa77e Fix thumb NEG instruction. Finally pass armwrestler!
This one took me quite a bit. :/


Former-commit-id: f08537dda5a62076c3faff31a898c0a585102526
2019-09-10 01:01:49 +03:00
Michel Heily 441482516e Get rid of timer.rs spam
Former-commit-id: 2d2ce31ad77840e4a8685257a77f824da21992ba
2019-09-09 20:07:45 +03:00
Michel Heily 9ebb0d3d2d Fix OBJ priorities (tonc prio_demo.gba works)
Former-commit-id: a55b3be7688ef7e1446a54c38fc5ddb5034cb4b9
2019-08-31 14:13:21 +02:00
Michel Heily ba9b4662d4 Fix SBC and RSC instructions
Needed to add 1-C and not substract 1-C


Former-commit-id: 339201a2cd41d777d3b3204995e698182032c80d
2019-08-31 14:10:05 +02:00
Michel Heily eab08992b9 Add normal sprite rendering support.
Former-commit-id: 04c3d7ec3051ce4c5aeacb552688c0217b3b3d3b
2019-08-27 23:15:22 +03:00
Michel Heily 8abebbe844 Implement Window special effect (win_demo.gba works, excpet the sprite)
Former-commit-id: 511d04045bbb678ceec39e34c483f04db154997b
2019-08-24 00:36:48 +03:00
Michel Heily 1d2d950729 Fix IoRegs::write_8
Former-commit-id: 9877e7f42fefafb71dd319287e01d55926d4d12c
2019-08-24 00:33:01 +03:00
Michel Heily f40ee148ea Add sdl2 key mappings
Former-commit-id: 9b3aa941ffca9a679d9ce70ca43d6396d4dfe5ff
2019-08-23 22:47:12 +03:00
Michel Heily 4a72a1035f Fix Rgb15::is_transparent bug
Former-commit-id: f12729b993ec9bef94a58a4d48982c7d3939c45b
2019-08-17 21:27:36 +03:00
Michel Heily 639993edd7 Add blending and mosaic SFX, and cleanup code.
Former-commit-id: b9f0ccaf1820da61f49ebeb2af5beff5cccd722f
2019-08-13 22:15:36 +03:00
Michel Heily c4b24fde02 Refactor GPU registers wrappers to a separate module
Former-commit-id: 3e7c6326232cd761674061ceed758a56412da17f
2019-08-11 22:35:32 +03:00
Michel Heily 52ef793759 Move gpu module to a separate folder, to allow for later cleanup.
Also, get rid of "render" command


Former-commit-id: 7dd004f3ff8f55686665adead497ebae4f873379
2019-08-11 22:28:52 +03:00
Michel Heily edf2efcce5 Fix panic if debugger histfile does not exist
Former-commit-id: a355a783b4d513dd3c65ef41de6a7604853a7b0f
2019-08-11 21:50:44 +03:00
Michel Heily 9064ae9cf8 Fix bug in IoRegs::write_32
Former-commit-id: a2c5b57a0e7da2fa0f080d70acd77b8643bc4742
2019-08-11 21:50:44 +03:00