def run
      @values = { pc: 0, a: 0, x: 0 }
      loop do
        break if @values[:ret] # break when returned

        yield(@values) if block_given?
        inst = @instructions[pc]
        op, *args = inst.symbolize
        case op
        when :ret then ret(args.first) # ret
        when :ld then ld(args[0], args[1]) # ld/ldx
        when :st then st(args[0], args[1]) # st/stx
        when :jmp then jmp(args[0]) # directly jmp
        when :cmp then cmp(*args[0, 4]) # jmp with comparsion
        when :alu then alu(args[0], args[1]) # alu
        when :misc then misc(args[0]) # misc: txa/tax
        end
        set(:pc, get(:pc) + 1) if %i[ld st alu misc].include?(op)
      end
      @values
    end
def run
      @values = { pc: 0, a: 0, x: 0 }
      loop do
        break if @values[:ret] # break when returned

        yield(@values) if block_given?
        inst = @instructions[pc]
        op, *args = inst.symbolize
        case op
        when :ret then ret(args.first) # ret
        when :ld then ld(args[0], args[1]) # ld/ldx
        when :st then st(args[0], args[1]) # st/stx
        when :jmp then jmp(args[0]) # directly jmp
        when :cmp then cmp(*args[0, 4]) # jmp with comparsion
        when :alu then alu(args[0], args[1]) # alu
        when :misc then misc(args[0]) # misc: txa/tax
        end
        set(:pc, get(:pc) + 1) if %i[ld st alu misc].include?(op)
      end
      @values
    end
Instantiate a {Emulator} object.

 All parameters except +instructions+ are optional, while a warning will be shown if unset data being accessed.
 @param [Array<Instruction::Base>] instructions
 @param [Integer] sys_nr
   Syscall number.
 @param [Array<Integer>] args
   Syscall arguments
 @param [Integer] instruction_pointer
   Program counter address when this syscall invoked.
 @param [Symbol] arch
   If not given, use system architecture as default.

   See {SeccompTools::Util.supported_archs} for list of supported architectures.
 Run emulation!
 @return [Hash{Symbol, Integer => Integer}]