Commit Graph
75 Commits
Author SHA1 Message Date
Matthew Laux 8bfb3cf5bd clean up unused code and stale comments 2026-08-08 00:44:56 -05:00
Matthew Laux b9a4e32fbb remove unused 68020 mode 2026-08-08 00:25:48 -05:00
Matthew Laux 3b5529d8c1 move memory loads to their own file, was getting long 2026-08-08 00:06:12 -05:00
Matthew Laux 9142963262 migrate to 4k page size - bank switch optimization pt 2 2026-08-07 20:06:24 -05:00
Matthew Laux 084e45c920 WIP bank switch optimize 2026-08-07 19:25:35 -05:00
Matthew Laux 4af08af085 fix miscompiling data after loop end as code - fixes Pokemon Yellow 2026-08-04 23:15:06 -05:00
Matthew Laux ad1d7b392c fix noise being too loud, fix duty cycle of square waves, cache joypad value for fast read 2026-08-01 14:03:03 -05:00
Matthew Laux 985666d727 "deadline-gating budget_touch" omg 2026-07-27 16:49:53 -05:00
Matthew Laux f621a0d703 use GetKeys to avoid wasting time in GetNextEvent, use shared memory access helpers instead of inlining 2026-07-27 16:42:16 -05:00
Matthew Laux 42acc41a0d WIP compiler improvements 2026-07-27 11:24:31 -05:00
Matthew Laux db7a18ec31 don't call patch helper at all for HRAM, v2.0.1 2026-07-25 23:49:58 -05:00
Matthew Laux 0b7c9e7501 fix spurious writes into the cgb_color_lut 2026-07-24 14:34:29 -05:00
Matthew Laux aa0bf50bfa handle timing edge cases, don;t loop if condition is false on entry (fixes trainer entry in pokered) 2026-07-22 20:50:25 -05:00
Matthew Laux 71bb51ec88 instruction optimization round 1 2026-07-14 17:52:49 -05:00
Matthew Laux efae2406d0 remove fused branches, complexity wasn't worth it 2026-07-14 14:46:12 -05:00
Matthew Laux a778e8a79b track cycles in the block then count them at the end. kind of a wash? 2026-07-14 14:27:49 -05:00
Matthew Laux 00de54b442 add slow path for call/ret/rst (fixes SML2) 2026-07-12 23:38:46 -05:00
Matthew Laux 3d6d618420 fix constant folding in banked area (fixes DW 1+2) 2026-07-12 20:07:40 -05:00
Matthew Laux faddf5d469 make m68k_offsets static (code block size -= 256) 2026-07-12 17:49:07 -05:00
Matthew Laux ed37a7c185 half-remove cycles_per_exit, optimize STAT interrupts, but will remove 2026-07-12 17:18:06 -05:00
Matthew Laux f6a9a1fd56 host side runner (gb6run) with tests from mooneye/blargg/games 2026-07-11 22:04:11 -05:00
Matthew Laux 7610d3ce96 biased page tables, scaled index on 68020+, interrupt fixes (that may or may not have actually improved compatibility) 2026-07-08 20:12:32 -05:00
Tanner Fokkens 39d9dcca74 Forgot to add other files... 2026-02-01 15:29:19 -08:00
Tanner Fokkens 3cbc9337f8 Fix stack corruption in CALL/RET/RST and add STOP instruction support
Major fixes:
- CALL, RET, RST, and their conditional variants now properly check
  stack_in_ram before accessing memory via A3. Previously they assumed
  A3 was always a valid native pointer, causing memory corruption when
  in slow mode (A3 held raw GB SP value like 0xFFFE).

- Fixed initial SP setup to use fast mode with A3 pointing to actual
  HRAM memory instead of holding the raw GB SP value.

- STOP instruction now calls runtime handler to check for CGB speed
  switch instead of immediately halting. Enables double-speed mode.

- HDMA cancellation: writing to HDMA5 with bit 7=0 while HDMA is active
  now cancels the transfer (fixes Pokemon Crystal).

