0% found this document useful (0 votes)
58 views

Microprocessor Architecture

The program loads data from memory location 8500H into the accumulator, performs a bitwise AND operation with the value 0FH to mask off the upper nibble, and stores the result back to memory location 8501H. It then halts execution.

Uploaded by

Tanaya
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Microprocessor Architecture

The program loads data from memory location 8500H into the accumulator, performs a bitwise AND operation with the value 0FH to mask off the upper nibble, and stores the result back to memory location 8501H. It then halts execution.

Uploaded by

Tanaya
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 64

Write a program

1 a. Store the data byte 32H in memory

Mnemonics
opcode
XRA A
0001 MVI A
0002
0003 STA
0004
0005
0006 HLT

Address Mnemonic Hex Code Comment

7001 32
7002 STA 8000H 22 Copy the content at
7003 00
7004 80
7005 HLT 76 Terminate the program

Address
the data byte 32H in memory location 8000H

Mnemonics Hex code Label Comment


operand
AF ;Clear the accumulator
32 H 3E ;store 32H data in accumulator
32
8000 H 22 ;store the data at address 8000 H
00
80
76 ;End

Mnemonic Hex Code Comment

8000H 22 Copy the content at address 8000h

76 Terminate the program


2c

Address Mnemonics Hex code Comment

7000 LHLD 8000H 2A Get the content in HL register pair from the memory location 8000H & 8001H
7001 XCHG 00
7002 LHLD 8002H 80
7003 EB Swap the contents with HL register and DE register
7004 2A Get the content in HL register pair from the memory location 8002H & 8003H
7005 02
7006 80
7007 MOV A,E 7B Move the data from E register to the accumulator
7008 ADD L 85 Add the L register with accumulator
7009 MOV L, A 6F Store the value in L register from the accumulator
700A MOV A,D 7A Move the data from D register to the accumulator
700B ADC H 8C Add the carry the H register with accumulator
700C MOV H,A 67 Store the value in H register from the accumulator
700D SHLD 8004H 22 Store the HL register pair in memory location 8004H and 8005H
700E 04
700F 80
7010 HLT 76 Terminate the program
location 8000H & 8001H

location 8002H & 8003H


2d

Address Mnemonics Hex code Comment

7000 LHLD 8000H 2A Get the content in HL register from memory location 8000H and 8001H
7001 00
7002 80
7003 XCHG EB Swap the contents of HL register & DE register
7004 LHLD 8002H 2A Get the content in HL register from memory location 8020H and 8003H
7005 02
7006 80
7007 MOV A,E 7B Move the content of E register into accumulator
7008 SUB L 95 Subtract the contents of L register from the accumulator
7009 MOV L,A 6F Store the value in L register
700A MOV A,D 7A Move the content of D register into accumulator
700B SBB H 9C Subtract with borrow the contents of H register from accumulator
700C MOV H,A 67 Store the value in L register
700D SHLD 8004H 22 Store HL register in memory location 8004H & 8005H
700E 04
700F 80
7010 HLT 76 Terminate the program
8000H and 8001H

8020H and 8003H

accumulator
1a

Address Mnemonics Hex code Comment


7000 MVI A,32H 3E Store the data into accumulator
7001 32
7002 STA 8000H 22 Copy the content address at 8000h
7003 00
7005 HLT 80
76 Terminate the program
1 b. A block of data consisting of 256 bytes is stored in memory starting at 8000H. Write a assembly language program to
1b
Address Mnemonics Hex code Label Comment
7000 MVI C, 0F H 0E Set up B to count 16 bytes
7001 0F
7002 LXI H, 8000H 21 Setup HL pair as a pointer for source memory.
7003 00
7004 80
7005 LXI D, 8050H 21 Set up DE pair as a pointer for destination memory
7006 50
7007 80
7008 MOV A,M 7E Back: Get data byte from source.
7009 STAX D 12 Store data byte as destination
700A INX H 23 Increment HL pair to access next Source destination
700B INX D 13 Increment DE pair to access next Source destination
700C DCR C 0D Decrement count
700D JNZ C2 Back If counter is not 0, go back to transfer data byte.
700E 00
700F 00
7010 HLT 76 Stop
ssembly language program to shift this block in memory from 8050H onwards.

ource memory.

destination memory

xt Source destination
xt Source destination

ansfer data byte.


1c

Address Mnemonic Hex Code Label Comment


