flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > complex struct. How do ? |
| Author |
|
|
Roman 10 Aug 2026, 16:53
Code: struc affaf [x] { .x dd 0 } struct frettt life affaf x,y,z ;fasm error alredy defined frettt.life.x ends jumpii frettt |
|||
|
|
Roman 10 Aug 2026, 17:11
I try this but error
Code: struc affaf x { irp r,x \{ ;display r r dd 0 \} } struct frettt life affaf <.x,.y,.z> ends jumpii frettt mov [jumpii.life.x],1 ;undefined jumpii.life.x mov [jumpii.life.y],2 ;undefined jumpii.life.y |
|||
|
|
Roman 10 Aug 2026, 17:23
This work !
Code: struc affaf pp { irp r,pp \{ ;display pp r dd 0 \} } struc frettt { .x affaf <.life.x,.life.y,.life.z> } jumpii frettt ;in code mov [jumpii.life.x],1 mov [jumpii.life.y],2 mov [jumpii.life.z],3 mov [jumpii.x],3 ;= mov [jumpii.life.x],3 |
|||
|
|
Roman 11 Aug 2026, 04:36
Code: macro zero@Struct ss { local up mov eax,ss#.bgn up: if ss#.Type = 1 mov dword [eax],0 add eax,4 end if if ss#.Type = 0 ;byte mov byte [eax],0 inc eax end if if ss#.Type = 2 mov dword [eax],1.0 add eax,4 end if cmp eax,ss#.end jnz up } macro cs@. v,n { if v#.Type = 1 mov dword [v],n end if if v#.Type = 0 mov byte [v],n end if if v#.Type = 2 mov dword [v],n#f end if } struc csafint pp { irp r,pp \{ ;display pp r dd 0 r\#\.Type equ 1 \} } struc csafbyte pp { irp r,pp \{ r db 0 r\#\.Type equ 0 \} } struc csaflt pp { irp r,pp \{ ;display pp r dd 0 r\#\.Type equ 2 \} } macro mmm@cs4 v,e { v#.bgn csaflt <v#.x,v#.y,v#.z,v#.w> v#.end: v#.Type equ e } struc complexStructF { .life.bgn csafint <.life.x,.life.y> .life.end: .life.Type equ 1 ;int .pos.bgn csaflt <.pos.x,.pos.y,.pos.z> .pos.end: .pos.Type equ 2 ;float mmm@cs4 .quat,2 } jumpii complexStructF mov eax,jumpii.life.x.Type mov eax,jumpii.pos.x.Type cs@. jumpii.life.x , 2 cs@. jumpii.pos.z , 2 zero@Struct jumpii.life zero@Struct jumpii.pos |
|||
|
|
macomics 11 Aug 2026, 16:25
Code: struc A [x] { .#\.#x dd 0 } struc B { .life A x,y,z } C B mov dword [C.life.x], eax mov [C.life.y], eax mov [C.life.z], eax |
|||
|
|
Roman 12 Aug 2026, 04:33
Thanks macomics. Good variant.
I rewrited to my solution. Code: struc cssA [x] { .#\.#x dd 0 .#\.#x#\.Type equ 2 } struc cssB { .life.bgn: .life cssA x,y,z,w,d,g .life.end: .life.Type equ 2 } ;in code new cssB |
|||
|
|
Roman 12 Aug 2026, 07:56
I want do macro. But error
Code: macro m@cs obj { ;display obj match a,obj \{ a \} } macro mInc {inc dword [eax] } struc cssB { .life.bgn: .life cssA x,y,z,w,d,g .life.end: .life.Type equ 2 .life.macro equ mInc } ;in code i do jj cssB m@cs jj.life.macro ;i want get inc dword [eax]. but get fasm error |
|||
|
|
macomics 12 Aug 2026, 15:26
Code: struc cssA [x] { .#\.#x dd 0 .#\.#x#\.#Type equ 2 ;^ ^ ^ ^ ^- Type ;| | | +- \. = '.' ;| | +- 'x' or 'y' or 'z' or 'w' or 'd' or 'g' ;| +- \. = '.' ;+- jj.life ; jj.life.x.Type } macro m@cs obj { ;display obj match a,obj \{ a \} } macro mInc {inc dword [eax] } struc cssB { .life.bgn: .life cssA x,y,z,w,d,g .life.end: .life.Type equ 2 .life.macro equ mInc } ;in code i do jj cssB m@cs jj.life.macro bash wrote:
Code: inc dword [eax] ; 67 66 ff 00 |
|||
|
|
macomics 12 Aug 2026, 15:36
bash wrote:
|
|||
|
|
Roman 12 Aug 2026, 18:56
Thanks.
Now compiled fine. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.