News:

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

Main Menu

How to redefine an area having only the pointer to the area?

Started by frktons, January 11, 2013, 02:20:15 AM

Previous topic - Next topic

dedndave

if it's my own structure, i find a different way to do it - lol
if it's defined by MS, i have to work with it   :P

frktons

Quote from: dedndave on January 11, 2013, 05:06:52 AM
if it's my own structure, i find a different way to do it - lol
if it's defined by MS, i have to work with it   :P

In this case you have to. :t

One more question about data and PROC

If I have 3 equates on main prog, and I call an external PROC
in a LIB, that uses these equates, how should I define them
in order to make them visible and usable by both main and proc?

One  EQU 1
Maxrow EQU 32
MaxCol EQU 128
....
CALL AnyProc



AnyProc PROC

?????

mov eax, Zero
mov ebx, MaxRow
mov ecx, MaxCol
.....

There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

dedndave

equates don't have "visibility" like data, per se
you can define the same equates in the program source, and in the source for the module
it's nice if they are the same value   :P

another way to go is to put the common equates in an INC file
then, include that INC file in both sources

remember, at assembly time, equates are resolved as simple numeric constants
you might have a hard time with referencing a symbol like this from 2 different files
END_DATA EQU $

MichaelW

Quote from: frktons on January 11, 2013, 04:13:46 AM
Something a little bit obscure is the mixed use of STRUCT and
defined data that MichaelW does in its last example:
    printf("|%s|\n\n", ADDR Area_)
Considering you have never addressed Area_ in your code
and it is initialized to spaces, what did you expect the prog
should display with the previous line of code?

It displays the initialized structure as an ANSI string, which I thought was what you were after. I added the vertical bar characters before and after the string so you could see where it started and ended.
Well Microsoft, here's another nice mess you've gotten us into.

frktons

Thanks Dave and Michael.
I think I can go on until next doubt.  :P
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama