projects/06/assembler/Code.php
/**
     * Returns the binary code for the dest mnemonic.
     */
Returns the binary code for the dest mnemonic.
Returns the binary code for the dest mnemonic .
public static function dest($str)
    {
        $mnemonics = array(
            'null' => '000',
            'M' => '001',
            'D' => '010',
            'MD' => '011',
            'A' => '100',
            'AM' => '101',
            'AD' => '110',
            'AMD' => '111'
        );
        if (isset($mnemonics[$str])) {
            return $mnemonics[$str];
        }
        return '000';
    }
public static function dest ( $ str ) { $ mnemonics = array ( 'null' => '000' , 'M' => '001' , 'D' => '010' , 'MD' => '011' , 'A' => '100' , 'AM' => '101' , 'AD' => '110' , 'AMD' => '111' ) ; if ( isset ( $ mnemonics [ $ str ] ) ) { return $ mnemonics [ $ str ] ; } return '000' ; }
Returns the binary code for the dest mnemonic.
Returns the binary code for the dest mnemonic .