public static function debug($frame, $binary_mode = false)
        {
            if ($binary_mode) {
            
                    foreach ($frame as &$frameLine) {
                        $frameLine = join('<span class="m">&nbsp;&nbsp;</span>', explode('0', $frameLine));
                        $frameLine = join('&#9608;&#9608;', explode('1', $frameLine));
                    }
                    
                    echo '<style> .m { background-color: white; } </style> ';
                    echo '<pre><tt><br/ ><br/ ><br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                    echo join("<br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $frame);
                    echo '</tt></pre><br/ ><br/ ><br/ ><br/ ><br/ ><br/ >';
            
            } else {
            
                foreach ($frame as &$frameLine) {
                
                    $frameLine = strtr($frameLine, array(
                        "\xc0" => '<span class="m">&nbsp;</span>',   //marker 0    
                        "\xc1" => '<span class="m">&#9618;</span>',  //marker 1
                        "\xa0" => '<span class="p">&nbsp;</span>',   //submarker 0
                        "\xa1" => '<span class="p">&#9618;</span>',  //submarker 1
                        "\x84" => '<span class="s">F</span>',        //format 0
                        "\x85" => '<span class="s">f</span>',        //format 1
                        "\x81" => '<span class="x">S</span>',        //special bit
                        "\x90" => '<span class="c">C</span>',        //clock 0
                        "\x91" => '<span class="c">c</span>',        //clock 1
                        "\x88" => '<span class="f">&nbsp;</span>',   //version 0 
                        "\x89" => '<span class="f">&#9618;</span>',  //version 1
                        "\x03" => '1',                               // 1
                        "\x02" => '0',                               // 0         
                    ));                                          
                }                
               
                echo '<style>';
                echo '    .p { background-color: yellow; }';
                echo '    .m { background-color: #00FF00; }';
                echo '    .s { background-color: #FF0000; }';
                echo '    .c { background-color: aqua; }';
                echo '    .x { background-color: pink; }';
                echo '    .f { background-color: gold; }';
                echo '</style>';
               
                echo "<tt>";
                echo join("<br/ >", $frame);
                echo "<br/>Legend:<br/>";
                echo '1 - data 1<br/>';                          
                echo '0 - data 0<br/>';  
                echo '<span class="m">&nbsp;</span> - marker bit 0<br/>'; 
                echo '<span class="m">&#9618;</span> - marker bit 1<br/>';  
                echo '<span class="p">&nbsp;</span> - secondary marker bit 0<br/>';   
                echo '<span class="p">&#9618;</span> - secondary marker bit 1<br/>';  
                echo '<span class="s">F</span> - format bit 0<br/>';        
                echo '<span class="s">f</span> - format bit 1<br/>';        
                echo '<span class="x">S</span> - special bit<br/>';        
                echo '<span class="c">C</span> - clock bit 0<br/>';        
                echo '<span class="c">c</span> - clock bit 1<br/>';        
                echo '<span class="f">&nbsp;</span> - version bit 0<br/>'; 
                echo '<span class="f">&#9618;</span> - version bit 1<br/>';
                echo "</tt>";
            
            }
        }