Cambio di valore in un registro

;(b) Register swap

 

  VAL1 EQU 0E6h

  VAL2 EQU 2Dh

  VAL3 EQU 30F0h

  ORG    0000h

  JP     0100h

  ORG    0100h

PROG_B :     LD A, VAL1       ;load the value 250 in exadecimal = 0E6(VAL1) in A accumulator

            LD B, VAL2       ;load the value 45 in exadecimal = 2D(VAL2) in the B register

           LD HL, VAL3       ;load the value 30F0h in the coupled HL register (16bit)

            LD C, VAL1        ;load the value VAL1 in the register C

           LD A,B            ; load the content of B in the Accumulator A

           LD B,C            ;load the value of C in the B register

HALT

Lascia un commento