home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,009 of 4,675   
   Frank Kotler to 2018peb5224@nospicedham.mnit.ac.in   
   Re: register pointer to memory   
   16 Jan 20 18:47:32   
   
   From: fbkotler@nospicedham.myfairpoint.net   
      
   On 01/16/2020 03:01 AM, 2018peb5224@nospicedham.mnit.ac.in wrote:   
   >   
   >>> i don't think memory access is the issue   
   >>> if i try to access memory data like this   
   >>> ________________________________   
   >>> lea si , [000000H]   
   >>> lea di ,[test1]   
   >>> movsb   
   >>> movsb   
   >>> push test1   
   >>   
   >> This is the address of "test1". I doubt if that's what you want to print...   
   >>   
   > yso you are saying if i will push the variable test1 into the stack and then   
   call the printf function it will print the address instead of the value?   
      
   Right.   
      
   >>> call _printf   
   >>> ____________________________   
   >>> section .data   
   >>> test1: dd 00h   
   >>>   
   >>> then i am getting output of 2 bytes.   
   >>> but if i try to move the address to the register and then try to print it,   
   its not printing anything, no error nothing just blank.section .data   
      
   Strange.   
   ____________________________________   
   >>> mov ecx,000000h   
   >>> mov eax, [ecx]   
   >>> push eax   
   >>> push .fmt   
   >>> call _printf   
   >>> ret	   
   >>> 	   
   >>> ____________________________________   
   >>> i just wanna know what is there that i am doing wrong.   
   >>>   
   >>> In the end i just want to get the data from a particular memory location   
   using registers not using section data. is there any way?   
   >>>   
   >>   
   >> What platform? Put another way, what command line are you giving Nasm?   
   >> Is this 16 bit code or 32 bit?   
   >>   
   >> Best,   
   >> Frank   
   >   
   > its windows 10   
   > and this is the command that i am using   
   > nasm -f win32 int.asm   
      
   Okay. I haven't done Windows for a long time. Perhaps I should let   
   someone else help you. I would "expect" some of the things you're doing   
   to raise an exception. If it doesn't, it doesn't.   
      
   What you're doing...   
   mov ebx, 0   
   add ebx, ???   
   mov eax, [ebx]   
    etc.   
   "should work" if there's memory at that address. Try 0x400000. As I   
   recall, that should be the start of the executable header. I may   
   remember that wrong... You should be pretty close to making it work.   
      
   Best,   
   Frank   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca