It is currently Thu Oct 17, 2019 1:52 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: strange ASM
PostPosted: Mon May 30, 2016 4:25 pm 
Offline
User
User

Joined: Sat Mar 05, 2016 10:46 pm
Posts: 64
c0.s="456"

c1.s="789"

!mov [v_c1],[v_c0]


Debug c1


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Mon May 30, 2016 5:35 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3677
Location: Berlin, Germany
In the «Tricks 'n' Tips» subforum, callroot wrote:
c0.s="456"

c1.s="789"

!mov [v_c1],[v_c0]


Debug c1

infratec wrote:
callroot should be renamed to spamroot ;-)

I agree.

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Mon May 30, 2016 5:43 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 04, 2015 7:10 am
Posts: 1673
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!

_________________
Thankyou to all the coders who generously helped & encouraged me in the nearly 2yrs when i was welcome here,
it was a tremendous privilege. I learned a lot. I wish you and your families all the best and success for the future.


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Mon May 30, 2016 5:59 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 04, 2013 5:28 pm
Posts: 332
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


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Tue May 31, 2016 4:56 am 
Offline
User
User

Joined: Sat Mar 05, 2016 10:46 pm
Posts: 64
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:

c0.s = " 456 "

c1.s = " 789 "

! mov eax,[v_c0]

! mov [v_c1],eax


debug c1



Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Tue May 31, 2016 5:35 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 3585
Location: Utah, USA
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:
c0.s = " 456 "

c1.s = " 789 "

! mov eax,[v_c0]

! mov [v_c1],eax


debug c1

Code works fine. What's so strange?

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Tue May 31, 2016 5:49 am 
Offline
User
User

Joined: Sat Mar 05, 2016 10:46 pm
Posts: 64
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:
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Tue May 31, 2016 6:10 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3479
Location: Netherlands
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.

_________________
macOS 10.15 Catalina, PB 5.71 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Tue May 31, 2016 12:50 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 04, 2013 5:28 pm
Posts: 332
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Tue May 31, 2016 1:01 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Apr 26, 2003 1:11 am
Posts: 1389
topic moved...

_________________
SPAMINATOR NR.1


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Tue May 31, 2016 4:05 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 04, 2015 7:10 am
Posts: 1673
here is some more info http://stackoverflow.com/questions/11953352/why-ia32-does-not-allow-memory-to-memory-mov

_________________
Thankyou to all the coders who generously helped & encouraged me in the nearly 2yrs when i was welcome here,
it was a tremendous privilege. I learned a lot. I wish you and your families all the best and success for the future.


Top
 Profile  
Reply with quote  
 Post subject: Re: strange ASM
PostPosted: Sun Jan 21, 2018 10:50 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Jun 11, 2003 9:33 pm
Posts: 4578
Location: Spa, relaxing and thinking, and learning...
Dear callroot:
R.t.f.m.
https://flatassembler.net/docs.php?article=manual

_________________
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye