PROGRAM
PROGRAM
0042
OBJECTIVES:
To provide training on programming of microprocessors and microcontrollers and
understand the interface requirements.
To simulate various microprocessors and microcontrollers using KEIL or Equivalent
simulator.
LIST OF EXPERIMENTS
8 Bit Subtraction
Label Mnemonic Comments
ORG 8000H Origin
MVI C,00H 00 moved to c register
MVI A,94H 8 bit data moved to accumulator
ADI 88H 8 bit directly subtract and stored
JNC LOOP Jump if No carry to loop
INR C Increment c
LOOP: STA OFE73H Store the content of A in 0FE73H
MOV A,C Move c to accumulator
STA OFE74H Store the content of A in 0FE74H
CALL 056CH Call the subroutine
HLT Stop the program
8 Bit Multiplication
Label Mnemonic Comments
ORG 8000H Origin
MVI C,00H 00 moved to c register
MVI A,00H 00 is moved to accumulator
MVI B,30H 8 bit data moved to register B
MVI D,60H 8 bit data moved to register D
LOOP1: ADD B Add content of B with accumulator.
JNC LOOP2 Jump if no carry to loop2
INR C Increment C
LOOP2: DCR D Decrement D
STA OFE73H Store content of A in OFE73H
MOV A,C Move C to accumulatore
STA OFE74H Store content of A in OFE74H
CALL 056CH Call the sub-routine
HLT Stop the program
8 Bit Division
Label Mnemonic Comments
ORG 8000H Assemble the program starting at 8000H
MVI C,00H 00 moved to C register with 00H
MVI A,49H Load register A with 8 bit data
MVI B,07H Load register B with 8 bit data
LOOP1: SUB B Subtract contents of B from accumulator
JC LOOP2 Jump no carry to Loop 2
INC C Increment register content C
JMP LOOP 1 Jump on Loop 1
LOOP2: ADD B Add content of B to Accumulator
STA OFE73H Store content of A to memory OFE73H
MOV A,C Move contents of C to Accumulator
STA OFE74H Store content of A to memory OFE74H
CALL 056CH Call the sub-routine at 056CH
HLT Stop the program
16 Bit Division
Label Mnemonic Comments
ORG 8000H Assemble the program starting at 8000H
LXI D,0000H Load 0000H in DE register
LXI H,FF66H Load 16 bit data in register BC
LXI B, 8888H Load 16 bit data in register BC
LOOP1: DSUB B Subtract B
JC LOOP2 Jump on carry to LOOP2
INX D Increment the content of register DE by 1
JMP LOOP1 Jump to LOOP1
LOOP2: DAD B Add contents of register pair BC to HL pair
SHLD 8850H Store H and L registers direct
XCHG Exchange H and L with D and E
SHLD 8852H Store the H and L register direct
HLT End of program
2 Array operations
(i) Finding
(ii) Sorting
i (a) Smallest Number
Label Mnemonic Comments
ORG 8500H
DB 09H, 08H,
07H, 06H, 04H
ORG 8000H
MVI C, 0AH
LXI H,8500H
MOV A,M
LOOP1: INX H
CMP M
JC LOOP2
MOV A,M
LOOP2: DCR C
JNZ LOOP1
STA OFE75H
CALL 0578H
HLT