7000 LDA 8000H 3A Get the content of the memory address 8000H into accumulator
7001 00
7002 80
7003 MOV B,A 47 Save the contents into B register
7004 LDA 9000H 3A Get the content of the memory address 9000H into accumulator
7005 00
7006 90
7007 STA 8000H 22 Store the contents of the accumulator into memory address 8000H
7008 00
7009 80
700A MOV A,B 78 Get the saved contents back into register
700B STA 9000H 22 Store the contents of accumulator at address 9000H
700C 00
700D 90
700E HLT 76 Terminate the program
000H into accumulator

000H into accumulator

o memory address 8000H


2a

Address Mnemonic Hex code Comment


7000 LDA 8000H 3A Get the first data from accumulator from 8000H
7001 00
7002 80
7003 MOV B,A 47 Move the data into register (B register)
7004 LDA 8000H 3A Get the second data from accumulator from 8000H
7005 01
7006 80
7007 MOV C,A 4F Move the data into register (C register)
7008 LDA 8000H 3A Get the first data into accumulator from 8000H
7009 00
700A 80
700B ADD C 81 Add the second data with the first data which is present in accumulator
700C STA 8002H 22 Store the ans in memory location 8002H
700D 02
700E 80
700F HLT 76 Terminate the program
ent in accumulator
2b

Address Mnemonics Hex code Comment


7000 LDA 8000H 3A Get the first data into accumulator from 8000H
7001 00
7002 80
7003 MOV B,A 47 Move the data into register B
7004 LDA 8001H 3A Get the second data into accumulator from 8001H
7005 01
7006 80
7007 MOV C,A 4F Move the data into register C
7008 SUB B 90 Subract the data stored in register b from accumulator
7009 STA 8002H 22 Store the data into memory location 8002H
700A 02
700B 80
700C HLT 76 Terminate the program
2c

7000 LHLD 8000H 2A Get the content in HL register pair from memory location 8000H & 8001H
7001 00
7002 80
7003 XCHG EB Swap the contents with HL register & DE register
7004 LHLD 8002H 2A Get the content in HL register pair from memory location 8002H & 8003H
7005 02
7006 80
7007 MOV A, E 7B Move the data from E register to accumutor
7008 ADD L 85 Add the L register with accumulator
7009 MOV L, A 6F Store the value in L register from accumultor
700A MOV A, D 7A Move the data from D register to accumutor
700B ADC H 8C Add with carry the H register with accumulator
700C MOV H, A 67 Store the value in H register from accumultor
700D SHLD 8004H 22 Store the HL register in memory location 8004H & 8005H
700E 04
700F 80
7010 HLT 76 Terminate the program
2c

Address Mnemonics Hex code Comment


7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
700A
700B
700C
700D
700E
700F
2e

Address Mnemonics Hex code Comment


7000 LDA 8400H 3A Get the content into accumulator from memory location 8400H
7001 00
7002 84
7003 CMA 2F Complement the number in accumulator
7004 STA 8300H 22 Store the ans in memory location 8300H
7005 0
7006 83
7007 HLT 76 Terminate the program
2f

Address Mnemonic Hex code Comment


7000 LDA 8200H 3A Get the content into accumulator from memory location 8200H
7001 00
7002 82
7003 CMA 2F Complement the number in accumulator
7004 ADI 01H C6 Add one in the complement number
7005 01
7006 STA 8300H 23 Store the ans in memory location 8300H
7007 00
7008 83
7009 HLT 78 Terminate the program
3:00 AM

Address Mnemonics Hex code Comment


7000 LDA 8500H 3A Get the content of memory location 8500 in accumulator A
7001 00
7002 85
7003 ANI 0FH C6 Perform AND operation with the contents of accumulator and 0FH
7004 0F
7005 STA 8501H 22 Store contents of Accumulator to memory location 8501H
7006 01
7007 85
7008 LDA 8500H 3A Loads the content of memory location 8500 in accumulator A
7009 00
700A 85
700B ANI F0H C6 Perform AND operation with contents of accumulator and F0H
700C F0
700D RRC 0F Rotate each bit in accumulator right by one position
700E RRC 0F Rotate each bit in accumulator right by one position
700F RRC 0F Rotate each bit in accumulator right by one position
7010 RRC 0F Rotate each bit in accumulator right by one position
7011 STA 8502H 22 Store contents of Accumulator to memory location 8502H
7012 02
7013 85
7014 HLT 76 Terminate the program
lator and 0FH
4:00 AM

Address Mnemonics Hex code Comment


7000 LDA 8000H 3A Get the content from memory location 8000H
7001 0
7002 80
7003 MOV C, A 4F Move the content into register C
7004 RAR 1F Rotate Accumulator Right
7005 RAR 1F Rotate Accumulator Right
7006 RAR 1F Rotate Accumulator Right
7007 RAR 1F Rotate Accumulator Right
7008 MOV C, A 4F Move the value in register C
7009 STA 8001H 22 Store the value at memory location 8001H
700A 01
700B 80
700C HLT 76 Terminate the program
4b

Address Mnemonics Hex code Comment


7000 LHLD 8000H 2A Get the contents into register pair HL from memory location 8000H and 8001H
7001 00
7002 80
7003 MOV A,L 70 Move the content into accumulator from register L
7004 RAL 17 Rotate accumulator left
7005 MOV L,A 6F Move the content into register L from accumulator
7006 MOV A,H 7C Move the content into accumulator from register h
7007 RAL 17 Rotate accumulator left
7008 MOV H,A 67 Move the content into register H from accumulator
7009 SHLD 8004H 22 Store the contents of HL register into memory location 8004H & 8005H
700A 04
700B 80
700C HLT 76 Terminate the program
ocation 8000H and 8001H

on 8004H & 8005H


3c

Address Mnemonics Hex code Label Comment


7000 LXI D, 99FH 11 Get the data 99FFH into register DE
7001 FF
7002 99
7003 MVI B, 00H 06 Move the data 00H in register B
7004 00
7005 MVI C, 08H 0E Move the data 08H in register C
7006 08
7007 MOV A,D 7A Move the content of D register into accumulator A
7008 BACK: RAR 1F Back: Rotate accumulator right with carry
7009 JNC SKIP D2 Skip Jump if no carry
700A 0D
700B 70
700C INR B 04
700D SKIP: DCR C 0D Skip:
700E JNZ BACK C2 Back Jump if no zero i
700F 08
7010 70
7011 MOV A,B 78 Move the contents to a B register from accumulator A
7012 HLT 76 Terminate the program
cumulator A
5:00 AM

Address Mnemonics Hex code Label Comment


7000 LXI H, 8200H 21 Get the data 8200H in HL pair
7001 00
7002 82
7003 MOV C,M 4E Move the content of H register into C register
7004 MVI B,00H 06 Initialize B register 00H
7005 00
7006 INX H 23 Increment HL pair by 2
7007 MOV A,M 7E REPEAT Move the content of H register into accumulator
7008 RAR 1F Rotate accumulator right
7009 JC SKIP DA Jump if carry is set
700A 0F
700B 70
700C RAL 17 Rotate accumulator left
700D ADD B 80 Add the content of B register & accumulator
700E MOV B,A 47 Move the content of accumulator into B register
700F INX H 23 SKIP Increment HL pair by 2
7010 DCR C 0D Decrement C register by 2
7011 JNZ REPEAT C2 jump if counter is 1
7012 07
7013 70
7014 STA 8300H 32 Store the value in memory location 8300H
7015 00
7016 83
7017 HLT 76 Terminate the program
0
5C

Address Mnemonics Hex code Label Comment


7000 LXI H,8200H 21 Get the content from memory address 8200H
7001 00
7002 82
7003 MVI D,00H 16 Initialize register D to 00
7004 00
7005 MVI A,00H 3E Initialize Accumulator content to 00
7006 00
7007 MOV B,M 46 Get the first number in B register
7008 INX H 23 Increment HL pair by 1
7009 MOV C,M 4E Get the second number in C register
700A ADD B 80 REPEAT: Add content of accumulator to register B
700B JNC SKIP D2 Jump on no carry
700C 0F
700D 70
700E INR D 14 Increment content of register D
700F DCR C 0D SKIP: Decrement content of register C
7010 JNZ REPEAT C2 Jump on no zero
7011 0A
7012 70
7013 STA 8300H 32 Store the result in Memory location 8300H
7014 00
7015 83
7016 MOV A,D 7A Move D register into accumulator
7017 STA 8301H 32 Store the result in Memory location 8301H
7018 01
7019 83
701A HLT 76 Terminate the program
5d

Address Mnemonics Hex code Label Comment


7000 LXI H,800H 21 Point 8000H address
7001 00
7002 80
7003 MOV A,M 7E Store the lower order byte
7004 INX H 23 Increase the HL pair to point next loop
7005 MOV B, M 46 Store the higher order byte
7006 INX H 23 Increase the HL pair to point next loop
7007 MOV C,M 4E Load the denominator
7008 INR B 04 Increase the B register
7009 LXI H,0000H 21 Store 0000H into HL pair
700A 00
700B 00
700C SUB C 91 LOOP Subract C from acc
700D JC SKIP DA Jump to SKIP when C Y
700E 14
700F F0
7010 INX H 23 INCR Increase quotient part
7011 JMP LOOP C3 Jump to LOOP
7012 0C
7013 F0
7014 DCR B 05 SKIP Decrease B
7015 JZ STORE CA Jump to store when z=1
7016 1B
7017 F0
7018 JMP INCR C3 Jump to INCR
7019 10
701A F0
701B ADD C 81 STORE Add c with Acc
701C XCHG EB swap DE and HL pair contents
701D LXI H, 8300H 21 Load the destination address
701E 50
701F 80
7020 MOV M,E 73 Store the lower order quotient
7021 INX H 23 Increase HL pair
7022 MOV M,D 72 Store the higher order quotient
7023 INX H 23 Increase HL pair
7024 MOV M,A 77 Store the remainder
7025 HLT 76 Terminate the program
5e

Address Mnemonics Hex code Label Comment


7000 LDA 8200H 3A Get the content into content into accumulator from memory location 82
7001 00
7002 82
7003 MOV C,A 4F Initialize count
7004 MVI B, 00H 06 Negative number=0
7005 00
7006 LXI H,8201H 21 Initialize pointer
7007 01
7008 82
7009 MOV A,M 7E BACK: Get the number into accumulator
700A ANI 80H E6 Check for MSB
700B 80
700C JZ SKIP CA Jump if MSB=1
700D 10
700E 70
700F INR B 04 Increment negative number count by 1
7010 INX H 23 SKIP: Increment pointer by 1
7011 DCR C 0D Decrement count by 1
7012 JNZ BACK C2 Jump if count 0 repeat
7013 09
7014 70
7015 MOV A,B 78 Move the counter into accumulator
7016 STA 8300H 32 Store the result in memory location 8300H
7017 00
7018 83
7019 HLT 76 Terminate the program
ator from memory location 8200H
5F

Address Mnemonics Hex code Label Comment


7000 LXI H, 8100H 21 Load the number from 800H
7001 00
7002 81
7003 XRA , A AF Clear accumulator
7004 MOV B,M 46 Load data from memory to B
7005 ADD M 86 LOOP Add memory byte with A
7006 DCR B 05 Decrease B by 1
707 JNZ LOOP C2 if Z=0, jump to loop
7008 05
7009 70
700A STA 9000H 32 Store result into memory
700B 00
700C 90
700D HLT 76 Terminate the program
3b

Address Mnemonics Hex code Comments


7000 LDA 8201H 32 Get the content in accumulator from memory location 8201H
7001 01
7002 82
7003 RLC 07 Rotate the content of the accumulator to the left with carry
7004 RLC 07 "
7005 RLC 07 "
7006 RLC 07 "
7007 ANI F0H E6 and operation of accumulator with F0H
7008 F0
7009 MOV C, A 4F Move the content of the accumulator in the C register
700A LDA 8200H 32 Get the second data into accumulator from the memory location 8200H
700B 00
700C 82
700D ADD C 81 ADD the content of the C register with the accumulator
700E STA 8300H 32 Store the content of the accumulator in the memory location 8300H
700F 0
7010 32
7011 HLT 76 Terminate the Program
ory location 8200H

location 8300H
3c

Address Mnemonics Hex code


3c

Address Mnemonics Hex code Comment


7000 LDA 8200H 32 Get the content in accumulator from memory location 8200H
7001 00
7002 82
7003 MOV C, A 79 moving the content of the accumulator in the C register
7004 ANI 0FH E6 AND of accumulator with 0FH
7005 0F
7006 STA 8300H 32 Storing the content of accumulator in memory location 8300H
7007 00
7008 83
7009 MOV A, C 4F Move the content of register C in accumulator
700A ANI F0H E6 And of accumulator with F0H
700B F0
700C RAR 1F Rotate the accumulator to the right
700D RAR 1F Rotate the accumulator to the right
700E RAR 1F Rotate the accumulator to the right
700F RAR 1F Rotate the accumulator to the right
7010 STA 8301H 32 Store the content of the accumulator in the memory location 8301H
7011 01
7012 83
7013 HLT 76 Terminate the program
location 8301H
6:00 AM

