Documente Academic
Documente Profesional
Documente Cultură
r arithmetic operations of two 8 bit numbers using 8085 microprocessor kit for the following operations. A. B. C. D. Addition Subtraction Multiplication Division
APPARATUS REQUIRED: S.No 1. 2. 3. Apparatus Required 8085 Microprocessor kit Power supply Opcode sheet Quantity 1 1
A. ALGORITHM FOR 8-BIT ADDITION: 1. 2. 3. 4. Start the program. Load first data in accumulator and move the content from register A to register B. Load the second data in accumulator. Initialize the carry value as 00. Add the content of A register with B register. If a carry doesnt exist, directly store the value. 5. If carry exists, then increment the carry value and then store the sum in the address location mentioned. 6. Stop the program.
IF ther e carr
No
Stop
PROGRAM FOR 8-BIT ADDITION: MEMORY LABEL 4500 START 4501 4502 4503 4504 4505 4506 4507 4508 4509 450A 450B 450C 450D 450E 450F 4510 4511 4512 4513 4514 4515 MNEMONICS OPCODE MVI C,00H 0E 00 LDA 4200H 3A 00 42 MOV B,A 47 LDA 4201H 3A 01 42 80 D2 0E 41 0C 32 02 42 79 32 03 42 76 COMMENTS Move the value to register C immediately Load accumulator from address 4200H Move the content to the B register Load accumulator from address 4201H Add contents of B with A Jump of control to given address when no carry is found Increment register C Store accumulator with contents of 4202H Move content of C to A Store accumulator with contents of 4203H Stop the program
LOOP1
STOP
HLT
B. ALGORITHM FOR 8 BIT SUBTRACTION: 1. Load the first data in accumulator and move the content from accumulator to B register. 2. Load the second data in accumulator. Initialize the carry value. 3. Subtract the content of accumulator with register B. 4. Check whether carry is present or not. 5. If present, increment the carry. 6. Complement the accumulator content. 7. Add immediate by incrementing A register. 8. If no carry is present, store the data in accumulator. 9. The content present in C register is moved to accumulator. 10. Store the result in memory location mentioned. 11. Stop the program.
PROGRAM FOR 8 BIT SUBTRACTION: MEMORY 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 460A 460B 460C 460D 460E 460F 4610 4611 4612 4613 4614 4615 4616 4617 LABEL START MNEMONICS OPCODE MVI C,00 0E 00 LDA 4200H 3A 00 42 47 3A 01 42 90 D2 10 46 0C 2F 3C 32 02 42 79 32 03 42 76 COMMENTS Move the value to register C immediately Load accumulator from address 4200H Move content of A to B Load accumulator from address 4201H Subtract contents of B with A Jump of control to given address when no carry is found Increment register C Complement occurs Increment of A Store the content of given address to accumulator Move contents of C to A Store the content of given address to accumulator
Stop the program
LOOP1
STOP
HLT
ALGORITHM FOR 8-BIT MULTIPLICATION: 1. Start the program. 2. Load the first data into the accumulator. 3. Move the content of accumulator to the B register. 4. Load the second data into the accumulator. 5. Move the content of accumulator to the C register. 6. Decrement the content of B register by one. 7. Add the C register content with accumulator. 8. Decrement the content of B register & then repeat the steps 7 & 8. 9. Else store the result in the memory location mentioned. 10. Stop the program.
PROGRAM FOR 8 BIT MULTIPLICATION: MEMORY 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 LABEL START MNEMONICS OPCODE MVI C,00H 0E 00 LDA 4200H 0A 00 41 MOV B,A 47 LDA 4201H 0A 01 41 MOV C,A 4F DCR B 05 ADD C 81 DCR B 05 JNZ LOOP C2 0B 41 STA 4202H 32 02 42 HLT 76 COMMENTS Move the content immediately to reg C Load accumulator from address 4200H Move content of A to B Load accumulator from address 4201H Move content of A to C Decrement register B Add content of C with A Decrement register B Jump of control to given address when no zero is found Store the content of given address to accumulator Stop the program
LOOP
ALGORITHM FOR 8 BIT DIVISION: 1. 2. 3. 4. 5. Start the program. Load the first data in the accumulator. Move the content from memory address to A register and increment the HL pair. Move the content from memory address to B register & initialize the C register. Compare the 8 bit instructions in A and B registers. Subtract B register from accumulator & increment the value in C register. 6. Increment the HL pair and move the content in accumulator to memory. 7. Stop the program
PROGRAM FOR 8 BIT DIVISION: MEMORY 4201 4202 4203 4204 4205 4206 4207 4208 4209 420A 420B 420C 420D 420E 420F 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 421A LABEL START MNEMONICS OPCODE MVI C,00H 0E 00 LDA 4500H 3A 00 45 MOV B,A 47 LDA 4501 3A 01 45 CMP B B8 JC LOOP2 DA 13 42 SUB B 90 INR C 0C JMP LOOP1 C3 0A 42 STA 4502H 32 02 45 MOV A,C 79 STA 4503 32 03 45 HLT 76 COMMENTS Move the content immediately to reg C Load the content to the accumulator with the address 4500 Move the content to reg B Load the content to the accumulator with the address 4501 Compare the B reg Jump carry to loop2
LOOP 1
LOOP2
STOP
Store the content to the accumulator with the address 4502 Move the content to A Store the content to the accumulator with the address 4503 Halt the process
AIM: To write an assembly language program for the ascending and descending order of 8-bit numbers using 8085 microprocessor kit. APPRATUS REQUIRED: S.NO 1. 2. NAME OF ITEMS 8085-Microprocessor kit Power supply QUANTITY 1
A. ALGORITHM FOR ASCENDING ORDER: 1. Start the program 2. Load the data in memory whose address in C 3. Move the memory into C-register then decrement the C-register by 1 and increment H by 1. 4. Load the data in the memory to A. 5. Compare the memory with A. 6. Jump on the carry when M is greater A, go to Step 9. 7. Move the memory M to D register 8. Decrement the address of HL pair and move the D register content to M and increment the value by H by 1. 9. Move B register and decrement the C-register. 10. Jump on Zero to the address 4108,if zero goes to decrement B and go to step1. 11. Stop the program.
PROGRAM FOR ASCENDING ORDER: ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C OPCODE 06 05 05 0E 05 0D 21 00 42 7E 23 BE DA 14 41 56 77 2B 72 23 0D C2 09 41 05 C2 03 41 76 LABEL START MNEMONICS MVI B,05H DCR B MVI C,05H DCR C LXI H,4200 COMMENTS Move the content immediately to reg B Decrement the reg B Move the content immediately to reg c Decrement the reg C Load the content immediately to HL pair Move the content to A Increment the HL pair Compare the contents Jump carry to loop3 MOV D,M MOV M,A DCX H MOV M,D INX H DCR C JNZ LOOP2 Move the content to D Move the content to memory Decrement the HL pair Move the content to memory Increment the HL pair Decrement the reg C Jump non zero to loop2 DCR B JNC LOOP1 Decrement the reg B Jump no carry to loop1 STOP HLT Halt the process
LOOP1
LOOP2
LOOP3
B. ALGORITHM FOR DESCENDING ORDER: 1. Start the program 2. Load the data in memory whose address in C 3. Move the memory into C-register then decrement the C-register by 1 and increment H by 1. 4. Load the data in the memory to A. 5. Compare the memory with A. 6. Jump on no carry when M is greater A, go to Step 9. 7. Move the memory M to D register 8. Decrement the value of HL pair and move the D register content to M and increment the value by H by 1. 9. Move B register and decrement the C-register. 10. Jump on Zero to the address 4108,if zero goes to decrement B and go to step1. 11. Stop the program.
PROGRAM FOR DESCENDING ORDER: ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C OPCODE 06 05 05 0E 05 0D 21 00 42 7E 23 BE D2 14 41 56 77 2B 72 23 0D C2 09 41 05 C2 03 41 76 MOV D,M MOV M,A DCX H MOV M,D INX H DCR C JNZ LOOP2 Move the content to D Move the content to memory Decrement the HL pair Move the content to memory Increment the HL pair Decrement the reg C Jump non zero to loop2 DCR B JNC LOOP1 Jump no carry to loop1 STOP HLT Halt the process Decrement the reg B LABEL START MNEMONICS MVI B,05H DCR B MVI C,05H DCR C LXI H,4200 COMMENTS Move the content immediately to reg B Decrement the reg B Move the content immediately to reg c Decrement the reg C Load the content immediately to HL pair Move the content to A Increment the HL pair Compare the contents Jump non carry to loop3
LOOP1
LOOP2
LOOP3
Exp no: 3 Date : PROGRAM WITH 8085 CONTROL INSTRUCTIONS AIM: To write an assembly language program for the Maximum/Minimum instructions using 8085 microprocessor kit. APPRATUS REQUIRED: S.NO 1. 2. NAME OF ITEMS 8085-Microprocessor kit Power supply QUANTITY 1
A. ALGORITHM FOR SEARCHING MINIMUM NUMBER: 1. Start the program 2. Load the address of the first element of the array in the HL register fair(pointer). 3. Move the count to B register. 4. Increment the pointer. 5. Get the first data in accumulator. 6. Decrement the count. 7. Increment the pointer. 8. Compare the content of memory address by HL pair with that of accumulator. 9. If carry=1 go to step 2 or If carry=0 go to step 10. 10. Move the content of memory addressed by HL to accumulator. 11. Decrement the count. 12. Check whether ZF=0 go to step 7 or If ZF=1 go to next step. 13. Store the smallest data in memory. 14. Stop the program.
PROGRAM FOR SEARCHING MINIMUM NUMBER ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 OPCODE 21 00 45 46 23 7E 05 23 BE DA 0D 41 7E 05 C2 07 41 32 04 45 76 LABEL START MNEMONICS LXI H,4500 Load the content immediately to HL pair MOV B,M INX H MOV A,M L2 DCR B INX H CMP M JC L1 Move the content to reg B Increment the HL pair Move the content to A Decrement the reg B Increment the HL pair Compare the memory to A Jump carry to L1 MOV A,M DCR B JNZ L2 Move the content to reg A Decrement the reg B Jump non zero to L2 STA 4504 Store the value to A STOP HLT Halt the process COMMENTS
L1
B. ALGORITHM FOR SEARCHING MAXIMUM NUMBER: 1. Start the program 2. Load the address of the first element of the array in the HL register fair (pointer). 3. Move the count to B register. 4. Increment the pointer. 5. Get the first data in accumulator. 6. Decrement the count. 7. Increment the pointer. 8. Compare the content of memory address by HL pair with that of accumulator. 9. If carry=0 go to step 2 or If carry=0 go to step 10. 10. Move the content of memory addressed by HL to accumulator. 11. Decrement the count. 12. Check whether ZF=0 go to step 7 or If ZF=1 go to next step. 13. Store the smallest data in memory. 14. Stop the program.
PROGRAM FOR SEARCHING MAXIMUM NUMBER: ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 OPCODE 21 00 45 46 23 7E 05 23 BE D2 0D 41 7E 05 C2 07 41 32 04 45 76 LABEL START MNEMONICS LXI H,4500 Load the content immediately to HL pair MOV B,M INX H MOV A,M L2 DCR B INX H CMP M JNC L1 Move the content to reg B Increment the HL pair Move the content to A Decrement the reg B Increment the HL pair Compare the memory to A Jump non carry to L1 MOV A,M DCR B JNZ L2 Move the content to reg A Decrement the reg B Jump non zero to L2 STA 4504 Store the value to A STOP HLT Halt the process COMMENTS
L1
Exp no: 4 Date : PROGRAM WITH 8085 CONTROL INSTRUCTIONS AIM: To write an assembly language program for the Code conversion using 8085 microprocessor kit. APPRATUS REQUIRED: S.NO 1. 2. NAME OF ITEMS 8085-Microprocessor kit Power supply QUANTITY 1
a. ALGORITHM FOR BCD TO BINARY: 1. Start the program. 2. Get the BCD data in A register and move to B register. 3. Mask the lower nibble of BCD data in A register. 4. Rotate the upper nibble to lower nibble position and save in B register. 5. Clear the accumulator. 6. Move 0AH to C register. 7. Add B register to A register. 8. Decrement C register If ZF=0 go to step 7 If ZF=1 go to next step. 9. Save the product in B register. 10. Get the BCD data in A register. 11. Add the units (A reg) to product (B reg). 12. Store the binary value in memory. 13. Stop the program.
PROGRAM FOR BCD TO BINARY: ADDRESS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B OPCODE 3A 00 45 47 E6 0F 5F 78 E6 F0 0F 0F 0F 0F 57 A7 26 0A 84 15 C2 12 41 83 82 01 45 76 LABEL START MNEMONICS LDA 4500 Load the content to A MOV B,A ANI OF MOV E,A MOV A,B ANI FO RRC RRC RRC RRC MOV D,A XRA A MVI H,OA L1 ADD H DCR D JNZ L1 Move content to reg B And the content immediately with accumulator Move content to reg E Move content to reg A And the content immediately with accumulator Rotate A to right with carry Rotate A to right with carry Rotate A to right with carry Rotate A to right with carry Move content to reg D XOR function with A Move immediately to reg H Add the reg H Decrement the reg D Jmp non zero to L1 ADD E STA 4501 Add to reg E Store the content to A STOP HLT Halt the process COMMENTS
b. ALGORITHM FOR BINARY TO BCD 1. Start the program. 2. Clear D &E register to account for hundreds and tens. 3. Load the BINARY data in A register 4. Compare A register with 64H If carry flag set go to step 8 otherwise go to next step. 5. Subtract 64H from A register. 6. Increment E register. 7. Go to step 4. 8. Compare A register with 0AH If carry flag set go to step 11 otherwise go to next step. 9. Subtract 0AH from A register. 10. Increment D register 11. Go to step 8. 12. Combine the units and tens to form 8 bit result. 13. Save the units, hundreds and tens in memory. 14. Stop the program.
PROGRAM FOR BINARY TO BCD: ADDRESS OPCODE LABEL 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E 411F 4120 4121 4122 4123 31 00 47 21 00 45 7E CD 0B 41 76 21 00 46 06 64 CD 1A 41 06 0A CD 1A 41 77 C9 36 FF 34 90 D2 1C 41 80 23 C9 START
LXI H,4500 Load the data to HL MOV A,M CALL SUB R1 Move the data to A Call the sub function SUB R1 HLT LXI H,4600 Halt the process Load the data to HL MVI B,64H CALL SUB R2 Move the data to regB Call the sub function SUB R2 Move the data to regB Call the sub function SUB R2 Move the data to M Return Move the data to M Increment memory register Subtract reg B from A Jump no carry to L1 ADD B INX H RET Add A to B Increment reg H Return
SUB R1
Exp no: 5 Date : PROGRAMMING WITH 8085 16 BIT ARITHMETIC OPERATION AIM: To write an assembly language program for arithmetic operations of two 16 bit numbers using 8085 microprocessor kit for the following operations. A. B. C. D. Addition Subtraction Multiplication Division
APPARATUS REQUIRED: Apparatus Required S.No 1. 8085 Microprocessor kit 2. Power supply 3. Opcode sheet A. ALGORITHM FOR 16-BIT ADDITION: 1. Start the program 2. Load the first 16-bit data from memory into HL register pair 3. Move the first 16-bit data from HL register pair to DE register pair 4. Load the second 16-bit data from memory into HL register pair 5. Initialize the C register as 00H 6. Move content of L register into accumulator 7. Add the content of E register to content of accumulator 8. Move content of accumulator(result of lower 8-bit addition) into L register 9. Move content of H register into accumulator 10. Add the content of D register to content of accumulator with carry 11. If carry zero means go to step 13 12. Increment C register 13. Move content of accumulator(result of higher 8-bit addition) into H register 14. Store the output from HL register pair to memory 15. Move content of C register into accumulator 16. Store the carry result in another memory location 17. Stop the program Quantity 1 1
Stop
ADDRESS 8500 8503 8504 8507 8509 850A 850B 850C 850D 850E 8511 8512 8513 8516 8517 851A
LABEL
MNEMONICS OPCODE LHLD 9000 XCHG LHLD 9002 MVI C,00 MOV A,L ADD E MOV L,A MOV A,M ADC D JNC STEP1 INR C MOV H,A SHLD 9100 MOV A,C STA 9102 HLT
OPERAND
COMMENTS
STEP1
B.
1. Start the program 2. Load the first 16-bit data from memory into HL register pair 3. Move the first 16-bit data from HL register pair to DE register pair 4. Load the second 16-bit data from memory into HL register pair 5. Initialize the C register as 00H 6. Move content of L register into accumulator 7. Subtract the content of E register from content of accumulator 8. Move content of accumulator(result of lower 8-bit subtraction) into L register 9. Move content of H register into accumulator 10. Subtract the content of D register from content of accumulator with borrow 11. If carry zero means go to step 13 12. Increment C register 13. Move content of accumulator(result of higher 8-bit subtract) into H register 14. Store the output from HL register pair to memory 15. Move content of C register into accumulator 16. Store the carry result in another memory location 17. Stop the program
Subtract higher byte of second number and borrow from previous subtraction
Stop
ADDRESS 8500 8503 8504 8507 8509 850A 850B 850C 850D 850E 8511 8512 8513 8516 8517 851A
LABEL
MNEMONICS LHLD 9000 XCHG LHLD 9002 MVI C,00 MOV A,L SUB E MOV L,A MOV A,M SBB D JNC STEP1 INR C MOV H,A SHLD 9100 MOV A,C STA 9102 HLT
OPCODE
OPERAND
COMMENTS
STEP1
C. ALGORITHM FOR 16- BIT MULTIPLICATION: 1. Start the program. 2. Move the content of accumulator to the B register. 3. Load the HL register into the accumulator. 4. Exchange the content of accumulator to the C register. 5. Load the HL register to the next accumulator. 6. Load the register pair immediately to the H register. 7. Multiply the register with SP. 8. Increment B register. 9. Move the HL register to memory. 10. Compare the OR register pair with E. 11. Store the HL register to memory. 12. Move the content of the memory to register B. 13. Move the content of all memory. 14. Stop the program.
Subtract lower byte of second number from lower byte of first number
Subtract higher byte of second number and borrow from previous subtraction
Stop
MEMORY 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E
LABEL
COMMENTS
LXI SP,FFFF
LXI B,2222
LXI H,0000
L2
DAD SP JNC L1
L1
SHLD 4500
HLT
ALGORITHM FOR 16 BIT DIVISION: 1. Start the program. 2. Initialize BC to store quotient. 3. Load the dividend. 4. Transfer the content to the register pair DE. 5. Load the divisor. 6. Move the content of H to accumulator. 7. If dividend is less than the divisor then store the result. 8. Store quotient in 16 bit address. 9. Stop the program.
Get the divisor in A reg, move to B reg and get the dividend in A reg
Yes If cy= No
Stop
MEMORY 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E
LABEL START
COMMENTS
LXI B, 4502H
LXI D, 4504H
L1
INX D JMP L1
L2
HLT
PROGRAMMING FOR ARITHMETIC OPERATIONS USING 8086 ARITHMETIC OPERATION AIM: To perform arithmetic operations like addition, subtraction, multiplication and division using 8086. 1. 2. 3. 4. ADDITION: SUBTRACTION. MULTIPLICATION. DIVISION
APPARATUS REQUIRED: S.No 1. 2. 3. Apparatus Required 8085 Microprocessor kit Power supply Opcode sheet Quantity 1 1
A. ALGORITHM FOR 16 BIT ADDITIONS; 1. Start the program. 2. Load the first data in AX register. 3. Load the second data in BX register. 4. Clear CL register. 5. Add the two data and get sum in AX register. 6. Store sum in memory. 7. Check for carry. 8. Increment CL register. 9. Stores carry in memory. 10. Stop.
FLOWCHART:
Start
Clear CL register
YES
Is CF= 1 Increment CL reg NO
Stop
PROGRAM FOR 16 BIT ADDITIONS IN 8086: Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E Hex. Code C7 C0 34 12 C7 C3 78 56 01 D8 89 06 02 11 F4 Mnemonic Instruction Label START Opcode MOV Operand AX ,#1234 Load the data in AX reg Comments
MOV
BX,#5678
ADD MOV
AX,BX [1200],AX
Add two data and get sum in AX reg Move the sum value to memory
STOP
HLT
B. ALGORITHM FOR 16 BIT SUBTRACTIONS: 1. 2. 3. 4. 5. 6. 7. 8. 9. Start the program. Load the minuend in AX register. Get the subtrahend in BX register. Clear CL register to account for sign. Subtract the content of BX from AX. Check for carry. If cy=1 go to next step. Increment CL register. Store the sign bit in memory. Stop.
FLOWCHART:
Start
Clear CL register
YES
Is CF= 1 Increment CL reg NO Complement AX register
Add 01 to AX
Stop
PROGRAM FOR 16 BIT SUBTRACTIONS IN 8086: Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E Hex. Code C7 C0 34 12 C7 C3 78 56 01 D8 89 06 02 11 F4 Mnemonic Instruction Label START Opcode MOV Operand AX ,#1234 Load the data in AX reg Comments
MOV
BX,#5678
ADD MOV
AX,BX [1200],AX
Add two data and get sum in AX reg Move the sum value to memory
STOP
HLT
C. ALGORITHM FOR 32 BIT MULTIPLICATIONS: 1. Load address of data in BX register 2. Clear CX register to account for carry 3. Get D1LW in AX & D2 LW in BP 4. Multiply MX&BP to get product1 in AX&BX 5. Save P1UW in SI register 6. Get D1UW in AX register 7. Multiply AX&BP to get product2 in AX&DX 8. Check for array 9. Increment CX 10. Save P2UW in DI register 11. Multiply AX&BP 12. Add P3LW to SI register 13. Add CX & P3LW 14. Clear CX register 15. Check for carry 16. Increment CX register 17. Save third & fourth word of product in memory 18. Stop
FLOWCHART:
Start
Get D1 LW in AX register
Get D2 LW in BP
Save P1LW in SI
Multiply AX & BP
Save AX
Is CF
Increment CX
Multiply AX & BX
Add P3LW to SI
Is CF=1
Increment CX
Clear CX
A Get D1UW in AX Multiply AX & BP to get Product 4 in AX & DX Add DI & AX to get third product Add CX previous carry to get fourth product of final product
Stop
PROGRAM FOR 32 BIT MULTIPLICATION IN 8086 Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 Hex.code C7 C0 04 00 C7 C3 05 00 F7 E3 89 06 02 11 89 16 04 11 F4 Mnemonic Instruction Label Opcode START MOV AX,#0004H Comments Move the data in reg AX
MOV BX,#0005H
MOV [1104],BX
STOP
HLT
D. ALGORITHM FOR DIVISION OF 32 BIT DATA BY 16 BIT DATA 1. 2. 3. 4. 5. 6. 7. Load the address of data in SI register. Get lower word of dividend in AX register. Get upper word of dividend in DX register. Get divisor in BX register. Perform division to get quotient in AX and divider in DX. Save quotient and remainder. Stop.
FLOWCHART
Start
Stop
PROGRAM FOR DIVISION OF 32 BIT BY 16 BIT DATA : Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 Hex.code C7 C0 04 00 C7 C3 05 00 F7 E3 89 06 02 11 89 16 04 11 F4 STOP HLT Halt the process MOV [1104],BX Load the data from BX reg to address MOV [1102],AX Load the data from AX reg to address MUL BX Multiply AX and BX MOV BX,#0005H Move the data in reg BX Mnemonic Instruction Label START Instruction MOV AX,#0004H Move the data in reg AX Comments
PROGRAM WITH 8086 CONTROL INSTRUCTIONS AIM: To write an assembly language program for the below given instructions using 8086 microprocessor kit. A. Maximum/Minimum B. Code conversion APPRATUS REQUIRED: S.NO 1. 2. NAME OF ITEMS 8086-Microprocessor kit Power supply QUANTITY 1
A. ALGORITHM FOR MINIMUM NUMBERS IN AN ARRAY: 1. Start 2. Load starting address of array in SI register 3. Load number of byte in array in CL register 4. Increment array pointer 5. Get first byte of array in AL register 6. Decrement byte count 7. Increment array pointer 8. Get next byte in BL register 9. Compare AL and BL 10. Checks carry flag 11. Move BL and AL 12. Check zero flag 13. Save smallest data 14. Stop
FLOWCHART:
Start
YES
Is cf=0
NO A
A
Move BL and AL
B
Decrement CL
NO
Stop
PROGRAM FOR SEARCHING OF MINIMUM NUMBER IN AN ARRAY Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 101A 101B 101C Hex. Code BE 11 00 BF 12 00 8A 0C 46 84 04 FE C9 46 8A 1C 3A C3 72 02 8A C3 FE C9 75 F3 88 05 F4 HLT MOV [DI],A JNC AGAIN if count is not zero repeat search store smallest data in memory AHEAD DEC CL decrement count MOV AL,BL JC AHEAD if cy=1 then AL is less than BL CMP AL,BL AGAIN INC MOV SI BL,[SI] makes SI to point to next data get next data in BL register DEC CL INC MOV SI AL,[SI] increment address pointer MOV CL,[SI] MOV DI,1200 set DI register as pointer for result Mnemonic Instruction Label Opcode Operand MOV SI,1100 Comments set SI register as pointer
B. ALGORITHM FOR MAXIMUM NUMBER IN AN ARRAY 1. Start 2. Load the starting address of array in SI register 3. Load the address of result in DI register 4. Load number of bytes in the array in CL register 5. Increment array pointer 6. Get first byte of array in AL register 7. Get next byte of array in BL register 8. Checks carry flag 9. Move BL and AL 10. Decrement byte count 11. Check zero flag 12. Store largest data 13. Stop
FLOW CHART:
Start
B
Increment array pointer
YES is cf=0
C
NO
MOVE BL AD AL
C
DECREMENT BYTE COUNT NO
STOP
PROGRAM FOR SEARCHING OF MAXIMUM NUMBER IN AN ARRAY Memory Address 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 101A 101B 101C Hex. Code BE 11 00 BF 12 00 8A 0C 46 84 04 FE C9 46 8A 1C 3A C3 72 02 8A C3 FE C9 75 F3 88 05 F4 HLT MOV [DI],AL JNC AGAIN if count is not zero repeat search store largest data in memory AHEAD DEC CL decrement count MOV AL,BL JNC AHEAD if cy=1 then BL as current largest CMP AL,BL AGAIN INC MOV SI BL,[SI] makes SI to point to next data get next data in BL register DEC CL INC MOV SI AL,[SI] MOV CL,[SI] set CL as count for element increment address pointer MOV DI,1200 set DI register as pointer for result Mnemonic Instruction Label START Opcode Operand MOV SI,1100 Comments set SI register as pointer
Exp no:8
STRING MANIPULATION
AIM: To write and execute a program to perform the string manipulation multibyte addition using 8086 microprocessor. APPARATUS REQUIRED:
S. NO 1. 2. ALGORITHM: 1. 2. 3. 4. 5. 6. 7. 8. 9.
Quantity 1 1
XOR the BX register with AX register. XOR the BX register with BX register. Move the data 05 to CL register. Move the content of 1200 to SI register. Move the content of SI register to BL register. Add the content of BX register with AX register and the result is stored in AX register. Execute the loop1 instruction. Move the AX register to SI register. Stop the program.
FLOW CHART:
YES
LOOP
NO
A
STOP
PROGRAM: ADDRESS 1000 OPCODE 31,CD LABEL INSTRUCTION XOR OPERAND AX,BX COMMENTS XOR the content of AX register with BX register XOR the content of BX register with BX register Move the data 05 to CL register Move the content of 1200 to SI register Move the content of SI register to BL register Add the content of BX register with AX register Increment SI register Go to loop 1 Move the content of AX register to SI register Stop the program
46 F2,F9 89,04 F4
SI LOOP 1 [SI],AX
EVEN OR ODD
To write and execute an assembly language for finding whether the given number is even or odd. APPARATUS REQUIRED: S.NO 1 2 ALGORITHM: 1. Start the program. 2. Clear the CX register. 3. Clear the D register. 4. Move the content 06 to CL register. 5. Move the content 1300 to SI register. 6. Move the SI value to AL register. 7. Shift AL register by one. 8. Jump if carry to LI. 9. Increments BL register value. 10. Jump to loop 2. 11. Increment DL value. 12. Increment SI value. 13. Go to loop 3. 14. Move the content from DL to SI and BL to SI. 15. Increment SI value. 16. Stop the program. APPARATUS REQUIRED 8086 Microprocessor kit Power supply QUANTITY 1 1
FLOW CHART:
Start
Move the data 06 to CL register Move the content of 1300 to SI register B Move the SI value to AL register A
Jump carry
YES
Jump if carry
NO
Loop
NO
Stop
PROGRAM:
ADDRESS 1000 1004 1007 100A 100E 1010 1012 1014 1016 1019 101B 101C 101E 1020 1021 1023
OPCODE LABEL INSTRUCTION C7,C1,00,00 MOV C6,C2,00 MOV C6,C3,00 MOV C6,C1,06 C7,C6,06,13 L3 D2,EB 72,05 FE,C3 E9,1E,10 FF,C2 46 E2,FO 88,14 46 88,1C F4 MOV MOV SHR JC INC JMP INC INC LOOP MOV INC MOV HLT
OPERAND CX,00 DL,00 CL,06 SI,1300 AL,[SI] AL 101C BL 101B DL SI 100E [SI],DL SI [SI],DL
L1 L2
COMMENT Clear the CX register Clear the DL register Move the data 06 to CL register Move the content of 1300 to SI register Move the content of SI to AL register Shift AL register by one Jump if carry to L2 Increment BL register by one Jump to L1 Increment DL by one Increment SI value Go to loop 3 Move the content DL to SI Increment SI value Move the content DI to SI Stop the program
Exp no: 10 Date : PROGRAMMING FOR 8 BIT ARITHMETIC OPERATION USING 8051 AIM: To write an assembly language program for 8- bit addition, subtraction, multiplication and division using 8051. APPARATUS REQUIRED: 1. 8051 microcontroller 2. Power supply
ALGORITHM FOR 8 BIT ADDITIONS: 1. 2. 3. 4. 5. 6. Start the program Get the 1st operand in accumulator Add 2nd operand with 1st operand in accumulator Move data from accumulator to data pointer Store the result in memory Stop
FLOW CHART:
Stop
PROGRAM FOR 8-BIT ADDITION OF 8051 Memory Address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 Mnemonic Instruction Label Opcode MOV ADD MOV Operand A,#34 A,#62 DPTR,#4500
Hex. Code 74 34 24 62 90 45 00 F0 80 FE
MOV SJMP
X@DPTR,A 4108
ALGORITHM 8 BIT SUBTRACTION IN 8051: 1. 2. 3. 4. 5. 6. Start the program Get the 1st operand in accumulator Subtract 2nd operand from 1st operand in accumulator Move data from accumulator to data pointer Store the result in memory Stop
FLOWCHART:
Start Get the 1st operand in A register Subtract 2nd operand from A register Store the result in memory
Stop
ALGORITHM FOR MULTIPLICATION: 1. 2. 3. 4. 5. Start the program Get the two numbers Multiply two numbers Store the result Stop the program
Start
PROGRAM FOR MULTIPLICATION: ADDRESS 4100 4102 4105 4106 4109 410A 410B 410D 410E LABEL START MNEMONICS MOV A,#04 MOV B,# 02 MUL A,B MOV DPTR,#4500 MOVX @ DPTR,A INC DPTR MOV A ,B MOV X,@DPTR,A SJMP HERE OPCODE 74,04 75, F0,02 A4 90,45,00 F0 A3 E5,F0 F0 80, FE
HERE
ALGORITHM FOR DIVISION: 1. 2. 3. 4. 5. Start the program Get the two numbers Divide two numbers Store the result Stop the program
Start
Divide
two numbers
Store the results
Stop
PROGRAM FOR DIVISION: ADDRESS 4100 4102 4105 4106 4109 410A 410B 410D 410E LABEL START MNEMONICS MOV A,#08 MOV B,# 02 DIV AB MOV DPTR,#4500 MOV X@ DPTR,A INC DPTR MOV A ,B MOV X,@DPTR,A SJMP HERE OPCODE 74,08 75,F0,02 84 90,45, 00 F0 A3 E5,F0 F0 80,FE
HERE
Exp no :11 Date: 1S AND 2S COMPLEMENT USING 8051 AIM: To write an assembly language program for 1s and 2s complement using 8051.
ALGORITHM:
1. 2. 3. 4. 5. 6. 7. 8. 9.
Start the program. Move the value to a register. Compliment the value of a register. The result is stored in the address of 4500. Move the content of a to DPTR. Increment the a value. Increment the DPTR value. Move the content of a to DPTR. Jump to the next process.
PROGRAM:
OPCODE
LABEL
MNEMONICS MOVE
OPERAND A, #DPTR
COMMENTS Move the content of DPTR value to A Compliment the value of A Move the value from 4200 to DPTR
CPL
MOV
DPTR, #4200
MOV X
@DPTR, A
Move the A value to DPTR Increment the A Value Increment the DPTR Value Move the content of A value to DPTR Short jump
4107 4108
INC INC
A DPTR
4109
MOV X
@DPTR, A
410A 410B
SJMP
410A
FLOW CHART:
Start
Get divide in A
Get divide in B
Divide by B
Stop
PROGRAM:
OPCODE
LABEL
MNEMONICS MOV
OPERAND A, #08
MOV
B, #02
DIV
A,B
Exp no: 12 Date : INTERFACING AND PROGRAMMING OF STEPPER MOTOR CONTROL USING 8085
AIM: To interface stepper motor with 8085. APPARATUS REQUIRED: 1. 8085 microcontroller kit 2. Stepper motor control kit 3. Power supply ALGORITHM: 1. 2. 3. 4. 5. 6. 7. Start the program Set count for four stepping sequence. Set control word. Set output data for a sequence. Wait for one millisecond. Decrement count value. Stop.
FLOW CHART:
Start
Initialize ports
No
Is Count=0?
Yes
PROGRAM FOR INTERFACING OF STEPPER MOTOR WITH 8085: Memory Address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C 411D 411E Hex. Code 21 1A 41 06 04 7E D3 C0 11 03 03 00 1B 7B B2 C2 0B 41 23 05 C2 05 41 C3 00 41 DB 09 05 06 0A Mnemonic Instruction Label Opcode Operand START LXI H,LOOK UP Comments
DELAY
D A,E D DELAY
Decrement DE pair
H B REPT
JMP
START
Jump to start
AIM: To interface 8253 interface board to 8085 p and verify the operation of 8253 in six different modes. APPARATUS REQUIRED: 8085 p kit, 8253 interface board, DC regulated power supply, VXT parallel bus, CRO. FLOW CHART: Start
Out the A port value Move immediately 90 to A Out the A port value Move immediately 88 to A register
Stop
PROGRAM:
Opcodes 3E 36 D3 CE 3E 0A D3 C8 3E 00 D3 C8 76
Label START:
Comments Channel 0 in mode 3 Send Mode control word LSB of count Write count to register MSB of count Write count to register Stop the program
Exp no:14 Date : PROGRAMMING FOR INTERFACE EXPERIMENTS AIM: To study the value of analog to digital conversion and digital to analog conversion. A. ADC INTERFACING WITH 8085 B. DAC INTERFACING WITH 8085 APPARATUS REQUIRED: 1. 8085 microprocessor kit 2. ADC, DAC interface card A. ALGORITHM FOR ADC INTERFACE: 1. 2. 3. 4. 5. 6. Start the program Initialize the count value Move the data immediately to the accumulator Store the data in specified address Display the data with LED glowing ON/OFF Stop the program
FLOWCHART:
Start
Display
Stop
PROGRAM FOR ADC INTERFACE: Memory address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 Label Mnemonics Hexade Comments Op code Operand cimal code MVI A,10 3E Move the data immediately to the accumulator 10 OUT E0 D3 Display to port E0 MVI A,18 3E Move the data immediately to the accumulator 18 OUT E0 D3 Display to port E0 MVI A,01 3E Move the data 00 immediately to the accumulator 01 OUT D0 D3 Display to port D0 XRA A AF Clear the accumulator content XRA A AF Clear the accumulator content XRA A AF Clear the accumulator content MVI A,00 3E Move the data 00 immediately to the accumulator 00 OUT D0 D3 Display to port D0 HLT 76 Halt the program
Start
B. ALGORITHM FOR DAC INTERFACE: A. SQUARE WAVE GENERATOR: B. SAW TOOTH WAVEFORM C. TRIANGULAR WAVEFORM
A. ALGORITHM FOR SQUARE WAVE GENERATOR: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Start the program Clear the accumulator Load minimum value to the accumulator Display data in output port address Call subroutine SQR Delay program SQR Assign first count to C register Assign second count to B register Decrement the second count If count is zero, decrement the count else go to step 9 If carry is zero go to step 8 Return to main program
Decrement II count
Count= 0 Stop
Move the data immediately to the accumulator Display to port Call the subroutine
OUT CALL
C0 SQR
MVI
A,FF
Move the data immediately to the accumulator Display to port Call the subroutine
OUT CALL
C0 SQR
JMP
LOOP1
MVI
C,03
Move the data immediately to the accumulator Move the data immediately to the accumulator Decrement the B register Jump to specified location if no zero exists
MVI
B,FF
DCR JNZ
B LOOP4
DCR JNZ
C LOOP3
RET
FLOWCHART:
Start
Stop
LOOP1
Move the data immediately to the accumulator Write the data from A to port address Increment the Accumulator Jump to specified location if no zero occurs
LOOP2
OUT
C0
INR JNZ
A LOOP2
JMP
LOOP1
FLOW CHART:
Start
No
If Z
No
If ZF
Yes
LOOP3
Move the data immediately to the accumulator Write the data from A to port address Increment the Accumulator Jump to specified location if no zero occurs
LOOP1
OUT
C0
INR JNZ
A LOOP1
MVI
A,FF
Move the data immediately to the accumulator Write the data from A to port address Decrement the Accumulator Jump to specified location if no zero occurs
LOOP2
OUT
C0
DCR JNZ
A LOOP2
JMP
LOOP1
Exp no:15 Date : PROGRAMMING FOR INTERFACE EXPERIMENTS AIM: To control the traffic light using 8085 microprocessor and interface of 8279
APPARATUS REQUIRED: 8085 trainer kit, 8279 interface board, DC power supply.
B. ALGORITHM FOR INTERFACING 8279 WITH 8085 TO DISPLAY THE CHARACTER C 1. 2. 3. 4. 5. 6. 7. Start the program Get mode and display set By immediate address mode get value in A-register Count value in display Write content in display RAM Out the character Stop
FLOW CHART:
Start
Stop
PROGRAM FOR INTERFACING OF 8279 WITH 8085: Memory Address 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 411A 411B 411C Hex. Code 3E 00 D3 C2 3E CC D3 C2 3E CC D3 C2 3E 6C D3 C0 3E FF D3 C0 D3 C0 D3 C0 D3 C0 D3 C0 76 Mnemonic Instruction Label Opcode Operand MVI A,00 OUT MVI OUT MVI OUT MVI OUT MVI OUT OUT OUT OUT OUT HLT C2 A,CC C2 A,90 C2 A,6C C0 A,FF C0 C0 C0 C0 C0 Out the content Display C Write display RAM Comments Mode & Display set Out control word C2 Clear display RAM
APPARATUS REQUIRED:
8085 p kit, 8251 interface board, DC regulated power supply, VXT parallel bus.
B (1).ALGORITHM FOR INTERFACING OF 8251 WITH 8085: 1. Start the program. 2. At transmitter side move the data to accumulator. 3. Out the data to port CE. 4. Move the data from port to A. 5. AND 04 with the content of accumulator. 6. If it is non zero jump on to LOP. 7. REST 1. 8. For reception move the data to accumulator. 9. out data to various port. 10. Input data from port. 11. If it is non zero jump on to LOP1. 12. AND data with accumulator. 13. Store the result in 4150. 14. RESET 1.
FLOW CHART:
Start
In transmitter side move the data to accumulator Out the data to port CE
Store result
Stop
Out data to various Port
If
N RESET 1
PROGRAM FOR INTERFACING OF 8251 WITH 8085 TRANSMITTER PROGRAM: Mnemonic Instruction Memory Hex. Address Code Label Opcode Operand 4100 3E START MVI A,36 4101 36 4102 D3 OUT OCE H 4103 CE 4104 3E MVI A,0A 4105 0A 4106 D3 OUT OC8 H 4107 C8 4108 3E MVI A,00 4109 00 410A D3 OUT OC8 H 410B C8 410C 3E MVI A,4E 410D 4E 410E D3 OUT OC2 H 410F C2 4110 3E MVI A,37 4111 37 4112 D3 OUT OC2 H 4113 C2 4114 DB 4115 C2 LOP IN OC2 H 4116 E6 ANI 04 4117 04 4118 CA JZ LOP 4119 14 411A 41 411B 3E MVI A,41 H 411C 41 411D D3 OUT OC0 H 411E CO 411F CF RST 1
Cut the data from port And immediate data 04 with A Jump on zero to LOP
Reset
RECEIVER PROGRAM: Mnemonic Instruction Memory Hex. Address Code Label Opcode Operand 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 420A 420B 420C 420D 420E 420F 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 421A 421B 3E 36 D3 CE 3E 0A D3 C8 3E 00 D3 C8 3E 4E D3 C2 3E 37 D3 C2 DB C2 E6 02 CA 14 42 DB IN OC0 H JZ LOP1 LOP1: IN ANI OC2 H 02 OUT OC2 H MVI A,37 OUT OC2 H MVI A,4E OUT OC8 H MVI A,00 OUT C8 H MVI A,0A OUT OCE H MVI A,36
Hex. Code CO 32 50 41 CF
Comments
Store in 4150
RST
PROGRAM:
ADDRESS OPCODES 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B
LABEL START:
MNEMONICS MVI
OPERAND A,90
COMMENTS Initialize port A as input and port B as output Send Mode Control Word Read from port A Display the data in port B Store the data read from port A in 4200
C6 C0 C2 4200
STOP:
HLT
MAIN PROGRAM: ADDRESS OPCODES 4100 4101 4102 4103 4104 4105 4106 4107
LABEL START:
MNEMONICS MVI
OPERAND A,B4
COMMENTS Initialize port A as input port in mode 1 Send Mode Control Word Set the PC4 bit for INTE A Display the data in port B
C6 A,09 C6
EI 4108 4109 410A 410B MVI SIM EI HLT Stop the program A,08 Enable RST5.5
ISR(Interrupt Service Routine) ADDRESS OPCODES LABEL MNEMONICS OPERAND 4200 START: IN C0 4201 4202 4203 4204 4205 HLT STA 4500
COMMENTS
LABEL
MNEMONICS JMP
OPERAND 4200
COMMENTTS Go to 4200
BSR MODE(Bit Set Reset mode) PROGRAM: ADDRESS OPCODES 4100 4101 4102 4103 4104 4105 4106 4107 4108
LABEL START:
COMMENTS Set PC0 Send Mode Control Word Set PC3 Send Mode Control Word Stop the program
STOP:
HLT