0% found this document useful (0 votes)
74 views20 pages

ALP Lab Manual

The program performs block transfer of 5 bytes of data from memory locations 8500H to 8504H to memory locations 8600H to 8604H. It initializes the HL register pair to point to the input block at 8500H and the DE register pair to point to the output block at 8600H. A counter of 5 is loaded into the B register. The number at the HL addressed memory location is moved to the accumulator and then stored into the DE addressed memory location. HL and DE are then incremented and the counter decremented to repeat the transfer for the remaining bytes until complete.

Uploaded by

EMPIRE MK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views20 pages

ALP Lab Manual

The program performs block transfer of 5 bytes of data from memory locations 8500H to 8504H to memory locations 8600H to 8604H. It initializes the HL register pair to point to the input block at 8500H and the DE register pair to point to the output block at 8600H. A counter of 5 is loaded into the B register. The number at the HL addressed memory location is moved to the accumulator and then stored into the DE addressed memory location. HL and DE are then incremented and the counter decremented to repeat the transfer for the remaining bytes until complete.

Uploaded by

EMPIRE MK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

PROGRAM: 1. WRITE AN ALP TO DO EXCHANGE OF TWO-16BIT NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND
Load contents of 8600 to L
8000 2A 00 86 LHLD 8600H
and 8601 to H register.
Exchange (Store contents of
8003 EB XCHG
HL into DE). HL  DE.
Load contents of 8700 to L
8004 2A 00 87 LHLD 8700H
and 8701 to H register.
Store L contents to 8600 and
8007 22 00 86 SHLD 8600H
H contents to 8601 location.
Exchange (Store contents of
800A EB XCHG
DE into HL). DE  HL.
Store L contents to 8700 and
800B 22 00 87 SHLD 8700H
H contents to 8701 location.
800E 76 HLT End of the program.

INPUT: OUTPUT:

8600 3B 8700 3E 8600 3E 8700 3B

8601 AB 8701 FE 8601 FE 8701 AB

Lab Manual Page |1 BCA – V SEM


PROGRAM: 2. WRITE AN ALP TO DO ADDITION OF TWO-8BIT HEX NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

9000 21 00 86 LXI H, 8600H Initialize HL as I/P Pointer.

9003 7E MOV A, M Get the 8bit no. into Acc.

9004 23 INX H Increment pointer by 1.

9005 86 ADD M Add Acc with M => Acc

9006 32 00 87 STA 8700H Store the Sum to 8700.

9009 3E 00 MVI A, 00H Initialize Acc with 00.

900B 8F ADC A Get the Carry into Acc.

900C 32 01 87 STA 8701H Store the Carry into 8701.

900F 76 HLT End of the program.

INPUT: 1st 2nd OUTPUT: 1st 2nd

8600 30 8600 56 8700 38 8700 4B

8601 08 8601 F5 8701 00 8701 01

Lab Manual Page |2 BCA – V SEM


PROGRAM: 3. WRITE AN ALP TO DO SUBTRACTION OF TWO-16BIT BINARY NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND
Load 1st byte to L register &
9000 2A 00 86 LHLD 8600H
the 2nd byte to H register.
Exchange (Store contents of
9003 EB XCHG
HL into DE). HL  DE.
Load 1st byte to L register &
9004 2A 00 87 LHLD 8700H
the 2nd byte to H register.
9007 7B MOV A, E Get 1st byte of 16bit to Acc.
Subtract the 1st byte of both
9008 95 SUB L
no’s & store into Acc.
9009 6F MOV L, A Store back to L register.

900A 7A MOV A, D Get 2nd byte of 16bit to Acc.


Subtract 2nd byte of both
900B 9C SBB H
no’s & store into Acc.
900C 67 MOV H, A Store back to H register.
Store L contents to 8800 &
900D 22 00 88 SHLD 8800H
H to 8801 location.
9010 3E 00 MVI A, 00H Initialize Acc with 00.

9012 9F SBB A Get the Borrow into Acc.

9013 32 02 88 STA 8802H Store Acc contents to 8802.

