Entry 3461

VM parser

   

Submitted by anonymous on March 30, 2010 at 3:01 p.m.
Language: Python. Code size: 530 bytes.

for i in range(0, len(d)/4):

    OC = struct.unpack_from('L', d[i*4:i*4+4])[0]

    A  = OC >> 24
    B  = (OC >> 16) & 0xff
    C  = (OC >> 8) & 0xff
    D  = (OC ) & 0xff

    DEST = "R[%2.2x]" % B

    if( A != 0x14 ):
        C   = C&0xBF
        D   = D&0xBF
        OP1 = "R[%2.2x]" % C
        OP2 = "R[%2.2x]" % D
    else:
        OP1 = "#0x%2.2x" % C
        OP2 = "#0x%2.2x" % D

    print "%4.4x: ( %2.2x %2.2x %2.2x %2.2x ) %s = %.10s %s %s" %( i, A,B,C,D, DEST, functions[ A&0x1f ], OP1, OP2 )

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).