Computer Science, asked by ironman29, 1 year ago

write an ALP that multiply two 8 bit hex numbers are stored in memory locations c005H and c006H store the two bytes result in consecutive memory location starting from c00H.

Answers

Answered by Anonymous
11
Hello! ! !

Hey my dear friend here is your answer ___________

Assembly language program which u needed is in the above pic.

check it out....

_________________

HOPE THIS ANSWER WILL HELP U....

@Neha...
Attachments:
Answered by pruthaasl
1

Answer:

LXI H, C005h

MOV E, M

MVI D, 00h

INX H

MOV C, M

LXI H, 0000h

back: DAD D

DCR C

JNZ back

SHLD C007h

HLT

8-bit multiplication:

  • The multiplication of two 8-bit hex numbers is done by repetitive addition.
  • In repetitive addition, one number is set as a counter to keep the count of how many times the addition is taking place. The other number is added to itself.
  • The counter is decremented by one after every addition.
  • Once the counter has become zero, the addition is stopped and the desired product is obtained.

Explanation:

  • We first initialize the memory pointer to C005h where the first 8-bit hex number is stored.
  • This number is then copied to the register E using the MOV instruction.
  • The register D is loaded with 00h implicitly using the MVI instruction.
  • The memory pointer is incremented to point to the next memory location C006h where the second 8-bit hex number is stored.
  • The second number is copied to register C as a counter using the MOV instruction.
  • The HL register pair is loaded with data 0000h using the LXI instruction as it will be used in the repetitive addition.
  • The contents of DE and HL register pairs are added using the DAD instruction and the result is again stored in the HL pair.
  • The count stored in register C is then decremented by one. If it is not zero, the zero flag will be reset and the flow of the program will be transferred back to the DAD D statement.
  • The addition of one 8-bit hex number will continue repetitively unless the value of the other number set as the counter is not zero.
  • Once the value of register C is zero, the multiplication by repetitive addition is done.
  • The result is stored in the next consecutive memory locations, i.e., C007h and C008h using the SHLD instruction.
  • The program is then terminated.

#SPJ3

Similar questions