Now I've learned enough assembly to know that moving from one memory location to another isn't allowed. But a question just popped into my head: how can push and pop be allowed? Correct me if I'm wrong, but push is simply 'pushing' onto the stack, and the stack is in memory. So are you not moving one memory item into another? Same goes for pop. I was just curious as to why mov mem,mem then isn't allowed. Any information greatly appreciated :wink:
Posted on 2005-01-25 19:04:04 by DaRetard
It's a matter of how many addresses you want to embed explicitly in your instructions. There is a space vs. time tradeoff for adding a full set of addressing modes for a second operand. The circuitry and/or microcoding for the x86 addressing is fairly complex, especially to get the speeds we are getting now. The designers have not yet elected to add the bits for that second address, and probably never will.

If you look at the bit encoding, you will see that PUSH-from and POP-to memory have exactly one memory operand encoded in the bits. The string instructions, MOVSB/W/D, CMPSB/W/D have no operand bits.
Posted on 2005-01-25 22:20:11 by tenkey
At the most basic, its not allowed because there is no opcode to perform that action. Syntax errors are properly high level language constructs, in assembler its what opcodes you have to work with and passing the correct arguments to them in the correct format.

I agree with tenkey here, it could be done but its very doubtful that it will be done, even though it would be a useful instruction but then is easy enough to perform in 2 instructions in any case, push/pop if speed does not matter or two MOV instructions if you have a spare register.
Posted on 2005-01-25 23:53:21 by hutch--
DaRetard,
The MOTORLA 6800/68000 can do a direct memory to memory copy with no excuses, like not enough circuitry, op codes, time, etc. Also it has 16 registers, so that programming it is easier than the INTEL CPU series.

The stack instructions PUSH and POP has an implicit designated register ESP to point within the stack. Therefore the stack instructions are not a memory to memory operation. Ratch
Posted on 2005-01-26 05:26:06 by Ratch
Great; thanks for all the info guys :alright:
Posted on 2005-01-26 09:52:03 by DaRetard


The MOTORLA 6800/68000 can do a direct memory to memory copy with no excuses, ...



The Motorola 6800 has no such capability.

It is much easier and cleaner to program the MC68000 series as you mentioned. This is because of a large and more useful register set, orthaginal instruction set with more useful addressing modes, and orthagonal application of instructions and addressing mode to all registers. It also has much more useful setting of the Control Register bits. For example no need to ever use anything like xor eax,eax.

Unfortunately, when IBM chose the 8088 for the first PC, Motorola went out of the mainstream.,
Posted on 2005-01-26 11:16:47 by msmith
DaRetard,
The MOTORLA 6800/68000 can do a direct memory to memory copy with no excuses, like not enough circuitry, op codes, time, etc. Also it has 16 registers, so that programming it is easier than the INTEL CPU series.

The stack instructions PUSH and POP has an implicit designated register ESP to point within the stack. Therefore the stack instructions are not a memory to memory operation. Ratch


I'm programming an emulator for the 68000 chips. That fact made my life a bit harder :), but my emu is executing those instructions correctly now.
Posted on 2005-01-26 16:42:44 by x86asm
msmith,

The Motorola 6800 has no such capability.


You are correct only the 68000 can do a mem to mem. Sorry for the mistake. Ratch
Posted on 2005-01-26 20:10:10 by Ratch
No problem.

BTW, I''ve been working on a customer's 6802 project (same instruction set as 6800). This processor was obsoleted over 20 years ago, which I'm sure you're aware. The single index register is a real bottleneck. At least the 8080 of that day had 2 address registers. Other than that complaint, I would rather write code for the Motorola stuff any day.

Unfortunately, the world has gone with the Intel stuff, so that's mostly what I work with.
Posted on 2005-01-26 20:39:16 by msmith