0% found this document useful (0 votes)
38 views42 pages

Allsolution Paper IISETATOTAL42 ST

Uploaded by

Tanmay Panghate
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)
38 views42 pages

Allsolution Paper IISETATOTAL42 ST

Uploaded by

Tanmay Panghate
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/ 42

EXPERIMENT : 1

SLIP NO 1
Q1)a) Program is stored from memory location C000H to C002H.
Copy the contents of these memory locations on paper and disassemble the program
using op-code sheet.

Memory Opcodes Label Mnemonic Operand Comment/Remarks


Address
F000 21,00,C0 LXI H,C000H Initialize HL as ML C000H
F003 11,03,C0 LXI D, C003H Initialize DE as ML D000H
F006 0E,03 MVI C,03H Get data in regi C i.e. set counter
F008 7E UP MOV A,M Get content in A from HL i.e. M regi
F009 EB XCHG Exchange as HL -- DE
F00A 77 MOV M,A Get contet in M from A
F00B EB XCHG Exchange as HL -- DE
F00C 23 INX H Increment HL by one location
F00D 13 INX D Increment DE by one location
F00E 0D DCR C Decrement counter
F00F C2,08,F0 JNZ UP If if count # 0 then goto label UP and
execute instruction MOV A,M
F012 CF RST 1 Stop processing

DATA ( Before Execution )


Address DATA
C000H 06H
C001H 12H
C002 18H

Q1)b
b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 18 01 00 C0 06 54 0F C0 03 FFEB F013
Execution

Result Data After Execution Address Result


C003H 06H
C004H 12H
C005H 18H
Flags After Execution & Interpret’s its meaning is

After Execution = F = 54 = 01010100


1) CY = 0  Result is 8-bit .
2) P = 1 But there are number of 1’s are = 3=odd  P= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 1
SLIP NO 1
Q1)a) Program is stored from memory location C000H to C002H.
Copy the contents of these memory locations on paper and disassemble the program
using op-code sheet.
Memory Opcodes Label Opecodes Operand Comment
Address
F000 01,00,C0 LXI B, C000H Initialize BC address to location
F003 21,03,C0 LXI H,C003H Initialize HL address to location
F006 16,03 MVI D,03H Set counter
F008 0A LOOP LDAX B Loads contents from BC to ACC
F009 77 MOV M,A Moves from ACC TO Memory
F00A 03 INX B Increments BC address
F00B 23 INX H Increments HL address
F00C 15 DCR D Decrements counter
F00D C2,08,F0 JNZ LOOP If cout#0 then jumps to label LOOP and
executes
F010 CF RST 1 Stop processing

DATA ( Before Execution )


Address DATA
C000H 22H
C001H 24H
C002H 26H

Q1)b) Enters the program on the microprocessor kit.

Q1)c) Execution of program


Registers A B C D E F I H L SP PC
After 26 C0 03 00 00 54 0F C0 06 FFEB F011
Execution

Result Data After Execution

Address Result
C003H 22H
C004H 24H
C005H 26H
Flags After Execution & Interpret’s its meaning is

After Execution = F = 54 = 01010100


1) CY = 0  Result is 8-bit .
2) P = 1 But there are number of 1’s are = 3=odd  P= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 2
SLIP NO 2
Q1)a) Write a program that adds the contents of a block of memory using the DAD instructions.
The block length is stored at C000H and starting address of block is C001H. Stores the
2-byte result below the end of the block.

Memory Opcodes LabelMnemo Operand Comment/Remark


Address nic
D000 01 , 00, C0 LXI B, C000H Initialize BC pair
D003 0A LDAX B Loads content of BC rp into A
D004 5F MOV E ,A Gets content into C from A
D005 3E , 00 MVI A , 00H LSB sum = 00
D007 16, 00 MVI D , 00H MSB sum = 00
D009 03 LOOP INX B Next address in BC rp
D00A 21,00,00 LXI H,0000H Initialize HL to 0000H
D00D 09 DAD B HL = HL + BC
D00E 86 ADD M A=A+M
D00F D2,13,D0 JNC NEXT If cy =0 then goto label NEXT & execute
instruction DCR C
D012 14 INR D Increment content of D i.e. get MSB sum
D013 1D NEXT DCR E Decrement counter
D014 C2, 09, D0 JNZ LOOP If counter # 0 then goto label LOOP and
execute instruction INX B
D017 03 INX B
D018 02 STAX B Store to BC rp
D019 03 INX B Increment BC rp
D01A 7A MOV A, D Gets the content into A to D i.e. MSB
sum
D01B 02 STAX B Stores to BC rp
D01C CF RST 1 Stop processing
DATA ( Before Execution )
Address DATA
C000H 03H
C001H 11H
C002H 12H
C003H 13H
Q1)b
b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 00 C0 05 00 00 54 0F C0 03 FFEB D01D
Execution

Result Data After Execution Address RESULT


C004H 36H
C005H 00H
Flags After Execution & Interpret’s its meaning is

After Execution = F = 54 = 01010100


1) CY = 0  Result is 8-bit .
2) P = 1 But there are number of 1’s are = 3=odd  P= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 2 SLIP NO 2
Q1)a) Write a program that adds the contents of a block of memory using the DAD instructions.
The block length is stored at C000H and starting address of block is C001H. Stores the
2-byte result below the end of the block.
Memory Opcodes Label Mnemo Operand Comment/Remark
Address nic
F000 11, 00, 00 LXI D,0000H ; Initialize DE register pair.
F003 21, 00, 00 LXI H, 0000H ; Initialize HL register pair.
F006 01, 00, CO LXI B, C000H ; Initialize BC register pair.
F009 0A LDAX B ; Load A with BC register pair content.
F00A 4F MOV C, A ; copy A content to register C
F00B 0A UP LDAX B ; Load A with BC register pair content.
F00C 5F MOV E, A ; copy content of A to E register.
F00D 19 DAD D ; HL = HL + DE.
F00E 0B DCX B ; Decrement BC register pair address by
one.
F00F 79 MOV A, C ; Copy C content in register A.
F010 FE, 00 CPI 00H ; Compare A data 00H
F012 C2, 0B, F0 JNZ UP ; if Z# 0 then goto label UP.
F015 01, 00, C0 LXI B,C000H ; Initialize BC register pair.
F018 0A LDAX B ; Load A with BC register pair content.
F019 4F MOV C, A ; Copy A content to register C.
F01A 03 INX B ; Increment BC address by one.
F01B 7D MOV A, L ; Copy L content to register A.
F01C 02 STAX B ; Store A content to BC register pair
address.
F01D 7C MOV A, H ; Copy H content to register A.
F01E 03 INX B ; Increment BC register pair address.
F01F 02 STAX B ; Store A content to BC register pair
address.
F020 CF RST 1 ; Stop processing.
DATA ( Before Execution )
Address DATA
C000H 05H
Q1)b
b) Enters the program on the C001H 01H
microprocessor kit. C002H 02H
C003H 03H
C004H 04H
C005H 05H
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 00 C0 07 00 01 54 0F 00 0F FFEB F021
Execution
Result Data After Execution
Address Result
C006H 0FH
C007H 00H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But there are number of 1’s are = 3=odd  P= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book Q3) Term Work Q4) Oral (Viva Vice )
EXPERIMENT : 2
SLIP NO 3
Q1)a) Write program that subtract the number stored in ML C001H from the number stored in
C000H. Stores the absolute difference in ML C002H as result.
Memory Opcodes Label Mnemo Operand Comment/Remark
Address nic
F000 21,00,C0 LXI H, C000H Initialize HL
F003 7E MOV A,M ; Copy HL content to A.
F004 23 INX H ; Increment HL address by 1.
F005 96 SUB M ; A= A – HL
F006 D2, 0B,F0 JNC NEXT ; Jump to Label NEXT if CY=0
F009 2F CMA ;1’s compliment is calculates.
F00A 3C INR A ; Increment A by one.
F00B 23 NEXT INX H ; Increment HL address by 1.
F00C 77 MOV M ,A ; Copy content of A to HL
F00D CF RST 1 ; Stop processing
DATA ( Before Execution )
Address DATA
C000H 45H
C001H 23H

Q1)b
b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 22 01 00 00 00 14 0F C0 02 FFEB F00E
Execution
Result Data After Execution
Address Result
C002H 22H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 14 = 00010100
1) CY = 0  Result is 8-bit .
2) P = 1 But there are number of 1’s are = 2=even
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 2
SLIP NO 3
Q1)a) Write program that subtract the number stored in ML C001H from the number stored in
C000H. Stores the absolute difference in ML C002H as result.
Memory Opcodes Label Mnemo Operand Comment/Remark
Address nic
F000 21,00,C0 LXI H, C000H Initialize HL
F003 7E MOV A,M ; Copy HL content to A.
F004 23 INX H ; Increment HL address by 1.
F005 96 SUB M ; A= A – HL
F006 D2,0C,F0 JNC NEXT ; Jump to Label NEXT if CY=0
F009 7E MOV A, M ; Copy HL to A.
F00A 2B DCX H ; Decrement HL address by 1.
F00B 96 SUB M ; A = A – HL .
F00C 32,02,C0 NEXT STA C002H ; Store A to ML C002H.
F00F CF RST 1 ; Stop processing.
DATA ( Before Execution )
Address DATA
C000H 23H
C001H ABH

