Exemplo n.º 1
0
        public void Assemble()
        {
            int offset = 0;

            offset      = (index * 18) + 0x1D0040; offset++;
            rom[offset] = messageBox != 0 ? (byte)((messageBox - 1) << 1) : (byte)0xFE;
            offset++;
            rom[offset] = maskLowX;
            Bits.SetBit(rom, offset, 7, maskLock); offset++;
            rom[offset] = maskLowY; offset++;
            rom[offset] = maskHighX; offset++;
            rom[offset] = maskHighY; offset++;
            rom[offset] = xNegL2; offset++;
            rom[offset] = yNegL2; offset++;
            rom[offset] = xNegL3; offset++;
            rom[offset] = yNegL3;
            Bits.SetBit(rom, offset, 7, infiniteScrolling); offset++;
            Bits.SetBit(rom, offset, 0, scrollWrapL1_HZ);
            Bits.SetBit(rom, offset, 1, scrollWrapL1_VT);
            Bits.SetBit(rom, offset, 2, culexA);
            Bits.SetBit(rom, offset, 3, scrollWrapL2_HZ);
            Bits.SetBit(rom, offset, 4, scrollWrapL2_VT);
            Bits.SetBit(rom, offset, 5, culexB);
            Bits.SetBit(rom, offset, 6, scrollWrapL3_HZ);
            Bits.SetBit(rom, offset, 7, scrollWrapL3_VT);
            offset++;
            rom[offset] = 0;
            switch (syncL2_HZ)
            {
            case 0: Bits.SetBitsByByte(rom, offset, 0x03, false); break;

            case 1: Bits.SetBitsByByte(rom, offset, 0x02, true); break;

            case 2: Bits.SetBitsByByte(rom, offset, 0x03, true); break;

            case 3: Bits.SetBitsByByte(rom, offset, 0x01, true); break;
            }
            switch (syncL2_VT)
            {
            case 0: Bits.SetBitsByByte(rom, offset, 0x0C, false); break;

            case 1: Bits.SetBitsByByte(rom, offset, 0x08, true); break;

            case 2: Bits.SetBitsByByte(rom, offset, 0x0C, true); break;

            case 3: Bits.SetBitsByByte(rom, offset, 0x04, true); break;
            }
            switch (syncL3_HZ)
            {
            case 0: Bits.SetBitsByByte(rom, offset, 0x30, false); break;

            case 1: Bits.SetBitsByByte(rom, offset, 0x20, true); break;

            case 2: Bits.SetBitsByByte(rom, offset, 0x30, true); break;

            case 3: Bits.SetBitsByByte(rom, offset, 0x10, true); break;
            }
            switch (syncL3_VT)
            {
            case 0: Bits.SetBitsByByte(rom, offset, 0xC0, false); break;

            case 1: Bits.SetBitsByByte(rom, offset, 0x80, true); break;

            case 2: Bits.SetBitsByByte(rom, offset, 0xC0, true); break;

            case 3: Bits.SetBitsByByte(rom, offset, 0x40, true); break;
            }
            offset++;
            switch (scrollDirectionL2)
            {
            case 0: rom[offset] = 0x00; break;

            case 1: rom[offset] = 0x08; break;

            case 2: rom[offset] = 0x10; break;

            case 3: rom[offset] = 0x18; break;

            case 4: rom[offset] = 0x20; break;

            case 5: rom[offset] = 0x28; break;

            case 6: rom[offset] = 0x30; break;

            case 7: rom[offset] = 0x38; break;
            }
            switch (scrollSpeedL2)
            {
            case 0: Bits.SetBitsByByte(rom, offset, 0x00, true); break;

            case 4: Bits.SetBitsByByte(rom, offset, 0x01, true); break;

            case 2: Bits.SetBitsByByte(rom, offset, 0x02, true); break;

            case 1: Bits.SetBitsByByte(rom, offset, 0x03, true); break;

            case 3: Bits.SetBitsByByte(rom, offset, 0x04, true); break;

            case 5: Bits.SetBitsByByte(rom, offset, 0x05, true); break;

            case 6: Bits.SetBitsByByte(rom, offset, 0x07, true); break;
            }
            Bits.SetBit(rom, offset, 7, scrollL2Bit7);
            offset++;
            switch (scrollDirectionL3)
            {
            case 0: rom[offset] = 0x00; break;

            case 1: rom[offset] = 0x08; break;

            case 2: rom[offset] = 0x10; break;

            case 3: rom[offset] = 0x18; break;

            case 4: rom[offset] = 0x20; break;

            case 5: rom[offset] = 0x28; break;

            case 6: rom[offset] = 0x30; break;

            case 7: rom[offset] = 0x38; break;
            }
            switch (scrollSpeedL3)
            {
            case 0: Bits.SetBitsByByte(rom, offset, 0x00, true); break;

            case 4: Bits.SetBitsByByte(rom, offset, 0x01, true); break;

            case 2: Bits.SetBitsByByte(rom, offset, 0x02, true); break;

            case 1: Bits.SetBitsByByte(rom, offset, 0x03, true); break;

            case 3: Bits.SetBitsByByte(rom, offset, 0x04, true); break;

            case 5: Bits.SetBitsByByte(rom, offset, 0x05, true); break;

            case 6: Bits.SetBitsByByte(rom, offset, 0x07, true); break;
            }
            Bits.SetBit(rom, offset, 7, scrollL3Bit7);
            offset++;
            rom[offset] = 0;
            Bits.SetBit(rom, offset, 4, ripplingWater);
            Bits.SetBitsByByte(rom, offset, prioritySet, true);
            offset++;
            switch (effectsL3)
            {
            case 0: rom[offset] = 0x00; break;

            case 1: rom[offset] = 0x01; break;

            case 2: rom[offset] = 0x02; break;

            case 3: rom[offset] = 0x03; break;

            case 4: rom[offset] = 0x05; break;

            case 5: rom[offset] = 0x06; break;

            case 6: rom[offset] = 0x07; break;

            case 7: rom[offset] = 0x08; break;

            case 8: rom[offset] = 0x09; break;

            case 9: rom[offset] = 0x0A; break;

            case 10: rom[offset] = 0x0B; break;

            case 11: rom[offset] = 0x0C; break;

            case 12: rom[offset] = 0x0D; break;

            case 13: rom[offset] = 0x0E; break;

            case 14: rom[offset] = 0x0F; break;

            case 15: rom[offset] = 0x10; break;

            case 16: rom[offset] = 0x11; break;

            case 17: rom[offset] = 0x12; break;

            case 18: rom[offset] = 0x14; break;

            case 19: rom[offset] = 0x15; break;

            case 20: rom[offset] = 0x16; break;

            case 21: rom[offset] = 0x17; break;

            case 22: rom[offset] = 0x18; break;
            }
            offset++;
            switch (effectsNPC)
            {
            case 0: rom[offset] = 0x00; break;

            case 1: rom[offset] = 0x05; break;

            case 2: rom[offset] = 0x06; break;

            case 3: rom[offset] = 0x07; break;

            case 4: rom[offset] = 0x0A; break;

            case 5: rom[offset] = 0x0B; break;

            case 6: rom[offset] = 0x0C; break;

            case 7: rom[offset] = 0x0D; break;

            case 8: rom[offset] = 0x0F; break;

            case 9: rom[offset] = 0x10; break;

            case 10: rom[offset] = 0x12; break;

            case 11: rom[offset] = 0x13; break;

            case 12: rom[offset] = 0x15; break;

            case 13: rom[offset] = 0x16; break;

            case 14: rom[offset] = 0x17; break;

            case 15: rom[offset] = 0x18; break;

            case 16: rom[offset] = 0x19; break;

            case 17: rom[offset] = 0x1A; break;

            case 18: rom[offset] = 0x1B; break;

            case 19: rom[offset] = 0x1D; break;

            case 20: rom[offset] = 0x1E; break;

            case 21: rom[offset] = 0x1F; break;

            case 22: rom[offset] = 0x20; break;

            case 23: rom[offset] = 0x21; break;

            case 24: rom[offset] = 0x22; break;
            }
        }