flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Macroinstructions > How macro understood . or .. ? | 
| Author | 
 | 
| Overclick 09 Mar 2023, 19:27 You can separate locations for different types of data then check it in your macro
 Code: struc point { .x dd ? .y dd ? } struc pointFloat { if 0 .: end if ..x dd ? ..y dd ? } macro Update source,data { if source >= Float ;use float variant else ;use integer variant end if } Mytest point Float = $ ;your float area next to this point Mytest pointFloat Anyway, don't you want to name it more intuitive? )) UpdateFloat pp.x.float ... | |||
|  09 Mar 2023, 19:27 | 
 | 
| Roman 09 Mar 2023, 19:41 Thanks.
 Very cool. | |||
|  09 Mar 2023, 19:41 | 
 | 
| macomics 09 Mar 2023, 19:57 Why divide it into two structures?     Code: struc POINT xdata=?, ydata=? { .x dd xdata ;as integer .y dd ydata ..x dd 1.0 ;as float for macro ..y dd 1.0 ;as float for macro } macro Update base*,source*,data=0 { if base#source >= base#..x mov [base#source], data#f else mov [base#source], data end if } pp POINT 1,1 Update pp,.x,5 ;macro put 5 Update pp,..x,5 ;macro put 5f Last edited by macomics on 09 Mar 2023, 20:10; edited 1 time in total | |||
|  09 Mar 2023, 19:57 | 
 | 
| Overclick 09 Mar 2023, 20:01 macomics, your variant works for one structure only. It's ok but if there some more structures/points  like that it will not.
 Did you check it? match a=.b, source Last edited by Overclick on 09 Mar 2023, 20:03; edited 2 times in total | |||
|  09 Mar 2023, 20:01 | 
 | 
| Roman 09 Mar 2023, 20:02 I do this. Like c++ class    Code: macro Update source,data { if source >= Initz mov eax,data call source end if if source = Float & source < Initz mov [source],data#f ;use float variant end if if source < Float mov [source],data ;use integer variant end if } struc POINT xdata=?, ydata=? { .x dd xdata ;as integer .y dd ydata } struc POINTfl xdata=?, ydata=? { Float = $ if 0 .: end if ..x dd xdata ..y dd ydata } struc POINTintz { Initz = $ if 0 .: end if .i: ;proc xdata add eax,eax ret ;endp } ;data pp POINT 1,1 pp POINTfl 2,3 pp POINTintz ;code Update pp.i,32 ;do call ahhh1 i check in IDA Pro Update pp.x,5 ;put [pp.x],5 Update pp..x,1 ;put [pp..x],1f Last edited by Roman on 09 Mar 2023, 20:12; edited 1 time in total | |||
|  09 Mar 2023, 20:02 | 
 | 
| macomics 09 Mar 2023, 20:11 Overclick wrote: Did you check it? match a=.b, source Roman, only when using relative access to the fields of the structure, this will not work. Code: virtual at rbx pp POINT 1,1 end virtual Update pp.x, 5 Update pp..x, 5 | |||
|  09 Mar 2023, 20:11 | 
 | 
| Overclick 09 Mar 2023, 20:23 Roman you put separators at wrong places
 Code: .data pp POINT 1,1 Float =$ pp POINTfl 2,3 .code Initz =$ pp POINTintz Update pp.i,32 ;do call ahhh1 i check in IDA Pro Update pp.x,5 ;put [pp.x],5 Update pp..x,1 ;put [pp..x],1f | |||
|  09 Mar 2023, 20:23 | 
 | 
| revolution 09 Mar 2023, 21:34 Very confusing!     Roman wrote: 
 Very clear, no confusion, obvious what is intended. Code: Update_integer pp.x,5 ;macro put 5 Update_float pp..x,5 ;macro put 5f Code: mov [pp.x],5 mov [pp..x],5f  | |||
|  09 Mar 2023, 21:34 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.