Address Mnemonics Hex code Label Comment


7000 LXI H, 2200H 21 START: Initialize memory pointer
7001 00
7002 22
7003 MVI B, 09H 06 Initialize counter
7004 09
7005 MVI C, 09H 0E Initialize counter 2
7006 09
7007 MOV A, M 7E BACK: Get the number
7008 INX H 23 Increment memory pointer
7009 CMP M BE Compare number with next number
700A JC SKIP DA If less, don't interchange
700B 15
700C 80
700D JZ SKIP CA If equal, don't interchange
700E 15
700F 80
7010 MOV D,M 56 Get the number into register D from memory
7011 MOV M,A 77 Get the number into memory from accumulator
7012 DCX H 2B Decrement the pointer
7013 MOV M, D 72 Get the number from register D into memory
7014 INX H 23 Interchange two numbers
7015 DCR C 0D SKIP: Decrement counter 2
7016 JNZ BACK C2 If counter 2 is not zero, repeat
7017 07
7018 80
7019 DCR B 05 Decrement counter 1
701A JNZ START C2 If counter 1 is not zero, repeat
701B 00
701C 80
701D HLT 76 Terminate the program
6b

Address Mnemonics Hex code Label Comment


7000 LXI H, 8000H 21 Initialize memory pointer 52H
7001 00
7002 80
7003 MVI C, 52H 0E Initialize counter
7004 52
7005 MOV A, C 79 Get the number
7006 INX H 23 LOOP: Increment memory pointer
7007 CMP M BE Compare with the given byte
7008 JZ LAST CA Go last if match occurs
7009 18
700A 70
700B DCR C 0D Decrement counter
700C JNZ LOOP C2 If not zero, repeat
700D 06
700E 70
700F LXI H, 8000H 21 Load FFFFH into HL pair
7010 FF
7011 FF
7012 SHLD 8200H 22 Store the memory address at 8200H and 8201H
7013 00
7014 82
7015 JMP END C3 Store 00 at 8200H and 8201H
7016 1B
7017 70
7018 SHLD 8200H 22 LAST: Store memory address
7019 00
701A 82
701B HLT 76 END: Terminate the program
6C

Address Mnemonics Hex code Label Comment


7000 LDA 2200H 3A Get the data into accumulator
7001 00
7002 22
7003 MOV C, A 4F Initialize counter
7004 XRA A AF Clear Accumulator
7005 LXI H, 2201H 21 Initialize pointer
7006 01
7007 22
7008 CMP M BE BACK: Is number>maximum
7009 JNZ SKIP D2 Yes, replace maximum
700A 0D
700B 70
700C MOV A, M 7E Move the data into accumulator
700D INX H 23 SKIP: Increment the pointer
700E DCR C 0D Decrement the counter
700F JNZ BACK C2 Jump if number not maximum
7010 08
7011 70
7012 STA 2300H 32 Store maximum number
7013 00
7014 23
7015 HLT 76 Terminate the program
7:00 AM

Address Mnemonics Hex code Label Comment


7000 LXI H, 2200H 21 Initialize memory pointer 1
7001 00
7002 22
7003 LXI D, 2300H 11 Initialize memory pointer 2
7004 00
7005 23
7006 MVI C, 32H 0E Initialize counter
7007 32
7008 MOV A, M 7E BACK: Get the number
7009 ANI 01H E6 Check for even number
700A 01
700B JNZ SKIP C2 If ODD, don't store
700C 11
700D 70
700E MOV A,M 7E Get the number
700F STAX D 12 Store the number in result list
7010 INX D 13 Increment pointer 2
7011 INX H 23 SKIP: Increment pointer 1
7012 DCR C OD Decrement counter
7013 JNZ BACK C2 If not zero, repeat
7014 08
7015 70
7016 HLT 76 Terminate the program
7b

Address Mnemonics Hex code Label Comment


7000 LXI H, 2040H 21 Get the data from the memory
7001 40
7002 20
7003 MOV C, M 71 Counter for character
7004 INX H 23 REPEAT: Memory pointer
7005 MOV A, M 77 Character in accumulator
7006 ORA A B7 O ring with itself to check parity
7007 JPO SKIP E2 If odd parity place
7008 0C
7009 70
700A ORI 80H F6 Even parity in D7(80)
700B 80
700C MOV M, A 7E SKIP: Store converted even parity character
700D DCR C 0D Decrement counter
700E JNZ REPEAT CA If not zero go for the next character
700F 4
7010 70
7011 HLT 76 Terminate the program
7c

