Commit Graph

20 Commits

Author SHA1 Message Date
c4ded6d077 cpu: get blarg CPU instruction test 6 passing
Its been too long since a checkin, but here's some of the
improvements:

- Support for diffing with other emulators
- Better disassmbed output
- New CPU instructions implemented
- Lots of CPU fixes
2018-08-26 22:57:35 -07:00
6f9ed73ef2 gbdb: refactor command parsing
Instead of passing around a string and having each command parse off
additional tokens, have a single command to parse all of the tokens,
and the commands can pass around a token list. Then each
command/subcommand can pop off whatever arguments they need.
2018-07-22 21:55:10 -07:00
f659af54e1 gbdb,video: improve logging
Add more runtime toggles and add the ability to log to a file for
faster runs and better searchability.
2018-07-22 16:15:10 -07:00
53cd4ab7e5 video: first signs of life
The video code now writes out a bmp file per-frame. With this patch
applied, the Nintendo logo is rendered in each frame.

There is still plenty of work to be done. Pretty much everything is
hardcoded to make the bootrom work.
2018-07-20 20:08:15 -07:00
cd66ad8a89 memory: separate the memory-related code into it's own file
After doing a little reading about the way the memory banks are
mapped, it looks like this code is going to grow. Separate it into
it's own file.

While we're at it, make gb_mem_read() a proper function instead of a
callback. Because these functions are used so frequently, this
corresponds to a ~10-20% performance benefit (due to LTO).
2018-07-09 05:28:14 +00:00
c8ba18f6e3 gbdb: re-indent the file
To make up for variations in editor config.
2018-07-09 02:41:42 +00:00
ea2ea1e293 gbdb,cpu,video: reduce number of calls to cycle functions
Instead of calling cpu_cycle() and video_cycle() once per emulated
cycle, call cpu_cycle() once per emulated instruction. This should not
have any obvious effects on the emulation (as currently written),
because all of the memory reads and writes are done in the first
"cycle" of the instruction.

This patch results in a substantial performance gain (>100%, if I
recall correctly).
2018-07-09 02:38:50 +00:00
447276d029 boot_test: updates for changes to breakpoints
Because now they actually stop in the correct place.

Also, some other fixups because I'm too lazy to properly split patches
for a personal project.
2018-07-09 02:36:20 +00:00
213c08fa18 gbdb: remove some conditionals from mem_read()
By reading directly from a "RAM" array, and copying in the cart data
over the old bootrom.

Also, some other fixups because I'm too lazy to properly split patches
for a personal project.
2018-07-09 02:34:24 +00:00
1bb3d8512a cpu,gbdb: implement better breakpoints
Previously, gbdb had to check several signals, including the current
PC, to determine when do_run() should stop. This code was hotpath and
unecessarily slow.

Instead, leverage a n undefined instruction (0xd3) as a breakpoint instruction.
When the CPU emulation encounters this instruction, it will call a callback
which is implemented by gbdb. This can set a simple flag which is less expensive to
query.

Finally, both the signal handler and the breakpoint callback set specific
"paused" flags and a generic "pause" flag. Now, do_run() can simply check
the generic "paused" flag, then use the specific flags to determine the
stop reason.

This change increased performance by ~10% on Raspberry Pi.
2018-07-01 23:59:50 +00:00
01c1c9e393 gbdb: change cycle calculation for better performance
The conditions are hotpath, so pre-calcuate the end cycle count instead of doing it every loop.

I didn't verify that the compiler wasn't doing this anyway, but this won't hurt.
2018-07-01 21:57:25 +00:00
25e26804a9 cpu: correct some print formats and use more "native" types
These were found while running on a Raspberry Pi (ARM).
2018-07-01 21:43:49 +00:00
0a3340f4fc Fix assertion on $af register and add more debug output to asserts 2018-06-17 14:34:09 -07:00
bd95e66280 fixup whitespace 2018-02-19 05:41:26 +00:00
29ce85b87c gbdb: optimize breakpoints and add runto 2018-02-19 05:13:40 +00:00
9b69088b35 pushing to dev 2018-02-18 12:51:10 -08:00
92f9ef591b gbdb: add scripting features for automatic testing 2018-01-01 16:50:14 -08:00
3976d8635e gbdb: add support for multiple commands on single line 2017-11-19 18:25:50 -08:00
e5acc3088c treewide: restucture source tree per project
Signed-off-by: Max Regan <mgregan2@gmail.com>
2017-05-10 22:40:12 -07:00
6e2f4096a2 gb-emu: initial commit
Add a mostly non-functional Gameboy CPU and the skeleton
of a Gameboy assembler intended for unit tests.
2017-05-10 22:40:12 -07:00