4 Replies - 418 Views - Last Post: 20 September 2017 - 07:30 AM

#1 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

What does mov means ?

Posted 18 September 2017 - 09:48 AM

Why does this code use mov only ?

section	.text
   global _start	 ;must be declared for linker (gcc)
	
_start:	         ;tell linker entry point
   mov	edx,len  ;message length
   mov	ecx,msg  ;message to write
   mov	ebx,1    ;file descriptor (stdout)
   mov	eax,4    ;system call number (sys_write)
   int	0x80     ;call kernel
	
   mov	edx,9    ;message length
   mov	ecx,s2   ;message to write
   mov	ebx,1    ;file descriptor (stdout)
   mov	eax,4    ;system call number (sys_write)
   int	0x80     ;call kernel
	
   mov	eax,1    ;system call number (sys_exit)
   int	0x80     ;call kernel
	
section	.data
msg db 'Displaying 9 stars',0xa ;a message
len equ $ - msg  ;length of message
s2 times 9 db '*'


Is This A Good Question/Topic? 0
  • +

Replies To: What does mov means ?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,847
  • Joined: 12-June 08

Re: What does mov means ?

Posted 18 September 2017 - 10:03 AM

It doesn't just use MOV.

What would you think would go there? What else would move data between a register and memory?
Was This Post Helpful? 0
  • +
  • -

#3 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

Re: What does mov means ?

Posted 18 September 2017 - 10:18 AM

I made a rough picture for my studying purposes . I have loads of questions to ask . Not sure where to start .

Is this how a stack looks like ? does a stack has registers in it ?

The data moves between

EAX
EBX
ECX
EDX

?

What is last in first out .?Is it like first in EDX register , last out in EAX register ?





Posted Image

This post has been edited by sunshine33: 18 September 2017 - 10:24 AM

Was This Post Helpful? 0
  • +
  • -

#4 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

Re: What does mov means ?

Posted 18 September 2017 - 11:15 AM

Posted Image

Just an update , is this how the whole thing works ?
Was This Post Helpful? 0
  • +
  • -

#5 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

Re: What does mov means ?

Posted 20 September 2017 - 07:30 AM

Can somebody please delete those two pictures ?

I cannot find my edit button .

This post has been edited by sunshine33: 20 September 2017 - 07:30 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1