9016 76 HLT End of the program.

INPUT: 1st 16bit 2nd 16bit OUTPUT:

8600 2A 8700 43 8800 E7


8601 96 8701 5B 8801 3A
1ST 16 BIT NUM: 96 2A 8802 00
2ND 16 BIT NUM: 5B 43
DIFF (RESULT) 00 3A E7

Lab Manual Page |3 BCA – V SEM


PROGRAM: 4. WRITE AN ALP TO DO ADDITION OF ‘N’-1BYTE BINARY NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8200 0E 05 MVI C, 05H Set the C reg as Counter.

8202 21 00 85 LXI H, 8500H Initialize HL as Pointer.

8205 06 00 MVI B, 00H Clear B reg to store carry.

8207 7E MOV A, M Get the 1st no to Acc.

8208 23 L2: INX H Increment pointer by 1.

8209 86 ADD M Add Acc + M, Sum to Acc.

820A D2 0E 82 JNC L1 Jump if CY = 0 to L1 (Loop).

820D 04 INR B Increase the B reg by 1.

820E OD L1: DCR C Decrease the Count by 1.

820F C2 08 82 JNZ L2 Jump if Z = 0 to L2 (Loop).

8212 32 00 87 STA 8700H Store the Sum into 8700.

8215 78 MOV A, B Get the Carry into Acc.

8216 32 01 87 STA 8701H Store the carry into 8701.

8219 76 HLT End of the program.

INPUT: OUTPUT: 30
8500 => 30 8700 3F 22
8501 => 22 8701 01 10
8502 => 10 2A
8503 => 2A B3
8504 => B3 01 3F

Lab Manual Page |4 BCA – V SEM


PROGRAM: 5. WRITE AN ALP TO DO BLOCK TRANSFER OF ‘N’ BYTES OF DATA (DIRECT ORDER).

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8200 21 00 85 LXI H, 8500H Load HL as input Pointer.

8203 11 00 86 LXI D, 8600H Load DE as output Pointer.

8206 06 05 MVI B, 05H Set B reg as Counter (05).

8208 7E L1: MOV A, M Get the number to Acc.

8209 12 STAX D Store to DE pointed ML.

820A 23 INX H Increase the HL pair by 1.

820B 13 INX D Increase the DE pair by 1.

820C 05 DCR B Decrease the Count by 1.

820D C2 08 82 JNZ L1 Jump if Z=0 to L1 (Loop).

8210 76 HLT End of the program.

INPUT: OUTPUT:

8500 30 8600 30
8501 45 8601 45
8502 6E 8602 6E
8503 2B 8603 2B
8504 38 8604 38

Lab Manual Page |5 BCA – V SEM


PROGRAM: 6. WRITE AN ALP TO FIND 1’S COMPLEMENT OF A 16BIT NUMBER.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND
Get the 1st byte to L and 2nd
9000 2A 00 87 LHLD 8700H
byte to H register.
9003 7D MOV A, L Get the 1st byte to Acc.

9004 2F CMA Complement the Acc.

9005 67 MOV L, A Store back to L register.

9006 7C MOV A, H Get the 2nd byte to Acc.

9007 2F CMA Complement the Acc.

9008 6F MOV H, A Store back to H register.


Store L contents to 8800
9009 22 00 88 SHLD 8800H
and H contents to 8801.
900C 76 HLT End of the Program.

INPUT: OUTPUT:

8700 3E 8800 C1

8701 52 8801 AD

523E => 0101 0010 0011 1110

1’S COMPLEMENT => 1010 1101 1100 0001 == A D C 1

Lab Manual Page |6 BCA – V SEM


PROGRAM: 7. WRITE AN ALP TO FIND SMALLEST OF ‘N’ 1BYTE BINARY NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8000 21 00 85 LXI H,8500H Load HL as input Pointer.

8003 7E MOV A, M Get the 1st no. to Acc.

8004 0E 04 MVI C, 04H Set the C reg as Counter.

8006 23 L2: INX H Increase pointer by 1.

8007 BE CMP M Compare with another no.

8008 DA 0C 80 JC L1 Jump if CY=0 to L1 (Loop).

800B 7E MOV A, M Get SMALL into Acc.

800C 0D L1: DCR C Decrease the Count by 1.

800D C2 06 80 JNZ L2 Jump if Z=0 to L2 (Loop).


Store the small no. that is to
8010 32 F1 8F STA 8FF1H
be displayed in Data field.
8013 CD 4C 04 CALL 044CH Call Subroutine to display.

8016 76 HLT End of the program.

INPUT: 8500 => 40 OUTPUT:

8501 => 30 DISPLAYS – 16 ON THE DATA FIELD


8502 => 24
8503 => 16 Smallest
8504 => 25

Lab Manual Page |7 BCA – V SEM


PROGRAM: 8. WRITE AN ALP TO SIMULATE DECIMAL COUNTER (DISPLAY FROM 00 TO 99)

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8000 3E 00 MVI A, 00H Set the Acc with start 00.


Store the no. that is to be
8002 32 F1 8F L1: STA 8FF1H
displayed in data field.
8005 F5 PUSH PSW Push Acc + Flags to Stack.

8006 CD 4C 04 CALL 044CH Call Subroutine to display.

8009 CD 55 55 CALL 5555H Call the delay Subroutine.

800C F1 POP PSW Pop Acc + Flags from Stack.

800D C6 01 ADI 01H Increment the no. by 1.

800F 27 DAA Adjust the no. to Decimal.

8010 FE 00 CPI 00H Compare the no. with 00.

8012 C2 02 80 JNZ L1 Jump if Z=0 to L1 (Loop).

8015 76 HLT End of the program.

INPUT: OUTPUT:

NO INPUT DISPLAYS DECIMAL COUNT FROM => 00 TO 99

(INITIALIZE WITH COUNT 00)

Lab Manual Page |8 BCA – V SEM


PROGRAM: 9. WRITE AN ALP TO DO ADDITION OF ‘N’ 2DIGIT BCD NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8200 0E 05 MVI C, 05H Set the C reg as Counter.

8202 21 00 85 LXI H, 8500H Initialize HL as Pointer.

8205 06 00 MVI B, 00H Clear B reg to store carry.

8207 7E MOV A, M Get the 1st no to Acc.

8208 23 L2: INX H Increment pointer by 1.

8209 86 ADD M Add Acc + M, Sum to Acc.

820A 27 DAA Decimal Adjust Acc.

820B D2 0F 82 JNC L1 Jump if CY=0 to L1 (loop).

820E 04 INR B Increase the B reg by 1.

820F OD L1: DCR C Decrease the Count by 1.

8210 C2 08 82 JNZ L2 Jump if Z=0 to L2 (loop).

8213 32 00 87 STA 8700H Store the Sum into 8700.

8216 78 MOV A, B Get the Carry into Acc.

8217 32 01 87 STA 8701H Store the carry into 8701.

821A 76 HLT End of the program.

INPUT: 8900 25 OUTPUT: 8A00 65

8901 12 8A01 01

8902 30

8903 98

Lab Manual Page |9 BCA – V SEM


PROGRAM: 10. WRITE AN ALP TO DO MULTIPLICATION OF 2 DIGIT DECIMAL NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND
Load contents of 8300 to L &
8400 2A 00 83 LHLD 8300H
contents of 8301 to H.
8403 AF XRA A Clear Acc and flags.

8404 47 MOV B, A Initialize B reg with 00.

8405 84 L2: ADD H Add Acc + H. Store to Acc.

8406 27 DAA Adjust Acc. to Decimal.

8407 D2 0B 84 JNC L1 Jump if Z=0 to L1 (Loop).

840A 04 INR B Increase the B reg by 1.

840B 2D L1: DCR L Decrease no. of additions.

840C C2 05 84 JNZ L2 Jump if Z=0 to L2 (Loop).

840F 6F MOV L, A Store Acc contents to L.

8410 60 MOV H, B Store B reg contents to H.

