ASCENDING ORDER:ADDRESS 9100 9103 9105 9106 9107 9108 910B 910C 910D 910E 9111 9112

9113 9114 9115 9116 9117 9118 911B 911C 911F LOOP LABEL MNEMONICS OPCODE COMMENTS LDA 9400 3A 00 94 Load the accumulator direct Subtract 01 from A SUI 01 D6 01 Move the A value to D register MOV D,A 57 Move the A value to E register MOV E, A 5F Move the D register value to B MOV B,D 42 LXI H 9200 21 00 92 Load HL pair indirect MOV A,M INX H CMP M JC LOOP MOV C,A MOV A,M MOV M,C DCX H MOV M,A INX H DCR B JNZ LOOP1 DCR E JNZ LOOP2 HLT 7E 23 BE DA 14 91 4F 7E 71 2B 77 23 5 C2 0B 91 1D C2 07 91 76 Move the M value to accumulator Increment the HL pair Compare the HL pair Jump on carry to 9114 Move the A value to C register Move the M value to A register Move the C register value to M Decrement HL pair Move the accumulator to M Increment HL pair Decrement B register Jump on no zero to 910A Decrement E register value Jump on no zero to 9107 Stop the program

LOOP2

LOOP1

DESCENDING ORDER:- ADDRESS LABEL MNEMONICS 9100 LDA 9400 9103 SUI 01 9105 MOV D.M INX H CMP M JNC LOOP MOV C. A MOV B.M MOV M.D LXI H 9200 MOV A.A MOV A.C DCX H MOV M.A INX H DCR B JNZ LOOP1 DCR E JNZ LOOP2 HLT OPCODE 3A 00 94 D6 01 57 5F 42 21 00 92 7E 23 BE D2 14 91 4F 7E 71 2B 77 23 5 C2 0B 91 1D C2 07 91 76 LOOP1 COMMENTS Load the accumulator direct Subtract 01 from A Move the A value to D register Move the A value to E register Move the D register value to B Load HL pair indirect Move the M value to accumulator Increment the HL pair Compare the HL pair Jump on carry to 9114 Move the A value to C register Move the M value to A register Move the C register value to M Decrement HL pair Move the accumulator to M Increment HL pair Decrement B register Jump on no zero to 910A Decrement E register value Jump on no zero to 9107 Stop the program .A 9106 9107 9108 910B 910C 910D 910E 9111 9112 9113 9114 9115 9116 9117 9118 911B 911C 911F LOOP LOOP2 MOV E.

A DCR H JNZ LOOP HLT LOOP OPCODE COMMENTS 11 02 FA Load DE pair immediately 06 00 Move immediate 00 to B register 0E 01 Move immediate 01 to C register 3A 00 FA Directly load accumulator 67 Move content of acc.C MOV C.FIBONACCI SERIES:- ADDRESS LABEL 8000 8003 8005 8007 800A 800B 800C 800D 800E 800F 8010 8011 8012 8015 MNEMONIC LXI D.A MOV A. To H 78 Move content of B register to acc. 12 Store accumulator indirect 13 Increment DE pair by 01 81 Add content of C register to acc. 41 Move content of C to B register 4F Move content of acc.B STAX D INX D ADD C MOV B.FA02 MVI B. To C register 25 Decrement H register by 01 C2 0C 80 Jump on no zero loop 76 Stop the program .01 LDA FAOO MOV H.00 MVI C.

23 Increment HL register pair 5 Decrement B register CA 32 80 Jump to address 8032 if zero flag is 1 16 02 Move immediately 02 to E register 16 00 Move immediately 00 to D register 4B Move the content of E register to C register 7B Move the content of accumulator to E register 91 Subtract the data in c register from accumulator C2 1E 80 Jump to address 801E if zero flag is 0 14 Increment D register D2 19 80 Jump to address 8019 if carry flag is 0 0D Decrement C register C2 18 80 Jump to address 8018 if zero flag is 0 7A Move the content of D register to accumulator FE 02 Compare with 02 CD 2D Jump to address 801E if zero flag is 0 80 73 Move the content of memory addressed by HL register pair to accumulator 23 Increment HL register pair 1C Increment E register 5 Decrement B register C2 15 80 Jump to address 8015 if zero flag is 0 76 Stop.00 MOV C. 21 00 91 3A 00 90 47 .E INX H INR E DCR B JNZ DD HLT DD XX BB AA CC END Load the data 9100 to HL register pair Load the accumulator directly Move the content of B register to accumulator.PRIME NUMBER SERIES:ADDRESS LABEL MNEMONIC OP CODE COMMENTS 8000 8003 8006 8007 8008 800D 800E 800F 8010 8013 8015 8017 8018 8019 801A 801D 801E 8021 8022 8025 8026 8028 802B 802C 802D 802E 802F 8032 LXI H.9100 LDA 9000 MOV B.A DCR B JZ END MOV M.A INX H DCR B JZ END MVI E.E SUB C JNZ AA INR D JNC BB DCR C JNZ XX MOV A.02 MVI D.E MOV A. 5 Decrement B register CA 32 80 Jump to address 8032 if zero flag is 1 77 Move the content of accumulator to memory addressed by HL registerpair.D CPI 02 JNZ CC MOV M.

