assemblymarie

Assembly program (in MARIE), How to fill First and second pass?


I really did the sympol table and did fill it its easy but the code has many errors like Repeat is not vaild and values var1,var2 & res where no datatype for the HEX OR DEC etc.. so what to fill really confusing

Click to see the problem

Any help ?


Solution

  • You're right: Repeat is not defined, so technically, the problem cannot be finished.  Probably a typo, and they meant to use the properly-defined label Again instead of Repeat. Suggest you proceed with that assumption, and state such assumption clearly in the work you turn in, if possible.


    The post-first-pass table shows the opcode and the operand, and while the first operand is shown numerically, the second operand is shown symbolically when necessary (or numerically if known as such, e.g. for SkipCond since the operand is numeric already).

    So, for the first instruction, we have 1, Var1, which is a representation of the machine code instruction where the opcode is 1 (Load) and the operand is Var1.


    When we get to the post-second-pass table, the symbolic operands (as names) are replaced with the numeric values that the processor will see when executing this program.  In many cases, the numeric values of these names are not known until the completion of the first pass, which gives numbers to labels.  So, after the 2nd pass now we have a fully numeric representation of the machine code for the program.