strange ASM

Bare metal programming in PureBasic, for experienced users
callroot
User
User
Posts: 64
Joined: Sat Mar 05, 2016 10:46 pm

strange ASM

Post by callroot »

c0.s="456"

c1.s="789"

!mov [v_c1],[v_c0]


Debug c1
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: strange ASM

Post by Little John »

In the «Tricks 'n' Tips» subforum, callroot wrote:c0.s="456"

c1.s="789"

!mov [v_c1],[v_c0]


Debug c1
[u]infratec[/u] wrote:callroot should be renamed to spamroot ;-)
I agree.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: strange ASM

Post by Keya »

i didnt think you could "mov [mem], [mem]" in the one go (and this is a CPU thing not a PB thing) - you have to "mov reg, [mem]" then "mov [mem], reg". Please correct me if im wrong!
DontTalkToMe
Enthusiast
Enthusiast
Posts: 334
Joined: Mon Feb 04, 2013 5:28 pm

Re: strange ASM

Post by DontTalkToMe »

Keya wrote:i didnt think you could "mov [mem], [mem]" in the one go (and this is a CPU thing not a PB thing) - you have to "mov reg, [mem]" then "mov [mem], reg". Please correct me if im wrong!
You are not wrong.

Amazing tip btw :D
callroot
User
User
Posts: 64
Joined: Sat Mar 05, 2016 10:46 pm

Re: strange ASM

Post by callroot »

Keya wrote:i didnt think you could "mov [mem], [mem]" in the one go (and this is a CPU thing not a PB thing) - you have to "mov reg, [mem]" then "mov [mem], reg". Please correct me if im wrong!

Code: Select all


c0.s = " 456 "

c1.s = " 789 "

! mov eax,[v_c0]

! mov [v_c1],eax


debug c1

User avatar
Demivec
Addict
Addict
Posts: 4082
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: strange ASM

Post by Demivec »

callroot wrote:
Keya wrote:i didnt think you could "mov [mem], [mem]" in the one go (and this is a CPU thing not a PB thing) - you have to "mov reg, [mem]" then "mov [mem], reg". Please correct me if im wrong!

Code: Select all

c0.s = " 456 "

c1.s = " 789 "

! mov eax,[v_c0]

! mov [v_c1],eax


debug c1
Code works fine. What's so strange?
callroot
User
User
Posts: 64
Joined: Sat Mar 05, 2016 10:46 pm

Re: strange ASM

Post by callroot »

Demivec wrote:
callroot wrote:
Keya wrote:i didnt think you could "mov [mem], [mem]" in the one go (and this is a CPU thing not a PB thing) - you have to "mov reg, [mem]" then "mov [mem], reg". Please correct me if im wrong!

Code: Select all

c0.s = " 456 "

c1.s = " 789 "

! mov eax,[v_c0]

! mov [v_c1],eax


debug c1
Code works fine. What's so strange?
! mov [v_c1],[v_c0]


Can't write this way.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: strange ASM

Post by wilbert »

callroot wrote:! mov [v_c1],[v_c0]


Can't write this way.
That's right and you will never be able to write it this way because asm doesn't support this.
Windows (x64)
Raspberry Pi OS (Arm64)
DontTalkToMe
Enthusiast
Enthusiast
Posts: 334
Joined: Mon Feb 04, 2013 5:28 pm

Re: strange ASM

Post by DontTalkToMe »

There are tables with the possible operands sizes and types you can use with each instruction.

http://x86.renejeschke.de/html/file_mod ... d_176.html

Look there and you'll see you can't move from memory to memory.
User avatar
Rings
Moderator
Moderator
Posts: 1427
Joined: Sat Apr 26, 2003 1:11 am

Re: strange ASM

Post by Rings »

topic moved...
SPAMINATOR NR.1
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: strange ASM

Post by Keya »

User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: strange ASM

Post by Psychophanta »

http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Post Reply