Q1)b
b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 88 01 00 00 00 B4 0F C0 00 FFEB F010
Execution
Result Data After Execution
Address Result
C002H 88H

Flags After Execution & Interpret’s its meaning is


After Execution = F = B4 = 10110100
1) CY = 0  Result is 8-bit .
2) P = 1  Result is Even & 1’s=4=even.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 1  Result is Negative.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 2
SLIP NO 4
Q1)a) Write a program that adds a 4-byte integer stored in consecutive memory locations starting
from C000H beginning with lower order byte to another 4-byte integer stored in the
consecutive M.L. starting from MLC004H beginning with lower order byte stores the result
in consecutive M.L. starting from MLC000H
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
D000 AF XRA A Reset CY flag
D001 06,04 MVI B , 04H Set counter in B register
D003 21, 00 , C0 LXI H , C000H Set memory pointer in HL
D006 11, 04 , C0 LXI D , C004H Set memory pointer in DE
D009 1A UP LDAX D Load ACC with databyte from DE rp
D00A 8E ADC M [ A ] = [ A ] + [ M ] + CY
D00B 77 MOV M,A Moves A to M
D00C 13 INX D Increments memory of DE rp
D00D 23 INX H Increments memory of HL rp
D00E 05 DCR B Decrements counter by one
D00F C2 , 09, D0 JNZ UP If counter # 0 then goto label UP and
executes the instruction LDAX D
D012 CF RST 1 Stop processing

Address DATA
DATA ( Before Execution ) C000H F3H
C001H B2H
C002H C6H
C003H 89H
C004H 72H
C005H 90H
C006H 35H
C007H 67H

Q1)b) Enters the program on the microprocessor kit.


Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After F0 00 00 C0 08 54 0F C0 04 FFEB D013
Execution
Result Data After Execution Address Result
C000H 65H
C001H 43H
C002H FCH
C003H F0H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But number of 1’s=3=odd  Result is odd . So P=0 modify.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Negative.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 2 SLIP NO 4
Q1)a) Write a program that adds a 4-byte integer stored in consecutive memory locations starting
from C000H beginning with lower order byte to another 4-byte integer stored in the
consecutive M.L. starting from MLC004H beginning with lower order byte stores the result
in consecutive M.L. starting from MLC000H
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 0E,04 MVI C,04H ; Load Immediate data 04H to regi. C
F002 21,00,C0 LXI H,C000H ; Initialize HL
F005 11,04,C0 LXI D, C004H ; Initialize DE
F008 37 STC ; Set carry
F009 3F CMC ; Complement carry
F00A 1A LOOP LDAX D ; Load A with content of DE regi. pair
F00B 8E ADC M ; A = A + HL + CY
F00C 77 MOV M,A ; Copy content of A into HL.
F00D 23 INX H ; Increment HL by 1.
F00E 13 INX D ; Increment address of DE regi. pair by 1.
F00F 0D DCR C ; Decrement C register content by 1.
F010 C2,0A,F0 JNZ LOOP ; Jump on Z#0 to label LOOP.
F013 CF RST 1 ; Stop processing.
Address DATA
DATA ( Before Execution ) C000H 03H
C001H B2H
C002H B6H
C003H 8FH
C004H 73H
C005H 9DH
C006H 37H
C007H EDH
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 7C 01 00 C0 08 55 0F C0 04 FFEB F014
Execution
Result Data After Execution
Address Result
C000H 76H
C001H 4FH
C002H EEH
C003H 7CH

Flags After Execution & Interpret’s its meaning is


After Execution = F = 55 = 01010101
1) CY = 1  Result is 9-bit .
2) P = 1  Result is Even.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 3
SLIP NO 5
Q1)a) Write a program that multiplies two 1-byte hex numbers stored in consecutive MLs starting
from C000H. Stores the 2-byte result in consecutive MLs starting from C002H beginning
with lower order byte.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
D000 3A ,00 ,C0 LDA C000H ; Load A with ML content C000H.
D003 5F MOV E ,A ; Copy content of A into E.
D004 16 , 00 MVI D , 00H ; Move immediate data to regi D.
D006 3A ,01 ,C0 LDA C001H ; Load A with ML content C001H
D009 4F MOV C,A ; Copy content of A into C.
D00A 21, 00, 00 LXI H , 0000H ; Initialize HL and clears.
D00D 19 LOOP DAD D ; HL = HL + DE
D00E 0D DCR C ; Decrement C by 1.
D00F C2 ,0D,D0 JNZ LOOP ; Jump if Z#0 to label LOOP.
D012 22 , 02, C0 SHLD C002H ; Store HL to C002H and C003H.
D015 CF RST 1 ; Stop processing.
Address DATA
C000H FFH
DATA ( Before Execution )
C001H 02H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 02 01 00 00 FF 54 0F 01 FE FFEB D016
Execution
Result Data After Execution Address Result
C002H FEH
C003H 01H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 1  Result is 8-bit .
2) P = 1  Result is Even. But 1’s = 3=odd. So p=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 3 SLIP NO 5
Q1)a) Write a program that multiplies two 1-byte hex numbers stored in consecutive MLs starting
from C000H. Stores the 2-byte result in consecutive MLs starting from C002H beginning
with lower order byte.

Memory Opcodes Label Mnem Operand Comment/Remark


Address onic
D000 0E , 00 MVI C ,00H Initialize C =00 to store CY and MSB sum
D002 3E , 00 MVI A , 00H Initialize A = 00 to LSB sum
D004 21 , 00 , C0 LXI H, C000H Initialize HL and memory address becomes
C000H
D007 46 MOV B, M Gets content of memory in B regi
D008 23 INX H Increment memory address
D009 86 NEXT ADD M [A]=[A]+[M]
D00A D2 , 0E , D0 JNC LOOP If CY = 0 then goto label LOOP and
executes instruction DCR B
D00D 0C INR C I f CY = 1 then Increments CY i.e. MSB sum
D00E 05 LOOP DCR B Decrements counter
D00F C2 , 09 , D0 JNZ NEXT If Z=0 then goto label NEXT and executes
instruction ADD M
D012 23 INX H Increments memory address
D013 77 MOV M,A Gets contents into memory from A
D014 23 INX H Increments memory address by one
D015 71 MOV M,C Gets contents into memory from C
D016 CF RST 1 Stop processing

DATA ( Before Execution ) Address DATA


C000H F5H
C001H 08H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After A8 00 07 00 00 54 0F C0 03 FFEB D017
Execution
Result Data After Execution Address Result
C002H A8H
C003H 07H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 54 = 01010100
1) CY = 1  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 3
SLIP NO 6
Q1)a) Write an ALP that divides two one-byte hex numbers, where dividend is stored at ML
D000H and divisor is stored in ML D001H. Stores the quotient and remainder in MLs
D002H and D003H. Note : dividend is 8 bit result is 16bit
Memory Opcodes Label Mnemon Operand Comment/Remark
Address ic
C000 06, 00 MVI B ,00H Set B = 00H
C002 21, 00, D0 LXI H , D000H Initialize HL address to C000H
C005 7E MOV A,M Gets content into A from memory
C006 23 INX H Increments the HL address by one
C007 BE BACK CMP M If A<M
C008 DA, 10 , C0 JC LOOP If A< M then CY =1 then goto label
LOOP executes instruction INX H
C00B 96 SUB M [A]=[A]–[M]
C00C 04 INR B Increments the contents of B
C00D C3, 07, C0 JMP BACK Jumps unconditionally label BACK
C010 23 LOOP INX H Increments HL by one
C011 70 MOV M,B Gets contents in memory from B
C012 23 INX H Increments HL by one
C013 77 MOV M,A Gets contents in memory from A
C014 CF RST 1 Stop processing

DATA ( Before Execution ) Address DATA


D000H 09H
D001H 02H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 01 04 00 00 82 85 0F D0 03 FFEB C015
Execution
Address Result
Result Data After Execution D002H 04H
D003H 01H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 85 = 10000101
1) CY = 1  Result is 9-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 0  Carry is not given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 1  Result is Negative.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 3
SLIP NO 6
Q1)a) Write an ALP that divides two one-byte hex numbers, where dividend is stored at ML
D000H and divisor is stored in ML D001H. Stores the quotient and remainder in MLs
D002H and D003H. Note : dividend is 8 bit result is 16bit
Memory Opcodes Label Mnemon Operand Comment/Remark
Address ic
C000 21, 00, D0 LXI H, D000H ; Initialize HL
C003 7E MOV A, M ; Copy HL content into A.
C004 23 INX H ; Increment HL address by 1.
C005 46 MOV B, M ; Copy HL content into regi. B.
C006 0E, 00 MVI C, 00H ; Load Immediate data into regi C
C008 90 LOOP SUB B ; A = A – B.
C009 0C INR C ; Increment C register content by 1.
C00A B8 CMP B ; Compare A with B.
C00B D2, 08, C0 JNC LOOP ; Jump to label LOOP if CY=0
C00E 23 INX H ; Increment HL address by 1.
C00F 71 MOV M, C ; Copy content of C register into HL.
C010 23 INX H ; Increment HL address by 1.
C011 77 MOV M, A ; Copy content of A into HL.
C012 CF RST 1 ; Stop processing.

