flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > FASMG: push_regs |
Author |
|
Tomasz Grysztar 02 May 2023, 16:06
If your multiple arguments are always going to be plain names, you can split them with a simple MATCH in a loop, like this:
Code: calminstruction push? sequence*& local item loop: match item sequence?, sequence jno done ; if match failed, the remaining sequence was empty arrange item, =str item, [=sp, -8]! assemble item jump loop done: end calminstruction |
|||
02 May 2023, 16:06 |
|
alorent 02 May 2023, 17:03
Thanks Tomasz! It worked great!
I just realized that the stack needs to be 16-byte aligned, so the ideal would be to insert two registers at once, like: Code: stp x1, x2, [sp, 16]! I'm not sure if that could be covered in fasmg where I read "pairs" of parameters, so something like: Code: push x1 x2 x3 x4 would generate: Code: stp x1, x2, [sp, 16]! stp x3, x4, [sp, 16]! Thanks again! |
|||
02 May 2023, 17:03 |
|
Tomasz Grysztar 02 May 2023, 17:15
Just code the loop accordingly:
Code: calminstruction push? sequence*& local item, item2 loop: match item sequence?, sequence jno done match item2 sequence?, sequence jno single arrange item, =stp item, item2, [=sp, 16]! assemble item jump loop single: arrange item, =str item, [=sp, -8]! assemble item done: end calminstruction |
|||
02 May 2023, 17:15 |
|
alorent 02 May 2023, 20:33
Amazing Tomasz!
Thanks a million! |
|||
02 May 2023, 20:33 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.