I\'m doing an program inassembly 8086 processor, but i have one doubt. I want move one word to my created string, but the compiler show me an error: error A2004: constant value
In 8086 assembler, you cannot move a string of bytes into a memory location using a mov
statement.
You can move strings using the movsb
statement by loading the source address in the SI
register, the destination address in the DI
register, and the length of the string in the CX
register, and then finally calling MOVSB
.
Here is a simple example:
TARGET db 80 dup(0)
SOURCE db 'Hello', 0
mov si, offset SOURCE ; address of SOURCE
mov di, offset TARGET ; address of TARGET
mov cx, 6 ; number of bytes to move (size of SOURCE)
rep movsb ; move cx number of bytes from SOURCE to TARGET