debugger/wam_debugger/src/main/com/thesett/aima/logic/fol/wam/debugger/monitor/ByteCodeMonitor.java
private void renderInstructions(Iterable<WAMInstruction> instructions, int row, int address)
    {
        for (WAMInstruction instruction : instructions)
        {
            WAMLabel label = instruction.getLabel();

            labeledTable.put(ADDRESS, row, String.format("%08X", address));
            labeledTable.put(LABEL, row, (label == null) ? "" : (label.toPrettyString() + ":"));
            labeledTable.put(MNEMONIC, row, instruction.getMnemonic().getPretty());

            int fieldMask = instruction.getMnemonic().getFieldMask();

            String arg = "";

            for (int i = 2; i < 32; i = i * 2)
            {
                if ((fieldMask & i) != 0)
                {
                    if (!"".equals(arg))
                    {
                        arg += ", ";
                    }

                    switch (i)
                    {
                    case 2:
                        arg += Integer.toString(instruction.getReg1());
                        break;

                    case 4:
                        arg += Integer.toString(instruction.getReg2());
                        break;

                    case 8:

                        FunctorName fn = instruction.getFn();
                        if (fn != null)
                        {
                            arg += fn.getName() + "/" + fn.getArity();
                        }

                        break;

                    case 16:

                        WAMLabel target1 = instruction.getTarget1();
                        if (target1 != null)
                        {
                            arg += target1.getName() + "/" + target1.getArity() + "_" + target1.getId();
                        }

                        break;
                    }
                }
            }

            labeledTable.put(ARG_1, row, arg);

            row++;
            address += instruction.sizeof();
        }
    }
private void renderInstructions(Iterable<WAMInstruction> instructions, int row, int address)
    {
        for (WAMInstruction instruction : instructions)
        {
            WAMLabel label = instruction.getLabel();

            labeledTable.put(ADDRESS, row, String.format("%08X", address));
            labeledTable.put(LABEL, row, (label == null) ? "" : (label.toPrettyString() + ":"));
            labeledTable.put(MNEMONIC, row, instruction.getMnemonic().getPretty());

            int fieldMask = instruction.getMnemonic().getFieldMask();

            String arg = "";

            for (int i = 2; i < 32; i = i * 2)
            {
                if ((fieldMask & i) != 0)
                {
                    if (!"".equals(arg))
                    {
                        arg += ", ";
                    }

                    switch (i)
                    {
                    case 2:
                        arg += Integer.toString(instruction.getReg1());
                        break;

                    case 4:
                        arg += Integer.toString(instruction.getReg2());
                        break;

                    case 8:

                        FunctorName fn = instruction.getFn();
                        if (fn != null)
                        {
                            arg += fn.getName() + "/" + fn.getArity();
                        }

                        break;

                    case 16:

                        WAMLabel target1 = instruction.getTarget1();
                        if (target1 != null)
                        {
                            arg += target1.getName() + "/" + target1.getArity() + "_" + target1.getId();
                        }

                        break;
                    }
                }
            }

            labeledTable.put(ARG_1, row, arg);

            row++;
            address += instruction.sizeof();
        }
    }
private void renderInstructions ( Iterable < WAMInstruction > instructions , int row , int address ) { for ( WAMInstruction instruction : instructions ) { WAMLabel label = instruction . getLabel ( ) ; labeledTable . put ( ADDRESS , row , String . format ( "%08X" , address ) ) ; labeledTable . put ( LABEL , row , ( label == null ) ? "" : ( label . toPrettyString ( ) + ":" ) ) ; labeledTable . put ( MNEMONIC , row , instruction . getMnemonic ( ) . getPretty ( ) ) ; int fieldMask = instruction . getMnemonic ( ) . getFieldMask ( ) ; String arg = "" ; for ( int i = 2 ; i < 32 ; i = i * 2 ) { if ( ( fieldMask & i ) != 0 ) { if ( ! "" . equals ( arg ) ) { arg += ", " ; } switch ( i ) { case 2 : arg += Integer . toString ( instruction . getReg1 ( ) ) ; break ; case 4 : arg += Integer . toString ( instruction . getReg2 ( ) ) ; break ; case 8 : FunctorName fn = instruction . getFn ( ) ; if ( fn != null ) { arg += fn . getName ( ) + "/" + fn . getArity ( ) ; } break ; case 16 : WAMLabel target1 = instruction . getTarget1 ( ) ; if ( target1 != null ) { arg += target1 . getName ( ) + "/" + target1 . getArity ( ) + "_" + target1 . getId ( ) ; } break ; } } } labeledTable . put ( ARG_1 , row , arg ) ; row ++ ; address += instruction . sizeof ( ) ; } }
Renders disassembled instructions into the code table, starting at the specified row and instruction address.

@param instructions A list of instructions to render into the table.
@param row          The table row to start at.
@param address      The code address to start at.
Renders disassembled instructions into the code table starting at the specified row and instruction address .