Clear the contents of accumulator. A LDA 9000 ANI 0F MOV D. Move 04 to C register to rotate the upper nibble four times. Perform AND operation with F0 to separate lower nibble. Load the BCD number to ACC. Rotate content to right side if count not zero. Store the binary value in address. Decrement the value of C reg. Load the original BCD number to acc. Rotate content to right side without carry. Stop the program.BCD TO BINARY:ADDRESS LABEL MNEMONICS OPCODE COMMENTS 8000 MVI E. A MVI A. Decrement the E register value by 1. Add the lower nibble of BCD number with accumulator. . 00 ADD B DCR E JNZ STEP 3A 00 90 E6 F0 0F 0D C2 09 80 47 3A 00 90 E6 0F 57 3E 00 80 10 C2 16 80 801B 801C 801F ADD D STA 9001 HLT 82 32 01 90 76 Move 0A to E register to multiply the upper nibble of BCD number by 10. Add the upper nibble of BCD number to accumulator. 04 0E 04 8004 8007 8009 800A 800B 800E 800F 8012 8013 8014 8016 8017 8018 STEP JUMP LDA 9000 ANI F0 RRC DCR C JNZ JUMP MOV B. 0A 1E 0A 8002 MVI C. Move the lower nibble to D register. Jump to add the upper nibble to accumulator if count not zero. Else move the upper nibble to reg B. Perform AND operation with 0F to separate upper nibble.

BINARY TO ASCII:- ADDRESS LABEL MNEMONICS OPCODE COMMENTS 8150 LDA 9150 3A 50 91 Load the binary number to accumulator. Add immediately value 30 to acc. 8153 MOV B. Store the ASCII value to address. Add the content of acc with 37. Stop the program. A 47 Move the original binary number to B reg. 8154 CPI OA FE 0A Check if the binary value is less than 0A. 8159 815B 815E 8160 8163 LOOP1 LOOP ADI 37 JMP LOOP ADI 30 STA 9151 HLT C6 37 C3 60 81 C6 30 32 51 81 76 Else. . Jump unconditionally to address.

8052 8053 8056 8058 805B 805D 805E 8061 8063 8066 8068 8069 806C 806D 806E UNIT TEN HUND MOV D. Load the binary number to accumulator. Rotate the content of acc to left without carry. Jump to check the unit¶s place if carry is set. 00 1E 00 Clear the contents of E register.BINARY TO BCD:ADDRESS LABEL MNEMONICS OPCODE COMMENTS 8050 MVI E. A MOV A. E LDA 9050 CPI 64 JC TEN SUI 64 INR E JMP HUND CPI 0A JC UNIT SUI 0A INR D JMP TEN MOV C. D RLC 53 3A 50 90 FE 64 DA 61 80 D6 64 1C C3 56 80 FE 0A DA 6C 80 D6 0A 14 C3 61 80 4F 7A 7 Clear the contents of D register. . Jump to check if number is less than hundred. Check if binary number is less than !00. Jump to check the ten¶s place if carry is set . Subtract 64 immediately from binary number. Move content of accumulator with register C. Subtract 0AH immediately from binary number. Increment the value of hundreds digit. Increment the value of tens digit. Jump to check again if number is less than 10. Move the number of ten¶s to accumulator. Check if the binary number is less than ten.

Rotate the content of acc to left without carry. E STA 9052 HLT 7 7 7 81 32 51 90 7B 32 52 90 76 Rotate the content of acc to left without carry.806F 8070 8071 8072 8073 8076 8077 807A RLC RLC RLC ADD C STA 9051 MOV A. Move content of register E with accumulator. Add the unit¶s place to the ten¶s place. Store the content of accumulator Stop the program. Store the content of accumulator. Rotate the content of acc to left without carry. .

RLC 7 Rotate the content of accumulator to left without carry. ANI 07 E6 07 Perform AND operation of acc with 07. A 47 Move the original binary number to B reg. RLC 7 Rotate the content of accumulator to left without carry. B 78 Move the original binary number to accumulator. RRC 0F Rotate content of accumulator to right side without carry. ANI C0 E6 C0 Perform AND operation of accumulator with C0. HLT 76 Stop the program 800D 800E 800F 8012 8013 8015 8016 8017 801A . STA 9003 32 03 90 Store the third digit of octal number to memory address. MOV A. STA 9001 32 01 90 Store the first digit of octal number to address. MOV A.BINARY TO OCTAL:ADDRESS 8000 8003 8004 8006 8009 800A 800C LABEL MNEMONICS OPCODE COMMENTS LDA 9000 3A 00 90 Load the binary number to be converted into A register. RRC 0F Rotate content of accumulator to right side without carry. ANI 38 E6 38 Perform AND operation of accumulator with 38. MOV B. RRC 0F Rotate content of accumulator to right side without carry. STA 9002 32 02 90 Store the second digit of octal number to memory address. B 78 Move the original binary number to accumulator.

805B ADD C 81 Add the first digit with the accumulator. 8056 MOV C. to register D. 8060 RRC 0F Rotate content to right side without carry. A 57 Move content of acc. 8065 HLT 76 Stop the program. 805A RRC 0F Rotate content to right side without carry. B 78 Move original octal number to acc. 805C MOV D. 805D MOV A. A 4F Move the content of acc. 8054 ANI 07 E6 07 Perform AND operation with 07 to separate the first digit. to reg. 8053 MOV B. 8058 ANI 10 E6 10 Perform AND operation with 10 to separate the second digit. . B 78 Move the original octal number to acc.OCTAL TO BINARY:ADDRESS LABEL MNEMONICS OPCODE COMMENTS 8050 LDA 9050 3A 50 90 Load the octal number to accumulator. 8062 STA 9052 32 52 90 Store the binary number in address. A 47 Move original octal number to reg B. 805E ANI 60 E6 60 Perform AND operation with 60. 8061 ADD D 82 Add content of register D with the acc. C. 8057 MOV A.

Sign up to vote on this title
UsefulNot useful