The docs state: "If a register is used to specify the shift amount the PC will be 12 bytes ahead"
I probably misread that when implementing DataProcessing instructions,
and because of that added 4 bytes to (op1+8) when shift amount was specified by a rotated immediate.
Fixes#6 (and probably tons of other bugs too!)
Former-commit-id: 129f0951a6381221314c23a468c3da8b31435a30
Displaying sbb_aff.gba and rsbin demos correctly.
Problems in mode7:
* Incorrect first scanline in m7_demo.gba
* Mariokart scaling is off
Former-commit-id: 27655a7a3cde0e9cdabd727a6ec9c99270a99b35
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
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
1) Decouple SysBus from Gpu
2) Split Gpu rendering function into separate modules
3) Cleanup
Former-commit-id: 0435ad1c9c1de72ed50769fabfea7c5f33b670e0
This was apparent in Dragon Ball Z - Legacy of Goku II, where the save
point sprites were not rendered at all.
Former-commit-id: 156356ebe2f2a4879602019a1fe2c18fe2b8a395
The symptom of the problem was in the form of a rythmic click sound popping in the left channel.
Diving deep into Kirby's binary, I found out that channel B and channel
A are playing too different pcm buffers simultationsly: A is enabled for
the right channel and B is enabled for the left.
I found out that the game's sound driver was using VCOUNT in order to syncornize the audio,
but in some occassions the fifo DMA was not disabled in time, causing the DMA to
fill the fifo in additional 16 bytes of garbage residing next to channel
B's pcmBuffer.
After a thorough check-up of the GPU state machine, I find out that I
stay in VBLANK for 1 line too long, and that's what caused the audio
buffer to de-sync with the gpu emulation.
This commit fixes this issue.
Former-commit-id: e0f20bd01b8abf62da486e2501cff197a9a22763
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
This commit removed the dummy iomem buffer, and the bios busy waits on
REG_SOUNDBIAS in order to proceed.
Former-commit-id: 1fb8e2b621bed22da55781adcaae748aaaf845b9
This solve many graphical glitches with normal sprites in:
- Kirby - Nightmare in Dreamland
- DragonBall Advanced Adventure
- DragonBall Supersonic Warriors
Former-commit-id: aa7813720ca86c0ff0a3111f245d35765112d750
- 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
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
- 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
This fixes the glitch in dma_demo.gba where the rendering of the circle
was off by a scanline.
Former-commit-id: 907fefd548b6557ce46e06a99d0bc6ab83a8f332
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
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
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