0

According to the book , In the assembly language, opcode CPA compares the operand in the memory and the data in the accumulator. I want to know how the instruction CPA affects A register(accumulator)

BR main 

NUM1: .block 2

NUM2: .block 2

MSG1: .ascii “A register is less than 0\0x00”

MSG2: .asciiA register is more than 0\0x00”

Compared: .block2 

main: 

      DECI NUM1,d.    ; for example, 1

      DECI NUM2,d.          ; for example, 4

      LDA NUM1,d

      CPA NUM2,d.      ;after comparing num1(which is now in - 
                    -Accumulator) and num 2(in the memory)


      STA Compared,d.  ;if i store the contents in the Accumulator,
                  Whih figure would accumulator have? 3 or 2?


      BRlT lessThan 
      BR   End

LessThan: 

      STRO msg1,d

      DECO compared,d

          BR END


END: 

      stop 

      .End
#

According to PEP/8 simulator, The result was “the register is less than 0”, while the accululator is still 1.

What happens when using CPA? Please help me ((

Sami Kuhmonen
  • 30,146
  • 9
  • 61
  • 74

0 Answers0