Address Mnemonics Hex code Label Comment


7000 LXI H, 8000H 21 Initialize memory pointer
7001 00
7002 80
7003 MVI C, 00H 0E Initialize number counter
7004 00
7005 MVI B, 00H 06 Initialize negative number counter
7006 00
7007 MVI E, 00H 1E Initialize zero number counter
7008 00
7009 MOV A, M 7E BEGIN: Get the number
700A CPI 00H FE If number = 0
700B 00
700C JZ ZERO CA Goto ZERO
700D 18
700E 70
700F ANI 80H E6 If MSB of number = 1
7010 80
7011 JNZ NEG C2 If number is negative goto NEG
7012 1C
7013 70
7014 INR D 14 Otherwise increment positive number counter
7015 JMP LAST C3 If number is positive then goto LAST
7016 1D
7017 70
7018 INR E 1C ZERO: Increment zero number counter
7019 JMP LAST C3 If number is zero number then goto LAST
701A 1D
701B 70
701C INR B 04 NEG: Increment negative number counter
701D INX H 23 LAST: Increment memory pointer
701E INR C 0C Increment number counter
701F MOV A, C 79
7020 CPI 14H FE If number counter = 20
7021 14
7022 JNZ BEGIN C2 Store it, otherwise check next number
7022 09
7024 70
7025 LXI H, 9000H 21 Initialize memory pointer
7026 00
7027 90
7028 MOV M, B 70 Store negative number
7029 INX H 23 Increment memory pointer
702A MOV M, E 73 Store zero number
702B INX H 23 Increment memory pointer
702C MOV M, D 72 Store positive number
702D HLT 76 Terminate the program
7d

Address Mnemonics Hex code Label Comment


7000 MVI D, 09H 16 Initialize the pointer at which the fibonacci number lies
7001 09
7002 MVI B, 00H 06 Initialize first number in the fibonacci series
7003 00
7004 MVI C, 01H 0E Initialize second number in the fibonacci series
7005 01
7006 MOV A, B 78 AGAIN: Get the first number in the accumulator
7007 ADD C 81 Add the second number with the accumulator
7008 MOV B, C 41 Move the second number in register B
7009 MOV C, A 4F Move the result from accumulator in register C
700A DCR D 15 Decrement the pointer
700B JNZ AGAIN C2 Jump till we get the pointer numbers ans in fibonacci number
700C 06
700D 70
700E HLT 76 Terminate the program
i number lies

n fibonacci number
7e

Address Mnemonics Hex code Label Comment


7000 LDA 8000H 3A Get the number
7001 00
7002 80
7003 CPI 02H FE Check if number is greater than 1
7004 02
7005 JC LAST DA Jump if not greater than 1
7006 17
7007 70
7008 MVI D, 00H 16 Load number as a result
7009 00
700A MOV E, A 5F Move the data into accumulator
700B DCR A 3D Decrement accumulator for next number
700C MOV C, A 4F Load counter one less than number
700D CALL FACTO CD Call subroutine FACTO
700E 1E
700F 70
7010 XCHG EB Get the result in HL
7011 SHLD 8001H 22 Store result in the memory
7012 01
7013 80
7014 JMP END C3 Jump to END to store the result
7015 1A
7016 70
7017 LXI H, 0001H 21 LAST: Store result = 01
7018 01
7019 00
701A SHLD 8001H 22 END: store the result in memory location 8001H
701B 01
701C 80
701D HLT 76 Terminate the program
701E LXI H, 0000H 21 FACTO: initialize pointer
701F 00
7020 00
7021 MOV B, C 41 Load counter
7022 DAD D 19 BACK: Multiply by successive addition
7023 DCR B 05 Decrement the number
7024 JNZ BACK C2 Jump till the result we get
7025 22
7026 70
7027 XCHG EB Store result in DE
7028 DCR C 0D Decrement counter
7029 CNZ FACTO C4 Call subroutine FACTO
702A 1E
702B 70
702C RET C9 Return to main program
8:00 AM

Address Mnemonics Hex code Label Comment


