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
- Walk through arrays with index registers
- Use the stack, CALL and RET correctly
- Copy, fill, compare and search blocks of memory with the string instructions
Lessons
- 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
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
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
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
- A table of squaresEasy
- Count the vowelsMedium
- Sort a list of digitsHard
- Swap with the stackEasy
- BackwardsMedium
- Balanced bracketsHard
- A new-line procedureEasy
- A power of twoMedium
- Sum from 1 to nHard
- Fill with starsEasy
- Where is the letter?Medium
- Compare two linesHard