Skip to content
Discussion options

You must be logged in to vote

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 emit instruction, because we also still can't use #d blocks inside asm blocks.

#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
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fmixolydian
Comment options

Answer selected by fmixolydian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants