flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
revolution
ARM have defined CPY in their mnemonics.
Z80 uses LD. AT&T uses MOV<size> But to actually answer your question you'd need to ask the original designers of the CPU opcodes. If they are still alive? |
|||
![]() |
|
sleepsleep
i guess mov is easier to type than cpy, and mov looks cleaner than cpy
![]() |
|||
![]() |
|
Furs
Actually, I agree. Or name should be "set" since in some architectures (x86) you can also use constants and such. "Copy" makes sense there but it's a bit less intuitive.
Code: set eax, ebx set eax, 5 |
|||
![]() |
|
Tomasz Grysztar
I personally like the LD and ST that some architectures use. It would in fact fit x86 too, as there are separate opcodes that could be called LD (MOV reg,mem) and ST (MOV mem,reg), but Intel chose to use a common mnemonic for multiple instructions, perhaps to make it easier to remember.
|
|||
![]() |
|
_shura
let instead of set. IMHO it sounds better
![]() But this is a question I also had for a long time. I guess, there is no reason. |
|||
![]() |
|
Furs
I have nightmares with "let" due to "math speak"...
|
|||
![]() |
|
_shura
let furs = not ( having nightmares )
![]() |
|||
![]() |
|
revolution
In x86 MOV is a very common opcode to see in the source code. So why not remove it completely? Just put the operands without an opcode.
Code: eax,ebx ;mov eax,ebx add eax,ebx ;add eax,ebx cx,5 ;mov cx,5 Code: eax,ebx ;blank opcode add eax,ebx ;explicit opcode cx,5 ;blank opcode |
|||
![]() |
|
Furs
Nah, but:
Code: eax = ebx cx = 5 ![]() |
|||
![]() |
|
_shura
well, you could define eax, ebx, ... as a macro and match the arguments like this:
Code: irp name, al, ah, ax, eax, \ cl, ch, cx, ecx, \ dl, dh, dx, edx, \ bl, bh, bx, ebx macro name arguments* match == operands, arguments mov name, operands else err `name, ': invalid operands' end match end macro end irp |
|||
![]() |
|
revolution
Don't forget about these also:
Code: mov rsi,[mem] mov [mem],rax mov byte[mem],0xff |
|||
![]() |
|
shoorick
![]() Code: eax ; mov eax,0 |
|||
![]() |
|
revolution
shoorick wrote:
Code: macro a { xor eax,eax } ;works for both 32-bit and 64-bit modes |
|||
![]() |
|
_shura
memory as source-operand should work with this code, for memory as destination-operand you can do this:
Code: irp name, byte, word, dword macro name arguments* match [ memory ] == operands, arguments mov name [ memory ], operands else err `name, ': invalid operands' end match end macro end irp but Code: [ eax ] = 1 is not possible afaik. why should Code: eax equal to Code: mov eax, 0 ? anyway, some extra bits: Code: irp name, byte, word, dword macro name arguments* match [ memory ] == operands, arguments mov name [ memory ], operands else match [ memory ] ++, arguments inc name [ memory ] else match [ memory ] --, arguments dec name [ memory ] else err `name, ': invalid operands' end match end macro end irp irp name, al, ah, ax, eax, \ cl, ch, cx, ecx, \ dl, dh, dx, edx, \ bl, bh, bx, ebx macro name arguments* match == operands, arguments mov name, operands else match ++, arguments inc name else match --, arguments dec name else err `name, ': invalid operands' end match end macro end irp |
|||
![]() |
|
revolution
_shura wrote: why should ![]() |
|||
![]() |
|
_shura
I mean, if I read a single line »eax« in my code, it is not obvious what this mean. I looks like a function call:
Code: call eax but not like Code:
xor eax, eax
and even a function call should look more like Code:
eax()
which can be done with: Code: struc (symbol) ? definition& match =(=), definition call symbol else match =( arguments =), definition callFunction eax, arguments else err `symbol, ': what do ya want from me?' end match end struc but you have to implement »callFunction« yourself. |
|||
![]() |
|
revolution
_shura wrote: and even a function call should look more like ![]() |
|||
![]() |
|
_shura
so eax = 1 should not allowed too
![]() |
|||
![]() |
|
Tomasz Grysztar
_shura wrote: but |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2019, Tomasz Grysztar.
Powered by rwasa.