Ok so this is part of what I have:
byte 1 byte 2 (optional) bits [ 7 6 5 4 3 2 1 0 ] [ 7 6 5 4 3 2 1 0 ] opcode - - - mod - operand1 - - - - operand2 - - - - - - - -
And instructions:
opcode | instruction | operands (mod 0) | operands (mod 1) -------+-------------+------------------+----------------- 0x00 | jmp | r1 | r2:r1 0x01 | movr | r1, r2 | rx, imm 0x02 | movm | r1, [ds:r2] | [ds:r1], r2 0x03 | add | r1, r2 | r1, imm flags cmp r1, r2 instruction results in: r1 == r2 => fl = 0 r1 < r2 => fl = 0xff r1 > r2 => fl = 1 jmpe r1 => if (fl == 0) jmp r1 else nop
I am then given:
0x00 0x00 0x00 0x01 0x03 0x02 0x03 0x02 0x03 0x02
But pretty much like you said, I am in need of simulating a processor with given instructions.

In reply to Re^2: Parsing through instructions by DaveMonk
in thread Parsing through instructions by DaveMonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.