Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

All language designers are arrogant. Goes with the territory... -- Larry Wall


programming / comp.lang.asm.x86 / Re: register pointer to memory

SubjectAuthor
* register pointer to memory2018peb5224
+* Re: register pointer to memoryJJ
|`- Re: register pointer to memory2018peb5224
`* Re: register pointer to memoryFrank Kotler
 `* Re: register pointer to memory2018peb5224
  `* Re: register pointer to memoryFrank Kotler
   +- Re: register pointer to memory2018peb5224
   +- Re: register pointer to memory2018peb5224
   `* Re: register pointer to memory2018peb5224
    `- Re: register pointer to memoryFrank Kotler

1
Subject: register pointer to memory
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Tue, 14 Jan 2020 08:47 UTC
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Subject: register pointer to memory
Date: Tue, 14 Jan 2020 00:47:38 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 19
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Tue, 14 Jan 2020 08:47:38 +0000
Injection-Info: reader02.eternal-september.org; posting-host="b4fc9b7573dfb979dcf3c21b25d39b12";
logging-data="12967"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SrP6oj/cFuZnjbdY6U/bvy2G7j+gAowY="
User-Agent: G2/1.0
Cancel-Lock: sha1:R6+evu0fv5vWU2lY7OM0/gpH8Hs=
View all headers
Hi,i am new in assembly coding. i want to do some memory address manipulation for my project
what i want is to save a memory address in a Register then done some manipulation on that address like changing the address and so on, then get the data from the newly updated address.
So far i am not able to do it.
i am using nasm.



mov ebx,000000h
add ebx,000230h
mov eax,[ebx]
push eax
push .fmt
call _printf
ret

..fmt  db '%d',0x0d,0x0a,0

Thanks



Subject: Re: register pointer to memory
From: JJ
Newsgroups: comp.lang.asm.x86
Organization: albasani.net
Date: Wed, 15 Jan 2020 13:18 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jj4pub...@nospicedham.vfemail.net (JJ)
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Wed, 15 Jan 2020 20:18:44 +0700
Organization: albasani.net
Lines: 22
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <7phx5r2jgnke.11lp91661gjr5$.dlg@40tude.net>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="75f016aa57973dd2963b3287273a5c1a";
logging-data="4324"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/utyz1C++cPkMo72Hml3TFbexobbdaq+s="
User-Agent: 40tude_Dialog/2.0.15.84
Cancel-Lock: sha1:IZslJXO/J3OMPQ6Jk0SXzQLTzmw=
View all headers
On Tue, 14 Jan 2020 00:47:38 -0800 (PST), 2018peb5224@nospicedham.mnit.ac.in
wrote:
Hi,i am new in assembly coding. i want to do some memory address manipulation for my project
what i want is to save a memory address in a Register then done some manipulation on that address like changing the address and so on, then get the data from the newly updated address.
So far i am not able to do it.
i am using nasm.

mov ebx,000000h
add ebx,000230h
mov eax,[ebx]
push eax
push .fmt
call _printf
ret

..fmt  db '%d',0x0d,0x0a,0

Thanks

Your problem is not an assembly issue. But a problem understanding what kind
of value is expected by a function's argument.



Subject: Re: register pointer to memory
From: Frank Kotler
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Wed, 15 Jan 2020 21:32 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: fbkot...@nospicedham.myfairpoint.net (Frank Kotler)
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Wed, 15 Jan 2020 16:32:56 -0500
Organization: Aioe.org NNTP Server
Lines: 31
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qvo0li$13sj$1@gioia.aioe.org>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="75f016aa57973dd2963b3287273a5c1a";
logging-data="10960"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198+OrhVpcGVmY4Hr5B/b2f9OTD5OF5k1A="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2
Cancel-Lock: sha1:mrP9mzXSfbvErxWK6tamSQK2wwI=
View all headers
On 01/14/2020 03:47 AM, 2018peb5224@nospicedham.mnit.ac.in wrote:
Hi,i am new in assembly coding. i want to do some memory address manipulation for my project
what i want is to save a memory address in a Register then done some manipulation on that address like changing the address and so on, then get the data from the newly updated address.
So far i am not able to do it.
i am using nasm.



mov ebx,000000h
add ebx,000230h
mov eax,[ebx]
push eax
push .fmt
call _printf
ret

.fmt  db '%d',0x0d,0x0a,0

Thanks


What platform? (Nasm will do a lot of things) Looks like Windows? What happens? Exception? I don't think you have access to (virtual) memory at that address. Try something in "section .data"...