7000 LXI H, 8113H 21 Initialize pointer at the last location of array
7001 13
7002 81 Initialize another pointer to point the last location of array oafter inserti
7003 LXI H, 8117H 11
7004 17
7005 81
7006 MOV A,M 7E AGAIN: Get the character
7007 STAX D 12 Store at the new location
7008 DCX D 1B Decrement destination pointer
7009 DCX H 2B Decrement source pointer
700A MOV A,L 7D Check whether desired bytes are shifted or not
700B CPI 09H FE
700C 09
700D JNZ AGAIN C2 If not repeat the process
700E 06
700F 70
7010 INX H 23 adjust the memory pointer
7011 LXI D, 8200H 11 Initialize the memory pointer to point the string to be inserted
7012 00
7013 82
7014 LDAX D 1A REPEAT: Get the character
7015 MOV M,A 77 Store it in the array
7016 INX D 13 Increment the source pointer
7017 INX H 23 Increment destination pointer
7018 MOV A, E 7B Check whether the 4 bytes are inserted
7019 CPI 04H FE
701A 04
701B JNZ REPEAT C2 If not repeat the process
701C 14
701D 70
701E HLT 76 Terminate the program
ocation of array oafter insertion

string to be inserted
8b

Address Mnemonics Hex code Label Comment


7000 LXI H, 810EH 21 Initialize source memory pointer at the 14th location
7001 0E
7002 81
7003 LXI D, 810AH 11 Initialize destination memory pointer at the 10th location
7004 0A
7005 81
7006 MOV A, M 7E REPEAT: Get the character
7007 STAX D 12 Store character at new location
7008 INX H 23 Increment destination pointer
7009 INX D 13 Increment source pointer
700A MOV A, L 7D Check whether desired bytes are shifted or not
700B CPI 20H FE
700C 20
700D JNZ REPEAT C2 If not repeat the process
700E 06
700F 70
7010 HLT 76 Terminate the program
e 10th location
9:00 AM

Address Mnemonics Hex code Label Comment


7000 LDA 8201H 3A Load the accumulator from memory location 8201H
7001 01
7002 82
7003 MOV B, A 47 Move the data into register B
7004 LDA 8200H 3A Load the accumulator from memory location 8200H
7005 00
7006 82
7007 MOV C, A 4F Move the data into register C
7008 ADD B 80 Add the content of register B with accumulator
7009 CALL ADDITION CD Now call a subroutine program which will adjust the data into BCD
700A 10
700B 70
700C STA 8300H 32 Store the data into memory location 8300H
700D 00
700E 83
700F HLT 76 Terminate the program
7010 ADI 06H C6 ADDITION: Adjust the data by adding 06 in it
7011 06
7012 RET C9 Return to the main program
adjust the data into BCD
9b

Address Mnemonics Hex code Label Comment


7000 LDA 8200H 3A Get the first data into accumulator
7001 00
7002 82
7003 MOV E, A 5F Move the data into register E
7004 MVI D, 00H 16 Get the first number in DE register pair
7005 00
7006 LDA 8201H 3A Get the second data into accumulator
7007 01
7008 82
7009 MOV C, A 4F Initialize counter
700A LXI H, 0000H 21 Result = 0
700B 00
700C 00
700D DAD D 19 BACK: Result = result + first number
700E DCR C 0D Decrement count
700F JNZ BACK C2 If count 0 repeat
7010 0D
7011 70
7012 SHLD 8300H 22 Store result
7013 00
7014 83
7015 LDA 8300H 3A Load the result
7016 00
7017 83
7018 CALL STORE CD Call the subroutine program
7019 1C
701A 70
701B HLT 76 Terminate the program
701C MOV B, A 47 STORE: Store the result in register B
701D RET C9 Return to the main program
Score
ADALL
2 deepak 4

Mohamm
ed Aatif
Altaf
3 Ambedkar 4
Harsh
Chetan
5 Avadhan 3
Atharva
6 Chavan 3
Sheetal
14 Chauhan 4

Himanshu
Chaurasiy
15 a 2
ROHAN
16 CHAVAN 3
Nayama
Premchan
17 d das 3
Pratham
19 dubey 3
Aniket
Mahesh
22 Gupta 2
10:00 AM

Address Mnemonics Hex code Comment


7000 LHLD 8002H 2A Load HL pair with memory location 8002H
7001 02
7002 80
7003 XCHG EB Register pair DE & HL are exchanged
7004 LHLD 8000H 2A load HL pair with memory location 8002H
7005 00
7006 80
7007 MOV A, L 7D Get the data into accumulator
7008 ADD E 83 Add second lower bit with accumulator
7009 DAA 27 adjust the result by adding 6 in it
700A STA 2300H 32 store the result in memory location 2300H
700B 00
700C 23
700D MOV A, H 7C Get the data into accumulator
700E ADC D 8A Add second higher bit with accumulator
700F DAA 27 adjust the result by adding 6 in it
7010 STA 2301H 32 store the result in memory location 2301H
7011 01
7012 23
7013 HLT 76 Terminate the program
10 b