DATA ( Before Execution )


Address DATA
D000H 09H
D001H 02H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 01 02 04 00 00 85 0F D0 03 FFEB C013
Execution

Address Result
RESULT Data After Execution D002H 04H
D003H 01H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 85 = 10000101
1) CY = 1  Result is 9-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 0  Carry is not given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 1  Result is Negative.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 4
SLIP NO 7
Q1)a) Write a program that adds the BCD contents of a block of memory. Block length is hex not
exceeding 6316 = 9910 is stored at MLC000H and starting address of block is at ML C001H.
Stores the BCD sum as result starting from ML D000H.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 06,00 MVI B,00H ; Load Immediate data in register B.
F002 21,00,CO LXI H,C000H ; Initialize HL.
F005 4E MOV C,M ; copy HL content into register C.
F006 7E MOV A,M ; Copy HL content into register A.
F007 FE,63 CPI 63H ; Compare A with data 63H.
F009 D2,20,F0 JNC STOP ; Jump to label STOP if cy =0
F00C 3E,00 MVI A,00H ; Load immediate data in regi. A and
clear
F00E 23 LOOP INX H ; Increment HL address by 1.
F00F 86 ADD M ; A = A + HL
F010 27 DAA ; Decimal adjust accumulator.
F011 D2,15,F0 JNC NEXT ; Jump to label NEXT if cy=0.
F014 04 INR B ; Increment B content by 1.
F015 0D NEXT DCR C ; Decrement C content by 1.
F016 C2,0E,F0 JNZ LOOP ; Jump to label LOOP if z=0
F019 32,00,D0 STA DOOOH ; Store A into ML D000H.
F01C 78 MOV A,B ; Copy B into A.
F01D 32,01,D0 STA D001H ; Store A into ML D001H.
F020 CF STOP RST 1 ; Stop processing.

DATA ( Before Execution ) Address DATA


C000H 04H
C001H 22H
C002H 45H
C003H 56H
C004H 89H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 02 02 00 00 00 55 0F C0 04 FFEB F021
Execution
Address Result
Result Data After Execution
D000H 12H
D001H 02H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 55 = 01010101
1) CY = 1  Result is 9-bit .
2) P = 1  Result is Even.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 4 SLIP NO 7
Q1)a) Write a program that adds the BCD contents of a block of memory. Block length is hex not
exceeding 6316 = 9910 is stored at MLC000H and starting address of block is at ML C001H.
Stores the BCD sum as result starting from ML D000H.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 06,00 MVI B,00H ; Load B with immediate data and clear.
F002 21,00,CO LXI H,C000H ; Initialize HL
F005 4E MOV C,M ; Copy HL content into register C
F006 7E MOV A,M ; Copy HL content into register A.
F007 FE,63 CPI 63H ; Compare A with data 63H.
F009 D2,20,F0 JNC STOP ; Jump to label STOP if cy=0.
F00C AF XRA A ; Clear A and CY i.e A XORed with A.
F00D 23 LOOP INX H ; Increment HL address by 1.
F00E 8E ADC M ; A = A + HL + CY
F00F 27 DAA ; Decimal adjust accumulator.
F010 D2,14,F0 JNC NEXT ; Jump to label NEXT if cy=0
F013 04 INR B ; Increment B register content by 1.
F014 0D NEXT DCR C ; Decrement content of regi C by 1.
F015 C2,0D,F0 JNZ LOOP ; Jump to label LOOP if z=0
F018 32,00,D0 STA DOOOH ; Store A content into ML D000H.
F01B 78 MOV A,B ; Copy B content into A.
F01C 32,01,D0 STA D001H ; Store content of A into ML D001H.
F01F CF STOP RST 1 ; Stop processing.

DATA ( Before Execution ) Address DATA


C000H 04H
C001H 11H
C002H 34H
C003H 14H
C004H 15H

Q1)b) Enters the program on the microprocessor kit.


Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 00 00 00 00 00 54 0F C0 04 FFEB F020
Execution

Result Data After Execution Address Result


D000H 74H
D001H 00H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 54 = 01010100
1) CY = 1  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 8
SLIP NO 11
Q1)a) A block of data is stored in MLs from C000H to C002H. Write a program to transfers the
data in the reverse order to MLs starting from M.L. C003H.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 01,02,C0 LXI B,C002H Initialize source block to BC rp
F003 21,03,C0 LXI H,C003H Initialize to destination block to HL
F006 16,03 MVI D,03H Set counter as register D
F008 0A LOOP LDAX B Gets contents from source block in ACC
F009 77 MOV M,A Moves content to from memory
F00A 0B DCX B Decrement block counter
F00B 23 INX H Increment HL
F00C 15 DCR D H Decrement counter
F00D C2,08,F0 JNZ LOOP If counter # 0 then goto to LOOP execute
instruction LDAX B
F010 CF RST 1 S/W interrupting

Address DATA
DATA ( Before Execution ) C000H 03H
C001H 02H
C002H 05H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 03 BF FF 00 00 54 0F C0 06 FFEB F011
Execution

Address Result
Result Data After Execution C003H 05H
C004H 02H
C005H 03H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 54 = 01010100
1) CY = 1  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Negative.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 8 SLIP NO 11
Q1)a) A block of data is stored in MLs from C000H to C002H. Write a program to transfers the
data in the reverse order to MLs starting from M.L. C003H.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21,02,C0 LXI H,C002H ; Initialize HL.
F003 11,03,C0 LXI D,C003H ; Initialize DE.
F006 0E,03 MVI C,03H ; Move immediate data 03H to register C.
F008 7E BACK MOV A,M ; Copy HL content into register A.
F009 EB XCHG ; Exchanges HL and DE addresses.
F00A 77 MOV M,A ; Copy content of register A into HL.
F00B EB XCHG ; Exchanges HL and DE addresses.
F00C 2B DCX H ; Decrement address of HL by 1.
F00D 13 INX D ; Increment address of DE by 1.
F00E OD DCR C ; Decrement content of register C by 1.
F00F C2,08,F0 JNZ BACK ; if z=0 then jump to label BACK
F012 CF RST 1 ; Stop processing.
Address DATA
DATA ( Before Execution )
C000H 11H
C001H 22H
C002H 33H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 11 01 00 C0 06 54 0F BF FF FFEB F013
Execution
Address Result
Result Data After Execution
C003H 33H
C004H 22H
C005H 11H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 8 SLIP NO 12
Q1)a) A block of data is stored in MLs from C000H TO C002H. Another block of data having the
same length is stored in MLs starting from ML C003H. Writes a program to exchanges the
contents of these two blocks.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 06,03 MVI B, 03 Set counter in register B
F002 21,00,C0 LXI H,C000H Initialize address in HL
F005 11,03,C0 LXI D,C003H Initialize address DE rp
F008 4E BACK MOV C, M Gets content in register C from memory i.e.
HL
F009 1A LDAX D Loads content in ACC from DE rp
F00A 77 MOV M,A Gets contents in memory from Acc
F00B 79 MOV A,C Gets content in ACC from C
F00C 12 STAX D Stores contents from ACC to DE rp
F00D 23 INX H Increment HL
F00E 13 INX D Increment DE
F00F 05 DCR B Decrement counter
F010 C2,08,F0 JNZ BACK If counter # 0 then goto label BACK then
execute MOV C,M
F013 CF RST 1 S/W interrupting
Address DATA
DATA ( Before Execution ) C000H 55H
C001H 66H
C002H 77H
C003H 99H
C004H 98H
C005H 97H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 77 00 77 C0 06 54 0F C0 03 FFEB F014
Execution
Address Result
C000H 99H
RESULT: Data After Execution
C001H 98H
C002H 97H
C003H 55H
C004H 66H
Flags After Execution & Interpret’s its meaning is C005H 77H
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 8 SLIP NO 12
Q1)a) A block of data is stored in MLs from C000H TO C002H. Another block of data having the
same length is stored in MLs starting from ML C003H. Writes a program to exchanges the
contents of these two blocks.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
D000 06, 03 MVI B,03H ; Move immediate data 03H into regi B.
D002 21, 00, C0 LXI H,C000H ; Initialize HL register pair.
D005 11, 03, C0 LXI D,C003H ; Initialize DE register pair.
D008 EB LOOP XCHG ; Exchanges address of HL and DE regi.
pair
D009 4E MOV C,M ; Copy content of HL into register C.
D00A 1A LDAX D ; Load A with DE regi. pair content.
D00B EB XCHG ; Exchanges addresses of HL with DE and
DE with HL.
D00C 71 MOV M,C ; Copy content of register C into HL.
D00D 12 STAX D ; Stores content of A into DE register pair.
D00E 23 INX H ; Increment HL address by 1.
D00F 13 INX D ; Increment DE address by 1.
D010 05 DCR B ; Decrement content of register B by 1.
D011 C2,08, D0 JNZ LOOP ; Jump to label LOOP if z=0
D0014 CF RST 1 ; Stop processing.

