newb and nasm

Thread Solved

Join Date: Oct 2006
Posts: 1
Reputation: ahcfan is an unknown quantity at this point 
Solved Threads: 0
ahcfan ahcfan is offline Offline
Newbie Poster

newb and nasm

 
0
  #1
Oct 25th, 2006
Hi, i'm currently learning assembly with the nasm assembler and i'm stuck trying to get a memory address into a register. Here is what I have:

  1. [bits 32]
  2. [org 100h]
  3.  
  4. section .data
  5. msg db "Hello", 0
  6.  
  7. section .text
  8. mov si, [msg]
  9. ;lea si, [msg]
  10.  
  11. ret
I read the nasm manual and it appear that both instructions should work but they don't. With lea si stays at 0, with mov si gets the wrong address What exactly am I doing wrong here??
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1
Reputation: dynarski is an unknown quantity at this point 
Solved Threads: 1
dynarski dynarski is offline Offline
Newbie Poster

Re: newb and nasm

 
0
  #2
Dec 6th, 2006
Originally Posted by ahcfan View Post
Hi, i'm currently learning assembly with the nasm assembler and i'm stuck trying to get a memory address into a register. Here is what I have:

  1. [bits 32]
  2. [org 100h]
  3.  
  4. section .data
  5. msg db "Hello", 0
  6.  
  7. section .text
  8. mov si, [msg]
  9. ;lea si, [msg]
  10.  
  11. ret
I read the nasm manual and it appear that both instructions should work but they don't. With lea si stays at 0, with mov si gets the wrong address What exactly am I doing wrong here??
use mov si,msg
to get address of msg into si.
[msg] refers to the content of msg not its address.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 23
Reputation: Day Brown is an unknown quantity at this point 
Solved Threads: 0
Day Brown Day Brown is offline Offline
Newbie Poster

Re: newb and nasm

 
0
  #3
Dec 7th, 2006
the indirect address '[msg] and not the content of the array called 'msg' should be what goes into si. What's there instead? Whatcha doing this for?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC