Commit graph

39 commits

Author SHA1 Message Date
Michel Heily 884f39ca8f Refactor workspace structure
Former-commit-id: d6ab90563fa209b431661086f9ec2672bda02a96
2020-04-11 16:06:34 +03:00
Michel Heily fb93ebb4ed feat/arm7tdmi_dispatch_table: Done!
Moved away from using lazy_static for this one since every access to a
lazy_static reference adds a runtime check, Currently using a build.rs script to generate a const table instead.

Worked out the ARM decoding issues, seems to run fine now.

Though the dynamic decoding for ARM is broken now since I had to change things in Data Processing and MSR instructions

TODO use `const fn` when it becomes stable


Former-commit-id: ba09748ff74a403c7016adcbe0ca553b591f6855
2020-04-07 02:31:13 +03:00
Michel Heily a523a37d32 [WIP] Start working on arm7tdmi dispatch table.
Lookup tables are generally faster than matching in most architectures.
There is some trouble in decoding some arm data processing instructions
so this is non-default feature for now

* Crashes on armwrestler but many games seem to work


Former-commit-id: 3c06ea344ae0097947d8cd5bd05b1f882c7f743a
2020-04-07 02:30:22 +03:00
Michel Heily d938767430 feat/jni: Add rustboyadvance-jni crate to export some simple JNI bindings
Former-commit-id: d4e7a622a97215a8c1b7b50bb7f08d18cb9c5716
2020-02-23 00:30:38 +02:00
Michel Heily c50ab1ecd8 feat: Add basic gdbserver feature
Initially I began implementing the gdb protocol on my own, but I then found a
nice work-in-progress crate on https://github.com/daniel5151/gdbstub
that suited my needs.


Former-commit-id: f77557cbbd8652c2ed05ac439efc1956d8e99729
2020-02-21 22:12:58 +02:00
Michel Heily aeab3a82a3 Return to rust stable, get rid of nightly features for now
Former-commit-id: 1550bc0f70218c8a012f0631502eabbdf835d0ab
2020-02-14 14:33:22 +02:00
Michel Heily b03fe3567e Fix all warnings during build
Ran cargo-fix to automatically fix most of the build warnings,
Cleaned up dead code, and fix the rest manually


Former-commit-id: f35faba46b40eaf9c047efb8ab1e77ffa24d41b6
2020-02-14 14:21:45 +02:00
Michel Heily 17560eeb0c fix: Completly refactor GPU scanline composition code.
This change fixes #9 and emulates:
- Correct layer ordering
- Correct emulation of blending sfx
- Correct emulation of the object window (BIOS boot animation is now fixed)


Former-commit-id: caf46fe4b62cc54e6f2c02a8001da552f8e6b54a
2020-02-07 16:11:16 +02:00
Michel Heily 5fc38546ce refactor(core/cartridge): Refactor cartridge module to make it easier to configure savetypes
Former-commit-id: 2e8dd8c3f60c7de8c55bd4c38eaa0630af73c1cc
2020-01-31 16:15:29 +02:00
Michel Heily 8f4e42d6d4 feat(logger): Add a logger to the project
Former-commit-id: aa0579884951857a136904b3147eaa553117e68e
2020-01-31 16:15:29 +02:00
Michel Heily 70c19ea343 fix(sound): Fix amplitude and properly emulate sound bias level
Former-commit-id: 92dec2c186b9e6f34ae5ce0ee167d6f1fa7730c8
2020-01-21 01:20:28 +02:00
Michel Heily c20ac9cdf8 core: cartridge: Try to detect and print the backup type
In preparation for backup impl


Former-commit-id: 75efbbaea82ba30899787b46b8eaca834622493c
2020-01-17 16:11:43 +02:00
Michel Heily 8755013ec6 tests: Wrap gba-suite by jsmolka
Former-commit-id: 511f08470520c712b3b5a5bd9e33ac590939c315
2020-01-17 01:33:21 +02:00
Michel Heily 87999122da feat/savestates: Add write_bin_file util function
Former-commit-id: 88e12df1d8a88ad97756e943b4b959f73bb99c35
2020-01-16 19:49:43 +02:00
Michel Heily d887602266 feat/savestates: Add serde and bincode traits to the project
Former-commit-id: b4699586bba03b8fcfc718ea08363a7067d31e20
2020-01-16 19:49:13 +02:00
Michel Heily 12ebcf44a2 refactor: Make debugger into a cargo feature
Former-commit-id: 50f28963d5f7c7b04a0ecd4be82ddd61bd59a39b
2020-01-13 01:11:58 +02:00
Michel Heily c6feb5d500 core: Optimizing GameBoyAdvance::frame
Profiling GameBoyAdvance::frame shows that it spends way too much time idleing
on SoundController::update & Gpu::step waiting for the cycle count to
reach to the next event, Consuming cpu time for the Arm7tdmi core.

This commit changes the implementation of the main loop functions so
that the CPU will run as many cycles as possible and the peripherals
will only be updated when needed.
The is a performance improvement of roughly 50% in fps in some games!


Former-commit-id: 937e097f958423934c70b7face6b6b02926b7a51
2020-01-11 16:12:54 +02:00
Michel Heily 3687161b98 Make the debugger into an optional build option.
This module is written purely and always breaks when changes are being
made into the 'core' module, so as long as I don't use it, I don't feel
like maintaining it.


Former-commit-id: f5b18ba54a27d22e8a195dd0912ec9c8f29fa830
2019-12-29 23:44:34 +02:00
Michel Heily d8545dd8cd sdl2: Use callbacks with ring buffer instead of audio queue.
Better latencies, and also fast-forward (aka Turbo mode) sounds normal
this way.


Former-commit-id: d1075087e847c765a871157a7973c897575ef4d7
2019-12-28 17:03:59 +02:00
Michel Heily 398e66b723 More work. DMA sound seems to work, but sounds very crappy.
Former-commit-id: cc9f2877f9ccc1b05163af3fd35ff07efa8e3067
2019-12-23 01:37:45 +02:00
Michel Heily fefeddbc40 Continue working on DMA sound.
Cleanup timer.rs
run cargo fmt
restore debugging continue&frame commands
Fix bug introduced in previous commit causing the bios animation to
hang


Former-commit-id: 188acaa1121503a97f2d3be816f6f57835e17fe1
2019-12-23 01:37:45 +02:00
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 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 7cc1a50d12 Support zip files and add --no-framerate-limit
Former-commit-id: 62a7122fb0b3e832eeb3cbf347a0966e4cd32d50
2019-09-11 21:26:40 +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 3f6a52cae6 Add sdl2 backend
Currently has bad performance


Former-commit-id: 384ef6b5cd7b1e1baeb6adfbc0b299b0d07d7a5d
2019-08-10 18:14:59 +03:00
Michel Heily c7dd713605 The big ioregs refactoring.
This commit refactors the ioregs:
* Use bitfield crate to implement the GPU ioregs.
* IoRegs are stored in their own variables bindings (i.e, Gpu related ioregs are now fields of the Gpu struct)
  - This optimize performance quiet alot from my testings - since every scanline was accessing deseralizing ioregs from sysbus. (Getting constant 59fps now)
* For now, comment out DMA model

Also, cleaned the code up to eliminate rustc warnings.


Former-commit-id: 9077695c446ebd1a71783acfdd9819245aa02d7a
2019-08-03 00:24:15 +03:00
Michel Heily eb2a1a02fe Implement background scrolling!
tonc's brin_demo.gba now works as intended :)


Former-commit-id: 596c063c5968534f42e42f52203c85262b9c6fa2
2019-07-31 00:52:46 +03:00
Michel Heily 7e9c0e31da Add minifb backend - Armwrestler now plays !
Former-commit-id: d72ea9139e04624322cf3bc4a8ab330f6bb133a4
2019-07-20 23:02:18 +03:00
Michel Heily 53115a9a58 Refactor core functionality into a separate module
Former-commit-id: 5d55b9eb0b63ed7c61465b4e814782165caa5002
2019-07-20 16:46:00 +03:00
Michel Heily 7119ba2451 Cpu: Rewrite pipeline code.
Pipeline code was unreadable up until now, this also fixes a bug:

* Some roms have illegal instructions right after branch instructions, and
the cpu would error trying to decode them because of pipelining.


Former-commit-id: e3201c7b0d2adfc772231a3e2d5909f43c17b50f
2019-07-20 16:03:37 +03:00
Michel Heily 1f074e20ad Refactor lcd -> gpu
Former-commit-id: c12be139770922bac55490c76348f5406fc00f07
2019-07-16 01:21:11 +03:00
Michel Heily c92bde54a1 Begin modeling DMA
Former-commit-id: 83ab601e70666f76ed3ebfb22340c6b1868af3ac
2019-07-07 01:47:51 +03:00
Michel Heily 3cc84b1b03 Model many things
Former-commit-id: b87fa2b16b395f497cf217ea043e68404ab2f65e
2019-07-06 15:54:07 +03:00
Michel Heily 58e1230e7a Model the cartidge.
Former-commit-id: b51d2928631bfc438b9f1b15fafcaa9d90008179
2019-07-03 01:40:08 +03:00
Michel Heily 6f81c236a6 Mega Commit #2 - Add some thumb decoding and disassembly
Former-commit-id: e3a89ac681a8d6f6f0bee85b32f64d181e11242f
2019-07-03 00:03:35 +03:00
Michel Heily cbddeffd91 arm: Implement MSR_REG and fix some prefetching errors
Former-commit-id: 177b8966159ed86472b0d4d031363df72d46807a
2019-07-02 16:53:29 +03:00
Michel Heily 22c175d9cc Reorganize package structure
Former-commit-id: d7ad26c07fc7063522fae061577f7ceece797ae5
2019-07-01 16:15:42 +03:00