8411 22 EF 8F SHLD 8FEFH Store product to display.

8414 CD 40 04 CALL 0440H Call Subroutine to display.

8417 76 HLT End of the program.

INPUT: OUTPUT:

8300 04 DISPLAYS 0020 IN ADDRESS FIELD

8301 03

8300 06 DISPLAYS 0300 IN ADDRESS FIELD

8301 50

Lab Manual P a g e | 10 BCA – V SEM


PROGRAM: 11. WRITE AN ALP TO DO EXCHANGE OF TWO-32 BIT NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND
Initialize HL pair as 1st
8000 21 00 86 LXI H, 8600H
pointer to memory 8600.
Initialize DE pair as 2nd
8003 11 00 87 LXI D, 8700H
pointer to memory 8700.
8006 3E 04 MVI C, 04H Set C reg for count.
Move 8bit data to B reg
8008 46 L1: MOV B, M
from memory pointer (HL).
Load 8bit data to Acc from
8009 1A LDAX D
DE pointed location.
Store contents of Acc to
800A 77 MOV M, A
memory pointed by HL pair.
Get the B reg contents to
800B 78 MOV A, B
Accumulator to store.
Store Acc contents to DE
800C 12 STAX D
pointed location.
800D 23 INX H Increment HL pair by 1.

800E 13 INX D Increment DE pair by 1.

800F 0D DCR C Decrement the Count by 1.


Jump to L1 if the Z flag is
8010 C2 08 80 JNZ L1
non-zero.
8013 76 HLT End of the program.

INPUT: OUTPUT:

8600 24 8700 45 8600 45 8700 24


8601 3E 8701 4D 8601 4D 8701 3E
8602 AB 8702 56 8602 56 8701 AB
8603 3C 8703 C3 8603 C3 8703 3C

Lab Manual P a g e | 11 BCA – V SEM


PROGRAM: 12 WRITE AN ALP TO DO SUBTRACTION OF TWO-8BIT BINARY NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

9000 21 00 86 LXI H, 8600H Initialize HL as I/P Pointer.

9003 7E MOV A, M Get the 8bit no. into Acc.

9004 23 INX H Increment the pointer by 1

9005 96 SUB M Subtract Acc with M => Acc

9006 32 00 87 STA 8700H Store Difference to 8700.

9009 3E 00 MVI A, 00H Initialize Acc with 00.

900B 9F SBB A Get the Borrow to Acc.

900C 32 01 87 STA 8701H Store the Borrow into 8701.

900F 76 HLT End of the program.

INPUT: OUTPUT:

8600 30 8600 08 8700 28 8700 D8

8601 08 8601 30 8701 00 8701 FF

Lab Manual P a g e | 12 BCA – V SEM


PROGRAM: 13. WRITE AN ALP TO DO ADDITION OF TWO-16BIT BINARY NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND
Load contents of 8600 to L
9000 2A 00 86 LHLD 8600H
and 8601 to H register.
Exchange (Store contents of
9003 EB XCHG
HL into DE). HL  DE.
Load contents of 8700 to L
9904 2A 00 87 LHLD 8700H
and 8701 to H register.
9007 7B MOV A, E Get 1st byte of 16bit. to Acc.
Add the 1st byte of both no’s
9008 85 ADD L
& store into Acc.
9009 6F MOV L, A Store back to L register.

900A 7A MOV A, D Get 2nd byte of 16bit. to Acc.


Add the 2nd byte of both no’s
900B 8C ADC H
& store into Acc.
900C 67 MOV H, A Store back to H register.
Store L contents to 8800 & H
900D 22 00 88 SHLD 8800H
contents to 8801 location.
9010 3E 00 MVI A, 00H Initialize Acc with 00.

9012 8F ADC A Get the Carry into Acc.

9013 32 02 88 STA 8802H Store Acc contents to 8802.

9016 76 HLT End of the program.

INPUT: OUTPUT:

8600 2A 8700 43 8800 6D

8601 96 8701 5B 8801 F1


