News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

registers as pointer q

Started by dc, September 08, 2023, 04:00:09 AM

Previous topic - Next topic

NoCforMe

Quote from: dc on September 12, 2023, 08:39:37 AMthat's not using allocated memory...
can allocated memory be used as an array?

Odd question: of course it can. Why would you think otherwise?

Another thing: why are you so all-fired focused on using xxxx ptr constructs, instead of just the ordinary MASM tools (use PTR only when you need to make an ambiguous reference like MOV [EDX], 0 explicit)?

Maybe tell us what you're trying to accomplish here?
Assembly language programming should be fun. That's why I do it.

dc

ive tried all the suggested ways and some seem to work but i test it and it ALWAYS uses the pointer like a label instead, so i have to put space after the labeled pointer like this:

pbrd            dd ?
tester          dd 500000 dup (?)

it fills up tester instead of the allocated memory

jj2007

Quote from: zedd151 on September 12, 2023, 12:09:11 AMHi dc, could you post some more code. Just a line or two isn't really telling us what it is, that you now are trying to do. With a more complete piece of code, we will be able to help you better. Full source preferred

Quote from: HSE on September 12, 2023, 12:58:05 AM
Quote from: dc on September 12, 2023, 12:50:29 AMi don't see why nobody understands my question

Where is your code?

Quote from: jj2007 on September 12, 2023, 01:06:29 AMdc, it's considered bad practice to post snippets, thus assuming that older members love spending their precious time adding headers, includes etc.

If you want help, zip all necessary files, especially the complete *.asm source, and attach it here. Otherwise all your questions will be happily ignored. Please confirm arrival of the message.

zedd151

Quote from: dc on September 12, 2023, 11:08:25 PMive tried all the suggested ways and some seem to work but i test it and it ALWAYS uses the pointer like a label instead, so i have to put space after the labeled pointer like this:

pbrd            dd ?
tester          dd 500000 dup (?)

it fills up tester instead of the allocated memory
dc please understand, without seeing more of your code, no one here knows exactly what you are trying to do.
Many members had asked for your code.

So please, post your code. The entire source code.

Vortex

Hi dc,

tester          dd 500000 dup (?)
Why not to use memory allocation functions? Probably, you notice that ml is slow while assembling this code portion.

dc

i did... global and heap... the pointer always works as a label instead...

zedd151

#36
Quote from: dc on September 13, 2023, 12:02:14 AMi did... global and heap... the pointer always works as a label instead...
dc, do everyone that is trying to help you a favor, and post your source code.
Please read: https://masm32.com/board/index.php?msg=123503

It is highly likely that you are doing something wrong in the code, some kind of error, and probably something simple to fix.

So please post your code so we can help you resolve this ,,,
We are waiting...

As a hint, do a forum search for "indirect addressing" this might be what you are looking for, and trying to achieve. Thinking about this, it might just be the case that you did not know the proper terminology to explain  what you want to achieve. Let us know here, please.

But still wondering why you won't post your code. Are you doing something that you are not supposed to be doing? Prove that theory wrong by posting or attaching your code.

Edit for further clarification and add the 'search' hint above.



NoCforMe

Yes, without seeing more of your code we really can't help you much here. (Not necessarily the whole project, but certainly the part where you're trying to use pbrd as a pointer.)

You're not the first person to be confused over the concepts of direct and indirect addressing; they're somewhat tricky ideas to wrap your head around, the difference between

MOV EDX, pbrd ;Get the CONTENTS of pbrd, a pointer
MOV EAX, [EDX] ;Get the CONTENTS of what it points to
MOV EAX, [EDX + array] ;Get the CONTENTS of what it points to in "array"
MOV EAX, [EDX + EBX + array] ;Get the CONTENTS of what it points to, indexed into "array"

and

LEA EAX, pbrd ;Get the ADDRESS of pbrd
INVOKE SomeFunction, EAX ;Pass the ADDRESS of pbrd to a function

(and these are only two examples out of many more), but you'll get it, I'm sure. (Hope these examples aren't confusing you.)
Assembly language programming should be fun. That's why I do it.

dc

im not seeing a way to upload my zip
my project is too big for this site

HSE

You can make a little test with just problematic code. You don't have to show complete code at all.
Equations in Assembly: SmplMath

zedd151

#40
Quote from: dc on September 13, 2023, 08:45:25 AMim not seeing a way to upload my zip
my project is too big for this site

How big is your zipped source code only? (In kilobytes) Without the executable!!! Less than 512 kilobytes, then attach the .zip file.

Otherwise try this:
Okay, do as HSE suggests and post the relevant portion of the code. Try posting that at least. More than one or two lines, that is not enough. At least a dozen lines before and a dozen lines after...

dc, everyone that is trying to help you are running out of patience. You are wasting our time if you cannot post more code so that we understand what your problems are, with the code that you have written.

Edit for clarity and typos

NoCforMe

Quote from: dc on September 13, 2023, 08:45:25 AMim not seeing a way to upload my zip
my project is too big for this site


Just copy and paste part of your code here directly so we can see what's going on inside there, 'k? (You can use the Code button (2nd in the last group on the top line) to put the code into a nice window.)
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: dc on September 13, 2023, 08:45:25 AMim not seeing a way to upload my zip
my project is too big for this site

Your project, zipped, exceeds 512kBytes, but you need help with basic addressing concepts? Come on, be serious...

@Zedd: I'd suggest to move this to the Soap Box, unless dc manages to zip his project.

zedd151

Quite possible that dc is trying to mix disassembled code into his project as in this thread: https://masm32.com/board/index.php?topic=11204.0 that might be adding to his confusion.

That thread is related to using GlobalAlloc.  :wink2: