News:

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

Main Menu

Echo value of offset

Started by Rockphorr, June 09, 2024, 04:51:25 AM

Previous topic - Next topic

NoCforMe

He's trying show offsets into a structure for its members (hence the echo). That's all.
Assembly language programming should be fun. That's why I do it.

zedd151

Quote from: NoCforMe on June 09, 2024, 10:49:28 AMHe's trying show offsets into a structure for its members (hence the echo). That's all.
It just seemed weird to me. So, I had to ask.
Ventanas diez es el mejor.  :azn:

NoCforMe

Well, it might have been kinda a dumb question.
But the say the really dumb question is the one you don't ask.
Assembly language programming should be fun. That's why I do it.

Rockphorr

Quote from: NoCforMe on June 09, 2024, 09:05:35 AMYes, exactly.
I didn't mean to bring this up to further muddy the waters.
So did you get everything to work OK?



Quote from: sudoku on June 09, 2024, 10:29:57 AM
Quote from: NoCforMe on June 09, 2024, 09:05:35 AMSo did you get everything to work OK?
Maybe I am a little slow, but I don't understand what this piece of code is actually supposed to do...  :undecided:
As is, it seems not very useful as a program since the object file has no code. Am I missing some key point to this?

Maybe it would be more useful to show an example of how/where it would be used.


All your questions are fine. I think that most of masm directive should generate more information.
For example, proc should generate proto to output inc_file.
I make this macro to avoid sharing  full structure in module, instead i use this macro to create const definition.

value.asm
;=======[ STRUCTURE ]===============
Some\
STRUC
...
Some_Method\
DWORD ?
Some\
ENDS


;======[ MACRO ]====================
@Value MACRO name:req, expression:req
 .RADIX 10h
 %ECHO @CatStr (<name>,< = >,%expression,<h>)
 .RADIX 0Ah
  ENDM

.386
.MODEL FLAT

.code


@Value @V_ofs,Some.Some_Method

end


ml value.asm >log.txt

Copy from log.txt to some.inc following line and use it in another module.

some.inc

@V_ofs = 4h



NoCforMe

Not every assembly-language program need generate any code at all.

Here's a tool I wrote to tell me which constants were not defined in our own windows.inc:
;====================================================
;NotInWindowsInc.asm
;
; Tool to go through a list of symbolic constants and output
; those which are NOT defined in MASM32's windows.inc.
;====================================================
.nolist
include \masm32\include\masm32rt.inc
.list

$ce macro arg1, arg2
ifndef &arg1
% echo &arg1 EQU &arg2
endif
endm

echo Constants NOT defined in MASM32 include files:

$ce IMAGE_FILE_MACHINE_UNKNOWN, 0
$ce IMAGE_FILE_MACHINE_AM33, 1d3H
$ce IMAGE_FILE_MACHINE_AMD64, 8664H
$ce IMAGE_FILE_MACHINE_ARM, 1c0H
$ce IMAGE_FILE_MACHINE_ARMNT, 1c4H
$ce IMAGE_FILE_MACHINE_EBC, 0ebcH
$ce IMAGE_FILE_MACHINE_I386, 14cH

; . . . many more entries here . . .

END

which simply echoes all those undefined constants so I can put them in a file, NotInWindowsInc.inc.
Assembly language programming should be fun. That's why I do it.

zedd151

#20
Thanks for the clarification for the 'uninitiated'.
My idea of echo was only

"value of offset  value of offset  value of offset  value of offset  value of offset"
aside from using 'echo' on the command line.  :smiley:
So basically its a macro 'thing'?
Would have been more apparent (what it does), if used in an example for 'macro noobz' like me.  :tongue:
Ventanas diez es el mejor.  :azn:

NoCforMe

Quote from: sudoku on June 10, 2024, 04:27:09 AMMy idea of echo was only
"value of offset  value of offset  value of offset  value of offset  value of offset"
Bada-BOOMP! (bada-boomp)  [bada-boomp) ...
Assembly language programming should be fun. That's why I do it.

Rockphorr

Quote from: HSE on June 09, 2024, 07:43:26 AM:biggrin: it's a lot more simple that your idea:
;=======[ STRUCTURE ]===============
Some\
STRUC
Some_Data_0\
BYTE ?
Some_Data_1\
BYTE ?
Some_Data_2\
WORD ?
Some_Method\
DWORD ?
Some\
ENDS


;======[ MACRO ]====================
@Value MACRO name:req, expression:req
 .RADIX 10h
 %ECHO @CatStr (<name>,< = >,%expression,<h>)
 .RADIX 0Ah
  ENDM

.386
.MODEL FLAT

.code

@Value @V_size,Size(Some)
@Value @V_ofs,Some.Some_Method

end

Can I ask you what compiller do you use ?

Rockphorr

Quote from: jj2007 on June 09, 2024, 08:37:28 AM
Quote from: Rockphorr on June 09, 2024, 07:36:56 AMI use ml of masm32 from masm32.com instead your UAsm64

UAsm is a Masm32 clone, 100% compatible. And at least a factor 3 faster.


Can you post the link to it ?

NoCforMe

Quote from: Rockphorr on June 11, 2024, 03:09:01 AMCan I ask you what compiller do you use ?
Assembler, not compiler. (Does a similar job but let's not confuse ourselves with wrong terms here.)
Assembly language programming should be fun. That's why I do it.

Rockphorr

Quote from: NoCforMe on June 11, 2024, 03:18:24 AM
Quote from: Rockphorr on June 11, 2024, 03:09:01 AMCan I ask you what compiller do you use ?
Assembler, not compiler. (Does a similar job but let's not confuse ourselves with wrong terms here.)


Ok, let's talk about what assembler.

NoCforMe

So are you having problems with ml?
Assembly language programming should be fun. That's why I do it.

Rockphorr

Quote from: NoCforMe on June 11, 2024, 03:34:20 AMSo are you having problems with ml?

Problems come when using on bounds... Now my problem is solved. I want to try another assembler and compare.

NoCforMe

Quote from: Rockphorr on June 11, 2024, 03:43:01 AMProblems come when using on bounds...
Bounds? as in array bound checking?
Just curious.
Assembly language programming should be fun. That's why I do it.

Rockphorr

Quote from: NoCforMe on June 12, 2024, 06:10:10 AM
Quote from: Rockphorr on June 11, 2024, 03:43:01 AMProblems come when using on bounds...
Bounds? as in array bound checking?
Just curious.


As bounds of assembler abilities. A default solution is the immediate value, but i need to get that from the expression of offsets.