{Sorry for the delay  in your first post. This is a moderated NG and the internet was down at my place. Should go faster from here on...)

Best,
Frank



Subject: Re: register pointer to memory
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 16 Jan 2020 05:43 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Wed, 15 Jan 2020 21:43:32 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 61
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <e996913f-f819-423e-9b09-5b04e9cecf77@googlegroups.com>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com> <qvo0li$13sj$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Thu, 16 Jan 2020 05:43:33 +0000
Injection-Info: reader02.eternal-september.org; posting-host="d6b768bf782f3503ffa85efc57807b2d";
logging-data="12531"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JpqL2Ogr3+gw9rzARS+4B4gkaip5yRQo="
User-Agent: G2/1.0
Cancel-Lock: sha1:iiXB+X2r0C9jW8dgN5vjts7QBAY=
View all headers
On Thursday, January 16, 2020 at 3:10:13 AM UTC+5:30, Frank Kotler wrote:
On 01/14/2020 03:47 AM, 2018peb5224@nospicedham.mnit.ac.in wrote:
Hi,i am new in assembly coding. i want to do some memory address manipulation for my project
what i want is to save a memory address in a Register then done some manipulation on that address like changing the address and so on, then get the data from the newly updated address.
So far i am not able to do it.
i am using nasm.



mov ebx,000000h
add ebx,000230h
mov eax,[ebx]
push eax
push .fmt
call _printf
ret

.fmt  db '%d',0x0d,0x0a,0

Thanks


What platform? (Nasm will do a lot of things) Looks like Windows? What
happens? Exception? I don't think you have access to (virtual) memory at
that address. Try something in "section .data"...

{Sorry for the delay  in your first post. This is a moderated NG and the
internet was down at my place. Should go faster from here on...)

Best,
Frank

hi, thanks for the reply,
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
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
____________________________________
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?



Subject: Re: register pointer to memory
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 16 Jan 2020 05:45 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Wed, 15 Jan 2020 21:45:52 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 53
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <d21b3bda-f87c-4a1b-ad3d-d41b8ff2a2bc@googlegroups.com>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com> <7phx5r2jgnke.11lp91661gjr5$.dlg@40tude.net>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Thu, 16 Jan 2020 05:45:52 +0000
Injection-Info: reader02.eternal-september.org; posting-host="d6b768bf782f3503ffa85efc57807b2d";
logging-data="12628"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QmfzgOCsB0Qb3CJ9O1S+gBZcsR2uUIzQ="
User-Agent: G2/1.0
Cancel-Lock: sha1:/5s55f6K+NJg8DiERr4rTvHWunc=
View all headers
On Thursday, January 16, 2020 at 2:51:38 AM UTC+5:30, JJ wrote:
On Tue, 14 Jan 2020 00:47:38 -0800 (PST), 2018peb5224@nospicedham.mnit.ac.in
wrote:
Hi,i am new in assembly coding. i want to do some memory address manipulation for my project
what i want is to save a memory address in a Register then done some manipulation on that address like changing the address and so on, then get the data from the newly updated address.
So far i am not able to do it.
i am using nasm.

mov ebx,000000h
add ebx,000230h
mov eax,[ebx]
push eax
push .fmt
call _printf
ret

..fmt  db '%d',0x0d,0x0a,0

Thanks

Your problem is not an assembly issue. But a problem understanding what kind
of value is expected by a function's argument.

can you help me with that?

i can get the data from a particular memory location using section data, but i want to use registers, cause i want to change the address dynamically which i can'y do with section data

________________________________
lea si , [000000H]
lea di ,[test1]
movsb
movsb
push test1
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
____________________________________
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?



Subject: Re: register pointer to memory
From: Frank Kotler
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Thu, 16 Jan 2020 06:26 UTC
References: 1 2 3
Path: i2pn2.org!rocksolid2!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: fbkot...@nospicedham.myfairpoint.net (Frank Kotler)
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Thu, 16 Jan 2020 01:26:29 -0500
Organization: Aioe.org NNTP Server
Lines: 41
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qvovu2$1bc6$1@gioia.aioe.org>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com>
<qvo0li$13sj$1@gioia.aioe.org>
<e996913f-f819-423e-9b09-5b04e9cecf77@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="d6b768bf782f3503ffa85efc57807b2d";
logging-data="23843"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wle0YCCBPFaWzbJW+6vpVA2EwITOzCJo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2
Cancel-Lock: sha1:RE/2JPCv3FTlKIHRvP+vrkQk1as=
View all headers
On 01/16/2020 12:43 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...

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
____________________________________
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



