Compare commits

..

517 Commits

Author SHA1 Message Date
9436888b28 chore(gitignore): update .gitignore
sometimes I'm left with a src/zig-cache, and I want to
just make sure that I never-ever end up commiting that
2022-10-21 05:13:13 -03:00
583ed54ee3 feat: write default config.toml if it doesn't exist
also resolves panic on missing /zba or /zba/save directory by ensuring
those directories exist as soon as we know the data directory
2022-10-21 05:13:13 -03:00
7944cd7abc chore: update README 2022-10-21 05:13:13 -03:00
ffd94c96ce Merge pull request 'Configure SDL2 to use OpenGL' (#4) from opengl into main
Reviewed-on: #4
2022-10-21 05:13:13 -03:00
4fe612da61 fix(opengl): properly control whether vsync is enabled 2022-10-21 05:13:12 -03:00
4262688fa8 chore(ppu): remove BGR555 -> RGBA888 LUT
LUT probably couldn't fit in CPU cache anyways.

TODO: Consider whether LUTs for separate channels (size 32 * 3 * 3
instead of std.math.maxInt(u15))
2022-10-21 05:13:12 -03:00
35d685f032 chore: replace OpenGL 4.5 bindings with OpenGL 3.3 2022-10-21 05:13:12 -03:00
5b9d3d0960 chore: remove unnecessary ptr cast 2022-10-21 05:13:12 -03:00
44b2e9be88 chore(gpio): add missing errdefer 2022-10-21 05:13:11 -03:00
4b7ef52a7a feat: implement better Colour Emulation 2022-10-21 05:13:11 -03:00
5103fdf646 chore(main): report errors slightly better 2022-10-21 05:13:11 -03:00
acddaf76aa fix: lower required OpenGL version + resolve offset bug 2022-10-21 05:13:11 -03:00
3da3b69e13 feat: use opengl
TODO:
- Texture isn't scaling properly
- I need to reverse the colours in the frag shader
2022-10-21 05:13:11 -03:00
40062d4dfe chore(config): add log message 2022-10-21 05:13:10 -03:00
1c91b497bc feat(config): add option to skip BIOS 2022-10-21 05:13:10 -03:00
e3286a9872 feat(cli): Add option to skip BIOS 2022-10-21 05:13:10 -03:00
ddb0e2f928 chore: Update README.md 2022-10-21 05:13:10 -03:00
d927ee6c90 Merge pull request 'Draft: Implement Instruction Pipeline' (#3) from pipeline into main
Reviewed-on: #3
2022-10-21 05:13:10 -03:00
011f105bee feat(config): add config option to mute ZBA 2022-10-21 05:13:09 -03:00
2c88f9bbce fix(bios): set addr_latch even if bios is skipped 2022-10-21 05:13:09 -03:00
30c5fafec1 chore(config): add example config file 2022-10-21 05:13:09 -03:00
3b144e581a fix(bus): make open bus impl aware of CPU pipeline 2022-10-21 05:13:09 -03:00
0117a52f4d style(bus): cpu ptr doesn't need to be optional 2022-10-21 05:13:09 -03:00
3cf7c83269 style: code cleanup 2022-10-21 05:13:09 -03:00
85d4690c56 fix: resolve timing regressions
make sure to use fetch timings when fetching instructions
2022-10-21 05:13:08 -03:00
130d40bc7f fix: rename Pipline to Pipeline 2022-10-21 05:13:08 -03:00
2c928eafec feat: working pipeline implementation 2022-10-21 05:13:08 -03:00
dcbeeee7cc chore: refactor ARM/THUMB data processing instructions 2022-10-21 05:13:08 -03:00
84ccb7224b fix: don't flush pipeline when reloading CPSR in ARM Data Processing 2022-10-21 05:13:08 -03:00
dd4bb4ff03 chore: don't write to CPSR + swap with SPSR at the same time 2022-10-21 05:13:07 -03:00
ecbfe67b27 chore: update README.md 2022-10-21 05:13:07 -03:00
e29c20019d fix: advance r15, even when the pipeline is reloaded from the scheduler
The PC would fall behind whenever an IRQ was called because the pipeline
was reloaded (+8 to PC), however that was never actually done by any code

Now, the PC is always incremented when the pipeline is reloaded
2022-10-21 05:13:07 -03:00
d8c397248f chore: dump pipeline state on cpu panic 2022-10-21 05:13:07 -03:00
64aed01869 fix: reimpl THUMB.5 instructions
pipeline branch now passes arm.gba and thumb.gba again

(TODO: Stop rewriting my commits away)
2022-10-21 05:13:07 -03:00
29f2a0288f fix: impl workaround for stage2 miscompilation 2022-10-21 05:13:07 -03:00
27ada16377 chore: instantly refill the pipeline on flush
I believe this to be necessary in order to get hardware interrupts
working.

thumb.gba test 108 fails but I'm committing anyways (despite the
regression) because this is kind of rebase/merge hell and I have
something that at least sort of works rn
2022-10-21 05:13:06 -03:00
ad1cec58e7 fix: reimpl handleInterrupt code 2022-10-21 05:13:06 -03:00
97d9edab93 feat: implement basic pipeline
passes arm.gba, thumb.gb and armwrestler, fails in actual games
TODO: run FuzzARM debug specific titles
2022-10-21 05:13:06 -03:00
39f56e6d8a feat: resolve off-by-{word, halfword} errors when printing debug info 2022-10-21 05:13:06 -03:00
f0014e7179 feat: reimplement cpu logging 2022-10-21 05:13:06 -03:00
8a804ea05e Merge pull request 'Add TOML Support' (#2) from toml into main
Reviewed-on: #2
2022-10-21 05:13:05 -03:00
efce1a6dce chore(emu): refactor code 2022-10-21 05:13:05 -03:00
8b9ab6f4b5 feat(config): add support for (and read from) TOML config file 2022-10-21 05:13:05 -03:00
d21c860eb5 feat: parse config.toml in data folder
Also took the chance to rework parts of the logic that determines
ZBA's save path
2022-10-21 05:13:05 -03:00
85e670a1d7 chore: add zig-toml dependency 2022-10-21 05:13:05 -03:00
4f823217bd chore: update dependencies 2022-10-21 05:13:04 -03:00
207a99edbe style: improve code quality 2022-10-21 05:13:04 -03:00
3c5b30dece feat: rewrite device ticks 2022-10-21 05:13:04 -03:00
739d38533a style(scheduler): rename scheduler event handlers 2022-10-21 05:13:04 -03:00
ae6b8e2f03 style: code refactoring 2022-10-21 05:13:04 -03:00
208f4b522d style(apu): split apu.zig into multiple files + refactor 2022-10-21 05:13:03 -03:00
bd54700103 style(backup): refactor code 2022-10-21 05:13:03 -03:00
08d27520e0 style(flash): move flash code into it's own file 2022-10-21 05:13:03 -03:00
bfe97c671e style(eeprom): move eeprom code to it's own file 2022-10-21 05:13:03 -03:00
9baadadba2 style(bus): refactor several hardware abstractions 2022-10-21 05:13:03 -03:00
68a87e0a54 chore: SDL2.zig expects target to be set before link() is called 2022-10-21 05:13:02 -03:00
1d7dfe71ca chore: update dependencies 2022-10-21 05:13:02 -03:00
1acc5e35e9 chore: move util.zig 2022-10-21 05:13:02 -03:00
df73cdbecc chore: disable audio sync by default
forgot SDL2 AudioStream doesn't work well for my use-case
2022-10-21 05:13:02 -03:00
6738dfac85 chore: change default settings 2022-10-21 05:13:02 -03:00
11985f4019 chore: reimpl util.escape
should make use of stdlib when I can
2022-10-21 05:13:02 -03:00
7cad3aca13 fix: Detect FRAM ROMs 2022-10-21 05:13:01 -03:00
2bbc12cd1a chore: improve util and Gui API 2022-10-21 05:13:01 -03:00
270db2b5ff chore: move Gpio and Clock structs to separate file 2022-10-21 05:13:01 -03:00
bce46418cd Merge pull request 'Implement RTC' (#1) from rtc into main
Reviewed-on: #1
2022-10-21 05:13:01 -03:00
2d9b03a725 feat: add option to force-enable RTC 2022-10-21 05:13:01 -03:00
c34752ac65 feat: auto-detect RTC in commercial ROMS 2022-10-21 05:13:00 -03:00
60680a36e2 fix: account for lateness in RTC scheduler event 2022-10-21 05:13:00 -03:00
4111bb5e4f fix: RTC day is 6 bits wide, not 3 2022-10-21 05:13:00 -03:00
612f5fe30e feat: put RTC Sync on Scheduler
TODO: Database to see what games have what GPIO devices
2022-10-21 05:13:00 -03:00
d9776e99d3 chore: import datetime library + default time for RTC 2022-10-21 05:13:00 -03:00
960efcd428 fix: ignore RTC Time/DateTime writes
this falls in-line with better emulators
2022-10-21 05:13:00 -03:00
b07dc8484d chore: use Clock.Writer for Command parsing, delete Clock.Command 2022-10-21 05:12:59 -03:00
ebcae80a9d feat: implement RTC Read/Writes 2022-10-21 05:12:59 -03:00
ff8ea79620 feat: implement force irqs for GPIO/RTC 2022-10-21 05:12:59 -03:00
fe19b19fc7 fix: properly resovle stack UAF 2022-10-21 05:12:59 -03:00
e709c2030c chore: shorten orelse @panic to .? 2022-10-21 05:12:59 -03:00
5725bbbe35 fix: update GpioData extern union
u4's are no longer supported in extern unions :\
2022-10-21 05:12:59 -03:00
8553ab6e6d chore: Guilty Gear X expects these I/O Registers 2022-10-21 05:12:58 -03:00
372bfdc5f6 tmp: incomplete impl of GPIO + RTC 2022-10-21 05:12:58 -03:00
fad5c9e632 feat: implement open bus for unmapped i/o 2022-10-21 05:12:58 -03:00
5fb5247d0e chore: comment open bus impl 2022-10-21 05:12:58 -03:00
75be6aa82a chore: update dependencies 2022-10-21 05:12:58 -03:00
0b8cc30d4d chore: Update README.md 2022-10-21 05:12:58 -03:00
d2a50cf9d2 feat: reimplement audio sync
APU will now drop samples if the Audio Queue is already full, therefore
creating a "sped-up" effect when the emulator runs faster than 100%
2022-10-21 05:12:57 -03:00
b2386a6a2b chore: move arm/thumb lut idx functions 2022-10-21 05:12:57 -03:00
22fbe380eb chore: update dependencies 2022-10-21 05:12:57 -03:00
f2b27f31f4 chore: better conform to zig idioms 2022-10-21 05:12:57 -03:00
867025b1ec chore: rename arm7tdmi variables to just cpu
Less verbose, specifying arm7tdmi doesn't really do much when there's
no other CPU in the system
2022-10-21 05:12:57 -03:00
9b0f54b111 chore: allocate sprite array on heap
Each Sprite optional is 10 bytes meaning I'm allocating 1.28Kb on the
stack which isn't necessary.
2022-10-21 05:12:56 -03:00
4cf58f1faa chore: improve init/deinit methods 2022-10-21 05:12:56 -03:00
1a56f957c1 chore: reorganize some code 2022-10-21 05:12:56 -03:00
1a4a2a56a3 chore: pass the allocator as an argument more often
As of right now, I think the only cases where I shouldn't explicitly pass an allocator
are in read/write functions and deinits
2022-10-21 05:12:56 -03:00
c701156ce6 fix: resolve use-afer-free in backup.zig
This worked fine on stage1, and works fine in debug in stage3.
However, stage3 ReleaseSafe would panic due to what I assume must
have been an undefined behaviour optimization.

While I'm happy that I was quickly made aware of the issue thanks to
the safety checks in ReleaseSafe I do wish that this issue showed itself
in Debug, since I *am* using the GPA
2022-10-21 05:12:56 -03:00
4b6897aedf feat: Get ZBA working on Zig's new stage2/stage3 compiler 2022-10-21 05:12:55 -03:00
1471288969 chore: move window scale const to emu.zig 2022-10-21 05:12:55 -03:00
7488fd7fd5 fix: reimpl debug reads w/out throwing away *const Self 2022-10-21 05:12:55 -03:00
20056eff2c chore: update dependencies: 2022-10-21 05:12:55 -03:00
3f760fccaf feat: reimplement cpu logging 2022-10-21 05:12:55 -03:00
f833de765c chore: don't init bus in Arm7tdmi init 2022-10-21 05:12:55 -03:00
aa19ef5f71 feat: move arm instr decoding to module 2022-10-21 05:12:54 -03:00
f0284107f9 feat: move thumb instr decoding to module 2022-10-21 05:12:54 -03:00
91c94fe528 chore: change directory structure 2022-10-21 05:12:54 -03:00
45fc49b216 fix: reimplement halt fast-forwarding 2022-10-21 05:12:54 -03:00
0939d6d7bc chore: move audio sync, video sync variables 2022-10-21 05:12:53 -03:00
e7b5410509 chore: update README.md 2022-10-21 05:12:53 -03:00
2758e511ea chore: update SDL.zig 2022-10-21 05:12:53 -03:00
46ee21f464 feat: impl WININ, WINOUT, WIN{N}H and WIN{N}V 2022-10-21 05:12:53 -03:00
0287c9a260 fix: force align DMA transfers 2022-10-21 05:12:53 -03:00
665767c250 fix: resolve bugs in VRAM unpredictable read/writes 2022-10-21 05:12:53 -03:00
0fd8a13a93 fix: don't start HDMA in vblank 2022-10-21 05:12:52 -03:00
125b931d0c feat: implement brightness increase/decrease 2022-10-21 05:12:52 -03:00
27259c97db feat: implement object blending 2022-10-21 05:12:52 -03:00
9479838614 feat: implement background alpha blending 2022-10-21 05:12:52 -03:00
8a203ff05f feat: implement BLDCNT, BLDALPHA, BLDY 2022-10-21 05:12:52 -03:00
39f71730e0 chore: update README 2022-10-21 05:12:52 -03:00
33f993c19d chore: rename + remove some code 2022-10-21 05:12:51 -03:00
18ec16eb6d fix: properly fire DMA IRQs
This resolves Sound DMA Timing issues present in DOOM
2022-10-21 05:12:51 -03:00
bf558922f9 chore: rename Dma.active to Dma.in_progress 2022-10-21 05:12:51 -03:00
e87bda7584 chore: rewrite info log message 2022-10-21 05:12:51 -03:00
87dc70436c feat: implement NR10 obscure behaviour 2022-10-21 05:12:51 -03:00
5dd78177f4 feat: handle all I/O when using Cult-Of-GBA BIOS 2022-10-21 05:12:51 -03:00
203af4c471 chore: 32-bit reads for PSG audio 2022-10-21 05:12:50 -03:00
98223d9e5a chore: implement more than just 1 cycle per mem access 2022-10-21 05:12:50 -03:00
e8cc0dfabb fix: implement register reads for Yoshi's Island 2022-10-21 05:12:50 -03:00
c8585a6f9a fix: reimplement DMA ticking 2022-10-21 05:12:50 -03:00
7d79361aca chore(cpu): add inline fn isHalted() 2022-10-21 05:12:50 -03:00
d1d32e465c chore: attempt to debug Rhythm Heaven 2022-10-21 05:12:50 -03:00
42c6b21124 fix: impl BG?{X,Y} RefPoint write behaviour outside of Vblank
With this fix Mode 7-like games now properly render their backgrounds
2022-10-21 05:12:49 -03:00
44e1dacb7b chore: change priority of some logs 2022-10-21 05:12:49 -03:00
eeea8a6327 chore: mess with debug statements + mask APU I/O reads 2022-10-21 05:12:49 -03:00
0a5df26c31 chore: move timer, apu and dma i/o addr matching outside of io.zig 2022-10-21 05:12:49 -03:00
d3bc58d71c chore: separate render code for affine sprites 2022-10-21 05:12:49 -03:00
8d32d9788e chore: reimplement object rendering
TODO: implement affine sprites
2022-10-21 05:12:48 -03:00
b18f488b01 chore: small changes to normal background drawing code 2022-10-21 05:12:48 -03:00
4b4242df2a feat: implement affine backgrounds 2022-10-21 05:12:48 -03:00
e2533dedeb chore: stub 8-bit window registers 2022-10-21 05:12:48 -03:00
89619596ad chore: remove code that pretends to remove DC offset 2022-10-21 05:12:48 -03:00
02fee16561 fix: replace affine bg register bitfields with signed integers 2022-10-21 05:12:48 -03:00
bf8521eb5e chore: use stdlib endian-aware integer read/write functions 2022-10-21 05:12:47 -03:00
299244a37a chore: update zig version in README.md 2022-10-21 05:12:47 -03:00
9990fa3513 chore: update SDL.zig 2022-10-21 05:12:47 -03:00
db064d2321 chore: misc style improvements 2022-10-21 05:12:47 -03:00
e0523aea63 chore: rename method in FpsTracker 2022-10-21 05:12:47 -03:00
5982fdea98 chore: update README.md 2022-10-21 05:12:46 -03:00
c18be62b11 fix(backup): resolve banking issue in flash impl 2022-10-21 05:12:46 -03:00
9f69b122d0 chore: remove awful ptr casts in backup.zig and bios.zig 2022-10-21 05:12:46 -03:00
295aa139f6 feat: pass jsmolka's bios.gba 2022-10-21 05:12:46 -03:00
2502cc5bf0 fix: play right samples in right channel 2022-10-21 05:12:46 -03:00
fc7f2a2959 fix: resolve issue when handling event sooner than expected 2022-10-21 05:12:46 -03:00
9d839a0328 fix: remove DC offset from audio output 2022-10-21 05:12:45 -03:00
55dada243e chore: add debug keybinds for scheduler capacity + event count 2022-10-21 05:12:45 -03:00
78e7c0bc3f perf: don't check scheduler every iteration of runFrame loop
~20fps gain in Pokemon Emerald, nice
2022-10-21 05:12:45 -03:00
9134456229 chore: simplify 4bpp palette code 2022-10-21 05:12:45 -03:00
0ef71ecb49 perf: convert BGR555 to RGBA8888 at compile-time, access w/ lookup table
Compile speed isn't slowed down by that much + there's a ~20fps gain in
Pokemon emerald, though this isn't anything exact
2022-10-21 05:12:45 -03:00
3d18685d36 chore: modify type signature of util.sext 2022-10-21 05:12:45 -03:00
f194bee4eb chore: cleanup main 2022-10-21 05:12:44 -03:00
f373d8e17c chore: emu audio sync code to emu.zig 2022-10-21 05:12:44 -03:00
1b7d15e7d2 chore: redo apu sampling 2022-10-21 05:12:44 -03:00
89d8c08cd1 chore: implement apu u16 reads 2022-10-21 05:12:44 -03:00
3cd02a44cf fix: clean up frequency timer implementations 2022-10-21 05:12:44 -03:00
87eb0cc808 Revert "fix: resolve off-by-one errors when scheduling freq timer expirations"
This reverts commit c9b0030b4b9b25df6566ce0104c40b0cd18665fe.
2022-10-21 05:12:43 -03:00
8313210ddc fix: resolve off-by-one errors when scheduling freq timer expirations 2022-10-21 05:12:43 -03:00
2664f5cf20 chore: improve APU accuracy + scheduler refactoring 2022-10-21 05:12:43 -03:00
47518268a6 chore: update SDL.zig 2022-10-21 05:12:43 -03:00
29ee225c1f feat: stub Affine BG registers 2022-10-21 05:12:43 -03:00
ff6d2517be fix: resolve out-of-bounds error with 8bpp tall / horizontal sprites
Boot ROM is now enabled by default as well
2022-10-21 05:12:43 -03:00
242bf08cf2 chore: improve audio accuracy 2022-10-21 05:12:42 -03:00
996de65688 chore: reintroduce thread sleeping + simplify fps counter 2022-10-21 05:12:42 -03:00
b97b66927f feat: implement double buffering 2022-10-21 05:12:42 -03:00
628d4cfb68 chore: clean up DMA code 2022-10-21 05:12:42 -03:00
ff002f18c6 feat: handle DMA IRQs (maybe?) 2022-10-21 05:12:42 -03:00
5d5d3827fb chore: contain Timers in a tuple rather than a struct 2022-10-21 05:12:42 -03:00
8826242bf3 chore: contain DMA Controllers in a tuple rather than a struct 2022-10-21 05:12:41 -03:00
4bb1aa06f7 chore: update git submodules 2022-10-21 05:12:41 -03:00
570ff8536c chore: resolve incorrect memory mirror in VRAM
+ stub GPIO registers on ROM Write
2022-10-21 05:12:41 -03:00
2c0d2b64a2 chore: stub a few I/O registers 2022-10-21 05:12:41 -03:00
1750c0a26e chore: allow 8-bit IO to BG0CNT and BG1CNT
BG0CNT and and BG1CNT now work properly in mario kart
2022-10-21 05:12:41 -03:00
a102d68e99 chore: define affine sprite attributes 2022-10-21 05:12:41 -03:00
61483b93e8 feat: stub mode 1 and 2 2022-10-21 05:12:40 -03:00
192d7645eb feat: implement mode 5
I wonder which obscure game makes heavy use of this mode
2022-10-21 05:12:40 -03:00
f1c68fb0de chore: comment ARM MSR code + Audio issues 2022-10-21 05:12:40 -03:00
cb74bfd280 chore: pass destoer's cond_invalid test 2022-10-21 05:12:40 -03:00
0d1717538b chore: misc print message improvements 2022-10-21 05:12:40 -03:00
896ae0935a chore: improvements to APU accuracy 2022-10-21 05:12:39 -03:00
1a23073424 fix: incorrect order-of-operations in ARM BL impl 2022-10-21 05:12:39 -03:00
36f3b0d381 chore: special case saving for ROMS without titles 2022-10-21 05:12:39 -03:00
74335cacbf chore: update README 2022-10-21 05:12:39 -03:00
1ee2dd9c5e chore: update most recent zig version 2022-10-21 05:12:39 -03:00
c2f3790dc3 feat: pass DenSinH's eeprom-test 2022-10-21 05:12:39 -03:00
746c28004f feat: implement EEPROM 2022-10-21 05:12:38 -03:00
084d4b28dd chore: implement I/O regsister for Minish Cap 2022-10-21 05:12:38 -03:00
ed6e83b121 chore: change default window scale to 4x 2022-10-21 05:12:38 -03:00
b827ba3a1c chore: write more debug log messages for unimplemented registers 2022-10-21 05:12:38 -03:00
0f343f0b74 chore: only sync to audio for now 2022-10-21 05:12:38 -03:00
7a670c6ed9 feat: panic on unimplemented I/O in ReleaseSafe/Debug but not ReleaseFast 2022-10-21 05:12:38 -03:00
e690f88cda chore: misc improvements 2022-10-21 05:12:37 -03:00
c7f537959b fix: improper lifetime for *Arm7tdmi ptr in Bus
*Arm7tdmi ptr is now assigned one scope up so that it lives as least
as long as Bus does
2022-10-21 05:12:37 -03:00
f074b703b3 feat: implement Noise
Kirby & The Amazing Mirror crashes only in ReleaseSafe / ReleaseBug.

TODO: Figure out why
2022-10-21 05:12:37 -03:00
f8159645e0 feat: implement ch3 2022-10-21 05:12:37 -03:00
cccb83a926 feat: implement ch2 2022-10-21 05:12:37 -03:00
af8fe66c43 feat: implement ch1
TODO: It's really loud
2022-10-21 05:12:36 -03:00
1f23aff22c chore: broken impl of ch1 2022-10-21 05:12:36 -03:00
e580b78020 feat: add audio resampler
Also implement extremely naive audio sync
2022-10-21 05:12:36 -03:00
a87a5ce273 chore: calculate apu sample rate a bit better 2022-10-21 05:12:36 -03:00
af1887e0a6 feat: schedule audio sampling on scheduler
DMA sound in games like Pokemon Emerald, Chobits, Love Hina, and Kirby:
Nightmare in Dream Land sound great save for conerns about resampling
2022-10-21 05:12:36 -03:00
14bb2f6fbe chore: improve timer behaviour 2022-10-21 05:12:36 -03:00
d144973acf chore: move some init code to functions 2022-10-21 05:12:35 -03:00
eecd78a008 feat: impelemt THUMB open bus 2022-10-21 05:12:35 -03:00
c03c142b14 feat: implement ARM read open bus 2022-10-21 05:12:35 -03:00
40f3600de2 fix: remove accidental rotation in ldrsh instructions 2022-10-21 05:12:35 -03:00
c08e331f77 chore: move log statement 2022-10-21 05:12:35 -03:00
a92989ed24 chore: remove magic numbers 2022-10-21 05:12:35 -03:00
6c61eb3537 chore: remove unnecessary 32MB allocation 2022-10-21 05:12:34 -03:00
05c1274ec1 chore: define more I/O read/writes 2022-10-21 05:12:34 -03:00
f5bc78ae22 chore: update README 2022-10-21 05:12:34 -03:00
27ad8772ea feat: pass jsmolka memory.gba 2022-10-21 05:12:34 -03:00
135987745c chore: ignore instead of logging errors for perf reasons 2022-10-21 05:12:34 -03:00
f039c891c7 feat: Initial Implementation of DMA Audio 2022-10-21 05:12:33 -03:00
e69f4cfafe chore: tick scheduler on memory access 2022-10-21 05:12:33 -03:00
a4020400da chore: log error on open bus in page 0x00 and 0x01 2022-10-21 05:12:33 -03:00
d4aac22e34 chore: rewrite I/O read/writes 2022-10-21 05:12:33 -03:00
601e717850 chore: reimplement bus read/writes 2022-10-21 05:12:33 -03:00
886b9abf3d fix: force align reads/writes in memory bus rather than in CPU 2022-10-21 05:12:32 -03:00
9c87b9820e fix: pass none.gba and kind of sram.gba from jsmolka test suite 2022-10-21 05:12:32 -03:00
1fe332a44f feat: implement GamePak out-of-bounds reads 2022-10-21 05:12:32 -03:00
b6d2084c96 chore: run zigfmt 2022-10-21 05:12:32 -03:00
ed896d976d chore: change implementation of rotr 2022-10-21 05:12:32 -03:00
677eecad41 chore: rewrite read/write methods for remainig Bus devices 2022-10-21 05:12:32 -03:00
74b6fa2ecc chore: mirror VRAM 2022-10-21 05:12:31 -03:00
effb6315e9 chore: write generic read/write for VRAM 2022-10-21 05:12:31 -03:00
3c8390a248 Merge branch 'main' of ssh://musuka.dev:2222/paoda/zba 2022-10-21 05:12:31 -03:00
8337a6dcd9 chore: update dependencies 2022-10-21 05:12:31 -03:00
ee194b03d0 chore: update README 2022-10-21 05:12:31 -03:00
2d8fa9c2f7 fix: don't create un-needed save file
If we don't know if we support a game's save type yet, avoid
creating a file for it.
2022-10-21 05:12:30 -03:00
b76481b34c chore: don't assume 1cpi when stepping by a frame 2022-10-21 05:12:30 -03:00
147f6ac9ec Revert "chore: tick on memory access instead of 1cpi"
This reverts commit 7f555095f2c49cbb06bca9fc2fd6cdee05a1b2cd.
2022-10-21 05:12:30 -03:00
84273cbdad chore: tick on memory access instead of 1cpi 2022-10-21 05:12:30 -03:00
885f92beeb feat: implement Flash backup cartrige kinds 2022-10-21 05:12:30 -03:00
f12800f2d0 chore: stub more apu I/O addresses 2022-10-21 05:12:30 -03:00
a93b335dea fix: account for subset of disallowed chars in save file names 2022-10-21 05:12:29 -03:00
ad9463dcb9 feat: implement SRAM saving and loading 2022-10-21 05:12:29 -03:00
242627199b chore: properly deallocate OAM buffer 2022-10-21 05:12:29 -03:00
22a8f67d81 fix: speed percentage in title is now accurate
We now properly account for full speed being 59.97Hz not, 59Hz or 60Hz
2022-10-21 05:12:29 -03:00
4ee0eed2e5 chore: make some variables const 2022-10-21 05:12:29 -03:00
20f39176c6 feat: minor performance improvements 2022-10-21 05:12:29 -03:00
ed792d71d3 feat: switch from BGR555 to RGBA8888 2022-10-21 05:12:28 -03:00
c3ae727ed1 fix: improve perf of instructions w/ rotr 2022-10-21 05:12:28 -03:00
0116dcdbe1 fix: improve frame limiting and fps counting 2022-10-21 05:12:28 -03:00
5ecbcc9f33 fix: implement proper SRAM mirroring and stub Flash 2022-10-21 05:12:28 -03:00
2d16e4a4e6 chore: move DMA and Timers from io to bus 2022-10-21 05:12:28 -03:00
bb9dc45e0c feat: define APU registers 2022-10-21 05:12:27 -03:00
9dcecc0d58 fix: move code in scheduler to ppu 2022-10-21 05:12:27 -03:00
92e63f5dd6 chore: create different types of emuloops 2022-10-21 05:12:27 -03:00
74cda6a1d0 fix: resolve relative sprite priority issues 2022-10-21 05:12:27 -03:00
d7354cca33 chore: improve accuracy of frame limiter 2022-10-21 05:12:27 -03:00
7684cf0f4a chore: improve accuracy of thread sleep in emu thread 2022-10-21 05:12:27 -03:00
3994c2c7c8 feat: implement video sync 2022-10-21 05:12:26 -03:00
a768d28e7c chore: organize io switch statements 2022-10-21 05:12:26 -03:00
efd99f16e0 fix: mirror SRAM
SRAM is mirrored in 64K chunks
TODO: According to GBATEK SRAM chips are 32K and mirrored
2022-10-21 05:12:26 -03:00
61d6288fec chore: don't panic on unknown bus and io writes/reads
This will lead to emulation bugs due to devices I've yet to implement but by
doing this a lot of games become playable "by default" such as Doom or
Kirby: Nightmare in Dream Land.

When implementing feature and/or debuggin make sure to set:
panic_on_und_bus and panic_on_und_io to true so that the emu crashes
on unknown reads/writes
2022-10-21 05:12:26 -03:00
e3e45cd129 feat: implement Timers 2022-10-21 05:12:26 -03:00
15191aedca fix: implement sprite coord overflow behaviour 2022-10-21 05:12:26 -03:00
63486f13f2 fix: resolve issues with sprite mirroring 2022-10-21 05:12:25 -03:00
17455e40d1 feat: Implement MVP of Mode 0 Sprites 2022-10-21 05:12:25 -03:00
d54e593276 chore: clean up io 2022-10-21 05:12:25 -03:00
c6a544a824 feat: fix tile flipping issue 2022-10-21 05:12:25 -03:00
e3ae3635bc chore: add some type definitions for sprites 2022-10-21 05:12:25 -03:00
6723bfb364 feat: improve DMA Transfer support 2022-10-21 05:12:25 -03:00
12c628e82c chore(ppu): resolve integer overflow regression 2022-10-21 05:12:24 -03:00
5f9abf69d3 feat(ppu): implement bg priority and transparency 2022-10-21 05:12:24 -03:00
351a687a2d chore: update README.md 2022-10-21 05:12:24 -03:00
68b0601a42 chore: replace unnecessarily complex sign extension implementation 2022-10-21 05:12:24 -03:00
9455ffe837 feat: pass beeg yoshi 2022-10-21 05:12:24 -03:00
02d2ff3e0c fix: palette id is a u16 not a u8 2022-10-21 05:12:24 -03:00
02572dd15c feat: DMA Transfer MVP 2022-10-21 05:12:23 -03:00
6d253cc74e feat(ppu): implement transparency + backdrop in mode 0 2022-10-21 05:12:23 -03:00
4885a86833 chore(io): replace some bitfields with enums 2022-10-21 05:12:23 -03:00
fd9ffb20b4 fix: better emulate behaviour of IO reads 2022-10-21 05:12:23 -03:00
56ef2b077a chore: document select unimplmented I/O registers
These registers are written to / read from Kirby: Nightmare in Dream Land
2022-10-21 05:12:23 -03:00
d4c7cfdf8b feat: impelement a barebones SRAM 2022-10-21 05:12:23 -03:00
4d75d156e5 feat: pass retAddr.gba 2022-10-21 05:12:22 -03:00
d30a4d7ee5 feat: implement Hblank and Vcount Interrupts
Also implemented unique behaviour when writing to IF
2022-10-21 05:12:22 -03:00
d1fce8ba75 chore: improve Bus log + panic messages 2022-10-21 05:12:22 -03:00
0f74e4fcf9 chore: improve io.zig 2022-10-21 05:12:22 -03:00
4afcbd0957 feat: implement mirroring for IWRAM EWRAM, OAM and PALRAM
Also realized I confused IWRAM and EWRAM. This is also fixed
TODO: Implemnt Mirroring for VRRAM
2022-10-21 05:12:22 -03:00
50dc31447d fix: resolve integer overflow in BG0 Drawing 2022-10-21 05:12:22 -03:00
acf1a10f91 chore: don't panic on 32-bit I/O 2022-10-21 05:12:21 -03:00
606f9b959a chore: stub CPU HALTing 2022-10-21 05:12:21 -03:00
f19b42baf3 chore: correct logic errors in map size 1 and 3 2022-10-21 05:12:21 -03:00
2a3d0c8b0d chore: properly write to VOFS and HOFS in 32-bit bus 2022-10-21 05:12:21 -03:00
4405fa6bbf feat: implement hofs and vofs on io bus 2022-10-21 05:12:21 -03:00
e2b2bf882a feat: implement scrolling 2022-10-21 05:12:21 -03:00
08e4eb1bf1 feat: add support for multiple BGs in Mode 0 2022-10-21 05:12:20 -03:00
f4b176a813 feat: document mode 0 2022-10-21 05:12:20 -03:00
efc7d817db feat: Mode 0 MVP 2022-10-21 05:12:20 -03:00
1b17b1eb0c chore: use zig slices for fun 2022-10-21 05:12:20 -03:00
fab6d4c2a2 chore: give DISPCNT DISPSTAT and VCOUNT to PPU struct 2022-10-21 05:12:20 -03:00
223a3403c0 chore: give io read/write functions access to the entire Bus 2022-10-21 05:12:20 -03:00
dfd0d064de feat: implement BG Scrolling Registers 2022-10-21 05:12:19 -03:00
0c4882e658 feat: impelemnt BG0,1,2CNT and IF 2022-10-21 05:12:19 -03:00
bfdad9fa32 feat: implement OAM 2022-10-21 05:12:19 -03:00
37fd8dab84 chore: squash bugs preventing swi_demo.gba from working 2022-10-21 05:12:19 -03:00
c143aefb01 chore(cpu): reimplement bank switching logic 2022-10-21 05:12:19 -03:00
05bf245b5a fix: don't mask away MSB in THUMB.5 add 2022-10-21 05:12:19 -03:00
f9e7128061 fix: properly decode format 11 instructions 2022-10-21 05:12:18 -03:00
603e4b6fdf chore: make use of scoped logging 2022-10-21 05:12:18 -03:00
9ed37340cc Merge branch 'main' of ssh://musuka.dev:2222/paoda/zba 2022-10-21 05:12:18 -03:00
599a1f2973 chore: remove TODOs and some useless imports 2022-10-21 05:12:18 -03:00
22424ca69c fix: improper condition check and initialization of register 2022-10-21 05:12:18 -03:00
67a785cc22 fix(cpu): force align thumb and arm block data transfers 2022-10-21 05:12:18 -03:00
4a4663607e chore: update README 2022-10-21 05:12:17 -03:00
4eb3842606 feat: pass arm.gba 2022-10-21 05:12:17 -03:00
1ee8b51b2b chore: reimplement ARM LDM/STM 2022-10-21 05:12:17 -03:00
130310e5cc chore: improve arm ldm/stm 2022-10-21 05:12:17 -03:00
e933d7e5c7 fix(cpu): force-align SWP reads and writes 2022-10-21 05:12:17 -03:00
44e8b5b882 fix: force-align ARM STRH reads 2022-10-21 05:12:17 -03:00
28361e8b7d fix: implement the same LDRSH logic as THUMB LDRSH 2022-10-21 05:12:16 -03:00
75921d6413 fix: PC is 12 ahead when it is rd in str and strb 2022-10-21 05:12:16 -03:00
17226d8f75 fix: listen to my past self
By deleting this line I go from test 234 to test 355 in arm.gba
2022-10-21 05:12:16 -03:00
0166999446 chore: update SDL.zig 2022-10-21 05:12:16 -03:00
2cb1bf834a chore: dont use std.mem.bytesToValue
the stdlib accounts for endianness, which isn't something we want.
2022-10-21 05:12:16 -03:00
8006ca31e6 chore: remove unnecessary @as calls 2022-10-21 05:12:16 -03:00
82b92b4733 feat: pass thumb.gba 2022-10-21 05:12:15 -03:00
bf42d3ae2f chore: account for empty rlist in THUMB LDM/STM 2022-10-21 05:12:15 -03:00
f63ae76931 fix(cpu): handle edge case in LDRSH 2022-10-21 05:12:15 -03:00
feded4ac25 chore: specify which compiler this project is built with 2022-10-21 05:12:15 -03:00
f046787523 chore: reorganize util.zig 2022-10-21 05:12:15 -03:00
bbd73550e8 fix: zero initialize all allocated memory 2022-10-21 05:12:15 -03:00
fce560dd89 chore: don't commit *.sh files 2022-10-21 05:12:14 -03:00
4776dc0788 Revert "fix: allow for 32-bit reads to KEYINPUT"
This reverts commit 3a51707280bcb35f3397c8a6da8441f95629bf07.
2022-10-21 05:12:14 -03:00
d8bd6da563 fix: resolve decoding mixup in THUMB format 8 instructions 2022-10-21 05:12:14 -03:00
b569a32170 fix: allow for 32-bit reads to KEYINPUT 2022-10-21 05:12:14 -03:00
06e20666bd chore: refactor ARMv4 decoding 2022-10-21 05:12:14 -03:00
36687c5c67 chore: add more debug information to CPU panic method 2022-10-21 05:12:14 -03:00
dd9b20030a chore: give more descriptive panic messages when changing mode fails 2022-10-21 05:12:13 -03:00
c0db2a987b chore: clean up THUMB instruction decoding 2022-10-21 05:12:13 -03:00
c3ff2ed6c1 feat: parse cartridge header 2022-10-21 05:12:13 -03:00
271f42cf0e feat: rename ARM and THUMB SWI functions 2022-10-21 05:12:13 -03:00
01e15584da chore: group THUMB and select ARM instructions together (same file) 2022-10-21 05:12:13 -03:00
17b91db2ef feat: integrate zig-clap with ZBA 2022-10-21 05:12:13 -03:00
3e786d02ac fix(cpu): properly decode format 7 and 8 2022-10-21 05:12:12 -03:00
c8f2db69df fix(cpu): resolve edge cases in THUMB Format 5 2022-10-21 05:12:12 -03:00
b4e0682801 fix(cpu): allow for select values to overflow
FuzzARM found these operations which panicked, when they should
have overflowed. These are now fixed

n = 8000
2022-10-21 05:12:12 -03:00
af10c1b076 feat(cpu): implement format 13
While bugs do exist, at this point all THUMB and ARMv4 instructions
have been implemented! Yay!
2022-10-21 05:12:12 -03:00
e6a0eab667 feat(cpu): implement THUMB format 17 2022-10-21 05:12:12 -03:00
523b9d2736 feat(cpu): implement THUMB format11 2022-10-21 05:12:12 -03:00
011d2f2f2a chore: update to latest zig nightly 2022-10-21 05:12:11 -03:00
c37546d273 chore: progress towards passing ldr/str thumb in armwrestler 2022-10-21 05:12:11 -03:00
fbedebb938 fix(cpu): properly negate in NEG 2022-10-21 05:12:11 -03:00
1773a3acc8 fix(cpu): reimplement THUMB offset shifts 2022-10-21 05:12:11 -03:00
058c02150c fix(cpu): op == 0b00 decodes to add in format 5 2022-10-21 05:12:11 -03:00
8d841ead50 fix(cpu): account for overflow in THUMB alu MUL 2022-10-21 05:12:10 -03:00
152dafbdf7 chore: use if-else when decoding THUMB instructions 2022-10-21 05:12:10 -03:00
7dbd2fc556 fix(cpu): account for rn in rlist in block data transfer 2022-10-21 05:12:10 -03:00
85e0924669 feat: implement LDM/STM behaviour when S is set 2022-10-21 05:12:10 -03:00
97919f646d feat(cpu): Pass all LDR/STR ARMwrestler tests 2022-10-21 05:12:10 -03:00
696cc1b359 feat(cpu): decode and implement all necessary ARM CPU instructions 2022-10-21 05:12:10 -03:00
151de2eab4 feat(cpu): implement ARM SWP and SWPB 2022-10-21 05:12:10 -03:00
e7f6464564 fix: resolve off by n * 2 when accessing Palette during BG Mode 4 2022-10-21 05:12:09 -03:00
da681c946e feat(cpu): Implement Multiply Long ARM instructions 2022-10-21 05:12:09 -03:00
e0e43eece5 fix: no buttons are pressed by default 2022-10-21 05:12:09 -03:00
7013389288 feat(cpu): implement format 18 THUMB instructions 2022-10-21 05:12:09 -03:00
443520ecae chore: more detailed panic message 2022-10-21 05:12:09 -03:00
96d7285111 feat(cpu): implement format 10 THUMB instructions 2022-10-21 05:12:08 -03:00
7e6fc44191 feat(cpu): implement SWP 2022-10-21 05:12:08 -03:00
9cb4ebaa7f fix(cpu): perform MUL with u64s, throw away upper 32 bits 2022-10-21 05:12:08 -03:00
3e4d7e7ed8 feat: implement keyboard input 2022-10-21 05:12:08 -03:00
3a6951d93d chore: don't panic on unsupported BG mode 2022-10-21 05:12:08 -03:00
391096872e chore: tempoarily disable fps counter 2022-10-21 05:12:08 -03:00
eebf6fcae4 chore: zero-initialize VRAM 2022-10-21 05:12:07 -03:00
8b7223cf35 chore: stub KeyInput I/O register 2022-10-21 05:12:07 -03:00
e1fec48a0e fix(cpu): properly decode multiply instructions 2022-10-21 05:12:07 -03:00
0778ee8dd7 feat(cpu): implement ARM multiply instructions 2022-10-21 05:12:07 -03:00
14d5160674 fix: allow 32-bit writes to DISPCNT 2022-10-21 05:12:07 -03:00
eabf787305 fix(cpu): properly decode ldm stm thumb instructions 2022-10-21 05:12:07 -03:00
980e4ff5dd fix(cpu): properly decode THUMB PUSH and POP at comptime 2022-10-21 05:12:06 -03:00
1ac193c506 fix(cpu): don't ignore 11th bit of THUMB BL offset 2022-10-21 05:12:06 -03:00
d6ed071bc6 feat(cpu): implement thumb push / pop and stub format 13 thumb instrs 2022-10-21 05:12:06 -03:00
a3d53d40fb feat(cpu): implement THUMB format 9 loads / stores 2022-10-21 05:12:06 -03:00
a17dfbe41f fix(cpu): resolve issues with unexpected PC value in THUMB 2022-10-21 05:12:06 -03:00
b9a81baa47 feat(cpu): implement THUMB ldmia stmia 2022-10-21 05:12:06 -03:00
97b236225e chore: implement THUMB format 4 instructions 2022-10-21 05:12:05 -03:00
8113146b86 chore: dedup code in THUMB instructions 2022-10-21 05:12:05 -03:00
e6625113db chore: refactor and genericize ARM data processing calculations 2022-10-21 05:12:05 -03:00
2643504eb5 chore: relocate barrel_shifter zig file 2022-10-21 05:12:05 -03:00
f7518d1bab feat(cpu): implement format2 THUMB instructions 2022-10-21 05:12:05 -03:00
800ca798cd feat(cpu): implement format19 THUMB instructions 2022-10-21 05:12:05 -03:00
d714ffb4f9 chore: account for THUMB BL instruction when mimicking mGBA logs 2022-10-21 05:12:04 -03:00
7bc186a03c feat(cpu): implement format16 THUMB instructions 2022-10-21 05:12:04 -03:00
b94b87d186 feat(cpu): implement format 1 THUMB instructions 2022-10-21 05:12:04 -03:00
0289be60ef fix: dont close file handle early 2022-10-21 05:12:04 -03:00
93922b65e3 feat(cpu): implement format 6 THUMB instructions 2022-10-21 05:12:04 -03:00
c6608748c6 chore: rename title 2022-10-21 05:12:04 -03:00
8e383d55d7 chore: refactor GBA Display Timings
This change should reflect that the Hblank bit of DISPSTAT is toggled on all scanlines
while also ensuring that the Vblank bit is set on all Vblank scanlines
2022-10-21 05:12:03 -03:00
8926026b5b chore: move a single statement lol 2022-10-21 05:12:03 -03:00
464479b986 chore: mark indexing methods as inline 2022-10-21 05:12:03 -03:00
de1c84914c feat: create emulator thread 2022-10-21 05:12:03 -03:00
8e7766e694 chore: disable logging by default 2022-10-21 05:12:03 -03:00
4858dbc5dc chore: revert fastboot changes 2022-10-21 05:12:03 -03:00
c4e131b92d chore: binary logging + file logging + DP chanes + fastBoot changes 2022-10-21 05:12:02 -03:00
90e0d9139c chore: ignore .bin files 2022-10-21 05:12:02 -03:00
2e54be76d6 chore: rename skipBios to fastBoot 2022-10-21 05:12:02 -03:00
7914268702 chore: set correct values for select banked registers on fast boot 2022-10-21 05:12:02 -03:00
4bdb85834c feat(cpu): implement SWI 2022-10-21 05:12:02 -03:00
f89a37936f chore(bios): allow reading from BIOS 2022-10-21 05:12:02 -03:00
8bb7ea6be6 fix(cpu): interim solution to weird program counter behaviour on illegal tst instruction 2022-10-21 05:12:01 -03:00
60a1f7fa99 chore(cpu): implement behaviour for undefined test instruction 2022-10-21 05:12:01 -03:00
b3b8182f85 fix(cpu): fix PC offset when barrel shifter and bit 4 of DP is set 2022-10-21 05:12:01 -03:00
19094b492e chore: remove reccomended extension 2022-10-21 05:12:01 -03:00
56e660714c fix(cpu): implement S set + rd == 15 case for data processing 2022-10-21 05:12:01 -03:00
eb632056a2 feat(cpu): implement banked registers 2022-10-21 05:12:01 -03:00
fbc9de0335 fix(cpu): improve MRS and MSR instructions 2022-10-21 05:12:01 -03:00
5c7539cd26 feat(cpu): implement CMN 2022-10-21 05:12:00 -03:00
7c20e5fdb5 fix(barrel_shifter): fix PC being 1 word ahead in barrel shifter 2022-10-21 05:12:00 -03:00
f79e7126ee feat(cpu): Implement RSC 2022-10-21 05:12:00 -03:00
15e92bc6af feat(cpu): implement RSB 2022-10-21 05:12:00 -03:00
47fc96fe00 feat(cpu): implement BIC 2022-10-21 05:12:00 -03:00
4ac5ad42c6 feat(cpu): implement EOR 2022-10-21 05:12:00 -03:00
c93153672f feat(cpu): implement ADD 2022-10-21 05:11:59 -03:00
a46dd448f4 feat(cpu): implement fix for ADC and implement SBC 2022-10-21 05:11:59 -03:00
01f75112ce chore(barrel_shifter): remove panic from ASR 2022-10-21 05:11:59 -03:00
051b98bc02 fix(barrel_shifter): should not modify cpsr when amount == 0 2022-10-21 05:11:59 -03:00
5d0bc1b335 chore(cpu): refactor the barrel shifter once again 2022-10-21 05:11:59 -03:00
43d011538e feat(cpu): implement ADC
ADC interacting w/ the Barrel Shifter is not working though
2022-10-21 05:11:59 -03:00
f3ad5e90ff feat(cpu): implement RRX for Barrel Shifter 2022-10-21 05:11:58 -03:00
9b867c02e0 feat(cpu): implement SUB in THUMB format 3 2022-10-21 05:11:58 -03:00
2ba09868ba feat(cpu): implement ARM SUB in data processing 2022-10-21 05:11:58 -03:00
9394754593 feat(cpu): implement MVN 2022-10-21 05:11:58 -03:00
41bab3d6ba chore(cpu): refactor barrel shifter 2022-10-21 05:11:58 -03:00
99b686b2d7 fix(cpu): use barrel shifter in data processing immediates 2022-10-21 05:11:58 -03:00
daad98bbfe feat(cpu): implement format 12 thumb instructions 2022-10-21 05:11:57 -03:00
2fb01577af feat(cpu): implement some already decoded format 3 instructions 2022-10-21 05:11:57 -03:00
96d21f27a5 feat(cpu): implement THUMB format 5 instructions 2022-10-21 05:11:57 -03:00
793110f315 chore: mgba log now supports printing THUMB instructions 2022-10-21 05:11:57 -03:00
5ed5c5d52d feat(cpu): implement like 1 THUMB instruction 2022-10-21 05:11:57 -03:00
01385ee46b chore: distinguish between undefined ARM and THUMB instr 2022-10-21 05:11:57 -03:00
0eba3aca1f chore(cpu): lay groundwork for THUMB instruction decoding and execution 2022-10-21 05:11:57 -03:00
83a5370196 chore(cpu): refactor ARM functions to make room for THUMB 2022-10-21 05:11:56 -03:00
b0b6247f06 fix(cpu): fix conditions for GT cond 2022-10-21 05:11:56 -03:00
2a33716166 fix(cpu): fix imm value calculation in MSR 2022-10-21 05:11:56 -03:00
9b26454c72 fix(cpu): resolve off-by-one error when executing LDM 2022-10-21 05:11:56 -03:00
97b933d9ea feat(cpu): implement branch and exchange
If I want to continue with armwrestler, I'll have to implement
THUMB instructions now
2022-10-21 05:11:56 -03:00
ff70aadfdb fix(cpu): make Data Processing instructions r15-aware 2022-10-21 05:11:55 -03:00
ae53f92d40 fix(cpu): make LDRH and STRH aware of r15 2022-10-21 05:11:55 -03:00
f51e1d3154 fix(cpu): account for r15 in LDR and STR instructions 2022-10-21 05:11:55 -03:00
a21f94569f fix(cpu): flip two branches in PSR Transfer execution 2022-10-21 05:11:55 -03:00
b9255bffe7 feat(cpu): implement MSR and MRS 2022-10-21 05:11:55 -03:00
e1f8400343 feat(cpu): stub PSR Transfer instructions 2022-10-21 05:11:55 -03:00
52493831cc chore(io): implement IE and IME 2022-10-21 05:11:54 -03:00
00ba7afac4 chore: remove some magic constants 2022-10-21 05:11:54 -03:00
c703352ac3 Merge branch 'main' of ssh://musuka.dev:2222/paoda/zba 2022-10-21 05:11:54 -03:00
97e663febf fix(bus): remove accidental recursion 2022-10-21 05:11:54 -03:00
3891b54f42 chore: ignores for building on windows 2022-10-21 05:11:54 -03:00
9a5959e46c fix(cpu): write results of ORR to destination register 2022-10-21 05:11:54 -03:00
780c717409 feat(cpu): implement TEQ 2022-10-21 05:11:53 -03:00
34c6df344d feat(cpu): Implement ORR 2022-10-21 05:11:53 -03:00
670347d4a0 feat(bus): implement IWRAM and EWRAM 2022-10-21 05:11:53 -03:00
e0c4b3b407 fix(ppu): properly access Mode 4 palette 2022-10-21 05:11:53 -03:00
cffffab8ea feat(cpu): refactor LDM/STM 2022-10-21 05:11:53 -03:00
527bd2889e feat(cpu): implement LDM/STM 2022-10-21 05:11:53 -03:00
15dc4ce03a chore(io): DISPSTAT bits 3 and 4 better match GBATEK documentation 2022-10-21 05:11:52 -03:00
4f629227ab fix(cpu): fix off-by-word bug in BL 2022-10-21 05:11:52 -03:00
caa799853e feat(bus): have VCOUNT be addressable on the bus 2022-10-21 05:11:52 -03:00
3590215d33 feat(ppu): implement Mode 4
Implementation is not tested. Pending on LDM and STM so that I can
run beeg.gba
2022-10-21 05:11:52 -03:00
d6aafc61bd chore(io): rename some io bitfield fields 2022-10-21 05:11:52 -03:00
357211a4cc chore: remove premature inlines 2022-10-21 05:11:52 -03:00
c4c4332485 chore: add FPS counter 2022-10-21 05:11:51 -03:00
2cec8d9f70 chore: improve code clarity 2022-10-21 05:11:51 -03:00
8348d7c4bc feat(ppu): improve timings + implement BG mode 3 bitmap 2022-10-21 05:11:51 -03:00
c33068d831 fix: allocate framebuf on heap 2022-10-21 05:11:51 -03:00
f28b963f9d chore: add code for heap alloc of white texture 2022-10-21 05:11:51 -03:00
7fc77f993f chore(gui): switch from RGBA8888 to BGR5555 to match BG Mode 3 2022-10-21 05:11:51 -03:00
0e0b21d8c3 feat: draw white texture using SDL2 2022-10-21 05:11:50 -03:00
f3ad0eb3aa fix(ppu): deallocate palette RAM on cleanup 2022-10-21 05:11:50 -03:00
036b861b05 chore: code cleanup 2022-10-21 05:11:50 -03:00
880546468c chore(bus): refactor bus.zig 2022-10-21 05:11:50 -03:00
1a9c9ba4cb chore: refactor instruction exec code 2022-10-21 05:11:50 -03:00
a9e7140a88 chore(io): alias @This() to Self in io.zig 2022-10-21 05:11:50 -03:00
808633deb7 chore: refactor bios.zig and pak.zig 2022-10-21 05:11:49 -03:00
ee4fcd926b fix: by convention deinit() should not take pointers to self 2022-10-21 05:11:49 -03:00
9d1229fe0c feat: implement PPU Timings in Scheduler 2022-10-21 05:11:49 -03:00
d54c8df7b3 feat(sched): add HBlank and VBlank events to the scheduler 2022-10-21 05:11:49 -03:00
d495f5b4c5 feat: implement S (when rd != 15) for several data processing instructions 2022-10-21 05:11:49 -03:00
788bef188d feat: implement dedicated Barrel Shifter SHL and SHR 2022-10-21 05:11:49 -03:00
bff9be03cc chore: stub TST 2022-10-21 05:11:48 -03:00
44424e0687 chore: comment-out logging by default 2022-10-21 05:11:48 -03:00
4b43dcd256 fix(cpu): improve LDR/STR write-back logic 2022-10-21 05:11:48 -03:00
47805fb60c feat(bus): implement Palette RAM and DISPSTAT 2022-10-21 05:11:48 -03:00
abe2fc431e fix(bus): restrict Game ROM and VRAM to a 16-bit bus 2022-10-21 05:11:48 -03:00
46c694d95a fix(cpu): properly implement SUB/CMP CSPSR carry bit condition 2022-10-21 05:11:48 -03:00
faced77161 fix(cpu): resolve reversed if statement + write back on W = 0 2022-10-21 05:11:47 -03:00
32f0b9d71c chore: add mgba compatible (minus disasm) log function 2022-10-21 05:11:47 -03:00
bbdcc0a8c2 chore: rename CPSR u32 from val to raw 2022-10-21 05:11:47 -03:00
67bf975034 chore: remove print statements 2022-10-21 05:11:47 -03:00
da7300a78c chore: remove all memory leaks 2022-10-21 05:11:47 -03:00
5c5179a553 feat(ppu): implement VRAM 2022-10-21 05:11:47 -03:00
dcf78d0f76 fix(emu): prevent infinite loop when advancing scheduler 2022-10-21 05:11:46 -03:00
4836ea3bcf fix(io): fix DISPCNT is at wrong IO address 2022-10-21 05:11:46 -03:00
182392bf1c feat(cpu): properly implement STR STRH and STRB 2022-10-21 05:11:46 -03:00
c6de540c8a feat(cpu): implement skipBios method 2022-10-21 05:11:46 -03:00
82fb5e7a93 chore: panic on read from BIOS
GBA Bios requires a lot of implemented features, so we're ignoring it
for now
2022-10-21 05:11:46 -03:00
cbcc6282df feat(bus): add Io Struct
Also, add more information to all panic messages
2022-10-21 05:11:46 -03:00
614ac4a262 chore: rename consturctors to fit convention 2022-10-21 05:11:45 -03:00
80d49e03d6 chore: move bitfield library to lib director
I'd presonally prefer to use a git submodule here but It doesn't quite
seem like git submodules are possible for individual files. I'll have to
check with FlorenceOS every once and a while to ensure that there are no
lingering soundness issues with the library.

Thanks to @N00byEdge for this wonderful library!
2022-10-21 05:11:45 -03:00
7016fcdb79 chore: use bitfield library 2022-10-21 05:11:45 -03:00
f030889d6c feat(bus): emu is now able to read from user-provided BIOS 2022-10-21 05:11:45 -03:00
d50aff30c9 feat(bus): implement Gameboy Advance MMIO 2022-10-21 05:11:45 -03:00
5cbfae677a feat: implement ROM CLI argument 2022-10-21 05:11:45 -03:00
d660babecd fix(cpu): purposely overflow when calculating PC during branch 2022-10-21 05:11:44 -03:00
cb06c20864 feat(cpu): implement condition field behaviour 2022-10-21 05:11:44 -03:00
c98e8d384a chore: conform to zig style guides 2022-10-21 05:11:44 -03:00
446eeba094 chore: run zig fmt 2022-10-21 05:11:44 -03:00
e841bf44ca chore(cpu): iron out some false assumptions 2022-10-21 05:11:44 -03:00
1991bd8525 feat: implement LDR STR 2022-10-21 05:11:44 -03:00
6c6d7d463d chore: run zig fmt 2022-10-21 05:11:43 -03:00
acdf13cb7b chore: add reccomended vscode extensions 2022-10-21 05:11:43 -03:00

Diff Content Not Available