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
- Predict the result and the flags of an addition or a subtraction
- Add numbers that are wider than a register
- Read digits and lines and print results with INT 21h
Lessons
- 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
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
- Difference of two digitsEasy
- Does it fit in a byte?Medium
- Count the carriesHard
- Add two digitsEasy
- Say the line twiceMedium
- Length and spaces of a lineHard
Module quiz
‹ The frame, registers and variablesJumps, loops, multiplication and bits ›