flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > signed

Author
Thread Post new topic Reply to topic
asmgges



Joined: 17 Jun 2003
Posts: 86
Location: France
asmgges 14 Dec 2005, 14:20
Hi ! Very Happy

Possible to integrate signed values in .if .elseif style s< s> s<= s>= ?
At present not, "match" does not seem to support symbols as s< s> s<= s>= ( but it is maybe I who badly use him )
I use a lot signed values and I made macro separate .ifs and .elseifs with the same unsigned symbols < > <= >= as .if and .elseif.
( Some are going to say to me that I can use l, le,g, ge ......OK OK )

Friendly...AsmGges
Post 14 Dec 2005, 14:20
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 14 Dec 2005, 15:29
Code:
if (value1+(1 shl 63))<(value2+(1 shl 63))
if (value1+(1 shl 63))>(value2+(1 shl 63))
if (value1+(1 shl 63))<=(value2+(1 shl 63))
if (value1+(1 shl 63))>=(value2+(1 shl 63))    
Post 14 Dec 2005, 15:29
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 14 Dec 2005, 18:02
"s<"? What language comes it from?
Post 14 Dec 2005, 18:02
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 14 Dec 2005, 18:49
learn about "match{}" feature to achieve that. But rather thing if it is really nescessary.
Post 14 Dec 2005, 18:49
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 15 Dec 2005, 09:31
asmgges wrote:
Hi ! Very Happy

Possible to integrate signed values in .if .elseif style s< s> s<= s>= ?
At present not, "match" does not seem to support symbols as s< s> s<= s>= ( but it is maybe I who badly use him )
I use a lot signed values and I made macro separate .ifs and .elseifs with the same unsigned symbols < > <= >= as .if and .elseif.
( Some are going to say to me that I can use l, le,g, ge ......OK OK )

Friendly...AsmGges


you meant,
s<0
s>0
no?
Post 15 Dec 2005, 09:31
View user's profile Send private message Visit poster's website Reply with quote
asmgges



Joined: 17 Jun 2003
Posts: 86
Location: France
asmgges 15 Dec 2005, 19:31
Hi! Matrix Very Happy
I am going to try to be clear (with my poor English it is not sure)
In Fasm you have the hlls of comparisons .if .elseif .until .while with JNCOND who authorizes you this (and a little more still) but I write just the concerned parts

Code:
.if value1 = value2
;or
.if value1,e,value2

.if value1 <> value2
;or
.if value1,ne,value2

;Unsigned
.if value1 < value2
;or
.if value1,b,value2

.if value1 <= value2
;or
.if value1,be,value2

.if value1 > value2
;or
.if value1,a,value2

.if value1 >= value2
;or
.if value1,ae,value2

;Signed
.if value1,l,value2
.if value1,le,value2
.if value1,g,value2
.if value1,ge,value2
    

I would like to be able to replace the signed conditions , l , le , g , ge, by the symbolic of replacements:
s< s<= s> s>=
As see below:

Code:
;Signed
;;;;;;;.if value1,l,value2
.if value1 s< value2

;;;;;;;.if value1,le,value2
.if value1 s<= value2

;;;;;;;.if value1,g,value2
.if value1 s> value2

;;;;;;;.if value1,ge,value2
.if value1 s>= value2
    

I did not find how to make to integrate in JNCOND
I redefined others macros as .if_signed and friends with JNCONDSIGNED and the same symbolism as the unsigned values.
Code:
.if_signed value1 < value2   ; l
.if_signed value1 <= value2  ; le
.if_signed value1 > value2   ; g
.if_signed value1 >= value2  ; ge


; Signed
; .if_signed v1 cond v2     cond:  <  <=  >  >= 
macro .if_signed [arg]
{   common
    __IF equ
    local ..endif
    __ENDIF equ ..endif
    local ..else
    __ELSE equ ..else
    JNCONDSIGNED __ELSE,arg   }   

macro JNCONDSIGNED label,[conds]
{   common
    match =CONDS v1>==v2, CONDS conds     ;>=
    \{  cmp v1,v2
        jl label
        CONDS equ  \}
    match =CONDS v1<==v2, CONDS conds     ;<=
    \{  cmp v1,v2
        jg label
        CONDS equ  \}
    match =CONDS v1>v2, CONDS conds       ;>
    \{  cmp v1,v2
        jle label
        CONDS equ  \}
    match =CONDS v1<v2, CONDS conds       ;<
    \{  cmp v1,v2
        jge label
        CONDS equ  \}
    restore CONDS   }              
    

But do not waste your time resolving this minor problem Very Happy
Friendly...AsmGges
Post 15 Dec 2005, 19:31
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 15 Dec 2005, 19:46
You can integrate it into JNCOND like this:
Code:
 match =COND v1=s>v2, COND cond
 \{
   cmp v1,v2
   jle label
   COND equ
 \}
 match =COND v1>v2, COND cond
 \{
   cmp v1,v2
   jbe label
   COND equ
 \}    

Read more about "match" directive to learn how it works.
Post 15 Dec 2005, 19:46
View user's profile Send private message Visit poster's website Reply with quote
asmgges



Joined: 17 Jun 2003
Posts: 86
Location: France
asmgges 16 Dec 2005, 10:11
Hi! Very Happy

Tomasz wrote
Quote:

"s<"? What language comes it from?

Euh! euh! Bof.... Seen in another life and on another planet ...
I am maybe one similar parent of the kind extraterrestrial ET
Or born over MARS.
Or I maybe sucked too much chocolate bar of the same name in my youth..... Wink

More seriously,thanks for solution,run fine,add this block in beginning of JNCOND
Code:
macro JNCOND label,[cond]
{   common
    match =COND v1=s>==v2, COND cond  ; symbol s>=
    \{  cmp v1,v2
        jl label
        COND equ  \}
    match =COND v1=s<==v2, COND cond  ; symbol s<=
    \{  cmp v1,v2
        jg label
        COND equ  \}
    match =COND v1=s<v2, COND cond    ; symbol s<
    \{  cmp v1,v2
        jge label
        COND equ  \}
    match =COND v1=s>v2, COND cond    ; symbol s>
    \{  cmp v1,v2
        jle label
        COND equ  \}                 
    

Friendly...AsmGges
Post 16 Dec 2005, 10:11
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 16 Dec 2005, 11:20
Hello Asmgges,
So now do these macros work with signed values? Good work! So add this code to the JCOND block?, without over-writing anything else?
Post 16 Dec 2005, 11:20
View user's profile Send private message Reply with quote
asmgges



Joined: 17 Jun 2003
Posts: 86
Location: France
asmgges 16 Dec 2005, 14:01
Hi ! madmatt Very Happy

Yes just over-writing
I made many tests.
Seem very well to work.

Friendly...AsmGges
Post 16 Dec 2005, 14:01
View user's profile Send private message Visit poster's website 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.