Computer Science • Assembly language

Assembly Tracing

Rows recorded: 0

Program in memory

    Trace table

    No lines recorded yet.

    Explanation

    Instruction set

    ASCII table

    The codes this program uses are highlighted.

    Codes 0 to 31 and 127 are control characters; 32 (SP) is a space.

    Assembly Tracing — Explanation

    Each question is a short assembly language program, in the instruction set used in Cambridge International AS & A Level Computer Science (9618) Paper 1. Trace it through, a line at a time, and complete the trace table exactly as you would on the printed paper. Some are past paper questions, and some were written for this site in the same style.

    How to fill in the table. Each row is one instruction as it runs: write its address, then any register or memory value that changes. Leave a cell blank when its value doesn't change from the row above, as the mark scheme does. The first row's address is filled in for you, since every program starts at its first instruction. A jump that isn't taken, a compare and END still get a row, with only the address.

    Signed in, your tables are saved as you go: come back to any question and carry on where you left off. A question is done once you've submitted it with every line of the program traced; done questions are ticked in the list, and Random question picks one you haven't done yet.

    Set by your teacher. Questions your teacher has set you are marked in the list, and come up first. Each is worth one mark for every line you get right first time: a line you had to correct, or completed with a hint, gets no mark. If you had already done one before it was set, it starts again, fresh; after that you can have as many attempts as you like, and your best counts.

    Objective: trace an assembly language program, showing how the contents of the accumulator, index register and memory change as each instruction runs, and the output (9618 syllabus 4.2, Assembly language).

    Where this fits

    • Cambridge: Cambridge A Level Computer Science (9618); Cambridge AS Level Computer Science (9618)

    Assembly Tracing — Key Terms

    Key concepts in English, with te reo Māori, Chinese (Simplified) and Korean.

    EnglishTe reo Māori中文(简体)한국어What it means on this page
    Computerrorohiko计算机컴퓨터A device with a processor and memory that carries out a program’s instructions.
    Processor (CPU)pūtukatuka matua中央处理器중앙 처리 장치The chip that fetches, decodes and executes each instruction in turn.
    Memorypūmahara内存메모리Where the program’s instructions and data are held while it runs.
    Programpapatono程序프로그램The ordered sequence of instructions this trace table steps through.
    Instructiontohutohu指令명령어A single step of the program — one line of the trace table.
    Datararaunga数据데이터The values held in registers, memory and the accumulator as the program runs.
    Binarytāhūrua二进制이진법The base-2 system every value in this exercise is ultimately stored in.
    Bit (binary digit)moka位 / 比特비트A single 0 or 1 held in a register or memory location.
    Inputtāuru输入입력A value read into the program from outside — for example, from the keyboard.
    Outputhuaputa输出출력A value the program produces — for example, printed to the screen.
    Loopkoromeke循环반복문A block of instructions repeated while a condition holds.
    Branchpeka分支분기An instruction that can send execution to a different line, rather than the next one.
    Algorithmhātepe算法알고리즘The logic the program follows, independent of any one programming language.
    Machine codereo mihini机器码기계어The lowest-level form of a program; assembly language translates directly into it.
    Registerno attested term寄存器레지스터One of the small storage locations inside the processor, named in this exercise’s trace tables (e.g. ACC).
    Accumulatorno attested term累加器누산기The register that holds the result of arithmetic and logic operations.
    Address (memory address)wāhitau pūmahara地址주소The location in memory an instruction reads from or writes to.
    Program counterno attested term程序计数器프로그램 카운터The register that holds the address of the next instruction to fetch.
    Bitwise Operationno attested term——An operation (AND, OR, XOR) applied to each pair of matching bits in two binary numbers separately, giving one result bit for each position.
    Maskno attested term——A binary pattern used with a bitwise operation to pick out, set or change chosen bits: AND with a mask clears bits, OR sets them, XOR toggles them.
    Logical Shiftno attested term——Moving every bit of a binary number left or right by a number of places, filling the gaps with 0s: a left shift multiplies by 2 for each place, a right shift divides by 2, and bits shifted out are lost.

    On the te reo Māori column. Terms marked as gaps have no attested equivalent in the sources checked — Karaitiana Taiuru's Dictionary of Māori Computer and Social Media Terms, Paekupu, the Reserve Bank's te reo financial glossary, NZQA and Te Aka. No coinage is printed as though it were established; where a class needs one, commission it from Te Taura Whiri i te Reo Māori and credit the translator. Te reo Māori is not italicised and takes no plural "s".