1ST 16 BIT NUM: 96 2A 8802 00
ND
2 16 BIT NUM: 5B 43
SUM (RESULT) 00 F1 6D

Lab Manual P a g e | 13 BCA – V SEM


PROGRAM: 14. WRITE AN ALP TO DO SUBTRACTION OF ‘N’-1BYTE BINARY NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8200 0E 05 MVI C, 05H Set the C reg as Counter.

8202 21 00 85 LXI H, 8500H Initialize HL as Pointer.

8205 06 00 MVI B, 00H Clear B reg to store carry.

8207 7E MOV A, M Get the 1st no to Acc.

8208 23 L2: INX H Increment pointer by 1.

8209 96 SUB M Sub Acc - M, Diff to Acc.

820A D2 0E 82 JNC L1 Jump if CY=0 to loop L1.

820D 05 DCR B Decrement B reg by 1.

820E OD L1: DCR C Decrement Count by 1.

820F C2 08 82 JNZ L2 Jump if Z=0 to loop L2.

8212 32 00 87 STA 8700H Store the Diff into 8700.

8215 78 MOV A, B Get the Borrow into Acc.

8216 32 01 87 STA 8701H Store the Borrow into 8701.

8219 76 HLT End of the program.

INPUT: OUTPUT: AE
8500 => AE 8700 A6 22
8501 => 22 8701 FF 10
8502 => 10 23
8503 => 2A B3
8504 => B3 FF A6

Lab Manual P a g e | 14 BCA – V SEM


PROGRAM: 15. WRITE AN ALP TO DO BLOCK TRANSFER OF N BYTES OF DATA (REVERSE ORDER)

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8200 21 00 85 LXI H, 8500H Load HL as input Pointer.

8203 11 04 86 LXI D, 8604H Load DE as output Pointer.

8206 06 05 MVI B, 05H Set B reg as Counter (05).

8208 7E L1: MOV A, M Get the number to Acc.

8209 12 STAX D Store to DE pointed ML.

820A 23 INX H Increase the HL pair by 1.

820B 1B DCX D Decrease the DE pair by 1.

820C 05 DCR B Decrease the Count by 1.

820D C2 08 82 JNZ L1 Jump if Z=0 to L1 (Loop).

8210 76 HLT End of the Program.

INPUT: OUTPUT:
8500 30 8600 38
8501 45 8601 2B
8502 6E 8602 6E
8503 2B 8603 45
8504 38 8604 30

Lab Manual P a g e | 15 BCA – V SEM


PROGRAM: 16. WRITE AN ALP TO FIND 2’S COMPLEMENT OF A 16BIT NUMBER.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

Get the 1st byte to L and 2nd


9000 2A 00 87 LHLD 8700H
byte to H register.
9003 7D MOV A, L Get the 1st byte to Acc.

9004 2F CMA Complement the Acc.

9005 C6 01 ADI 01H Add 01 to get 2’s comp.

9007 67 MOV L, A Store back to L register.

9008 7C MOV A, H Get the 2nd byte to Acc.

9009 2F CMA Complement the Acc.

900A 6F MOV H, A Store back to H register.


Store L contents to 8800
900B 22 00 88 SHLD 8800H
and H contents to 8801.
900E 76 HLT End of the Program.

INPUT: OUTPUT:

8700 3E 8800 C2
8701 52 8801 AD

523E => 0101 0010 0011 1110


2’S COMPLEMENT => 1010 1101 1100 0010 == A D C 2

Lab Manual P a g e | 16 BCA – V SEM


PROGRAM: 17. WRITE AN ALP TO FIND THE LARGEST OF ‘N’-1BYTE OF BINARY NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8000 21 00 85 LXI H,8500H Load HL as input Pointer.

8003 7E MOV A, M Get the 1st no. to Acc.

8004 0E 04 MVI C, 04H Set the C reg as Counter.

8006 23 L2: INX H Increase pointer by 1.

8007 BE CMP M Compare with another no.

8008 D2 0C 80 JNC L1 Jump if CY=1 to L1 (Loop).

800B 7E MOV A, M Get SMALL into Acc.

