Arithmetic, flags and input and output

ADD, SUB and the flags they set, signed and unsigned numbers, ADC for big numbers, and reading keys and lines and printing text with INT 21h.

About 6 hours of study

Learning objectives

Lessons

  1. 1

    Arithmetic and the flags

    ADD, SUB, INC, DEC and NEG, and the flags every result sets: carry, zero, sign, overflow, parity. The same bits read as unsigned or signed numbers, and ADC for numbers bigger than 16 bits.

  2. 2

    Keyboard and screen with INT 21h

    Reading a key and a whole line, printing characters, strings and new lines, and turning the digit a user types into the number it stands for (and back).

Module practice

Module quiz

1. Which flag shows that an unsigned addition did not fit in the register?
2. What is the code of the character '5'?
3. AL = 0FFh. After ADD AL, 1, what are AL, CF and ZF?
4. What must the first byte of the buffer for INT 21h with AH = 0Ah hold?
5. AX = 0FFFFh, BX = 1, CX = 0 and DX = 0. What is DX after ADD AX, BX and then ADC DX, CX?
6. What does AAM give for AL = 13?

‹ The frame, registers and variablesJumps, loops, multiplication and bits ›