ams-hackers / gbforth

👾 A Forth-based Game Boy development kit
https://gbforth.org
MIT License
128 stars 24 forks source link

Some optimizations #331

Closed meithecatte closed 4 years ago

meithecatte commented 4 years ago

"10 print" now runs much faster :D

tkers commented 4 years ago

Thank you for your contribution! The swap optimisation makes a world of difference! 🔥

I'll have a quick look at the other changes as well soon :)

meithecatte commented 4 years ago

On Fri, May 15, 2020 at 08:19:09AM -0700, Tijn Kersjes wrote:

@tkers commented on this pull request.

@@ -413,7 +413,7 @@ instruction add, ~n ~A ~~> %11 %000 %110 op, n, 2 cycles :: ~(HL) ~A ~~> %10 %000 %110 op, 2 cycles :: ~ss ~HL ~~> %00 ss1 %001 op, 2 cycles ::

  • ~e ~SP ~~> %11 %101 %000 op, e, 4 cycles ::
  • ~e ~SP ~~> %11 %101 %000 op, e_, 4 cycles ::

I'm very curious how you managed to find this bug 😄 Hats off!

Thankfully, the routines got assembled at an address which made $0002 out of range of a jr.