Editorial for Byang's Assembly

The problem involves simulating the simple machine described in the statement. To do that, you will need to read in the assembly code, parse it, and run through it step-by-step keeping the state of the 7 registers as defined in the problem statement.

There are three things that are worth keeping in mind:

  1. Since the register P indicates which line is about to be executed, changing P will change the next line you are supposed to process.

  2. P can be changed in ways other than JMP instruction. Since P is also a a register, just like the other 6, instructions like ADD, INC, etc can also change the value of P.

  3. There may be more than one HLT in the input assembly code.

With these, the solution to this problem should be fairly straightforward.


    60% Solution Ratio

    moshiur_cse15Earliest, Apr '19

    moshiur_cse15Fastest, 0.0s

    touhidurrrLightest, 0 B

    touhidurrrShortest, 1043B

    Toph uses cookies. By continuing you agree to our Cookie Policy.