FIT1047 Chap.6 MARIE Assembly, Addressing and Subroutines
MARIE Assembly, Addressing and Subroutines
MARIE is the teaching architecture used to connect assembly language, instruction formats, registers, memory and control. The course-developed textbook describes 16-bit words, sixteen instructions and a 16-bit instruction split into a 4-bit opcode plus 12-bit address.
This chapter decodes those fields, follows conceptual register transfers, and traces Load, Store, arithmetic, input/output, halt, condition/branch behaviour, direct and indirect addressing and subroutine return flow. It separates instruction address, address field, effective address and operand contents.
A memory-role table distinguishes instructions, scalar data, pointers and control data while acknowledging that hardware stores bit patterns. The Demonstration's published purpose supports analysing/writing MARIE programs and understanding process/memory in an in-class activity, but no readable evidence supports inventing its format, timing or material conditions. All programs and addresses here are fresh practice.
A reliable MARIE explanation connects encoded fields, effective address, register transfers and algorithmic purpose without collapsing them into one line. Direct and indirect access must be traced through different address paths, and a subroutine call must preserve a usable continuation.
The current A2 evidence supports only the Demonstration's broad purpose; no exact prompt type, required trace table, timing, rubric, simulator procedure or materials rule is inferred.
What this chapter covers
- 01
16-bit MARIE word and instruction format
- 02
Opcode and 12-bit address decoding
- 03
Named registers and fetch transfers
- 04
Load, Store, Add and Subt directions
- 05
Input, Output and Halt
- 06
Conditional skips, jumps and loops
- 07
Direct and indirect addressing
- 08
Subroutine call/return reasoning
- 09
Memory-location role maps
- 10
Architectural effect and mutation ledgers
- 11
Continuation preservation across subroutine calls
AskSia-authored practice weighting (not an official mark scheme): Fresh MARIE loop reasoning
- invariantState invariant TOTAL=3k and COUNT=4−k after k completed iterations.
- processExpand one iteration as Load/Add/Store TOTAL then Load/Subt/Store COUNT.
- controlTest the updated count and select the back edge only while positive.
- traceList endpoints (3,3), (6,2), (9,1), (12,0).
- checkVerify VALUE and STEP never change and control exits at the updated boundary.
Key terms
- Opcode
- The instruction field selecting the operation; MARIE uses a 4-bit opcode field.
- Address field
- The 12-bit part of a MARIE instruction word naming an address or target under instruction semantics.
- Accumulator
- The principal MARIE register used for arithmetic and many data transfers.
- Effective address
- The location actually used for operand access after resolving the addressing mode.
- Indirect addressing
- An access where the instruction field names a pointer location whose contents supply the effective address.
- Return address
- The saved instruction continuation used to resume the caller after a subroutine.
- Memory-role map
- A pre-trace classification of each relevant location as instruction, scalar data, pointer, destination or return-control storage. Hardware stores bit patterns, but the role map prevents an address field, pointer value and pointee contents from being conflated.
- Continuation
- The control-flow location to which execution must return after a subroutine completes. Call and return reasoning must show where this value is preserved, how the routine reaches its entry, and how the program counter is restored without overwriting return control.
MARIE Assembly, Addressing and Subroutines FAQ
How does hexadecimal align with a MARIE instruction?
Four opcode bits form one hexadecimal digit and twelve address bits form three. Keep leading zeros so the field boundary remains visible.
What is the difference between direct and indirect access?
Direct uses memory at the instruction's address field. Indirect first reads that location as a pointer and then accesses memory at the pointer value.
Does Store clear the accumulator?
No. Store copies the accumulator to addressed memory under the teaching semantics; the accumulator remains unless another instruction changes it.
How should Skipcond or a conditional trace be checked?
Record accumulator state at the test, the exact condition from the MARIE materials, PC after fetch and the selected next instruction. Test negative/zero/positive boundaries as applicable.
What should I prepare for the Demonstration?
Practise analysing/writing fresh MARIE programs and explaining process and memory. Verify current activity format, conditions and all operational details in Moodle rather than inferring them here.
How should an indirect memory access be explained?
Name the instruction's address field, read the pointer stored at that location, treat the pointer value as the effective address and then access the pointee. Show each role separately so a read of the pointer is not reported as a read or write of final data.
Can this chapter predict the A2 trace or simulator task?
No. It provides original standard-canon practice for the published purpose only. The exact A2 prompt, required artefacts, timing, rubric, demonstration interaction and material rules are not available here and must be confirmed in the live Moodle activity.
Assessment move
Build a symbol/memory map before tracing. Split each instruction into opcode and address fields and reconstruct the sixteen bits as a decode check. For every line, write PC, instruction, effective address, memory operand, accumulator before/after and changed memory. Use a mutation ledger: Load and arithmetic read operand memory; Store changes one destination.
Draw control-flow edges before simulating loops, state an invariant, and test boundary initial counts. For indirect access, show pointer location, pointer contents/effective address and pointee contents. For subroutines, record saved continuation, entry, side effects and restored PC. Explain the algorithm performed by the sequence rather than paraphrasing mnemonics.
Use current course syntax and simulator instructions from Moodle. Maintain a location-role table with instruction, scalar, pointer, destination and return-control rows. Record every read and write plus final contents. Decode hexadecimal instruction words by keeping one opcode digit and three address digits visible, and rebuild the sixteen-bit word before execution.
For conditional work, prepare three accumulator states around the exact comparison boundary and list PC after fetch, after the skip decision and at the next fetch. For an indirect table traversal, draw the pointer arrow, update the pointer separately and verify the pointee is not modified by a read. For a loop, expand the first iteration at instruction granularity, then use the invariant for later endpoints.
For a subroutine, protect the return-storage location and test that restored PC selects the instruction after the call. End by changing one input and predicting path/state changes before rerunning; this demonstrates a program model rather than memorisation. Use the supplied textbook to confirm MARIE scope, word layout and instruction meanings, but reconstruct all programs, traces and diagrams independently.
Do not reproduce source code examples, figures, wording or answers. Keep the live A2 task and any simulator-specific instructions outside generated practice and follow current Moodle.
Working through MARIE Assembly, Addressing and Subroutines in FIT1047? Sia is AskSia’s AI Computer Science tutor — ask any FIT1047 MARIE Assembly, Addressing and Subroutines question and get a clear, step-by-step explanation grounded in how FIT1047 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.