NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: macaswell on December 18, 2010, 12:27:25 AM

Title: Does mov actually move, or just copy?
Post by: macaswell on December 18, 2010, 12:27:25 AM
So, I'm trying to implement command line arguments in my OS, and I came across a situation of which I've never heard of.

Does the operand 'mov' actually move the data, or just copy the data?

Such as (this code will not work on any os):
Code: [Select]
start:
     mov [tmp0], str0
     mov si, [tmp0]          ; is tmp0 now empty?
     call print_string

     tmp0     times 255 db 0
     str0       db 'Hello, World!', 0

Will that empty [tmp0]?
Title: Re: Does mov actually move, or just copy?
Post by: Frank Kotler on December 18, 2010, 04:55:36 AM
"mov" just copies. How would you define "empty"? Re-filled with zeros?

I'm amazed you wrote Casnix without knowing this. I got as far as:

Code: [Select]
mov sp, 0FFFFh

... and stopped reading. You really want to keep your stack aligned!

Best,
Frank