Code blocks as macro arguments #228
-
|
This is the code of an example i wrote for my audio processor: It's supposed to assemble into: To define it, i've tried (in a However, it doesnt work. How do i specify a code block (compiled into an int, kinda like with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
We don't have proper macros yet, but you can use an #ruledef
{
push_counter {times: u4} => 0x8 @ times
callw {address: u16} => 0xaa @ address
djnz {address: u16} => 0xbb @ address
emit {x} => x
rep {times: u4} {code} => asm {
loop:
push_counter {times}
emit {code}
djnz loop
}
}
pattern1:
#d 0xabcd
rep 4 asm {
callw pattern1
} |
Beta Was this translation helpful? Give feedback.
We don't have proper macros yet, but you can use an
asm { }block to compile code into an integer, as you mentioned.Here's a setup I made which also incorporates the loop mechanics. I had to create a helper
emitinstruction, because we also still can't use#dblocks insideasmblocks.