Exemple #1
0
        public bool OpJmp(BytecodeStream code)
        {
            ushort address = code.ReadChar();

            if (code.TrySetPosition(address))
            {
                return(true);
            }

            return(PushError("参照不可能な箇所にジャンプしようとしました"));
        }
Exemple #2
0
        public bool OpStoreD(BytecodeStream code)
        {
            int memPtr = code.ReadChar();
            int regId  = code.ReadByte();

            if (TryGetReg(regId, out uint val))
            {
                return(_memory.TrySetUi32(memPtr, val));
            }
            return(PushRegError(regId));
        }
Exemple #3
0
        public bool OpMoveIW(BytecodeStream code)
        {
            int    regId = code.ReadByte();
            ushort imm   = code.ReadChar();

            if (!TrySetRegUi16(regId, imm))
            {
                return(PushRegError(regId));
            }
            return(true);
        }
Exemple #4
0
        public bool OpLoadD(BytecodeStream code)
        {
            int regId  = code.ReadByte();
            int memPtr = code.ReadChar();

            if (_memory.TryGetUi32(memPtr, out uint val32))
            {
                return(TrySetRegUi32(regId, val32));
            }
            return(PushError($"メモリ範囲外を指定しました => ptr: {memPtr}"));
        }
Exemple #5
0
        public bool OpSysCall(BytecodeStream code)
        {
            ushort methodId = code.ReadChar();

            if (methodId < 0 || methodId > _methods.Count)
            {
                return(PushError("組み込み関数IDが不正です"));
            }

            CreateStatus();
            _itr = _methods[methodId].Invoke(_instance, new object[] { _status }) as IEnumerator <int>;

            return(true);
        }