Address Mnemonics Hex code Comment


7000 LDA 8001H 3A load accumulator from memory location 8001H
7001 01
7002 80
7003 MOV E, A 5F move the data into register E
7004 MVI A, 99H 3E get the data 99H into accumulator
7005 99
7006 SUB E 93 Subtract register E by accumulator
7007 INR A 3C Increment the accumulator
7008 MOV D, A 57 Store the result in register D
7009 LDA 8000H 3A load accumulator from memory location 8000H
700A 00
700B 80
700C ADD D 82 Add the data with register D
700D DAA 27 Adjust the number by adding 6 in it
700E STA 9000H 32 store the result in memory location 9000H
700F 00
7010 90
7011 HLT 76 Terminate the program
10 c

Address Mnemonics Hex code Label Comment


7000 MVI C, 5AH 0E Load BCD multiplier
7001 5A
7002 MVI B, 00H 06 Initialize counter
7003 00
7004 LXI H, 000H 21 Result=0000
7005 00
7006 00
7007 MVI E, 34H 1E Load multiplicand
7008 34
7009 MVI D, 00H 16 Extend to 16-bits
700A 00
700B DAD D 19 BACK: Result= Result + Multiplicand
700C MOV A, L 7D Get the lower byte of the result
700D ADI 00H C6
700E 00
700F DAA 27 Adjust the lower byte of result to BCD
7010 MOV L, A 6F Store the lower byte of the result
7011 MOV A, H 7C Get the higher byte of the result
7012 ACI 00H CE
7013 00
7014 DAA 27 Adjust the higher byte of result to BCD
7015 MOV H, A 67 Store the higher byte of the result
7016 MOV A, B 78 Increment counter
7017 ADI 01H C6
7018 01
7019 DAA 27 adjust it to BCD
701A MOV B, A 47 store the counter in register B
701B CMP C B9 Compare if count = multiplier
701C JNZ BACK C2 if not equal repeat
701D 0B
701E 70
701F HLT 76 Terminate the program
5 ab

Address Mnemonics Hex code Label Comment


7000 LDA 8200H 3A Get the content into accumulator from memory location 8200H
7001 00
7002 82
7003 MOV C,A 4F Move accumulator to register C
7004 LXI H, 8201H 21 Get the data into HL pair starting from memory location 8201
7005 01
7006 82
7007 SUB A 97 Initialize counter
7008 MOV B,A 47 Move the counter number approximately from accumulator to register
7009 ADD M 86 BACK: Add Memory data with accumulator
700A JNC SKIP D2 Jump if no carry is set
700B 0E
700C 70
700D INR B 04 Increment B register by 1
700E INX H 23 Increment H pair by 1
700F DCR C 0D SKIP: Decrement counter by00H
7010 JNZ BACK C2 Jump if the value is zero
7011 09
7012 70
7013 STA 8300H 32 Store the value at memory location 8300H
7014 00
7015 83
7016 MOV A, B 78 Move the data into accumulator from B register
7017 STA 8301H 32 Store the value at memory location 8301H
7018 01
7019 83
701A HLT 76 Terminate the program
emory location 8200H

mory location 8201

from accumulator to register B


5c

Address Mnemonics Hex code Label Comment


7000 LDA 8200H 3A Get the content into accumulator from memory location 8200H
7001 00
7002 82
7003 MOV C,A 4F Move the data into register C from accumulator
7004 MVI B,00H 06 Initialize register B 00H
7005 00
7006 LXI H 8201H 21 Initialize pointer
7007 01
7008 82
7009 MOV A,M 7E BACK: Move the memory data into accumulator
700A ANI 01H E6 Masking of bits
700B 01
700C JNZ SKIP C2
700D 12
700E 70
700F MOV A,B 78 Move register B data into accumulator
7010 ADD M 86 SKIP: Add memory data from accumulator
7011 MOV B,A 47 Move the accumulator into register B
7012 INX H 23 Increment the HL pair
7013 DCR C 0D Decrement the counter
7014 JNZ BACK C2 Jump if counter is 0
7015 9
7016 70
7017 STA 8000H 32 Store the data in memory location 8000H
7018 00
7019 80
701A HLT 76 Terminate the program
emory location 8200H

You might also like