Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write byte in GPU #19

Open
saku-koodari opened this issue Aug 28, 2016 · 3 comments
Open

Write byte in GPU #19

saku-koodari opened this issue Aug 28, 2016 · 3 comments

Comments

@saku-koodari
Copy link
Owner

Code snippet 1:

                case 5:
                    _raster = value;
                    break; // TODO: in the source, there was break; missing. Find out whether it was on purpose or not.
                // OAM DMA
                case 6:
                    for (var i = 0; i < SCREEN_WIDTH; i++)
                    {
                        // var val = MMU.rb((value << 8) + i);
                        // _oam[i] = vval;
                        // UpdateOAM(0xFE00 + i, val);
                        throw new NotImplementedException("// TODO: uncomment lines above. NOTE: MMU.rd (memory.ReadByte)");
                    }
                    break;
@saku-koodari
Copy link
Owner Author

Code snippet 2:

                    // TODO: #1 Look the source (javascript) You can see, that 
                    //          there are used obj0 and obj1 instead object1 and object2.
                    //          Find out wheter that is done on purpose or not.
                    //
                    // TODO: #2 Combine cases below, due to they are higly similar.
                    //
                    // TODO: #3 You Enum again for those Colors

                // OBJ0 palette mapping
                case 8:
                    for (var i = 0; i < 4; i++)
                    {
                        switch ((value >> (i * 2)) & 3)
                        {
                            case 0: _palette.Object1[i] = 255; break;
                            case 1: _palette.Object1[i] = 192; break;
                            case 2: _palette.Object1[i] = 96; break;
                            case 3: _palette.Object1[i] = 0; break;
                        }
                    }
                    break;

                // OBJ1 palette mapping
                case 9:
                    for (var i = 0; i < 4; i++)
                    {
                        switch ((value >> (i * 2)) & 3)
                        {
                            case 0: _palette.Object2[i] = 255; break;
                            case 1: _palette.Object2[i] = 192; break;
                            case 2: _palette.Object2[i] = 96; break;
                            case 3: _palette.Object2[i] = 0; break;
                        }
                    }
                    break;

@saku-koodari
Copy link
Owner Author

As you can see, colors are hardcored. They have to softcode.

@saku-koodari
Copy link
Owner Author

Commit d6a0756 softcoded colors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant