Pelles C forum

Assembly language => Assembly discussions => Topic started by: HellOfMice on December 31, 2024, 06:44:20 PM

Title: $
Post by: HellOfMice on December 31, 2024, 06:44:20 PM
Hi,


With PoAsm is it possible to do something like this:


NumberOfLines = $ - OFFSET AdrLastLine


I get :


QuoteDatas.asm(854): error: Must be a constant integer expression.
Title: Re: $
Post by: Vortex on December 31, 2024, 11:03:29 PM
Hi Philippe,

Reading the examples section of the subtitle EQU directive (IA32, AMD64) :

Quotestrlen1 EQU ($ - str)  ; will not work as in MASM; the tokens (, $, -, str, ) are assigned to strlen1, but no "current location" is associated with $ at this point !

The subtitle Assembler here token: $ (IA32, AMD64) :

QuoteThe special here token ($) holds the current location in the active code or data section.

Note! The here token should only be used in instructions or data directives. It will not work as expected if used in the EQU directive - only the token will be stored, not the current location.
Title: Re: $
Post by: HellOfMice on January 01, 2025, 02:11:49 AM

Hi Vortex,


With MASM32 I did "jmp $ + 4" or substract 2 address when I hat a tab of pointer to know the number of lines


Thank you for you help and I wish you an happy new year


Philippe
Title: Re: $
Post by: Vortex on January 01, 2025, 07:21:20 PM
Hi Philippe,

You are welcome. Me too, I wish you a happy new year.