0

I am new in assembly I tried to move variables in this link https://schweigi.github.io/assembler-simulator/ I tried to change the content of char1 and char3

JMP start
char1: db "A"  
char2: db "B"
char3: db "C"
start:
    MOV A, [char1]
    MOV B, [char3]
    MOV [char3],A
    MOV [char1],B

now I want to do it only with one register ( without B ) , it is possible to define another variable but i didn't understand how to move the content between 2 variables
Could you please advise ?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
user1365697
  • 5,819
  • 15
  • 60
  • 96

2 Answers2

2

Here is the (not recommended) XOR method

MOV A, [char1]
XOR A, [char3]
XOR [char1], A
XOR [char3], A

A discussion of the XOR method is here:

Weather Vane
  • 33,872
  • 7
  • 36
  • 56
  • Problem is, your simulator [instruction set](https://schweigi.github.io/assembler-simulator/instruction-set.html) doesn't have that addressing mode. – Weather Vane Dec 04 '21 at 18:08
0

Thanks to Vane

    JMP start
char1: db "D"  
char2: db "O"
char3: db "G"
start:
    MOV A, [char1]  
    PUSH A 
        MOV A, [char3]
    MOV [char1], A
    POP A
    MOV [char3], A
user1365697
  • 5,819
  • 15
  • 60
  • 96