DATA ( Before Execution ) Address DATA


C000H A1H
C001H A2H
C002H A3H
C003H FFH
C004H FEH
C005H FDH

Q1)b) Enters the program on the microprocessor kit.


Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After A3 00 FD C0 06 54 0F C0 03 FFEB D015
Execution

Address Result
Result Data After Execution C000H FFH
C001H FEH
C002H FDH
C003H A1H
C004H A2H
C005H A3H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 8 SLIP NO 13
Q1)a) A block of data is stored in MLs from C000 TO C003H.Write a program to finds the smallest
as well as greatest number from this block using Linear-Search. Stores the results
immediately after the end of block.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21,00,C0 LXI H, C000H Loads HL pair immediate with C000H
F003 06,04 MVI B, 04H Moves counter into regi B
F005 05 DCR B Decrements counter
F006 7E MOV A,M Move memory to ACC
F007 57 MOV D,A Moves acc to D
F008 5F MOV E,A Moves acc to E
F009 23 BACK INX H Increments HL pair by one location
F00A BE CMP M Compare memory with acc if CY=1
F00B DA,19,F0 JC LARGE If CY = 1 then goto label LARGE & executes
instruction MOV A,M
F00E 57 MOV D,A Moves content A to D
F00F 7E MOV A,M Moves content of M to A
F010 BB CMP E Compare with E register if CY=0
F011 D2,15,F0 JNC SMALL If CY = 0 then goto label SMALL and executes
instruction MOV A,D
F014 5F MOV E,A Moves content of A to E
F015 7A SMALL MOV A,D Moves content of D to A
F016 C3,1A,F0 JMP NEXT Jumps unconditionally label NEXT & executes
instruction DCR B
F019 7E LARGE MOV A,M Moves content of M to A
F01A 05 NEXT DCR B Decrements counter
F01B C2,09,F0 JNZ BACK If counter # 0 then goto label BACK & executes
instruction INX H
F01E 23 INX H Increment HL by 1
F01F 77 MOV M,A Moves content of A to M
FO20 7B MOV A, E Moves content of E to A
F021 23 INX H Increments HL address
F022 77 MOV M,A Moves content of A to M
F023 CF RST 1 S/W interrupting

DATA ( Before Execution ) Address DATA


Q1)b) Enters the program on the microprocessor kit. C000H 08H
Q1)c) Execution of program C001H 09H
C002H 01H
Registers A B C D E F I H L SP PC C003H 07H
After 01 00 00 09 01 54 0F C0 05 FFEB F024
Execution
Address Result
Result Data After Execution C004H 09H
C005H 01H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 8 SLIP NO 14
Q1)a) A block of data is stored in MLs from C001H. The length of block is stored at ML C000H.
Writes an ALP that sorts the given data in Ascending orders.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21,00,C0 LXI H, C000H ;Initialize HL
F003 4E MOV C, M ; Copy HL content to register C.
F004 21,01,C0 UP1 LXI H, C001H ; Initialize HL
F007 79 MOV A, C ; Copy content of register C into A.
F008 DE,01 SBI 01H ; A = A – 01H
F00A 47 MOV B,A ; Copy content of A into register B.
F00B 7E UP MOV A, M ; Copy content of HL into register A.
F00C 23 INX H ; Increment address of HL by 1.
F00D BE CMP M ; Compare A with HL content.
F00E DA,16,F0 JC DN ; Jump if cy=1 to label DN
F011 56 MOV D, M ; Copy HL content into register D
F012 77 MOV M, A ; Copy content of A into HL location.
F013 2B DCX H ; Decrement address of HL by 1.
F014 72 MOV M, D ; Copy content of D register into HL
location.
F015 23 INX H ; Increment HL address by 1.
F016 05 DN DCR B ; Decrement content of register B by 1.
F017 C2, 0B,F0 JNZ UP ; Jump to label UP if z=0.
F01A 0D DCR C ; Decrement content of register C by 1.
F01B C2,04,F0 JNZ UP1 ; Jumps to label UP1 if z=0
F01E CF RST 1 ; Stop processing
Address DATA
C000H 05H
DATA ( Before Execution )
C001H 02H
C002H 08H
C003H 01H
C004H 04H
C005H 03H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After E9 00 00 00 00 55 0F C1 01 FFEB F01F
Execution
Address Result
Result Data After Execution C001H 01H
C002H 02H
C003H 03H
C004H 04H
C005H 08H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 55 = 01010101
1) CY = 1  Result is 9-bit .
2) P = 1  Result is Even.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 8 SLIP NO 14
Q1)a) A block of data is stored in MLs from C001H. The length of block is stored at ML C00H.
Writes an ALP that sorts the given data in Descending orders.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21,00,C0 LXI H, C000H ;Initialize HL
F003 4E MOV C, M ; Copy HL content to register C.
F004 21,01,C0 UP1 LXI H, C001H ; Initialize HL
F007 79 MOV A, C ; Copy content of register C into A.
F008 DE,01 SBI 01H ; A = A – 01H
F00A 47 MOV B,A ; Copy content of A into register B.
F00B 7E UP MOV A, M ; Copy content of HL into register A.
F00C 23 INX H ; Increment address of HL by 1.
F00D BE CMP M ; Compare A with HL content.
F00E D2,16,F0 JNC DN ; Jump if cy=0 to label DN
F011 56 MOV D, M ; Copy HL content into register D
F012 77 MOV M, A ; Copy content of A into HL location.
F013 2B DCX H ; Decrement address of HL by 1.
F014 72 MOV M, D ; Copy content of D register into HL
location.
F015 23 INX H ; Increment HL address by 1.
F016 05 DN DCR B ; Decrement content of register B by 1.
F017 C2, 0B,F0 JNZ UP ; Jump to label UP if z=0.
F01A 0D DCR C ; Decrement content of register C by 1.
F01B C2,04,F0 JNZ UP1 ; Jumps to label UP1 if z=0
F01E CF RST 1 ; Stop processing
Address DATA
DATA ( Before Execution )
C000H 05H
C001H 06H
C002H 09H
C003H 01H
C004H 03H
C005H 02H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 00 00 00 F3 00 55 0F C1 01 FFEB F01F
Execution
Result Data After Execution Address Result
C001H 09H
C002H 06H
C003H 03H
C004H 02H
C005H 01H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book Q3) Term Work Q4) Oral (Viva Vice )
EXPERIMENT : 10
SLIP NO 15
Q1)a) A block of data is stored in MLs from C001H. The length of block is stored at M.L C000H.
Writes an ALP that counts the occurrences of the number D9H in the given block, Stores
the result in M.L.D000H
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 1E,00 MVI E, 00H Set counter for how many times the data
05H is occurred
F002 3E,D9 MVI A,D9H Gets data byte D9H in ACC
F004 21,00,C0 LXI H, C000H Initialize address in HL
F007 56 MOV D,M Sets block counter
F008 23 INX H Increments HL address
F009 BE BACK CMP M If A=M then Z =1
F00A C2,0E,F0 JNZ NEXT If Z =0 then goto label NEXT and
executes instruction INX H
F00D 1C INR E If A=M then Z=1 then increments the
counter of E
F00E 23 NEXT INX H Increments the HL address
F00F 15 DCR D Decrements the counter
F010 C2,09,F0 JNZ BACK If counter # 0 i.e. D#0 then goto label
BACK and executes instruction CMP M
F013 7B MOV A, E Gets counter in ACC
F014 32,00,D0 STA D000H Stores counter in M.L.
F017 CF RST 1 S/W interrupting
Address DATA
C000H 05H
DATA ( Before Execution )
C001H 02H
C002H D9H
C003H D9H
C004H D9H
C005H B4H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 03 01 00 00 03 54 0F C0 06 FFEB F018
Execution
Result Data After Execution Address Result
D000H 03H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1  But in result 1’s=3=odd  Result is odd  P=0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 10
SLIP NO 15
Q1)a) A block of data is stored in MLs from C001H. The length of block is stored at M.L C000H.
Writes an ALP that counts the occurrences of the number B5H in the given block, Stores
the result in M.L.D000H
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21, 00, C0 LXI H, C000H ; Initialize HL
F003 4E MOV C,M ; Copy HL content to register C.
F004 16, 00 MVI D,00 ; Load Immediate data to regi D & clear.
F006 23 LOOP INX H ; Increment HL address by 1.
F007 7E MOV A,M ; Copy HL content into Accumulator.
F008 FE, B5 CPI B5H ; Compare A with data B5H.
F00A C2, 0E, F0 JNZ NEXT ; Jump to label NEXT if z=0
F00D 14 INR D ; Increment content of D by 1.
F00E 0D NEXT DCR C ; Decrement content of C by 1.
F00F C2, 06, F0 JNZ LOOP ; Jump to label LOOP if z=0.
F012 7A MOV A,D ; Copy content of D register into A.
F013 32, 00, D0 STA D000H ; Store content of A to ML D000H.
F016 CF RST 1 ; Stop processing
DATA ( Before Execution )
Address DATA
C000H 05H
C001H 02H
C002H B5H
C003H 08H
C004H B5H
C005H 07H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 02 01 00 02 00 55 0F C0 05 FFEB F017
Execution
RESULT Data After Execution Address Result
D000H 02H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 55 = 01010101
1) CY = 1  Result is 9-bit .
2) P = 1  Result is Even.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 10 SLIP NO 16
Q1)a) A block of data is stored in MLs from C001H. The length of the block is stored at
M.L.C000H. Writes a program that searches for the first occurrences of data byte ABH in
the given block. Stores the address of this occurrences in the HL pair. If number is not
found then HL pair must contains FFFFH.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21,00,C0 LXI H,C000H Initialize HL address to location
F003 4E MOV C, M Moves from memory to C regi.
F004 23 INX H Increment memory address
F005 3E,AB MVI A,ABH Set data byte as FFH in ACC
F007 BE UP CMP M Compare data byte & content of memory
F008 CA,13,F0 JZ END If A=M i.e. FFH databyte occurred in
Memory then HL address is becomes as
data bytes location
F00B 23 INX H Increments HL address
F00C 0D DCR C Decrements counter
F00D C2,07,F0 JNZ UP If counter # 0 then goto label UP
F010 21,FF,FF LXI H,FFFFH HL address is FFFFH if not found
F013 CF END RST 1 S/W interrupting
Address DATA
DATA ( Before Execution )
C000H 05H
C001H ABH
C002H ABH
C003H ABH
C004H 05H
C005H 12H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After AB FF 05 00 8D 54 0F C0 01 FFEB F014
Execution
Address Result
Result Data After Execution
H C0H
L 01H
HL C001H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1  But in Result number of 1’s are 3 So that Result is odd. It is modified P=0.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 10
SLIP NO 16
Q1)a) A block of data is stored in MLs from C001H. The length of the block is stored at
M.L.C000H. Writes a program that searches for the first occurrences of data byte FFH in
the given block. Stores the address of this occurrences in the HL pair. If number is not
found then HL pair must contains AABBH.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21, 00, C0 LXI H,C000H ; Initialize HL.
F003 4E MOV C,M ; Copy content HL into register C.
F004 23 UP INX H ; Increment address of HL by 1.
F005 7E MOV A,M ; Copy HL content to register A.
F006 FE, FF CPI FFH ; Compare A with data FFH.
F008 CA, 12, F0 JZ STOP ; Jump to label STOP if z=1.
F00B 0D DCR C ; Decrement content of C by 1.
F00C C2, 04, F0 JNZ UP ; Jump to label UP if z=0.
F00F 21, BB, AA LXI H,AABBH ; Initialize HL AABBH if not found data.
F012 CF STOP RST 1 ; Stop processing.
Address DATA
DATA ( Before Execution ) C000H 04H
C001H 02H
C002H FFH
C003H FFH
C004H FFH
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After FF FF 03 00 8D 54 0F C0 02 FFEB F013
Execution
Address Result
Result Data After Execution
H C0H
L 02H
HL C002H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1  But in Result number of 1’s are 3 So that Result is odd. It is modified P=0.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 10 SLIP NO 16
Q1)a) A block of data is stored in MLs from C001H. The length of the block is stored at
M.L.C000H. Writes a program that searches for the first occurrences of data byte FFH in
the given block. Stores the address of this occurrences in the HL pair. If number is not
found then HL pair must contains FFFFH.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
D000 11, 00, C0 LXI D,C000H ; Initialize DE register pair.
D003 1A LDAX D ; Load A with DE register pair content.
D004 4F MOV C,A ; Copy content of A into register C.
D005 13 LOOP INX D ;Increment DE register pair address by 1.
D006 1A LDAX D ; Load A with DE register pair content.
D007 FE, FF CPI FFH ; Compare A with data FFH.
D009 C2, 10, D0 JNZ NEXT ; Jump to label NEXT if z=0.
D00C EB XCHG ; Exchanges address of HL & DE.
D00D C3, 17, D0 JMP STOP ; Unconditional jump to label STOP.
D010 0D NEXT DCR C ; Decrement content of C register by 1.
D011 C2, 05, D0 JNZ LOOP ; Jump to label LOOP if z=0
D014 21, FF, FF LXI H, FFFFH ; Initialize HL with data FFFFH if data
FFH is not found.
D017 CF STOP RST 1 ; Stop processing
Address DATA
DATA ( Before Execution ) C000H 04H
C001H 02H
C002H 03H
C003H 04H
C004H 05H

Q1)b) Enters the program on the microprocessor kit.


Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 05 01 00 C0 04 55 0F FF FF FFEB D018
Execution

Address Result
RESULT : Data After Execution H FFH
L FFH
HL FFFFH
Flags After Execution & Interpret’s its meaning is
After Execution = F = 55 = 01010101
1) CY = 1  Result is 9-bit .
2) P = 1  Result is Even.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT :10 SLIP NO 17
Q1)a) A block of data is stored in MLs from C000H TO C004H. Writes a program to finds the
number if odd as well as even numbers in the given block. Stores the results immediately
after the end of the block.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21,00,CO LXI H,C000H Initialize HL address as C000H
F003 0E,05 MVI C,05H Set block counter
F005 16,00 MVI D,00H Clear D regi & set as odd counter
F007 1E,00 MVI E,00H Clear E regi & set as even counter
F009 7E BACK MOV A, M Moves memory to ACC
F00A 0F RRC Rotate determine which determines the number is
odd or even
F00B D2,12,F0 JNC NEXT If CY=0 when execution of RRC instruction then
increments even counter byte otherwise increments
odd byte
F00E 14 INR D Increments D content if CY=1 when RRC instruction
execution
F00F C3,16,F0 JMP GO Jumps unconditionally to label GO & executes
instruction INX H
F012 1C NEXT INR E Increments E counter if CY=0 when execution of
instruction RRC instruction
F013 C3,16,F0 JMP GO Jumps unconditionally
F016 23 GO INX H Increments HL address
F017 0D DCR C Decrements block counter
F018 C2,09,F0 JNZ BACK If block counter # 0 i.e. C#0 then goto label BACK &
executes instruction MOV A,M
F01B 72 MOV M,D Moves content in memory from D
F01C 23 INX H Increments HL address
F01D 73 MOV M, E Moves content in memory from E
F01E CF RST 1 S/W interrupting

Address DATA
C000H 05H
DATA ( Before Execution )
C001H 02H
C002H 07H
C003H 09H
C004H B7H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After DB 01 00 04 01 55 0F C0 06 FFEB F01F
Execution
Address Result
RESULT : Data After Execution C005H 04H
C006H 01H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 55 = 01010101
1) CY = 1  Result is 9-bit .
2) P = 1  Result is Even.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT :10 SLIP NO 17
Q1)a) A block of data is stored in MLs from C000H TO C004H. Writes a program to finds the
number if odd as well as even numbers in the given block. Stores the results immediately
after the end of the block.
Memory Opcodes Label Mnemonic Operand Comment/Remark
Address
F000 21,00,CO LXI H,C000H Initialize HL address as C000H
F003 0E,05 MVI C,05H Set block counter
F005 16,00 MVI D,00H Clear D regi & set as odd counter
F007 1E,00 MVI E,00H Clear E regi & set as even counter
F009 7E BACK MOV A, M Moves memory to ACC
F00A E6,01 ANI 01H Rotate determine which determines the number is
odd or even
F00C FE,01 CPI 01H Compare A with B
F00E DA,15,F0 JZ NEXT If CY=0 when execution of RRC instruction then
increments even counter byte otherwise increments
odd byte
F011 14 INR D Increments D content if CY=1 when RRC instruction
execution
F012 C3,19,F0 JMP GO Jumps unconditionally to label GO & executes
instruction INX H
F015 1C NEXT INR E Increments E counter if CY=0 when execution of
instruction RRC instruction
F016 C3,19,F0 JMP GO Jumps unconditionally
F019 23 GO INX H Increments HL address
F01A 0D DCR C Decrements block counter
F01B C2,09,F0 JNZ BACK If block counter # 0 i.e. C#0 then goto label BACK &
executes instruction MOV A,M
F01E 72 MOV M,D Moves content in memory from D
F01F 23 INX H Increments HL address
F020 73 MOV M, E Moves content in memory from E
F021 CF RST 1 S/W interrupting

Address DATA
DATA ( Before Execution )
C000H 03H
C001H 02H
C002H 04H
C003H 06H
C004H 08H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program

