Skip to content

FibonacciSequence

フィボナッチ数列の先頭20項を出力します。複数のローカル変数相当の値を更新するループのサンプルです。

JSONファイルを開く

json
{
  "version": 1,
  "comment": "フィボナッチ数列の先頭20項を出力します。複数のローカル変数相当の値を更新するループのサンプルです。",
  "data": [
    {
      "name": "__a",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__b",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__next",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__index",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__index_next",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__zero",
      "type": "SystemInt32",
      "value": 0
    },
    {
      "name": "__one",
      "type": "SystemInt32",
      "value": 1
    },
    {
      "name": "__twenty",
      "type": "SystemInt32",
      "value": 20
    },
    {
      "name": "__condition",
      "type": "SystemBoolean",
      "value": false
    },
    {
      "name": "__loop_condition",
      "type": "SystemBoolean",
      "value": false
    }
  ],
  "code": [
    {
      "name": "_start",
      "export": true,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__zero"
        },
        {
          "op": "PUSH",
          "operand": "__a"
        },
        {
          "op": "COPY"
        },
        {
          "op": "PUSH",
          "operand": "__one"
        },
        {
          "op": "PUSH",
          "operand": "__b"
        },
        {
          "op": "COPY"
        },
        {
          "op": "PUSH",
          "operand": "__zero"
        },
        {
          "op": "PUSH",
          "operand": "__index"
        },
        {
          "op": "COPY"
        },
        {
          "op": "JUMP",
          "operand": "_loop"
        }
      ]
    },
    {
      "name": "_loop",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__index"
        },
        {
          "op": "PUSH",
          "operand": "__twenty"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_LessThan__SystemInt32_SystemInt32__SystemBoolean",
          "argumentCount": 2,
          "return": "__loop_condition"
        },
        {
          "op": "JUMP_IF_FALSE",
          "operand": "_end"
        },
        {
          "op": "JUMP",
          "operand": "_body"
        }
      ]
    },
    {
      "name": "_body",
      "export": false,
      "instructions": [
        {
          "op": "PUSH",
          "operand": "__a"
        },
        {
          "op": "EXTERN",
          "signature": "UnityEngineDebug.__Log__SystemObject__SystemVoid",
          "argumentCount": 1
        },
        {
          "op": "PUSH",
          "operand": "__a"
        },
        {
          "op": "PUSH",
          "operand": "__b"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Addition__SystemInt32_SystemInt32__SystemInt32",
          "argumentCount": 2,
          "return": "__next"
        },
        {
          "op": "POP"
        },
        {
          "op": "PUSH",
          "operand": "__b"
        },
        {
          "op": "PUSH",
          "operand": "__a"
        },
        {
          "op": "COPY"
        },
        {
          "op": "PUSH",
          "operand": "__next"
        },
        {
          "op": "PUSH",
          "operand": "__b"
        },
        {
          "op": "COPY"
        },
        {
          "op": "PUSH",
          "operand": "__index"
        },
        {
          "op": "PUSH",
          "operand": "__one"
        },
        {
          "op": "EXTERN",
          "signature": "SystemInt32.__op_Addition__SystemInt32_SystemInt32__SystemInt32",
          "argumentCount": 2,
          "return": "__index_next"
        },
        {
          "op": "PUSH",
          "operand": "__index"
        },
        {
          "op": "COPY"
        },
        {
          "op": "JUMP",
          "operand": "_loop"
        }
      ]
    },
    {
      "name": "_end",
      "export": false,
      "instructions": []
    }
  ]
}