Giter Site home page Giter Site logo

Comments (3)

Nebuleon avatar Nebuleon commented on June 23, 2024

-- Quote: Drenn, 2013-02-23, http://gbatemp.net/threads/gameyob-a-gameboy-emulator-for-ds.343407/page-3#post-4563539

I was able to fix a few problems with flags, but I don't know about instructions E8 and F8. I'd better take a look at Gambatte.

-- Quote: End

from gameyob.

Nebuleon avatar Nebuleon commented on June 23, 2024

I've looked into Gambatte. It appears the half-carry flag is bit 4 (overflowing from 0xF into 0x10), not 12 (overflowing from 0xFFF into 0x1000).

See this code:

#define sp_plus_n(sumout) do { \
    unsigned sp_plus_n_var_n; \
    PC_READ(sp_plus_n_var_n); \
    sp_plus_n_var_n = (sp_plus_n_var_n ^ 0x80) - 0x80; \
    \
    const unsigned sp_plus_n_var_sum = SP + sp_plus_n_var_n; \
    CF = SP ^ sp_plus_n_var_n ^ sp_plus_n_var_sum; \
    HF2 = CF << 5 & 0x200; /* this sets the half-carry flag to bit 4's value */ \
    ZF = 1; \
    cycleCounter += 4; \
    (sumout) = sp_plus_n_var_sum & 0xFFFF; \
} while (0)

from gameyob.

Stewmath avatar Stewmath commented on June 23, 2024

I tried adapting this code, and it didn't really work. When I googled it I came up with this, blargg explaining to dwedit how E8 and F8 work. It has several differences, including that the negative and zero flags should be cleared. Also the carry flag is apparently based on the lower byte of SP added with the immediate value, considered unsigned. Maybe gambatte does this, I didn't really study all that XORing in detail. Gameyob passes the test now, but it's strange that those other differences exist since gambatte apparently passes the test too.

from gameyob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.