Registers A B C D E F I H L SP PC
After 00 01 00 01 04 55 0F C0 06 FFEB F022
Execution
RESULT : Data After Execution Address Result
C005H 01H
C006H 04H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 55 = 01010101
6) CY = 1  Result is 9-bit .
7) P = 1  Result is Even.
8) AC = 1  Carry is given from bit 3 to bit 4.
9) Z = 1  Result is zero.
10) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT :10 SLIP NO 17
Q1)a) A block of data is stored in MLs from C000H TO C004H. Writes a program to finds the
number if odd as well as even numbers in the given block. Stores the results immediately
after the end of the block.
Memory Opcodes Label Mnem Operand Comment/Remark
Address onic
D000 0E, 05 MVI C,05H ; Move Immediate data 05H into C regi.
D002 21, 00, CO LXI H,C000H ; Initialize HL
D005 16, 00 MVI D,00H ; Move immediate data to regi C & clear.
D007 1E, 00 MVI E,00H ; Move immediate data to regi E & clear.
D009 CD, 10, D0 CALL CHECK ; Subroutine Call
D00C 72 MOV M,D ;Copy D to HL
D00D 23 INX H ; Increment HL address by 1.
D00E 73 MOV M,E ; Copy E to HL.
D00F CF RST 1 ; Stop processing.
SUBROUTINE ( CHECK )
D010 7E CHECK MOV A,M ; copy HL to A.
D011 0F RRC ; Rotate right without carry.
D012 D2, 19, D0 JNC NEXT ; Jump to label NEXT if cy=0.
D015 14 INR D ; Increment D by 1.
D016 C3,1A, D0 JMP GO ; Unconditional jump to label GO.
D019 1C NEXT INR E ; Increment content of E by 1.
D01A 23 GO INX H ; Increment HL address by 1.
D01B 0D DCR C ; Decrement content of C regi. by 1.
D01C C2,10, D0 JNZ CHECK ; Jump to label CHECK if z=0
D01F C9 RET ; Return from subroutine.
DATA ( Before Execution )
Address DATA
C000H 01H
C001H 02H
C002H 03H
C003H 04H
C004H 05H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program

Registers A B C D E F I H L SP PC
After 82 01 00 03 02 55 0F C0 06 FFEB D010
Execution
RESULT : Data After Execution Address Result
C005H 03H
C006H 02H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 55 = 01010101
1) CY = 1  Result is 9-bit .
2) P = 1  Result is Even.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 11
SLIP NO 18
Q1)a) Writes a program that separates the two nibbles of a number stored in ML C000H
and stores the same in MLs C001H and C002H. The program must also multiply the two
nibbles and stores the product in ML C003H.
Memory Opcodes Label Mnemonic Operand Comment
Address
D000 21,00,C0 LXI H,C000H Initialize HL address as C000H
D003 7E MOV A,M Moves content in ACC from memory
D004 E6,0F ANI OFH Mask off 4bit of LSB’s
D006 47 MOV B, A Moves content in B regi from Acc
D007 7E MOV A, M Moves content in ACC from memory
D008 E6,F0 ANI FOH Mask off 4-bit of MSB’s
D00A 0F RRC
D00B 0F RRC Exchanges contents of masked data
D00C 0F RRC
D00D 0F RRC
D00E 4F MOV C, A Moves content in C regi from ACC
D00F 23 INX H Increments HL address
D010 70 MOV M, B Moves content in memory from B
D011 23 INX H Increments HL address
D012 71 MOV M, C Moves contents in memory from C register
D013 3E,00 MVI A, 00H Clears content of ACC i.e. sum=00
D015 80 LOOP ADD B [A]=[A]+[B]
D016 0D DCR C Decrements counter
D017 C2,15,D0 JNZ LOOP If counter # 0 i.e. C # 0 then goto label
LOOP and executes instruction ADD B
D01A 23 INX H If C=0 then increments HL address
D01B 77 MOV M, A Moves content in memory from A
D01C CF RST 1 S/W interrupting
Address DATA
DATA ( Before Execution )
C000H 24H
C001H 24H
C002H 24H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 08 04 00 00 00 54 0F C0 03 FFEB D01D
Execution

Result Data After Execution Address Result


C001H 04H
C002H 02H
C003H 08H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But 1’s=3=odd  Result is odd & p= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 11 SLIP NO 18
Q1)a) Writes a program that separates the two nibbles of a number stored in ML C000H
and stores the same in MLs C001H and C002H. The program must also multiply the two
nibbles and stores the product in ML C003H.
Memory Opcodes Label Mnemonic Operand Comment
Address
D000 21, 00, C0 LXI H,C000H ; Initialize HL
D003 7E MOV A,M ; Copy HL into register A.
D004 E6, OF ANI 0FH ; ANDing A with data 0FH and maskoff
MSB
D006 47 MOV B,A ; Copy A into B.
D007 7E MOV A,M ; Copy HL into A.
D008 E6, FO ANI FOH ; ANDing A with data F0H and maskoff
LSB
D00A OF RRC ; Rotate right 4 times and exchanges two
D00B OF RRC 4bit nibbles.
D00C OF RRC
D00D OF RRC
D00E 57 MOV D,A ; Copy A into D.
D00F 4A MOV C,D ; Copy D into C.
D010 3E, 00 MVI A,00H ; Move immediate data 00H into A & clear.
D012 CD,18, D0 CALL MUL ; Calls a subroutine.
D015 23 INX H ; Increment HL address by 1.
D016 77 MOV M,A ; Copy A content into HL location.
D017 CF RST 1 ; Stop processing.
SUBROUTINE MUL
D018 80 MUL ADD B ;A=A+B
D019 0D DCR C ; Decrement C by 1.
D01A C2, 18, D0 JNZ MUL ; Jump to label MUL if z=0
D01D C9 RET ; Return from subroutine.
Address DATA
DATA ( Before Execution ) C000H 13H
C001H 13H
C002H 13H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 03 03 00 01 00 54 0F C0 01 FFEB D018
Execution

Result Data After Execution Address Result


C001H 03H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But 1’s=3=odd  Result is odd & p= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 11 SLIP NO 18
Q1)a) Writes a program that separates the two nibbles of a number stored in ML C000H
and stores the same in MLs C001H and C002H. The program must also multiply the two
nibbles and stores the product in ML C003H.
Memory Opcodes Label Mnemonic Operand Comment
Address
F000 3A, 00, C0 LDA C000H ; Load A with Memory location C000H.
F003 E6, 0F ANI 0FH ; ANDing A with data 0FH and maskoff
MSB
F005 5F MOV E,A ; Copy A to E.
F006 3A, 00, C0 LDA C000H ; Load A with ML C001H.
F009 E6, F0 ANI F0H ; ANDing A with data F0H and maskoff
LSB
F00B 0F RRC ; Rotate right without carry A with 4 times
F00C 0F RRC and exchanges two 4bit nibbles.
F00D 0F RRC
F00E 0F RRC
F00F 4F MOV C,A ; Copy A to C.
F010 16, 00 MVI D,00H ; Move immediate data in regi D & clear.
F012 21, 00, 00 LXI H,0000H ; Clear HL.
F015 19 LOOP DAD D ; HL = HL + DE
F016 0D DCR C ; Decrement C regi content by 1.
F017 C2, 15, F0 JNZ LOOP ; jump to label LOOP if z=0.
F01A 22, 03, CO SHLD C003H ; Store HL to two consecutive ML C003H
and C004H.
F01D CF RST 1 ; Stop processing.
Address DATA
DATA ( Before Execution ) C000H 25H
C001H 25H
C002H 25H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 02 01 00 00 05 54 0F 00 0A FFEB F01E
Execution

Result Data After Execution Address Result


C003H 0AH
C004H 00H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But 1’s=3=odd  Result is odd & p= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 11 SLIP NO 19
Q1)a) A 4-byte hex number beginning with lower order byte is stored from MLs C000H. Writes a
program that checks whether the given number is consider in hex is palindrome or not. If
the number is palindrome then ML D000H must contains AAH else contains FFH.
Memory Opcodes Label Mnem Operand Comment
Address onics
F000 21,00,D0 LXI H, D000H ; Initialize HL.
F003 36,FF MVI M, FFH ; Move immediate data FFH to HL location
F005 2A,00,C0 LHLD C000H ; Load HL with two consecutive ML contents
C000H and C001H.
F008 3A,03,C0 LDA C003H ; Load A with ML data C003H.
F00B 0F RRC ; Rotate right A without carry.
F00C 0F RRC ; Rotate right A without carry.
F00D 0F RRC ; Rotate right A without carry.
F00E 0F RRC ; Rotate right A without carry.
F00F 95 SUB L ;A=A–L
F010 C2, 23,F0 JNZ STOP ; Jump to label STOP if z=0
F013 3A,02,C0 LDA C002H ; Load A with ML data C002H.
F016 0F RRC ; Rotate right A without carry.
F017 0F RRC ; Rotate right A without carry.
F018 0F RRC ; Rotate right A without carry.
F019 0F RRC ; Rotate right A without carry.
F01A 94 SUB H ;A=A–H
F01B C2, 23, F0 JNZ STOP ; jump to label STOP if z=0.
F01E 21, 00, D0 LXI H, D000H Initialize DE
F021 36, AA MVI M, AAH ; Load immediate data AAH to HL
F023 CF STOP RST 1 ; Stop processing.