Safety improvements:
- Added src_ptr bounds check to prevent m68k_offsets array overflow
- Added PC validation to reject execution in VRAM/external RAM
- Added PC history ring buffer for crash debugging

Tested: Klax, Link's Awakening DX, Wario Land 3 now boot successfully.
2026-02-01 00:58:48 -08:00
Matthew Laux 23f752af23 move timing functions to their own file, LY wait on registers too 2026-01-25 22:16:22 -06:00
Matthew Laux 882ace0d13 make LY read faster, revert wack HALT change 2026-01-25 20:53:56 -06:00
Matthew Laux da7a7b31cd add "dec sp" - missed that one - allows DK Land to boot, not pretty though 2026-01-25 19:18:06 -06:00
Matthew Laux 6972ac5cc3 calculate mid-frame LY read correctly instead of cycling through - fixes Metroid enemies 2026-01-25 17:42:29 -06:00
Matthew Laux e9000a3c84 rewrite stack for the millionth time 2026-01-15 21:09:57 -06:00
Matthew Laux f8e508ecd2 LY wait detection, fix block overflow bug, add new menus, MBC5 2026-01-15 16:46:17 -06:00
Matthew Laux 1927fc04db arena allocator for blocks, remove duplicate blocks by tracking backward branches 2026-01-14 23:48:19 -06:00
Matthew Laux 0ce2ffd60e simplify cb ops, basic HALT, fast path for dmg_read/write16 2026-01-14 17:06:15 -06:00
Matthew Laux 814a9ccf0b dmg_write16 instead of two dmg_write for stack ops 2026-01-13 23:40:28 -06:00
Matthew Laux 74f91d802e prepare for dmg_read/write16, rename functions, simplify interop 2026-01-13 22:37:04 -06:00
Matthew Laux 9f91bd7526 add 1x scale, audio refactor and fix wave frequency issue, remove crazy SP detection and always go through dmg_read/write 2026-01-13 21:47:25 -06:00
Matthew Laux c611c553ca fix flag bugs (wow that was hard to find), make DIV better, add color icons 2026-01-12 19:24:03 -06:00
Matthew Laux 8f0100d322 flush instruction cache after patching block... this fixed so many random crashes 2026-01-10 21:06:23 -06:00
Matthew Laux 6a2ec58fbd fix "dec h", precompute LCD palette on palette change, make profiling percent based 2026-01-09 19:35:08 -06:00
Matthew Laux f472ce46bd use 68k ccr instead of GB flag format. it's getting crashy 2026-01-09 00:42:26 -06:00
Matthew Laux eab85d0205 optimize ldh 2026-01-08 22:30:28 -06:00
Matthew Laux ea687bed84 finish options dialog 2026-01-08 20:28:10 -06:00
Matthew Laux 9969a0b483 split out stack funcs to separate file, start on key mappings dialog 2026-01-07 23:27:33 -06:00
Matthew Laux 68937eb3f3 patch blocks to jump directly to next block 2026-01-07 18:53:53 -06:00
Matthew Laux bdeb43c0b3 more timing............................ 2026-01-05 15:09:39 -06:00
Matthew Laux f3864fef08 keep track of cycles per instruction, remove Mac timing hack 2026-01-04 23:30:22 -06:00
Matthew Laux 5b3ad01b68 move next_pc to d3 2026-01-04 18:11:43 -06:00
Matthew Laux 698fe41688 more efficient context switch into JIT, remove old compiler files, fix vblank flag bug 2026-01-04 17:45:52 -06:00
Matthew Laux c0ae5c3926 delete old unused interpreter code 2026-01-03 16:18:22 -06:00
Matthew Laux 6126315141 conditional call, LRU block cache, MBC support, much more complicated dispatcher :/ 2026-01-03 13:58:29 -06:00
Matthew Laux 1d5960a56e inline dmg_read/dmg_write, keep function call for ff00 2026-01-02 21:22:43 -06:00