800C 0D L1: DCR C Decrease the Count by 1.

800D C2 06 80 JNZ L2 Jump if Z=0 to L2 (Loop).


Store the small no. that is to
8010 32 F1 8F STA 8FF1H
be displayed in Data field.
8013 CD 4C 04 CALL 044CH Call Subroutine to display.

8016 76 HLT End of the program.

INPUT: OUTPUT:

8500 => 40 Largest DISPLAYS – 40 IN THE DATA FIELD


8501 => 30
8502 => 24
8503 => 16
8504 => 25

Lab Manual P a g e | 17 BCA – V SEM


PROGRAM: 18. WRITE AN ALP TO SIMULATE THE BINARY COUNTER (DISPLAY FROM 00 TO FF)

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8000 3E 00 MVI A, 00H Set the Acc with start 00.


Store the no. that is to be
8002 32 F1 8F L1: STA 8FF1H
displayed in data field.
8005 F5 PUSH PSW Push Acc + Flags to Stack.

8006 CD 4C 04 CALL 044C Call Subroutine to display.

8009 CD 55 55 CALL 5555 Call the delay Subroutine.

800C F1 POP PSW Pop Acc + Flags from Stack.

800D C6 01 ADI 01H Increment the no. by 1.

800F FE 00 CPI 00H Compare the no. with 00.

8011 C2 02 80 JNZ L1 Jump if Z=0 to L1 (Loop).

8014 76 HLT End of the Program.

INPUT: OUTPUT:

NO INPUT DISPLAYS BINARY COUNT FROM=> 00 TO FF

(INITIALIZED WITH COUNT 00)

Lab Manual P a g e | 18 BCA – V SEM


PROGRAM: 19. WRITE AN ALP TO CONVERT BINARY TO GRAY CODE OF AN 8BIT NUMBER.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND

8200 21 00 86 LXI H, 8600H Initialize HL as pointer.

8203 46 MOV B, M Get the num to B register.

8204 78 MOV A, B Get num to Accumulator.

8205 0F RRC Rotate Right Circular.

8206 E6 7F ANI 7FH Mask Acc with value 7F.

8208 A8 XRA B Ex-OR Acc with B register.


Store the no. that has to be
8209 32 F1 8F STA 8FF1H
displayed in data field.
820C CD 4C 04 CALL 044CH Call Subroutine to display.

820F 76 HLT End of the Program.

INPUT: OUTPUT:

8600 => 25H DISPLAYS -- 37 ON DATA FIELD

8600 => A9H DISPLAYS -- FD ON DATA FILED

Lab Manual P a g e | 19 BCA – V SEM


PROGRAM: 20. WRITE AN ALP TO DO MULTIPLICATION OF 2 DIGIT BINARY NUMBERS.

HEX- CODE MNEMONICS


ADDRESS LABEL COMMENTS
1B 2B 3B OPCODE OPERAND
Load contents of 8300 to L &
8400 2A 00 83 LHLD 8300H
contents of 8301 to H.
8403 AF XRA A Clear Acc and flags.

8404 47 MOV B, A Initialize B reg with 00.

8405 84 L2: ADD H Add Acc + H. Store to Acc.

8406 D2 0A 84 JNC L1 Jump if Z=0 to L1 (Loop).

8409 04 INR B Increase the B reg by 1.

840A 2D L1: DCR L Decrease no. of additions.

840B C2 05 84 JNZ L2 Jump if Z=0 to L2 (Loop).

840E 6F MOV L, A Store Acc contents to L.

840F 60 MOV H, B Store B reg contents to H.

8410 22 EF 8F SHLD 8FEFH Store product to display.

8413 CD 40 04 CALL 0440H Call Subroutine to display.

8416 76 HLT End of the Program.

INPUT: OUTPUT:

8300 04 DISPLAYS 000C IN ADDRESS FIELD


8301 03
8300 04 DISPLAYS 03FF IN ADDRESS FIELD
8301 FF

Lab Manual P a g e | 20 BCA – V SEM

You might also like