Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Square

OP CODE
LABEL ADDRESS MNEMONICS REMARKS
B1 B2 B3
START 8100 LXI H 8150 21 50 81 Load ACC to register

8103 MOV B,M 46 Move memory to B register

8104 XRA A AF Clear ACC to 0

LOOP 8105 ADD M 86 Add the memory with loop

8106 DCR B 05 Decrement B by 1

8107 JNZ LOOP C2 05 81 Jump on non zero loop

810A INX H 23 Increment by 1

810B MOV M, A 77 Move A to memory

END 810C HLT 76 Halt


Square root
OP CODE
LABEL ADDRESS MNEMONICS REMARKS
B1 B2 B3
START 8000 MVI C,01 0E 01 move immediate data 01 to c- register

8002 MVI B,01 06 07 The data 01 is move to B-register

8004 MVI A,XX 3E XX The data immediately move to A register

LOOP 2 8006 SUB B 90 subtract B with A- register

8007 JZ LOOP 1 CA 10 80 Jump zero

800A INR C 0C Increment c by 1

800B INR B 04 Increment B register by 1

800C INR B 04 Increment B register by 1

800D JMP LOOP 2 C3 06 80 Repeat subtract

LOOP 1 8010 MOV A,C 79 move contents c to Accumulator

8011 STA 8050 32 50 80 store the result in accumulator

END 8014 HLT 76 End of the program

You might also like