Free Electronic Circuits & 8085 projects

Electronic projects with circuit diagram and 8085 microprocessor projects.

Add two 8-bit numbers

Home Forums 8085 Microprocessor Code Library Add two 8-bit numbers

This topic contains 2 replies, has 3 voices, and was last updated by  YT2095 5 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #13389


    Add the contents of memory locations 4000H and 4001H and place the result in memory location 4002H.
    Sample problem

    (4000H) = 14H
    (4001H) = 89H
    Result = 14H + 89H = 9DH

    Source program

    LXI H 4000H : HL points 4000H
    MOV A, M : Get first operand
    INX H : HL points 4001H
    ADD M : Add second operand
    INX H : HL points 4002H
    MOV M, A : Store result at 4002H
    HLT : Terminate program execution




    I tried to run the program, but I get error on the first line. It shows that the format you have used with LXI is incompatible.



    I`m not sure if it helps but, LD HL,nn in this instance would read 2A 00 40.
    this will put the number 0x4000 into the HL register.

    to load the Contents of the location 0x4000 into HL then it`s simply 21 00 40.

    Also on Twitter as: “YT2095”

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.