flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Eqtype in preprocessor

Author
Thread Post new topic Reply to topic
thetrick



Joined: 19 Feb 2020
Posts: 18
thetrick 14 Jan 2024, 12:53
Hello.

I have such MATCH to process some binary instructions:

Code:
match opcode arg1 =, arg2, instructions    


Can preprocessor check if the arg2 is a numerical expression? I need to check it in the preprocessor stage. Now i have such construction:

Code:
if arg2 eqtype 1    


but it's done in the assembling stage and some labels inside this construction are invalid when arg2 isn't numerical.

I tried to use rept 1:... but it produces the error when the arg2 isn't numerical.

Thanks.
Post 14 Jan 2024, 12:53
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20060
Location: In your JS exploiting you and your system
revolution 14 Jan 2024, 16:27
There are no preprocessor actions that can examine the individual characters of a symbol.

Maybe if irpc existed it could be possible:
Code:
irpc char, symbol { ; loop through each character of a symbol. But irpc doesn't exist Sad
    match ... ; something here to look for '0' through '9' maybe?
}    
Post 14 Jan 2024, 16:27
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1701
Roman 16 Jan 2024, 09:05
What eqtype for symbols /+-* ?
Or only match for this symbols ?
Post 16 Jan 2024, 09:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20060
Location: In your JS exploiting you and your system
revolution 16 Jan 2024, 13:24
We can test it to see what happens.
Code:
test.asm [1]:
if + eqtype +
processed: if+eqtype+
error: reserved word used as symbol.    
Post 16 Jan 2024, 13:24
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 785
Location: Russian Federation, Sochi
ProMiNick 16 Jan 2024, 14:47
eqtypes: {+},{/},{*},{\-},{any started with nonnegate member parentless expression}
backslash within if had a weird effect
Code:
if {\-\-\-} eqtype {\[\eax\]}
 display 'no matter what prepended by \'
end if 
if {\-\-\-} eqtype {\eax \+ \1}
 display 'it is always compared only by count'
end if     
Code:
if {+} eqtype {+} ; curvy brackets ecranise from reserved word error    

{-} not eqtype anything except {-} itself
eqtypes: <+>,</>,<*>,<->,<any started with nonnegate member parentless
eqtypes: <->,<-->,<--->
expression>
Code:
if <+> eqtype <+> ; less-greater brackets ecranise from reserved word error too    

have a nice to play brackets and combinations:
Code:
if {eax-1} eqtype {eax+1}
 display 'never'
end if
if <eax-1> eqtype <eax+1>
 display 'always'
end if    

in some cases "if" could do things that thou thought previously it can`t. but still don`t affect on preprocessor stage.
Post 16 Jan 2024, 14:47
View user's profile Send private message Send e-mail Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1701
Roman 16 Jan 2024, 17:47
We need eqsymbol !
Post 16 Jan 2024, 17:47
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 658
Location: Ukraine
Overclick 16 Jan 2024, 19:08
Actually you can read the file as binary and work with opcodes then proceed in own way. You can see such example in my Xeon patcher.


Description:
Download
Filename: FlyTurboBoostPatcher_v6.rar
Filesize: 294.23 KB
Downloaded: 31 Time(s)

Post 16 Jan 2024, 19:08
View user's profile Send private message Visit poster's website Reply with quote
thetrick



Joined: 19 Feb 2020
Posts: 18
thetrick 01 Feb 2024, 10:19
Thank you guys!
Post 01 Feb 2024, 10:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.