Display the smallest of two given values
- In this program you need to input two values;
- You need to save them to some memory locations: say locations 20 and 21
- Next you need to compare those two values and determine which one is smallest:
- Load accumulator with memory 20
- Subtract memory 21
- If the accumulator is negative, contents of 20 is smaller than 21, so display the value
in 20
- otherwise, contents of 21 is smaller (or equal) to the contents of 20, so display the
value in 21
- end program.
Actual program:
- 0920
- 0921
- 0120
- 0421
- 0807 - Jump to location 07 (skip the next two instructions)
- 1020
- 9900
- 1021
- 9900
Notice that this program only works if it starts in position 0 because the jump
instruction needs to jump to a specific address (07).