Subject: Re: register pointer to memory
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 16 Jan 2020 07:47 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Wed, 15 Jan 2020 23:47:59 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 46
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <a0219fcd-baf5-407a-b3ab-7b704a9ae1d9@googlegroups.com>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com>
<qvo0li$13sj$1@gioia.aioe.org> <e996913f-f819-423e-9b09-5b04e9cecf77@googlegroups.com>
<qvovu2$1bc6$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Thu, 16 Jan 2020 07:48:00 +0000
Injection-Info: reader02.eternal-september.org; posting-host="d6b768bf782f3503ffa85efc57807b2d";
logging-data="16019"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Qf+HsBMcpo/9G2V4a8yeLze8ZpXFIJPE="
User-Agent: G2/1.0
Cancel-Lock: sha1:GQl2w2ZAMZ+nuTWfgCDpKUxkHCU=
View all headers
On Thursday, January 16, 2020 at 12:01:26 PM UTC+5:30, Frank Kotler wrote:
On 01/16/2020 12:43 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...

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
____________________________________
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

i am using windows,
nasm -f win32 int.asm
this is the command that i am using to create a object file



Subject: Re: register pointer to memory
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 16 Jan 2020 07:51 UTC
References: 1 2 3 4
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Wed, 15 Jan 2020 23:51:53 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 49
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <3b4937c5-443f-4ab2-8000-97cfc3540b23@googlegroups.com>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com>
<qvo0li$13sj$1@gioia.aioe.org> <e996913f-f819-423e-9b09-5b04e9cecf77@googlegroups.com>
<qvovu2$1bc6$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Thu, 16 Jan 2020 07:51:54 +0000
Injection-Info: reader02.eternal-september.org; posting-host="d6b768bf782f3503ffa85efc57807b2d";
logging-data="16046"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+V7QQ1l8wCWgwWh1e54vSGDnmiwAVgzGE="
User-Agent: G2/1.0
Cancel-Lock: sha1:T+1naHnJE7fmh26SqdaVrP3oExw=
View all headers
On Thursday, January 16, 2020 at 12:01:26 PM UTC+5:30, Frank Kotler wrote:
On 01/16/2020 12:43 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....

call _printf
so you are saying if i will push test1 in the stack and then call the printf function it willprint the address of the test1 not the data in the test1 ? if this is what you are saying than i have another example where i am using the same call but it is printing the data which is stored in test1
____________________________
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
____________________________________
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



Subject: Re: register pointer to memory
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 16 Jan 2020 08:01 UTC
References: 1 2 3 4
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 2018peb5...@nospicedham.mnit.ac.in
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Thu, 16 Jan 2020 00:01:09 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 44
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <625daa23-8ab4-4760-9c66-416341cabd30@googlegroups.com>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com>
<qvo0li$13sj$1@gioia.aioe.org> <e996913f-f819-423e-9b09-5b04e9cecf77@googlegroups.com>
<qvovu2$1bc6$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Thu, 16 Jan 2020 08:01:10 +0000
Injection-Info: reader02.eternal-september.org; posting-host="d6b768bf782f3503ffa85efc57807b2d";
logging-data="16067"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kklr4JGQf0t6AtQrhdZbmPGPIVYwF9Sw="
User-Agent: G2/1.0
Cancel-Lock: sha1:qxxQnyxN8cTD+1hjkmMPnL6Dhnc=
View all headers

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?
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
____________________________________
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



Subject: Re: register pointer to memory
From: Frank Kotler
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Thu, 16 Jan 2020 23:47 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: fbkot...@nospicedham.myfairpoint.net (Frank Kotler)
Newsgroups: comp.lang.asm.x86
Subject: Re: register pointer to memory
Date: Thu, 16 Jan 2020 18:47:32 -0500
Organization: Aioe.org NNTP Server
Lines: 66
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qvqstq$ads$1@gioia.aioe.org>
References: <34c3d79a-1604-4007-adaa-b393b37a07d5@googlegroups.com>
<qvo0li$13sj$1@gioia.aioe.org>
<e996913f-f819-423e-9b09-5b04e9cecf77@googlegroups.com>
<qvovu2$1bc6$1@gioia.aioe.org>
<625daa23-8ab4-4760-9c66-416341cabd30@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="fbc76ef2108a4f550726bb79ce9ac322";
logging-data="9985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+xK3vSqu036rbkJtA9bzx0lWE/pEtUBWs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2
Cancel-Lock: sha1:TDbWUrTZRYn2qVpK+2siaqH12iA=
View all headers
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



1

rocksolid light 0.8.3
clearneti2ptor