Post on 23-Dec-2015
description
SAMPLE PROGRAMS
EXAMPLE 1
Code a program to decrement a 2-byte number at File 26:27h ordered as high:low byte, remembering that decf does not alter the Carry/Borrow flag.
SOLUTION TO EXAMPLE 1
The task list to implement this job is:
1. IF the least significant byte in File 27h is zero THEN decrement the most significant byte.
2. Always decrement the least significant byte.
EXAMPLE 2
Some early computers used a bi-quinary code to represent BCD digits. This is a 7-bit code with only two bits set to one for any combination:
EXAMPLE 2
Bi-quinary coded decimal is a numeral encoding scheme used in many abacuses and in some early computers, including the Colossus. The term bi-quinary indicates that the code comprises both a two-state (bi) and a five-state (quinary) component. The encoding resembles that used by many abaci, with four beads indicating either 0 through 4 or 5 through 9 and another bead indicating which of those ranges.
EXAMPLE 2
SOLUTION TO EXAMPLE 2
All we need to do here is to determine when there are more or less than two bits set to one. Based on this approach we have the tasklist:
1. Count the number of ones in the bi-quinary byte.
2. Zero W.
3. IF count is not two THEN make FFh to signal an error.
SOLUTION 3