Arrays, the stack, procedures and strings

Addressing modes and arrays, the stack, procedures and recursion, and the string instructions with their REP prefixes.

About 12 hours of study

Learning objectives

Lessons

  1. 1

    Arrays and addressing modes Intermediate

    Every way an 8086 instruction can name its operand: immediate, register, direct, register indirect, based, indexed and based-indexed; walking byte and word arrays; and the sum and the largest value of an array.

  2. 2

    The stack Intermediate

    How the stack works (SS, SP, PUSH and POP, last in first out), saving registers, reversing a string, and why every PUSH needs its POP.

  3. 3

    Procedures: CALL and RET Intermediate

    Writing procedures with PROC and ENDP, how CALL and RET use the stack for the return address, passing values in registers and on the stack, saving registers, and recursion.

  4. 4

    String instructions Intermediate

    MOVSB, LODSB, STOSB, CMPSB and SCASB, which work through memory with SI and DI by themselves; repeating them with REP, REPE and REPNE; the direction flag; and setting ES.

Module practice

Module quiz

1. Which of these registers can be used inside square brackets to address memory?
2. SP = 0100h. What is SP after PUSH BX and then PUSH CX?
3. NUMS DW 5, 6, 7, 8 and SI = 6. What does MOV AX, NUMS[SI] read?
4. What is on top of the stack just after a CALL has jumped to the procedure?
5. A procedure does PUSH BP and then MOV BP, SP. Where is the return address?
6. AL = 'x' and the text is 'abxde' (5 bytes). After REPNE SCASB, what are CX and ZF?
7. Which instruction finds the first byte that is not equal to AL?

‹ Jumps, loops, multiplication and bitsFinal assessment ›