flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Compact data generation. |
Author |
|
Roman 29 Jun 2022, 10:07
I try first step. Like this.
Code: macro PDat chN,chB,chDup { chN: .#chB: d#chDup dup (0) } macro PDat_ chB,chDup { .#chB: d#chDup dup (0) } ;in section data write PDat Tom,buffer,d 20 PDat_ name,b 64 PDat_ flags,b 3 ;in code mov eax,Tom.flags mov ebx,Tom.name How union PDat and PDat_ in one macro PackData ? Or give PDat_ more params than two. PDat_ name,b 64,flags,b 3 Last edited by Roman on 29 Jun 2022, 11:04; edited 3 times in total |
|||
29 Jun 2022, 10:07 |
|
macomics 29 Jun 2022, 10:37
Code: struc PackedData { .proc dq ?, ? ; or 0, 0 .buffer dd 40 dup ? .name db 64 dup ? .flags db 3 dup ? } ;in section data write Tom PackedData Ron PackedData ;in code mov rax, [Tom.proc] lea rdx, [Ron.buffer] mov rcx, Tom.flags - Ron.flags |
|||
29 Jun 2022, 10:37 |
|
Roman 29 Jun 2022, 10:50
Nice tricky.
But idea get different size Tom and Ron. And different numbers .name or .name2 or .name3 or buffer1,buffer2 If i want do this ? Code: PackData Tom,proc,q2,buffer,d40,name,b64,flags,b3 PackData Ron,proc,q2,buffer,d120,name,b64,flags,b3,name2,b128 ;macro PackData do this Tom: .proc: dq 2 dup (0) .buffer: dd 40 dup (0) .name: db 64 dup (0) .flags: db 3 dup (0) Ron: .proc: dq 2 dup (0) .buffer: dd 120 dup (0) .name: db 64 dup (0) .flags: db 3 dup (0) .name2: db 128 dup (0) |
|||
29 Jun 2022, 10:50 |
|
macomics 29 Jun 2022, 11:11
Code: struc PackedData proc*, buffer*, name*, flags*, other { .proc d#proc dup 0 .buffer d#buffer dup 0 .name d#name dup 0 .flags d#flags dup 0 match any, other \{ .other d#other dup 0 \} } ;in section data write Tom PackedData q 2, d 40, b 64, b 3 Ron PackedData q 2, d 120, b 64, b 3, b 128 ;in code mov rax, [Tom.proc] lea rdx, [Ron.buffer] mov ecx, Tom.proc - Ron.other Code: struc PackedData proc*, buffer*, name*, flags*, other { .proc proc 0 .buffer buffer 0 .name name 0 .flags flags 0 match any, other \{ .other other 0 \} } ;in section data write Tom PackedData dq 2 dup, dd 40 dup, db 64 dup, db 3 dup Ron PackedData dq 2 dup, dd 120 dup, db 64 dup, db 3 dup, du 128 dup ;in code mov rax, [Tom.proc] lea rdx, [Ron.buffer] mov ecx, Tom.proc - Ron.other |
|||
29 Jun 2022, 11:11 |
|
Roman 29 Jun 2022, 11:19
ok. If i want write this.
I must write new struc PackedData2 proc*, buffer*, name*, flags*, other,other2 ? Code: PackData Ron,proc,q2,buffer,d120,name,b64,flags,b3,name2,b128,buffer2,d36 ;macro PackData do this Ron: .proc: dq 2 dup (0) .buffer: dd 120 dup (0) .name: db 64 dup (0) .flags: db 3 dup (0) .name2: db 128 dup (0) .buffer2: dd 36 and i want get not Ron.other, i want get Ron.name2 ! Or Ron.buffer2 |
|||
29 Jun 2022, 11:19 |
|
macomics 29 Jun 2022, 12:00
Code: struc PackedData [args] { forward match name==value, args \{ \.\#name value 0 \} } Tom PackedData proc=dq 2 dup, buffer=dd 40 dup, name=db 64 dup, flags=db 3 dup Ron PackedData proc=dq 2 dup, buffer=dd 120 dup, name=db 64 dup, flags=db 1 dup, name2=db 100 dup mov eax, Tom.name mov edx, Ron.name2 mov ecx, Ron.name2 - Tom.proc + 100 |
|||
29 Jun 2022, 12:00 |
|
Roman 29 Jun 2022, 12:17
Thanks.
Thats i wanted. |
|||
29 Jun 2022, 12:17 |
|
Roman 29 Jun 2022, 12:22
My variant:
Code: struc ??? [args] { forward match name==value, args \{ \.\#name d\#value dup (0) \} } Ron ??? proc=q 2, buffer=d 40, name=b 64, flags=b 3 |
|||
29 Jun 2022, 12:22 |
|
Roman 29 Jun 2022, 12:51
My question is how get name struc ?
I mean Ron ??? How in struc ??? Get name Ron ? Some how struc know input name ? I want auto apply in end stru Ron.End |
|||
29 Jun 2022, 12:51 |
|
Roman 29 Jun 2022, 13:08
Code: macro ??? chName,[args] { common chName: forward match name==value, args \{ \.\#name d\#value dup (0) \} common chName#.End: chName#.size = chName#.End-chName } ;in data ??? Ron,proc=q 2, buffer=d 5,name=b 64, flags=b 3 |
|||
29 Jun 2022, 13:08 |
|
macomics 29 Jun 2022, 15:15
Code: struc ??? [args] { forward match name==value, args \{ \.\#name d\#value dup (0) \} label .End } Ron ??? proc=q 2, buffer=d 40, name=b 64, flags=b 3 |
|||
29 Jun 2022, 15:15 |
|
Roman 29 Jun 2022, 16:11
Thanks.
Right is this: Code: struc ??? [args] { forward match name==value, args \{ \.\#name d\#value dup (0) \} common label .End } |
|||
29 Jun 2022, 16:11 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.