Address DATA
DATA ( Before Execution )
C000H ABH
C001H BCH
C002H CBH
C003H BAH
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 00 01 00 00 00 54 0F D0 00 FFEB F024
Execution

Result Data After Execution Address Result


D000H AAH

Flags After Execution & Interpret’s its meaning is


After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But 1’s=3=odd  Result is odd & p= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 11
SLIP NO 19
Q1)a) A 4-byte hex number beginning with lower order byte is stored from MLs C000H. Writes a
program that checks whether the given number is consider in hex is palindrome or not. If
the number is palindrome then MLD000H must contains 00H else contains FFH.
Memory Opcodes Label Mnemonics Operand Comment
Address
F0000 21, 00, C0 LXI H,C000H ; Initialize HL
F003 11, 03, C0 LXI D,C003H ; Initialize DE
F006 0E, 01 MVI C,01H ;Move Immediate data 01H into register
C.
F008 7E LOOP MOV A,M ; Copy HL to register A.
F009 0F RRC ; Rotate right A without CY
F00A 0F RRC ; Rotate right A without CY
F00B 0F RRC ; Rotate right A without CY
F00C 0F RRC ; Rotate right A without CY
F00D EB XCHG ; Exchanges addresses of HL and DE.
F00E BE CMP M ; Compare A with HL content.
F00F C2, 21, F0 JNZ EXIT ; Jump on label EXIT if z=0.
F012 EB XCHG ; Exchanges addresses of HL and DE.
F013 23 INX H ; Increment HL address by 1.
F014 1B DCX D ; Decrement address of DE by 1.
F015 0D DCR C ; Decrement content of C by 1.
F016 C2,08, F0 JNZ LOOP ; Jump to label LOOP if z=0
F019 21, 00, D0 LXI H,D000H ; Initialize DE register pair.
F01C 36, AA MVI M,AAH ; Move immediate data AAH into HL.
F01E C3,26, F0 JMP STOP ; Unconditional jump to label STOP.
F021 21, 00, D0 EXIT LXI H,D000H ; Initialize DE register pair.
F024 36, FF MVI M,FFH ; Move immediate data FFH to HL.
F026 CF STOP RST 1 ; Stop processing.

Address DATA
DATA ( Before Execution )
C000H CBH
C001H A9H
Result
C002H 9AH
C003H BCH
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After BC 01 00 C0 02 54 0F D0 00 FFEB F027
Execution

RESULT: Data After Execution Address Result


D000H AAH
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But 1’s=3=odd  Result is odd & p= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 11
SLIP NO 20
Q1)a) Write a program that multiplies two 1-byte hex numbers, stored in consecutive MLs starting
from C000H by rotation. Stores the two byte result in the consecutive MLs starting from
C002H beginning with lower order byte.
Memory Opcodes Label Mnemonics Operand Comment
Address
D000 21, 00, C0 LXI H,C000H ; Initialize HL
D003 5E MOV E,M ; Copy HL content to E.
D004 16, 00 MVI D,00H ; Move immediate data 00H to D &
clear.
D006 23 INX H ; Increment HL by 1.
D007 7E MOV A,M ; Copy HL to A.
D008 21, 00, 00 LXI H,0000H ; Initialize HL & clear.
D00B 0E, 08 MVI C,08H ; Move immediate data 08H to C.
D00D 29 UP DAD H ; HL = HL + HL
D00E 07 RLC ; Rotate left accumulator without carry.
D00F D2, 13, D0 JNC DN ; Jump if cy=0 to label DN
D012 19 DAD D ; HL= HL + DE
D013 0D DN DCR C ; Decrement C by 1.
D014 C2, 0D, D0 JNZ UP ; Jump on label UP if z=0
D017 22, 02, C0 SHLD C002H ; Store HL to two consecutive ML
C002H & C003H.
D01A CF RST 1 ; Stop processing.
Address DATA
C000H 03H
DATA ( Before Execution )
C001H 02H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 02 01 00 00 03 54 0F 00 06 FFEB D01B
Execution
Address Result
RESULT: Data After Execution C002H 06H
C003H 00H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But 1’s=3=odd  Result is odd & p= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.

Q2) Record Book


Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 11
SLIP NO 20
Q1)a) Write a program that multiplies two 1-byte hex numbers, stored in consecutive MLs starting
from C000H by rotation. Stores the two byte result in the consecutive MLs starting from
C002H beginning with lower order byte.
Memory Opcodes Label Mnemonics Operand Comment
Address
D000 21, 00, C0 LXI H,COOOH ; Initialize HL
D003 5E MOV E,M ; Copy HL to register E.
D004 16, 00 MVI D,00H ; Move immediate 00H to D & clear.
D006 23 INX H ; Increment HL by 1.
D007 7E MOV A,M ; Copy HL to A.
D008 21, 00, 00 LXI H,0000H ; Initialize HL and clear.
D00B 0E, 08 MVI C,08H ; Move immediate data 08H to C.
D00D 17 MUL RAL ; Rotate left A with carry.
D00E D2,12, D0 JNC GO ; jumps to label GO if cy =0
D011 19 DAD D ; HL = HL + DE
D012 0D GO DCR C ; Decrement C by 1.
D013 CA, 1A, D0 JZ STORE ; Jump on label STORE if z=1.
D016 29 DAD H ; HL = HL + HL.
D017 C3, 0D, D0 JMP MUL ; Unconditional jump to label MUL
D01A 22, 02, C0 STORE SHLD C002H ; Store HL to two consecutive ML
C0002H & C003H.
D01D CF RST 1 ; Stop processing.
Address DATA
DATA ( Before Execution ) C000H 09H
C001H 23H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 00 01 00 00 09 54 0F 01 3B FFEB D01E
Execution

RESULT: Data After Execution Address Result


C002H 3BH
C003H 01H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 54 = 01010100
1) CY = 0  Result is 8-bit .
2) P = 1 But 1’s=3=odd  Result is odd & p= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 1  Result is zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 12 SLIP NO 21
Q1)a) Write a program that performs the following in the given sequential order :
1. Clears all flags.
2. Loads 00h in accumulator and stores all flags in the stack. This should be done to
demonstrate ( using stack ) , that flags are not affected by data transfer instructions.
3. Logically OR the accumulator with itself to set zero flag and stores all the flags in
the stack. This should be done to demonstrate ( using stack ) that flags are affected
by logic instructions.
Memory Opcodes Label Mnemonic Operand Comment
Address
D000 31,99,C0 LXI SP,C099H Initialize stack address as C099H
D003 2E,00 MVI L , 00H Clear L register
D005 E5 PUSH H Place L on flag
D006 F1 POP PSW Clear flags
D007 3E,00 MVI A , 00H Load 00H
D009 F5 PUSH PSW Saves flags on stack
D00A E1 POP H Retrieve flags in L register
D00B 7D MOV A,L Get content in ACC
D00C D3,00 OUT 00H Display flags
D00E 3E,00 MVI A , 00H Load 00H again
D010 B7 ORA A Set flags & reset CY,AC flags
D011 F5 PUSH PSW Saves flag on stack
D012 E1 POP H Retrieves flags in L
D013 7D MOV A,L Get content in ACC
D014 E6,40 ANI 40H Masks all flags except ‘Z’ flag
D016 D3,01 OUT 01H Display flag on port 1
D018 CF RST 1 S/W interrupting
Address DATA
C099H 12H
DATA ( Before Execution ) C098H 00H
C097H 00H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 40 01 00 00 00 10 0F 00 44 C099 D019
Execution
Address RESULT
Result Data After Execution C099H 12H
C098H 40H
C097H 10H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 10 = 00010000
1) CY = 0  Result is 8-bit .
2) P = 0  Result is odd .
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 13 SLIP NO 22
Q1)a) Writes a program to converts a 2-digit BCD numbers stored at ML C000H into its binary
equivalent and stores the binary value in ML C001H
Memory Opcodes Label Instruc Operand Comment
Address tions
D000 21,00,C0 LXI H, C000H Set memory pointer in HL
D003 01,01,CO LXI B, C001H Set 2nd memory pointer in BC rp
D006 7E MOV A,M Moves memory TO ACC
D007 C5 PUSH B Stores BC to stack
D008 D5 PUSH D Stores DE to stack
D009 47 MOV B, A Moves ACC to B
D00A E6,0F ANI OFH Makes logical ANDing
D00C 4F MOV C, A Moves A to C
D00D 78 MOV A, B Moves B to A
D00E E6,F0 ANI FOH Makes logical ANDing
D010 0F RRC
D011 0F RRC Shifts two nibbles and exchanges its contents
D012 0F RRC
D013 0F RRC
D014 57 MOV D, A Moves A TO D
D015 AF XRA A Reset CY flag
D016 1E,0A MVI E, OAHSet E = 0AH
D018 83 SUM ADD E [A]=[A]+[E]
D019 15 DCR D Decrement count
D01A C2,18,D0 JNZ SUM If count # 0 then jumps to label SUM &
executes instruction ADD E
D01D 89 ADD C If count = 0 then [ A ] = [ A ]+[ D ]
D01E D1 POP D Restores data of stack to DE
D01F C1 POP B Restores data of stack to BC
D020 02 STAX B Stores ACC to B
D021 CF RST 1 S/W interrupting
Address DATA
DATA ( Before Execution ) C000H 99H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 63 C0 01 00 00 14 0F C0 00 FFEB D022
Execution

