8089 Programming HSC 2025
8089 Programming HSC 2025
Algorithm
1. Load the first number from memory location 2050 to
accumulator.
2. Move the content of accumulator to register H.
3. Load the second number from memory location 2051 to
accumulator.
4. Then add the content of register H and accumulator using
“ADD” instruction and storing result at 3050
5. The carry generated is recovered using “ADC” command and is
stored at memory location 3051
H→3051,
200D SHLD 3050
L→3050
Algorithm –
1. Load contents of memory location 2050 in register L and
contents of memory location 2051 in register H
8. End of program
Algorithm –
1. Load a 16-bit number from memory 3000 into a register pair
(H-L)
2. Move content of register L to accumulator
3. Complement content of accumulator
4. Move content of accumulator to register L
5. Move content of register H to accumulator
6. Complement content of accumulator
7. Move content of accumulator to register H
8. Store content of register pair in memory 3002
(1’s complement)
Algorithm –
1. Load 00H in a register (for carry)
2. Load content from memory into register pair
3. Move content from L register to accumulator
4. Add content of H register with accumulator
5. Add 06H if sum is greater than 9 or Auxiliary Carry is not zero
6. If carry flag is not equal to 1, go to step 8
7. Increment carry register by 1
8. Store content of accumulator into memory
9. Move content from carry register to accumulator
10. Store content of accumulator into memory
11. Stop
Algorithm –
Result of
2001H Result
factorial
Load data
2002H LXI H, 2000H from
memory
Load data to
2005H MOV B, M
B register
Set D register
2006H MVI D, 01H
with 1
Subroutine
2008H FACTORIAL CALL MULTIPLY call for
multiplication
Call factorial
200CH JNZ FACTORIAL till B
becomes 0
Increment
200FH INX H
memory
Store result
2010H MOV M, D
in memory
Transfer
2100H MULTIPLY MOV E, B contents of B
to C
Clear
accumulator
2101H MVI A, 00H
to store
result
Add contents
2103H MULTIPLYLOOP ADD D
of D to A
JNZ Repeated
2105H
MULTIPLYLOOP addition
Transfer
2108H MOV D, A contents of A
to D
Return from
2109H RET
subroutine