Commit Graph

24 Commits

Author SHA1 Message Date
Jesse Talavera-Greenberg e973236203
Refactor `NDS` and `DSi` to be objects (#1893)
* First crack at refactoring NDS and DSi into objects

- Remove all global/`static` variables in `NDS` and related classes
- Rely more on virtual dispatch when we need to pick methods at runtime
- Pass `NDS&` or `DSi&` to its constituent components where necessary
- Introduce some headers or move some definitions to break `#include` cycles

* Refactor the frontend to accommodate the core's changes

* Move up `SchedList`'s declaration

- Move it to before the components are initialized so the `map`s inside are initialized
- Fields in C++ are initialized in the order they're declared

* Fix a crash when allocating memory

* Fix JIT-free builds

* Fix GDB-free builds

* Fix Linux builds

- Explicitly qualify some member types in NDS, since they share the same name as their classes

* Remove an unnecessary template argument

- This was causing the build to fail on macOS

* Fix ARM and Android builds

* Rename `Constants.h` to `MemConstants.h`

* Add `NDS::IsRunning()`

* Use an `#include` guard instead of `#pragma once`
2023-11-28 23:16:41 +01:00
Jesse Talavera-Greenberg 346dd4006e
Move all core types into namespaces (#1886)
* Reorganize namespaces

- Most types are now moved into the `melonDS` namespace
- Only good chance to do this for a while, since a big refactor is next

* Fix the build
2023-11-25 18:32:09 +01:00
Arisotura ac38faef14 update copyright years 2023-11-04 00:21:46 +01:00
RSDuck 8ec8a6ce09 ehhh got that one wrong, now it should be right 2023-01-06 20:17:04 +01:00
RSDuck eadfeec7ab hopefully correct overflow flag for ADC and SBC
also use inline functions instead of macros to make things more neat
2023-01-06 20:11:11 +01:00
Arisotura 35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
Pedro f74387a8c1
Implement NO$GBA debug registers. (#1110)
* Implement NO$GBA debug registers.

NO$GBA comes with 4 debug registers that allow a ROM to print text to
the emulator terminal and 2 other status registers, one with the name of the
emulator and the other with the clock cycles count. This commit
implements them for the ARMv5 processor.

Some small things to note:
 - `NocashPrint` was changed and now it takes an address to _the string_ instead of the flags before it (those
don't do anything anyways).
 - The "Emulation ID" register contains the string "melonDS " followed by version, _not_ "NO$GBA"

* Fix styling issue and improve comment regarding NO$GBA message flags
2021-05-27 12:15:16 +02:00
RSDuck 436b3c4c1d update copyright year and add missing GPL headers 2021-03-12 20:07:40 +01:00
wheremyfoodat 03b465c5e2
Fix edge case in the division engine, fix edge case in the CPU (#1003)
* Fixed division edge case: Div64/32 and Div64/64 set the remainder to 0 if dividend == INT64_MIN && divisor == -1

* Fixed CPU edge case where ARM9 ALU ops would switch to Thumb even when they shouldn't

* Only clear the lowest bit of the jump address in ALU ops with rd==15 (on recommendation of RSDuck)
2021-02-19 23:58:41 +01:00
RSDuck 887ad27ed8 implement carry setting ALU op with imm 2020-07-25 22:08:43 +02:00
RSDuck af31d25086 fix #672 2020-07-25 21:16:23 +02:00
Arisotura 83f8e11bc1 update copyright years 2020-02-14 20:18:08 +01:00
Arisotura 1b98a3e3a0 fix 'shift by register' operands: always only take the lower 8 bits of the register, fix handling for LSL/LSR >32
fixes #479
2019-06-27 14:05:51 +02:00
Arisotura b0efde8bf7 also, update copyright name 2019-01-22 15:58:29 +01:00
StapleButter b6481a28ac make nocashprint work from ARM code too.
fixes #315
2018-12-31 20:58:58 +01:00
StapleButter e7a4fe11ed add nocashPrint type shit 2018-12-12 02:48:37 +01:00
StapleButter 172fb4876a begin work on general timing renovation. way shitty because it behaves as if caches were off, so everything will be slow as shit. 2018-12-04 17:54:10 +01:00
StapleButter fea7955675 fixor copyright years. 2018-09-15 02:32:13 +02:00
StapleButter d50e7e4686 fix SMULWx/SMLAWx. fixes #78, finally 2017-12-29 03:17:32 +01:00
StapleButter 49f8aec656 fix some shit 2017-06-13 17:44:35 +02:00
StapleButter 3499949129 * send undefined instructions to the proper exception handler
* make ARM9-only instructions fail on ARM7
2017-06-13 15:09:39 +02:00
StapleButter bbd251ddbc fix QADD/QSUB/QDADD/QDSUB, those would write their result to the wrong register.
also make them ARM9-only.
2017-06-13 11:17:22 +02:00
StapleButter 3a61ed0a91 allow crapoed THUMB hireg ADD/CMP/MOV 2017-03-31 02:20:29 +02:00
StapleButter 8a4ed8f41c reorganize repo, move shit around 2017-03-16 23:01:22 +01:00