Result Data After Execution


Address Result
C001H 63H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 14 = 00010100
1) CY = 0  Result is 8-bit .
2) P = 0 But 1’s=2=even. So that Result is even.  p=1 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 13
SLIP NO 22
Q1)a) Writes a program to converts a 2-digit BCD numbers stored at ML C000H into its binary
equivalent and stores the binary value in ML C001H
Memory Opcodes Label Mnemonic Operand Comment
Address
D000 21, 00, C0 LXI H, C000H ; Initialize HL.
D003 7E MOV A, M ; Copy HL into A
D004 E6, 0F ANI OFH ; ANDing A with 0FH & maskoff MSB
D006 47 MOV B, A ; Copy A to B
D007 0E, 0A MVI C, 0AH ; Move Immediate 0AH to C.
D009 7E MOV A, M ; Copy HL to A.
D00A E6, F0 ANI F0H ; ANDing A with F0H & maskoff LSB.
D00C 0F RRC ; Rotate right A without cy
D00D 0F RRC ; Rotate right A without cy
D00E 0F RRC ; Rotate right A without cy
D00F 0F RRC ; Rotate right A without cy
D010 57 MOV D, A ; Copy A to D.
D011 3E, 00 MVI A, 00H ; Move Immediate 00H to A & clear.
D013 82 UP ADD D ; A = A + D.
D014 0D DCR C ; Decrement C by 1.
D015 C2, 13, D0 JNZ UP ; Jump to label UP if z=0
D018 80 ADD B ;A=A+B
D019 32, 01, C0 STA C001H ; Store A into ML C001H.
D01C CF RST 1 ; Stop processing.

DATA ( Before Execution ) Address DATA


C000H 89H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 59 09 00 08 00 04 0F C0 00 FFEB D01D
Execution

Result Data After Execution Address Result


C001H 59H
C002H 00H
C003H 00H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 04 = 00000100
1) CY = 0  Result is 8-bit .
2) P = 1  Result is even. But 1’s = 1= odd. So that p =0 modified.
3) AC = 0  Carry is not given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 13
SLIP NO 23
Q1a) Writes a program to converts a binary number stored at ML C000H into its BCD equivalent
and stores the three digit BCD number in two consecutive MLs starting at C0001H.
Memory Opcodes Label Mnemonic Operand Comment
Address
D000 21,00,C0 LXI H, C000H Set memory pointer in HL
D003 7E MOV A,M Moves memory to ACC
D004 23 INX H Increments HL address
D005 06,64 MVI B, 64H Set [ B ] = 64H
D007 36,FF MVI M ,FFH Set [ M ] = FFH
D009 34 UP INR M Increments memory data
D00A 90 SUB B [A]=[A]–[B]
D00B D2,09,D0 JNC UP Jumps to label UP if CY = 0
D00E 80 ADD B If CU =1 then [A] = [A]+[B]
D00F 23 INX H Increments HL address
D010 06,0A MVI B, 0AH Sets [B]=0AH
D012 36,FF MVI M , FFH Memory=M=FFH
D014 34 UP1 INR M Increments memory data
D015 90 SUB B [A] = [A] - [B]
D016 D2,14,D0 JNC UP1 Jumps to label UP1 if CY=0
D019 80 ADD B If CY=1 then [A]=[A]+[B]
D01A 23 INX H Increments HL address
D01B 77 MOV M,A Moves content in memory from A
D01C CF RST 1 S/W interrupting
Address DATA
DATA ( Before Execution ) C000H 35H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 03 0A 00 00 00 15 0F C0 03 FFEB D01D
Execution

Result Data After Execution Address Result


C001H 00H
C002H 05H
C003H 03H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 15 = 00010101
1) CY = 1  Result is 9-bit .
2) P = 1  Result is even . But 1’s = 3 = odd. So that p= 0 modified.
3) AC = 1  Carry is given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 13
SLIP NO 24
Q1)a) A 2-digit hex number is stored in ML C000H. Writes a program to coverts each digit of this
number into ASCII equivalent, and stores the ASCII codes in MLs C001H and C002H.
Memory Opcodes Label Mnemonic Operand Comment
Address
D000 21, 00, C0 LXI H, C000H ; Initialize HL.
D003 7E MOV A,M ; Copy HL to A.
D004 E6, F0 ANI F0H ; ANDing A with data 0FH & maskoff
LSB.
D006 0F RRC ; Rotate right A without cy.
D007 0F RRC ; Rotate right A without cy.
D008 0F RRC ; Rotate right A without cy.
D009 0F RRC ; Rotate right A without cy.
D00A FE, 0A CPI 0AH ; Compare A with data 0AH.
D00C DA, 11, D0 JC NEXT ; Jump to label NEXT if cy=1
D00F C6, 07 ADI 07H ; A = A + 07H
D011 C6, 30 NEXT ADI 30H ; A = A + 30H
D013 57 MOV D,A ; Copy A to D.
D014 7E MOV A, M ; Copy HL to A.
D015 E6, 0F ANI 0FH ; ANDing A with data 0FH.
D017 FE, 0A CPI 0AH ; Compare A with data 0AH.
D019 DA, 1E, D0 JC GO ; Jump to label GO if cy=1.
D01C C6, 07 ADI 07H ; A = A + 07H.
D01E C6, 30 GO ADI 30H ; A = A + 30H.
D020 5F MOV E, A ; Copy A to E.
D021 EB XCHG ; Exchanges addresses of HL & DE
D022 22, 01, C0 SHLD C001H ; Stores HL to two consecutive ML
C001H & C002H.
D025 CF RST 1 ; Stop processing.

DATA ( Before Execution ) Address DATA


C000H 63H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 33 01 00 C0 00 04 0F 36 33 FFEB D026
Execution

Result Data After Execution Address Result


C001H 33H
C002H 36H

Flags After Execution & Interpret’s its meaning is


After Execution = F = 04 = 00000100
1) CY = 1  Result is 8-bit .
2) P = 1  Result is even . But 1’s = 1 = odd. So that p= 0 modified.
3) AC = 0  Carry is not given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )
EXPERIMENT : 13
SLIP NO 25
Q1)a) Two ASCII codes for hexadecimal digits are stored at MLs C000H and C001H. Writes an
ALP to converts the codes into their hexadecimal equivalents. Stores the two respective
hexadecimal equivalents as data in a single M.L. C002H.
Memory Opcodes Label Mnemonic Opeand Comment
Address
D000 3A,00,C0 LDA C000H Loads ACC with memory
D003 D6,30 SUI 30H Subtracts 30H from ACC
D005 FE,0A CPI OAH Compare with 0AH
D007 DA,0C,D0 JC DOWN If CY=1 then execute MOV B,A
D00A D6,07 SUI 07H If CY=0 then [A]=[A]-07
D00C 47 DOWN MOV B,A Moves A to B
D00D 3A,01,C0 LDA C001H Loads ACC with memory location
D010 D6,30 SUI 30H [A]=[A] - 30H
D012 FE,0A CPI 0AH Compare with 0AH
D014 DA,19,D0 JC DOWN1 If CY=1 then executes MOV C,A
D017 D6,07 SUI 07H If CY=0 then [A]=[A]-07H
D019 4F DOWN1 MOV C, A Moves A to C
D01A 78 MOV A, B Moves B TO A
D01B 07 RLC
D01C 07 RLC Shits lefts and exchanges contents
D01D 07 RLC
D01E 07 RLC
D01F 81 ADD C [A]=[A]+[C]
D020 32,02,C0 STA C002H Stores result
D023 CF RST 1 S/W interrupting
Address DATA
C000H 38H
DATA ( Before Execution )
C001H 34H
Q1)b) Enters the program on the microprocessor kit.
Q1)c) Execution of program
Registers A B C D E F I H L SP PC
After 84 08 04 00 00 A4 0F FF FE FFEB D024
Execution

Result Data After Execution Address RESULT


C002H 84H
Flags After Execution & Interpret’s its meaning is
After Execution = F = 04 = 00000100
1) CY = 1  Result is 8-bit .
2) P = 1  Result is even . But 1’s = 1 = odd. So that p= 0 modified.
3) AC = 0  Carry is not given from bit 3 to bit 4.
4) Z = 0  Result is non zero.
5) S = 0  Result is Positive.
Q2) Record Book
Q3) Term Work
Q4) Oral (Viva Vice )

You might also like