Commit Graph

3026 Commits

Author SHA1 Message Date
Lior Halphon 6f2b36cacb The HALT bug also happens on CGBs, regardless of DMG mode. 2016-09-20 22:59:25 +03:00
Lior Halphon 97eb3fe209 Detect games stuck on blank screens 2016-09-20 22:59:00 +03:00
Lior Halphon f88c9d299b Merge branch 'master' into rateless_apu 2016-09-20 20:05:03 +03:00
Lior Halphon f46414b7b1 Updated struct version :( 2016-09-20 20:04:38 +03:00
Lior Halphon 37e895352f Volumes no longer doubles 2016-09-20 19:58:30 +03:00
Lior Halphon a026f8b26d Update README.md 2016-09-20 01:45:02 +03:00
Lior Halphon f049284324 Emulate the HALT bug on a DMG 2016-09-20 01:22:21 +03:00
Lior Halphon 1a3a96762b CPU cleanup 2016-09-18 23:50:04 +03:00
Lior Halphon ed31358934 Forgot to emulate LCDC bit 0! 2016-09-18 21:00:05 +03:00
Lior Halphon fe51805ed7 Incorrect constant name 2016-09-16 18:24:38 +03:00
Lior Halphon f4c5cf20bc Cleanup of ret_cc 2016-09-16 13:27:32 +03:00
Lior Halphon 71d4ba21f2 Added a tick-counting debugger command 2016-09-16 11:58:31 +03:00
Lior Halphon 4beb946468 Slight APU optimization 2016-09-14 22:49:35 +03:00
Tim Allen 45a725e4b7 Update to v101r18 release.
byuu says:

Changelog:

  - added 30 new PAL games to icarus (courtesy of Mikerochip)
  - new version of libco no longer requires mprotect nor W|X permissions
  - nall: default C compiler to -std=c11 instead of -std=c99
  - nall: use `-fno-strict-aliasing` during compilation
  - updated nall/certificates (hopefully for the last time)
  - updated nall/http to newer coding conventions
  - nall: improve handling of range() function

I didn't really work on higan at all, this is mostly just a release
because lots of other things have changed.

The most interesting is `-fno-strict-aliasing` ... basically, it joins
`-fwrapv` as being "stop the GCC developers from doing *really* evil
shit that could lead to security vulnerabilities or instabilities."

For the most part, it's a ~2% speed penalty for higan. Except for the
Sega Genesis, where it's a ~10% speedup. I have no idea how that's
possible, but clearly something's going very wrong with strict aliasing
on the Genesis core.

So ... it is what it is. If you need the performance for the non-Genesis
cores, you can turn it off in your builds. But I'm getting quite sick of
C++'s "surprises" and clever compiler developers, so I'm keeping it on
in all of my software going forward.
2016-09-14 21:55:53 +10:00
Tim Allen c6fc15f8d2 Update to v101r18 release.
byuu says:

Changelog:

  - added 30 new PAL games to icarus (courtesy of Mikerochip)
  - new version of libco no longer requires mprotect nor W|X permissions
  - nall: default C compiler to -std=c11 instead of -std=c99
  - nall: use `-fno-strict-aliasing` during compilation
  - updated nall/certificates (hopefully for the last time)
  - updated nall/http to newer coding conventions
  - nall: improve handling of range() function

I didn't really work on higan at all, this is mostly just a release
because lots of other things have changed.

The most interesting is `-fno-strict-aliasing` ... basically, it joins
`-fwrapv` as being "stop the GCC developers from doing *really* evil
shit that could lead to security vulnerabilities or instabilities."

For the most part, it's a ~2% speed penalty for higan. Except for the
Sega Genesis, where it's a ~10% speedup. I have no idea how that's
possible, but clearly something's going very wrong with strict aliasing
on the Genesis core.

So ... it is what it is. If you need the performance for the non-Genesis
cores, you can turn it off in your builds. But I'm getting quite sick of
C++'s "surprises" and clever compiler developers, so I'm keeping it on
in all of my software going forward.
2016-09-14 21:55:53 +10:00
Lior Halphon f274cbc2ec Read wave form while playing 2016-09-13 17:40:10 +03:00
Lior Halphon 594aea2d5a APU is now being run lazily 2016-09-13 17:33:48 +03:00
Lior Halphon eefc998e43 Removed for loop in APU 2016-09-13 17:06:35 +03:00
Lior Halphon ff7b8a6854 Removed doubles, reorganized code a bit 2016-09-13 16:57:16 +03:00
Lior Halphon b95860c034 Making the APU independent of sample rate 2016-09-13 16:55:26 +03:00
Lior Halphon 43be91f032 Slightly more readable code. 2016-09-13 01:20:18 +03:00
Lior Halphon 71a9b7eb77 Updated change log and incremented version to 0.7 2016-09-10 20:59:02 +03:00
Lior Halphon 6e86dbcebb Cocoa port now shows the open dialog if no ROM is open. 2016-09-10 19:46:42 +03:00
Lior Halphon 95cfb114a2 Properly setting MBC RAM 2016-09-10 13:25:18 +03:00
Lior Halphon 6d836b9f48 Fixed APU bug that prevented some games from working 2016-09-10 02:20:44 +03:00
Lior Halphon ad604036a5 More false-negative fixes 2016-09-09 19:29:14 +03:00
Lior Halphon 7bafb6a843 Cocoa port: remember breakpoints and watchpoints after reset 2016-09-07 00:44:00 +03:00
Lior Halphon 62ecadeb57 Fixed another reset-while-debugging deadlock in Cocoa 2016-09-07 00:37:11 +03:00
Lior Halphon 01fc137256 Fixed an APU issue that might occur when having more than one GB_gameboy_t object 2016-09-06 22:36:16 +03:00
Lior Halphon ae003ee020 Fixed several automation false negatives. 2016-09-06 18:00:05 +03:00
Tim Allen d6e9d94ec3 Update to v101r17 release.
byuu says:

Changelog:

  - Z80: added most opcodes between 0x00 and 0x3f (two or three hard
    ones missing still)
  - Z80: redid register declaration *again* to handle AF', BC', DE',
    HL' (ugggggh, the fuck? Alternate registers??)
      - basically, using `#define <register name>` values to get around
        horrendously awful naming syntax
  - Z80: improved handling of displace() so that it won't ever trigger
    on (BC) or (DE)
2016-09-06 23:53:14 +10:00
Lior Halphon 603b8969ab Correct (disconnected) serial emulation. 2016-09-06 13:13:14 +03:00
Tim Allen 2fbbccf985 Update to v101r16 release.
byuu says:

Changelog:

  - Z80: implemented 113 new instructions (all the easy
    LD/ADC/ADD/AND/OR/SBC/SUB/XOR ones)
  - Z80: used alternative to castable<To, With> type (manual cast inside
    instruction() register macros)
  - Z80: debugger: used register macros to reduce typing and increase
    readability
  - Z80: debugger: smarter way of handling multiple DD/FD prefixes
    (using gotos, yay!)
  - ruby: fixed crash with Windows input driver on exit (from SuperMikeMan)

I have no idea how the P/V flag is supposed to work on AND/OR/XOR, so
that's probably wrong for now. HALT is also mostly a dummy function for
now. But I typically implement those inside instruction(), so it
probably won't need to be changed? We'll see.
2016-09-06 10:09:33 +10:00
Tim Allen 4c3f58150c Update to v101r15 release.
byuu says:

Changelog:

  - added (poorly-named) castable<To, With> template
  - Z80 debugger rewritten to make declaring instructions much simpler
  - Z80 has more instructions implemented; supports displacement on
    (IX), (IY) now
  - added `Processor::M68K::Bus` to mirror `Processor::Z80::Bus`
      - it does add a pointer indirection; so I'm not sure if I want to
        do this for all of my emulator cores ...
2016-09-04 23:51:27 +10:00
Lior Halphon ab2e532cc3 Added link to automation results 2016-09-03 23:24:47 +03:00
Lior Halphon 84a4701733 Auto-detect common crashes, fixed logs about unsupported carts not being written. 2016-09-03 22:59:23 +03:00
Tim Allen d91f3999cc Update to v101r14 release.
byuu says:
Changelog:

  - rewrote the Z80 core to properly handle 0xDD (IX0 and 0xFD (IY)
    prefixes
  - added Processor::Z80::Bus as a new type of abstraction
  - all of the instructions implemented have their proper T-cycle counts
    now
  - added nall/certificates for my public keys

The goal of `Processor::Z80::Bus` is to simulate the opcode fetches being
2-read + 2-wait states; operand+regular reads/writes being 3-read. For
now, this puts the cycle counts inside the CPU core. At the moment, I
can't think of any CPU core where this wouldn't be appropriate. But it's
certainly possible that such a case exists. So this may not be the
perfect solution.

The reason for having it be a subclass of Processor::Z80 instead of
virtual functions for the MasterSystem::CPU core to define is due to
naming conflicts. I wanted the core to say `in(addr)` and have it take
the four clocks. But I also wanted a version of the function that didn't
consume time when called. One way to do that would be for the core to
call `Z80::in(addr)`, which then calls the regular `in(addr)` that goes to
`MasterSystem::CPU::in(addr)`. But I don't want to put the `Z80::`
prefix on all of the opcodes. Very easy to forget it, and then end up not
consuming any time. Another is to use uglier names in the
`MasterSystem::CPU` core, like `read_`, `write_`, `in_`, `out_`, etc. But,
yuck.

So ... yeah, this is an experiment. We'll see how it goes.
2016-09-03 21:26:04 +10:00
Lior Halphon a6c5a8fdaa Fixed a bug that caused the Cocoa port to freeze sometimes if the emulator was reset while debugging. 2016-09-03 13:34:49 +03:00
Lior Halphon a2d77b1754 Warn about unsupported cartridges/MBCs 2016-09-03 04:00:37 +03:00
Lior Halphon a746c726ee Added basic automatic ROM tester 2016-09-03 03:39:32 +03:00
Tim Allen 7c96826eb0 Update to v101r13 release.
byuu says:

Changelog:

  - MS: added ms/bus
  - Z80: implemented JP/JR/CP/DI/IM/IN instructions
  - MD/VDP: added window layer emulation
  - MD/controller/gamepad: fixed d2,d3 bits (Altered Beast requires
    this)

The Z80 is definitely a lot nastier than the LR35902. There's a lot of
table duplication with HL→IX→IY; and two of them nest two levels deep
(eg FD CB xx xx), so the design may change as I implement more.
2016-08-27 14:48:21 +10:00
Lior Halphon 833cd88aea Allow compilation with precompiled boot ROMs. 2016-08-27 01:30:11 +03:00
Tim Allen 5df717ff2a Update to v101r12 release.
byuu says:

Changelog:

  - new md/bus/ module for bus reads/writes
      - abstracts byte/word accesses wherever possible (everything but
        RAM; forces all but I/O to word, I/O to byte)
      - holds the system RAM since that's technically not part of the
        CPU anyway
  - added md/controller and md/system/peripherals
  - added emulation of gamepads
  - added stub PSG audio output (silent) to cap the framerate at 60fps
    with audio sync enabled
  - fixed VSRAM reads for plane vertical scrolling (two bugs here: add
    instead of sub; interlave plane A/B)
  - mask nametable read offsets (can't exceed 8192-byte nametables
    apparently)
  - emulated VRAM/VSRAM/CRAM reads from VDP data port
  - fixed sprite width/height size calculations
  - added partial emulation of 40-tile per scanline limitation (enough
    to fix Sonic's title screen)
  - fixed off-by-one sprite range testing
  - fixed sprite tile indexing
  - Vblank happens at Y=224 with overscan disabled
      - unsure what happens when you toggle it between Y=224 and Y=240
        ... probably bad things
  - fixed reading of address register for ADDA, CMPA, SUBA
  - fixed sign extension for MOVEA effect address reads
  - updated MOVEM to increment the read addresses (but not writeback)
    for (aN) mode

With all of that out of the way, we finally have Sonic the Hedgehog
(fully?) playable. I played to stage 1-2 and through the special stage,
at least. EDIT: yeah, we probably need HIRQs for Labyrinth Zone.

Not much else works, of course. Most games hang waiting on the Z80, and
those that don't (like Altered Beast) are still royally screwed. Tons of
features still missing; including all of the Z80/PSG/YM2612.

A note on the perihperals this time around: the Mega Drive EXT port is
basically identical to the regular controller ports. So unlike with the
Famicom and Super Famicom, I'm inheriting the exension port from the
controller class.
2016-08-22 08:11:24 +10:00
Lior Halphon ee4907949b Support for RTC latching. Fixes #4. 2016-08-21 22:33:57 +03:00
Lior Halphon 92c2b22735 Cocoa port now remembers the mute switch 2016-08-21 21:58:33 +03:00
Tim Allen f7ddbfc462 Update to v101r11 release.
byuu says:

Changelog:

  - 68K: fixed NEG/NEGX operand order
  - 68K: fixed bug in disassembler that was breaking trace logging
  - VDP: improved sprite rendering (still 100% broken)
  - VDP: added horizontal/vertical scrolling (90% broken)

Forgot:

  - 68K: fix extension word sign bit on indexed modes for disassembler
    as well
  - 68K: emulate STOP properly (use r.stop flag; clear on IRQs firing)

I'm really wearing out fast here. The Genesis documentation is somehow
even worse than Game Boy documentation, but this is a far more complex
system.

It's a massive time sink to sit here banging away at every possible
combination of how things could work, only to see no positive
improvements. Nothing I do seems to get sprites to do a goddamn thing.

squee says the sprite Y field is 10-bits, X field is 9-bits. genvdp says
they're both 10-bits. BlastEm treats them like they're both 10-bits,
then masks off the upper bit so it's effectively 9-bits anyway.

Nothing ever bothers to tell you whether the horizontal scroll values
are supposed to add or subtract from the current X position. Probably
the most basic detail you could imagine for explaining horizontal
scrolling and yet ... nope. Nothing.

I can't even begin to understand how the VDP FIFO functionality works,
or what the fuck is meant by "slots".

I'm completely at a loss as how how in the holy hell the 68K works with
8-bit accesses. I don't know whether I need byte/word handlers for every
device, or if I can just hook it right into the 68K core itself. This
one's probably the most major design detail. I need to know this before
I go and implement the PSG/YM2612/IO ports-\>gamepads/Z80/etc.

Trying to debug the 68K is murder because basically every game likes to
start with a 20,000,000-instruction reset phase of checksumming entire
games, and clearing out the memory as agonizingly slowly as humanly
possible. And like the ARM, there's too many registers so I'd need three
widescreen monitors to comfortably view the entire debugger output lines
onscreen.

I can't get any test ROMs to debug functionality outside of full games
because every **goddamned** test ROM coder thinks it's acceptable to tell
people to go fetch some toolchain from a link that died in the late '90s
and only works on MS-DOS 6.22 to build their fucking shit, because god
forbid you include a 32KiB assembled ROM image in your fucking archives.

... I may have to take a break for a while. We'll see.
2016-08-21 12:50:05 +10:00
Lior Halphon 33da8734fe Mouse hiding is now only enabled during full screen mode 2016-08-21 00:38:26 +03:00
Lior Halphon 9479fce7d0 Update README.md 2016-08-20 23:05:13 +03:00
Lior Halphon 0420538034 Update README.md 2016-08-20 23:03:28 +03:00
Lior Halphon 276fe53385 Added icon and version information to Windows port 2016-08-20 22:59:03 +03:00