Exemplo n.º 1
0
        static bool LOAD_AND_JUMP(byte[] commandBytes)
        {
            int targetBank = commandBytes[3];
            int ROMStart   = cvt.int32(commandBytes, 4);
            int ROMEnd     = cvt.int32(commandBytes, 8);

            EmulationState.instance.LoadBank(targetBank, ROMStart, ROMEnd, false);
            //EmulationState.instance.banks[targetBank] = new EmulationState.RAMBank(targetBank, ROMStart, ROMEnd);
            if (currentBankIndex > -1)
            {
                EmulationState.instance.banks[targetBank].ptrsRAM.Add((currentBankIndex << 0x18) | cursor);
            }
            else if (currentBankIndex == -2)
            {
                EmulationState.instance.banks[targetBank].ptrsROM.Add(cursor);
            }

            EmulationState.RAMBank jumpTargetBank = EmulationState.instance.banks[commandBytes[0xC]];
            returnAddresses.Push(cursor);
            if (jumpTargetBank != null)
            {
                cursor = cvt.int32(commandBytes, 0xC) & 0xFFFFFF;
                ReadAmount(jumpTargetBank.value);
            }
            else
            {
                Log("Skipped jump to RAM bank 0x" + (commandBytes[0xC]).ToString("X") + ".");
            }
            cursor = returnAddresses.Pop();
            return(commandBytes[0] == 0x00);
        }
Exemplo n.º 2
0
        static bool BRANCH(byte[] commandBytes)
        {
            uint target = cvt.uint32(commandBytes, 4);

            EmulationState.RAMBank jumpTargetBank = EmulationState.instance.banks[target >> 0x18];
            returnAddresses.Push(cursor);
            if (jumpTargetBank != null)
            {
                cursor = (int)(target & 0xFFFFFF);
                ReadAmount(EmulationState.instance.banks[target >> 0x18].value);
            }
            else
            {
                Log("Skipped jump to RAM bank 0x" + (target >> 0x18).ToString("X") + ".");
            }
            cursor = returnAddresses.Pop();
            return(commandBytes[3] == 0);
        }